diff --git a/composer.json b/composer.json index 79a5054e..f38fb510 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "werk365/identitydocuments", "description": "Package to parse identity documents like passports", "license": "GPL-3.0-or-later", - "version": "2.0.4", + "version": "2.0.5", "authors": [ { "name": "Hergen Dillema", @@ -15,7 +15,7 @@ "require": { "google/cloud-vision": "^1.3", "intervention/image": "^2.5", - "illuminate/support": "~5|~6|~7|~8" + "illuminate/support": "~5|~6|~7|~8|~9" }, "require-dev": { "phpunit/phpunit": "^8.0", diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..67ed20b1 --- /dev/null +++ b/composer.lock @@ -0,0 +1,6868 @@ +{ + "_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": "b6342cbab23ca03b586214c7f373c9d5", + "packages": [ + { + "name": "doctrine/inflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^8.2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "vimeo/psalm": "^4.10" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + } + }, + "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": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "homepage": "https://www.doctrine-project.org/projects/inflector.html", + "keywords": [ + "inflection", + "inflector", + "lowercase", + "manipulation", + "php", + "plural", + "singular", + "strings", + "uppercase", + "words" + ], + "support": { + "issues": "https://github.com/doctrine/inflector/issues", + "source": "https://github.com/doctrine/inflector/tree/2.0.4" + }, + "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%2Finflector", + "type": "tidelift" + } + ], + "time": "2021-10-22T20:16:43+00:00" + }, + { + "name": "doctrine/lexer", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" + }, + "type": "library", + "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.3" + }, + "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" + } + ], + "time": "2022-02-28T11:07:21+00:00" + }, + { + "name": "dragonmantank/cron-expression", + "version": "v2.3.1", + "source": { + "type": "git", + "url": "https://github.com/dragonmantank/cron-expression.git", + "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/65b2d8ee1f10915efb3b55597da3404f096acba2", + "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2", + "shasum": "" + }, + "require": { + "php": "^7.0|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.4|^7.0|^8.0|^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-4": { + "Cron\\": "src/Cron/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Chris Tankersley", + "email": "chris@ctankersley.com", + "homepage": "https://github.com/dragonmantank" + } + ], + "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", + "keywords": [ + "cron", + "schedule" + ], + "support": { + "issues": "https://github.com/dragonmantank/cron-expression/issues", + "source": "https://github.com/dragonmantank/cron-expression/tree/v2.3.1" + }, + "funding": [ + { + "url": "https://github.com/dragonmantank", + "type": "github" + } + ], + "time": "2020-10-13T00:52:37+00:00" + }, + { + "name": "egulias/email-validator", + "version": "2.1.25", + "source": { + "type": "git", + "url": "https://github.com/egulias/EmailValidator.git", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^1.0.1", + "php": ">=5.5", + "symfony/polyfill-intl-idn": "^1.10" + }, + "require-dev": { + "dominicsayers/isemail": "^3.0.7", + "phpunit/phpunit": "^4.8.36|^7.5.15", + "satooshi/php-coveralls": "^1.0.1" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Gulias Davis" + } + ], + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": [ + "email", + "emailvalidation", + "emailvalidator", + "validation", + "validator" + ], + "support": { + "issues": "https://github.com/egulias/EmailValidator/issues", + "source": "https://github.com/egulias/EmailValidator/tree/2.1.25" + }, + "funding": [ + { + "url": "https://github.com/egulias", + "type": "github" + } + ], + "time": "2020-12-29T14:50:06+00:00" + }, + { + "name": "firebase/php-jwt", + "version": "v5.5.1", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "83b609028194aa042ea33b5af2d41a7427de80e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/83b609028194aa042ea33b5af2d41a7427de80e6", + "reference": "83b609028194aa042ea33b5af2d41a7427de80e6", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8 <=9" + }, + "suggest": { + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/v5.5.1" + }, + "time": "2021-11-08T20:18:51+00:00" + }, + { + "name": "google/auth", + "version": "v1.18.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-auth-library-php.git", + "reference": "21dd478e77b0634ed9e3a68613f74ed250ca9347" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/21dd478e77b0634ed9e3a68613f74ed250ca9347", + "reference": "21dd478e77b0634ed9e3a68613f74ed250ca9347", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0", + "guzzlehttp/guzzle": "^5.3.1|^6.2.1|^7.0", + "guzzlehttp/psr7": "^1.7|^2.0", + "php": ">=5.4", + "psr/cache": "^1.0|^2.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "guzzlehttp/promises": "0.1.1|^1.3", + "kelvinmo/simplejwt": "^0.2.5|^0.5.1", + "phpseclib/phpseclib": "^2.0.31", + "phpunit/phpunit": "^4.8.36|^5.7", + "sebastian/comparator": ">=1.2.3" + }, + "suggest": { + "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "support": { + "docs": "https://googleapis.github.io/google-auth-library-php/master/", + "issues": "https://github.com/googleapis/google-auth-library-php/issues", + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.18.0" + }, + "time": "2021-08-24T18:03:18+00:00" + }, + { + "name": "google/cloud-core", + "version": "v1.44.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-cloud-php-core.git", + "reference": "72706f7d1824777f42294a3c9ccdaddaad670017" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/72706f7d1824777f42294a3c9ccdaddaad670017", + "reference": "72706f7d1824777f42294a3c9ccdaddaad670017", + "shasum": "" + }, + "require": { + "google/auth": "^1.18", + "guzzlehttp/guzzle": "^5.3|^6.0|^7.0", + "guzzlehttp/promises": "^1.3", + "guzzlehttp/psr7": "^1.7|^2.0", + "monolog/monolog": "^1.1|^2.0", + "php": ">=5.5", + "psr/http-message": "1.0.*", + "rize/uri-template": "~0.3" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "google/common-protos": "^1.0||^2.0", + "google/gax": "^1.9", + "opis/closure": "^3", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "^4.8|^5.0", + "squizlabs/php_codesniffer": "2.*" + }, + "suggest": { + "opis/closure": "May be used to serialize closures to process jobs in the batch daemon. Please require version ^3.", + "symfony/lock": "Required for the Spanner cached based session pool. Please require the following commit: 3.3.x-dev#1ba6ac9" + }, + "bin": [ + "bin/google-cloud-batch" + ], + "type": "library", + "extra": { + "component": { + "id": "cloud-core", + "target": "googleapis/google-cloud-php-core.git", + "path": "Core", + "entry": "src/ServiceBuilder.php" + } + }, + "autoload": { + "psr-4": { + "Google\\Cloud\\Core\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", + "support": { + "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.44.0" + }, + "time": "2022-01-31T21:39:13+00:00" + }, + { + "name": "google/cloud-vision", + "version": "v1.5.4", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-cloud-php-vision.git", + "reference": "450e09ae73885e1863143f48f90f17c48f717e97" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-vision/zipball/450e09ae73885e1863143f48f90f17c48f717e97", + "reference": "450e09ae73885e1863143f48f90f17c48f717e97", + "shasum": "" + }, + "require": { + "google/cloud-core": "^1.43", + "google/gax": "^1.1" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "google/cloud-storage": "^1.12", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "^4.8|^5.0", + "squizlabs/php_codesniffer": "2.*" + }, + "suggest": { + "ext-grpc": "The gRPC extension enables use of the performant gRPC transport", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions.", + "google/cloud-storage": "Annotate images stored in Google Cloud Storage" + }, + "type": "library", + "extra": { + "component": { + "id": "cloud-vision", + "target": "googleapis/google-cloud-php-vision.git", + "path": "Vision", + "entry": "src/VisionClient.php" + } + }, + "autoload": { + "psr-4": { + "Google\\Cloud\\Vision\\": "src", + "GPBMetadata\\Google\\Cloud\\Vision\\": "metadata" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Cloud Vision Client for PHP", + "support": { + "source": "https://github.com/googleapis/google-cloud-php-vision/tree/v1.5.4" + }, + "time": "2022-02-08T21:14:28+00:00" + }, + { + "name": "google/common-protos", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/common-protos-php.git", + "reference": "a1bcb7b37f1fa1c92d65c3c6339fc701a65916ee" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/a1bcb7b37f1fa1c92d65c3c6339fc701a65916ee", + "reference": "a1bcb7b37f1fa1c92d65c3c6339fc701a65916ee", + "shasum": "" + }, + "require": { + "google/protobuf": "^3.6.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36", + "sami/sami": "*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\": "src", + "GPBMetadata\\Google\\": "metadata" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google API Common Protos for PHP", + "homepage": "https://github.com/googleapis/common-protos-php", + "keywords": [ + "google" + ], + "support": { + "issues": "https://github.com/googleapis/common-protos-php/issues", + "source": "https://github.com/googleapis/common-protos-php/tree/2.0.0" + }, + "time": "2022-01-13T20:17:53+00:00" + }, + { + "name": "google/gax", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/gax-php.git", + "reference": "d802c9b40c349f5368f077bfcbc2982e7c31f43c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/gax-php/zipball/d802c9b40c349f5368f077bfcbc2982e7c31f43c", + "reference": "d802c9b40c349f5368f077bfcbc2982e7c31f43c", + "shasum": "" + }, + "require": { + "google/auth": "^1.18.0", + "google/common-protos": "^1.0||^2.0", + "google/grpc-gcp": "^0.2", + "google/protobuf": "^3.12.2", + "grpc/grpc": "^1.13", + "guzzlehttp/promises": "^1.3", + "guzzlehttp/psr7": "^1.7.0||^2", + "php": ">=5.5" + }, + "conflict": { + "ext-protobuf": "<3.7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36", + "squizlabs/php_codesniffer": "3.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\ApiCore\\": "src", + "GPBMetadata\\ApiCore\\": "metadata/ApiCore" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Google API Core for PHP", + "homepage": "https://github.com/googleapis/gax-php", + "keywords": [ + "google" + ], + "support": { + "issues": "https://github.com/googleapis/gax-php/issues", + "source": "https://github.com/googleapis/gax-php/tree/v1.12.0" + }, + "time": "2022-02-24T22:04:47+00:00" + }, + { + "name": "google/grpc-gcp", + "version": "v0.2.0", + "source": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/grpc-gcp-php.git", + "reference": "2465c2273e11ada1e95155aa1e209f3b8f03c314" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GoogleCloudPlatform/grpc-gcp-php/zipball/2465c2273e11ada1e95155aa1e209f3b8f03c314", + "reference": "2465c2273e11ada1e95155aa1e209f3b8f03c314", + "shasum": "" + }, + "require": { + "google/auth": "^1.3", + "google/protobuf": "^v3.3.0", + "grpc/grpc": "^v1.13.0", + "php": ">=5.5.0", + "psr/cache": "^1.0.1||^2.0.0||^3.0.0" + }, + "require-dev": { + "google/cloud-spanner": "^1.7", + "phpunit/phpunit": "4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "Grpc\\Gcp\\": "src/" + }, + "classmap": [ + "src/generated/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "gRPC GCP library for channel management", + "support": { + "issues": "https://github.com/GoogleCloudPlatform/grpc-gcp-php/issues", + "source": "https://github.com/GoogleCloudPlatform/grpc-gcp-php/tree/v0.2.0" + }, + "time": "2021-09-27T22:57:18+00:00" + }, + { + "name": "google/protobuf", + "version": "v3.19.4", + "source": { + "type": "git", + "url": "https://github.com/protocolbuffers/protobuf-php.git", + "reference": "6f0a54186f133aff98f49d0f36a32d4a4f7d4cbd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/6f0a54186f133aff98f49d0f36a32d4a4f7d4cbd", + "reference": "6f0a54186f133aff98f49d0f36a32d4a4f7d4cbd", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8.0" + }, + "suggest": { + "ext-bcmath": "Need to support JSON deserialization" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Protobuf\\": "src/Google/Protobuf", + "GPBMetadata\\Google\\Protobuf\\": "src/GPBMetadata/Google/Protobuf" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "proto library for PHP", + "homepage": "https://developers.google.com/protocol-buffers/", + "keywords": [ + "proto" + ], + "support": { + "issues": "https://github.com/protocolbuffers/protobuf-php/issues", + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.19.4" + }, + "time": "2022-01-28T17:23:32+00:00" + }, + { + "name": "grpc/grpc", + "version": "1.42.0", + "source": { + "type": "git", + "url": "https://github.com/grpc/grpc-php.git", + "reference": "9fa44f104cb92e924d4da547323a97f3d8aca6d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/grpc/grpc-php/zipball/9fa44f104cb92e924d4da547323a97f3d8aca6d4", + "reference": "9fa44f104cb92e924d4da547323a97f3d8aca6d4", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "google/auth": "^v1.3.0" + }, + "suggest": { + "ext-protobuf": "For better performance, install the protobuf C extension.", + "google/protobuf": "To get started using grpc quickly, install the native protobuf library." + }, + "type": "library", + "autoload": { + "psr-4": { + "Grpc\\": "src/lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "gRPC library for PHP", + "homepage": "https://grpc.io", + "keywords": [ + "rpc" + ], + "support": { + "source": "https://github.com/grpc/grpc-php/tree/v1.42.0" + }, + "time": "2021-11-19T08:13:51+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "7.4.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "ee0a041b1760e6a53d2a39c8c34115adc2af2c79" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ee0a041b1760e6a53d2a39c8c34115adc2af2c79", + "reference": "ee0a041b1760e6a53d2a39c8c34115adc2af2c79", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5", + "guzzlehttp/psr7": "^1.8.3 || ^2.1", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "ext-curl": "*", + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.5.5 || ^9.3.5", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.4-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "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": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.4.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2021-12-06T18:43:05+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4 || ^5.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/1.5.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2021-10-22T20:56:57+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/089edd38f5b8abba6cb01567c2a8aaa47cec4c72", + "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.8 || ^9.3.10" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.1.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2021-10-06T17:43:30+00:00" + }, + { + "name": "intervention/image", + "version": "2.7.1", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "744ebba495319501b873a4e48787759c72e3fb8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/744ebba495319501b873a4e48787759c72e3fb8c", + "reference": "744ebba495319501b873a4e48787759c72e3fb8c", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1 || ^2.0", + "php": ">=5.4.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.2", + "phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@olivervogel.com", + "homepage": "http://olivervogel.com/" + } + ], + "description": "Image handling and manipulation library with support for Laravel integration", + "homepage": "http://image.intervention.io/", + "keywords": [ + "gd", + "image", + "imagick", + "laravel", + "thumbnail", + "watermark" + ], + "support": { + "issues": "https://github.com/Intervention/image/issues", + "source": "https://github.com/Intervention/image/tree/2.7.1" + }, + "funding": [ + { + "url": "https://www.paypal.me/interventionphp", + "type": "custom" + }, + { + "url": "https://github.com/Intervention", + "type": "github" + } + ], + "time": "2021-12-16T16:49:26+00:00" + }, + { + "name": "laravel/framework", + "version": "v6.20.44", + "source": { + "type": "git", + "url": "https://github.com/laravel/framework.git", + "reference": "505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/framework/zipball/505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0", + "reference": "505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0", + "shasum": "" + }, + "require": { + "doctrine/inflector": "^1.4|^2.0", + "dragonmantank/cron-expression": "^2.3.1", + "egulias/email-validator": "^2.1.10", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "league/commonmark": "^1.3", + "league/flysystem": "^1.1", + "monolog/monolog": "^1.12|^2.0", + "nesbot/carbon": "^2.31", + "opis/closure": "^3.6", + "php": "^7.2.5|^8.0", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0", + "ramsey/uuid": "^3.7", + "swiftmailer/swiftmailer": "^6.0", + "symfony/console": "^4.3.4", + "symfony/debug": "^4.3.4", + "symfony/finder": "^4.3.4", + "symfony/http-foundation": "^4.3.4", + "symfony/http-kernel": "^4.3.4", + "symfony/polyfill-php73": "^1.17", + "symfony/process": "^4.3.4", + "symfony/routing": "^4.3.4", + "symfony/var-dumper": "^4.3.4", + "tijsverkoyen/css-to-inline-styles": "^2.2.1", + "vlucas/phpdotenv": "^3.3" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "replace": { + "illuminate/auth": "self.version", + "illuminate/broadcasting": "self.version", + "illuminate/bus": "self.version", + "illuminate/cache": "self.version", + "illuminate/config": "self.version", + "illuminate/console": "self.version", + "illuminate/container": "self.version", + "illuminate/contracts": "self.version", + "illuminate/cookie": "self.version", + "illuminate/database": "self.version", + "illuminate/encryption": "self.version", + "illuminate/events": "self.version", + "illuminate/filesystem": "self.version", + "illuminate/hashing": "self.version", + "illuminate/http": "self.version", + "illuminate/log": "self.version", + "illuminate/mail": "self.version", + "illuminate/notifications": "self.version", + "illuminate/pagination": "self.version", + "illuminate/pipeline": "self.version", + "illuminate/queue": "self.version", + "illuminate/redis": "self.version", + "illuminate/routing": "self.version", + "illuminate/session": "self.version", + "illuminate/support": "self.version", + "illuminate/translation": "self.version", + "illuminate/validation": "self.version", + "illuminate/view": "self.version" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.155", + "doctrine/dbal": "^2.6", + "filp/whoops": "^2.8", + "guzzlehttp/guzzle": "^6.3.1|^7.0.1", + "league/flysystem-cached-adapter": "^1.0", + "mockery/mockery": "~1.3.3|^1.4.2", + "moontoast/math": "^1.1", + "orchestra/testbench-core": "^4.8", + "pda/pheanstalk": "^4.0", + "phpunit/phpunit": "^7.5.15|^8.4|^9.3.3", + "predis/predis": "^1.1.1", + "symfony/cache": "^4.3.4" + }, + "suggest": { + "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.155).", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "ext-ftp": "Required to use the Flysystem FTP driver.", + "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", + "ext-memcached": "Required to use the memcache cache driver.", + "ext-pcntl": "Required to use all features of the queue worker.", + "ext-posix": "Required to use all features of the queue worker.", + "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", + "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", + "filp/whoops": "Required for friendly error pages in development (^2.8).", + "guzzlehttp/guzzle": "Required to use the Mailgun mail driver and the ping methods on schedules (^6.3.1|^7.0.1).", + "laravel/tinker": "Required to use the tinker console command (^2.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", + "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", + "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).", + "predis/predis": "Required to use the predis connector (^1.1.2).", + "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0).", + "symfony/cache": "Required to PSR-6 cache bridge (^4.3.4).", + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^1.2).", + "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "autoload": { + "files": [ + "src/Illuminate/Foundation/helpers.php", + "src/Illuminate/Support/helpers.php" + ], + "psr-4": { + "Illuminate\\": "src/Illuminate/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Laravel Framework.", + "homepage": "https://laravel.com", + "keywords": [ + "framework", + "laravel" + ], + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2022-01-12T16:12:12+00:00" + }, + { + "name": "league/commonmark", + "version": "1.6.7", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/commonmark.git", + "reference": "2b8185c13bc9578367a5bf901881d1c1b5bbd09b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/2b8185c13bc9578367a5bf901881d1c1b5bbd09b", + "reference": "2b8185c13bc9578367a5bf901881d1c1b5bbd09b", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^7.1 || ^8.0" + }, + "conflict": { + "scrutinizer/ocular": "1.7.*" + }, + "require-dev": { + "cebe/markdown": "~1.0", + "commonmark/commonmark.js": "0.29.2", + "erusev/parsedown": "~1.0", + "ext-json": "*", + "github/gfm": "0.29.0", + "michelf/php-markdown": "~1.4", + "mikehaertl/php-shellcommand": "^1.4", + "phpstan/phpstan": "^0.12.90", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.2", + "scrutinizer/ocular": "^1.5", + "symfony/finder": "^4.2" + }, + "bin": [ + "bin/commonmark" + ], + "type": "library", + "autoload": { + "psr-4": { + "League\\CommonMark\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and Github-Flavored Markdown (GFM)", + "homepage": "https://commonmark.thephpleague.com", + "keywords": [ + "commonmark", + "flavored", + "gfm", + "github", + "github-flavored", + "markdown", + "md", + "parser" + ], + "support": { + "docs": "https://commonmark.thephpleague.com/", + "issues": "https://github.com/thephpleague/commonmark/issues", + "rss": "https://github.com/thephpleague/commonmark/releases.atom", + "source": "https://github.com/thephpleague/commonmark" + }, + "funding": [ + { + "url": "https://www.colinodell.com/sponsor", + "type": "custom" + }, + { + "url": "https://www.paypal.me/colinpodell/10.00", + "type": "custom" + }, + { + "url": "https://github.com/colinodell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/commonmark", + "type": "tidelift" + } + ], + "time": "2022-01-13T17:18:13+00:00" + }, + { + "name": "league/flysystem", + "version": "1.1.9", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "094defdb4a7001845300334e7c1ee2335925ef99" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/094defdb4a7001845300334e7c1ee2335925ef99", + "reference": "094defdb4a7001845300334e7c1ee2335925ef99", + "shasum": "" + }, + "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.9" + }, + "funding": [ + { + "url": "https://offset.earth/frankdejonge", + "type": "other" + } + ], + "time": "2021-12-09T09:40:50+00:00" + }, + { + "name": "league/mime-type-detection", + "version": "1.9.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/mime-type-detection.git", + "reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/aa70e813a6ad3d1558fc927863d47309b4c23e69", + "reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.2", + "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.9.0" + }, + "funding": [ + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" + } + ], + "time": "2021-11-21T11:48:40+00:00" + }, + { + "name": "monolog/monolog", + "version": "2.4.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "d7fd7450628561ba697b7097d86db72662f54aef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/d7fd7450628561ba697b7097d86db72662f54aef", + "reference": "d7fd7450628561ba697b7097d86db72662f54aef", + "shasum": "" + }, + "require": { + "php": ">=7.2", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" + }, + "provide": { + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^7", + "graylog2/gelf-php": "^1.4.2", + "mongodb/mongodb": "^1.8", + "php-amqplib/php-amqplib": "~2.4 || ^3", + "php-console/php-console": "^3.1.3", + "phpspec/prophecy": "^1.6.1", + "phpstan/phpstan": "^0.12.91", + "phpunit/phpunit": "^8.5", + "predis/predis": "^1.1", + "rollbar/rollbar": "^1.3 || ^2 || ^3", + "ruflin/elastica": ">=0.90@dev", + "swiftmailer/swiftmailer": "^5.3|^6.0" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "https://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/2.4.0" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "time": "2022-03-14T12:44:37+00:00" + }, + { + "name": "nesbot/carbon", + "version": "2.57.0", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "4a54375c21eea4811dbd1149fe6b246517554e78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4a54375c21eea4811dbd1149fe6b246517554e78", + "reference": "4a54375c21eea4811dbd1149fe6b246517554e78", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.1.8 || ^8.0", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" + }, + "require-dev": { + "doctrine/dbal": "^2.0 || ^3.0", + "doctrine/orm": "^2.7", + "friendsofphp/php-cs-fixer": "^3.0", + "kylekatarnls/multi-tester": "^2.0", + "phpmd/phpmd": "^2.9", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.54 || ^1.0", + "phpunit/phpunit": "^7.5.20 || ^8.5.14", + "squizlabs/php_codesniffer": "^3.4" + }, + "bin": [ + "bin/carbon" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-3.x": "3.x-dev", + "dev-master": "2.x-dev" + }, + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "Carbon\\": "src/Carbon/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "https://markido.com" + }, + { + "name": "kylekatarnls", + "homepage": "https://github.com/kylekatarnls" + } + ], + "description": "An API extension for DateTime that supports 281 different languages.", + "homepage": "https://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ], + "support": { + "docs": "https://carbon.nesbot.com/docs", + "issues": "https://github.com/briannesbitt/Carbon/issues", + "source": "https://github.com/briannesbitt/Carbon" + }, + "funding": [ + { + "url": "https://opencollective.com/Carbon", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "type": "tidelift" + } + ], + "time": "2022-02-13T18:13:33+00:00" + }, + { + "name": "opis/closure", + "version": "3.6.3", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/3d81e4309d2a927abbe66df935f4bb60082805ad", + "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0 || ^8.0" + }, + "require-dev": { + "jeremeamia/superclosure": "^2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.6.x-dev" + } + }, + "autoload": { + "files": [ + "functions.php" + ], + "psr-4": { + "Opis\\Closure\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", + "homepage": "https://opis.io/closure", + "keywords": [ + "anonymous functions", + "closure", + "function", + "serializable", + "serialization", + "serialize" + ], + "support": { + "issues": "https://github.com/opis/closure/issues", + "source": "https://github.com/opis/closure/tree/3.6.3" + }, + "time": "2022-01-27T09:35:39+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v9.99.100", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", + "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" + ], + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/random_compat/issues", + "source": "https://github.com/paragonie/random_compat" + }, + "time": "2020-10-15T08:29:30+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" + }, + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.8.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2021-12-04T23:24:31+00:00" + }, + { + "name": "psr/cache", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "shasum": "" + }, + "require": { + "php": ">=8.0.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": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/2.0.0" + }, + "time": "2021-02-03T23:23:37+00:00" + }, + { + "name": "psr/container", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.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.2" + }, + "time": "2021-11-05T16:50:12+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client/tree/master" + }, + "time": "2020-06-29T06:28:15+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "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 interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/master" + }, + "time": "2019-04-30T12:38:16+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "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": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "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" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/log", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "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/2.0.0" + }, + "time": "2021-07-14T16:41:46+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" + ], + "support": { + "source": "https://github.com/php-fig/simple-cache/tree/master" + }, + "time": "2017-10-23T01:57:42+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "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": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "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.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "ramsey/uuid", + "version": "3.9.6", + "source": { + "type": "git", + "url": "https://github.com/ramsey/uuid.git", + "reference": "ffa80ab953edd85d5b6c004f96181a538aad35a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/ffa80ab953edd85d5b6c004f96181a538aad35a3", + "reference": "ffa80ab953edd85d5b6c004f96181a538aad35a3", + "shasum": "" + }, + "require": { + "ext-json": "*", + "paragonie/random_compat": "^1 | ^2 | ^9.99.99", + "php": "^5.4 | ^7.0 | ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "replace": { + "rhumsaa/uuid": "self.version" + }, + "require-dev": { + "codeception/aspect-mock": "^1 | ^2", + "doctrine/annotations": "^1.2", + "goaop/framework": "1.0.0-alpha.2 | ^1 | >=2.1.0 <=2.3.2", + "mockery/mockery": "^0.9.11 | ^1", + "moontoast/math": "^1.1", + "nikic/php-parser": "<=4.5.0", + "paragonie/random-lib": "^2", + "php-mock/php-mock-phpunit": "^0.3 | ^1.1 | ^2.6", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpunit/phpunit": ">=4.8.36 <9.0.0 | >=9.3.0", + "squizlabs/php_codesniffer": "^3.5", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "ext-ctype": "Provides support for PHP Ctype functions", + "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", + "ext-openssl": "Provides the OpenSSL extension for use with the OpenSslGenerator", + "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", + "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", + "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", + "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", + "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Ramsey\\Uuid\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + }, + { + "name": "Marijn Huizendveld", + "email": "marijn.huizendveld@gmail.com" + }, + { + "name": "Thibaud Fabre", + "email": "thibaud@aztech.io" + } + ], + "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", + "homepage": "https://github.com/ramsey/uuid", + "keywords": [ + "guid", + "identifier", + "uuid" + ], + "support": { + "issues": "https://github.com/ramsey/uuid/issues", + "rss": "https://github.com/ramsey/uuid/releases.atom", + "source": "https://github.com/ramsey/uuid", + "wiki": "https://github.com/ramsey/uuid/wiki" + }, + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid", + "type": "tidelift" + } + ], + "time": "2021-09-25T23:07:42+00:00" + }, + { + "name": "rize/uri-template", + "version": "0.3.4", + "source": { + "type": "git", + "url": "https://github.com/rize/UriTemplate.git", + "reference": "2a874863c48d643b9e2e254ab288ec203060a0b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/2a874863c48d643b9e2e254ab288ec203060a0b8", + "reference": "2a874863c48d643b9e2e254ab288ec203060a0b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "Rize\\": "src/Rize" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marut K", + "homepage": "http://twitter.com/rezigned" + } + ], + "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", + "keywords": [ + "RFC 6570", + "template", + "uri" + ], + "support": { + "issues": "https://github.com/rize/UriTemplate/issues", + "source": "https://github.com/rize/UriTemplate/tree/0.3.4" + }, + "funding": [ + { + "url": "https://www.paypal.me/rezigned", + "type": "custom" + }, + { + "url": "https://opencollective.com/rize-uri-template", + "type": "open_collective" + } + ], + "time": "2021-10-09T06:30:16+00:00" + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v6.3.0", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8a5d5072dca8f48460fce2f4131fcc495eec654c", + "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c", + "shasum": "" + }, + "require": { + "egulias/email-validator": "^2.0|^3.1", + "php": ">=7.0.0", + "symfony/polyfill-iconv": "^1.0", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "symfony/phpunit-bridge": "^4.4|^5.4" + }, + "suggest": { + "ext-intl": "Needed to support internationalized email addresses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "https://swiftmailer.symfony.com", + "keywords": [ + "email", + "mail", + "mailer" + ], + "support": { + "issues": "https://github.com/swiftmailer/swiftmailer/issues", + "source": "https://github.com/swiftmailer/swiftmailer/tree/v6.3.0" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/swiftmailer/swiftmailer", + "type": "tidelift" + } + ], + "abandoned": "symfony/mailer", + "time": "2021-10-18T15:26:12+00:00" + }, + { + "name": "symfony/console", + "version": "v4.4.38", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "5a50085bf5460f0c0d60a50b58388c1249826b8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/5a50085bf5460f0c0d60a50b58388c1249826b8a", + "reference": "5a50085bf5460f0c0d60a50b58388c1249826b8a", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2" + }, + "conflict": { + "psr/log": ">=3", + "symfony/dependency-injection": "<3.4", + "symfony/event-dispatcher": "<4.3|>=5", + "symfony/lock": "<4.4", + "symfony/process": "<3.3" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/event-dispatcher": "^4.3", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/var-dumper": "^4.3|^5.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "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": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/console/tree/v4.4.38" + }, + "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": "2022-01-30T21:23:57+00:00" + }, + { + "name": "symfony/css-selector", + "version": "v6.0.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "1955d595c12c111629cc814d3f2a2ff13580508a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/1955d595c12c111629cc814d3f2a2ff13580508a", + "reference": "1955d595c12c111629cc814d3f2a2ff13580508a", + "shasum": "" + }, + "require": { + "php": ">=8.0.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Converts CSS selectors to XPath expressions", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/css-selector/tree/v6.0.3" + }, + "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": "2022-01-02T09:55:41+00:00" + }, + { + "name": "symfony/debug", + "version": "v4.4.37", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "5de6c6e7f52b364840e53851c126be4d71e60470" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/5de6c6e7f52b364840e53851c126be4d71e60470", + "reference": "5de6c6e7f52b364840e53851c126be4d71e60470", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "psr/log": "^1|^2|^3" + }, + "conflict": { + "symfony/http-kernel": "<3.4" + }, + "require-dev": { + "symfony/http-kernel": "^3.4|^4.0|^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "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": "Provides tools to ease debugging PHP code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/debug/tree/v4.4.37" + }, + "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": "2022-01-02T09:41:36+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.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": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.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-07-12T14:48:14+00:00" + }, + { + "name": "symfony/error-handler", + "version": "v4.4.37", + "source": { + "type": "git", + "url": "https://github.com/symfony/error-handler.git", + "reference": "8d80ad881e1ce17979547873d093e3c987a6a629" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/8d80ad881e1ce17979547873d093e3c987a6a629", + "reference": "8d80ad881e1ce17979547873d093e3c987a6a629", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "psr/log": "^1|^2|^3", + "symfony/debug": "^4.4.5", + "symfony/var-dumper": "^4.4|^5.0" + }, + "require-dev": { + "symfony/http-kernel": "^4.4|^5.0", + "symfony/serializer": "^4.4|^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\ErrorHandler\\": "" + }, + "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": "Provides tools to manage errors and ease debugging PHP code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/error-handler/tree/v4.4.37" + }, + "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": "2022-01-02T09:41:36+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v4.4.37", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "3ccfcfb96ecce1217d7b0875a0736976bc6e63dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/3ccfcfb96ecce1217d7b0875a0736976bc6e63dc", + "reference": "3ccfcfb96ecce1217d7b0875a0736976bc6e63dc", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/event-dispatcher-contracts": "^1.1", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/dependency-injection": "<3.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "1.1" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/error-handler": "~3.4|~4.4", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/stopwatch": "^3.4|^4.0|^5.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "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": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.37" + }, + "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": "2022-01-02T09:41:36+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v1.1.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "01e9a4efac0ee33a05dfdf93b346f62e7d0e998c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/01e9a4efac0ee33a05dfdf93b346f62e7d0e998c", + "reference": "01e9a4efac0ee33a05dfdf93b346f62e7d0e998c", + "shasum": "" + }, + "require": { + "php": ">=7.1.3" + }, + "suggest": { + "psr/event-dispatcher": "", + "symfony/event-dispatcher-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.1-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.1.11" + }, + "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-03-23T15:25:38+00:00" + }, + { + "name": "symfony/finder", + "version": "v4.4.37", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "b17d76d7ed179f017aad646e858c90a2771af15d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/b17d76d7ed179f017aad646e858c90a2771af15d", + "reference": "b17d76d7ed179f017aad646e858c90a2771af15d", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "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": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v4.4.37" + }, + "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": "2022-01-02T09:41:36+00:00" + }, + { + "name": "symfony/http-client-contracts", + "version": "v2.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "ec82e57b5b714dbb69300d348bd840b345e24166" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/ec82e57b5b714dbb69300d348bd840b345e24166", + "reference": "ec82e57b5b714dbb69300d348bd840b345e24166", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/http-client-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\HttpClient\\": "" + } + }, + "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 HTTP clients", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.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-11-03T09:24:47+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v4.4.39", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "60e8e42a4579551e5ec887d04380e2ab9e4cc314" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/60e8e42a4579551e5ec887d04380e2ab9e4cc314", + "reference": "60e8e42a4579551e5ec887d04380e2ab9e4cc314", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/mime": "^4.3|^5.0", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "predis/predis": "~1.0", + "symfony/expression-language": "^3.4|^4.0|^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "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": "Defines an object-oriented layer for the HTTP specification", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-foundation/tree/v4.4.39" + }, + "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": "2022-03-04T07:06:13+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v4.4.39", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "19d1cacefe81cb448227cc4d5909fb36e2e23081" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/19d1cacefe81cb448227cc4d5909fb36e2e23081", + "reference": "19d1cacefe81cb448227cc4d5909fb36e2e23081", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "psr/log": "^1|^2", + "symfony/error-handler": "^4.4", + "symfony/event-dispatcher": "^4.4", + "symfony/http-client-contracts": "^1.1|^2", + "symfony/http-foundation": "^4.4.30|^5.3.7", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/browser-kit": "<4.3", + "symfony/config": "<3.4", + "symfony/console": ">=5", + "symfony/dependency-injection": "<4.3", + "symfony/translation": "<4.2", + "twig/twig": "<1.43|<2.13,>=2" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/cache": "^1.0|^2.0|^3.0", + "symfony/browser-kit": "^4.3|^5.0", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/console": "^3.4|^4.0", + "symfony/css-selector": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^4.3|^5.0", + "symfony/dom-crawler": "^3.4|^4.0|^5.0", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/finder": "^3.4|^4.0|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/routing": "^3.4|^4.0|^5.0", + "symfony/stopwatch": "^3.4|^4.0|^5.0", + "symfony/templating": "^3.4|^4.0|^5.0", + "symfony/translation": "^4.2|^5.0", + "symfony/translation-contracts": "^1.1|^2", + "twig/twig": "^1.43|^2.13|^3.0.4" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "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": "Provides a structured process for converting a Request into a Response", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-kernel/tree/v4.4.39" + }, + "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": "2022-03-05T21:04:55+00:00" + }, + { + "name": "symfony/mime", + "version": "v5.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/mime.git", + "reference": "e1503cfb5c9a225350f549d3bb99296f4abfb80f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mime/zipball/e1503cfb5c9a225350f549d3bb99296f4abfb80f", + "reference": "e1503cfb5c9a225350f549d3bb99296f4abfb80f", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "egulias/email-validator": "~3.0.0", + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/mailer": "<4.4" + }, + "require-dev": { + "egulias/email-validator": "^2.1.10|^3.1", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/property-access": "^4.4|^5.1|^6.0", + "symfony/property-info": "^4.4|^5.1|^6.0", + "symfony/serializer": "^5.2|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mime\\": "" + }, + "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": "Allows manipulating MIME messages", + "homepage": "https://symfony.com", + "keywords": [ + "mime", + "mime-type" + ], + "support": { + "source": "https://github.com/symfony/mime/tree/v5.4.3" + }, + "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": "2022-01-02T09:53:40+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "30885182c981ab175d4d034db0f6f469898070ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "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": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "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.25.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-10-20T20:35:02+00:00" + }, + { + "name": "symfony/polyfill-iconv", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-iconv.git", + "reference": "f1aed619e28cb077fc83fac8c4c0383578356e40" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/f1aed619e28cb077fc83fac8c4c0383578356e40", + "reference": "f1aed619e28cb077fc83fac8c4c0383578356e40", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-iconv": "*" + }, + "suggest": { + "ext-iconv": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Iconv\\": "" + } + }, + "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 Iconv extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "iconv", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.25.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": "2022-01-04T09:04:05+00:00" + }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "749045c69efb97c70d25d7463abba812e91f3a44" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/749045c69efb97c70d25d7463abba812e91f3a44", + "reference": "749045c69efb97c70d25d7463abba812e91f3a44", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-intl-normalizer": "^1.10", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.25.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-09-14T14:02:44+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "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 for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.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": "symfony/polyfill-mbstring", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.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-11-30T18:21:41+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.25.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-05-27T09:17:38+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.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-06-05T21:20:04+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.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": "2022-03-04T08:16:47+00:00" + }, + { + "name": "symfony/process", + "version": "v4.4.37", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "b2d924e5a4cb284f293d5092b1dbf0d364cb8b67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/b2d924e5a4cb284f293d5092b1dbf0d364cb8b67", + "reference": "b2d924e5a4cb284f293d5092b1dbf0d364cb8b67", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "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": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v4.4.37" + }, + "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": "2022-01-27T17:14:04+00:00" + }, + { + "name": "symfony/routing", + "version": "v4.4.37", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "324f7f73b89cd30012575119430ccfb1dfbc24be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/324f7f73b89cd30012575119430ccfb1dfbc24be", + "reference": "324f7f73b89cd30012575119430ccfb1dfbc24be", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/config": "<4.2", + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "psr/log": "^1|^2|^3", + "symfony/config": "^4.2|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/yaml": "^3.4|^4.0|^5.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "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": "Maps an HTTP request to a set of configuration variables", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "support": { + "source": "https://github.com/symfony/routing/tree/v4.4.37" + }, + "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": "2022-01-02T09:41:36+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.5.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-11-04T16:48:04+00:00" + }, + { + "name": "symfony/translation", + "version": "v4.4.37", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "4ce00d6875230b839f5feef82e51971f6c886e00" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/4ce00d6875230b839f5feef82e51971f6c886e00", + "reference": "4ce00d6875230b839f5feef82e51971f6c886e00", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/translation-contracts": "^1.1.6|^2" + }, + "conflict": { + "symfony/config": "<3.4", + "symfony/dependency-injection": "<3.4", + "symfony/http-kernel": "<4.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "symfony/translation-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/console": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/finder": "~2.8|~3.0|~4.0|^5.0", + "symfony/http-kernel": "^4.4", + "symfony/intl": "^3.4|^4.0|^5.0", + "symfony/service-contracts": "^1.1.2|^2", + "symfony/yaml": "^3.4|^4.0|^5.0" + }, + "suggest": { + "psr/log-implementation": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "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": "Provides tools to internationalize your application", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/translation/tree/v4.4.37" + }, + "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": "2022-01-02T09:41:36+00:00" + }, + { + "name": "symfony/translation-contracts", + "version": "v2.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "d28150f0f44ce854e942b671fc2620a98aae1b1e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/d28150f0f44ce854e942b671fc2620a98aae1b1e", + "reference": "d28150f0f44ce854e942b671fc2620a98aae1b1e", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/translation-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" + } + }, + "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 translation", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v2.5.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-08-17T14:20:01+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v4.4.39", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "35237c5e5dcb6593a46a860ba5b29c1d4683d80e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/35237c5e5dcb6593a46a860ba5b29c1d4683d80e", + "reference": "35237c5e5dcb6593a46a860ba5b29c1d4683d80e", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5", + "symfony/polyfill-php80": "^1.16" + }, + "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|^5.0", + "symfony/process": "^4.4|^5.0", + "twig/twig": "^1.43|^2.13|^3.0.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" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "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": "Provides mechanisms for walking through any arbitrary PHP variable", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v4.4.39" + }, + "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": "2022-02-25T10:38:15+00:00" + }, + { + "name": "tijsverkoyen/css-to-inline-styles", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", + "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/da444caae6aca7a19c0c140f68c6182e337d5b1c", + "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "php": "^5.5 || ^7.0 || ^8.0", + "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "TijsVerkoyen\\CssToInlineStyles\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Tijs Verkoyen", + "email": "css_to_inline_styles@verkoyen.eu", + "role": "Developer" + } + ], + "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", + "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", + "support": { + "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.4" + }, + "time": "2021-12-08T09:12:39+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v3.6.10", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "5b547cdb25825f10251370f57ba5d9d924e6f68e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/5b547cdb25825f10251370f57ba5d9d924e6f68e", + "reference": "5b547cdb25825f10251370f57ba5d9d924e6f68e", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0 || ^8.0", + "phpoption/phpoption": "^1.5.2", + "symfony/polyfill-ctype": "^1.17" + }, + "require-dev": { + "ext-filter": "*", + "ext-pcre": "*", + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator.", + "ext-pcre": "Required to use most of the library." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.6-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://github.com/vlucas" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "support": { + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v3.6.10" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "type": "tidelift" + } + ], + "time": "2021-12-12T23:02:06+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" + }, + "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.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%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-03-03T08:28:38+00:00" + }, + { + "name": "fakerphp/faker", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/FakerPHP/Faker.git", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "doctrine/persistence": "^1.3 || ^2.0", + "ext-intl": "*", + "symfony/phpunit-bridge": "^4.4 || ^5.2" + }, + "suggest": { + "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "v1.19-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/FakerPHP/Faker/issues", + "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" + }, + "time": "2022-02-02T17:38:57+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": "" + }, + "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": "mockery/mockery", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", + "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", + "shasum": "" + }, + "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.5.0" + }, + "time": "2022-01-20T13:18:17+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "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.11.0" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2022-03-03T13:19:32+00:00" + }, + { + "name": "orchestra/testbench", + "version": "v4.18.0", + "source": { + "type": "git", + "url": "https://github.com/orchestral/testbench.git", + "reference": "38d9292f5575a167995fde926612a728d622fe13" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/38d9292f5575a167995fde926612a728d622fe13", + "reference": "38d9292f5575a167995fde926612a728d622fe13", + "shasum": "" + }, + "require": { + "laravel/framework": "^6.20.12", + "mockery/mockery": "^1.3.3 || ^1.4.2", + "orchestra/testbench-core": "^4.18", + "php": ">=7.2 || >=8.0", + "phpunit/phpunit": "^7.5.15 || ^8.4 || ^9.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mior Muhammad Zaki", + "email": "crynobone@gmail.com", + "homepage": "https://github.com/crynobone" + } + ], + "description": "Laravel Testing Helper for Packages Development", + "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", + "keywords": [ + "BDD", + "TDD", + "laravel", + "orchestra-platform", + "orchestral", + "testing" + ], + "support": { + "issues": "https://github.com/orchestral/testbench/issues", + "source": "https://github.com/orchestral/testbench/tree/v4.18.0" + }, + "funding": [ + { + "url": "https://paypal.me/crynobone", + "type": "custom" + }, + { + "url": "https://liberapay.com/crynobone", + "type": "liberapay" + } + ], + "time": "2021-09-08T08:13:21+00:00" + }, + { + "name": "orchestra/testbench-core", + "version": "v4.18.0", + "source": { + "type": "git", + "url": "https://github.com/orchestral/testbench-core.git", + "reference": "6d6ce5e62a25bc796625ed56d4353e8071bf8693" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/6d6ce5e62a25bc796625ed56d4353e8071bf8693", + "reference": "6d6ce5e62a25bc796625ed56d4353e8071bf8693", + "shasum": "" + }, + "require": { + "fakerphp/faker": "^1.9.1", + "php": ">=7.2 || >=8.0" + }, + "require-dev": { + "laravel/framework": "^6.20.14", + "laravel/laravel": "6.x-dev", + "mockery/mockery": "^1.3.3 || ^1.4.2", + "phpunit/phpunit": "^7.5.15 || ^8.4 || ^9.3.3" + }, + "suggest": { + "laravel/framework": "Required for testing (^6.20.12).", + "mockery/mockery": "Allow using Mockery for testing (^1.3.2).", + "orchestra/testbench-browser-kit": "Allow using legacy Laravel BrowserKit for testing (^4.0).", + "orchestra/testbench-dusk": "Allow using Laravel Dusk for testing (^4.0).", + "phpunit/phpunit": "Allow using PHPUnit for testing (^7.5.15|^8.4|^9.3.3)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Orchestra\\Testbench\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mior Muhammad Zaki", + "email": "crynobone@gmail.com", + "homepage": "https://github.com/crynobone" + } + ], + "description": "Testing Helper for Laravel Development", + "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", + "keywords": [ + "BDD", + "TDD", + "laravel", + "orchestra-platform", + "orchestral", + "testing" + ], + "support": { + "issues": "https://github.com/orchestral/testbench/issues", + "source": "https://github.com/orchestral/testbench-core" + }, + "funding": [ + { + "url": "https://paypal.me/crynobone", + "type": "custom" + }, + { + "url": "https://liberapay.com/crynobone", + "type": "liberapay" + } + ], + "time": "2021-09-02T05:33:20+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": "" + }, + "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.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "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.2.1" + }, + "time": "2022-02-21T01:04:05+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": "" + }, + "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.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "shasum": "" + }, + "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", + "psalm/phar": "^4.8" + }, + "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/5.3.0" + }, + "time": "2021-10-19T17:43:47+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*", + "psalm/phar": "^4.8" + }, + "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.6.0" + }, + "time": "2022-01-04T19:58:01+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.2", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^6.0 || ^7.0", + "phpunit/phpunit": "^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.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/v1.15.0" + }, + "time": "2021-12-08T12:19:24+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": "" + }, + "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.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "shasum": "" + }, + "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.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:42:26+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" + ], + "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": "" + }, + "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": "" + }, + "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.24", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "293cb0099d75407d971a73f41e51f35b664667ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/293cb0099d75407d971a73f41e51f35b664667ed", + "reference": "293cb0099d75407d971a73f41e51f35b664667ed", + "shasum": "" + }, + "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.24" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-03-05T16:52:36+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": "" + }, + "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": "" + }, + "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": "" + }, + "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": "" + }, + "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.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^8.5" + }, + "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.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-11-11T13:51:24+00:00" + }, + { + "name": "sebastian/global-state", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "shasum": "" + }, + "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.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-10T06:55:38+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": "" + }, + "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": "" + }, + "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": "" + }, + "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": "" + }, + "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" + } + ], + "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": "" + }, + "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": "" + }, + "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": "sempro/phpunit-pretty-print", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/s360digital/phpunit-pretty-print.git", + "reference": "fa623aa8a17aece4a2b69e54b07a5e37572d1f1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/s360digital/phpunit-pretty-print/zipball/fa623aa8a17aece4a2b69e54b07a5e37572d1f1d", + "reference": "fa623aa8a17aece4a2b69e54b07a5e37572d1f1d", + "shasum": "" + }, + "require": { + "php": ">=7.1.0", + "phpunit/phpunit": "^7 || ^8 || ^9" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16" + }, + "type": "library", + "autoload": { + "psr-4": { + "Sempro\\PHPUnitPrettyPrinter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Prettify PHPUnit output", + "support": { + "issues": "https://github.com/s360digital/phpunit-pretty-print/issues", + "source": "https://github.com/s360digital/phpunit-pretty-print/tree/1.4.0" + }, + "time": "2021-01-04T13:25:10+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": "" + }, + "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": "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": "" + }, + "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": [], + "platform-dev": [], + "plugin-api-version": "2.0.0" +} diff --git a/vendor/autoload.php b/vendor/autoload.php new file mode 100644 index 00000000..950972e1 --- /dev/null +++ b/vendor/autoload.php @@ -0,0 +1,7 @@ + + * 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 +{ + private $vendorDir; + + // 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; + + private static $registeredLoaders = array(); + + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($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); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * 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; + } + + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + 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 new file mode 100644 index 00000000..02e9493a --- /dev/null +++ b/vendor/composer/InstalledVersions.php @@ -0,0 +1,1464 @@ + + array ( + 'pretty_version' => '2.0.5', + 'version' => '2.0.5.0', + 'aliases' => + array ( + ), + 'reference' => NULL, + 'name' => 'werk365/identitydocuments', + ), + 'versions' => + array ( + 'cordoval/hamcrest-php' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'davedevelopment/hamcrest-php' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'doctrine/inflector' => + array ( + 'pretty_version' => '2.0.4', + 'version' => '2.0.4.0', + 'aliases' => + array ( + ), + 'reference' => '8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89', + ), + 'doctrine/instantiator' => + array ( + 'pretty_version' => '1.4.1', + 'version' => '1.4.1.0', + 'aliases' => + array ( + ), + 'reference' => '10dcfce151b967d20fde1b34ae6640712c3891bc', + ), + 'doctrine/lexer' => + array ( + 'pretty_version' => '1.2.3', + 'version' => '1.2.3.0', + 'aliases' => + array ( + ), + 'reference' => 'c268e882d4dbdd85e36e4ad69e02dc284f89d229', + ), + 'dragonmantank/cron-expression' => + array ( + 'pretty_version' => 'v2.3.1', + 'version' => '2.3.1.0', + 'aliases' => + array ( + ), + 'reference' => '65b2d8ee1f10915efb3b55597da3404f096acba2', + ), + 'egulias/email-validator' => + array ( + 'pretty_version' => '2.1.25', + 'version' => '2.1.25.0', + 'aliases' => + array ( + ), + 'reference' => '0dbf5d78455d4d6a41d186da50adc1122ec066f4', + ), + 'fakerphp/faker' => + array ( + 'pretty_version' => 'v1.19.0', + 'version' => '1.19.0.0', + 'aliases' => + array ( + ), + 'reference' => 'd7f08a622b3346766325488aa32ddc93ccdecc75', + ), + 'firebase/php-jwt' => + array ( + 'pretty_version' => 'v5.5.1', + 'version' => '5.5.1.0', + 'aliases' => + array ( + ), + 'reference' => '83b609028194aa042ea33b5af2d41a7427de80e6', + ), + 'google/auth' => + array ( + 'pretty_version' => 'v1.18.0', + 'version' => '1.18.0.0', + 'aliases' => + array ( + ), + 'reference' => '21dd478e77b0634ed9e3a68613f74ed250ca9347', + ), + 'google/cloud-core' => + array ( + 'pretty_version' => 'v1.44.0', + 'version' => '1.44.0.0', + 'aliases' => + array ( + ), + 'reference' => '72706f7d1824777f42294a3c9ccdaddaad670017', + ), + 'google/cloud-vision' => + array ( + 'pretty_version' => 'v1.5.4', + 'version' => '1.5.4.0', + 'aliases' => + array ( + ), + 'reference' => '450e09ae73885e1863143f48f90f17c48f717e97', + ), + 'google/common-protos' => + array ( + 'pretty_version' => '2.0.0', + 'version' => '2.0.0.0', + 'aliases' => + array ( + ), + 'reference' => 'a1bcb7b37f1fa1c92d65c3c6339fc701a65916ee', + ), + 'google/gax' => + array ( + 'pretty_version' => 'v1.12.0', + 'version' => '1.12.0.0', + 'aliases' => + array ( + ), + 'reference' => 'd802c9b40c349f5368f077bfcbc2982e7c31f43c', + ), + 'google/grpc-gcp' => + array ( + 'pretty_version' => 'v0.2.0', + 'version' => '0.2.0.0', + 'aliases' => + array ( + ), + 'reference' => '2465c2273e11ada1e95155aa1e209f3b8f03c314', + ), + 'google/protobuf' => + array ( + 'pretty_version' => 'v3.19.4', + 'version' => '3.19.4.0', + 'aliases' => + array ( + ), + 'reference' => '6f0a54186f133aff98f49d0f36a32d4a4f7d4cbd', + ), + 'grpc/grpc' => + array ( + 'pretty_version' => '1.42.0', + 'version' => '1.42.0.0', + 'aliases' => + array ( + ), + 'reference' => '9fa44f104cb92e924d4da547323a97f3d8aca6d4', + ), + 'guzzlehttp/guzzle' => + array ( + 'pretty_version' => '7.4.1', + 'version' => '7.4.1.0', + 'aliases' => + array ( + ), + 'reference' => 'ee0a041b1760e6a53d2a39c8c34115adc2af2c79', + ), + 'guzzlehttp/promises' => + array ( + 'pretty_version' => '1.5.1', + 'version' => '1.5.1.0', + 'aliases' => + array ( + ), + 'reference' => 'fe752aedc9fd8fcca3fe7ad05d419d32998a06da', + ), + 'guzzlehttp/psr7' => + array ( + 'pretty_version' => '2.1.0', + 'version' => '2.1.0.0', + 'aliases' => + array ( + ), + 'reference' => '089edd38f5b8abba6cb01567c2a8aaa47cec4c72', + ), + 'hamcrest/hamcrest-php' => + array ( + 'pretty_version' => 'v2.0.1', + 'version' => '2.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '8c3d0a3f6af734494ad8f6fbbee0ba92422859f3', + ), + 'illuminate/auth' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/broadcasting' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/bus' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/cache' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/config' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/console' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/container' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/contracts' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/cookie' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/database' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/encryption' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/events' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/filesystem' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/hashing' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/http' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/log' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/mail' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/notifications' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/pagination' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/pipeline' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/queue' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/redis' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/routing' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/session' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/support' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/translation' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/validation' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/view' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'intervention/image' => + array ( + 'pretty_version' => '2.7.1', + 'version' => '2.7.1.0', + 'aliases' => + array ( + ), + 'reference' => '744ebba495319501b873a4e48787759c72e3fb8c', + ), + 'kodova/hamcrest-php' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'laravel/framework' => + array ( + 'pretty_version' => 'v6.20.44', + 'version' => '6.20.44.0', + 'aliases' => + array ( + ), + 'reference' => '505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0', + ), + 'league/commonmark' => + array ( + 'pretty_version' => '1.6.7', + 'version' => '1.6.7.0', + 'aliases' => + array ( + ), + 'reference' => '2b8185c13bc9578367a5bf901881d1c1b5bbd09b', + ), + 'league/flysystem' => + array ( + 'pretty_version' => '1.1.9', + 'version' => '1.1.9.0', + 'aliases' => + array ( + ), + 'reference' => '094defdb4a7001845300334e7c1ee2335925ef99', + ), + 'league/mime-type-detection' => + array ( + 'pretty_version' => '1.9.0', + 'version' => '1.9.0.0', + 'aliases' => + array ( + ), + 'reference' => 'aa70e813a6ad3d1558fc927863d47309b4c23e69', + ), + 'mockery/mockery' => + array ( + 'pretty_version' => '1.5.0', + 'version' => '1.5.0.0', + 'aliases' => + array ( + ), + 'reference' => 'c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac', + ), + 'monolog/monolog' => + array ( + 'pretty_version' => '2.4.0', + 'version' => '2.4.0.0', + 'aliases' => + array ( + ), + 'reference' => 'd7fd7450628561ba697b7097d86db72662f54aef', + ), + 'myclabs/deep-copy' => + array ( + 'pretty_version' => '1.11.0', + 'version' => '1.11.0.0', + 'aliases' => + array ( + ), + 'reference' => '14daed4296fae74d9e3201d2c4925d1acb7aa614', + ), + 'nesbot/carbon' => + array ( + 'pretty_version' => '2.57.0', + 'version' => '2.57.0.0', + 'aliases' => + array ( + ), + 'reference' => '4a54375c21eea4811dbd1149fe6b246517554e78', + ), + 'opis/closure' => + array ( + 'pretty_version' => '3.6.3', + 'version' => '3.6.3.0', + 'aliases' => + array ( + ), + 'reference' => '3d81e4309d2a927abbe66df935f4bb60082805ad', + ), + 'orchestra/testbench' => + array ( + 'pretty_version' => 'v4.18.0', + 'version' => '4.18.0.0', + 'aliases' => + array ( + ), + 'reference' => '38d9292f5575a167995fde926612a728d622fe13', + ), + 'orchestra/testbench-core' => + array ( + 'pretty_version' => 'v4.18.0', + 'version' => '4.18.0.0', + 'aliases' => + array ( + ), + 'reference' => '6d6ce5e62a25bc796625ed56d4353e8071bf8693', + ), + 'paragonie/random_compat' => + array ( + 'pretty_version' => 'v9.99.100', + 'version' => '9.99.100.0', + 'aliases' => + array ( + ), + 'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a', + ), + 'phar-io/manifest' => + array ( + 'pretty_version' => '2.0.3', + 'version' => '2.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '97803eca37d319dfa7826cc2437fc020857acb53', + ), + 'phar-io/version' => + array ( + 'pretty_version' => '3.2.1', + 'version' => '3.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74', + ), + 'phpdocumentor/reflection-common' => + array ( + 'pretty_version' => '2.2.0', + 'version' => '2.2.0.0', + 'aliases' => + array ( + ), + 'reference' => '1d01c49d4ed62f25aa84a747ad35d5a16924662b', + ), + 'phpdocumentor/reflection-docblock' => + array ( + 'pretty_version' => '5.3.0', + 'version' => '5.3.0.0', + 'aliases' => + array ( + ), + 'reference' => '622548b623e81ca6d78b721c5e029f4ce664f170', + ), + 'phpdocumentor/type-resolver' => + array ( + 'pretty_version' => '1.6.0', + 'version' => '1.6.0.0', + 'aliases' => + array ( + ), + 'reference' => '93ebd0014cab80c4ea9f5e297ea48672f1b87706', + ), + 'phpoption/phpoption' => + array ( + 'pretty_version' => '1.8.1', + 'version' => '1.8.1.0', + 'aliases' => + array ( + ), + 'reference' => 'eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15', + ), + 'phpspec/prophecy' => + array ( + 'pretty_version' => 'v1.15.0', + 'version' => '1.15.0.0', + 'aliases' => + array ( + ), + 'reference' => 'bbcd7380b0ebf3961ee21409db7b38bc31d69a13', + ), + 'phpunit/php-code-coverage' => + array ( + 'pretty_version' => '7.0.15', + 'version' => '7.0.15.0', + 'aliases' => + array ( + ), + 'reference' => '819f92bba8b001d4363065928088de22f25a3a48', + ), + 'phpunit/php-file-iterator' => + array ( + 'pretty_version' => '2.0.5', + 'version' => '2.0.5.0', + 'aliases' => + array ( + ), + 'reference' => '42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5', + ), + 'phpunit/php-text-template' => + array ( + 'pretty_version' => '1.2.1', + 'version' => '1.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '31f8b717e51d9a2afca6c9f046f5d69fc27c8686', + ), + 'phpunit/php-timer' => + array ( + 'pretty_version' => '2.1.3', + 'version' => '2.1.3.0', + 'aliases' => + array ( + ), + 'reference' => '2454ae1765516d20c4ffe103d85a58a9a3bd5662', + ), + 'phpunit/php-token-stream' => + array ( + 'pretty_version' => '4.0.4', + 'version' => '4.0.4.0', + 'aliases' => + array ( + ), + 'reference' => 'a853a0e183b9db7eed023d7933a858fa1c8d25a3', + ), + 'phpunit/phpunit' => + array ( + 'pretty_version' => '8.5.24', + 'version' => '8.5.24.0', + 'aliases' => + array ( + ), + 'reference' => '293cb0099d75407d971a73f41e51f35b664667ed', + ), + 'psr/cache' => + array ( + 'pretty_version' => '2.0.0', + 'version' => '2.0.0.0', + 'aliases' => + array ( + ), + 'reference' => '213f9dbc5b9bfbc4f8db86d2838dc968752ce13b', + ), + 'psr/container' => + array ( + 'pretty_version' => '1.1.2', + 'version' => '1.1.2.0', + 'aliases' => + array ( + ), + 'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea', + ), + 'psr/event-dispatcher-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + ), + ), + 'psr/http-client' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', + ), + 'psr/http-client-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + ), + ), + 'psr/http-factory' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be', + ), + 'psr/http-factory-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + ), + ), + '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' => '2.0.0', + 'version' => '2.0.0.0', + 'aliases' => + array ( + ), + 'reference' => 'ef29f6d262798707a9edd554e2b82517ef3a9376', + ), + 'psr/log-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0.0 || 2.0.0 || 3.0.0', + 1 => '1.0|2.0', + ), + ), + 'psr/simple-cache' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b', + ), + 'ralouphie/getallheaders' => + array ( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '120b605dfeb996808c31b6477290a714d356e822', + ), + 'ramsey/uuid' => + array ( + 'pretty_version' => '3.9.6', + 'version' => '3.9.6.0', + 'aliases' => + array ( + ), + 'reference' => 'ffa80ab953edd85d5b6c004f96181a538aad35a3', + ), + 'rhumsaa/uuid' => + array ( + 'replaced' => + array ( + 0 => '3.9.6', + ), + ), + 'rize/uri-template' => + array ( + 'pretty_version' => '0.3.4', + 'version' => '0.3.4.0', + 'aliases' => + array ( + ), + 'reference' => '2a874863c48d643b9e2e254ab288ec203060a0b8', + ), + 'sebastian/code-unit-reverse-lookup' => + array ( + 'pretty_version' => '1.0.2', + 'version' => '1.0.2.0', + 'aliases' => + array ( + ), + 'reference' => '1de8cd5c010cb153fcd68b8d0f64606f523f7619', + ), + 'sebastian/comparator' => + array ( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '1071dfcef776a57013124ff35e1fc41ccd294758', + ), + 'sebastian/diff' => + array ( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '14f72dd46eaf2f2293cbe79c93cc0bc43161a211', + ), + 'sebastian/environment' => + array ( + 'pretty_version' => '4.2.4', + 'version' => '4.2.4.0', + 'aliases' => + array ( + ), + 'reference' => 'd47bbbad83711771f167c72d4e3f25f7fcc1f8b0', + ), + 'sebastian/exporter' => + array ( + 'pretty_version' => '3.1.4', + 'version' => '3.1.4.0', + 'aliases' => + array ( + ), + 'reference' => '0c32ea2e40dbf59de29f3b49bf375176ce7dd8db', + ), + 'sebastian/global-state' => + array ( + 'pretty_version' => '3.0.2', + 'version' => '3.0.2.0', + 'aliases' => + array ( + ), + 'reference' => 'de036ec91d55d2a9e0db2ba975b512cdb1c23921', + ), + 'sebastian/object-enumerator' => + array ( + 'pretty_version' => '3.0.4', + 'version' => '3.0.4.0', + 'aliases' => + array ( + ), + 'reference' => 'e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2', + ), + 'sebastian/object-reflector' => + array ( + 'pretty_version' => '1.1.2', + 'version' => '1.1.2.0', + 'aliases' => + array ( + ), + 'reference' => '9b8772b9cbd456ab45d4a598d2dd1a1bced6363d', + ), + 'sebastian/recursion-context' => + array ( + 'pretty_version' => '3.0.1', + 'version' => '3.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '367dcba38d6e1977be014dc4b22f47a484dac7fb', + ), + 'sebastian/resource-operations' => + array ( + 'pretty_version' => '2.0.2', + 'version' => '2.0.2.0', + 'aliases' => + array ( + ), + 'reference' => '31d35ca87926450c44eae7e2611d45a7a65ea8b3', + ), + 'sebastian/type' => + array ( + 'pretty_version' => '1.1.4', + 'version' => '1.1.4.0', + 'aliases' => + array ( + ), + 'reference' => '0150cfbc4495ed2df3872fb31b26781e4e077eb4', + ), + 'sebastian/version' => + array ( + 'pretty_version' => '2.0.1', + 'version' => '2.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '99732be0ddb3361e16ad77b68ba41efc8e979019', + ), + 'sempro/phpunit-pretty-print' => + array ( + 'pretty_version' => '1.4.0', + 'version' => '1.4.0.0', + 'aliases' => + array ( + ), + 'reference' => 'fa623aa8a17aece4a2b69e54b07a5e37572d1f1d', + ), + 'swiftmailer/swiftmailer' => + array ( + 'pretty_version' => 'v6.3.0', + 'version' => '6.3.0.0', + 'aliases' => + array ( + ), + 'reference' => '8a5d5072dca8f48460fce2f4131fcc495eec654c', + ), + 'symfony/console' => + array ( + 'pretty_version' => 'v4.4.38', + 'version' => '4.4.38.0', + 'aliases' => + array ( + ), + 'reference' => '5a50085bf5460f0c0d60a50b58388c1249826b8a', + ), + 'symfony/css-selector' => + array ( + 'pretty_version' => 'v6.0.3', + 'version' => '6.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '1955d595c12c111629cc814d3f2a2ff13580508a', + ), + 'symfony/debug' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => '5de6c6e7f52b364840e53851c126be4d71e60470', + ), + 'symfony/deprecation-contracts' => + array ( + 'pretty_version' => 'v2.5.0', + 'version' => '2.5.0.0', + 'aliases' => + array ( + ), + 'reference' => '6f981ee24cf69ee7ce9736146d1c57c2780598a8', + ), + 'symfony/error-handler' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => '8d80ad881e1ce17979547873d093e3c987a6a629', + ), + 'symfony/event-dispatcher' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => '3ccfcfb96ecce1217d7b0875a0736976bc6e63dc', + ), + 'symfony/event-dispatcher-contracts' => + array ( + 'pretty_version' => 'v1.1.11', + 'version' => '1.1.11.0', + 'aliases' => + array ( + ), + 'reference' => '01e9a4efac0ee33a05dfdf93b346f62e7d0e998c', + ), + 'symfony/event-dispatcher-implementation' => + array ( + 'provided' => + array ( + 0 => '1.1', + ), + ), + 'symfony/finder' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => 'b17d76d7ed179f017aad646e858c90a2771af15d', + ), + 'symfony/http-client-contracts' => + array ( + 'pretty_version' => 'v2.5.0', + 'version' => '2.5.0.0', + 'aliases' => + array ( + ), + 'reference' => 'ec82e57b5b714dbb69300d348bd840b345e24166', + ), + 'symfony/http-foundation' => + array ( + 'pretty_version' => 'v4.4.39', + 'version' => '4.4.39.0', + 'aliases' => + array ( + ), + 'reference' => '60e8e42a4579551e5ec887d04380e2ab9e4cc314', + ), + 'symfony/http-kernel' => + array ( + 'pretty_version' => 'v4.4.39', + 'version' => '4.4.39.0', + 'aliases' => + array ( + ), + 'reference' => '19d1cacefe81cb448227cc4d5909fb36e2e23081', + ), + 'symfony/mime' => + array ( + 'pretty_version' => 'v5.4.3', + 'version' => '5.4.3.0', + 'aliases' => + array ( + ), + 'reference' => 'e1503cfb5c9a225350f549d3bb99296f4abfb80f', + ), + 'symfony/polyfill-ctype' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => '30885182c981ab175d4d034db0f6f469898070ab', + ), + 'symfony/polyfill-iconv' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => 'f1aed619e28cb077fc83fac8c4c0383578356e40', + ), + 'symfony/polyfill-intl-idn' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => '749045c69efb97c70d25d7463abba812e91f3a44', + ), + 'symfony/polyfill-intl-normalizer' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => '8590a5f561694770bdcd3f9b5c69dde6945028e8', + ), + 'symfony/polyfill-mbstring' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => '0abb51d2f102e00a4eefcf46ba7fec406d245825', + ), + 'symfony/polyfill-php72' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => '9a142215a36a3888e30d0a9eeea9766764e96976', + ), + 'symfony/polyfill-php73' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => 'cc5db0e22b3cb4111010e48785a97f670b350ca5', + ), + 'symfony/polyfill-php80' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => '4407588e0d3f1f52efb65fbe92babe41f37fe50c', + ), + 'symfony/process' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => 'b2d924e5a4cb284f293d5092b1dbf0d364cb8b67', + ), + 'symfony/routing' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => '324f7f73b89cd30012575119430ccfb1dfbc24be', + ), + 'symfony/service-contracts' => + array ( + 'pretty_version' => 'v2.5.0', + 'version' => '2.5.0.0', + 'aliases' => + array ( + ), + 'reference' => '1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc', + ), + 'symfony/translation' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => '4ce00d6875230b839f5feef82e51971f6c886e00', + ), + 'symfony/translation-contracts' => + array ( + 'pretty_version' => 'v2.5.0', + 'version' => '2.5.0.0', + 'aliases' => + array ( + ), + 'reference' => 'd28150f0f44ce854e942b671fc2620a98aae1b1e', + ), + 'symfony/translation-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0|2.0', + ), + ), + 'symfony/var-dumper' => + array ( + 'pretty_version' => 'v4.4.39', + 'version' => '4.4.39.0', + 'aliases' => + array ( + ), + 'reference' => '35237c5e5dcb6593a46a860ba5b29c1d4683d80e', + ), + 'theseer/tokenizer' => + array ( + 'pretty_version' => '1.2.1', + 'version' => '1.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '34a41e998c2183e22995f158c581e7b5e755ab9e', + ), + 'tijsverkoyen/css-to-inline-styles' => + array ( + 'pretty_version' => '2.2.4', + 'version' => '2.2.4.0', + 'aliases' => + array ( + ), + 'reference' => 'da444caae6aca7a19c0c140f68c6182e337d5b1c', + ), + 'vlucas/phpdotenv' => + array ( + 'pretty_version' => 'v3.6.10', + 'version' => '3.6.10.0', + 'aliases' => + array ( + ), + 'reference' => '5b547cdb25825f10251370f57ba5d9d924e6f68e', + ), + 'webmozart/assert' => + array ( + 'pretty_version' => '1.10.0', + 'version' => '1.10.0.0', + 'aliases' => + array ( + ), + 'reference' => '6964c76c7804814a842473e0c8fd15bab0f18e25', + ), + 'werk365/identitydocuments' => + array ( + 'pretty_version' => '2.0.5', + 'version' => '2.0.5.0', + 'aliases' => + array ( + ), + 'reference' => NULL, + ), + ), +); +private static $canGetVendors; +private static $installedByVendor = array(); + + + + + + + +public static function getInstalledPackages() +{ +$packages = array(); +foreach (self::getInstalled() as $installed) { +$packages[] = array_keys($installed['versions']); +} + +if (1 === \count($packages)) { +return $packages[0]; +} + +return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); +} + + + + + + + + + +public static function isInstalled($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (isset($installed['versions'][$packageName])) { +return true; +} +} + +return false; +} + + + + + + + + + + + + + + +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) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +$ranges = array(); +if (isset($installed['versions'][$packageName]['pretty_version'])) { +$ranges[] = $installed['versions'][$packageName]['pretty_version']; +} +if (array_key_exists('aliases', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); +} +if (array_key_exists('replaced', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); +} +if (array_key_exists('provided', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); +} + +return implode(' || ', $ranges); +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getVersion($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +if (!isset($installed['versions'][$packageName]['version'])) { +return null; +} + +return $installed['versions'][$packageName]['version']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getPrettyVersion($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +if (!isset($installed['versions'][$packageName]['pretty_version'])) { +return null; +} + +return $installed['versions'][$packageName]['pretty_version']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getReference($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +if (!isset($installed['versions'][$packageName]['reference'])) { +return null; +} + +return $installed['versions'][$packageName]['reference']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getRootPackage() +{ +$installed = self::getInstalled(); + +return $installed[0]['root']; +} + + + + + + + + +public static function getRawData() +{ +@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + +return self::$installed; +} + + + + + + + +public static function getAllRawData() +{ +return self::getInstalled(); +} + + + + + + + + + + + + + + + + + + + +public static function reload($data) +{ +self::$installed = $data; +self::$installedByVendor = array(); +} + + + + + +private static function getInstalled() +{ +if (null === self::$canGetVendors) { +self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); +} + +$installed = array(); + +if (self::$canGetVendors) { +foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { +if (isset(self::$installedByVendor[$vendorDir])) { +$installed[] = self::$installedByVendor[$vendorDir]; +} elseif (is_file($vendorDir.'/composer/installed.php')) { +$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; +} +} +} + +$installed[] = self::$installed; + +return $installed; +} +} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE new file mode 100644 index 00000000..f27399a0 --- /dev/null +++ b/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +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 new file mode 100644 index 00000000..333db072 --- /dev/null +++ b/vendor/composer/autoload_classmap.php @@ -0,0 +1,677 @@ + $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', + 'GPBMetadata\\GrpcGcp' => $vendorDir . '/google/grpc-gcp/src/generated/GPBMetadata/GrpcGcp.php', + 'Grpc\\Gcp\\AffinityConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig.php', + 'Grpc\\Gcp\\AffinityConfig_Command' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig_Command.php', + 'Grpc\\Gcp\\ApiConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/ApiConfig.php', + 'Grpc\\Gcp\\ChannelPoolConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/ChannelPoolConfig.php', + 'Grpc\\Gcp\\MethodConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/MethodConfig.php', + 'Hamcrest\\Arrays\\IsArray' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php', + 'Hamcrest\\Arrays\\IsArrayContaining' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php', + 'Hamcrest\\Arrays\\IsArrayContainingInAnyOrder' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php', + 'Hamcrest\\Arrays\\IsArrayContainingInOrder' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php', + 'Hamcrest\\Arrays\\IsArrayContainingKey' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php', + 'Hamcrest\\Arrays\\IsArrayContainingKeyValuePair' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php', + 'Hamcrest\\Arrays\\IsArrayWithSize' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayWithSize.php', + 'Hamcrest\\Arrays\\MatchingOnce' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/MatchingOnce.php', + 'Hamcrest\\Arrays\\SeriesMatchingOnce' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php', + 'Hamcrest\\AssertionError' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/AssertionError.php', + 'Hamcrest\\BaseDescription' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseDescription.php', + 'Hamcrest\\BaseMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseMatcher.php', + 'Hamcrest\\Collection\\IsEmptyTraversable' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsEmptyTraversable.php', + 'Hamcrest\\Collection\\IsTraversableWithSize' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsTraversableWithSize.php', + 'Hamcrest\\Core\\AllOf' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AllOf.php', + 'Hamcrest\\Core\\AnyOf' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AnyOf.php', + 'Hamcrest\\Core\\CombinableMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/CombinableMatcher.php', + 'Hamcrest\\Core\\DescribedAs' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/DescribedAs.php', + 'Hamcrest\\Core\\Every' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Every.php', + 'Hamcrest\\Core\\HasToString' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/HasToString.php', + 'Hamcrest\\Core\\Is' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Is.php', + 'Hamcrest\\Core\\IsAnything' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsAnything.php', + 'Hamcrest\\Core\\IsCollectionContaining' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsCollectionContaining.php', + 'Hamcrest\\Core\\IsEqual' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsEqual.php', + 'Hamcrest\\Core\\IsIdentical' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsIdentical.php', + 'Hamcrest\\Core\\IsInstanceOf' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsInstanceOf.php', + 'Hamcrest\\Core\\IsNot' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNot.php', + 'Hamcrest\\Core\\IsNull' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNull.php', + 'Hamcrest\\Core\\IsSame' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsSame.php', + 'Hamcrest\\Core\\IsTypeOf' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsTypeOf.php', + 'Hamcrest\\Core\\Set' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Set.php', + 'Hamcrest\\Core\\ShortcutCombination' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ShortcutCombination.php', + 'Hamcrest\\Description' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Description.php', + 'Hamcrest\\DiagnosingMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/DiagnosingMatcher.php', + 'Hamcrest\\FeatureMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/FeatureMatcher.php', + 'Hamcrest\\Internal\\SelfDescribingValue' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Internal/SelfDescribingValue.php', + 'Hamcrest\\Matcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matcher.php', + 'Hamcrest\\MatcherAssert' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php', + 'Hamcrest\\Matchers' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matchers.php', + 'Hamcrest\\NullDescription' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/NullDescription.php', + 'Hamcrest\\Number\\IsCloseTo' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/IsCloseTo.php', + 'Hamcrest\\Number\\OrderingComparison' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/OrderingComparison.php', + 'Hamcrest\\SelfDescribing' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/SelfDescribing.php', + 'Hamcrest\\StringDescription' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/StringDescription.php', + 'Hamcrest\\Text\\IsEmptyString' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEmptyString.php', + 'Hamcrest\\Text\\IsEqualIgnoringCase' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php', + 'Hamcrest\\Text\\IsEqualIgnoringWhiteSpace' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php', + 'Hamcrest\\Text\\MatchesPattern' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/MatchesPattern.php', + 'Hamcrest\\Text\\StringContains' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContains.php', + 'Hamcrest\\Text\\StringContainsIgnoringCase' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php', + 'Hamcrest\\Text\\StringContainsInOrder' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsInOrder.php', + 'Hamcrest\\Text\\StringEndsWith' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringEndsWith.php', + 'Hamcrest\\Text\\StringStartsWith' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringStartsWith.php', + 'Hamcrest\\Text\\SubstringMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/SubstringMatcher.php', + 'Hamcrest\\TypeSafeDiagnosingMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeDiagnosingMatcher.php', + 'Hamcrest\\TypeSafeMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeMatcher.php', + 'Hamcrest\\Type\\IsArray' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsArray.php', + 'Hamcrest\\Type\\IsBoolean' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsBoolean.php', + 'Hamcrest\\Type\\IsCallable' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsCallable.php', + 'Hamcrest\\Type\\IsDouble' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsDouble.php', + 'Hamcrest\\Type\\IsInteger' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsInteger.php', + 'Hamcrest\\Type\\IsNumeric' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsNumeric.php', + 'Hamcrest\\Type\\IsObject' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsObject.php', + 'Hamcrest\\Type\\IsResource' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsResource.php', + 'Hamcrest\\Type\\IsScalar' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsScalar.php', + 'Hamcrest\\Type\\IsString' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsString.php', + 'Hamcrest\\Util' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php', + 'Hamcrest\\Xml\\HasXPath' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php', + 'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php', + 'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', + 'PHPUnit\\Exception' => $vendorDir . '/phpunit/phpunit/src/Exception.php', + 'PHPUnit\\Framework\\Assert' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert.php', + 'PHPUnit\\Framework\\AssertionFailedError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/AssertionFailedError.php', + 'PHPUnit\\Framework\\CodeCoverageException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/CodeCoverageException.php', + 'PHPUnit\\Framework\\Constraint\\ArrayHasKey' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ArrayHasKey.php', + 'PHPUnit\\Framework\\Constraint\\ArraySubset' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ArraySubset.php', + 'PHPUnit\\Framework\\Constraint\\Attribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Attribute.php', + 'PHPUnit\\Framework\\Constraint\\Callback' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Callback.php', + 'PHPUnit\\Framework\\Constraint\\ClassHasAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php', + 'PHPUnit\\Framework\\Constraint\\ClassHasStaticAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php', + 'PHPUnit\\Framework\\Constraint\\Composite' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Composite.php', + 'PHPUnit\\Framework\\Constraint\\Constraint' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Constraint.php', + 'PHPUnit\\Framework\\Constraint\\Count' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Count.php', + 'PHPUnit\\Framework\\Constraint\\DirectoryExists' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/DirectoryExists.php', + 'PHPUnit\\Framework\\Constraint\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Exception.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionCode' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ExceptionCode.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessage' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessage.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessageRegularExpression' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\FileExists' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/FileExists.php', + 'PHPUnit\\Framework\\Constraint\\GreaterThan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/GreaterThan.php', + 'PHPUnit\\Framework\\Constraint\\IsAnything' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsAnything.php', + 'PHPUnit\\Framework\\Constraint\\IsEmpty' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsEmpty.php', + 'PHPUnit\\Framework\\Constraint\\IsEqual' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsEqual.php', + 'PHPUnit\\Framework\\Constraint\\IsFalse' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsFalse.php', + 'PHPUnit\\Framework\\Constraint\\IsFinite' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsFinite.php', + 'PHPUnit\\Framework\\Constraint\\IsIdentical' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php', + 'PHPUnit\\Framework\\Constraint\\IsInfinite' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsInfinite.php', + 'PHPUnit\\Framework\\Constraint\\IsInstanceOf' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsInstanceOf.php', + 'PHPUnit\\Framework\\Constraint\\IsJson' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsJson.php', + 'PHPUnit\\Framework\\Constraint\\IsNan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsNan.php', + 'PHPUnit\\Framework\\Constraint\\IsNull' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsNull.php', + 'PHPUnit\\Framework\\Constraint\\IsReadable' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsReadable.php', + 'PHPUnit\\Framework\\Constraint\\IsTrue' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsTrue.php', + 'PHPUnit\\Framework\\Constraint\\IsType' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsType.php', + 'PHPUnit\\Framework\\Constraint\\IsWritable' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsWritable.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatches' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatchesErrorMessageProvider' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/JsonMatchesErrorMessageProvider.php', + 'PHPUnit\\Framework\\Constraint\\LessThan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LessThan.php', + 'PHPUnit\\Framework\\Constraint\\LogicalAnd' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LogicalAnd.php', + 'PHPUnit\\Framework\\Constraint\\LogicalNot' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LogicalNot.php', + 'PHPUnit\\Framework\\Constraint\\LogicalOr' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LogicalOr.php', + 'PHPUnit\\Framework\\Constraint\\LogicalXor' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LogicalXor.php', + 'PHPUnit\\Framework\\Constraint\\ObjectHasAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ObjectHasAttribute.php', + 'PHPUnit\\Framework\\Constraint\\RegularExpression' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/RegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\SameSize' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/SameSize.php', + 'PHPUnit\\Framework\\Constraint\\StringContains' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringContains.php', + 'PHPUnit\\Framework\\Constraint\\StringEndsWith' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringEndsWith.php', + 'PHPUnit\\Framework\\Constraint\\StringMatchesFormatDescription' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringMatchesFormatDescription.php', + 'PHPUnit\\Framework\\Constraint\\StringStartsWith' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringStartsWith.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContains' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/TraversableContains.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsEqual' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/TraversableContainsEqual.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsIdentical' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/TraversableContainsIdentical.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsOnly' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/TraversableContainsOnly.php', + 'PHPUnit\\Framework\\CoveredCodeNotExecutedException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/CoveredCodeNotExecutedException.php', + 'PHPUnit\\Framework\\DataProviderTestSuite' => $vendorDir . '/phpunit/phpunit/src/Framework/DataProviderTestSuite.php', + 'PHPUnit\\Framework\\Error\\Deprecated' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Deprecated.php', + 'PHPUnit\\Framework\\Error\\Error' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Error.php', + 'PHPUnit\\Framework\\Error\\Notice' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Notice.php', + 'PHPUnit\\Framework\\Error\\Warning' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Warning.php', + 'PHPUnit\\Framework\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/Exception.php', + 'PHPUnit\\Framework\\ExceptionWrapper' => $vendorDir . '/phpunit/phpunit/src/Framework/ExceptionWrapper.php', + 'PHPUnit\\Framework\\ExpectationFailedException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/ExpectationFailedException.php', + 'PHPUnit\\Framework\\IncompleteTest' => $vendorDir . '/phpunit/phpunit/src/Framework/IncompleteTest.php', + 'PHPUnit\\Framework\\IncompleteTestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/IncompleteTestCase.php', + 'PHPUnit\\Framework\\IncompleteTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/IncompleteTestError.php', + 'PHPUnit\\Framework\\InvalidArgumentException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/InvalidArgumentException.php', + 'PHPUnit\\Framework\\InvalidCoversTargetException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/InvalidCoversTargetException.php', + 'PHPUnit\\Framework\\InvalidDataProviderException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/InvalidDataProviderException.php', + 'PHPUnit\\Framework\\InvalidParameterGroupException' => $vendorDir . '/phpunit/phpunit/src/Framework/InvalidParameterGroupException.php', + 'PHPUnit\\Framework\\MissingCoversAnnotationException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/MissingCoversAnnotationException.php', + 'PHPUnit\\Framework\\MockObject\\Api' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Api/Api.php', + 'PHPUnit\\Framework\\MockObject\\BadMethodCallException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Identity' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\InvocationMocker' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\InvocationStubber' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationStubber.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Match_' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/Match_.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\MethodNameMatch' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/MethodNameMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\ParametersMatch' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Stub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/Stub.php', + 'PHPUnit\\Framework\\MockObject\\ConfigurableMethod' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/ConfigurableMethod.php', + 'PHPUnit\\Framework\\MockObject\\ConfigurableMethodsAlreadyInitializedException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/ConfigurableMethodsAlreadyInitializedException.php', + 'PHPUnit\\Framework\\MockObject\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Generator' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator.php', + 'PHPUnit\\Framework\\MockObject\\IncompatibleReturnValueException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/IncompatibleReturnValueException.php', + 'PHPUnit\\Framework\\MockObject\\Invocation' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Invocation.php', + 'PHPUnit\\Framework\\MockObject\\InvocationHandler' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/InvocationHandler.php', + 'PHPUnit\\Framework\\MockObject\\Matcher' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher.php', + 'PHPUnit\\Framework\\MockObject\\Method' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Api/Method.php', + 'PHPUnit\\Framework\\MockObject\\MethodNameConstraint' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MethodNameConstraint.php', + 'PHPUnit\\Framework\\MockObject\\MockBuilder' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php', + 'PHPUnit\\Framework\\MockObject\\MockClass' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MockClass.php', + 'PHPUnit\\Framework\\MockObject\\MockMethod' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MockMethod.php', + 'PHPUnit\\Framework\\MockObject\\MockMethodSet' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MockMethodSet.php', + 'PHPUnit\\Framework\\MockObject\\MockObject' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MockObject.php', + 'PHPUnit\\Framework\\MockObject\\MockTrait' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MockTrait.php', + 'PHPUnit\\Framework\\MockObject\\MockType' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MockType.php', + 'PHPUnit\\Framework\\MockObject\\MockedCloneMethod' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Api/MockedCloneMethod.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\AnyInvokedCount' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Rule/AnyInvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\AnyParameters' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Rule/AnyParameters.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\ConsecutiveParameters' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Rule/ConsecutiveParameters.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvocationOrder' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Rule/InvocationOrder.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtIndex' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtIndex.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtLeastCount' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtLeastCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtLeastOnce' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtLeastOnce.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtMostCount' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtMostCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedCount' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\MethodName' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Rule/MethodName.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\Parameters' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Rule/Parameters.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\ParametersRule' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Rule/ParametersRule.php', + 'PHPUnit\\Framework\\MockObject\\RuntimeException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php', + 'PHPUnit\\Framework\\MockObject\\Stub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ConsecutiveCalls' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ConsecutiveCalls.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnArgument' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnArgument.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnCallback' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnCallback.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnReference' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnReference.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnSelf' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnSelf.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnStub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnStub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnValueMap' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnValueMap.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\Stub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/Stub.php', + 'PHPUnit\\Framework\\MockObject\\UnmockedCloneMethod' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Api/UnmockedCloneMethod.php', + 'PHPUnit\\Framework\\MockObject\\Verifiable' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Verifiable.php', + 'PHPUnit\\Framework\\NoChildTestSuiteException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/NoChildTestSuiteException.php', + 'PHPUnit\\Framework\\OutputError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/OutputError.php', + 'PHPUnit\\Framework\\PHPTAssertionFailedError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/PHPTAssertionFailedError.php', + 'PHPUnit\\Framework\\RiskyTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/RiskyTestError.php', + 'PHPUnit\\Framework\\SelfDescribing' => $vendorDir . '/phpunit/phpunit/src/Framework/SelfDescribing.php', + 'PHPUnit\\Framework\\SkippedTest' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTest.php', + 'PHPUnit\\Framework\\SkippedTestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTestCase.php', + 'PHPUnit\\Framework\\SkippedTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/SkippedTestError.php', + 'PHPUnit\\Framework\\SkippedTestSuiteError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/SkippedTestSuiteError.php', + 'PHPUnit\\Framework\\SyntheticError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/SyntheticError.php', + 'PHPUnit\\Framework\\SyntheticSkippedError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/SyntheticSkippedError.php', + 'PHPUnit\\Framework\\Test' => $vendorDir . '/phpunit/phpunit/src/Framework/Test.php', + 'PHPUnit\\Framework\\TestBuilder' => $vendorDir . '/phpunit/phpunit/src/Framework/TestBuilder.php', + 'PHPUnit\\Framework\\TestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/TestCase.php', + 'PHPUnit\\Framework\\TestFailure' => $vendorDir . '/phpunit/phpunit/src/Framework/TestFailure.php', + 'PHPUnit\\Framework\\TestListener' => $vendorDir . '/phpunit/phpunit/src/Framework/TestListener.php', + 'PHPUnit\\Framework\\TestListenerDefaultImplementation' => $vendorDir . '/phpunit/phpunit/src/Framework/TestListenerDefaultImplementation.php', + 'PHPUnit\\Framework\\TestResult' => $vendorDir . '/phpunit/phpunit/src/Framework/TestResult.php', + 'PHPUnit\\Framework\\TestSuite' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSuite.php', + 'PHPUnit\\Framework\\TestSuiteIterator' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSuiteIterator.php', + 'PHPUnit\\Framework\\UnintentionallyCoveredCodeError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/UnintentionallyCoveredCodeError.php', + 'PHPUnit\\Framework\\Warning' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/Warning.php', + 'PHPUnit\\Framework\\WarningTestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/WarningTestCase.php', + 'PHPUnit\\Runner\\AfterIncompleteTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterIncompleteTestHook.php', + 'PHPUnit\\Runner\\AfterLastTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterLastTestHook.php', + 'PHPUnit\\Runner\\AfterRiskyTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterRiskyTestHook.php', + 'PHPUnit\\Runner\\AfterSkippedTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterSkippedTestHook.php', + 'PHPUnit\\Runner\\AfterSuccessfulTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterSuccessfulTestHook.php', + 'PHPUnit\\Runner\\AfterTestErrorHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterTestErrorHook.php', + 'PHPUnit\\Runner\\AfterTestFailureHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterTestFailureHook.php', + 'PHPUnit\\Runner\\AfterTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php', + 'PHPUnit\\Runner\\AfterTestWarningHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterTestWarningHook.php', + 'PHPUnit\\Runner\\BaseTestRunner' => $vendorDir . '/phpunit/phpunit/src/Runner/BaseTestRunner.php', + 'PHPUnit\\Runner\\BeforeFirstTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/BeforeFirstTestHook.php', + 'PHPUnit\\Runner\\BeforeTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/BeforeTestHook.php', + 'PHPUnit\\Runner\\DefaultTestResultCache' => $vendorDir . '/phpunit/phpunit/src/Runner/DefaultTestResultCache.php', + 'PHPUnit\\Runner\\Exception' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception.php', + 'PHPUnit\\Runner\\Filter\\ExcludeGroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\Factory' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/Factory.php', + 'PHPUnit\\Runner\\Filter\\GroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/GroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\IncludeGroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\NameFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php', + 'PHPUnit\\Runner\\Hook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/Hook.php', + 'PHPUnit\\Runner\\NullTestResultCache' => $vendorDir . '/phpunit/phpunit/src/Runner/NullTestResultCache.php', + 'PHPUnit\\Runner\\PhptTestCase' => $vendorDir . '/phpunit/phpunit/src/Runner/PhptTestCase.php', + 'PHPUnit\\Runner\\ResultCacheExtension' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCacheExtension.php', + 'PHPUnit\\Runner\\StandardTestSuiteLoader' => $vendorDir . '/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php', + 'PHPUnit\\Runner\\TestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/TestHook.php', + 'PHPUnit\\Runner\\TestListenerAdapter' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/TestListenerAdapter.php', + 'PHPUnit\\Runner\\TestResultCache' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResultCache.php', + 'PHPUnit\\Runner\\TestSuiteLoader' => $vendorDir . '/phpunit/phpunit/src/Runner/TestSuiteLoader.php', + 'PHPUnit\\Runner\\TestSuiteSorter' => $vendorDir . '/phpunit/phpunit/src/Runner/TestSuiteSorter.php', + 'PHPUnit\\Runner\\Version' => $vendorDir . '/phpunit/phpunit/src/Runner/Version.php', + 'PHPUnit\\TextUI\\Command' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command.php', + 'PHPUnit\\TextUI\\Exception' => $vendorDir . '/phpunit/phpunit/src/TextUI/Exception.php', + 'PHPUnit\\TextUI\\Help' => $vendorDir . '/phpunit/phpunit/src/TextUI/Help.php', + 'PHPUnit\\TextUI\\ResultPrinter' => $vendorDir . '/phpunit/phpunit/src/TextUI/ResultPrinter.php', + 'PHPUnit\\TextUI\\TestRunner' => $vendorDir . '/phpunit/phpunit/src/TextUI/TestRunner.php', + 'PHPUnit\\Util\\Annotation\\DocBlock' => $vendorDir . '/phpunit/phpunit/src/Util/Annotation/DocBlock.php', + 'PHPUnit\\Util\\Annotation\\Registry' => $vendorDir . '/phpunit/phpunit/src/Util/Annotation/Registry.php', + 'PHPUnit\\Util\\Blacklist' => $vendorDir . '/phpunit/phpunit/src/Util/Blacklist.php', + 'PHPUnit\\Util\\Color' => $vendorDir . '/phpunit/phpunit/src/Util/Color.php', + 'PHPUnit\\Util\\Configuration' => $vendorDir . '/phpunit/phpunit/src/Util/Configuration.php', + 'PHPUnit\\Util\\ConfigurationGenerator' => $vendorDir . '/phpunit/phpunit/src/Util/ConfigurationGenerator.php', + 'PHPUnit\\Util\\ErrorHandler' => $vendorDir . '/phpunit/phpunit/src/Util/ErrorHandler.php', + 'PHPUnit\\Util\\Exception' => $vendorDir . '/phpunit/phpunit/src/Util/Exception.php', + 'PHPUnit\\Util\\FileLoader' => $vendorDir . '/phpunit/phpunit/src/Util/FileLoader.php', + 'PHPUnit\\Util\\Filesystem' => $vendorDir . '/phpunit/phpunit/src/Util/Filesystem.php', + 'PHPUnit\\Util\\Filter' => $vendorDir . '/phpunit/phpunit/src/Util/Filter.php', + 'PHPUnit\\Util\\Getopt' => $vendorDir . '/phpunit/phpunit/src/Util/Getopt.php', + 'PHPUnit\\Util\\GlobalState' => $vendorDir . '/phpunit/phpunit/src/Util/GlobalState.php', + 'PHPUnit\\Util\\InvalidDataSetException' => $vendorDir . '/phpunit/phpunit/src/Util/InvalidDataSetException.php', + 'PHPUnit\\Util\\Json' => $vendorDir . '/phpunit/phpunit/src/Util/Json.php', + 'PHPUnit\\Util\\Log\\JUnit' => $vendorDir . '/phpunit/phpunit/src/Util/Log/JUnit.php', + 'PHPUnit\\Util\\Log\\TeamCity' => $vendorDir . '/phpunit/phpunit/src/Util/Log/TeamCity.php', + 'PHPUnit\\Util\\PHP\\AbstractPhpProcess' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php', + 'PHPUnit\\Util\\PHP\\DefaultPhpProcess' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/DefaultPhpProcess.php', + 'PHPUnit\\Util\\PHP\\WindowsPhpProcess' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/WindowsPhpProcess.php', + 'PHPUnit\\Util\\Printer' => $vendorDir . '/phpunit/phpunit/src/Util/Printer.php', + 'PHPUnit\\Util\\RegularExpression' => $vendorDir . '/phpunit/phpunit/src/Util/RegularExpression.php', + 'PHPUnit\\Util\\Test' => $vendorDir . '/phpunit/phpunit/src/Util/Test.php', + 'PHPUnit\\Util\\TestDox\\CliTestDoxPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/CliTestDoxPrinter.php', + 'PHPUnit\\Util\\TestDox\\HtmlResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/HtmlResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\NamePrettifier' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php', + 'PHPUnit\\Util\\TestDox\\ResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/ResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\TestDoxPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/TestDoxPrinter.php', + 'PHPUnit\\Util\\TestDox\\TextResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/TextResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\XmlResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/XmlResultPrinter.php', + 'PHPUnit\\Util\\TextTestListRenderer' => $vendorDir . '/phpunit/phpunit/src/Util/TextTestListRenderer.php', + 'PHPUnit\\Util\\Type' => $vendorDir . '/phpunit/phpunit/src/Util/Type.php', + 'PHPUnit\\Util\\VersionComparisonOperator' => $vendorDir . '/phpunit/phpunit/src/Util/VersionComparisonOperator.php', + 'PHPUnit\\Util\\XdebugFilterScriptGenerator' => $vendorDir . '/phpunit/phpunit/src/Util/XdebugFilterScriptGenerator.php', + 'PHPUnit\\Util\\Xml' => $vendorDir . '/phpunit/phpunit/src/Util/Xml.php', + 'PHPUnit\\Util\\XmlTestListRenderer' => $vendorDir . '/phpunit/phpunit/src/Util/XmlTestListRenderer.php', + 'PHP_Token' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_TokenWithScope' => $vendorDir . '/phpunit/php-token-stream/src/TokenWithScope.php', + 'PHP_TokenWithScopeAndVisibility' => $vendorDir . '/phpunit/php-token-stream/src/TokenWithScopeAndVisibility.php', + 'PHP_Token_ABSTRACT' => $vendorDir . '/phpunit/php-token-stream/src/Abstract.php', + 'PHP_Token_AMPERSAND' => $vendorDir . '/phpunit/php-token-stream/src/Ampersand.php', + 'PHP_Token_AND_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/AndEqual.php', + 'PHP_Token_ARRAY' => $vendorDir . '/phpunit/php-token-stream/src/Array.php', + 'PHP_Token_ARRAY_CAST' => $vendorDir . '/phpunit/php-token-stream/src/ArrayCast.php', + 'PHP_Token_AS' => $vendorDir . '/phpunit/php-token-stream/src/As.php', + 'PHP_Token_AT' => $vendorDir . '/phpunit/php-token-stream/src/At.php', + 'PHP_Token_BACKTICK' => $vendorDir . '/phpunit/php-token-stream/src/Backtick.php', + 'PHP_Token_BAD_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/BadCharacter.php', + 'PHP_Token_BOOLEAN_AND' => $vendorDir . '/phpunit/php-token-stream/src/BooleanAnd.php', + 'PHP_Token_BOOLEAN_OR' => $vendorDir . '/phpunit/php-token-stream/src/BooleanOr.php', + 'PHP_Token_BOOL_CAST' => $vendorDir . '/phpunit/php-token-stream/src/BoolCast.php', + 'PHP_Token_BREAK' => $vendorDir . '/phpunit/php-token-stream/src/break.php', + 'PHP_Token_CALLABLE' => $vendorDir . '/phpunit/php-token-stream/src/Callable.php', + 'PHP_Token_CARET' => $vendorDir . '/phpunit/php-token-stream/src/Caret.php', + 'PHP_Token_CASE' => $vendorDir . '/phpunit/php-token-stream/src/Case.php', + 'PHP_Token_CATCH' => $vendorDir . '/phpunit/php-token-stream/src/Catch.php', + 'PHP_Token_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Character.php', + 'PHP_Token_CLASS' => $vendorDir . '/phpunit/php-token-stream/src/Class.php', + 'PHP_Token_CLASS_C' => $vendorDir . '/phpunit/php-token-stream/src/ClassC.php', + 'PHP_Token_CLASS_NAME_CONSTANT' => $vendorDir . '/phpunit/php-token-stream/src/ClassNameConstant.php', + 'PHP_Token_CLONE' => $vendorDir . '/phpunit/php-token-stream/src/Clone.php', + 'PHP_Token_CLOSE_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/CloseBracket.php', + 'PHP_Token_CLOSE_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/CloseCurly.php', + 'PHP_Token_CLOSE_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/CloseSquare.php', + 'PHP_Token_CLOSE_TAG' => $vendorDir . '/phpunit/php-token-stream/src/CloseTag.php', + 'PHP_Token_COALESCE' => $vendorDir . '/phpunit/php-token-stream/src/Coalesce.php', + 'PHP_Token_COALESCE_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/CoalesceEqual.php', + 'PHP_Token_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Colon.php', + 'PHP_Token_COMMA' => $vendorDir . '/phpunit/php-token-stream/src/Comma.php', + 'PHP_Token_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Comment.php', + 'PHP_Token_CONCAT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/ConcatEqual.php', + 'PHP_Token_CONST' => $vendorDir . '/phpunit/php-token-stream/src/Const.php', + 'PHP_Token_CONSTANT_ENCAPSED_STRING' => $vendorDir . '/phpunit/php-token-stream/src/ConstantEncapsedString.php', + 'PHP_Token_CONTINUE' => $vendorDir . '/phpunit/php-token-stream/src/Continue.php', + 'PHP_Token_CURLY_OPEN' => $vendorDir . '/phpunit/php-token-stream/src/CurlyOpen.php', + 'PHP_Token_DEC' => $vendorDir . '/phpunit/php-token-stream/src/Dec.php', + 'PHP_Token_DECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Declare.php', + 'PHP_Token_DEFAULT' => $vendorDir . '/phpunit/php-token-stream/src/Default.php', + 'PHP_Token_DIR' => $vendorDir . '/phpunit/php-token-stream/src/Dir.php', + 'PHP_Token_DIV' => $vendorDir . '/phpunit/php-token-stream/src/Div.php', + 'PHP_Token_DIV_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/DivEqual.php', + 'PHP_Token_DNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/DNumber.php', + 'PHP_Token_DO' => $vendorDir . '/phpunit/php-token-stream/src/Do.php', + 'PHP_Token_DOC_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/DocComment.php', + 'PHP_Token_DOLLAR' => $vendorDir . '/phpunit/php-token-stream/src/Dollar.php', + 'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => $vendorDir . '/phpunit/php-token-stream/src/DollarOpenCurlyBraces.php', + 'PHP_Token_DOT' => $vendorDir . '/phpunit/php-token-stream/src/Dot.php', + 'PHP_Token_DOUBLE_ARROW' => $vendorDir . '/phpunit/php-token-stream/src/DoubleArrow.php', + 'PHP_Token_DOUBLE_CAST' => $vendorDir . '/phpunit/php-token-stream/src/DoubleCast.php', + 'PHP_Token_DOUBLE_COLON' => $vendorDir . '/phpunit/php-token-stream/src/DoubleColon.php', + 'PHP_Token_DOUBLE_QUOTES' => $vendorDir . '/phpunit/php-token-stream/src/DoubleQuotes.php', + 'PHP_Token_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/Echo.php', + 'PHP_Token_ELLIPSIS' => $vendorDir . '/phpunit/php-token-stream/src/Ellipsis.php', + 'PHP_Token_ELSE' => $vendorDir . '/phpunit/php-token-stream/src/Else.php', + 'PHP_Token_ELSEIF' => $vendorDir . '/phpunit/php-token-stream/src/Elseif.php', + 'PHP_Token_EMPTY' => $vendorDir . '/phpunit/php-token-stream/src/Empty.php', + 'PHP_Token_ENCAPSED_AND_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/EncapsedAndWhitespace.php', + 'PHP_Token_ENDDECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Enddeclare.php', + 'PHP_Token_ENDFOR' => $vendorDir . '/phpunit/php-token-stream/src/Endfor.php', + 'PHP_Token_ENDFOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Endforeach.php', + 'PHP_Token_ENDIF' => $vendorDir . '/phpunit/php-token-stream/src/Endif.php', + 'PHP_Token_ENDSWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Endswitch.php', + 'PHP_Token_ENDWHILE' => $vendorDir . '/phpunit/php-token-stream/src/Endwhile.php', + 'PHP_Token_END_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/EndHeredoc.php', + 'PHP_Token_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Equal.php', + 'PHP_Token_EVAL' => $vendorDir . '/phpunit/php-token-stream/src/Eval.php', + 'PHP_Token_EXCLAMATION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/ExclamationMark.php', + 'PHP_Token_EXIT' => $vendorDir . '/phpunit/php-token-stream/src/Exit.php', + 'PHP_Token_EXTENDS' => $vendorDir . '/phpunit/php-token-stream/src/Extends.php', + 'PHP_Token_FILE' => $vendorDir . '/phpunit/php-token-stream/src/File.php', + 'PHP_Token_FINAL' => $vendorDir . '/phpunit/php-token-stream/src/Final.php', + 'PHP_Token_FINALLY' => $vendorDir . '/phpunit/php-token-stream/src/Finally.php', + 'PHP_Token_FN' => $vendorDir . '/phpunit/php-token-stream/src/Fn.php', + 'PHP_Token_FOR' => $vendorDir . '/phpunit/php-token-stream/src/For.php', + 'PHP_Token_FOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Foreach.php', + 'PHP_Token_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/src/Function.php', + 'PHP_Token_FUNC_C' => $vendorDir . '/phpunit/php-token-stream/src/FuncC.php', + 'PHP_Token_GLOBAL' => $vendorDir . '/phpunit/php-token-stream/src/Global.php', + 'PHP_Token_GOTO' => $vendorDir . '/phpunit/php-token-stream/src/Goto.php', + 'PHP_Token_GT' => $vendorDir . '/phpunit/php-token-stream/src/Gt.php', + 'PHP_Token_HALT_COMPILER' => $vendorDir . '/phpunit/php-token-stream/src/HaltCompiler.php', + 'PHP_Token_IF' => $vendorDir . '/phpunit/php-token-stream/src/If.php', + 'PHP_Token_IMPLEMENTS' => $vendorDir . '/phpunit/php-token-stream/src/Implements.php', + 'PHP_Token_INC' => $vendorDir . '/phpunit/php-token-stream/src/Inc.php', + 'PHP_Token_INCLUDE' => $vendorDir . '/phpunit/php-token-stream/src/Include.php', + 'PHP_Token_INCLUDE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/IncludeOnce.php', + 'PHP_Token_INLINE_HTML' => $vendorDir . '/phpunit/php-token-stream/src/InlineHtml.php', + 'PHP_Token_INSTANCEOF' => $vendorDir . '/phpunit/php-token-stream/src/Instanceof.php', + 'PHP_Token_INSTEADOF' => $vendorDir . '/phpunit/php-token-stream/src/Insteadof.php', + 'PHP_Token_INTERFACE' => $vendorDir . '/phpunit/php-token-stream/src/Interface.php', + 'PHP_Token_INT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/IntCast.php', + 'PHP_Token_ISSET' => $vendorDir . '/phpunit/php-token-stream/src/Isset.php', + 'PHP_Token_IS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/IsEqual.php', + 'PHP_Token_IS_GREATER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/IsGreaterOrEqual.php', + 'PHP_Token_IS_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/IsIdentical.php', + 'PHP_Token_IS_NOT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/IsNotEqual.php', + 'PHP_Token_IS_NOT_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/IsNotIdentical.php', + 'PHP_Token_IS_SMALLER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/IsSmallerOrEqual.php', + 'PHP_Token_Includes' => $vendorDir . '/phpunit/php-token-stream/src/Includes.php', + 'PHP_Token_LINE' => $vendorDir . '/phpunit/php-token-stream/src/Line.php', + 'PHP_Token_LIST' => $vendorDir . '/phpunit/php-token-stream/src/List.php', + 'PHP_Token_LNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Lnumber.php', + 'PHP_Token_LOGICAL_AND' => $vendorDir . '/phpunit/php-token-stream/src/LogicalAnd.php', + 'PHP_Token_LOGICAL_OR' => $vendorDir . '/phpunit/php-token-stream/src/LogicalOr.php', + 'PHP_Token_LOGICAL_XOR' => $vendorDir . '/phpunit/php-token-stream/src/LogicalXor.php', + 'PHP_Token_LT' => $vendorDir . '/phpunit/php-token-stream/src/Lt.php', + 'PHP_Token_METHOD_C' => $vendorDir . '/phpunit/php-token-stream/src/MethodC.php', + 'PHP_Token_MINUS' => $vendorDir . '/phpunit/php-token-stream/src/Minus.php', + 'PHP_Token_MINUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/MinusEqual.php', + 'PHP_Token_MOD_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/ModEqual.php', + 'PHP_Token_MULT' => $vendorDir . '/phpunit/php-token-stream/src/Mult.php', + 'PHP_Token_MUL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/MulEqual.php', + 'PHP_Token_NAMESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Namespace.php', + 'PHP_Token_NAME_FULLY_QUALIFIED' => $vendorDir . '/phpunit/php-token-stream/src/NameFullyQualified.php', + 'PHP_Token_NAME_QUALIFIED' => $vendorDir . '/phpunit/php-token-stream/src/NameQualified.php', + 'PHP_Token_NAME_RELATIVE' => $vendorDir . '/phpunit/php-token-stream/src/NameRelative.php', + 'PHP_Token_NEW' => $vendorDir . '/phpunit/php-token-stream/src/New.php', + 'PHP_Token_NS_C' => $vendorDir . '/phpunit/php-token-stream/src/NsC.php', + 'PHP_Token_NS_SEPARATOR' => $vendorDir . '/phpunit/php-token-stream/src/NsSeparator.php', + 'PHP_Token_NUM_STRING' => $vendorDir . '/phpunit/php-token-stream/src/NumString.php', + 'PHP_Token_OBJECT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/ObjectCast.php', + 'PHP_Token_OBJECT_OPERATOR' => $vendorDir . '/phpunit/php-token-stream/src/ObjectOperator.php', + 'PHP_Token_OPEN_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/OpenBracket.php', + 'PHP_Token_OPEN_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/OpenCurly.php', + 'PHP_Token_OPEN_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/OpenSquare.php', + 'PHP_Token_OPEN_TAG' => $vendorDir . '/phpunit/php-token-stream/src/OpenTag.php', + 'PHP_Token_OPEN_TAG_WITH_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/OpenTagWithEcho.php', + 'PHP_Token_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/OrEqual.php', + 'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => $vendorDir . '/phpunit/php-token-stream/src/PaamayimNekudotayim.php', + 'PHP_Token_PERCENT' => $vendorDir . '/phpunit/php-token-stream/src/Percent.php', + 'PHP_Token_PIPE' => $vendorDir . '/phpunit/php-token-stream/src/Pipe.php', + 'PHP_Token_PLUS' => $vendorDir . '/phpunit/php-token-stream/src/Plus.php', + 'PHP_Token_PLUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/PlusEqual.php', + 'PHP_Token_POW' => $vendorDir . '/phpunit/php-token-stream/src/Pow.php', + 'PHP_Token_POW_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/PowEqual.php', + 'PHP_Token_PRINT' => $vendorDir . '/phpunit/php-token-stream/src/Print.php', + 'PHP_Token_PRIVATE' => $vendorDir . '/phpunit/php-token-stream/src/Private.php', + 'PHP_Token_PROTECTED' => $vendorDir . '/phpunit/php-token-stream/src/Protected.php', + 'PHP_Token_PUBLIC' => $vendorDir . '/phpunit/php-token-stream/src/Public.php', + 'PHP_Token_QUESTION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/QuestionMark.php', + 'PHP_Token_REQUIRE' => $vendorDir . '/phpunit/php-token-stream/src/Require.php', + 'PHP_Token_REQUIRE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/RequireOnce.php', + 'PHP_Token_RETURN' => $vendorDir . '/phpunit/php-token-stream/src/Return.php', + 'PHP_Token_SEMICOLON' => $vendorDir . '/phpunit/php-token-stream/src/Semicolon.php', + 'PHP_Token_SL' => $vendorDir . '/phpunit/php-token-stream/src/Sl.php', + 'PHP_Token_SL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/SlEqual.php', + 'PHP_Token_SPACESHIP' => $vendorDir . '/phpunit/php-token-stream/src/Spaceship.php', + 'PHP_Token_SR' => $vendorDir . '/phpunit/php-token-stream/src/Sr.php', + 'PHP_Token_SR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/SrEqual.php', + 'PHP_Token_START_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/StartHeredoc.php', + 'PHP_Token_STATIC' => $vendorDir . '/phpunit/php-token-stream/src/Static.php', + 'PHP_Token_STRING' => $vendorDir . '/phpunit/php-token-stream/src/String.php', + 'PHP_Token_STRING_CAST' => $vendorDir . '/phpunit/php-token-stream/src/StringCast.php', + 'PHP_Token_STRING_VARNAME' => $vendorDir . '/phpunit/php-token-stream/src/StringVarname.php', + 'PHP_Token_SWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Switch.php', + 'PHP_Token_Stream' => $vendorDir . '/phpunit/php-token-stream/src/Stream.php', + 'PHP_Token_Stream_CachingFactory' => $vendorDir . '/phpunit/php-token-stream/src/CachingFactory.php', + 'PHP_Token_THROW' => $vendorDir . '/phpunit/php-token-stream/src/Throw.php', + 'PHP_Token_TILDE' => $vendorDir . '/phpunit/php-token-stream/src/Tilde.php', + 'PHP_Token_TRAIT' => $vendorDir . '/phpunit/php-token-stream/src/Trait.php', + 'PHP_Token_TRAIT_C' => $vendorDir . '/phpunit/php-token-stream/src/TraitC.php', + 'PHP_Token_TRY' => $vendorDir . '/phpunit/php-token-stream/src/Try.php', + 'PHP_Token_UNSET' => $vendorDir . '/phpunit/php-token-stream/src/Unset.php', + 'PHP_Token_UNSET_CAST' => $vendorDir . '/phpunit/php-token-stream/src/UnsetCast.php', + 'PHP_Token_USE' => $vendorDir . '/phpunit/php-token-stream/src/Use.php', + 'PHP_Token_USE_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/src/UseFunction.php', + 'PHP_Token_Util' => $vendorDir . '/phpunit/php-token-stream/src/Util.php', + 'PHP_Token_VAR' => $vendorDir . '/phpunit/php-token-stream/src/Var.php', + 'PHP_Token_VARIABLE' => $vendorDir . '/phpunit/php-token-stream/src/Variable.php', + 'PHP_Token_WHILE' => $vendorDir . '/phpunit/php-token-stream/src/While.php', + 'PHP_Token_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Whitespace.php', + 'PHP_Token_XOR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/XorEqual.php', + 'PHP_Token_YIELD' => $vendorDir . '/phpunit/php-token-stream/src/Yield.php', + 'PHP_Token_YIELD_FROM' => $vendorDir . '/phpunit/php-token-stream/src/YieldFrom.php', + 'PharIo\\Manifest\\Application' => $vendorDir . '/phar-io/manifest/src/values/Application.php', + 'PharIo\\Manifest\\ApplicationName' => $vendorDir . '/phar-io/manifest/src/values/ApplicationName.php', + 'PharIo\\Manifest\\Author' => $vendorDir . '/phar-io/manifest/src/values/Author.php', + 'PharIo\\Manifest\\AuthorCollection' => $vendorDir . '/phar-io/manifest/src/values/AuthorCollection.php', + 'PharIo\\Manifest\\AuthorCollectionIterator' => $vendorDir . '/phar-io/manifest/src/values/AuthorCollectionIterator.php', + 'PharIo\\Manifest\\AuthorElement' => $vendorDir . '/phar-io/manifest/src/xml/AuthorElement.php', + 'PharIo\\Manifest\\AuthorElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/AuthorElementCollection.php', + 'PharIo\\Manifest\\BundledComponent' => $vendorDir . '/phar-io/manifest/src/values/BundledComponent.php', + 'PharIo\\Manifest\\BundledComponentCollection' => $vendorDir . '/phar-io/manifest/src/values/BundledComponentCollection.php', + 'PharIo\\Manifest\\BundledComponentCollectionIterator' => $vendorDir . '/phar-io/manifest/src/values/BundledComponentCollectionIterator.php', + 'PharIo\\Manifest\\BundlesElement' => $vendorDir . '/phar-io/manifest/src/xml/BundlesElement.php', + 'PharIo\\Manifest\\ComponentElement' => $vendorDir . '/phar-io/manifest/src/xml/ComponentElement.php', + 'PharIo\\Manifest\\ComponentElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/ComponentElementCollection.php', + 'PharIo\\Manifest\\ContainsElement' => $vendorDir . '/phar-io/manifest/src/xml/ContainsElement.php', + 'PharIo\\Manifest\\CopyrightElement' => $vendorDir . '/phar-io/manifest/src/xml/CopyrightElement.php', + 'PharIo\\Manifest\\CopyrightInformation' => $vendorDir . '/phar-io/manifest/src/values/CopyrightInformation.php', + 'PharIo\\Manifest\\ElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/ElementCollection.php', + 'PharIo\\Manifest\\ElementCollectionException' => $vendorDir . '/phar-io/manifest/src/exceptions/ElementCollectionException.php', + 'PharIo\\Manifest\\Email' => $vendorDir . '/phar-io/manifest/src/values/Email.php', + 'PharIo\\Manifest\\Exception' => $vendorDir . '/phar-io/manifest/src/exceptions/Exception.php', + 'PharIo\\Manifest\\ExtElement' => $vendorDir . '/phar-io/manifest/src/xml/ExtElement.php', + 'PharIo\\Manifest\\ExtElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/ExtElementCollection.php', + 'PharIo\\Manifest\\Extension' => $vendorDir . '/phar-io/manifest/src/values/Extension.php', + 'PharIo\\Manifest\\ExtensionElement' => $vendorDir . '/phar-io/manifest/src/xml/ExtensionElement.php', + 'PharIo\\Manifest\\InvalidApplicationNameException' => $vendorDir . '/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php', + 'PharIo\\Manifest\\InvalidEmailException' => $vendorDir . '/phar-io/manifest/src/exceptions/InvalidEmailException.php', + 'PharIo\\Manifest\\InvalidUrlException' => $vendorDir . '/phar-io/manifest/src/exceptions/InvalidUrlException.php', + 'PharIo\\Manifest\\Library' => $vendorDir . '/phar-io/manifest/src/values/Library.php', + 'PharIo\\Manifest\\License' => $vendorDir . '/phar-io/manifest/src/values/License.php', + 'PharIo\\Manifest\\LicenseElement' => $vendorDir . '/phar-io/manifest/src/xml/LicenseElement.php', + 'PharIo\\Manifest\\Manifest' => $vendorDir . '/phar-io/manifest/src/values/Manifest.php', + 'PharIo\\Manifest\\ManifestDocument' => $vendorDir . '/phar-io/manifest/src/xml/ManifestDocument.php', + 'PharIo\\Manifest\\ManifestDocumentException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestDocumentException.php', + 'PharIo\\Manifest\\ManifestDocumentLoadingException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestDocumentLoadingException.php', + 'PharIo\\Manifest\\ManifestDocumentMapper' => $vendorDir . '/phar-io/manifest/src/ManifestDocumentMapper.php', + 'PharIo\\Manifest\\ManifestDocumentMapperException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php', + 'PharIo\\Manifest\\ManifestElement' => $vendorDir . '/phar-io/manifest/src/xml/ManifestElement.php', + 'PharIo\\Manifest\\ManifestElementException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestElementException.php', + 'PharIo\\Manifest\\ManifestLoader' => $vendorDir . '/phar-io/manifest/src/ManifestLoader.php', + 'PharIo\\Manifest\\ManifestLoaderException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestLoaderException.php', + 'PharIo\\Manifest\\ManifestSerializer' => $vendorDir . '/phar-io/manifest/src/ManifestSerializer.php', + 'PharIo\\Manifest\\PhpElement' => $vendorDir . '/phar-io/manifest/src/xml/PhpElement.php', + 'PharIo\\Manifest\\PhpExtensionRequirement' => $vendorDir . '/phar-io/manifest/src/values/PhpExtensionRequirement.php', + 'PharIo\\Manifest\\PhpVersionRequirement' => $vendorDir . '/phar-io/manifest/src/values/PhpVersionRequirement.php', + 'PharIo\\Manifest\\Requirement' => $vendorDir . '/phar-io/manifest/src/values/Requirement.php', + 'PharIo\\Manifest\\RequirementCollection' => $vendorDir . '/phar-io/manifest/src/values/RequirementCollection.php', + 'PharIo\\Manifest\\RequirementCollectionIterator' => $vendorDir . '/phar-io/manifest/src/values/RequirementCollectionIterator.php', + 'PharIo\\Manifest\\RequiresElement' => $vendorDir . '/phar-io/manifest/src/xml/RequiresElement.php', + 'PharIo\\Manifest\\Type' => $vendorDir . '/phar-io/manifest/src/values/Type.php', + 'PharIo\\Manifest\\Url' => $vendorDir . '/phar-io/manifest/src/values/Url.php', + 'PharIo\\Version\\AbstractVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/AbstractVersionConstraint.php', + 'PharIo\\Version\\AndVersionConstraintGroup' => $vendorDir . '/phar-io/version/src/constraints/AndVersionConstraintGroup.php', + 'PharIo\\Version\\AnyVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/AnyVersionConstraint.php', + 'PharIo\\Version\\BuildMetaData' => $vendorDir . '/phar-io/version/src/BuildMetaData.php', + 'PharIo\\Version\\ExactVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/ExactVersionConstraint.php', + 'PharIo\\Version\\Exception' => $vendorDir . '/phar-io/version/src/exceptions/Exception.php', + 'PharIo\\Version\\GreaterThanOrEqualToVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php', + 'PharIo\\Version\\InvalidPreReleaseSuffixException' => $vendorDir . '/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php', + 'PharIo\\Version\\InvalidVersionException' => $vendorDir . '/phar-io/version/src/exceptions/InvalidVersionException.php', + 'PharIo\\Version\\NoBuildMetaDataException' => $vendorDir . '/phar-io/version/src/exceptions/NoBuildMetaDataException.php', + 'PharIo\\Version\\NoPreReleaseSuffixException' => $vendorDir . '/phar-io/version/src/exceptions/NoPreReleaseSuffixException.php', + 'PharIo\\Version\\OrVersionConstraintGroup' => $vendorDir . '/phar-io/version/src/constraints/OrVersionConstraintGroup.php', + 'PharIo\\Version\\PreReleaseSuffix' => $vendorDir . '/phar-io/version/src/PreReleaseSuffix.php', + 'PharIo\\Version\\SpecificMajorAndMinorVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php', + 'PharIo\\Version\\SpecificMajorVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php', + 'PharIo\\Version\\UnsupportedVersionConstraintException' => $vendorDir . '/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php', + 'PharIo\\Version\\Version' => $vendorDir . '/phar-io/version/src/Version.php', + 'PharIo\\Version\\VersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/VersionConstraint.php', + 'PharIo\\Version\\VersionConstraintParser' => $vendorDir . '/phar-io/version/src/VersionConstraintParser.php', + 'PharIo\\Version\\VersionConstraintValue' => $vendorDir . '/phar-io/version/src/VersionConstraintValue.php', + 'PharIo\\Version\\VersionNumber' => $vendorDir . '/phar-io/version/src/VersionNumber.php', + 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', + 'SebastianBergmann\\CodeCoverage\\CodeCoverage' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage.php', + 'SebastianBergmann\\CodeCoverage\\CoveredCodeNotExecutedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Driver' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/Driver.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PCOV' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/PCOV.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PHPDBG' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/PHPDBG.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Xdebug' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/Xdebug.php', + 'SebastianBergmann\\CodeCoverage\\Exception' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/Exception.php', + 'SebastianBergmann\\CodeCoverage\\Filter' => $vendorDir . '/phpunit/php-code-coverage/src/Filter.php', + 'SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\CodeCoverage\\MissingCoversAnnotationException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php', + 'SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => $vendorDir . '/phpunit/php-code-coverage/src/Node/AbstractNode.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Builder' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Builder.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Node\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Node/File.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Iterator' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Iterator.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Clover' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Clover.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Crap4j.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer.php', + 'SebastianBergmann\\CodeCoverage\\Report\\PHP' => $vendorDir . '/phpunit/php-code-coverage/src/Report/PHP.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Text' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Text.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/BuildInformation.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Coverage.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Method.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Node.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Project.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Report.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Source.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Tests.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Totals.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Unit.php', + 'SebastianBergmann\\CodeCoverage\\RuntimeException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/RuntimeException.php', + 'SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php', + 'SebastianBergmann\\CodeCoverage\\Util' => $vendorDir . '/phpunit/php-code-coverage/src/Util.php', + 'SebastianBergmann\\CodeCoverage\\Version' => $vendorDir . '/phpunit/php-code-coverage/src/Version.php', + 'SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => $vendorDir . '/sebastian/code-unit-reverse-lookup/src/Wizard.php', + 'SebastianBergmann\\Comparator\\ArrayComparator' => $vendorDir . '/sebastian/comparator/src/ArrayComparator.php', + 'SebastianBergmann\\Comparator\\Comparator' => $vendorDir . '/sebastian/comparator/src/Comparator.php', + 'SebastianBergmann\\Comparator\\ComparisonFailure' => $vendorDir . '/sebastian/comparator/src/ComparisonFailure.php', + 'SebastianBergmann\\Comparator\\DOMNodeComparator' => $vendorDir . '/sebastian/comparator/src/DOMNodeComparator.php', + 'SebastianBergmann\\Comparator\\DateTimeComparator' => $vendorDir . '/sebastian/comparator/src/DateTimeComparator.php', + 'SebastianBergmann\\Comparator\\DoubleComparator' => $vendorDir . '/sebastian/comparator/src/DoubleComparator.php', + 'SebastianBergmann\\Comparator\\ExceptionComparator' => $vendorDir . '/sebastian/comparator/src/ExceptionComparator.php', + 'SebastianBergmann\\Comparator\\Factory' => $vendorDir . '/sebastian/comparator/src/Factory.php', + 'SebastianBergmann\\Comparator\\MockObjectComparator' => $vendorDir . '/sebastian/comparator/src/MockObjectComparator.php', + 'SebastianBergmann\\Comparator\\NumericComparator' => $vendorDir . '/sebastian/comparator/src/NumericComparator.php', + 'SebastianBergmann\\Comparator\\ObjectComparator' => $vendorDir . '/sebastian/comparator/src/ObjectComparator.php', + 'SebastianBergmann\\Comparator\\ResourceComparator' => $vendorDir . '/sebastian/comparator/src/ResourceComparator.php', + 'SebastianBergmann\\Comparator\\ScalarComparator' => $vendorDir . '/sebastian/comparator/src/ScalarComparator.php', + 'SebastianBergmann\\Comparator\\SplObjectStorageComparator' => $vendorDir . '/sebastian/comparator/src/SplObjectStorageComparator.php', + 'SebastianBergmann\\Comparator\\TypeComparator' => $vendorDir . '/sebastian/comparator/src/TypeComparator.php', + 'SebastianBergmann\\Diff\\Chunk' => $vendorDir . '/sebastian/diff/src/Chunk.php', + 'SebastianBergmann\\Diff\\ConfigurationException' => $vendorDir . '/sebastian/diff/src/Exception/ConfigurationException.php', + 'SebastianBergmann\\Diff\\Diff' => $vendorDir . '/sebastian/diff/src/Diff.php', + 'SebastianBergmann\\Diff\\Differ' => $vendorDir . '/sebastian/diff/src/Differ.php', + 'SebastianBergmann\\Diff\\Exception' => $vendorDir . '/sebastian/diff/src/Exception/Exception.php', + 'SebastianBergmann\\Diff\\InvalidArgumentException' => $vendorDir . '/sebastian/diff/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\Diff\\Line' => $vendorDir . '/sebastian/diff/src/Line.php', + 'SebastianBergmann\\Diff\\LongestCommonSubsequenceCalculator' => $vendorDir . '/sebastian/diff/src/LongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\MemoryEfficientLongestCommonSubsequenceCalculator' => $vendorDir . '/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\Output\\AbstractChunkOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/AbstractChunkOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOnlyOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOutputBuilderInterface' => $vendorDir . '/sebastian/diff/src/Output/DiffOutputBuilderInterface.php', + 'SebastianBergmann\\Diff\\Output\\StrictUnifiedDiffOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/StrictUnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\UnifiedDiffOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Parser' => $vendorDir . '/sebastian/diff/src/Parser.php', + 'SebastianBergmann\\Diff\\TimeEfficientLongestCommonSubsequenceCalculator' => $vendorDir . '/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Environment\\Console' => $vendorDir . '/sebastian/environment/src/Console.php', + 'SebastianBergmann\\Environment\\OperatingSystem' => $vendorDir . '/sebastian/environment/src/OperatingSystem.php', + 'SebastianBergmann\\Environment\\Runtime' => $vendorDir . '/sebastian/environment/src/Runtime.php', + 'SebastianBergmann\\Exporter\\Exporter' => $vendorDir . '/sebastian/exporter/src/Exporter.php', + 'SebastianBergmann\\FileIterator\\Facade' => $vendorDir . '/phpunit/php-file-iterator/src/Facade.php', + 'SebastianBergmann\\FileIterator\\Factory' => $vendorDir . '/phpunit/php-file-iterator/src/Factory.php', + 'SebastianBergmann\\FileIterator\\Iterator' => $vendorDir . '/phpunit/php-file-iterator/src/Iterator.php', + 'SebastianBergmann\\GlobalState\\Blacklist' => $vendorDir . '/sebastian/global-state/src/Blacklist.php', + 'SebastianBergmann\\GlobalState\\CodeExporter' => $vendorDir . '/sebastian/global-state/src/CodeExporter.php', + 'SebastianBergmann\\GlobalState\\Exception' => $vendorDir . '/sebastian/global-state/src/exceptions/Exception.php', + 'SebastianBergmann\\GlobalState\\Restorer' => $vendorDir . '/sebastian/global-state/src/Restorer.php', + 'SebastianBergmann\\GlobalState\\RuntimeException' => $vendorDir . '/sebastian/global-state/src/exceptions/RuntimeException.php', + 'SebastianBergmann\\GlobalState\\Snapshot' => $vendorDir . '/sebastian/global-state/src/Snapshot.php', + 'SebastianBergmann\\ObjectEnumerator\\Enumerator' => $vendorDir . '/sebastian/object-enumerator/src/Enumerator.php', + 'SebastianBergmann\\ObjectEnumerator\\Exception' => $vendorDir . '/sebastian/object-enumerator/src/Exception.php', + 'SebastianBergmann\\ObjectEnumerator\\InvalidArgumentException' => $vendorDir . '/sebastian/object-enumerator/src/InvalidArgumentException.php', + 'SebastianBergmann\\ObjectReflector\\Exception' => $vendorDir . '/sebastian/object-reflector/src/Exception.php', + 'SebastianBergmann\\ObjectReflector\\InvalidArgumentException' => $vendorDir . '/sebastian/object-reflector/src/InvalidArgumentException.php', + 'SebastianBergmann\\ObjectReflector\\ObjectReflector' => $vendorDir . '/sebastian/object-reflector/src/ObjectReflector.php', + 'SebastianBergmann\\RecursionContext\\Context' => $vendorDir . '/sebastian/recursion-context/src/Context.php', + 'SebastianBergmann\\RecursionContext\\Exception' => $vendorDir . '/sebastian/recursion-context/src/Exception.php', + 'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => $vendorDir . '/sebastian/recursion-context/src/InvalidArgumentException.php', + 'SebastianBergmann\\ResourceOperations\\ResourceOperations' => $vendorDir . '/sebastian/resource-operations/src/ResourceOperations.php', + 'SebastianBergmann\\Timer\\Exception' => $vendorDir . '/phpunit/php-timer/src/Exception.php', + 'SebastianBergmann\\Timer\\RuntimeException' => $vendorDir . '/phpunit/php-timer/src/RuntimeException.php', + 'SebastianBergmann\\Timer\\Timer' => $vendorDir . '/phpunit/php-timer/src/Timer.php', + 'SebastianBergmann\\Type\\CallableType' => $vendorDir . '/sebastian/type/src/CallableType.php', + 'SebastianBergmann\\Type\\Exception' => $vendorDir . '/sebastian/type/src/exception/Exception.php', + 'SebastianBergmann\\Type\\GenericObjectType' => $vendorDir . '/sebastian/type/src/GenericObjectType.php', + 'SebastianBergmann\\Type\\IterableType' => $vendorDir . '/sebastian/type/src/IterableType.php', + 'SebastianBergmann\\Type\\NullType' => $vendorDir . '/sebastian/type/src/NullType.php', + 'SebastianBergmann\\Type\\ObjectType' => $vendorDir . '/sebastian/type/src/ObjectType.php', + 'SebastianBergmann\\Type\\RuntimeException' => $vendorDir . '/sebastian/type/src/exception/RuntimeException.php', + 'SebastianBergmann\\Type\\SimpleType' => $vendorDir . '/sebastian/type/src/SimpleType.php', + 'SebastianBergmann\\Type\\Type' => $vendorDir . '/sebastian/type/src/Type.php', + 'SebastianBergmann\\Type\\TypeName' => $vendorDir . '/sebastian/type/src/TypeName.php', + 'SebastianBergmann\\Type\\UnknownType' => $vendorDir . '/sebastian/type/src/UnknownType.php', + 'SebastianBergmann\\Type\\VoidType' => $vendorDir . '/sebastian/type/src/VoidType.php', + 'SebastianBergmann\\Version' => $vendorDir . '/sebastian/version/src/Version.php', + 'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php', + 'Text_Template' => $vendorDir . '/phpunit/php-text-template/src/Template.php', + 'TheSeer\\Tokenizer\\Exception' => $vendorDir . '/theseer/tokenizer/src/Exception.php', + 'TheSeer\\Tokenizer\\NamespaceUri' => $vendorDir . '/theseer/tokenizer/src/NamespaceUri.php', + 'TheSeer\\Tokenizer\\NamespaceUriException' => $vendorDir . '/theseer/tokenizer/src/NamespaceUriException.php', + 'TheSeer\\Tokenizer\\Token' => $vendorDir . '/theseer/tokenizer/src/Token.php', + 'TheSeer\\Tokenizer\\TokenCollection' => $vendorDir . '/theseer/tokenizer/src/TokenCollection.php', + 'TheSeer\\Tokenizer\\TokenCollectionException' => $vendorDir . '/theseer/tokenizer/src/TokenCollectionException.php', + 'TheSeer\\Tokenizer\\Tokenizer' => $vendorDir . '/theseer/tokenizer/src/Tokenizer.php', + 'TheSeer\\Tokenizer\\XMLSerializer' => $vendorDir . '/theseer/tokenizer/src/XMLSerializer.php', + 'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php', + 'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php', +); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php new file mode 100644 index 00000000..1651edc3 --- /dev/null +++ b/vendor/composer/autoload_files.php @@ -0,0 +1,28 @@ + $vendorDir . '/symfony/polyfill-php80/bootstrap.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', + '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php', + 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php', + 'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php', + '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', + '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', + '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php', + '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', + 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', + 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php', + '2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php', + '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', + '538ca81a9a966a6716601ecf48f4eaef' => $vendorDir . '/opis/closure/functions.php', + 'e39a8b23c42d4e1452234d762b03835a' => $vendorDir . '/ramsey/uuid/src/functions.php', + 'f0906e6318348a765ffb6eb24e0d0938' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/helpers.php', + '58571171fd5812e6e447dce228f52f4d' => $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php', + '6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', +); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php new file mode 100644 index 00000000..631bf71b --- /dev/null +++ b/vendor/composer/autoload_namespaces.php @@ -0,0 +1,10 @@ + array($vendorDir . '/mockery/mockery/library'), +); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php new file mode 100644 index 00000000..32926120 --- /dev/null +++ b/vendor/composer/autoload_psr4.php @@ -0,0 +1,83 @@ + array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/reflection-docblock/src', $vendorDir . '/phpdocumentor/type-resolver/src'), + 'Werk365\\IdentityDocuments\\Tests\\' => array($baseDir . '/tests'), + 'Werk365\\IdentityDocuments\\' => array($baseDir . '/src'), + 'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'), + 'TijsVerkoyen\\CssToInlineStyles\\' => array($vendorDir . '/tijsverkoyen/css-to-inline-styles/src'), + 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'), + 'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'), + 'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'), + 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), + 'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'), + 'Symfony\\Polyfill\\Intl\\Idn\\' => array($vendorDir . '/symfony/polyfill-intl-idn'), + 'Symfony\\Polyfill\\Iconv\\' => array($vendorDir . '/symfony/polyfill-iconv'), + 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), + 'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'), + 'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'), + 'Symfony\\Contracts\\HttpClient\\' => array($vendorDir . '/symfony/http-client-contracts'), + 'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'), + 'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'), + 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), + 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), + 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'), + 'Symfony\\Component\\Mime\\' => array($vendorDir . '/symfony/mime'), + 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), + 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), + 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'), + 'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'), + 'Symfony\\Component\\ErrorHandler\\' => array($vendorDir . '/symfony/error-handler'), + 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'), + 'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'), + 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'), + 'Sempro\\PHPUnitPrettyPrinter\\' => array($vendorDir . '/sempro/phpunit-pretty-print/src'), + 'Rize\\' => array($vendorDir . '/rize/uri-template/src/Rize'), + 'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'), + 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), + 'Psr\\Log\\' => array($vendorDir . '/psr/log/src'), + 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), + 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), + 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), + 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), + 'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src/Prophecy'), + 'PhpOption\\' => array($vendorDir . '/phpoption/phpoption/src/PhpOption'), + 'Orchestra\\Testbench\\' => array($vendorDir . '/orchestra/testbench-core/src'), + 'Opis\\Closure\\' => array($vendorDir . '/opis/closure/src'), + 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), + 'League\\MimeTypeDetection\\' => array($vendorDir . '/league/mime-type-detection/src'), + 'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'), + 'League\\CommonMark\\' => array($vendorDir . '/league/commonmark/src'), + 'Intervention\\Image\\' => array($vendorDir . '/intervention/image/src/Intervention/Image'), + 'Illuminate\\' => array($vendorDir . '/laravel/framework/src/Illuminate'), + 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), + 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), + 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), + 'Grpc\\Gcp\\' => array($vendorDir . '/google/grpc-gcp/src'), + 'Grpc\\' => array($vendorDir . '/grpc/grpc/src/lib'), + 'Google\\Protobuf\\' => array($vendorDir . '/google/protobuf/src/Google/Protobuf'), + 'Google\\Cloud\\Vision\\' => array($vendorDir . '/google/cloud-vision/src'), + 'Google\\Cloud\\Core\\' => array($vendorDir . '/google/cloud-core/src'), + 'Google\\Auth\\' => array($vendorDir . '/google/auth/src'), + 'Google\\ApiCore\\' => array($vendorDir . '/google/gax/src'), + 'Google\\' => array($vendorDir . '/google/common-protos/src'), + 'GPBMetadata\\Google\\Protobuf\\' => array($vendorDir . '/google/protobuf/src/GPBMetadata/Google/Protobuf'), + 'GPBMetadata\\Google\\Cloud\\Vision\\' => array($vendorDir . '/google/cloud-vision/metadata'), + 'GPBMetadata\\Google\\' => array($vendorDir . '/google/common-protos/metadata'), + 'GPBMetadata\\ApiCore\\' => array($vendorDir . '/google/gax/metadata/ApiCore'), + 'Firebase\\JWT\\' => array($vendorDir . '/firebase/php-jwt/src'), + 'Faker\\' => array($vendorDir . '/fakerphp/faker/src/Faker'), + 'Egulias\\EmailValidator\\' => array($vendorDir . '/egulias/email-validator/src'), + 'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'), + 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'), + 'Doctrine\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Inflector'), + 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib/Doctrine/Common/Lexer'), + 'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'), + 'Cron\\' => array($vendorDir . '/dragonmantank/cron-expression/src/Cron'), + 'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'), +); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php new file mode 100644 index 00000000..a529ed4b --- /dev/null +++ b/vendor/composer/autoload_real.php @@ -0,0 +1,75 @@ += 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\ComposerStaticInit101ae59d932d1dffdac3612ec53dc0f5::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\ComposerStaticInit101ae59d932d1dffdac3612ec53dc0f5::$files; + } else { + $includeFiles = require __DIR__ . '/autoload_files.php'; + } + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequire101ae59d932d1dffdac3612ec53dc0f5($fileIdentifier, $file); + } + + return $loader; + } +} + +function composerRequire101ae59d932d1dffdac3612ec53dc0f5($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 new file mode 100644 index 00000000..a00d20d9 --- /dev/null +++ b/vendor/composer/autoload_static.php @@ -0,0 +1,1146 @@ + __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', + 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php', + 'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php', + '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', + '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', + '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php', + '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', + 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', + 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php', + '2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php', + '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', + '538ca81a9a966a6716601ecf48f4eaef' => __DIR__ . '/..' . '/opis/closure/functions.php', + 'e39a8b23c42d4e1452234d762b03835a' => __DIR__ . '/..' . '/ramsey/uuid/src/functions.php', + 'f0906e6318348a765ffb6eb24e0d0938' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php', + '58571171fd5812e6e447dce228f52f4d' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php', + '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'p' => + array ( + 'phpDocumentor\\Reflection\\' => 25, + ), + 'W' => + array ( + 'Werk365\\IdentityDocuments\\Tests\\' => 32, + 'Werk365\\IdentityDocuments\\' => 26, + 'Webmozart\\Assert\\' => 17, + ), + 'T' => + array ( + 'TijsVerkoyen\\CssToInlineStyles\\' => 31, + ), + 'S' => + array ( + 'Symfony\\Polyfill\\Php80\\' => 23, + 'Symfony\\Polyfill\\Php73\\' => 23, + 'Symfony\\Polyfill\\Php72\\' => 23, + 'Symfony\\Polyfill\\Mbstring\\' => 26, + 'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33, + 'Symfony\\Polyfill\\Intl\\Idn\\' => 26, + 'Symfony\\Polyfill\\Iconv\\' => 23, + 'Symfony\\Polyfill\\Ctype\\' => 23, + 'Symfony\\Contracts\\Translation\\' => 30, + 'Symfony\\Contracts\\Service\\' => 26, + 'Symfony\\Contracts\\HttpClient\\' => 29, + 'Symfony\\Contracts\\EventDispatcher\\' => 34, + 'Symfony\\Component\\VarDumper\\' => 28, + 'Symfony\\Component\\Translation\\' => 30, + 'Symfony\\Component\\Routing\\' => 26, + 'Symfony\\Component\\Process\\' => 26, + 'Symfony\\Component\\Mime\\' => 23, + 'Symfony\\Component\\HttpKernel\\' => 29, + 'Symfony\\Component\\HttpFoundation\\' => 33, + 'Symfony\\Component\\Finder\\' => 25, + 'Symfony\\Component\\EventDispatcher\\' => 34, + 'Symfony\\Component\\ErrorHandler\\' => 31, + 'Symfony\\Component\\Debug\\' => 24, + 'Symfony\\Component\\CssSelector\\' => 30, + 'Symfony\\Component\\Console\\' => 26, + 'Sempro\\PHPUnitPrettyPrinter\\' => 28, + ), + 'R' => + array ( + 'Rize\\' => 5, + 'Ramsey\\Uuid\\' => 12, + ), + 'P' => + array ( + 'Psr\\SimpleCache\\' => 16, + 'Psr\\Log\\' => 8, + 'Psr\\Http\\Message\\' => 17, + 'Psr\\Http\\Client\\' => 16, + 'Psr\\Container\\' => 14, + 'Psr\\Cache\\' => 10, + 'Prophecy\\' => 9, + 'PhpOption\\' => 10, + ), + 'O' => + array ( + 'Orchestra\\Testbench\\' => 20, + 'Opis\\Closure\\' => 13, + ), + 'M' => + array ( + 'Monolog\\' => 8, + ), + 'L' => + array ( + 'League\\MimeTypeDetection\\' => 25, + 'League\\Flysystem\\' => 17, + 'League\\CommonMark\\' => 18, + ), + 'I' => + array ( + 'Intervention\\Image\\' => 19, + 'Illuminate\\' => 11, + ), + 'G' => + array ( + 'GuzzleHttp\\Psr7\\' => 16, + 'GuzzleHttp\\Promise\\' => 19, + 'GuzzleHttp\\' => 11, + 'Grpc\\Gcp\\' => 9, + 'Grpc\\' => 5, + 'Google\\Protobuf\\' => 16, + 'Google\\Cloud\\Vision\\' => 20, + 'Google\\Cloud\\Core\\' => 18, + 'Google\\Auth\\' => 12, + 'Google\\ApiCore\\' => 15, + 'Google\\' => 7, + 'GPBMetadata\\Google\\Protobuf\\' => 28, + 'GPBMetadata\\Google\\Cloud\\Vision\\' => 32, + 'GPBMetadata\\Google\\' => 19, + 'GPBMetadata\\ApiCore\\' => 20, + ), + 'F' => + array ( + 'Firebase\\JWT\\' => 13, + 'Faker\\' => 6, + ), + 'E' => + array ( + 'Egulias\\EmailValidator\\' => 23, + ), + 'D' => + array ( + 'Dotenv\\' => 7, + 'Doctrine\\Instantiator\\' => 22, + 'Doctrine\\Inflector\\' => 19, + 'Doctrine\\Common\\Lexer\\' => 22, + 'DeepCopy\\' => 9, + ), + 'C' => + array ( + 'Cron\\' => 5, + 'Carbon\\' => 7, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'phpDocumentor\\Reflection\\' => + array ( + 0 => __DIR__ . '/..' . '/phpdocumentor/reflection-common/src', + 1 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src', + 2 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src', + ), + 'Werk365\\IdentityDocuments\\Tests\\' => + array ( + 0 => __DIR__ . '/../..' . '/tests', + ), + 'Werk365\\IdentityDocuments\\' => + array ( + 0 => __DIR__ . '/../..' . '/src', + ), + 'Webmozart\\Assert\\' => + array ( + 0 => __DIR__ . '/..' . '/webmozart/assert/src', + ), + 'TijsVerkoyen\\CssToInlineStyles\\' => + array ( + 0 => __DIR__ . '/..' . '/tijsverkoyen/css-to-inline-styles/src', + ), + 'Symfony\\Polyfill\\Php80\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php80', + ), + 'Symfony\\Polyfill\\Php73\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php73', + ), + 'Symfony\\Polyfill\\Php72\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php72', + ), + 'Symfony\\Polyfill\\Mbstring\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', + ), + 'Symfony\\Polyfill\\Intl\\Normalizer\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer', + ), + 'Symfony\\Polyfill\\Intl\\Idn\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-idn', + ), + 'Symfony\\Polyfill\\Iconv\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-iconv', + ), + 'Symfony\\Polyfill\\Ctype\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', + ), + 'Symfony\\Contracts\\Translation\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/translation-contracts', + ), + 'Symfony\\Contracts\\Service\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/service-contracts', + ), + 'Symfony\\Contracts\\HttpClient\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/http-client-contracts', + ), + 'Symfony\\Contracts\\EventDispatcher\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/event-dispatcher-contracts', + ), + 'Symfony\\Component\\VarDumper\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/var-dumper', + ), + 'Symfony\\Component\\Translation\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/translation', + ), + 'Symfony\\Component\\Routing\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/routing', + ), + 'Symfony\\Component\\Process\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/process', + ), + 'Symfony\\Component\\Mime\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/mime', + ), + 'Symfony\\Component\\HttpKernel\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/http-kernel', + ), + 'Symfony\\Component\\HttpFoundation\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/http-foundation', + ), + 'Symfony\\Component\\Finder\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/finder', + ), + 'Symfony\\Component\\EventDispatcher\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/event-dispatcher', + ), + 'Symfony\\Component\\ErrorHandler\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/error-handler', + ), + 'Symfony\\Component\\Debug\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/debug', + ), + 'Symfony\\Component\\CssSelector\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/css-selector', + ), + 'Symfony\\Component\\Console\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/console', + ), + 'Sempro\\PHPUnitPrettyPrinter\\' => + array ( + 0 => __DIR__ . '/..' . '/sempro/phpunit-pretty-print/src', + ), + 'Rize\\' => + array ( + 0 => __DIR__ . '/..' . '/rize/uri-template/src/Rize', + ), + 'Ramsey\\Uuid\\' => + array ( + 0 => __DIR__ . '/..' . '/ramsey/uuid/src', + ), + 'Psr\\SimpleCache\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/simple-cache/src', + ), + 'Psr\\Log\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/log/src', + ), + 'Psr\\Http\\Message\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-factory/src', + 1 => __DIR__ . '/..' . '/psr/http-message/src', + ), + 'Psr\\Http\\Client\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-client/src', + ), + 'Psr\\Container\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/container/src', + ), + 'Psr\\Cache\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/cache/src', + ), + 'Prophecy\\' => + array ( + 0 => __DIR__ . '/..' . '/phpspec/prophecy/src/Prophecy', + ), + 'PhpOption\\' => + array ( + 0 => __DIR__ . '/..' . '/phpoption/phpoption/src/PhpOption', + ), + 'Orchestra\\Testbench\\' => + array ( + 0 => __DIR__ . '/..' . '/orchestra/testbench-core/src', + ), + 'Opis\\Closure\\' => + array ( + 0 => __DIR__ . '/..' . '/opis/closure/src', + ), + 'Monolog\\' => + array ( + 0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog', + ), + 'League\\MimeTypeDetection\\' => + array ( + 0 => __DIR__ . '/..' . '/league/mime-type-detection/src', + ), + 'League\\Flysystem\\' => + array ( + 0 => __DIR__ . '/..' . '/league/flysystem/src', + ), + 'League\\CommonMark\\' => + array ( + 0 => __DIR__ . '/..' . '/league/commonmark/src', + ), + 'Intervention\\Image\\' => + array ( + 0 => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image', + ), + 'Illuminate\\' => + array ( + 0 => __DIR__ . '/..' . '/laravel/framework/src/Illuminate', + ), + 'GuzzleHttp\\Psr7\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', + ), + 'GuzzleHttp\\Promise\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/promises/src', + ), + 'GuzzleHttp\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src', + ), + 'Grpc\\Gcp\\' => + array ( + 0 => __DIR__ . '/..' . '/google/grpc-gcp/src', + ), + 'Grpc\\' => + array ( + 0 => __DIR__ . '/..' . '/grpc/grpc/src/lib', + ), + 'Google\\Protobuf\\' => + array ( + 0 => __DIR__ . '/..' . '/google/protobuf/src/Google/Protobuf', + ), + 'Google\\Cloud\\Vision\\' => + array ( + 0 => __DIR__ . '/..' . '/google/cloud-vision/src', + ), + 'Google\\Cloud\\Core\\' => + array ( + 0 => __DIR__ . '/..' . '/google/cloud-core/src', + ), + 'Google\\Auth\\' => + array ( + 0 => __DIR__ . '/..' . '/google/auth/src', + ), + 'Google\\ApiCore\\' => + array ( + 0 => __DIR__ . '/..' . '/google/gax/src', + ), + 'Google\\' => + array ( + 0 => __DIR__ . '/..' . '/google/common-protos/src', + ), + 'GPBMetadata\\Google\\Protobuf\\' => + array ( + 0 => __DIR__ . '/..' . '/google/protobuf/src/GPBMetadata/Google/Protobuf', + ), + 'GPBMetadata\\Google\\Cloud\\Vision\\' => + array ( + 0 => __DIR__ . '/..' . '/google/cloud-vision/metadata', + ), + 'GPBMetadata\\Google\\' => + array ( + 0 => __DIR__ . '/..' . '/google/common-protos/metadata', + ), + 'GPBMetadata\\ApiCore\\' => + array ( + 0 => __DIR__ . '/..' . '/google/gax/metadata/ApiCore', + ), + 'Firebase\\JWT\\' => + array ( + 0 => __DIR__ . '/..' . '/firebase/php-jwt/src', + ), + 'Faker\\' => + array ( + 0 => __DIR__ . '/..' . '/fakerphp/faker/src/Faker', + ), + 'Egulias\\EmailValidator\\' => + array ( + 0 => __DIR__ . '/..' . '/egulias/email-validator/src', + ), + 'Dotenv\\' => + array ( + 0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src', + ), + 'Doctrine\\Instantiator\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator', + ), + 'Doctrine\\Inflector\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/inflector/lib/Doctrine/Inflector', + ), + 'Doctrine\\Common\\Lexer\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/lexer/lib/Doctrine/Common/Lexer', + ), + 'DeepCopy\\' => + array ( + 0 => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy', + ), + 'Cron\\' => + array ( + 0 => __DIR__ . '/..' . '/dragonmantank/cron-expression/src/Cron', + ), + 'Carbon\\' => + array ( + 0 => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon', + ), + ); + + public static $prefixesPsr0 = array ( + 'M' => + array ( + 'Mockery' => + array ( + 0 => __DIR__ . '/..' . '/mockery/mockery/library', + ), + ), + ); + + public static $classMap = array ( + 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'GPBMetadata\\GrpcGcp' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/GPBMetadata/GrpcGcp.php', + 'Grpc\\Gcp\\AffinityConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig.php', + 'Grpc\\Gcp\\AffinityConfig_Command' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig_Command.php', + 'Grpc\\Gcp\\ApiConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/ApiConfig.php', + 'Grpc\\Gcp\\ChannelPoolConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/ChannelPoolConfig.php', + 'Grpc\\Gcp\\MethodConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/MethodConfig.php', + 'Hamcrest\\Arrays\\IsArray' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php', + 'Hamcrest\\Arrays\\IsArrayContaining' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php', + 'Hamcrest\\Arrays\\IsArrayContainingInAnyOrder' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php', + 'Hamcrest\\Arrays\\IsArrayContainingInOrder' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php', + 'Hamcrest\\Arrays\\IsArrayContainingKey' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php', + 'Hamcrest\\Arrays\\IsArrayContainingKeyValuePair' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php', + 'Hamcrest\\Arrays\\IsArrayWithSize' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayWithSize.php', + 'Hamcrest\\Arrays\\MatchingOnce' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/MatchingOnce.php', + 'Hamcrest\\Arrays\\SeriesMatchingOnce' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php', + 'Hamcrest\\AssertionError' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/AssertionError.php', + 'Hamcrest\\BaseDescription' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseDescription.php', + 'Hamcrest\\BaseMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseMatcher.php', + 'Hamcrest\\Collection\\IsEmptyTraversable' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsEmptyTraversable.php', + 'Hamcrest\\Collection\\IsTraversableWithSize' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsTraversableWithSize.php', + 'Hamcrest\\Core\\AllOf' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AllOf.php', + 'Hamcrest\\Core\\AnyOf' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AnyOf.php', + 'Hamcrest\\Core\\CombinableMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/CombinableMatcher.php', + 'Hamcrest\\Core\\DescribedAs' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/DescribedAs.php', + 'Hamcrest\\Core\\Every' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Every.php', + 'Hamcrest\\Core\\HasToString' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/HasToString.php', + 'Hamcrest\\Core\\Is' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Is.php', + 'Hamcrest\\Core\\IsAnything' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsAnything.php', + 'Hamcrest\\Core\\IsCollectionContaining' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsCollectionContaining.php', + 'Hamcrest\\Core\\IsEqual' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsEqual.php', + 'Hamcrest\\Core\\IsIdentical' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsIdentical.php', + 'Hamcrest\\Core\\IsInstanceOf' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsInstanceOf.php', + 'Hamcrest\\Core\\IsNot' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNot.php', + 'Hamcrest\\Core\\IsNull' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNull.php', + 'Hamcrest\\Core\\IsSame' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsSame.php', + 'Hamcrest\\Core\\IsTypeOf' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsTypeOf.php', + 'Hamcrest\\Core\\Set' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Set.php', + 'Hamcrest\\Core\\ShortcutCombination' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ShortcutCombination.php', + 'Hamcrest\\Description' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Description.php', + 'Hamcrest\\DiagnosingMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/DiagnosingMatcher.php', + 'Hamcrest\\FeatureMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/FeatureMatcher.php', + 'Hamcrest\\Internal\\SelfDescribingValue' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Internal/SelfDescribingValue.php', + 'Hamcrest\\Matcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matcher.php', + 'Hamcrest\\MatcherAssert' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php', + 'Hamcrest\\Matchers' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matchers.php', + 'Hamcrest\\NullDescription' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/NullDescription.php', + 'Hamcrest\\Number\\IsCloseTo' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/IsCloseTo.php', + 'Hamcrest\\Number\\OrderingComparison' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/OrderingComparison.php', + 'Hamcrest\\SelfDescribing' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/SelfDescribing.php', + 'Hamcrest\\StringDescription' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/StringDescription.php', + 'Hamcrest\\Text\\IsEmptyString' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEmptyString.php', + 'Hamcrest\\Text\\IsEqualIgnoringCase' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php', + 'Hamcrest\\Text\\IsEqualIgnoringWhiteSpace' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php', + 'Hamcrest\\Text\\MatchesPattern' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/MatchesPattern.php', + 'Hamcrest\\Text\\StringContains' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContains.php', + 'Hamcrest\\Text\\StringContainsIgnoringCase' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php', + 'Hamcrest\\Text\\StringContainsInOrder' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsInOrder.php', + 'Hamcrest\\Text\\StringEndsWith' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringEndsWith.php', + 'Hamcrest\\Text\\StringStartsWith' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringStartsWith.php', + 'Hamcrest\\Text\\SubstringMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/SubstringMatcher.php', + 'Hamcrest\\TypeSafeDiagnosingMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeDiagnosingMatcher.php', + 'Hamcrest\\TypeSafeMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeMatcher.php', + 'Hamcrest\\Type\\IsArray' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsArray.php', + 'Hamcrest\\Type\\IsBoolean' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsBoolean.php', + 'Hamcrest\\Type\\IsCallable' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsCallable.php', + 'Hamcrest\\Type\\IsDouble' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsDouble.php', + 'Hamcrest\\Type\\IsInteger' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsInteger.php', + 'Hamcrest\\Type\\IsNumeric' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsNumeric.php', + 'Hamcrest\\Type\\IsObject' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsObject.php', + 'Hamcrest\\Type\\IsResource' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsResource.php', + 'Hamcrest\\Type\\IsScalar' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsScalar.php', + 'Hamcrest\\Type\\IsString' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsString.php', + 'Hamcrest\\Util' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php', + 'Hamcrest\\Xml\\HasXPath' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php', + 'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php', + 'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', + 'PHPUnit\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Exception.php', + 'PHPUnit\\Framework\\Assert' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert.php', + 'PHPUnit\\Framework\\AssertionFailedError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/AssertionFailedError.php', + 'PHPUnit\\Framework\\CodeCoverageException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/CodeCoverageException.php', + 'PHPUnit\\Framework\\Constraint\\ArrayHasKey' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ArrayHasKey.php', + 'PHPUnit\\Framework\\Constraint\\ArraySubset' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ArraySubset.php', + 'PHPUnit\\Framework\\Constraint\\Attribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Attribute.php', + 'PHPUnit\\Framework\\Constraint\\Callback' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Callback.php', + 'PHPUnit\\Framework\\Constraint\\ClassHasAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php', + 'PHPUnit\\Framework\\Constraint\\ClassHasStaticAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php', + 'PHPUnit\\Framework\\Constraint\\Composite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Composite.php', + 'PHPUnit\\Framework\\Constraint\\Constraint' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Constraint.php', + 'PHPUnit\\Framework\\Constraint\\Count' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Count.php', + 'PHPUnit\\Framework\\Constraint\\DirectoryExists' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/DirectoryExists.php', + 'PHPUnit\\Framework\\Constraint\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Exception.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionCode' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ExceptionCode.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessage' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessage.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessageRegularExpression' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\FileExists' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/FileExists.php', + 'PHPUnit\\Framework\\Constraint\\GreaterThan' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/GreaterThan.php', + 'PHPUnit\\Framework\\Constraint\\IsAnything' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsAnything.php', + 'PHPUnit\\Framework\\Constraint\\IsEmpty' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsEmpty.php', + 'PHPUnit\\Framework\\Constraint\\IsEqual' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsEqual.php', + 'PHPUnit\\Framework\\Constraint\\IsFalse' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsFalse.php', + 'PHPUnit\\Framework\\Constraint\\IsFinite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsFinite.php', + 'PHPUnit\\Framework\\Constraint\\IsIdentical' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php', + 'PHPUnit\\Framework\\Constraint\\IsInfinite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsInfinite.php', + 'PHPUnit\\Framework\\Constraint\\IsInstanceOf' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsInstanceOf.php', + 'PHPUnit\\Framework\\Constraint\\IsJson' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsJson.php', + 'PHPUnit\\Framework\\Constraint\\IsNan' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsNan.php', + 'PHPUnit\\Framework\\Constraint\\IsNull' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsNull.php', + 'PHPUnit\\Framework\\Constraint\\IsReadable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsReadable.php', + 'PHPUnit\\Framework\\Constraint\\IsTrue' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsTrue.php', + 'PHPUnit\\Framework\\Constraint\\IsType' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsType.php', + 'PHPUnit\\Framework\\Constraint\\IsWritable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsWritable.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatches' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatchesErrorMessageProvider' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/JsonMatchesErrorMessageProvider.php', + 'PHPUnit\\Framework\\Constraint\\LessThan' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LessThan.php', + 'PHPUnit\\Framework\\Constraint\\LogicalAnd' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LogicalAnd.php', + 'PHPUnit\\Framework\\Constraint\\LogicalNot' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LogicalNot.php', + 'PHPUnit\\Framework\\Constraint\\LogicalOr' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LogicalOr.php', + 'PHPUnit\\Framework\\Constraint\\LogicalXor' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LogicalXor.php', + 'PHPUnit\\Framework\\Constraint\\ObjectHasAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ObjectHasAttribute.php', + 'PHPUnit\\Framework\\Constraint\\RegularExpression' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/RegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\SameSize' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/SameSize.php', + 'PHPUnit\\Framework\\Constraint\\StringContains' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/StringContains.php', + 'PHPUnit\\Framework\\Constraint\\StringEndsWith' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/StringEndsWith.php', + 'PHPUnit\\Framework\\Constraint\\StringMatchesFormatDescription' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/StringMatchesFormatDescription.php', + 'PHPUnit\\Framework\\Constraint\\StringStartsWith' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/StringStartsWith.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContains' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/TraversableContains.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsEqual' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/TraversableContainsEqual.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsIdentical' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/TraversableContainsIdentical.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsOnly' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/TraversableContainsOnly.php', + 'PHPUnit\\Framework\\CoveredCodeNotExecutedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/CoveredCodeNotExecutedException.php', + 'PHPUnit\\Framework\\DataProviderTestSuite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/DataProviderTestSuite.php', + 'PHPUnit\\Framework\\Error\\Deprecated' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Error/Deprecated.php', + 'PHPUnit\\Framework\\Error\\Error' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Error/Error.php', + 'PHPUnit\\Framework\\Error\\Notice' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Error/Notice.php', + 'PHPUnit\\Framework\\Error\\Warning' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Error/Warning.php', + 'PHPUnit\\Framework\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/Exception.php', + 'PHPUnit\\Framework\\ExceptionWrapper' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/ExceptionWrapper.php', + 'PHPUnit\\Framework\\ExpectationFailedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/ExpectationFailedException.php', + 'PHPUnit\\Framework\\IncompleteTest' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/IncompleteTest.php', + 'PHPUnit\\Framework\\IncompleteTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/IncompleteTestCase.php', + 'PHPUnit\\Framework\\IncompleteTestError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/IncompleteTestError.php', + 'PHPUnit\\Framework\\InvalidArgumentException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/InvalidArgumentException.php', + 'PHPUnit\\Framework\\InvalidCoversTargetException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/InvalidCoversTargetException.php', + 'PHPUnit\\Framework\\InvalidDataProviderException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/InvalidDataProviderException.php', + 'PHPUnit\\Framework\\InvalidParameterGroupException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/InvalidParameterGroupException.php', + 'PHPUnit\\Framework\\MissingCoversAnnotationException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/MissingCoversAnnotationException.php', + 'PHPUnit\\Framework\\MockObject\\Api' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Api/Api.php', + 'PHPUnit\\Framework\\MockObject\\BadMethodCallException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Identity' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\InvocationMocker' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\InvocationStubber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationStubber.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Match_' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/Match_.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\MethodNameMatch' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/MethodNameMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\ParametersMatch' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Stub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/Stub.php', + 'PHPUnit\\Framework\\MockObject\\ConfigurableMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/ConfigurableMethod.php', + 'PHPUnit\\Framework\\MockObject\\ConfigurableMethodsAlreadyInitializedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/ConfigurableMethodsAlreadyInitializedException.php', + 'PHPUnit\\Framework\\MockObject\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Generator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator.php', + 'PHPUnit\\Framework\\MockObject\\IncompatibleReturnValueException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/IncompatibleReturnValueException.php', + 'PHPUnit\\Framework\\MockObject\\Invocation' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Invocation.php', + 'PHPUnit\\Framework\\MockObject\\InvocationHandler' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/InvocationHandler.php', + 'PHPUnit\\Framework\\MockObject\\Matcher' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher.php', + 'PHPUnit\\Framework\\MockObject\\Method' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Api/Method.php', + 'PHPUnit\\Framework\\MockObject\\MethodNameConstraint' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MethodNameConstraint.php', + 'PHPUnit\\Framework\\MockObject\\MockBuilder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php', + 'PHPUnit\\Framework\\MockObject\\MockClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MockClass.php', + 'PHPUnit\\Framework\\MockObject\\MockMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MockMethod.php', + 'PHPUnit\\Framework\\MockObject\\MockMethodSet' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MockMethodSet.php', + 'PHPUnit\\Framework\\MockObject\\MockObject' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MockObject.php', + 'PHPUnit\\Framework\\MockObject\\MockTrait' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MockTrait.php', + 'PHPUnit\\Framework\\MockObject\\MockType' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MockType.php', + 'PHPUnit\\Framework\\MockObject\\MockedCloneMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Api/MockedCloneMethod.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\AnyInvokedCount' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Rule/AnyInvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\AnyParameters' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Rule/AnyParameters.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\ConsecutiveParameters' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Rule/ConsecutiveParameters.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvocationOrder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Rule/InvocationOrder.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtIndex' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtIndex.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtLeastCount' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtLeastCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtLeastOnce' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtLeastOnce.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtMostCount' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtMostCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedCount' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\MethodName' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Rule/MethodName.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\Parameters' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Rule/Parameters.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\ParametersRule' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Rule/ParametersRule.php', + 'PHPUnit\\Framework\\MockObject\\RuntimeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php', + 'PHPUnit\\Framework\\MockObject\\Stub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ConsecutiveCalls' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ConsecutiveCalls.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnArgument' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnArgument.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnCallback' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnCallback.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnReference' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnReference.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnSelf' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnSelf.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnStub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnStub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnValueMap' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnValueMap.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\Stub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/Stub.php', + 'PHPUnit\\Framework\\MockObject\\UnmockedCloneMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Api/UnmockedCloneMethod.php', + 'PHPUnit\\Framework\\MockObject\\Verifiable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Verifiable.php', + 'PHPUnit\\Framework\\NoChildTestSuiteException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/NoChildTestSuiteException.php', + 'PHPUnit\\Framework\\OutputError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/OutputError.php', + 'PHPUnit\\Framework\\PHPTAssertionFailedError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/PHPTAssertionFailedError.php', + 'PHPUnit\\Framework\\RiskyTestError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/RiskyTestError.php', + 'PHPUnit\\Framework\\SelfDescribing' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SelfDescribing.php', + 'PHPUnit\\Framework\\SkippedTest' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SkippedTest.php', + 'PHPUnit\\Framework\\SkippedTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SkippedTestCase.php', + 'PHPUnit\\Framework\\SkippedTestError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/SkippedTestError.php', + 'PHPUnit\\Framework\\SkippedTestSuiteError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/SkippedTestSuiteError.php', + 'PHPUnit\\Framework\\SyntheticError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/SyntheticError.php', + 'PHPUnit\\Framework\\SyntheticSkippedError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/SyntheticSkippedError.php', + 'PHPUnit\\Framework\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Test.php', + 'PHPUnit\\Framework\\TestBuilder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestBuilder.php', + 'PHPUnit\\Framework\\TestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestCase.php', + 'PHPUnit\\Framework\\TestFailure' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestFailure.php', + 'PHPUnit\\Framework\\TestListener' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestListener.php', + 'PHPUnit\\Framework\\TestListenerDefaultImplementation' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestListenerDefaultImplementation.php', + 'PHPUnit\\Framework\\TestResult' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestResult.php', + 'PHPUnit\\Framework\\TestSuite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSuite.php', + 'PHPUnit\\Framework\\TestSuiteIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSuiteIterator.php', + 'PHPUnit\\Framework\\UnintentionallyCoveredCodeError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/UnintentionallyCoveredCodeError.php', + 'PHPUnit\\Framework\\Warning' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/Warning.php', + 'PHPUnit\\Framework\\WarningTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/WarningTestCase.php', + 'PHPUnit\\Runner\\AfterIncompleteTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterIncompleteTestHook.php', + 'PHPUnit\\Runner\\AfterLastTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterLastTestHook.php', + 'PHPUnit\\Runner\\AfterRiskyTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterRiskyTestHook.php', + 'PHPUnit\\Runner\\AfterSkippedTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterSkippedTestHook.php', + 'PHPUnit\\Runner\\AfterSuccessfulTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterSuccessfulTestHook.php', + 'PHPUnit\\Runner\\AfterTestErrorHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterTestErrorHook.php', + 'PHPUnit\\Runner\\AfterTestFailureHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterTestFailureHook.php', + 'PHPUnit\\Runner\\AfterTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php', + 'PHPUnit\\Runner\\AfterTestWarningHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterTestWarningHook.php', + 'PHPUnit\\Runner\\BaseTestRunner' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/BaseTestRunner.php', + 'PHPUnit\\Runner\\BeforeFirstTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/BeforeFirstTestHook.php', + 'PHPUnit\\Runner\\BeforeTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/BeforeTestHook.php', + 'PHPUnit\\Runner\\DefaultTestResultCache' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/DefaultTestResultCache.php', + 'PHPUnit\\Runner\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception.php', + 'PHPUnit\\Runner\\Filter\\ExcludeGroupFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\Factory' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/Factory.php', + 'PHPUnit\\Runner\\Filter\\GroupFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/GroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\IncludeGroupFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\NameFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php', + 'PHPUnit\\Runner\\Hook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/Hook.php', + 'PHPUnit\\Runner\\NullTestResultCache' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/NullTestResultCache.php', + 'PHPUnit\\Runner\\PhptTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/PhptTestCase.php', + 'PHPUnit\\Runner\\ResultCacheExtension' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCacheExtension.php', + 'PHPUnit\\Runner\\StandardTestSuiteLoader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php', + 'PHPUnit\\Runner\\TestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/TestHook.php', + 'PHPUnit\\Runner\\TestListenerAdapter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/TestListenerAdapter.php', + 'PHPUnit\\Runner\\TestResultCache' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResultCache.php', + 'PHPUnit\\Runner\\TestSuiteLoader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestSuiteLoader.php', + 'PHPUnit\\Runner\\TestSuiteSorter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestSuiteSorter.php', + 'PHPUnit\\Runner\\Version' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Version.php', + 'PHPUnit\\TextUI\\Command' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command.php', + 'PHPUnit\\TextUI\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Exception.php', + 'PHPUnit\\TextUI\\Help' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Help.php', + 'PHPUnit\\TextUI\\ResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/ResultPrinter.php', + 'PHPUnit\\TextUI\\TestRunner' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/TestRunner.php', + 'PHPUnit\\Util\\Annotation\\DocBlock' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Annotation/DocBlock.php', + 'PHPUnit\\Util\\Annotation\\Registry' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Annotation/Registry.php', + 'PHPUnit\\Util\\Blacklist' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Blacklist.php', + 'PHPUnit\\Util\\Color' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Color.php', + 'PHPUnit\\Util\\Configuration' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Configuration.php', + 'PHPUnit\\Util\\ConfigurationGenerator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/ConfigurationGenerator.php', + 'PHPUnit\\Util\\ErrorHandler' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/ErrorHandler.php', + 'PHPUnit\\Util\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Exception.php', + 'PHPUnit\\Util\\FileLoader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/FileLoader.php', + 'PHPUnit\\Util\\Filesystem' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Filesystem.php', + 'PHPUnit\\Util\\Filter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Filter.php', + 'PHPUnit\\Util\\Getopt' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Getopt.php', + 'PHPUnit\\Util\\GlobalState' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/GlobalState.php', + 'PHPUnit\\Util\\InvalidDataSetException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/InvalidDataSetException.php', + 'PHPUnit\\Util\\Json' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Json.php', + 'PHPUnit\\Util\\Log\\JUnit' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Log/JUnit.php', + 'PHPUnit\\Util\\Log\\TeamCity' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Log/TeamCity.php', + 'PHPUnit\\Util\\PHP\\AbstractPhpProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php', + 'PHPUnit\\Util\\PHP\\DefaultPhpProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/PHP/DefaultPhpProcess.php', + 'PHPUnit\\Util\\PHP\\WindowsPhpProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/PHP/WindowsPhpProcess.php', + 'PHPUnit\\Util\\Printer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Printer.php', + 'PHPUnit\\Util\\RegularExpression' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/RegularExpression.php', + 'PHPUnit\\Util\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Test.php', + 'PHPUnit\\Util\\TestDox\\CliTestDoxPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/CliTestDoxPrinter.php', + 'PHPUnit\\Util\\TestDox\\HtmlResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/HtmlResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\NamePrettifier' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php', + 'PHPUnit\\Util\\TestDox\\ResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/ResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\TestDoxPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/TestDoxPrinter.php', + 'PHPUnit\\Util\\TestDox\\TextResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/TextResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\XmlResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/XmlResultPrinter.php', + 'PHPUnit\\Util\\TextTestListRenderer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TextTestListRenderer.php', + 'PHPUnit\\Util\\Type' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Type.php', + 'PHPUnit\\Util\\VersionComparisonOperator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/VersionComparisonOperator.php', + 'PHPUnit\\Util\\XdebugFilterScriptGenerator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/XdebugFilterScriptGenerator.php', + 'PHPUnit\\Util\\Xml' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Xml.php', + 'PHPUnit\\Util\\XmlTestListRenderer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/XmlTestListRenderer.php', + 'PHP_Token' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_TokenWithScope' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/TokenWithScope.php', + 'PHP_TokenWithScopeAndVisibility' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/TokenWithScopeAndVisibility.php', + 'PHP_Token_ABSTRACT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Abstract.php', + 'PHP_Token_AMPERSAND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Ampersand.php', + 'PHP_Token_AND_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/AndEqual.php', + 'PHP_Token_ARRAY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Array.php', + 'PHP_Token_ARRAY_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ArrayCast.php', + 'PHP_Token_AS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/As.php', + 'PHP_Token_AT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/At.php', + 'PHP_Token_BACKTICK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Backtick.php', + 'PHP_Token_BAD_CHARACTER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/BadCharacter.php', + 'PHP_Token_BOOLEAN_AND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/BooleanAnd.php', + 'PHP_Token_BOOLEAN_OR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/BooleanOr.php', + 'PHP_Token_BOOL_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/BoolCast.php', + 'PHP_Token_BREAK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/break.php', + 'PHP_Token_CALLABLE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Callable.php', + 'PHP_Token_CARET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Caret.php', + 'PHP_Token_CASE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Case.php', + 'PHP_Token_CATCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Catch.php', + 'PHP_Token_CHARACTER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Character.php', + 'PHP_Token_CLASS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Class.php', + 'PHP_Token_CLASS_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ClassC.php', + 'PHP_Token_CLASS_NAME_CONSTANT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ClassNameConstant.php', + 'PHP_Token_CLONE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Clone.php', + 'PHP_Token_CLOSE_BRACKET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CloseBracket.php', + 'PHP_Token_CLOSE_CURLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CloseCurly.php', + 'PHP_Token_CLOSE_SQUARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CloseSquare.php', + 'PHP_Token_CLOSE_TAG' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CloseTag.php', + 'PHP_Token_COALESCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Coalesce.php', + 'PHP_Token_COALESCE_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CoalesceEqual.php', + 'PHP_Token_COLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Colon.php', + 'PHP_Token_COMMA' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Comma.php', + 'PHP_Token_COMMENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Comment.php', + 'PHP_Token_CONCAT_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ConcatEqual.php', + 'PHP_Token_CONST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Const.php', + 'PHP_Token_CONSTANT_ENCAPSED_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ConstantEncapsedString.php', + 'PHP_Token_CONTINUE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Continue.php', + 'PHP_Token_CURLY_OPEN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CurlyOpen.php', + 'PHP_Token_DEC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Dec.php', + 'PHP_Token_DECLARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Declare.php', + 'PHP_Token_DEFAULT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Default.php', + 'PHP_Token_DIR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Dir.php', + 'PHP_Token_DIV' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Div.php', + 'PHP_Token_DIV_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DivEqual.php', + 'PHP_Token_DNUMBER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DNumber.php', + 'PHP_Token_DO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Do.php', + 'PHP_Token_DOC_COMMENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DocComment.php', + 'PHP_Token_DOLLAR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Dollar.php', + 'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DollarOpenCurlyBraces.php', + 'PHP_Token_DOT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Dot.php', + 'PHP_Token_DOUBLE_ARROW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DoubleArrow.php', + 'PHP_Token_DOUBLE_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DoubleCast.php', + 'PHP_Token_DOUBLE_COLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DoubleColon.php', + 'PHP_Token_DOUBLE_QUOTES' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DoubleQuotes.php', + 'PHP_Token_ECHO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Echo.php', + 'PHP_Token_ELLIPSIS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Ellipsis.php', + 'PHP_Token_ELSE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Else.php', + 'PHP_Token_ELSEIF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Elseif.php', + 'PHP_Token_EMPTY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Empty.php', + 'PHP_Token_ENCAPSED_AND_WHITESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/EncapsedAndWhitespace.php', + 'PHP_Token_ENDDECLARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Enddeclare.php', + 'PHP_Token_ENDFOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Endfor.php', + 'PHP_Token_ENDFOREACH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Endforeach.php', + 'PHP_Token_ENDIF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Endif.php', + 'PHP_Token_ENDSWITCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Endswitch.php', + 'PHP_Token_ENDWHILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Endwhile.php', + 'PHP_Token_END_HEREDOC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/EndHeredoc.php', + 'PHP_Token_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Equal.php', + 'PHP_Token_EVAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Eval.php', + 'PHP_Token_EXCLAMATION_MARK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ExclamationMark.php', + 'PHP_Token_EXIT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Exit.php', + 'PHP_Token_EXTENDS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Extends.php', + 'PHP_Token_FILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/File.php', + 'PHP_Token_FINAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Final.php', + 'PHP_Token_FINALLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Finally.php', + 'PHP_Token_FN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Fn.php', + 'PHP_Token_FOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/For.php', + 'PHP_Token_FOREACH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Foreach.php', + 'PHP_Token_FUNCTION' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Function.php', + 'PHP_Token_FUNC_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/FuncC.php', + 'PHP_Token_GLOBAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Global.php', + 'PHP_Token_GOTO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Goto.php', + 'PHP_Token_GT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Gt.php', + 'PHP_Token_HALT_COMPILER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/HaltCompiler.php', + 'PHP_Token_IF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/If.php', + 'PHP_Token_IMPLEMENTS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Implements.php', + 'PHP_Token_INC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Inc.php', + 'PHP_Token_INCLUDE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Include.php', + 'PHP_Token_INCLUDE_ONCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IncludeOnce.php', + 'PHP_Token_INLINE_HTML' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/InlineHtml.php', + 'PHP_Token_INSTANCEOF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Instanceof.php', + 'PHP_Token_INSTEADOF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Insteadof.php', + 'PHP_Token_INTERFACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Interface.php', + 'PHP_Token_INT_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IntCast.php', + 'PHP_Token_ISSET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Isset.php', + 'PHP_Token_IS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IsEqual.php', + 'PHP_Token_IS_GREATER_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IsGreaterOrEqual.php', + 'PHP_Token_IS_IDENTICAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IsIdentical.php', + 'PHP_Token_IS_NOT_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IsNotEqual.php', + 'PHP_Token_IS_NOT_IDENTICAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IsNotIdentical.php', + 'PHP_Token_IS_SMALLER_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IsSmallerOrEqual.php', + 'PHP_Token_Includes' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Includes.php', + 'PHP_Token_LINE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Line.php', + 'PHP_Token_LIST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/List.php', + 'PHP_Token_LNUMBER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Lnumber.php', + 'PHP_Token_LOGICAL_AND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/LogicalAnd.php', + 'PHP_Token_LOGICAL_OR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/LogicalOr.php', + 'PHP_Token_LOGICAL_XOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/LogicalXor.php', + 'PHP_Token_LT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Lt.php', + 'PHP_Token_METHOD_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/MethodC.php', + 'PHP_Token_MINUS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Minus.php', + 'PHP_Token_MINUS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/MinusEqual.php', + 'PHP_Token_MOD_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ModEqual.php', + 'PHP_Token_MULT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Mult.php', + 'PHP_Token_MUL_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/MulEqual.php', + 'PHP_Token_NAMESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Namespace.php', + 'PHP_Token_NAME_FULLY_QUALIFIED' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/NameFullyQualified.php', + 'PHP_Token_NAME_QUALIFIED' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/NameQualified.php', + 'PHP_Token_NAME_RELATIVE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/NameRelative.php', + 'PHP_Token_NEW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/New.php', + 'PHP_Token_NS_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/NsC.php', + 'PHP_Token_NS_SEPARATOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/NsSeparator.php', + 'PHP_Token_NUM_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/NumString.php', + 'PHP_Token_OBJECT_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ObjectCast.php', + 'PHP_Token_OBJECT_OPERATOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ObjectOperator.php', + 'PHP_Token_OPEN_BRACKET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/OpenBracket.php', + 'PHP_Token_OPEN_CURLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/OpenCurly.php', + 'PHP_Token_OPEN_SQUARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/OpenSquare.php', + 'PHP_Token_OPEN_TAG' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/OpenTag.php', + 'PHP_Token_OPEN_TAG_WITH_ECHO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/OpenTagWithEcho.php', + 'PHP_Token_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/OrEqual.php', + 'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/PaamayimNekudotayim.php', + 'PHP_Token_PERCENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Percent.php', + 'PHP_Token_PIPE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Pipe.php', + 'PHP_Token_PLUS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Plus.php', + 'PHP_Token_PLUS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/PlusEqual.php', + 'PHP_Token_POW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Pow.php', + 'PHP_Token_POW_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/PowEqual.php', + 'PHP_Token_PRINT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Print.php', + 'PHP_Token_PRIVATE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Private.php', + 'PHP_Token_PROTECTED' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Protected.php', + 'PHP_Token_PUBLIC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Public.php', + 'PHP_Token_QUESTION_MARK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/QuestionMark.php', + 'PHP_Token_REQUIRE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Require.php', + 'PHP_Token_REQUIRE_ONCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/RequireOnce.php', + 'PHP_Token_RETURN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Return.php', + 'PHP_Token_SEMICOLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Semicolon.php', + 'PHP_Token_SL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Sl.php', + 'PHP_Token_SL_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/SlEqual.php', + 'PHP_Token_SPACESHIP' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Spaceship.php', + 'PHP_Token_SR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Sr.php', + 'PHP_Token_SR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/SrEqual.php', + 'PHP_Token_START_HEREDOC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/StartHeredoc.php', + 'PHP_Token_STATIC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Static.php', + 'PHP_Token_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/String.php', + 'PHP_Token_STRING_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/StringCast.php', + 'PHP_Token_STRING_VARNAME' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/StringVarname.php', + 'PHP_Token_SWITCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Switch.php', + 'PHP_Token_Stream' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Stream.php', + 'PHP_Token_Stream_CachingFactory' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CachingFactory.php', + 'PHP_Token_THROW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Throw.php', + 'PHP_Token_TILDE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Tilde.php', + 'PHP_Token_TRAIT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Trait.php', + 'PHP_Token_TRAIT_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/TraitC.php', + 'PHP_Token_TRY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Try.php', + 'PHP_Token_UNSET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Unset.php', + 'PHP_Token_UNSET_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/UnsetCast.php', + 'PHP_Token_USE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Use.php', + 'PHP_Token_USE_FUNCTION' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/UseFunction.php', + 'PHP_Token_Util' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Util.php', + 'PHP_Token_VAR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Var.php', + 'PHP_Token_VARIABLE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Variable.php', + 'PHP_Token_WHILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/While.php', + 'PHP_Token_WHITESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Whitespace.php', + 'PHP_Token_XOR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/XorEqual.php', + 'PHP_Token_YIELD' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Yield.php', + 'PHP_Token_YIELD_FROM' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/YieldFrom.php', + 'PharIo\\Manifest\\Application' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Application.php', + 'PharIo\\Manifest\\ApplicationName' => __DIR__ . '/..' . '/phar-io/manifest/src/values/ApplicationName.php', + 'PharIo\\Manifest\\Author' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Author.php', + 'PharIo\\Manifest\\AuthorCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/values/AuthorCollection.php', + 'PharIo\\Manifest\\AuthorCollectionIterator' => __DIR__ . '/..' . '/phar-io/manifest/src/values/AuthorCollectionIterator.php', + 'PharIo\\Manifest\\AuthorElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/AuthorElement.php', + 'PharIo\\Manifest\\AuthorElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/AuthorElementCollection.php', + 'PharIo\\Manifest\\BundledComponent' => __DIR__ . '/..' . '/phar-io/manifest/src/values/BundledComponent.php', + 'PharIo\\Manifest\\BundledComponentCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/values/BundledComponentCollection.php', + 'PharIo\\Manifest\\BundledComponentCollectionIterator' => __DIR__ . '/..' . '/phar-io/manifest/src/values/BundledComponentCollectionIterator.php', + 'PharIo\\Manifest\\BundlesElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/BundlesElement.php', + 'PharIo\\Manifest\\ComponentElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ComponentElement.php', + 'PharIo\\Manifest\\ComponentElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ComponentElementCollection.php', + 'PharIo\\Manifest\\ContainsElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ContainsElement.php', + 'PharIo\\Manifest\\CopyrightElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/CopyrightElement.php', + 'PharIo\\Manifest\\CopyrightInformation' => __DIR__ . '/..' . '/phar-io/manifest/src/values/CopyrightInformation.php', + 'PharIo\\Manifest\\ElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ElementCollection.php', + 'PharIo\\Manifest\\ElementCollectionException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ElementCollectionException.php', + 'PharIo\\Manifest\\Email' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Email.php', + 'PharIo\\Manifest\\Exception' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/Exception.php', + 'PharIo\\Manifest\\ExtElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ExtElement.php', + 'PharIo\\Manifest\\ExtElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ExtElementCollection.php', + 'PharIo\\Manifest\\Extension' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Extension.php', + 'PharIo\\Manifest\\ExtensionElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ExtensionElement.php', + 'PharIo\\Manifest\\InvalidApplicationNameException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php', + 'PharIo\\Manifest\\InvalidEmailException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/InvalidEmailException.php', + 'PharIo\\Manifest\\InvalidUrlException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/InvalidUrlException.php', + 'PharIo\\Manifest\\Library' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Library.php', + 'PharIo\\Manifest\\License' => __DIR__ . '/..' . '/phar-io/manifest/src/values/License.php', + 'PharIo\\Manifest\\LicenseElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/LicenseElement.php', + 'PharIo\\Manifest\\Manifest' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Manifest.php', + 'PharIo\\Manifest\\ManifestDocument' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ManifestDocument.php', + 'PharIo\\Manifest\\ManifestDocumentException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestDocumentException.php', + 'PharIo\\Manifest\\ManifestDocumentLoadingException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestDocumentLoadingException.php', + 'PharIo\\Manifest\\ManifestDocumentMapper' => __DIR__ . '/..' . '/phar-io/manifest/src/ManifestDocumentMapper.php', + 'PharIo\\Manifest\\ManifestDocumentMapperException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php', + 'PharIo\\Manifest\\ManifestElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ManifestElement.php', + 'PharIo\\Manifest\\ManifestElementException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestElementException.php', + 'PharIo\\Manifest\\ManifestLoader' => __DIR__ . '/..' . '/phar-io/manifest/src/ManifestLoader.php', + 'PharIo\\Manifest\\ManifestLoaderException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestLoaderException.php', + 'PharIo\\Manifest\\ManifestSerializer' => __DIR__ . '/..' . '/phar-io/manifest/src/ManifestSerializer.php', + 'PharIo\\Manifest\\PhpElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/PhpElement.php', + 'PharIo\\Manifest\\PhpExtensionRequirement' => __DIR__ . '/..' . '/phar-io/manifest/src/values/PhpExtensionRequirement.php', + 'PharIo\\Manifest\\PhpVersionRequirement' => __DIR__ . '/..' . '/phar-io/manifest/src/values/PhpVersionRequirement.php', + 'PharIo\\Manifest\\Requirement' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Requirement.php', + 'PharIo\\Manifest\\RequirementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/values/RequirementCollection.php', + 'PharIo\\Manifest\\RequirementCollectionIterator' => __DIR__ . '/..' . '/phar-io/manifest/src/values/RequirementCollectionIterator.php', + 'PharIo\\Manifest\\RequiresElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/RequiresElement.php', + 'PharIo\\Manifest\\Type' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Type.php', + 'PharIo\\Manifest\\Url' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Url.php', + 'PharIo\\Version\\AbstractVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/AbstractVersionConstraint.php', + 'PharIo\\Version\\AndVersionConstraintGroup' => __DIR__ . '/..' . '/phar-io/version/src/constraints/AndVersionConstraintGroup.php', + 'PharIo\\Version\\AnyVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/AnyVersionConstraint.php', + 'PharIo\\Version\\BuildMetaData' => __DIR__ . '/..' . '/phar-io/version/src/BuildMetaData.php', + 'PharIo\\Version\\ExactVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/ExactVersionConstraint.php', + 'PharIo\\Version\\Exception' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/Exception.php', + 'PharIo\\Version\\GreaterThanOrEqualToVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php', + 'PharIo\\Version\\InvalidPreReleaseSuffixException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php', + 'PharIo\\Version\\InvalidVersionException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/InvalidVersionException.php', + 'PharIo\\Version\\NoBuildMetaDataException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/NoBuildMetaDataException.php', + 'PharIo\\Version\\NoPreReleaseSuffixException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/NoPreReleaseSuffixException.php', + 'PharIo\\Version\\OrVersionConstraintGroup' => __DIR__ . '/..' . '/phar-io/version/src/constraints/OrVersionConstraintGroup.php', + 'PharIo\\Version\\PreReleaseSuffix' => __DIR__ . '/..' . '/phar-io/version/src/PreReleaseSuffix.php', + 'PharIo\\Version\\SpecificMajorAndMinorVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php', + 'PharIo\\Version\\SpecificMajorVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php', + 'PharIo\\Version\\UnsupportedVersionConstraintException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php', + 'PharIo\\Version\\Version' => __DIR__ . '/..' . '/phar-io/version/src/Version.php', + 'PharIo\\Version\\VersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/VersionConstraint.php', + 'PharIo\\Version\\VersionConstraintParser' => __DIR__ . '/..' . '/phar-io/version/src/VersionConstraintParser.php', + 'PharIo\\Version\\VersionConstraintValue' => __DIR__ . '/..' . '/phar-io/version/src/VersionConstraintValue.php', + 'PharIo\\Version\\VersionNumber' => __DIR__ . '/..' . '/phar-io/version/src/VersionNumber.php', + 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', + 'SebastianBergmann\\CodeCoverage\\CodeCoverage' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/CodeCoverage.php', + 'SebastianBergmann\\CodeCoverage\\CoveredCodeNotExecutedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Driver' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/Driver.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PCOV' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/PCOV.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PHPDBG' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/PHPDBG.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Xdebug' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/Xdebug.php', + 'SebastianBergmann\\CodeCoverage\\Exception' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/Exception.php', + 'SebastianBergmann\\CodeCoverage\\Filter' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Filter.php', + 'SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\CodeCoverage\\MissingCoversAnnotationException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php', + 'SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/AbstractNode.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Builder' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Builder.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Node\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/File.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Iterator' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Iterator.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Clover' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Clover.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Crap4j.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer.php', + 'SebastianBergmann\\CodeCoverage\\Report\\PHP' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/PHP.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Text' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Text.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/BuildInformation.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Coverage.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Method.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Node.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Project.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Report.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Source.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Tests.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Totals.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Unit.php', + 'SebastianBergmann\\CodeCoverage\\RuntimeException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/RuntimeException.php', + 'SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php', + 'SebastianBergmann\\CodeCoverage\\Util' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Util.php', + 'SebastianBergmann\\CodeCoverage\\Version' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Version.php', + 'SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => __DIR__ . '/..' . '/sebastian/code-unit-reverse-lookup/src/Wizard.php', + 'SebastianBergmann\\Comparator\\ArrayComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ArrayComparator.php', + 'SebastianBergmann\\Comparator\\Comparator' => __DIR__ . '/..' . '/sebastian/comparator/src/Comparator.php', + 'SebastianBergmann\\Comparator\\ComparisonFailure' => __DIR__ . '/..' . '/sebastian/comparator/src/ComparisonFailure.php', + 'SebastianBergmann\\Comparator\\DOMNodeComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/DOMNodeComparator.php', + 'SebastianBergmann\\Comparator\\DateTimeComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/DateTimeComparator.php', + 'SebastianBergmann\\Comparator\\DoubleComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/DoubleComparator.php', + 'SebastianBergmann\\Comparator\\ExceptionComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ExceptionComparator.php', + 'SebastianBergmann\\Comparator\\Factory' => __DIR__ . '/..' . '/sebastian/comparator/src/Factory.php', + 'SebastianBergmann\\Comparator\\MockObjectComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/MockObjectComparator.php', + 'SebastianBergmann\\Comparator\\NumericComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/NumericComparator.php', + 'SebastianBergmann\\Comparator\\ObjectComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ObjectComparator.php', + 'SebastianBergmann\\Comparator\\ResourceComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ResourceComparator.php', + 'SebastianBergmann\\Comparator\\ScalarComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ScalarComparator.php', + 'SebastianBergmann\\Comparator\\SplObjectStorageComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/SplObjectStorageComparator.php', + 'SebastianBergmann\\Comparator\\TypeComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/TypeComparator.php', + 'SebastianBergmann\\Diff\\Chunk' => __DIR__ . '/..' . '/sebastian/diff/src/Chunk.php', + 'SebastianBergmann\\Diff\\ConfigurationException' => __DIR__ . '/..' . '/sebastian/diff/src/Exception/ConfigurationException.php', + 'SebastianBergmann\\Diff\\Diff' => __DIR__ . '/..' . '/sebastian/diff/src/Diff.php', + 'SebastianBergmann\\Diff\\Differ' => __DIR__ . '/..' . '/sebastian/diff/src/Differ.php', + 'SebastianBergmann\\Diff\\Exception' => __DIR__ . '/..' . '/sebastian/diff/src/Exception/Exception.php', + 'SebastianBergmann\\Diff\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/diff/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\Diff\\Line' => __DIR__ . '/..' . '/sebastian/diff/src/Line.php', + 'SebastianBergmann\\Diff\\LongestCommonSubsequenceCalculator' => __DIR__ . '/..' . '/sebastian/diff/src/LongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\MemoryEfficientLongestCommonSubsequenceCalculator' => __DIR__ . '/..' . '/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\Output\\AbstractChunkOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/AbstractChunkOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOnlyOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOutputBuilderInterface' => __DIR__ . '/..' . '/sebastian/diff/src/Output/DiffOutputBuilderInterface.php', + 'SebastianBergmann\\Diff\\Output\\StrictUnifiedDiffOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/StrictUnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\UnifiedDiffOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Parser' => __DIR__ . '/..' . '/sebastian/diff/src/Parser.php', + 'SebastianBergmann\\Diff\\TimeEfficientLongestCommonSubsequenceCalculator' => __DIR__ . '/..' . '/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Environment\\Console' => __DIR__ . '/..' . '/sebastian/environment/src/Console.php', + 'SebastianBergmann\\Environment\\OperatingSystem' => __DIR__ . '/..' . '/sebastian/environment/src/OperatingSystem.php', + 'SebastianBergmann\\Environment\\Runtime' => __DIR__ . '/..' . '/sebastian/environment/src/Runtime.php', + 'SebastianBergmann\\Exporter\\Exporter' => __DIR__ . '/..' . '/sebastian/exporter/src/Exporter.php', + 'SebastianBergmann\\FileIterator\\Facade' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Facade.php', + 'SebastianBergmann\\FileIterator\\Factory' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Factory.php', + 'SebastianBergmann\\FileIterator\\Iterator' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Iterator.php', + 'SebastianBergmann\\GlobalState\\Blacklist' => __DIR__ . '/..' . '/sebastian/global-state/src/Blacklist.php', + 'SebastianBergmann\\GlobalState\\CodeExporter' => __DIR__ . '/..' . '/sebastian/global-state/src/CodeExporter.php', + 'SebastianBergmann\\GlobalState\\Exception' => __DIR__ . '/..' . '/sebastian/global-state/src/exceptions/Exception.php', + 'SebastianBergmann\\GlobalState\\Restorer' => __DIR__ . '/..' . '/sebastian/global-state/src/Restorer.php', + 'SebastianBergmann\\GlobalState\\RuntimeException' => __DIR__ . '/..' . '/sebastian/global-state/src/exceptions/RuntimeException.php', + 'SebastianBergmann\\GlobalState\\Snapshot' => __DIR__ . '/..' . '/sebastian/global-state/src/Snapshot.php', + 'SebastianBergmann\\ObjectEnumerator\\Enumerator' => __DIR__ . '/..' . '/sebastian/object-enumerator/src/Enumerator.php', + 'SebastianBergmann\\ObjectEnumerator\\Exception' => __DIR__ . '/..' . '/sebastian/object-enumerator/src/Exception.php', + 'SebastianBergmann\\ObjectEnumerator\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/object-enumerator/src/InvalidArgumentException.php', + 'SebastianBergmann\\ObjectReflector\\Exception' => __DIR__ . '/..' . '/sebastian/object-reflector/src/Exception.php', + 'SebastianBergmann\\ObjectReflector\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/object-reflector/src/InvalidArgumentException.php', + 'SebastianBergmann\\ObjectReflector\\ObjectReflector' => __DIR__ . '/..' . '/sebastian/object-reflector/src/ObjectReflector.php', + 'SebastianBergmann\\RecursionContext\\Context' => __DIR__ . '/..' . '/sebastian/recursion-context/src/Context.php', + 'SebastianBergmann\\RecursionContext\\Exception' => __DIR__ . '/..' . '/sebastian/recursion-context/src/Exception.php', + 'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/recursion-context/src/InvalidArgumentException.php', + 'SebastianBergmann\\ResourceOperations\\ResourceOperations' => __DIR__ . '/..' . '/sebastian/resource-operations/src/ResourceOperations.php', + 'SebastianBergmann\\Timer\\Exception' => __DIR__ . '/..' . '/phpunit/php-timer/src/Exception.php', + 'SebastianBergmann\\Timer\\RuntimeException' => __DIR__ . '/..' . '/phpunit/php-timer/src/RuntimeException.php', + 'SebastianBergmann\\Timer\\Timer' => __DIR__ . '/..' . '/phpunit/php-timer/src/Timer.php', + 'SebastianBergmann\\Type\\CallableType' => __DIR__ . '/..' . '/sebastian/type/src/CallableType.php', + 'SebastianBergmann\\Type\\Exception' => __DIR__ . '/..' . '/sebastian/type/src/exception/Exception.php', + 'SebastianBergmann\\Type\\GenericObjectType' => __DIR__ . '/..' . '/sebastian/type/src/GenericObjectType.php', + 'SebastianBergmann\\Type\\IterableType' => __DIR__ . '/..' . '/sebastian/type/src/IterableType.php', + 'SebastianBergmann\\Type\\NullType' => __DIR__ . '/..' . '/sebastian/type/src/NullType.php', + 'SebastianBergmann\\Type\\ObjectType' => __DIR__ . '/..' . '/sebastian/type/src/ObjectType.php', + 'SebastianBergmann\\Type\\RuntimeException' => __DIR__ . '/..' . '/sebastian/type/src/exception/RuntimeException.php', + 'SebastianBergmann\\Type\\SimpleType' => __DIR__ . '/..' . '/sebastian/type/src/SimpleType.php', + 'SebastianBergmann\\Type\\Type' => __DIR__ . '/..' . '/sebastian/type/src/Type.php', + 'SebastianBergmann\\Type\\TypeName' => __DIR__ . '/..' . '/sebastian/type/src/TypeName.php', + 'SebastianBergmann\\Type\\UnknownType' => __DIR__ . '/..' . '/sebastian/type/src/UnknownType.php', + 'SebastianBergmann\\Type\\VoidType' => __DIR__ . '/..' . '/sebastian/type/src/VoidType.php', + 'SebastianBergmann\\Version' => __DIR__ . '/..' . '/sebastian/version/src/Version.php', + 'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php', + 'Text_Template' => __DIR__ . '/..' . '/phpunit/php-text-template/src/Template.php', + 'TheSeer\\Tokenizer\\Exception' => __DIR__ . '/..' . '/theseer/tokenizer/src/Exception.php', + 'TheSeer\\Tokenizer\\NamespaceUri' => __DIR__ . '/..' . '/theseer/tokenizer/src/NamespaceUri.php', + 'TheSeer\\Tokenizer\\NamespaceUriException' => __DIR__ . '/..' . '/theseer/tokenizer/src/NamespaceUriException.php', + 'TheSeer\\Tokenizer\\Token' => __DIR__ . '/..' . '/theseer/tokenizer/src/Token.php', + 'TheSeer\\Tokenizer\\TokenCollection' => __DIR__ . '/..' . '/theseer/tokenizer/src/TokenCollection.php', + 'TheSeer\\Tokenizer\\TokenCollectionException' => __DIR__ . '/..' . '/theseer/tokenizer/src/TokenCollectionException.php', + 'TheSeer\\Tokenizer\\Tokenizer' => __DIR__ . '/..' . '/theseer/tokenizer/src/Tokenizer.php', + 'TheSeer\\Tokenizer\\XMLSerializer' => __DIR__ . '/..' . '/theseer/tokenizer/src/XMLSerializer.php', + 'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php', + 'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit101ae59d932d1dffdac3612ec53dc0f5::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit101ae59d932d1dffdac3612ec53dc0f5::$prefixDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInit101ae59d932d1dffdac3612ec53dc0f5::$prefixesPsr0; + $loader->classMap = ComposerStaticInit101ae59d932d1dffdac3612ec53dc0f5::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json new file mode 100644 index 00000000..56836421 --- /dev/null +++ b/vendor/composer/installed.json @@ -0,0 +1,7186 @@ +{ + "packages": [ + { + "name": "doctrine/inflector", + "version": "2.0.4", + "version_normalized": "2.0.4.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^8.2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "vimeo/psalm": "^4.10" + }, + "time": "2021-10-22T20:16:43+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + } + }, + "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": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "homepage": "https://www.doctrine-project.org/projects/inflector.html", + "keywords": [ + "inflection", + "inflector", + "lowercase", + "manipulation", + "php", + "plural", + "singular", + "strings", + "uppercase", + "words" + ], + "support": { + "issues": "https://github.com/doctrine/inflector/issues", + "source": "https://github.com/doctrine/inflector/tree/2.0.4" + }, + "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%2Finflector", + "type": "tidelift" + } + ], + "install-path": "../doctrine/inflector" + }, + { + "name": "doctrine/instantiator", + "version": "1.4.1", + "version_normalized": "1.4.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" + }, + "time": "2022-03-03T08:28:38+00:00", + "type": "library", + "installation-source": "dist", + "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.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%2Finstantiator", + "type": "tidelift" + } + ], + "install-path": "../doctrine/instantiator" + }, + { + "name": "doctrine/lexer", + "version": "1.2.3", + "version_normalized": "1.2.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" + }, + "time": "2022-02-28T11:07:21+00:00", + "type": "library", + "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.3" + }, + "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": "dragonmantank/cron-expression", + "version": "v2.3.1", + "version_normalized": "2.3.1.0", + "source": { + "type": "git", + "url": "https://github.com/dragonmantank/cron-expression.git", + "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/65b2d8ee1f10915efb3b55597da3404f096acba2", + "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2", + "shasum": "" + }, + "require": { + "php": "^7.0|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.4|^7.0|^8.0|^9.0" + }, + "time": "2020-10-13T00:52:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Cron\\": "src/Cron/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Chris Tankersley", + "email": "chris@ctankersley.com", + "homepage": "https://github.com/dragonmantank" + } + ], + "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", + "keywords": [ + "cron", + "schedule" + ], + "support": { + "issues": "https://github.com/dragonmantank/cron-expression/issues", + "source": "https://github.com/dragonmantank/cron-expression/tree/v2.3.1" + }, + "funding": [ + { + "url": "https://github.com/dragonmantank", + "type": "github" + } + ], + "install-path": "../dragonmantank/cron-expression" + }, + { + "name": "egulias/email-validator", + "version": "2.1.25", + "version_normalized": "2.1.25.0", + "source": { + "type": "git", + "url": "https://github.com/egulias/EmailValidator.git", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^1.0.1", + "php": ">=5.5", + "symfony/polyfill-intl-idn": "^1.10" + }, + "require-dev": { + "dominicsayers/isemail": "^3.0.7", + "phpunit/phpunit": "^4.8.36|^7.5.15", + "satooshi/php-coveralls": "^1.0.1" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "time": "2020-12-29T14:50:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Gulias Davis" + } + ], + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": [ + "email", + "emailvalidation", + "emailvalidator", + "validation", + "validator" + ], + "support": { + "issues": "https://github.com/egulias/EmailValidator/issues", + "source": "https://github.com/egulias/EmailValidator/tree/2.1.25" + }, + "funding": [ + { + "url": "https://github.com/egulias", + "type": "github" + } + ], + "install-path": "../egulias/email-validator" + }, + { + "name": "fakerphp/faker", + "version": "v1.19.0", + "version_normalized": "1.19.0.0", + "source": { + "type": "git", + "url": "https://github.com/FakerPHP/Faker.git", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "doctrine/persistence": "^1.3 || ^2.0", + "ext-intl": "*", + "symfony/phpunit-bridge": "^4.4 || ^5.2" + }, + "suggest": { + "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality." + }, + "time": "2022-02-02T17:38:57+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "v1.19-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/FakerPHP/Faker/issues", + "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" + }, + "install-path": "../fakerphp/faker" + }, + { + "name": "firebase/php-jwt", + "version": "v5.5.1", + "version_normalized": "5.5.1.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "83b609028194aa042ea33b5af2d41a7427de80e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/83b609028194aa042ea33b5af2d41a7427de80e6", + "reference": "83b609028194aa042ea33b5af2d41a7427de80e6", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8 <=9" + }, + "suggest": { + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + }, + "time": "2021-11-08T20:18:51+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/v5.5.1" + }, + "install-path": "../firebase/php-jwt" + }, + { + "name": "google/auth", + "version": "v1.18.0", + "version_normalized": "1.18.0.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-auth-library-php.git", + "reference": "21dd478e77b0634ed9e3a68613f74ed250ca9347" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/21dd478e77b0634ed9e3a68613f74ed250ca9347", + "reference": "21dd478e77b0634ed9e3a68613f74ed250ca9347", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0", + "guzzlehttp/guzzle": "^5.3.1|^6.2.1|^7.0", + "guzzlehttp/psr7": "^1.7|^2.0", + "php": ">=5.4", + "psr/cache": "^1.0|^2.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "guzzlehttp/promises": "0.1.1|^1.3", + "kelvinmo/simplejwt": "^0.2.5|^0.5.1", + "phpseclib/phpseclib": "^2.0.31", + "phpunit/phpunit": "^4.8.36|^5.7", + "sebastian/comparator": ">=1.2.3" + }, + "suggest": { + "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." + }, + "time": "2021-08-24T18:03:18+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "support": { + "docs": "https://googleapis.github.io/google-auth-library-php/master/", + "issues": "https://github.com/googleapis/google-auth-library-php/issues", + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.18.0" + }, + "install-path": "../google/auth" + }, + { + "name": "google/cloud-core", + "version": "v1.44.0", + "version_normalized": "1.44.0.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-cloud-php-core.git", + "reference": "72706f7d1824777f42294a3c9ccdaddaad670017" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/72706f7d1824777f42294a3c9ccdaddaad670017", + "reference": "72706f7d1824777f42294a3c9ccdaddaad670017", + "shasum": "" + }, + "require": { + "google/auth": "^1.18", + "guzzlehttp/guzzle": "^5.3|^6.0|^7.0", + "guzzlehttp/promises": "^1.3", + "guzzlehttp/psr7": "^1.7|^2.0", + "monolog/monolog": "^1.1|^2.0", + "php": ">=5.5", + "psr/http-message": "1.0.*", + "rize/uri-template": "~0.3" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "google/common-protos": "^1.0||^2.0", + "google/gax": "^1.9", + "opis/closure": "^3", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "^4.8|^5.0", + "squizlabs/php_codesniffer": "2.*" + }, + "suggest": { + "opis/closure": "May be used to serialize closures to process jobs in the batch daemon. Please require version ^3.", + "symfony/lock": "Required for the Spanner cached based session pool. Please require the following commit: 3.3.x-dev#1ba6ac9" + }, + "time": "2022-01-31T21:39:13+00:00", + "bin": [ + "bin/google-cloud-batch" + ], + "type": "library", + "extra": { + "component": { + "id": "cloud-core", + "target": "googleapis/google-cloud-php-core.git", + "path": "Core", + "entry": "src/ServiceBuilder.php" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Google\\Cloud\\Core\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", + "support": { + "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.44.0" + }, + "install-path": "../google/cloud-core" + }, + { + "name": "google/cloud-vision", + "version": "v1.5.4", + "version_normalized": "1.5.4.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-cloud-php-vision.git", + "reference": "450e09ae73885e1863143f48f90f17c48f717e97" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-vision/zipball/450e09ae73885e1863143f48f90f17c48f717e97", + "reference": "450e09ae73885e1863143f48f90f17c48f717e97", + "shasum": "" + }, + "require": { + "google/cloud-core": "^1.43", + "google/gax": "^1.1" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "google/cloud-storage": "^1.12", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "^4.8|^5.0", + "squizlabs/php_codesniffer": "2.*" + }, + "suggest": { + "ext-grpc": "The gRPC extension enables use of the performant gRPC transport", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions.", + "google/cloud-storage": "Annotate images stored in Google Cloud Storage" + }, + "time": "2022-02-08T21:14:28+00:00", + "type": "library", + "extra": { + "component": { + "id": "cloud-vision", + "target": "googleapis/google-cloud-php-vision.git", + "path": "Vision", + "entry": "src/VisionClient.php" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Google\\Cloud\\Vision\\": "src", + "GPBMetadata\\Google\\Cloud\\Vision\\": "metadata" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Cloud Vision Client for PHP", + "support": { + "source": "https://github.com/googleapis/google-cloud-php-vision/tree/v1.5.4" + }, + "install-path": "../google/cloud-vision" + }, + { + "name": "google/common-protos", + "version": "2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/common-protos-php.git", + "reference": "a1bcb7b37f1fa1c92d65c3c6339fc701a65916ee" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/a1bcb7b37f1fa1c92d65c3c6339fc701a65916ee", + "reference": "a1bcb7b37f1fa1c92d65c3c6339fc701a65916ee", + "shasum": "" + }, + "require": { + "google/protobuf": "^3.6.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36", + "sami/sami": "*" + }, + "time": "2022-01-13T20:17:53+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Google\\": "src", + "GPBMetadata\\Google\\": "metadata" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google API Common Protos for PHP", + "homepage": "https://github.com/googleapis/common-protos-php", + "keywords": [ + "google" + ], + "support": { + "issues": "https://github.com/googleapis/common-protos-php/issues", + "source": "https://github.com/googleapis/common-protos-php/tree/2.0.0" + }, + "install-path": "../google/common-protos" + }, + { + "name": "google/gax", + "version": "v1.12.0", + "version_normalized": "1.12.0.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/gax-php.git", + "reference": "d802c9b40c349f5368f077bfcbc2982e7c31f43c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/gax-php/zipball/d802c9b40c349f5368f077bfcbc2982e7c31f43c", + "reference": "d802c9b40c349f5368f077bfcbc2982e7c31f43c", + "shasum": "" + }, + "require": { + "google/auth": "^1.18.0", + "google/common-protos": "^1.0||^2.0", + "google/grpc-gcp": "^0.2", + "google/protobuf": "^3.12.2", + "grpc/grpc": "^1.13", + "guzzlehttp/promises": "^1.3", + "guzzlehttp/psr7": "^1.7.0||^2", + "php": ">=5.5" + }, + "conflict": { + "ext-protobuf": "<3.7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36", + "squizlabs/php_codesniffer": "3.*" + }, + "time": "2022-02-24T22:04:47+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Google\\ApiCore\\": "src", + "GPBMetadata\\ApiCore\\": "metadata/ApiCore" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Google API Core for PHP", + "homepage": "https://github.com/googleapis/gax-php", + "keywords": [ + "google" + ], + "support": { + "issues": "https://github.com/googleapis/gax-php/issues", + "source": "https://github.com/googleapis/gax-php/tree/v1.12.0" + }, + "install-path": "../google/gax" + }, + { + "name": "google/grpc-gcp", + "version": "v0.2.0", + "version_normalized": "0.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/grpc-gcp-php.git", + "reference": "2465c2273e11ada1e95155aa1e209f3b8f03c314" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GoogleCloudPlatform/grpc-gcp-php/zipball/2465c2273e11ada1e95155aa1e209f3b8f03c314", + "reference": "2465c2273e11ada1e95155aa1e209f3b8f03c314", + "shasum": "" + }, + "require": { + "google/auth": "^1.3", + "google/protobuf": "^v3.3.0", + "grpc/grpc": "^v1.13.0", + "php": ">=5.5.0", + "psr/cache": "^1.0.1||^2.0.0||^3.0.0" + }, + "require-dev": { + "google/cloud-spanner": "^1.7", + "phpunit/phpunit": "4.8.36" + }, + "time": "2021-09-27T22:57:18+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Grpc\\Gcp\\": "src/" + }, + "classmap": [ + "src/generated/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "gRPC GCP library for channel management", + "support": { + "issues": "https://github.com/GoogleCloudPlatform/grpc-gcp-php/issues", + "source": "https://github.com/GoogleCloudPlatform/grpc-gcp-php/tree/v0.2.0" + }, + "install-path": "../google/grpc-gcp" + }, + { + "name": "google/protobuf", + "version": "v3.19.4", + "version_normalized": "3.19.4.0", + "source": { + "type": "git", + "url": "https://github.com/protocolbuffers/protobuf-php.git", + "reference": "6f0a54186f133aff98f49d0f36a32d4a4f7d4cbd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/6f0a54186f133aff98f49d0f36a32d4a4f7d4cbd", + "reference": "6f0a54186f133aff98f49d0f36a32d4a4f7d4cbd", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8.0" + }, + "suggest": { + "ext-bcmath": "Need to support JSON deserialization" + }, + "time": "2022-01-28T17:23:32+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Google\\Protobuf\\": "src/Google/Protobuf", + "GPBMetadata\\Google\\Protobuf\\": "src/GPBMetadata/Google/Protobuf" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "proto library for PHP", + "homepage": "https://developers.google.com/protocol-buffers/", + "keywords": [ + "proto" + ], + "support": { + "issues": "https://github.com/protocolbuffers/protobuf-php/issues", + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.19.4" + }, + "install-path": "../google/protobuf" + }, + { + "name": "grpc/grpc", + "version": "1.42.0", + "version_normalized": "1.42.0.0", + "source": { + "type": "git", + "url": "https://github.com/grpc/grpc-php.git", + "reference": "9fa44f104cb92e924d4da547323a97f3d8aca6d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/grpc/grpc-php/zipball/9fa44f104cb92e924d4da547323a97f3d8aca6d4", + "reference": "9fa44f104cb92e924d4da547323a97f3d8aca6d4", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "google/auth": "^v1.3.0" + }, + "suggest": { + "ext-protobuf": "For better performance, install the protobuf C extension.", + "google/protobuf": "To get started using grpc quickly, install the native protobuf library." + }, + "time": "2021-11-19T08:13:51+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Grpc\\": "src/lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "gRPC library for PHP", + "homepage": "https://grpc.io", + "keywords": [ + "rpc" + ], + "support": { + "source": "https://github.com/grpc/grpc-php/tree/v1.42.0" + }, + "install-path": "../grpc/grpc" + }, + { + "name": "guzzlehttp/guzzle", + "version": "7.4.1", + "version_normalized": "7.4.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "ee0a041b1760e6a53d2a39c8c34115adc2af2c79" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ee0a041b1760e6a53d2a39c8c34115adc2af2c79", + "reference": "ee0a041b1760e6a53d2a39c8c34115adc2af2c79", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5", + "guzzlehttp/psr7": "^1.8.3 || ^2.1", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "ext-curl": "*", + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.5.5 || ^9.3.5", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "time": "2021-12-06T18:43:05+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.4-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "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": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.4.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "install-path": "../guzzlehttp/guzzle" + }, + { + "name": "guzzlehttp/promises", + "version": "1.5.1", + "version_normalized": "1.5.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4 || ^5.1" + }, + "time": "2021-10-22T20:56:57+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/1.5.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "install-path": "../guzzlehttp/promises" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.1.0", + "version_normalized": "2.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/089edd38f5b8abba6cb01567c2a8aaa47cec4c72", + "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.8 || ^9.3.10" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "time": "2021-10-06T17:43:30+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.1.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "install-path": "../guzzlehttp/psr7" + }, + { + "name": "hamcrest/hamcrest-php", + "version": "v2.0.1", + "version_normalized": "2.0.1.0", + "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": "" + }, + "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" + }, + "time": "2020-07-09T08:09:16+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "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" + }, + "install-path": "../hamcrest/hamcrest-php" + }, + { + "name": "intervention/image", + "version": "2.7.1", + "version_normalized": "2.7.1.0", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "744ebba495319501b873a4e48787759c72e3fb8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/744ebba495319501b873a4e48787759c72e3fb8c", + "reference": "744ebba495319501b873a4e48787759c72e3fb8c", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1 || ^2.0", + "php": ">=5.4.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.2", + "phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "time": "2021-12-16T16:49:26+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@olivervogel.com", + "homepage": "http://olivervogel.com/" + } + ], + "description": "Image handling and manipulation library with support for Laravel integration", + "homepage": "http://image.intervention.io/", + "keywords": [ + "gd", + "image", + "imagick", + "laravel", + "thumbnail", + "watermark" + ], + "support": { + "issues": "https://github.com/Intervention/image/issues", + "source": "https://github.com/Intervention/image/tree/2.7.1" + }, + "funding": [ + { + "url": "https://www.paypal.me/interventionphp", + "type": "custom" + }, + { + "url": "https://github.com/Intervention", + "type": "github" + } + ], + "install-path": "../intervention/image" + }, + { + "name": "laravel/framework", + "version": "v6.20.44", + "version_normalized": "6.20.44.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/framework.git", + "reference": "505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/framework/zipball/505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0", + "reference": "505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0", + "shasum": "" + }, + "require": { + "doctrine/inflector": "^1.4|^2.0", + "dragonmantank/cron-expression": "^2.3.1", + "egulias/email-validator": "^2.1.10", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "league/commonmark": "^1.3", + "league/flysystem": "^1.1", + "monolog/monolog": "^1.12|^2.0", + "nesbot/carbon": "^2.31", + "opis/closure": "^3.6", + "php": "^7.2.5|^8.0", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0", + "ramsey/uuid": "^3.7", + "swiftmailer/swiftmailer": "^6.0", + "symfony/console": "^4.3.4", + "symfony/debug": "^4.3.4", + "symfony/finder": "^4.3.4", + "symfony/http-foundation": "^4.3.4", + "symfony/http-kernel": "^4.3.4", + "symfony/polyfill-php73": "^1.17", + "symfony/process": "^4.3.4", + "symfony/routing": "^4.3.4", + "symfony/var-dumper": "^4.3.4", + "tijsverkoyen/css-to-inline-styles": "^2.2.1", + "vlucas/phpdotenv": "^3.3" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "replace": { + "illuminate/auth": "self.version", + "illuminate/broadcasting": "self.version", + "illuminate/bus": "self.version", + "illuminate/cache": "self.version", + "illuminate/config": "self.version", + "illuminate/console": "self.version", + "illuminate/container": "self.version", + "illuminate/contracts": "self.version", + "illuminate/cookie": "self.version", + "illuminate/database": "self.version", + "illuminate/encryption": "self.version", + "illuminate/events": "self.version", + "illuminate/filesystem": "self.version", + "illuminate/hashing": "self.version", + "illuminate/http": "self.version", + "illuminate/log": "self.version", + "illuminate/mail": "self.version", + "illuminate/notifications": "self.version", + "illuminate/pagination": "self.version", + "illuminate/pipeline": "self.version", + "illuminate/queue": "self.version", + "illuminate/redis": "self.version", + "illuminate/routing": "self.version", + "illuminate/session": "self.version", + "illuminate/support": "self.version", + "illuminate/translation": "self.version", + "illuminate/validation": "self.version", + "illuminate/view": "self.version" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.155", + "doctrine/dbal": "^2.6", + "filp/whoops": "^2.8", + "guzzlehttp/guzzle": "^6.3.1|^7.0.1", + "league/flysystem-cached-adapter": "^1.0", + "mockery/mockery": "~1.3.3|^1.4.2", + "moontoast/math": "^1.1", + "orchestra/testbench-core": "^4.8", + "pda/pheanstalk": "^4.0", + "phpunit/phpunit": "^7.5.15|^8.4|^9.3.3", + "predis/predis": "^1.1.1", + "symfony/cache": "^4.3.4" + }, + "suggest": { + "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.155).", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "ext-ftp": "Required to use the Flysystem FTP driver.", + "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", + "ext-memcached": "Required to use the memcache cache driver.", + "ext-pcntl": "Required to use all features of the queue worker.", + "ext-posix": "Required to use all features of the queue worker.", + "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", + "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", + "filp/whoops": "Required for friendly error pages in development (^2.8).", + "guzzlehttp/guzzle": "Required to use the Mailgun mail driver and the ping methods on schedules (^6.3.1|^7.0.1).", + "laravel/tinker": "Required to use the tinker console command (^2.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", + "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", + "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).", + "predis/predis": "Required to use the predis connector (^1.1.2).", + "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0).", + "symfony/cache": "Required to PSR-6 cache bridge (^4.3.4).", + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^1.2).", + "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)." + }, + "time": "2022-01-12T16:12:12+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/Illuminate/Foundation/helpers.php", + "src/Illuminate/Support/helpers.php" + ], + "psr-4": { + "Illuminate\\": "src/Illuminate/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Laravel Framework.", + "homepage": "https://laravel.com", + "keywords": [ + "framework", + "laravel" + ], + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "install-path": "../laravel/framework" + }, + { + "name": "league/commonmark", + "version": "1.6.7", + "version_normalized": "1.6.7.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/commonmark.git", + "reference": "2b8185c13bc9578367a5bf901881d1c1b5bbd09b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/2b8185c13bc9578367a5bf901881d1c1b5bbd09b", + "reference": "2b8185c13bc9578367a5bf901881d1c1b5bbd09b", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^7.1 || ^8.0" + }, + "conflict": { + "scrutinizer/ocular": "1.7.*" + }, + "require-dev": { + "cebe/markdown": "~1.0", + "commonmark/commonmark.js": "0.29.2", + "erusev/parsedown": "~1.0", + "ext-json": "*", + "github/gfm": "0.29.0", + "michelf/php-markdown": "~1.4", + "mikehaertl/php-shellcommand": "^1.4", + "phpstan/phpstan": "^0.12.90", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.2", + "scrutinizer/ocular": "^1.5", + "symfony/finder": "^4.2" + }, + "time": "2022-01-13T17:18:13+00:00", + "bin": [ + "bin/commonmark" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "League\\CommonMark\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and Github-Flavored Markdown (GFM)", + "homepage": "https://commonmark.thephpleague.com", + "keywords": [ + "commonmark", + "flavored", + "gfm", + "github", + "github-flavored", + "markdown", + "md", + "parser" + ], + "support": { + "docs": "https://commonmark.thephpleague.com/", + "issues": "https://github.com/thephpleague/commonmark/issues", + "rss": "https://github.com/thephpleague/commonmark/releases.atom", + "source": "https://github.com/thephpleague/commonmark" + }, + "funding": [ + { + "url": "https://www.colinodell.com/sponsor", + "type": "custom" + }, + { + "url": "https://www.paypal.me/colinpodell/10.00", + "type": "custom" + }, + { + "url": "https://github.com/colinodell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/commonmark", + "type": "tidelift" + } + ], + "install-path": "../league/commonmark" + }, + { + "name": "league/flysystem", + "version": "1.1.9", + "version_normalized": "1.1.9.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "094defdb4a7001845300334e7c1ee2335925ef99" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/094defdb4a7001845300334e7c1ee2335925ef99", + "reference": "094defdb4a7001845300334e7c1ee2335925ef99", + "shasum": "" + }, + "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" + }, + "time": "2021-12-09T09:40:50+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" + ], + "support": { + "issues": "https://github.com/thephpleague/flysystem/issues", + "source": "https://github.com/thephpleague/flysystem/tree/1.1.9" + }, + "funding": [ + { + "url": "https://offset.earth/frankdejonge", + "type": "other" + } + ], + "install-path": "../league/flysystem" + }, + { + "name": "league/mime-type-detection", + "version": "1.9.0", + "version_normalized": "1.9.0.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/mime-type-detection.git", + "reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/aa70e813a6ad3d1558fc927863d47309b4c23e69", + "reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.2", + "phpstan/phpstan": "^0.12.68", + "phpunit/phpunit": "^8.5.8 || ^9.3" + }, + "time": "2021-11-21T11:48:40+00:00", + "type": "library", + "installation-source": "dist", + "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.9.0" + }, + "funding": [ + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" + } + ], + "install-path": "../league/mime-type-detection" + }, + { + "name": "mockery/mockery", + "version": "1.5.0", + "version_normalized": "1.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", + "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", + "shasum": "" + }, + "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" + }, + "time": "2022-01-20T13:18:17+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "installation-source": "dist", + "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.5.0" + }, + "install-path": "../mockery/mockery" + }, + { + "name": "monolog/monolog", + "version": "2.4.0", + "version_normalized": "2.4.0.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "d7fd7450628561ba697b7097d86db72662f54aef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/d7fd7450628561ba697b7097d86db72662f54aef", + "reference": "d7fd7450628561ba697b7097d86db72662f54aef", + "shasum": "" + }, + "require": { + "php": ">=7.2", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" + }, + "provide": { + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^7", + "graylog2/gelf-php": "^1.4.2", + "mongodb/mongodb": "^1.8", + "php-amqplib/php-amqplib": "~2.4 || ^3", + "php-console/php-console": "^3.1.3", + "phpspec/prophecy": "^1.6.1", + "phpstan/phpstan": "^0.12.91", + "phpunit/phpunit": "^8.5", + "predis/predis": "^1.1", + "rollbar/rollbar": "^1.3 || ^2 || ^3", + "ruflin/elastica": ">=0.90@dev", + "swiftmailer/swiftmailer": "^5.3|^6.0" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + }, + "time": "2022-03-14T12:44:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "https://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/2.4.0" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "install-path": "../monolog/monolog" + }, + { + "name": "myclabs/deep-copy", + "version": "1.11.0", + "version_normalized": "1.11.0.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "time": "2022-03-03T13:19:32+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "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.11.0" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "install-path": "../myclabs/deep-copy" + }, + { + "name": "nesbot/carbon", + "version": "2.57.0", + "version_normalized": "2.57.0.0", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "4a54375c21eea4811dbd1149fe6b246517554e78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4a54375c21eea4811dbd1149fe6b246517554e78", + "reference": "4a54375c21eea4811dbd1149fe6b246517554e78", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.1.8 || ^8.0", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" + }, + "require-dev": { + "doctrine/dbal": "^2.0 || ^3.0", + "doctrine/orm": "^2.7", + "friendsofphp/php-cs-fixer": "^3.0", + "kylekatarnls/multi-tester": "^2.0", + "phpmd/phpmd": "^2.9", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.54 || ^1.0", + "phpunit/phpunit": "^7.5.20 || ^8.5.14", + "squizlabs/php_codesniffer": "^3.4" + }, + "time": "2022-02-13T18:13:33+00:00", + "bin": [ + "bin/carbon" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-3.x": "3.x-dev", + "dev-master": "2.x-dev" + }, + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Carbon\\": "src/Carbon/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "https://markido.com" + }, + { + "name": "kylekatarnls", + "homepage": "https://github.com/kylekatarnls" + } + ], + "description": "An API extension for DateTime that supports 281 different languages.", + "homepage": "https://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ], + "support": { + "docs": "https://carbon.nesbot.com/docs", + "issues": "https://github.com/briannesbitt/Carbon/issues", + "source": "https://github.com/briannesbitt/Carbon" + }, + "funding": [ + { + "url": "https://opencollective.com/Carbon", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "type": "tidelift" + } + ], + "install-path": "../nesbot/carbon" + }, + { + "name": "opis/closure", + "version": "3.6.3", + "version_normalized": "3.6.3.0", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/3d81e4309d2a927abbe66df935f4bb60082805ad", + "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0 || ^8.0" + }, + "require-dev": { + "jeremeamia/superclosure": "^2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "time": "2022-01-27T09:35:39+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.6.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "functions.php" + ], + "psr-4": { + "Opis\\Closure\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", + "homepage": "https://opis.io/closure", + "keywords": [ + "anonymous functions", + "closure", + "function", + "serializable", + "serialization", + "serialize" + ], + "support": { + "issues": "https://github.com/opis/closure/issues", + "source": "https://github.com/opis/closure/tree/3.6.3" + }, + "install-path": "../opis/closure" + }, + { + "name": "orchestra/testbench", + "version": "v4.18.0", + "version_normalized": "4.18.0.0", + "source": { + "type": "git", + "url": "https://github.com/orchestral/testbench.git", + "reference": "38d9292f5575a167995fde926612a728d622fe13" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/38d9292f5575a167995fde926612a728d622fe13", + "reference": "38d9292f5575a167995fde926612a728d622fe13", + "shasum": "" + }, + "require": { + "laravel/framework": "^6.20.12", + "mockery/mockery": "^1.3.3 || ^1.4.2", + "orchestra/testbench-core": "^4.18", + "php": ">=7.2 || >=8.0", + "phpunit/phpunit": "^7.5.15 || ^8.4 || ^9.3.3" + }, + "time": "2021-09-08T08:13:21+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mior Muhammad Zaki", + "email": "crynobone@gmail.com", + "homepage": "https://github.com/crynobone" + } + ], + "description": "Laravel Testing Helper for Packages Development", + "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", + "keywords": [ + "BDD", + "TDD", + "laravel", + "orchestra-platform", + "orchestral", + "testing" + ], + "support": { + "issues": "https://github.com/orchestral/testbench/issues", + "source": "https://github.com/orchestral/testbench/tree/v4.18.0" + }, + "funding": [ + { + "url": "https://paypal.me/crynobone", + "type": "custom" + }, + { + "url": "https://liberapay.com/crynobone", + "type": "liberapay" + } + ], + "install-path": "../orchestra/testbench" + }, + { + "name": "orchestra/testbench-core", + "version": "v4.18.0", + "version_normalized": "4.18.0.0", + "source": { + "type": "git", + "url": "https://github.com/orchestral/testbench-core.git", + "reference": "6d6ce5e62a25bc796625ed56d4353e8071bf8693" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/6d6ce5e62a25bc796625ed56d4353e8071bf8693", + "reference": "6d6ce5e62a25bc796625ed56d4353e8071bf8693", + "shasum": "" + }, + "require": { + "fakerphp/faker": "^1.9.1", + "php": ">=7.2 || >=8.0" + }, + "require-dev": { + "laravel/framework": "^6.20.14", + "laravel/laravel": "6.x-dev", + "mockery/mockery": "^1.3.3 || ^1.4.2", + "phpunit/phpunit": "^7.5.15 || ^8.4 || ^9.3.3" + }, + "suggest": { + "laravel/framework": "Required for testing (^6.20.12).", + "mockery/mockery": "Allow using Mockery for testing (^1.3.2).", + "orchestra/testbench-browser-kit": "Allow using legacy Laravel BrowserKit for testing (^4.0).", + "orchestra/testbench-dusk": "Allow using Laravel Dusk for testing (^4.0).", + "phpunit/phpunit": "Allow using PHPUnit for testing (^7.5.15|^8.4|^9.3.3)." + }, + "time": "2021-09-02T05:33:20+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Orchestra\\Testbench\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mior Muhammad Zaki", + "email": "crynobone@gmail.com", + "homepage": "https://github.com/crynobone" + } + ], + "description": "Testing Helper for Laravel Development", + "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", + "keywords": [ + "BDD", + "TDD", + "laravel", + "orchestra-platform", + "orchestral", + "testing" + ], + "support": { + "issues": "https://github.com/orchestral/testbench/issues", + "source": "https://github.com/orchestral/testbench-core" + }, + "funding": [ + { + "url": "https://paypal.me/crynobone", + "type": "custom" + }, + { + "url": "https://liberapay.com/crynobone", + "type": "liberapay" + } + ], + "install-path": "../orchestra/testbench-core" + }, + { + "name": "paragonie/random_compat", + "version": "v9.99.100", + "version_normalized": "9.99.100.0", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", + "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." + }, + "time": "2020-10-15T08:29:30+00:00", + "type": "library", + "installation-source": "dist", + "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" + ], + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/random_compat/issues", + "source": "https://github.com/paragonie/random_compat" + }, + "install-path": "../paragonie/random_compat" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "version_normalized": "2.0.3.0", + "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": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "time": "2021-07-20T11:28:43+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "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" + }, + "install-path": "../phar-io/manifest" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "version_normalized": "3.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "time": "2022-02-21T01:04:05+00:00", + "type": "library", + "installation-source": "dist", + "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.2.1" + }, + "install-path": "../phar-io/version" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "version_normalized": "2.2.0.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": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "time": "2020-06-27T09:03:43+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "installation-source": "dist", + "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" + }, + "install-path": "../phpdocumentor/reflection-common" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.3.0", + "version_normalized": "5.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "shasum": "" + }, + "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", + "psalm/phar": "^4.8" + }, + "time": "2021-10-19T17:43:47+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "installation-source": "dist", + "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/5.3.0" + }, + "install-path": "../phpdocumentor/reflection-docblock" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.6.0", + "version_normalized": "1.6.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*", + "psalm/phar": "^4.8" + }, + "time": "2022-01-04T19:58:01+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + } + }, + "installation-source": "dist", + "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.6.0" + }, + "install-path": "../phpdocumentor/type-resolver" + }, + { + "name": "phpoption/phpoption", + "version": "1.8.1", + "version_normalized": "1.8.1.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" + }, + "time": "2021-12-04T23:24:31+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" + }, + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.8.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "install-path": "../phpoption/phpoption" + }, + { + "name": "phpspec/prophecy", + "version": "v1.15.0", + "version_normalized": "1.15.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.2", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^6.0 || ^7.0", + "phpunit/phpunit": "^8.0 || ^9.0" + }, + "time": "2021-12-08T12:19:24+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "installation-source": "dist", + "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/v1.15.0" + }, + "install-path": "../phpspec/prophecy" + }, + { + "name": "phpunit/php-code-coverage", + "version": "7.0.15", + "version_normalized": "7.0.15.0", + "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": "" + }, + "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" + }, + "time": "2021-07-26T12:20:09+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.0-dev" + } + }, + "installation-source": "dist", + "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" + } + ], + "install-path": "../phpunit/php-code-coverage" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.5", + "version_normalized": "2.0.5.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "time": "2021-12-02T12:42:26+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "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.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../phpunit/php-file-iterator" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "version_normalized": "1.2.1.0", + "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" + }, + "time": "2015-06-21T13:50:34+00:00", + "type": "library", + "installation-source": "dist", + "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" + }, + "install-path": "../phpunit/php-text-template" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.3", + "version_normalized": "2.1.3.0", + "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": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "time": "2020-11-30T08:20:02+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "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" + } + ], + "install-path": "../phpunit/php-timer" + }, + { + "name": "phpunit/php-token-stream", + "version": "4.0.4", + "version_normalized": "4.0.4.0", + "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": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "time": "2020-08-04T08:28:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "installation-source": "dist", + "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, + "install-path": "../phpunit/php-token-stream" + }, + { + "name": "phpunit/phpunit", + "version": "8.5.24", + "version_normalized": "8.5.24.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "293cb0099d75407d971a73f41e51f35b664667ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/293cb0099d75407d971a73f41e51f35b664667ed", + "reference": "293cb0099d75407d971a73f41e51f35b664667ed", + "shasum": "" + }, + "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" + }, + "time": "2022-03-05T16:52:36+00:00", + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.5-dev" + } + }, + "installation-source": "dist", + "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.24" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../phpunit/phpunit" + }, + { + "name": "psr/cache", + "version": "2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "time": "2021-02-03T23:23:37+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": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/2.0.0" + }, + "install-path": "../psr/cache" + }, + { + "name": "psr/container", + "version": "1.1.2", + "version_normalized": "1.1.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "time": "2021-11-05T16:50:12+00:00", + "type": "library", + "installation-source": "dist", + "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.2" + }, + "install-path": "../psr/container" + }, + { + "name": "psr/http-client", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0" + }, + "time": "2020-06-29T06:28:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client/tree/master" + }, + "install-path": "../psr/http-client" + }, + { + "name": "psr/http-factory", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0" + }, + "time": "2019-04-30T12:38:16+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 interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/master" + }, + "install-path": "../psr/http-factory" + }, + { + "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": "" + }, + "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" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, + "install-path": "../psr/http-message" + }, + { + "name": "psr/log", + "version": "2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "time": "2021-07-14T16:41:46+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "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/2.0.0" + }, + "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": "" + }, + "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" + ], + "support": { + "source": "https://github.com/php-fig/simple-cache/tree/master" + }, + "install-path": "../psr/simple-cache" + }, + { + "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": "" + }, + "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.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "install-path": "../ralouphie/getallheaders" + }, + { + "name": "ramsey/uuid", + "version": "3.9.6", + "version_normalized": "3.9.6.0", + "source": { + "type": "git", + "url": "https://github.com/ramsey/uuid.git", + "reference": "ffa80ab953edd85d5b6c004f96181a538aad35a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/ffa80ab953edd85d5b6c004f96181a538aad35a3", + "reference": "ffa80ab953edd85d5b6c004f96181a538aad35a3", + "shasum": "" + }, + "require": { + "ext-json": "*", + "paragonie/random_compat": "^1 | ^2 | ^9.99.99", + "php": "^5.4 | ^7.0 | ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "replace": { + "rhumsaa/uuid": "self.version" + }, + "require-dev": { + "codeception/aspect-mock": "^1 | ^2", + "doctrine/annotations": "^1.2", + "goaop/framework": "1.0.0-alpha.2 | ^1 | >=2.1.0 <=2.3.2", + "mockery/mockery": "^0.9.11 | ^1", + "moontoast/math": "^1.1", + "nikic/php-parser": "<=4.5.0", + "paragonie/random-lib": "^2", + "php-mock/php-mock-phpunit": "^0.3 | ^1.1 | ^2.6", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpunit/phpunit": ">=4.8.36 <9.0.0 | >=9.3.0", + "squizlabs/php_codesniffer": "^3.5", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "ext-ctype": "Provides support for PHP Ctype functions", + "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", + "ext-openssl": "Provides the OpenSSL extension for use with the OpenSslGenerator", + "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", + "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", + "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", + "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", + "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." + }, + "time": "2021-09-25T23:07:42+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Ramsey\\Uuid\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + }, + { + "name": "Marijn Huizendveld", + "email": "marijn.huizendveld@gmail.com" + }, + { + "name": "Thibaud Fabre", + "email": "thibaud@aztech.io" + } + ], + "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", + "homepage": "https://github.com/ramsey/uuid", + "keywords": [ + "guid", + "identifier", + "uuid" + ], + "support": { + "issues": "https://github.com/ramsey/uuid/issues", + "rss": "https://github.com/ramsey/uuid/releases.atom", + "source": "https://github.com/ramsey/uuid", + "wiki": "https://github.com/ramsey/uuid/wiki" + }, + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid", + "type": "tidelift" + } + ], + "install-path": "../ramsey/uuid" + }, + { + "name": "rize/uri-template", + "version": "0.3.4", + "version_normalized": "0.3.4.0", + "source": { + "type": "git", + "url": "https://github.com/rize/UriTemplate.git", + "reference": "2a874863c48d643b9e2e254ab288ec203060a0b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/2a874863c48d643b9e2e254ab288ec203060a0b8", + "reference": "2a874863c48d643b9e2e254ab288ec203060a0b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.36" + }, + "time": "2021-10-09T06:30:16+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Rize\\": "src/Rize" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marut K", + "homepage": "http://twitter.com/rezigned" + } + ], + "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", + "keywords": [ + "RFC 6570", + "template", + "uri" + ], + "support": { + "issues": "https://github.com/rize/UriTemplate/issues", + "source": "https://github.com/rize/UriTemplate/tree/0.3.4" + }, + "funding": [ + { + "url": "https://www.paypal.me/rezigned", + "type": "custom" + }, + { + "url": "https://opencollective.com/rize-uri-template", + "type": "open_collective" + } + ], + "install-path": "../rize/uri-template" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.2", + "version_normalized": "1.0.2.0", + "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": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "time": "2020-11-30T08:15:22+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "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" + } + ], + "install-path": "../sebastian/code-unit-reverse-lookup" + }, + { + "name": "sebastian/comparator", + "version": "3.0.3", + "version_normalized": "3.0.3.0", + "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": "" + }, + "require": { + "php": ">=7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "time": "2020-11-30T08:04:30+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "dist", + "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" + } + ], + "install-path": "../sebastian/comparator" + }, + { + "name": "sebastian/diff", + "version": "3.0.3", + "version_normalized": "3.0.3.0", + "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": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "time": "2020-11-30T07:59:04+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "dist", + "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" + } + ], + "install-path": "../sebastian/diff" + }, + { + "name": "sebastian/environment", + "version": "4.2.4", + "version_normalized": "4.2.4.0", + "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": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "time": "2020-11-30T07:53:42+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "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" + } + ], + "install-path": "../sebastian/environment" + }, + { + "name": "sebastian/exporter", + "version": "3.1.4", + "version_normalized": "3.1.4.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^8.5" + }, + "time": "2021-11-11T13:51:24+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "installation-source": "dist", + "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.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/exporter" + }, + { + "name": "sebastian/global-state", + "version": "3.0.2", + "version_normalized": "3.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "shasum": "" + }, + "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": "*" + }, + "time": "2022-02-10T06:55:38+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "dist", + "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.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/global-state" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.4", + "version_normalized": "3.0.4.0", + "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": "" + }, + "require": { + "php": ">=7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "time": "2020-11-30T07:40:27+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "installation-source": "dist", + "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" + } + ], + "install-path": "../sebastian/object-enumerator" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.2", + "version_normalized": "1.1.2.0", + "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": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "time": "2020-11-30T07:37:18+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "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" + } + ], + "install-path": "../sebastian/object-reflector" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.1", + "version_normalized": "3.0.1.0", + "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": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "time": "2020-11-30T07:34:24+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "installation-source": "dist", + "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" + } + ], + "install-path": "../sebastian/recursion-context" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.2", + "version_normalized": "2.0.2.0", + "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": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2020-11-30T07:30:19+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "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" + } + ], + "install-path": "../sebastian/resource-operations" + }, + { + "name": "sebastian/type", + "version": "1.1.4", + "version_normalized": "1.1.4.0", + "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": "" + }, + "require": { + "php": ">=7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "time": "2020-11-30T07:25:11+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "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" + } + ], + "install-path": "../sebastian/type" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "version_normalized": "2.0.1.0", + "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" + }, + "time": "2016-10-03T07:35:21+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "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" + }, + "install-path": "../sebastian/version" + }, + { + "name": "sempro/phpunit-pretty-print", + "version": "1.4.0", + "version_normalized": "1.4.0.0", + "source": { + "type": "git", + "url": "https://github.com/s360digital/phpunit-pretty-print.git", + "reference": "fa623aa8a17aece4a2b69e54b07a5e37572d1f1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/s360digital/phpunit-pretty-print/zipball/fa623aa8a17aece4a2b69e54b07a5e37572d1f1d", + "reference": "fa623aa8a17aece4a2b69e54b07a5e37572d1f1d", + "shasum": "" + }, + "require": { + "php": ">=7.1.0", + "phpunit/phpunit": "^7 || ^8 || ^9" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16" + }, + "time": "2021-01-04T13:25:10+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Sempro\\PHPUnitPrettyPrinter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Prettify PHPUnit output", + "support": { + "issues": "https://github.com/s360digital/phpunit-pretty-print/issues", + "source": "https://github.com/s360digital/phpunit-pretty-print/tree/1.4.0" + }, + "install-path": "../sempro/phpunit-pretty-print" + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v6.3.0", + "version_normalized": "6.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8a5d5072dca8f48460fce2f4131fcc495eec654c", + "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c", + "shasum": "" + }, + "require": { + "egulias/email-validator": "^2.0|^3.1", + "php": ">=7.0.0", + "symfony/polyfill-iconv": "^1.0", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "symfony/phpunit-bridge": "^4.4|^5.4" + }, + "suggest": { + "ext-intl": "Needed to support internationalized email addresses" + }, + "time": "2021-10-18T15:26:12+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "https://swiftmailer.symfony.com", + "keywords": [ + "email", + "mail", + "mailer" + ], + "support": { + "issues": "https://github.com/swiftmailer/swiftmailer/issues", + "source": "https://github.com/swiftmailer/swiftmailer/tree/v6.3.0" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/swiftmailer/swiftmailer", + "type": "tidelift" + } + ], + "abandoned": "symfony/mailer", + "install-path": "../swiftmailer/swiftmailer" + }, + { + "name": "symfony/console", + "version": "v4.4.38", + "version_normalized": "4.4.38.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "5a50085bf5460f0c0d60a50b58388c1249826b8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/5a50085bf5460f0c0d60a50b58388c1249826b8a", + "reference": "5a50085bf5460f0c0d60a50b58388c1249826b8a", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2" + }, + "conflict": { + "psr/log": ">=3", + "symfony/dependency-injection": "<3.4", + "symfony/event-dispatcher": "<4.3|>=5", + "symfony/lock": "<4.4", + "symfony/process": "<3.3" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/event-dispatcher": "^4.3", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/var-dumper": "^4.3|^5.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "time": "2022-01-30T21:23:57+00:00", + "type": "library", + "installation-source": "dist", + "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": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/console/tree/v4.4.38" + }, + "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" + } + ], + "install-path": "../symfony/console" + }, + { + "name": "symfony/css-selector", + "version": "v6.0.3", + "version_normalized": "6.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "1955d595c12c111629cc814d3f2a2ff13580508a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/1955d595c12c111629cc814d3f2a2ff13580508a", + "reference": "1955d595c12c111629cc814d3f2a2ff13580508a", + "shasum": "" + }, + "require": { + "php": ">=8.0.2" + }, + "time": "2022-01-02T09:55:41+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Converts CSS selectors to XPath expressions", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/css-selector/tree/v6.0.3" + }, + "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" + } + ], + "install-path": "../symfony/css-selector" + }, + { + "name": "symfony/debug", + "version": "v4.4.37", + "version_normalized": "4.4.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "5de6c6e7f52b364840e53851c126be4d71e60470" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/5de6c6e7f52b364840e53851c126be4d71e60470", + "reference": "5de6c6e7f52b364840e53851c126be4d71e60470", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "psr/log": "^1|^2|^3" + }, + "conflict": { + "symfony/http-kernel": "<3.4" + }, + "require-dev": { + "symfony/http-kernel": "^3.4|^4.0|^5.0" + }, + "time": "2022-01-02T09:41:36+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "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": "Provides tools to ease debugging PHP code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/debug/tree/v4.4.37" + }, + "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" + } + ], + "install-path": "../symfony/debug" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.0", + "version_normalized": "2.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2021-07-12T14:48:14+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "function.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": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.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" + } + ], + "install-path": "../symfony/deprecation-contracts" + }, + { + "name": "symfony/error-handler", + "version": "v4.4.37", + "version_normalized": "4.4.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/error-handler.git", + "reference": "8d80ad881e1ce17979547873d093e3c987a6a629" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/8d80ad881e1ce17979547873d093e3c987a6a629", + "reference": "8d80ad881e1ce17979547873d093e3c987a6a629", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "psr/log": "^1|^2|^3", + "symfony/debug": "^4.4.5", + "symfony/var-dumper": "^4.4|^5.0" + }, + "require-dev": { + "symfony/http-kernel": "^4.4|^5.0", + "symfony/serializer": "^4.4|^5.0" + }, + "time": "2022-01-02T09:41:36+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\ErrorHandler\\": "" + }, + "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": "Provides tools to manage errors and ease debugging PHP code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/error-handler/tree/v4.4.37" + }, + "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" + } + ], + "install-path": "../symfony/error-handler" + }, + { + "name": "symfony/event-dispatcher", + "version": "v4.4.37", + "version_normalized": "4.4.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "3ccfcfb96ecce1217d7b0875a0736976bc6e63dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/3ccfcfb96ecce1217d7b0875a0736976bc6e63dc", + "reference": "3ccfcfb96ecce1217d7b0875a0736976bc6e63dc", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/event-dispatcher-contracts": "^1.1", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/dependency-injection": "<3.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "1.1" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/error-handler": "~3.4|~4.4", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/stopwatch": "^3.4|^4.0|^5.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "time": "2022-01-02T09:41:36+00:00", + "type": "library", + "installation-source": "dist", + "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": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.37" + }, + "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" + } + ], + "install-path": "../symfony/event-dispatcher" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v1.1.11", + "version_normalized": "1.1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "01e9a4efac0ee33a05dfdf93b346f62e7d0e998c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/01e9a4efac0ee33a05dfdf93b346f62e7d0e998c", + "reference": "01e9a4efac0ee33a05dfdf93b346f62e7d0e998c", + "shasum": "" + }, + "require": { + "php": ">=7.1.3" + }, + "suggest": { + "psr/event-dispatcher": "", + "symfony/event-dispatcher-implementation": "" + }, + "time": "2021-03-23T15:25:38+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.1-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "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" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.1.11" + }, + "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" + } + ], + "install-path": "../symfony/event-dispatcher-contracts" + }, + { + "name": "symfony/finder", + "version": "v4.4.37", + "version_normalized": "4.4.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "b17d76d7ed179f017aad646e858c90a2771af15d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/b17d76d7ed179f017aad646e858c90a2771af15d", + "reference": "b17d76d7ed179f017aad646e858c90a2771af15d", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-php80": "^1.16" + }, + "time": "2022-01-02T09:41:36+00:00", + "type": "library", + "installation-source": "dist", + "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": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v4.4.37" + }, + "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" + } + ], + "install-path": "../symfony/finder" + }, + { + "name": "symfony/http-client-contracts", + "version": "v2.5.0", + "version_normalized": "2.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "ec82e57b5b714dbb69300d348bd840b345e24166" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/ec82e57b5b714dbb69300d348bd840b345e24166", + "reference": "ec82e57b5b714dbb69300d348bd840b345e24166", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/http-client-implementation": "" + }, + "time": "2021-11-03T09:24:47+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\HttpClient\\": "" + } + }, + "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 HTTP clients", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.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" + } + ], + "install-path": "../symfony/http-client-contracts" + }, + { + "name": "symfony/http-foundation", + "version": "v4.4.39", + "version_normalized": "4.4.39.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "60e8e42a4579551e5ec887d04380e2ab9e4cc314" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/60e8e42a4579551e5ec887d04380e2ab9e4cc314", + "reference": "60e8e42a4579551e5ec887d04380e2ab9e4cc314", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/mime": "^4.3|^5.0", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "predis/predis": "~1.0", + "symfony/expression-language": "^3.4|^4.0|^5.0" + }, + "time": "2022-03-04T07:06:13+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "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": "Defines an object-oriented layer for the HTTP specification", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-foundation/tree/v4.4.39" + }, + "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" + } + ], + "install-path": "../symfony/http-foundation" + }, + { + "name": "symfony/http-kernel", + "version": "v4.4.39", + "version_normalized": "4.4.39.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "19d1cacefe81cb448227cc4d5909fb36e2e23081" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/19d1cacefe81cb448227cc4d5909fb36e2e23081", + "reference": "19d1cacefe81cb448227cc4d5909fb36e2e23081", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "psr/log": "^1|^2", + "symfony/error-handler": "^4.4", + "symfony/event-dispatcher": "^4.4", + "symfony/http-client-contracts": "^1.1|^2", + "symfony/http-foundation": "^4.4.30|^5.3.7", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/browser-kit": "<4.3", + "symfony/config": "<3.4", + "symfony/console": ">=5", + "symfony/dependency-injection": "<4.3", + "symfony/translation": "<4.2", + "twig/twig": "<1.43|<2.13,>=2" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/cache": "^1.0|^2.0|^3.0", + "symfony/browser-kit": "^4.3|^5.0", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/console": "^3.4|^4.0", + "symfony/css-selector": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^4.3|^5.0", + "symfony/dom-crawler": "^3.4|^4.0|^5.0", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/finder": "^3.4|^4.0|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/routing": "^3.4|^4.0|^5.0", + "symfony/stopwatch": "^3.4|^4.0|^5.0", + "symfony/templating": "^3.4|^4.0|^5.0", + "symfony/translation": "^4.2|^5.0", + "symfony/translation-contracts": "^1.1|^2", + "twig/twig": "^1.43|^2.13|^3.0.4" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "" + }, + "time": "2022-03-05T21:04:55+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "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": "Provides a structured process for converting a Request into a Response", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-kernel/tree/v4.4.39" + }, + "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" + } + ], + "install-path": "../symfony/http-kernel" + }, + { + "name": "symfony/mime", + "version": "v5.4.3", + "version_normalized": "5.4.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/mime.git", + "reference": "e1503cfb5c9a225350f549d3bb99296f4abfb80f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mime/zipball/e1503cfb5c9a225350f549d3bb99296f4abfb80f", + "reference": "e1503cfb5c9a225350f549d3bb99296f4abfb80f", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "egulias/email-validator": "~3.0.0", + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/mailer": "<4.4" + }, + "require-dev": { + "egulias/email-validator": "^2.1.10|^3.1", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/property-access": "^4.4|^5.1|^6.0", + "symfony/property-info": "^4.4|^5.1|^6.0", + "symfony/serializer": "^5.2|^6.0" + }, + "time": "2022-01-02T09:53:40+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mime\\": "" + }, + "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": "Allows manipulating MIME messages", + "homepage": "https://symfony.com", + "keywords": [ + "mime", + "mime-type" + ], + "support": { + "source": "https://github.com/symfony/mime/tree/v5.4.3" + }, + "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" + } + ], + "install-path": "../symfony/mime" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.25.0", + "version_normalized": "1.25.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "30885182c981ab175d4d034db0f6f469898070ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "time": "2021-10-20T20:35:02+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "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.25.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" + } + ], + "install-path": "../symfony/polyfill-ctype" + }, + { + "name": "symfony/polyfill-iconv", + "version": "v1.25.0", + "version_normalized": "1.25.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-iconv.git", + "reference": "f1aed619e28cb077fc83fac8c4c0383578356e40" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/f1aed619e28cb077fc83fac8c4c0383578356e40", + "reference": "f1aed619e28cb077fc83fac8c4c0383578356e40", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-iconv": "*" + }, + "suggest": { + "ext-iconv": "For best performance" + }, + "time": "2022-01-04T09:04:05+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Iconv\\": "" + } + }, + "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 Iconv extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "iconv", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.25.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" + } + ], + "install-path": "../symfony/polyfill-iconv" + }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.25.0", + "version_normalized": "1.25.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "749045c69efb97c70d25d7463abba812e91f3a44" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/749045c69efb97c70d25d7463abba812e91f3a44", + "reference": "749045c69efb97c70d25d7463abba812e91f3a44", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-intl-normalizer": "^1.10", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "time": "2021-09-14T14:02:44+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.25.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" + } + ], + "install-path": "../symfony/polyfill-intl-idn" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.25.0", + "version_normalized": "1.25.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "time": "2021-02-19T12:13:01+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "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 for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.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" + } + ], + "install-path": "../symfony/polyfill-intl-normalizer" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.25.0", + "version_normalized": "1.25.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "time": "2021-11-30T18:21:41+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.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" + } + ], + "install-path": "../symfony/polyfill-mbstring" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.25.0", + "version_normalized": "1.25.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2021-05-27T09:17:38+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.25.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" + } + ], + "install-path": "../symfony/polyfill-php72" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.25.0", + "version_normalized": "1.25.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2021-06-05T21:20:04+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.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" + } + ], + "install-path": "../symfony/polyfill-php73" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.25.0", + "version_normalized": "1.25.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2022-03-04T08:16:47+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.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" + } + ], + "install-path": "../symfony/polyfill-php80" + }, + { + "name": "symfony/process", + "version": "v4.4.37", + "version_normalized": "4.4.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "b2d924e5a4cb284f293d5092b1dbf0d364cb8b67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/b2d924e5a4cb284f293d5092b1dbf0d364cb8b67", + "reference": "b2d924e5a4cb284f293d5092b1dbf0d364cb8b67", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-php80": "^1.16" + }, + "time": "2022-01-27T17:14:04+00:00", + "type": "library", + "installation-source": "dist", + "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": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v4.4.37" + }, + "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" + } + ], + "install-path": "../symfony/process" + }, + { + "name": "symfony/routing", + "version": "v4.4.37", + "version_normalized": "4.4.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "324f7f73b89cd30012575119430ccfb1dfbc24be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/324f7f73b89cd30012575119430ccfb1dfbc24be", + "reference": "324f7f73b89cd30012575119430ccfb1dfbc24be", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/config": "<4.2", + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "psr/log": "^1|^2|^3", + "symfony/config": "^4.2|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/yaml": "^3.4|^4.0|^5.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "time": "2022-01-02T09:41:36+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "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": "Maps an HTTP request to a set of configuration variables", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "support": { + "source": "https://github.com/symfony/routing/tree/v4.4.37" + }, + "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" + } + ], + "install-path": "../symfony/routing" + }, + { + "name": "symfony/service-contracts", + "version": "v2.5.0", + "version_normalized": "2.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "time": "2021-11-04T16:48:04+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "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" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.5.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" + } + ], + "install-path": "../symfony/service-contracts" + }, + { + "name": "symfony/translation", + "version": "v4.4.37", + "version_normalized": "4.4.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "4ce00d6875230b839f5feef82e51971f6c886e00" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/4ce00d6875230b839f5feef82e51971f6c886e00", + "reference": "4ce00d6875230b839f5feef82e51971f6c886e00", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/translation-contracts": "^1.1.6|^2" + }, + "conflict": { + "symfony/config": "<3.4", + "symfony/dependency-injection": "<3.4", + "symfony/http-kernel": "<4.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "symfony/translation-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/console": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/finder": "~2.8|~3.0|~4.0|^5.0", + "symfony/http-kernel": "^4.4", + "symfony/intl": "^3.4|^4.0|^5.0", + "symfony/service-contracts": "^1.1.2|^2", + "symfony/yaml": "^3.4|^4.0|^5.0" + }, + "suggest": { + "psr/log-implementation": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "time": "2022-01-02T09:41:36+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "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": "Provides tools to internationalize your application", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/translation/tree/v4.4.37" + }, + "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" + } + ], + "install-path": "../symfony/translation" + }, + { + "name": "symfony/translation-contracts", + "version": "v2.5.0", + "version_normalized": "2.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "d28150f0f44ce854e942b671fc2620a98aae1b1e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/d28150f0f44ce854e942b671fc2620a98aae1b1e", + "reference": "d28150f0f44ce854e942b671fc2620a98aae1b1e", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/translation-implementation": "" + }, + "time": "2021-08-17T14:20:01+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" + } + }, + "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 translation", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v2.5.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" + } + ], + "install-path": "../symfony/translation-contracts" + }, + { + "name": "symfony/var-dumper", + "version": "v4.4.39", + "version_normalized": "4.4.39.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "35237c5e5dcb6593a46a860ba5b29c1d4683d80e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/35237c5e5dcb6593a46a860ba5b29c1d4683d80e", + "reference": "35237c5e5dcb6593a46a860ba5b29c1d4683d80e", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5", + "symfony/polyfill-php80": "^1.16" + }, + "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|^5.0", + "symfony/process": "^4.4|^5.0", + "twig/twig": "^1.43|^2.13|^3.0.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": "2022-02-25T10:38:15+00:00", + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "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": "Provides mechanisms for walking through any arbitrary PHP variable", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v4.4.39" + }, + "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" + } + ], + "install-path": "../symfony/var-dumper" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.1", + "version_normalized": "1.2.1.0", + "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": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "time": "2021-07-28T10:34:58+00:00", + "type": "library", + "installation-source": "dist", + "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" + } + ], + "install-path": "../theseer/tokenizer" + }, + { + "name": "tijsverkoyen/css-to-inline-styles", + "version": "2.2.4", + "version_normalized": "2.2.4.0", + "source": { + "type": "git", + "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", + "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/da444caae6aca7a19c0c140f68c6182e337d5b1c", + "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "php": "^5.5 || ^7.0 || ^8.0", + "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10" + }, + "time": "2021-12-08T09:12:39+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "TijsVerkoyen\\CssToInlineStyles\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Tijs Verkoyen", + "email": "css_to_inline_styles@verkoyen.eu", + "role": "Developer" + } + ], + "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", + "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", + "support": { + "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.4" + }, + "install-path": "../tijsverkoyen/css-to-inline-styles" + }, + { + "name": "vlucas/phpdotenv", + "version": "v3.6.10", + "version_normalized": "3.6.10.0", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "5b547cdb25825f10251370f57ba5d9d924e6f68e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/5b547cdb25825f10251370f57ba5d9d924e6f68e", + "reference": "5b547cdb25825f10251370f57ba5d9d924e6f68e", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0 || ^8.0", + "phpoption/phpoption": "^1.5.2", + "symfony/polyfill-ctype": "^1.17" + }, + "require-dev": { + "ext-filter": "*", + "ext-pcre": "*", + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator.", + "ext-pcre": "Required to use most of the library." + }, + "time": "2021-12-12T23:02:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.6-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://github.com/vlucas" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "support": { + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v3.6.10" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "type": "tidelift" + } + ], + "install-path": "../vlucas/phpdotenv" + }, + { + "name": "webmozart/assert", + "version": "1.10.0", + "version_normalized": "1.10.0.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": "" + }, + "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" + }, + "time": "2021-03-09T10:59:23+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "installation-source": "dist", + "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" + }, + "install-path": "../webmozart/assert" + } + ], + "dev": true, + "dev-package-names": [ + "doctrine/instantiator", + "fakerphp/faker", + "hamcrest/hamcrest-php", + "mockery/mockery", + "myclabs/deep-copy", + "orchestra/testbench", + "orchestra/testbench-core", + "phar-io/manifest", + "phar-io/version", + "phpdocumentor/reflection-common", + "phpdocumentor/reflection-docblock", + "phpdocumentor/type-resolver", + "phpspec/prophecy", + "phpunit/php-code-coverage", + "phpunit/php-file-iterator", + "phpunit/php-text-template", + "phpunit/php-timer", + "phpunit/php-token-stream", + "phpunit/phpunit", + "sebastian/code-unit-reverse-lookup", + "sebastian/comparator", + "sebastian/diff", + "sebastian/environment", + "sebastian/exporter", + "sebastian/global-state", + "sebastian/object-enumerator", + "sebastian/object-reflector", + "sebastian/recursion-context", + "sebastian/resource-operations", + "sebastian/type", + "sebastian/version", + "sempro/phpunit-pretty-print", + "theseer/tokenizer", + "webmozart/assert" + ] +} diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php new file mode 100644 index 00000000..c79602df --- /dev/null +++ b/vendor/composer/installed.php @@ -0,0 +1,1189 @@ + + array ( + 'pretty_version' => '2.0.5', + 'version' => '2.0.5.0', + 'aliases' => + array ( + ), + 'reference' => NULL, + 'name' => 'werk365/identitydocuments', + ), + 'versions' => + array ( + 'cordoval/hamcrest-php' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'davedevelopment/hamcrest-php' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'doctrine/inflector' => + array ( + 'pretty_version' => '2.0.4', + 'version' => '2.0.4.0', + 'aliases' => + array ( + ), + 'reference' => '8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89', + ), + 'doctrine/instantiator' => + array ( + 'pretty_version' => '1.4.1', + 'version' => '1.4.1.0', + 'aliases' => + array ( + ), + 'reference' => '10dcfce151b967d20fde1b34ae6640712c3891bc', + ), + 'doctrine/lexer' => + array ( + 'pretty_version' => '1.2.3', + 'version' => '1.2.3.0', + 'aliases' => + array ( + ), + 'reference' => 'c268e882d4dbdd85e36e4ad69e02dc284f89d229', + ), + 'dragonmantank/cron-expression' => + array ( + 'pretty_version' => 'v2.3.1', + 'version' => '2.3.1.0', + 'aliases' => + array ( + ), + 'reference' => '65b2d8ee1f10915efb3b55597da3404f096acba2', + ), + 'egulias/email-validator' => + array ( + 'pretty_version' => '2.1.25', + 'version' => '2.1.25.0', + 'aliases' => + array ( + ), + 'reference' => '0dbf5d78455d4d6a41d186da50adc1122ec066f4', + ), + 'fakerphp/faker' => + array ( + 'pretty_version' => 'v1.19.0', + 'version' => '1.19.0.0', + 'aliases' => + array ( + ), + 'reference' => 'd7f08a622b3346766325488aa32ddc93ccdecc75', + ), + 'firebase/php-jwt' => + array ( + 'pretty_version' => 'v5.5.1', + 'version' => '5.5.1.0', + 'aliases' => + array ( + ), + 'reference' => '83b609028194aa042ea33b5af2d41a7427de80e6', + ), + 'google/auth' => + array ( + 'pretty_version' => 'v1.18.0', + 'version' => '1.18.0.0', + 'aliases' => + array ( + ), + 'reference' => '21dd478e77b0634ed9e3a68613f74ed250ca9347', + ), + 'google/cloud-core' => + array ( + 'pretty_version' => 'v1.44.0', + 'version' => '1.44.0.0', + 'aliases' => + array ( + ), + 'reference' => '72706f7d1824777f42294a3c9ccdaddaad670017', + ), + 'google/cloud-vision' => + array ( + 'pretty_version' => 'v1.5.4', + 'version' => '1.5.4.0', + 'aliases' => + array ( + ), + 'reference' => '450e09ae73885e1863143f48f90f17c48f717e97', + ), + 'google/common-protos' => + array ( + 'pretty_version' => '2.0.0', + 'version' => '2.0.0.0', + 'aliases' => + array ( + ), + 'reference' => 'a1bcb7b37f1fa1c92d65c3c6339fc701a65916ee', + ), + 'google/gax' => + array ( + 'pretty_version' => 'v1.12.0', + 'version' => '1.12.0.0', + 'aliases' => + array ( + ), + 'reference' => 'd802c9b40c349f5368f077bfcbc2982e7c31f43c', + ), + 'google/grpc-gcp' => + array ( + 'pretty_version' => 'v0.2.0', + 'version' => '0.2.0.0', + 'aliases' => + array ( + ), + 'reference' => '2465c2273e11ada1e95155aa1e209f3b8f03c314', + ), + 'google/protobuf' => + array ( + 'pretty_version' => 'v3.19.4', + 'version' => '3.19.4.0', + 'aliases' => + array ( + ), + 'reference' => '6f0a54186f133aff98f49d0f36a32d4a4f7d4cbd', + ), + 'grpc/grpc' => + array ( + 'pretty_version' => '1.42.0', + 'version' => '1.42.0.0', + 'aliases' => + array ( + ), + 'reference' => '9fa44f104cb92e924d4da547323a97f3d8aca6d4', + ), + 'guzzlehttp/guzzle' => + array ( + 'pretty_version' => '7.4.1', + 'version' => '7.4.1.0', + 'aliases' => + array ( + ), + 'reference' => 'ee0a041b1760e6a53d2a39c8c34115adc2af2c79', + ), + 'guzzlehttp/promises' => + array ( + 'pretty_version' => '1.5.1', + 'version' => '1.5.1.0', + 'aliases' => + array ( + ), + 'reference' => 'fe752aedc9fd8fcca3fe7ad05d419d32998a06da', + ), + 'guzzlehttp/psr7' => + array ( + 'pretty_version' => '2.1.0', + 'version' => '2.1.0.0', + 'aliases' => + array ( + ), + 'reference' => '089edd38f5b8abba6cb01567c2a8aaa47cec4c72', + ), + 'hamcrest/hamcrest-php' => + array ( + 'pretty_version' => 'v2.0.1', + 'version' => '2.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '8c3d0a3f6af734494ad8f6fbbee0ba92422859f3', + ), + 'illuminate/auth' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/broadcasting' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/bus' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/cache' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/config' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/console' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/container' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/contracts' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/cookie' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/database' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/encryption' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/events' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/filesystem' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/hashing' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/http' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/log' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/mail' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/notifications' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/pagination' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/pipeline' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/queue' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/redis' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/routing' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/session' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/support' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/translation' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/validation' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/view' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'intervention/image' => + array ( + 'pretty_version' => '2.7.1', + 'version' => '2.7.1.0', + 'aliases' => + array ( + ), + 'reference' => '744ebba495319501b873a4e48787759c72e3fb8c', + ), + 'kodova/hamcrest-php' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'laravel/framework' => + array ( + 'pretty_version' => 'v6.20.44', + 'version' => '6.20.44.0', + 'aliases' => + array ( + ), + 'reference' => '505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0', + ), + 'league/commonmark' => + array ( + 'pretty_version' => '1.6.7', + 'version' => '1.6.7.0', + 'aliases' => + array ( + ), + 'reference' => '2b8185c13bc9578367a5bf901881d1c1b5bbd09b', + ), + 'league/flysystem' => + array ( + 'pretty_version' => '1.1.9', + 'version' => '1.1.9.0', + 'aliases' => + array ( + ), + 'reference' => '094defdb4a7001845300334e7c1ee2335925ef99', + ), + 'league/mime-type-detection' => + array ( + 'pretty_version' => '1.9.0', + 'version' => '1.9.0.0', + 'aliases' => + array ( + ), + 'reference' => 'aa70e813a6ad3d1558fc927863d47309b4c23e69', + ), + 'mockery/mockery' => + array ( + 'pretty_version' => '1.5.0', + 'version' => '1.5.0.0', + 'aliases' => + array ( + ), + 'reference' => 'c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac', + ), + 'monolog/monolog' => + array ( + 'pretty_version' => '2.4.0', + 'version' => '2.4.0.0', + 'aliases' => + array ( + ), + 'reference' => 'd7fd7450628561ba697b7097d86db72662f54aef', + ), + 'myclabs/deep-copy' => + array ( + 'pretty_version' => '1.11.0', + 'version' => '1.11.0.0', + 'aliases' => + array ( + ), + 'reference' => '14daed4296fae74d9e3201d2c4925d1acb7aa614', + ), + 'nesbot/carbon' => + array ( + 'pretty_version' => '2.57.0', + 'version' => '2.57.0.0', + 'aliases' => + array ( + ), + 'reference' => '4a54375c21eea4811dbd1149fe6b246517554e78', + ), + 'opis/closure' => + array ( + 'pretty_version' => '3.6.3', + 'version' => '3.6.3.0', + 'aliases' => + array ( + ), + 'reference' => '3d81e4309d2a927abbe66df935f4bb60082805ad', + ), + 'orchestra/testbench' => + array ( + 'pretty_version' => 'v4.18.0', + 'version' => '4.18.0.0', + 'aliases' => + array ( + ), + 'reference' => '38d9292f5575a167995fde926612a728d622fe13', + ), + 'orchestra/testbench-core' => + array ( + 'pretty_version' => 'v4.18.0', + 'version' => '4.18.0.0', + 'aliases' => + array ( + ), + 'reference' => '6d6ce5e62a25bc796625ed56d4353e8071bf8693', + ), + 'paragonie/random_compat' => + array ( + 'pretty_version' => 'v9.99.100', + 'version' => '9.99.100.0', + 'aliases' => + array ( + ), + 'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a', + ), + 'phar-io/manifest' => + array ( + 'pretty_version' => '2.0.3', + 'version' => '2.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '97803eca37d319dfa7826cc2437fc020857acb53', + ), + 'phar-io/version' => + array ( + 'pretty_version' => '3.2.1', + 'version' => '3.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74', + ), + 'phpdocumentor/reflection-common' => + array ( + 'pretty_version' => '2.2.0', + 'version' => '2.2.0.0', + 'aliases' => + array ( + ), + 'reference' => '1d01c49d4ed62f25aa84a747ad35d5a16924662b', + ), + 'phpdocumentor/reflection-docblock' => + array ( + 'pretty_version' => '5.3.0', + 'version' => '5.3.0.0', + 'aliases' => + array ( + ), + 'reference' => '622548b623e81ca6d78b721c5e029f4ce664f170', + ), + 'phpdocumentor/type-resolver' => + array ( + 'pretty_version' => '1.6.0', + 'version' => '1.6.0.0', + 'aliases' => + array ( + ), + 'reference' => '93ebd0014cab80c4ea9f5e297ea48672f1b87706', + ), + 'phpoption/phpoption' => + array ( + 'pretty_version' => '1.8.1', + 'version' => '1.8.1.0', + 'aliases' => + array ( + ), + 'reference' => 'eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15', + ), + 'phpspec/prophecy' => + array ( + 'pretty_version' => 'v1.15.0', + 'version' => '1.15.0.0', + 'aliases' => + array ( + ), + 'reference' => 'bbcd7380b0ebf3961ee21409db7b38bc31d69a13', + ), + 'phpunit/php-code-coverage' => + array ( + 'pretty_version' => '7.0.15', + 'version' => '7.0.15.0', + 'aliases' => + array ( + ), + 'reference' => '819f92bba8b001d4363065928088de22f25a3a48', + ), + 'phpunit/php-file-iterator' => + array ( + 'pretty_version' => '2.0.5', + 'version' => '2.0.5.0', + 'aliases' => + array ( + ), + 'reference' => '42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5', + ), + 'phpunit/php-text-template' => + array ( + 'pretty_version' => '1.2.1', + 'version' => '1.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '31f8b717e51d9a2afca6c9f046f5d69fc27c8686', + ), + 'phpunit/php-timer' => + array ( + 'pretty_version' => '2.1.3', + 'version' => '2.1.3.0', + 'aliases' => + array ( + ), + 'reference' => '2454ae1765516d20c4ffe103d85a58a9a3bd5662', + ), + 'phpunit/php-token-stream' => + array ( + 'pretty_version' => '4.0.4', + 'version' => '4.0.4.0', + 'aliases' => + array ( + ), + 'reference' => 'a853a0e183b9db7eed023d7933a858fa1c8d25a3', + ), + 'phpunit/phpunit' => + array ( + 'pretty_version' => '8.5.24', + 'version' => '8.5.24.0', + 'aliases' => + array ( + ), + 'reference' => '293cb0099d75407d971a73f41e51f35b664667ed', + ), + 'psr/cache' => + array ( + 'pretty_version' => '2.0.0', + 'version' => '2.0.0.0', + 'aliases' => + array ( + ), + 'reference' => '213f9dbc5b9bfbc4f8db86d2838dc968752ce13b', + ), + 'psr/container' => + array ( + 'pretty_version' => '1.1.2', + 'version' => '1.1.2.0', + 'aliases' => + array ( + ), + 'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea', + ), + 'psr/event-dispatcher-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + ), + ), + 'psr/http-client' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', + ), + 'psr/http-client-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + ), + ), + 'psr/http-factory' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be', + ), + 'psr/http-factory-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + ), + ), + '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' => '2.0.0', + 'version' => '2.0.0.0', + 'aliases' => + array ( + ), + 'reference' => 'ef29f6d262798707a9edd554e2b82517ef3a9376', + ), + 'psr/log-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0.0 || 2.0.0 || 3.0.0', + 1 => '1.0|2.0', + ), + ), + 'psr/simple-cache' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b', + ), + 'ralouphie/getallheaders' => + array ( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '120b605dfeb996808c31b6477290a714d356e822', + ), + 'ramsey/uuid' => + array ( + 'pretty_version' => '3.9.6', + 'version' => '3.9.6.0', + 'aliases' => + array ( + ), + 'reference' => 'ffa80ab953edd85d5b6c004f96181a538aad35a3', + ), + 'rhumsaa/uuid' => + array ( + 'replaced' => + array ( + 0 => '3.9.6', + ), + ), + 'rize/uri-template' => + array ( + 'pretty_version' => '0.3.4', + 'version' => '0.3.4.0', + 'aliases' => + array ( + ), + 'reference' => '2a874863c48d643b9e2e254ab288ec203060a0b8', + ), + 'sebastian/code-unit-reverse-lookup' => + array ( + 'pretty_version' => '1.0.2', + 'version' => '1.0.2.0', + 'aliases' => + array ( + ), + 'reference' => '1de8cd5c010cb153fcd68b8d0f64606f523f7619', + ), + 'sebastian/comparator' => + array ( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '1071dfcef776a57013124ff35e1fc41ccd294758', + ), + 'sebastian/diff' => + array ( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '14f72dd46eaf2f2293cbe79c93cc0bc43161a211', + ), + 'sebastian/environment' => + array ( + 'pretty_version' => '4.2.4', + 'version' => '4.2.4.0', + 'aliases' => + array ( + ), + 'reference' => 'd47bbbad83711771f167c72d4e3f25f7fcc1f8b0', + ), + 'sebastian/exporter' => + array ( + 'pretty_version' => '3.1.4', + 'version' => '3.1.4.0', + 'aliases' => + array ( + ), + 'reference' => '0c32ea2e40dbf59de29f3b49bf375176ce7dd8db', + ), + 'sebastian/global-state' => + array ( + 'pretty_version' => '3.0.2', + 'version' => '3.0.2.0', + 'aliases' => + array ( + ), + 'reference' => 'de036ec91d55d2a9e0db2ba975b512cdb1c23921', + ), + 'sebastian/object-enumerator' => + array ( + 'pretty_version' => '3.0.4', + 'version' => '3.0.4.0', + 'aliases' => + array ( + ), + 'reference' => 'e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2', + ), + 'sebastian/object-reflector' => + array ( + 'pretty_version' => '1.1.2', + 'version' => '1.1.2.0', + 'aliases' => + array ( + ), + 'reference' => '9b8772b9cbd456ab45d4a598d2dd1a1bced6363d', + ), + 'sebastian/recursion-context' => + array ( + 'pretty_version' => '3.0.1', + 'version' => '3.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '367dcba38d6e1977be014dc4b22f47a484dac7fb', + ), + 'sebastian/resource-operations' => + array ( + 'pretty_version' => '2.0.2', + 'version' => '2.0.2.0', + 'aliases' => + array ( + ), + 'reference' => '31d35ca87926450c44eae7e2611d45a7a65ea8b3', + ), + 'sebastian/type' => + array ( + 'pretty_version' => '1.1.4', + 'version' => '1.1.4.0', + 'aliases' => + array ( + ), + 'reference' => '0150cfbc4495ed2df3872fb31b26781e4e077eb4', + ), + 'sebastian/version' => + array ( + 'pretty_version' => '2.0.1', + 'version' => '2.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '99732be0ddb3361e16ad77b68ba41efc8e979019', + ), + 'sempro/phpunit-pretty-print' => + array ( + 'pretty_version' => '1.4.0', + 'version' => '1.4.0.0', + 'aliases' => + array ( + ), + 'reference' => 'fa623aa8a17aece4a2b69e54b07a5e37572d1f1d', + ), + 'swiftmailer/swiftmailer' => + array ( + 'pretty_version' => 'v6.3.0', + 'version' => '6.3.0.0', + 'aliases' => + array ( + ), + 'reference' => '8a5d5072dca8f48460fce2f4131fcc495eec654c', + ), + 'symfony/console' => + array ( + 'pretty_version' => 'v4.4.38', + 'version' => '4.4.38.0', + 'aliases' => + array ( + ), + 'reference' => '5a50085bf5460f0c0d60a50b58388c1249826b8a', + ), + 'symfony/css-selector' => + array ( + 'pretty_version' => 'v6.0.3', + 'version' => '6.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '1955d595c12c111629cc814d3f2a2ff13580508a', + ), + 'symfony/debug' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => '5de6c6e7f52b364840e53851c126be4d71e60470', + ), + 'symfony/deprecation-contracts' => + array ( + 'pretty_version' => 'v2.5.0', + 'version' => '2.5.0.0', + 'aliases' => + array ( + ), + 'reference' => '6f981ee24cf69ee7ce9736146d1c57c2780598a8', + ), + 'symfony/error-handler' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => '8d80ad881e1ce17979547873d093e3c987a6a629', + ), + 'symfony/event-dispatcher' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => '3ccfcfb96ecce1217d7b0875a0736976bc6e63dc', + ), + 'symfony/event-dispatcher-contracts' => + array ( + 'pretty_version' => 'v1.1.11', + 'version' => '1.1.11.0', + 'aliases' => + array ( + ), + 'reference' => '01e9a4efac0ee33a05dfdf93b346f62e7d0e998c', + ), + 'symfony/event-dispatcher-implementation' => + array ( + 'provided' => + array ( + 0 => '1.1', + ), + ), + 'symfony/finder' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => 'b17d76d7ed179f017aad646e858c90a2771af15d', + ), + 'symfony/http-client-contracts' => + array ( + 'pretty_version' => 'v2.5.0', + 'version' => '2.5.0.0', + 'aliases' => + array ( + ), + 'reference' => 'ec82e57b5b714dbb69300d348bd840b345e24166', + ), + 'symfony/http-foundation' => + array ( + 'pretty_version' => 'v4.4.39', + 'version' => '4.4.39.0', + 'aliases' => + array ( + ), + 'reference' => '60e8e42a4579551e5ec887d04380e2ab9e4cc314', + ), + 'symfony/http-kernel' => + array ( + 'pretty_version' => 'v4.4.39', + 'version' => '4.4.39.0', + 'aliases' => + array ( + ), + 'reference' => '19d1cacefe81cb448227cc4d5909fb36e2e23081', + ), + 'symfony/mime' => + array ( + 'pretty_version' => 'v5.4.3', + 'version' => '5.4.3.0', + 'aliases' => + array ( + ), + 'reference' => 'e1503cfb5c9a225350f549d3bb99296f4abfb80f', + ), + 'symfony/polyfill-ctype' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => '30885182c981ab175d4d034db0f6f469898070ab', + ), + 'symfony/polyfill-iconv' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => 'f1aed619e28cb077fc83fac8c4c0383578356e40', + ), + 'symfony/polyfill-intl-idn' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => '749045c69efb97c70d25d7463abba812e91f3a44', + ), + 'symfony/polyfill-intl-normalizer' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => '8590a5f561694770bdcd3f9b5c69dde6945028e8', + ), + 'symfony/polyfill-mbstring' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => '0abb51d2f102e00a4eefcf46ba7fec406d245825', + ), + 'symfony/polyfill-php72' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => '9a142215a36a3888e30d0a9eeea9766764e96976', + ), + 'symfony/polyfill-php73' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => 'cc5db0e22b3cb4111010e48785a97f670b350ca5', + ), + 'symfony/polyfill-php80' => + array ( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'aliases' => + array ( + ), + 'reference' => '4407588e0d3f1f52efb65fbe92babe41f37fe50c', + ), + 'symfony/process' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => 'b2d924e5a4cb284f293d5092b1dbf0d364cb8b67', + ), + 'symfony/routing' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => '324f7f73b89cd30012575119430ccfb1dfbc24be', + ), + 'symfony/service-contracts' => + array ( + 'pretty_version' => 'v2.5.0', + 'version' => '2.5.0.0', + 'aliases' => + array ( + ), + 'reference' => '1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc', + ), + 'symfony/translation' => + array ( + 'pretty_version' => 'v4.4.37', + 'version' => '4.4.37.0', + 'aliases' => + array ( + ), + 'reference' => '4ce00d6875230b839f5feef82e51971f6c886e00', + ), + 'symfony/translation-contracts' => + array ( + 'pretty_version' => 'v2.5.0', + 'version' => '2.5.0.0', + 'aliases' => + array ( + ), + 'reference' => 'd28150f0f44ce854e942b671fc2620a98aae1b1e', + ), + 'symfony/translation-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0|2.0', + ), + ), + 'symfony/var-dumper' => + array ( + 'pretty_version' => 'v4.4.39', + 'version' => '4.4.39.0', + 'aliases' => + array ( + ), + 'reference' => '35237c5e5dcb6593a46a860ba5b29c1d4683d80e', + ), + 'theseer/tokenizer' => + array ( + 'pretty_version' => '1.2.1', + 'version' => '1.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '34a41e998c2183e22995f158c581e7b5e755ab9e', + ), + 'tijsverkoyen/css-to-inline-styles' => + array ( + 'pretty_version' => '2.2.4', + 'version' => '2.2.4.0', + 'aliases' => + array ( + ), + 'reference' => 'da444caae6aca7a19c0c140f68c6182e337d5b1c', + ), + 'vlucas/phpdotenv' => + array ( + 'pretty_version' => 'v3.6.10', + 'version' => '3.6.10.0', + 'aliases' => + array ( + ), + 'reference' => '5b547cdb25825f10251370f57ba5d9d924e6f68e', + ), + 'webmozart/assert' => + array ( + 'pretty_version' => '1.10.0', + 'version' => '1.10.0.0', + 'aliases' => + array ( + ), + 'reference' => '6964c76c7804814a842473e0c8fd15bab0f18e25', + ), + 'werk365/identitydocuments' => + array ( + 'pretty_version' => '2.0.5', + 'version' => '2.0.5.0', + 'aliases' => + array ( + ), + 'reference' => NULL, + ), + ), +); diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php new file mode 100644 index 00000000..b168ddd5 --- /dev/null +++ b/vendor/composer/platform_check.php @@ -0,0 +1,26 @@ += 80002)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 8.0.2". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/vendor/doctrine/inflector/LICENSE b/vendor/doctrine/inflector/LICENSE new file mode 100644 index 00000000..8c38cc1b --- /dev/null +++ b/vendor/doctrine/inflector/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2006-2015 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/inflector/README.md b/vendor/doctrine/inflector/README.md new file mode 100644 index 00000000..6e3a97f7 --- /dev/null +++ b/vendor/doctrine/inflector/README.md @@ -0,0 +1,7 @@ +# Doctrine Inflector + +Doctrine Inflector is a small library that can perform string manipulations +with regard to uppercase/lowercase and singular/plural forms of words. + +[![Build Status](https://github.com/doctrine/inflector/workflows/Continuous%20Integration/badge.svg)](https://github.com/doctrine/inflector/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A4.0.x) +[![Code Coverage](https://codecov.io/gh/doctrine/inflector/branch/2.0.x/graph/badge.svg)](https://codecov.io/gh/doctrine/inflector/branch/2.0.x) diff --git a/vendor/doctrine/inflector/composer.json b/vendor/doctrine/inflector/composer.json new file mode 100644 index 00000000..f08fdc3b --- /dev/null +++ b/vendor/doctrine/inflector/composer.json @@ -0,0 +1,36 @@ +{ + "name": "doctrine/inflector", + "type": "library", + "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "keywords": ["php", "strings", "words", "manipulation", "inflector", "inflection", "uppercase", "lowercase", "singular", "plural"], + "homepage": "https://www.doctrine-project.org/projects/inflector.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.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^8.2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "vimeo/psalm": "^4.10" + }, + "autoload": { + "psr-4": { + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + } + }, + "autoload-dev": { + "psr-4": { + "Doctrine\\Tests\\Inflector\\": "tests/Doctrine/Tests/Inflector" + } + } +} diff --git a/vendor/doctrine/inflector/docs/en/index.rst b/vendor/doctrine/inflector/docs/en/index.rst new file mode 100644 index 00000000..29866f4d --- /dev/null +++ b/vendor/doctrine/inflector/docs/en/index.rst @@ -0,0 +1,226 @@ +Introduction +============ + +The Doctrine Inflector has methods for inflecting text. The features include pluralization, +singularization, converting between camelCase and under_score and capitalizing +words. + +Installation +============ + +You can install the Inflector with composer: + +.. code-block:: console + + $ composer require doctrine/inflector + +Usage +===== + +Using the inflector is easy, you can create a new ``Doctrine\Inflector\Inflector`` instance by using +the ``Doctrine\Inflector\InflectorFactory`` class: + +.. code-block:: php + + use Doctrine\Inflector\InflectorFactory; + + $inflector = InflectorFactory::create()->build(); + +By default it will create an English inflector. If you want to use another language, just pass the language +you want to create an inflector for to the ``createForLanguage()`` method: + +.. code-block:: php + + use Doctrine\Inflector\InflectorFactory; + use Doctrine\Inflector\Language; + + $inflector = InflectorFactory::createForLanguage(Language::SPANISH)->build(); + +The supported languages are as follows: + +- ``Language::ENGLISH`` +- ``Language::FRENCH`` +- ``Language::NORWEGIAN_BOKMAL`` +- ``Language::PORTUGUESE`` +- ``Language::SPANISH`` +- ``Language::TURKISH`` + +If you want to manually construct the inflector instead of using a factory, you can do so like this: + +.. code-block:: php + + use Doctrine\Inflector\CachedWordInflector; + use Doctrine\Inflector\RulesetInflector; + use Doctrine\Inflector\Rules\English; + + $inflector = new Inflector( + new CachedWordInflector(new RulesetInflector( + English\Rules::getSingularRuleset() + )), + new CachedWordInflector(new RulesetInflector( + English\Rules::getPluralRuleset() + )) + ); + +Adding Languages +---------------- + +If you are interested in adding support for your language, take a look at the other languages defined in the +``Doctrine\Inflector\Rules`` namespace and the tests located in ``Doctrine\Tests\Inflector\Rules``. You can copy +one of the languages and update the rules for your language. + +Once you have done this, send a pull request to the ``doctrine/inflector`` repository with the additions. + +Custom Setup +============ + +If you want to setup custom singular and plural rules, you can configure these in the factory: + +.. code-block:: php + + use Doctrine\Inflector\InflectorFactory; + use Doctrine\Inflector\Rules\Pattern; + use Doctrine\Inflector\Rules\Patterns; + use Doctrine\Inflector\Rules\Ruleset; + use Doctrine\Inflector\Rules\Substitution; + use Doctrine\Inflector\Rules\Substitutions; + use Doctrine\Inflector\Rules\Transformation; + use Doctrine\Inflector\Rules\Transformations; + use Doctrine\Inflector\Rules\Word; + + $inflector = InflectorFactory::create() + ->withSingularRules( + new Ruleset( + new Transformations( + new Transformation(new Pattern('/^(bil)er$/i'), '\1'), + new Transformation(new Pattern('/^(inflec|contribu)tors$/i'), '\1ta') + ), + new Patterns(new Pattern('singulars')), + new Substitutions(new Substitution(new Word('spins'), new Word('spinor'))) + ) + ) + ->withPluralRules( + new Ruleset( + new Transformations( + new Transformation(new Pattern('^(bil)er$'), '\1'), + new Transformation(new Pattern('^(inflec|contribu)tors$'), '\1ta') + ), + new Patterns(new Pattern('noflect'), new Pattern('abtuse')), + new Substitutions( + new Substitution(new Word('amaze'), new Word('amazable')), + new Substitution(new Word('phone'), new Word('phonezes')) + ) + ) + ) + ->build(); + +No operation inflector +---------------------- + +The ``Doctrine\Inflector\NoopWordInflector`` may be used to configure an inflector that doesn't perform any operation for +pluralization and/or singularization. If will simply return the input as output. + +This is an implementation of the `Null Object design pattern `_. + +.. code-block:: php + + use Doctrine\Inflector\Inflector; + use Doctrine\Inflector\NoopWordInflector; + + $inflector = new Inflector(new NoopWordInflector(), new NoopWordInflector()); + +Tableize +======== + +Converts ``ModelName`` to ``model_name``: + +.. code-block:: php + + echo $inflector->tableize('ModelName'); // model_name + +Classify +======== + +Converts ``model_name`` to ``ModelName``: + +.. code-block:: php + + echo $inflector->classify('model_name'); // ModelName + +Camelize +======== + +This method uses `Classify`_ and then converts the first character to lowercase: + +.. code-block:: php + + echo $inflector->camelize('model_name'); // modelName + +Capitalize +========== + +Takes a string and capitalizes all of the words, like PHP's built-in +``ucwords`` function. This extends that behavior, however, by allowing the +word delimiters to be configured, rather than only separating on +whitespace. + +Here is an example: + +.. code-block:: php + + $string = 'top-o-the-morning to all_of_you!'; + + echo $inflector->capitalize($string); // Top-O-The-Morning To All_of_you! + + echo $inflector->capitalize($string, '-_ '); // Top-O-The-Morning To All_Of_You! + +Pluralize +========= + +Returns a word in plural form. + +.. code-block:: php + + echo $inflector->pluralize('browser'); // browsers + +Singularize +=========== + +Returns a word in singular form. + +.. code-block:: php + + echo $inflector->singularize('browsers'); // browser + +Urlize +====== + +Generate a URL friendly string from a string of text: + +.. code-block:: php + + echo $inflector->urlize('My first blog post'); // my-first-blog-post + +Unaccent +======== + +You can unaccent a string of text using the ``unaccent()`` method: + +.. code-block:: php + + echo $inflector->unaccent('año'); // ano + +Legacy API +========== + +The API present in Inflector 1.x is still available, but will be deprecated in a future release and dropped for 3.0. +Support for languages other than English is available in the 2.0 API only. + +Acknowledgements +================ + +The language rules in this library have been adapted from several different sources, including but not limited to: + +- `Ruby On Rails Inflector `_ +- `ICanBoogie Inflector `_ +- `CakePHP Inflector `_ diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/CachedWordInflector.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/CachedWordInflector.php new file mode 100644 index 00000000..2d529087 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/CachedWordInflector.php @@ -0,0 +1,24 @@ +wordInflector = $wordInflector; + } + + public function inflect(string $word): string + { + return $this->cache[$word] ?? $this->cache[$word] = $this->wordInflector->inflect($word); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/GenericLanguageInflectorFactory.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/GenericLanguageInflectorFactory.php new file mode 100644 index 00000000..166061d2 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/GenericLanguageInflectorFactory.php @@ -0,0 +1,66 @@ +singularRulesets[] = $this->getSingularRuleset(); + $this->pluralRulesets[] = $this->getPluralRuleset(); + } + + final public function build(): Inflector + { + return new Inflector( + new CachedWordInflector(new RulesetInflector( + ...$this->singularRulesets + )), + new CachedWordInflector(new RulesetInflector( + ...$this->pluralRulesets + )) + ); + } + + final public function withSingularRules(?Ruleset $singularRules, bool $reset = false): LanguageInflectorFactory + { + if ($reset) { + $this->singularRulesets = []; + } + + if ($singularRules instanceof Ruleset) { + array_unshift($this->singularRulesets, $singularRules); + } + + return $this; + } + + final public function withPluralRules(?Ruleset $pluralRules, bool $reset = false): LanguageInflectorFactory + { + if ($reset) { + $this->pluralRulesets = []; + } + + if ($pluralRules instanceof Ruleset) { + array_unshift($this->pluralRulesets, $pluralRules); + } + + return $this; + } + + abstract protected function getSingularRuleset(): Ruleset; + + abstract protected function getPluralRuleset(): Ruleset; +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Inflector.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Inflector.php new file mode 100644 index 00000000..610a4cf4 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Inflector.php @@ -0,0 +1,507 @@ + 'A', + 'Á' => 'A', + 'Â' => 'A', + 'Ã' => 'A', + 'Ä' => 'Ae', + 'Æ' => 'Ae', + 'Å' => 'Aa', + 'æ' => 'a', + 'Ç' => 'C', + 'È' => 'E', + 'É' => 'E', + 'Ê' => 'E', + 'Ë' => 'E', + 'Ì' => 'I', + 'Í' => 'I', + 'Î' => 'I', + 'Ï' => 'I', + 'Ñ' => 'N', + 'Ò' => 'O', + 'Ó' => 'O', + 'Ô' => 'O', + 'Õ' => 'O', + 'Ö' => 'Oe', + 'Ù' => 'U', + 'Ú' => 'U', + 'Û' => 'U', + 'Ü' => 'Ue', + 'Ý' => 'Y', + 'ß' => 'ss', + 'à' => 'a', + 'á' => 'a', + 'â' => 'a', + 'ã' => 'a', + 'ä' => 'ae', + 'å' => 'aa', + 'ç' => 'c', + 'è' => 'e', + 'é' => 'e', + 'ê' => 'e', + 'ë' => 'e', + 'ì' => 'i', + 'í' => 'i', + 'î' => 'i', + 'ï' => 'i', + 'ñ' => 'n', + 'ò' => 'o', + 'ó' => 'o', + 'ô' => 'o', + 'õ' => 'o', + 'ö' => 'oe', + 'ù' => 'u', + 'ú' => 'u', + 'û' => 'u', + 'ü' => 'ue', + 'ý' => 'y', + 'ÿ' => 'y', + 'Ā' => 'A', + 'ā' => 'a', + 'Ă' => 'A', + 'ă' => 'a', + 'Ą' => 'A', + 'ą' => 'a', + 'Ć' => 'C', + 'ć' => 'c', + 'Ĉ' => 'C', + 'ĉ' => 'c', + 'Ċ' => 'C', + 'ċ' => 'c', + 'Č' => 'C', + 'č' => 'c', + 'Ď' => 'D', + 'ď' => 'd', + 'Đ' => 'D', + 'đ' => 'd', + 'Ē' => 'E', + 'ē' => 'e', + 'Ĕ' => 'E', + 'ĕ' => 'e', + 'Ė' => 'E', + 'ė' => 'e', + 'Ę' => 'E', + 'ę' => 'e', + 'Ě' => 'E', + 'ě' => 'e', + 'Ĝ' => 'G', + 'ĝ' => 'g', + 'Ğ' => 'G', + 'ğ' => 'g', + 'Ġ' => 'G', + 'ġ' => 'g', + 'Ģ' => 'G', + 'ģ' => 'g', + 'Ĥ' => 'H', + 'ĥ' => 'h', + 'Ħ' => 'H', + 'ħ' => 'h', + 'Ĩ' => 'I', + 'ĩ' => 'i', + 'Ī' => 'I', + 'ī' => 'i', + 'Ĭ' => 'I', + 'ĭ' => 'i', + 'Į' => 'I', + 'į' => 'i', + 'İ' => 'I', + 'ı' => 'i', + 'IJ' => 'IJ', + 'ij' => 'ij', + 'Ĵ' => 'J', + 'ĵ' => 'j', + 'Ķ' => 'K', + 'ķ' => 'k', + 'ĸ' => 'k', + 'Ĺ' => 'L', + 'ĺ' => 'l', + 'Ļ' => 'L', + 'ļ' => 'l', + 'Ľ' => 'L', + 'ľ' => 'l', + 'Ŀ' => 'L', + 'ŀ' => 'l', + 'Ł' => 'L', + 'ł' => 'l', + 'Ń' => 'N', + 'ń' => 'n', + 'Ņ' => 'N', + 'ņ' => 'n', + 'Ň' => 'N', + 'ň' => 'n', + 'ʼn' => 'N', + 'Ŋ' => 'n', + 'ŋ' => 'N', + 'Ō' => 'O', + 'ō' => 'o', + 'Ŏ' => 'O', + 'ŏ' => 'o', + 'Ő' => 'O', + 'ő' => 'o', + 'Œ' => 'OE', + 'œ' => 'oe', + 'Ø' => 'O', + 'ø' => 'o', + 'Ŕ' => 'R', + 'ŕ' => 'r', + 'Ŗ' => 'R', + 'ŗ' => 'r', + 'Ř' => 'R', + 'ř' => 'r', + 'Ś' => 'S', + 'ś' => 's', + 'Ŝ' => 'S', + 'ŝ' => 's', + 'Ş' => 'S', + 'ş' => 's', + 'Š' => 'S', + 'š' => 's', + 'Ţ' => 'T', + 'ţ' => 't', + 'Ť' => 'T', + 'ť' => 't', + 'Ŧ' => 'T', + 'ŧ' => 't', + 'Ũ' => 'U', + 'ũ' => 'u', + 'Ū' => 'U', + 'ū' => 'u', + 'Ŭ' => 'U', + 'ŭ' => 'u', + 'Ů' => 'U', + 'ů' => 'u', + 'Ű' => 'U', + 'ű' => 'u', + 'Ų' => 'U', + 'ų' => 'u', + 'Ŵ' => 'W', + 'ŵ' => 'w', + 'Ŷ' => 'Y', + 'ŷ' => 'y', + 'Ÿ' => 'Y', + 'Ź' => 'Z', + 'ź' => 'z', + 'Ż' => 'Z', + 'ż' => 'z', + 'Ž' => 'Z', + 'ž' => 'z', + 'ſ' => 's', + '€' => 'E', + '£' => '', + ]; + + /** @var WordInflector */ + private $singularizer; + + /** @var WordInflector */ + private $pluralizer; + + public function __construct(WordInflector $singularizer, WordInflector $pluralizer) + { + $this->singularizer = $singularizer; + $this->pluralizer = $pluralizer; + } + + /** + * Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'. + */ + public function tableize(string $word): string + { + $tableized = preg_replace('~(?<=\\w)([A-Z])~u', '_$1', $word); + + if ($tableized === null) { + throw new RuntimeException(sprintf( + 'preg_replace returned null for value "%s"', + $word + )); + } + + return mb_strtolower($tableized); + } + + /** + * Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'. + */ + public function classify(string $word): string + { + return str_replace([' ', '_', '-'], '', ucwords($word, ' _-')); + } + + /** + * Camelizes a word. This uses the classify() method and turns the first character to lowercase. + */ + public function camelize(string $word): string + { + return lcfirst($this->classify($word)); + } + + /** + * Uppercases words with configurable delimiters between words. + * + * Takes a string and capitalizes all of the words, like PHP's built-in + * ucwords function. This extends that behavior, however, by allowing the + * word delimiters to be configured, rather than only separating on + * whitespace. + * + * Here is an example: + * + * capitalize($string); + * // Top-O-The-Morning To All_of_you! + * + * echo $inflector->capitalize($string, '-_ '); + * // Top-O-The-Morning To All_Of_You! + * ?> + * + * + * @param string $string The string to operate on. + * @param string $delimiters A list of word separators. + * + * @return string The string with all delimiter-separated words capitalized. + */ + public function capitalize(string $string, string $delimiters = " \n\t\r\0\x0B-"): string + { + return ucwords($string, $delimiters); + } + + /** + * Checks if the given string seems like it has utf8 characters in it. + * + * @param string $string The string to check for utf8 characters in. + */ + public function seemsUtf8(string $string): bool + { + for ($i = 0; $i < strlen($string); $i++) { + if (ord($string[$i]) < 0x80) { + continue; // 0bbbbbbb + } + + if ((ord($string[$i]) & 0xE0) === 0xC0) { + $n = 1; // 110bbbbb + } elseif ((ord($string[$i]) & 0xF0) === 0xE0) { + $n = 2; // 1110bbbb + } elseif ((ord($string[$i]) & 0xF8) === 0xF0) { + $n = 3; // 11110bbb + } elseif ((ord($string[$i]) & 0xFC) === 0xF8) { + $n = 4; // 111110bb + } elseif ((ord($string[$i]) & 0xFE) === 0xFC) { + $n = 5; // 1111110b + } else { + return false; // Does not match any model + } + + for ($j = 0; $j < $n; $j++) { // n bytes matching 10bbbbbb follow ? + if (++$i === strlen($string) || ((ord($string[$i]) & 0xC0) !== 0x80)) { + return false; + } + } + } + + return true; + } + + /** + * Remove any illegal characters, accents, etc. + * + * @param string $string String to unaccent + * + * @return string Unaccented string + */ + public function unaccent(string $string): string + { + if (preg_match('/[\x80-\xff]/', $string) === false) { + return $string; + } + + if ($this->seemsUtf8($string)) { + $string = strtr($string, self::ACCENTED_CHARACTERS); + } else { + $characters = []; + + // Assume ISO-8859-1 if not UTF-8 + $characters['in'] = + chr(128) + . chr(131) + . chr(138) + . chr(142) + . chr(154) + . chr(158) + . chr(159) + . chr(162) + . chr(165) + . chr(181) + . chr(192) + . chr(193) + . chr(194) + . chr(195) + . chr(196) + . chr(197) + . chr(199) + . chr(200) + . chr(201) + . chr(202) + . chr(203) + . chr(204) + . chr(205) + . chr(206) + . chr(207) + . chr(209) + . chr(210) + . chr(211) + . chr(212) + . chr(213) + . chr(214) + . chr(216) + . chr(217) + . chr(218) + . chr(219) + . chr(220) + . chr(221) + . chr(224) + . chr(225) + . chr(226) + . chr(227) + . chr(228) + . chr(229) + . chr(231) + . chr(232) + . chr(233) + . chr(234) + . chr(235) + . chr(236) + . chr(237) + . chr(238) + . chr(239) + . chr(241) + . chr(242) + . chr(243) + . chr(244) + . chr(245) + . chr(246) + . chr(248) + . chr(249) + . chr(250) + . chr(251) + . chr(252) + . chr(253) + . chr(255); + + $characters['out'] = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy'; + + $string = strtr($string, $characters['in'], $characters['out']); + + $doubleChars = []; + + $doubleChars['in'] = [ + chr(140), + chr(156), + chr(198), + chr(208), + chr(222), + chr(223), + chr(230), + chr(240), + chr(254), + ]; + + $doubleChars['out'] = ['OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th']; + + $string = str_replace($doubleChars['in'], $doubleChars['out'], $string); + } + + return $string; + } + + /** + * Convert any passed string to a url friendly string. + * Converts 'My first blog post' to 'my-first-blog-post' + * + * @param string $string String to urlize. + * + * @return string Urlized string. + */ + public function urlize(string $string): string + { + // Remove all non url friendly characters with the unaccent function + $unaccented = $this->unaccent($string); + + if (function_exists('mb_strtolower')) { + $lowered = mb_strtolower($unaccented); + } else { + $lowered = strtolower($unaccented); + } + + $replacements = [ + '/\W/' => ' ', + '/([A-Z]+)([A-Z][a-z])/' => '\1_\2', + '/([a-z\d])([A-Z])/' => '\1_\2', + '/[^A-Z^a-z^0-9^\/]+/' => '-', + ]; + + $urlized = $lowered; + + foreach ($replacements as $pattern => $replacement) { + $replaced = preg_replace($pattern, $replacement, $urlized); + + if ($replaced === null) { + throw new RuntimeException(sprintf( + 'preg_replace returned null for value "%s"', + $urlized + )); + } + + $urlized = $replaced; + } + + return trim($urlized, '-'); + } + + /** + * Returns a word in singular form. + * + * @param string $word The word in plural form. + * + * @return string The word in singular form. + */ + public function singularize(string $word): string + { + return $this->singularizer->inflect($word); + } + + /** + * Returns a word in plural form. + * + * @param string $word The word in singular form. + * + * @return string The word in plural form. + */ + public function pluralize(string $word): string + { + return $this->pluralizer->inflect($word); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/InflectorFactory.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/InflectorFactory.php new file mode 100644 index 00000000..a0740a74 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/InflectorFactory.php @@ -0,0 +1,52 @@ +getFlippedSubstitutions() + ); + } + + public static function getPluralRuleset(): Ruleset + { + return new Ruleset( + new Transformations(...Inflectible::getPlural()), + new Patterns(...Uninflected::getPlural()), + new Substitutions(...Inflectible::getIrregular()) + ); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/English/Uninflected.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/English/Uninflected.php new file mode 100644 index 00000000..e2656cc4 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/English/Uninflected.php @@ -0,0 +1,193 @@ +getFlippedSubstitutions() + ); + } + + public static function getPluralRuleset(): Ruleset + { + return new Ruleset( + new Transformations(...Inflectible::getPlural()), + new Patterns(...Uninflected::getPlural()), + new Substitutions(...Inflectible::getIrregular()) + ); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/French/Uninflected.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/French/Uninflected.php new file mode 100644 index 00000000..3cf2444a --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/French/Uninflected.php @@ -0,0 +1,34 @@ +getFlippedSubstitutions() + ); + } + + public static function getPluralRuleset(): Ruleset + { + return new Ruleset( + new Transformations(...Inflectible::getPlural()), + new Patterns(...Uninflected::getPlural()), + new Substitutions(...Inflectible::getIrregular()) + ); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/NorwegianBokmal/Uninflected.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/NorwegianBokmal/Uninflected.php new file mode 100644 index 00000000..5d878c6d --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/NorwegianBokmal/Uninflected.php @@ -0,0 +1,36 @@ +pattern = $pattern; + + if (isset($this->pattern[0]) && $this->pattern[0] === '/') { + $this->regex = $this->pattern; + } else { + $this->regex = '/' . $this->pattern . '/i'; + } + } + + public function getPattern(): string + { + return $this->pattern; + } + + public function getRegex(): string + { + return $this->regex; + } + + public function matches(string $word): bool + { + return preg_match($this->getRegex(), $word) === 1; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Patterns.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Patterns.php new file mode 100644 index 00000000..e8d45cb7 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Patterns.php @@ -0,0 +1,34 @@ +patterns = $patterns; + + $patterns = array_map(static function (Pattern $pattern): string { + return $pattern->getPattern(); + }, $this->patterns); + + $this->regex = '/^(?:' . implode('|', $patterns) . ')$/i'; + } + + public function matches(string $word): bool + { + return preg_match($this->regex, $word, $regs) === 1; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Portuguese/Inflectible.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Portuguese/Inflectible.php new file mode 100644 index 00000000..95564d49 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Portuguese/Inflectible.php @@ -0,0 +1,104 @@ +getFlippedSubstitutions() + ); + } + + public static function getPluralRuleset(): Ruleset + { + return new Ruleset( + new Transformations(...Inflectible::getPlural()), + new Patterns(...Uninflected::getPlural()), + new Substitutions(...Inflectible::getIrregular()) + ); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Portuguese/Uninflected.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Portuguese/Uninflected.php new file mode 100644 index 00000000..58c34f9b --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Portuguese/Uninflected.php @@ -0,0 +1,38 @@ +regular = $regular; + $this->uninflected = $uninflected; + $this->irregular = $irregular; + } + + public function getRegular(): Transformations + { + return $this->regular; + } + + public function getUninflected(): Patterns + { + return $this->uninflected; + } + + public function getIrregular(): Substitutions + { + return $this->irregular; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Spanish/Inflectible.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Spanish/Inflectible.php new file mode 100644 index 00000000..c6862fa4 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Spanish/Inflectible.php @@ -0,0 +1,53 @@ +getFlippedSubstitutions() + ); + } + + public static function getPluralRuleset(): Ruleset + { + return new Ruleset( + new Transformations(...Inflectible::getPlural()), + new Patterns(...Uninflected::getPlural()), + new Substitutions(...Inflectible::getIrregular()) + ); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Spanish/Uninflected.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Spanish/Uninflected.php new file mode 100644 index 00000000..c743b393 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Spanish/Uninflected.php @@ -0,0 +1,36 @@ +from = $from; + $this->to = $to; + } + + public function getFrom(): Word + { + return $this->from; + } + + public function getTo(): Word + { + return $this->to; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Substitutions.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Substitutions.php new file mode 100644 index 00000000..17ee2961 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Substitutions.php @@ -0,0 +1,57 @@ +substitutions[$substitution->getFrom()->getWord()] = $substitution; + } + } + + public function getFlippedSubstitutions(): Substitutions + { + $substitutions = []; + + foreach ($this->substitutions as $substitution) { + $substitutions[] = new Substitution( + $substitution->getTo(), + $substitution->getFrom() + ); + } + + return new Substitutions(...$substitutions); + } + + public function inflect(string $word): string + { + $lowerWord = strtolower($word); + + if (isset($this->substitutions[$lowerWord])) { + $firstLetterUppercase = $lowerWord[0] !== $word[0]; + + $toWord = $this->substitutions[$lowerWord]->getTo()->getWord(); + + if ($firstLetterUppercase) { + return strtoupper($toWord[0]) . substr($toWord, 1); + } + + return $toWord; + } + + return $word; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Transformation.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Transformation.php new file mode 100644 index 00000000..30dcd594 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Transformation.php @@ -0,0 +1,39 @@ +pattern = $pattern; + $this->replacement = $replacement; + } + + public function getPattern(): Pattern + { + return $this->pattern; + } + + public function getReplacement(): string + { + return $this->replacement; + } + + public function inflect(string $word): string + { + return (string) preg_replace($this->pattern->getRegex(), $this->replacement, $word); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Transformations.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Transformations.php new file mode 100644 index 00000000..b6a48fa8 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Transformations.php @@ -0,0 +1,29 @@ +transformations = $transformations; + } + + public function inflect(string $word): string + { + foreach ($this->transformations as $transformation) { + if ($transformation->getPattern()->matches($word)) { + return $transformation->inflect($word); + } + } + + return $word; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Turkish/Inflectible.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Turkish/Inflectible.php new file mode 100644 index 00000000..d7b7064c --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Turkish/Inflectible.php @@ -0,0 +1,40 @@ +getFlippedSubstitutions() + ); + } + + public static function getPluralRuleset(): Ruleset + { + return new Ruleset( + new Transformations(...Inflectible::getPlural()), + new Patterns(...Uninflected::getPlural()), + new Substitutions(...Inflectible::getIrregular()) + ); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Turkish/Uninflected.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Turkish/Uninflected.php new file mode 100644 index 00000000..a75d2486 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Turkish/Uninflected.php @@ -0,0 +1,36 @@ +word = $word; + } + + public function getWord(): string + { + return $this->word; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/RulesetInflector.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/RulesetInflector.php new file mode 100644 index 00000000..12b2ed5b --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/RulesetInflector.php @@ -0,0 +1,56 @@ +rulesets = array_merge([$ruleset], $rulesets); + } + + public function inflect(string $word): string + { + if ($word === '') { + return ''; + } + + foreach ($this->rulesets as $ruleset) { + if ($ruleset->getUninflected()->matches($word)) { + return $word; + } + + $inflected = $ruleset->getIrregular()->inflect($word); + + if ($inflected !== $word) { + return $inflected; + } + + $inflected = $ruleset->getRegular()->inflect($word); + + if ($inflected !== $word) { + return $inflected; + } + } + + return $word; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/WordInflector.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/WordInflector.php new file mode 100644 index 00000000..b88b1d69 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/WordInflector.php @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/vendor/doctrine/instantiator/.doctrine-project.json b/vendor/doctrine/instantiator/.doctrine-project.json new file mode 100644 index 00000000..24ae36e0 --- /dev/null +++ b/vendor/doctrine/instantiator/.doctrine-project.json @@ -0,0 +1,47 @@ +{ + "active": true, + "name": "Instantiator", + "slug": "instantiator", + "docsSlug": "doctrine-instantiator", + "codePath": "/src", + "versions": [ + { + "name": "1.5", + "branchName": "1.5.x", + "slug": "latest", + "upcoming": true + }, + { + "name": "1.4", + "branchName": "1.4.x", + "slug": "1.4", + "aliases": [ + "current", + "stable" + ], + "maintained": true, + "current": true + }, + { + "name": "1.3", + "branchName": "1.3.x", + "slug": "1.3", + "maintained": false + }, + { + "name": "1.2", + "branchName": "1.2.x", + "slug": "1.2" + }, + { + "name": "1.1", + "branchName": "1.1.x", + "slug": "1.1" + }, + { + "name": "1.0", + "branchName": "1.0.x", + "slug": "1.0" + } + ] +} diff --git a/vendor/doctrine/instantiator/CONTRIBUTING.md b/vendor/doctrine/instantiator/CONTRIBUTING.md new file mode 100644 index 00000000..c1a2c42e --- /dev/null +++ b/vendor/doctrine/instantiator/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# Contributing + + * Follow the [Doctrine Coding Standard](https://github.com/doctrine/coding-standard) + * The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php) + * Any contribution must provide tests for additional introduced conditions + * Any un-confirmed issue needs a failing test case before being accepted + * Pull requests must be sent from a new hotfix/feature branch, not from `master`. + +## Installation + +To install the project and run the tests, you need to clone it first: + +```sh +$ git clone git://github.com/doctrine/instantiator.git +``` + +You will then need to run a composer installation: + +```sh +$ cd Instantiator +$ curl -s https://getcomposer.org/installer | php +$ php composer.phar update +``` + +## Testing + +The PHPUnit version to be used is the one installed as a dev- dependency via composer: + +```sh +$ ./vendor/bin/phpunit +``` + +Accepted coverage for new contributions is 80%. Any contribution not satisfying this requirement +won't be merged. + diff --git a/vendor/doctrine/instantiator/LICENSE b/vendor/doctrine/instantiator/LICENSE new file mode 100644 index 00000000..4d983d1a --- /dev/null +++ b/vendor/doctrine/instantiator/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 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/instantiator/README.md b/vendor/doctrine/instantiator/README.md new file mode 100644 index 00000000..4bc02b65 --- /dev/null +++ b/vendor/doctrine/instantiator/README.md @@ -0,0 +1,38 @@ +# Instantiator + +This library provides a way of avoiding usage of constructors when instantiating PHP classes. + +[![Build Status](https://travis-ci.org/doctrine/instantiator.svg?branch=master)](https://travis-ci.org/doctrine/instantiator) +[![Code Coverage](https://codecov.io/gh/doctrine/instantiator/branch/master/graph/badge.svg)](https://codecov.io/gh/doctrine/instantiator/branch/master) +[![Dependency Status](https://www.versioneye.com/package/php--doctrine--instantiator/badge.svg)](https://www.versioneye.com/package/php--doctrine--instantiator) + +[![Latest Stable Version](https://poser.pugx.org/doctrine/instantiator/v/stable.png)](https://packagist.org/packages/doctrine/instantiator) +[![Latest Unstable Version](https://poser.pugx.org/doctrine/instantiator/v/unstable.png)](https://packagist.org/packages/doctrine/instantiator) + +## Installation + +The suggested installation method is via [composer](https://getcomposer.org/): + +```sh +php composer.phar require "doctrine/instantiator:~1.0.3" +``` + +## Usage + +The instantiator is able to create new instances of any class without using the constructor or any API of the class +itself: + +```php +$instantiator = new \Doctrine\Instantiator\Instantiator(); + +$instance = $instantiator->instantiate(\My\ClassName\Here::class); +``` + +## Contributing + +Please read the [CONTRIBUTING.md](CONTRIBUTING.md) contents if you wish to help out! + +## Credits + +This library was migrated from [ocramius/instantiator](https://github.com/Ocramius/Instantiator), which +has been donated to the doctrine organization, and which is now deprecated in favour of this package. diff --git a/vendor/doctrine/instantiator/composer.json b/vendor/doctrine/instantiator/composer.json new file mode 100644 index 00000000..4fba95ca --- /dev/null +++ b/vendor/doctrine/instantiator/composer.json @@ -0,0 +1,48 @@ +{ + "name": "doctrine/instantiator", + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "type": "library", + "license": "MIT", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "instantiate", + "constructor" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "ext-phar": "*", + "ext-pdo": "*", + "doctrine/coding-standard": "^9", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "autoload-dev": { + "psr-0": { + "DoctrineTest\\InstantiatorPerformance\\": "tests", + "DoctrineTest\\InstantiatorTest\\": "tests", + "DoctrineTest\\InstantiatorTestAsset\\": "tests" + } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} diff --git a/vendor/doctrine/instantiator/docs/en/index.rst b/vendor/doctrine/instantiator/docs/en/index.rst new file mode 100644 index 00000000..0c85da0b --- /dev/null +++ b/vendor/doctrine/instantiator/docs/en/index.rst @@ -0,0 +1,68 @@ +Introduction +============ + +This library provides a way of avoiding usage of constructors when instantiating PHP classes. + +Installation +============ + +The suggested installation method is via `composer`_: + +.. code-block:: console + + $ composer require doctrine/instantiator + +Usage +===== + +The instantiator is able to create new instances of any class without +using the constructor or any API of the class itself: + +.. code-block:: php + + instantiate(User::class); + +Contributing +============ + +- Follow the `Doctrine Coding Standard`_ +- The project will follow strict `object calisthenics`_ +- Any contribution must provide tests for additional introduced + conditions +- Any un-confirmed issue needs a failing test case before being + accepted +- Pull requests must be sent from a new hotfix/feature branch, not from + ``master``. + +Testing +======= + +The PHPUnit version to be used is the one installed as a dev- dependency +via composer: + +.. code-block:: console + + $ ./vendor/bin/phpunit + +Accepted coverage for new contributions is 80%. Any contribution not +satisfying this requirement won’t be merged. + +Credits +======= + +This library was migrated from `ocramius/instantiator`_, which has been +donated to the doctrine organization, and which is now deprecated in +favour of this package. + +.. _composer: https://getcomposer.org/ +.. _CONTRIBUTING.md: CONTRIBUTING.md +.. _ocramius/instantiator: https://github.com/Ocramius/Instantiator +.. _Doctrine Coding Standard: https://github.com/doctrine/coding-standard +.. _object calisthenics: http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php diff --git a/vendor/doctrine/instantiator/docs/en/sidebar.rst b/vendor/doctrine/instantiator/docs/en/sidebar.rst new file mode 100644 index 00000000..0c364791 --- /dev/null +++ b/vendor/doctrine/instantiator/docs/en/sidebar.rst @@ -0,0 +1,4 @@ +.. toctree:: + :depth: 3 + + index diff --git a/vendor/doctrine/instantiator/psalm.xml b/vendor/doctrine/instantiator/psalm.xml new file mode 100644 index 00000000..e6270c13 --- /dev/null +++ b/vendor/doctrine/instantiator/psalm.xml @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php new file mode 100644 index 00000000..e6a5195f --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php @@ -0,0 +1,12 @@ + $reflectionClass + * + * @template T of object + */ + public static function fromAbstractClass(ReflectionClass $reflectionClass): self + { + return new self(sprintf( + 'The provided class "%s" is abstract, and cannot be instantiated', + $reflectionClass->getName() + )); + } + + public static function fromEnum(string $className): self + { + return new self(sprintf( + 'The provided class "%s" is an enum, and cannot be instantiated', + $className + )); + } +} diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php new file mode 100644 index 00000000..4e55ac52 --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php @@ -0,0 +1,59 @@ + $reflectionClass + * + * @template T of object + */ + public static function fromSerializationTriggeredException( + ReflectionClass $reflectionClass, + Exception $exception + ): self { + return new self( + sprintf( + 'An exception was raised while trying to instantiate an instance of "%s" via un-serialization', + $reflectionClass->getName() + ), + 0, + $exception + ); + } + + /** + * @phpstan-param ReflectionClass $reflectionClass + * + * @template T of object + */ + public static function fromUncleanUnSerialization( + ReflectionClass $reflectionClass, + string $errorString, + int $errorCode, + string $errorFile, + int $errorLine + ): self { + return new self( + sprintf( + 'Could not produce an instance of "%s" via un-serialization, since an error was triggered ' + . 'in file "%s" at line "%d"', + $reflectionClass->getName(), + $errorFile, + $errorLine + ), + 0, + new Exception($errorString, $errorCode) + ); + } +} diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php new file mode 100644 index 00000000..d616fa4d --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php @@ -0,0 +1,260 @@ + $className + * + * @return object + * @phpstan-return T + * + * @throws ExceptionInterface + * + * @template T of object + */ + public function instantiate($className) + { + if (isset(self::$cachedCloneables[$className])) { + /** + * @phpstan-var T + */ + $cachedCloneable = self::$cachedCloneables[$className]; + + return clone $cachedCloneable; + } + + if (isset(self::$cachedInstantiators[$className])) { + $factory = self::$cachedInstantiators[$className]; + + return $factory(); + } + + return $this->buildAndCacheFromFactory($className); + } + + /** + * Builds the requested object and caches it in static properties for performance + * + * @phpstan-param class-string $className + * + * @return object + * @phpstan-return T + * + * @template T of object + */ + private function buildAndCacheFromFactory(string $className) + { + $factory = self::$cachedInstantiators[$className] = $this->buildFactory($className); + $instance = $factory(); + + if ($this->isSafeToClone(new ReflectionClass($instance))) { + self::$cachedCloneables[$className] = clone $instance; + } + + return $instance; + } + + /** + * Builds a callable capable of instantiating the given $className without + * invoking its constructor. + * + * @phpstan-param class-string $className + * + * @phpstan-return callable(): T + * + * @throws InvalidArgumentException + * @throws UnexpectedValueException + * @throws ReflectionException + * + * @template T of object + */ + private function buildFactory(string $className): callable + { + $reflectionClass = $this->getReflectionClass($className); + + if ($this->isInstantiableViaReflection($reflectionClass)) { + return [$reflectionClass, 'newInstanceWithoutConstructor']; + } + + $serializedString = sprintf( + '%s:%d:"%s":0:{}', + is_subclass_of($className, Serializable::class) ? self::SERIALIZATION_FORMAT_USE_UNSERIALIZER : self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER, + strlen($className), + $className + ); + + $this->checkIfUnSerializationIsSupported($reflectionClass, $serializedString); + + return static function () use ($serializedString) { + return unserialize($serializedString); + }; + } + + /** + * @phpstan-param class-string $className + * + * @phpstan-return ReflectionClass + * + * @throws InvalidArgumentException + * @throws ReflectionException + * + * @template T of object + */ + private function getReflectionClass(string $className): ReflectionClass + { + if (! class_exists($className)) { + throw InvalidArgumentException::fromNonExistingClass($className); + } + + if (PHP_VERSION_ID >= 80100 && enum_exists($className, false)) { + throw InvalidArgumentException::fromEnum($className); + } + + $reflection = new ReflectionClass($className); + + if ($reflection->isAbstract()) { + throw InvalidArgumentException::fromAbstractClass($reflection); + } + + return $reflection; + } + + /** + * @phpstan-param ReflectionClass $reflectionClass + * + * @throws UnexpectedValueException + * + * @template T of object + */ + private function checkIfUnSerializationIsSupported(ReflectionClass $reflectionClass, string $serializedString): void + { + set_error_handler(static function (int $code, string $message, string $file, int $line) use ($reflectionClass, &$error): bool { + $error = UnexpectedValueException::fromUncleanUnSerialization( + $reflectionClass, + $message, + $code, + $file, + $line + ); + + return true; + }); + + try { + $this->attemptInstantiationViaUnSerialization($reflectionClass, $serializedString); + } finally { + restore_error_handler(); + } + + if ($error) { + throw $error; + } + } + + /** + * @phpstan-param ReflectionClass $reflectionClass + * + * @throws UnexpectedValueException + * + * @template T of object + */ + private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, string $serializedString): void + { + try { + unserialize($serializedString); + } catch (Exception $exception) { + throw UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $exception); + } + } + + /** + * @phpstan-param ReflectionClass $reflectionClass + * + * @template T of object + */ + private function isInstantiableViaReflection(ReflectionClass $reflectionClass): bool + { + return ! ($this->hasInternalAncestors($reflectionClass) && $reflectionClass->isFinal()); + } + + /** + * Verifies whether the given class is to be considered internal + * + * @phpstan-param ReflectionClass $reflectionClass + * + * @template T of object + */ + private function hasInternalAncestors(ReflectionClass $reflectionClass): bool + { + do { + if ($reflectionClass->isInternal()) { + return true; + } + + $reflectionClass = $reflectionClass->getParentClass(); + } while ($reflectionClass); + + return false; + } + + /** + * Checks if a class is cloneable + * + * Classes implementing `__clone` cannot be safely cloned, as that may cause side-effects. + * + * @phpstan-param ReflectionClass $reflectionClass + * + * @template T of object + */ + private function isSafeToClone(ReflectionClass $reflectionClass): bool + { + return $reflectionClass->isCloneable() + && ! $reflectionClass->hasMethod('__clone') + && ! $reflectionClass->isSubclassOf(ArrayIterator::class); + } +} diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php new file mode 100644 index 00000000..10508b56 --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php @@ -0,0 +1,24 @@ + $className + * + * @return object + * @phpstan-return T + * + * @throws ExceptionInterface + * + * @template T of object + */ + public function instantiate($className); +} diff --git a/vendor/doctrine/lexer/LICENSE b/vendor/doctrine/lexer/LICENSE new file mode 100644 index 00000000..e8fdec4a --- /dev/null +++ b/vendor/doctrine/lexer/LICENSE @@ -0,0 +1,19 @@ +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 new file mode 100644 index 00000000..784f2a27 --- /dev/null +++ b/vendor/doctrine/lexer/README.md @@ -0,0 +1,9 @@ +# Doctrine Lexer + +[![Build Status](https://github.com/doctrine/lexer/workflows/Continuous%20Integration/badge.svg)](https://github.com/doctrine/lexer/actions) + +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 new file mode 100644 index 00000000..c4356477 --- /dev/null +++ b/vendor/doctrine/lexer/composer.json @@ -0,0 +1,41 @@ +{ + "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.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" + }, + "autoload": { + "psr-4": { "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" } + }, + "autoload-dev": { + "psr-4": { "Doctrine\\Tests\\": "tests/Doctrine" } + }, + "config": { + "allow-plugins": { + "composer/package-versions-deprecated": true, + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "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 new file mode 100644 index 00000000..7e8a11d4 --- /dev/null +++ b/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php @@ -0,0 +1,337 @@ + + */ + private $tokens = []; + + /** + * Current lexer position in input string. + * + * @var int + */ + private $position = 0; + + /** + * Current peek of current lexer position. + * + * @var int + */ + private $peek = 0; + + /** + * The next token in the input. + * + * @var mixed[]|null + * @psalm-var Token|null + */ + public $lookahead; + + /** + * The last matched/seen token. + * + * @var mixed[]|null + * @psalm-var Token|null + */ + public $token; + + /** + * Composed regex for input parsing. + * + * @var string|null + */ + private $regex; + + /** + * Sets the input data to be tokenized. + * + * The Lexer is immediately reset and the new input tokenized. + * Any unprocessed tokens from any previous input are lost. + * + * @param string $input The input to be tokenized. + * + * @return void + */ + public function setInput($input) + { + $this->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 $type + * + * @return bool + */ + public function isNextToken($type) + { + return $this->lookahead !== null && $this->lookahead['type'] === $type; + } + + /** + * Checks whether any of the given tokens matches the current lookahead. + * + * @param list $types + * + * @return bool + */ + public function isNextTokenAny(array $types) + { + return $this->lookahead !== null && in_array($this->lookahead['type'], $types, 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 mixed[]|null The next token or NULL if there are no more tokens ahead. + * @psalm-return Token|null + */ + 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 mixed[]|null The next token or NULL if there are no more tokens ahead. + * @psalm-return Token|null + */ + 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 string[] + */ + abstract protected function getCatchablePatterns(); + + /** + * Lexical non-catchable patterns. + * + * @return string[] + */ + 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/doctrine/lexer/psalm.xml b/vendor/doctrine/lexer/psalm.xml new file mode 100644 index 00000000..f331e50c --- /dev/null +++ b/vendor/doctrine/lexer/psalm.xml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/vendor/dragonmantank/cron-expression/.editorconfig b/vendor/dragonmantank/cron-expression/.editorconfig new file mode 100644 index 00000000..1492202b --- /dev/null +++ b/vendor/dragonmantank/cron-expression/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/vendor/dragonmantank/cron-expression/CHANGELOG.md b/vendor/dragonmantank/cron-expression/CHANGELOG.md new file mode 100644 index 00000000..4e207aad --- /dev/null +++ b/vendor/dragonmantank/cron-expression/CHANGELOG.md @@ -0,0 +1,84 @@ +# Change Log + +## [2.3.1] - 2020-10-12 +### Added +- Added support for PHP 8 (#92) +### Changed +- N/A +### Fixed +- N/A + +## [2.3.0] - 2019-03-30 +### Added +- Added support for DateTimeImmutable via DateTimeInterface +- Added support for PHP 7.3 +- Started listing projects that use the library +### Changed +- Errors should now report a human readable position in the cron expression, instead of starting at 0 +### Fixed +- N/A + +## [2.2.0] - 2018-06-05 +### Added +- Added support for steps larger than field ranges (#6) +## Changed +- N/A +### Fixed +- Fixed validation for numbers with leading 0s (#12) + +## [2.1.0] - 2018-04-06 +### Added +- N/A +### Changed +- Upgraded to PHPUnit 6 (#2) +### Fixed +- Refactored timezones to deal with some inconsistent behavior (#3) +- Allow ranges and lists in same expression (#5) +- Fixed regression where literals were not converted to their numerical counterpart (#) + +## [2.0.0] - 2017-10-12 +### Added +- N/A + +### Changed +- Dropped support for PHP 5.x +- Dropped support for the YEAR field, as it was not part of the cron standard + +### Fixed +- Reworked validation for all the field types +- Stepping should now work for 1-indexed fields like Month (#153) + +## [1.2.0] - 2017-01-22 +### Added +- Added IDE, CodeSniffer, and StyleCI.IO support + +### Changed +- Switched to PSR-4 Autoloading + +### Fixed +- 0 step expressions are handled better +- Fixed `DayOfMonth` validation to be more strict +- Typos + +## [1.1.0] - 2016-01-26 +### Added +- Support for non-hourly offset timezones +- Checks for valid expressions + +### Changed +- Max Iterations no longer hardcoded for `getRunDate()` +- Supports DateTimeImmutable for newer PHP verions + +### Fixed +- Fixed looping bug for PHP 7 when determining the last specified weekday of a month + +## [1.0.3] - 2013-11-23 +### Added +- Now supports expressions with any number of extra spaces, tabs, or newlines + +### Changed +- Using static instead of self in `CronExpression::factory` + +### Fixed +- Fixes issue [#28](https://github.com/mtdowling/cron-expression/issues/28) where PHP increments of ranges were failing due to PHP casting hyphens to 0 +- Only set default timezone if the given $currentTime is not a DateTime instance ([#34](https://github.com/mtdowling/cron-expression/issues/34)) diff --git a/vendor/dragonmantank/cron-expression/LICENSE b/vendor/dragonmantank/cron-expression/LICENSE new file mode 100644 index 00000000..3e38bbc8 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2011 Michael Dowling , 2016 Chris Tankersley , and contributors + +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/dragonmantank/cron-expression/README.md b/vendor/dragonmantank/cron-expression/README.md new file mode 100644 index 00000000..8e8021b2 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/README.md @@ -0,0 +1,78 @@ +PHP Cron Expression Parser +========================== + +[![Latest Stable Version](https://poser.pugx.org/dragonmantank/cron-expression/v/stable.png)](https://packagist.org/packages/dragonmantank/cron-expression) [![Total Downloads](https://poser.pugx.org/dragonmantank/cron-expression/downloads.png)](https://packagist.org/packages/dragonmantank/cron-expression) [![Build Status](https://secure.travis-ci.org/dragonmantank/cron-expression.png)](http://travis-ci.org/dragonmantank/cron-expression) + +The PHP cron expression parser can parse a CRON expression, determine if it is +due to run, calculate the next run date of the expression, and calculate the previous +run date of the expression. You can calculate dates far into the future or past by +skipping **n** number of matching dates. + +The parser can handle increments of ranges (e.g. */12, 2-59/3), intervals (e.g. 0-9), +lists (e.g. 1,2,3), **W** to find the nearest weekday for a given day of the month, **L** to +find the last day of the month, **L** to find the last given weekday of a month, and hash +(#) to find the nth weekday of a given month. + +More information about this fork can be found in the blog post [here](http://ctankersley.com/2017/10/12/cron-expression-update/). tl;dr - v2.0.0 is a major breaking change, and @dragonmantank can better take care of the project in a separate fork. + +Installing +========== + +Add the dependency to your project: + +```bash +composer require dragonmantank/cron-expression +``` + +Usage +===== +```php +isDue(); +echo $cron->getNextRunDate()->format('Y-m-d H:i:s'); +echo $cron->getPreviousRunDate()->format('Y-m-d H:i:s'); + +// Works with complex expressions +$cron = Cron\CronExpression::factory('3-59/15 6-12 */15 1 2-5'); +echo $cron->getNextRunDate()->format('Y-m-d H:i:s'); + +// Calculate a run date two iterations into the future +$cron = Cron\CronExpression::factory('@daily'); +echo $cron->getNextRunDate(null, 2)->format('Y-m-d H:i:s'); + +// Calculate a run date relative to a specific time +$cron = Cron\CronExpression::factory('@monthly'); +echo $cron->getNextRunDate('2010-01-12 00:00:00')->format('Y-m-d H:i:s'); +``` + +CRON Expressions +================ + +A CRON expression is a string representing the schedule for a particular command to execute. The parts of a CRON schedule are as follows: + + * * * * * + - - - - - + | | | | | + | | | | | + | | | | +----- day of week (0 - 7) (Sunday=0 or 7) + | | | +---------- month (1 - 12) + | | +--------------- day of month (1 - 31) + | +-------------------- hour (0 - 23) + +------------------------- min (0 - 59) + +Requirements +============ + +- PHP 7.0+ +- PHPUnit is required to run the unit tests +- Composer is required to run the unit tests + +Projects that Use cron-expression +================================= +* Part of the [Laravel Framework](https://github.com/laravel/framework/) +* Available as a [Symfony Bundle - setono/cron-expression-bundle](https://github.com/Setono/CronExpressionBundle) \ No newline at end of file diff --git a/vendor/dragonmantank/cron-expression/composer.json b/vendor/dragonmantank/cron-expression/composer.json new file mode 100644 index 00000000..6fcf8184 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/composer.json @@ -0,0 +1,40 @@ +{ + "name": "dragonmantank/cron-expression", + "type": "library", + "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", + "keywords": ["cron", "schedule"], + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Chris Tankersley", + "email": "chris@ctankersley.com", + "homepage": "https://github.com/dragonmantank" + } + ], + "require": { + "php": "^7.0|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.4|^7.0|^8.0|^9.0" + }, + "autoload": { + "psr-4": { + "Cron\\": "src/Cron/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/Cron/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/AbstractField.php b/vendor/dragonmantank/cron-expression/src/Cron/AbstractField.php new file mode 100644 index 00000000..8b1072ab --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/AbstractField.php @@ -0,0 +1,286 @@ +fullRange = range($this->rangeStart, $this->rangeEnd); + } + + /** + * Check to see if a field is satisfied by a value + * + * @param string $dateValue Date value to check + * @param string $value Value to test + * + * @return bool + */ + public function isSatisfied($dateValue, $value) + { + if ($this->isIncrementsOfRanges($value)) { + return $this->isInIncrementsOfRanges($dateValue, $value); + } elseif ($this->isRange($value)) { + return $this->isInRange($dateValue, $value); + } + + return $value == '*' || $dateValue == $value; + } + + /** + * Check if a value is a range + * + * @param string $value Value to test + * + * @return bool + */ + public function isRange($value) + { + return strpos($value, '-') !== false; + } + + /** + * Check if a value is an increments of ranges + * + * @param string $value Value to test + * + * @return bool + */ + public function isIncrementsOfRanges($value) + { + return strpos($value, '/') !== false; + } + + /** + * Test if a value is within a range + * + * @param string $dateValue Set date value + * @param string $value Value to test + * + * @return bool + */ + public function isInRange($dateValue, $value) + { + $parts = array_map(function($value) { + $value = trim($value); + $value = $this->convertLiterals($value); + return $value; + }, + explode('-', $value, 2) + ); + + + return $dateValue >= $parts[0] && $dateValue <= $parts[1]; + } + + /** + * Test if a value is within an increments of ranges (offset[-to]/step size) + * + * @param string $dateValue Set date value + * @param string $value Value to test + * + * @return bool + */ + public function isInIncrementsOfRanges($dateValue, $value) + { + $chunks = array_map('trim', explode('/', $value, 2)); + $range = $chunks[0]; + $step = isset($chunks[1]) ? $chunks[1] : 0; + + // No step or 0 steps aren't cool + if (is_null($step) || '0' === $step || 0 === $step) { + return false; + } + + // Expand the * to a full range + if ('*' == $range) { + $range = $this->rangeStart . '-' . $this->rangeEnd; + } + + // Generate the requested small range + $rangeChunks = explode('-', $range, 2); + $rangeStart = $rangeChunks[0]; + $rangeEnd = isset($rangeChunks[1]) ? $rangeChunks[1] : $rangeStart; + + if ($rangeStart < $this->rangeStart || $rangeStart > $this->rangeEnd || $rangeStart > $rangeEnd) { + throw new \OutOfRangeException('Invalid range start requested'); + } + + if ($rangeEnd < $this->rangeStart || $rangeEnd > $this->rangeEnd || $rangeEnd < $rangeStart) { + throw new \OutOfRangeException('Invalid range end requested'); + } + + // Steps larger than the range need to wrap around and be handled slightly differently than smaller steps + if ($step >= $this->rangeEnd) { + $thisRange = [$this->fullRange[$step % count($this->fullRange)]]; + } else { + $thisRange = range($rangeStart, $rangeEnd, $step); + } + + return in_array($dateValue, $thisRange); + } + + /** + * Returns a range of values for the given cron expression + * + * @param string $expression The expression to evaluate + * @param int $max Maximum offset for range + * + * @return array + */ + public function getRangeForExpression($expression, $max) + { + $values = array(); + $expression = $this->convertLiterals($expression); + + if (strpos($expression, ',') !== false) { + $ranges = explode(',', $expression); + $values = []; + foreach ($ranges as $range) { + $expanded = $this->getRangeForExpression($range, $this->rangeEnd); + $values = array_merge($values, $expanded); + } + return $values; + } + + if ($this->isRange($expression) || $this->isIncrementsOfRanges($expression)) { + if (!$this->isIncrementsOfRanges($expression)) { + list ($offset, $to) = explode('-', $expression); + $offset = $this->convertLiterals($offset); + $to = $this->convertLiterals($to); + $stepSize = 1; + } + else { + $range = array_map('trim', explode('/', $expression, 2)); + $stepSize = isset($range[1]) ? $range[1] : 0; + $range = $range[0]; + $range = explode('-', $range, 2); + $offset = $range[0]; + $to = isset($range[1]) ? $range[1] : $max; + } + $offset = $offset == '*' ? $this->rangeStart : $offset; + if ($stepSize >= $this->rangeEnd) { + $values = [$this->fullRange[$stepSize % count($this->fullRange)]]; + } else { + for ($i = $offset; $i <= $to; $i += $stepSize) { + $values[] = (int)$i; + } + } + sort($values); + } + else { + $values = array($expression); + } + + return $values; + } + + /** + * Convert literal + * + * @param string $value + * @return string + */ + protected function convertLiterals($value) + { + if (count($this->literals)) { + $key = array_search($value, $this->literals); + if ($key !== false) { + return (string) $key; + } + } + + return $value; + } + + /** + * Checks to see if a value is valid for the field + * + * @param string $value + * @return bool + */ + public function validate($value) + { + $value = $this->convertLiterals($value); + + // All fields allow * as a valid value + if ('*' === $value) { + return true; + } + + if (strpos($value, '/') !== false) { + list($range, $step) = explode('/', $value); + return $this->validate($range) && filter_var($step, FILTER_VALIDATE_INT); + } + + // Validate each chunk of a list individually + if (strpos($value, ',') !== false) { + foreach (explode(',', $value) as $listItem) { + if (!$this->validate($listItem)) { + return false; + } + } + return true; + } + + if (strpos($value, '-') !== false) { + if (substr_count($value, '-') > 1) { + return false; + } + + $chunks = explode('-', $value); + $chunks[0] = $this->convertLiterals($chunks[0]); + $chunks[1] = $this->convertLiterals($chunks[1]); + + if ('*' == $chunks[0] || '*' == $chunks[1]) { + return false; + } + + return $this->validate($chunks[0]) && $this->validate($chunks[1]); + } + + if (!is_numeric($value)) { + return false; + } + + if (is_float($value) || strpos($value, '.') !== false) { + return false; + } + + // We should have a numeric by now, so coerce this into an integer + $value = (int) $value; + + return in_array($value, $this->fullRange, true); + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php b/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php new file mode 100644 index 00000000..594b4358 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php @@ -0,0 +1,413 @@ + '0 0 1 1 *', + '@annually' => '0 0 1 1 *', + '@monthly' => '0 0 1 * *', + '@weekly' => '0 0 * * 0', + '@daily' => '0 0 * * *', + '@hourly' => '0 * * * *' + ); + + if (isset($mappings[$expression])) { + $expression = $mappings[$expression]; + } + + return new static($expression, $fieldFactory ?: new FieldFactory()); + } + + /** + * Validate a CronExpression. + * + * @param string $expression The CRON expression to validate. + * + * @return bool True if a valid CRON expression was passed. False if not. + * @see \Cron\CronExpression::factory + */ + public static function isValidExpression($expression) + { + try { + self::factory($expression); + } catch (InvalidArgumentException $e) { + return false; + } + + return true; + } + + /** + * Parse a CRON expression + * + * @param string $expression CRON expression (e.g. '8 * * * *') + * @param FieldFactory|null $fieldFactory Factory to create cron fields + */ + public function __construct($expression, FieldFactory $fieldFactory = null) + { + $this->fieldFactory = $fieldFactory; + $this->setExpression($expression); + } + + /** + * Set or change the CRON expression + * + * @param string $value CRON expression (e.g. 8 * * * *) + * + * @return CronExpression + * @throws \InvalidArgumentException if not a valid CRON expression + */ + public function setExpression($value) + { + $this->cronParts = preg_split('/\s/', $value, -1, PREG_SPLIT_NO_EMPTY); + if (count($this->cronParts) < 5) { + throw new InvalidArgumentException( + $value . ' is not a valid CRON expression' + ); + } + + foreach ($this->cronParts as $position => $part) { + $this->setPart($position, $part); + } + + return $this; + } + + /** + * Set part of the CRON expression + * + * @param int $position The position of the CRON expression to set + * @param string $value The value to set + * + * @return CronExpression + * @throws \InvalidArgumentException if the value is not valid for the part + */ + public function setPart($position, $value) + { + if (!$this->fieldFactory->getField($position)->validate($value)) { + throw new InvalidArgumentException( + 'Invalid CRON field value ' . $value . ' at position ' . $position + ); + } + + $this->cronParts[$position] = $value; + + return $this; + } + + /** + * Set max iteration count for searching next run dates + * + * @param int $maxIterationCount Max iteration count when searching for next run date + * + * @return CronExpression + */ + public function setMaxIterationCount($maxIterationCount) + { + $this->maxIterationCount = $maxIterationCount; + + return $this; + } + + /** + * Get a next run date relative to the current date or a specific date + * + * @param string|\DateTimeInterface $currentTime Relative calculation date + * @param int $nth Number of matches to skip before returning a + * matching next run date. 0, the default, will return the + * current date and time if the next run date falls on the + * current date and time. Setting this value to 1 will + * skip the first match and go to the second match. + * Setting this value to 2 will skip the first 2 + * matches and so on. + * @param bool $allowCurrentDate Set to TRUE to return the current date if + * it matches the cron expression. + * @param null|string $timeZone TimeZone to use instead of the system default + * + * @return \DateTime + * @throws \RuntimeException on too many iterations + */ + public function getNextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false, $timeZone = null) + { + return $this->getRunDate($currentTime, $nth, false, $allowCurrentDate, $timeZone); + } + + /** + * Get a previous run date relative to the current date or a specific date + * + * @param string|\DateTimeInterface $currentTime Relative calculation date + * @param int $nth Number of matches to skip before returning + * @param bool $allowCurrentDate Set to TRUE to return the + * current date if it matches the cron expression + * @param null|string $timeZone TimeZone to use instead of the system default + * + * @return \DateTime + * @throws \RuntimeException on too many iterations + * @see \Cron\CronExpression::getNextRunDate + */ + public function getPreviousRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false, $timeZone = null) + { + return $this->getRunDate($currentTime, $nth, true, $allowCurrentDate, $timeZone); + } + + /** + * Get multiple run dates starting at the current date or a specific date + * + * @param int $total Set the total number of dates to calculate + * @param string|\DateTimeInterface $currentTime Relative calculation date + * @param bool $invert Set to TRUE to retrieve previous dates + * @param bool $allowCurrentDate Set to TRUE to return the + * current date if it matches the cron expression + * @param null|string $timeZone TimeZone to use instead of the system default + * + * @return \DateTime[] Returns an array of run dates + */ + public function getMultipleRunDates($total, $currentTime = 'now', $invert = false, $allowCurrentDate = false, $timeZone = null) + { + $matches = array(); + for ($i = 0; $i < max(0, $total); $i++) { + try { + $matches[] = $this->getRunDate($currentTime, $i, $invert, $allowCurrentDate, $timeZone); + } catch (RuntimeException $e) { + break; + } + } + + return $matches; + } + + /** + * Get all or part of the CRON expression + * + * @param string $part Specify the part to retrieve or NULL to get the full + * cron schedule string. + * + * @return string|null Returns the CRON expression, a part of the + * CRON expression, or NULL if the part was specified but not found + */ + public function getExpression($part = null) + { + if (null === $part) { + return implode(' ', $this->cronParts); + } elseif (array_key_exists($part, $this->cronParts)) { + return $this->cronParts[$part]; + } + + return null; + } + + /** + * Helper method to output the full expression. + * + * @return string Full CRON expression + */ + public function __toString() + { + return $this->getExpression(); + } + + /** + * Determine if the cron is due to run based on the current date or a + * specific date. This method assumes that the current number of + * seconds are irrelevant, and should be called once per minute. + * + * @param string|\DateTimeInterface $currentTime Relative calculation date + * @param null|string $timeZone TimeZone to use instead of the system default + * + * @return bool Returns TRUE if the cron is due to run or FALSE if not + */ + public function isDue($currentTime = 'now', $timeZone = null) + { + $timeZone = $this->determineTimeZone($currentTime, $timeZone); + + if ('now' === $currentTime) { + $currentTime = new DateTime(); + } elseif ($currentTime instanceof DateTime) { + // + } elseif ($currentTime instanceof DateTimeImmutable) { + $currentTime = DateTime::createFromFormat('U', $currentTime->format('U')); + } else { + $currentTime = new DateTime($currentTime); + } + $currentTime->setTimeZone(new DateTimeZone($timeZone)); + + // drop the seconds to 0 + $currentTime = DateTime::createFromFormat('Y-m-d H:i', $currentTime->format('Y-m-d H:i')); + + try { + return $this->getNextRunDate($currentTime, 0, true)->getTimestamp() === $currentTime->getTimestamp(); + } catch (Exception $e) { + return false; + } + } + + /** + * Get the next or previous run date of the expression relative to a date + * + * @param string|\DateTimeInterface $currentTime Relative calculation date + * @param int $nth Number of matches to skip before returning + * @param bool $invert Set to TRUE to go backwards in time + * @param bool $allowCurrentDate Set to TRUE to return the + * current date if it matches the cron expression + * @param string|null $timeZone TimeZone to use instead of the system default + * + * @return \DateTime + * @throws \RuntimeException on too many iterations + */ + protected function getRunDate($currentTime = null, $nth = 0, $invert = false, $allowCurrentDate = false, $timeZone = null) + { + $timeZone = $this->determineTimeZone($currentTime, $timeZone); + + if ($currentTime instanceof DateTime) { + $currentDate = clone $currentTime; + } elseif ($currentTime instanceof DateTimeImmutable) { + $currentDate = DateTime::createFromFormat('U', $currentTime->format('U')); + } else { + $currentDate = new DateTime($currentTime ?: 'now'); + } + + $currentDate->setTimeZone(new DateTimeZone($timeZone)); + $currentDate->setTime($currentDate->format('H'), $currentDate->format('i'), 0); + $nextRun = clone $currentDate; + $nth = (int) $nth; + + // We don't have to satisfy * or null fields + $parts = array(); + $fields = array(); + foreach (self::$order as $position) { + $part = $this->getExpression($position); + if (null === $part || '*' === $part) { + continue; + } + $parts[$position] = $part; + $fields[$position] = $this->fieldFactory->getField($position); + } + + // Set a hard limit to bail on an impossible date + for ($i = 0; $i < $this->maxIterationCount; $i++) { + + foreach ($parts as $position => $part) { + $satisfied = false; + // Get the field object used to validate this part + $field = $fields[$position]; + // Check if this is singular or a list + if (strpos($part, ',') === false) { + $satisfied = $field->isSatisfiedBy($nextRun, $part); + } else { + foreach (array_map('trim', explode(',', $part)) as $listPart) { + if ($field->isSatisfiedBy($nextRun, $listPart)) { + $satisfied = true; + break; + } + } + } + + // If the field is not satisfied, then start over + if (!$satisfied) { + $field->increment($nextRun, $invert, $part); + continue 2; + } + } + + // Skip this match if needed + if ((!$allowCurrentDate && $nextRun == $currentDate) || --$nth > -1) { + $this->fieldFactory->getField(0)->increment($nextRun, $invert, isset($parts[0]) ? $parts[0] : null); + continue; + } + + return $nextRun; + } + + // @codeCoverageIgnoreStart + throw new RuntimeException('Impossible CRON expression'); + // @codeCoverageIgnoreEnd + } + + /** + * Workout what timeZone should be used. + * + * @param string|\DateTimeInterface $currentTime Relative calculation date + * @param string|null $timeZone TimeZone to use instead of the system default + * + * @return string + */ + protected function determineTimeZone($currentTime, $timeZone) + { + if (! is_null($timeZone)) { + return $timeZone; + } + + if ($currentTime instanceOf DateTimeInterface) { + return $currentTime->getTimeZone()->getName(); + } + + return date_default_timezone_get(); + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/DayOfMonthField.php b/vendor/dragonmantank/cron-expression/src/Cron/DayOfMonthField.php new file mode 100644 index 00000000..d4552e06 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/DayOfMonthField.php @@ -0,0 +1,145 @@ + + */ +class DayOfMonthField extends AbstractField +{ + /** + * @inheritDoc + */ + protected $rangeStart = 1; + + /** + * @inheritDoc + */ + protected $rangeEnd = 31; + + /** + * Get the nearest day of the week for a given day in a month + * + * @param int $currentYear Current year + * @param int $currentMonth Current month + * @param int $targetDay Target day of the month + * + * @return \DateTime Returns the nearest date + */ + private static function getNearestWeekday($currentYear, $currentMonth, $targetDay) + { + $tday = str_pad($targetDay, 2, '0', STR_PAD_LEFT); + $target = DateTime::createFromFormat('Y-m-d', "$currentYear-$currentMonth-$tday"); + $currentWeekday = (int) $target->format('N'); + + if ($currentWeekday < 6) { + return $target; + } + + $lastDayOfMonth = $target->format('t'); + + foreach (array(-1, 1, -2, 2) as $i) { + $adjusted = $targetDay + $i; + if ($adjusted > 0 && $adjusted <= $lastDayOfMonth) { + $target->setDate($currentYear, $currentMonth, $adjusted); + if ($target->format('N') < 6 && $target->format('m') == $currentMonth) { + return $target; + } + } + } + } + + /** + * @inheritDoc + */ + public function isSatisfiedBy(DateTimeInterface $date, $value) + { + // ? states that the field value is to be skipped + if ($value == '?') { + return true; + } + + $fieldValue = $date->format('d'); + + // Check to see if this is the last day of the month + if ($value == 'L') { + return $fieldValue == $date->format('t'); + } + + // Check to see if this is the nearest weekday to a particular value + if (strpos($value, 'W')) { + // Parse the target day + $targetDay = substr($value, 0, strpos($value, 'W')); + // Find out if the current day is the nearest day of the week + return $date->format('j') == self::getNearestWeekday( + $date->format('Y'), + $date->format('m'), + $targetDay + )->format('j'); + } + + return $this->isSatisfied($date->format('d'), $value); + } + + /** + * @inheritDoc + * + * @param \DateTime|\DateTimeImmutable &$date + */ + public function increment(DateTimeInterface &$date, $invert = false) + { + if ($invert) { + $date = $date->modify('previous day')->setTime(23, 59); + } else { + $date = $date->modify('next day')->setTime(0, 0); + } + + return $this; + } + + /** + * @inheritDoc + */ + public function validate($value) + { + $basicChecks = parent::validate($value); + + // Validate that a list don't have W or L + if (strpos($value, ',') !== false && (strpos($value, 'W') !== false || strpos($value, 'L') !== false)) { + return false; + } + + if (!$basicChecks) { + + if ($value === 'L') { + return true; + } + + if (preg_match('/^(.*)W$/', $value, $matches)) { + return $this->validate($matches[1]); + } + + return false; + } + + return $basicChecks; + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/DayOfWeekField.php b/vendor/dragonmantank/cron-expression/src/Cron/DayOfWeekField.php new file mode 100644 index 00000000..d4ba3156 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/DayOfWeekField.php @@ -0,0 +1,196 @@ + 'MON', 2 => 'TUE', 3 => 'WED', 4 => 'THU', 5 => 'FRI', 6 => 'SAT', 7 => 'SUN']; + + /** + * Constructor + */ + public function __construct() + { + $this->nthRange = range(1, 5); + parent::__construct(); + } + + /** + * @inheritDoc + * + * @param \DateTime|\DateTimeImmutable $date + */ + public function isSatisfiedBy(DateTimeInterface $date, $value) + { + if ($value == '?') { + return true; + } + + // Convert text day of the week values to integers + $value = $this->convertLiterals($value); + + $currentYear = $date->format('Y'); + $currentMonth = $date->format('m'); + $lastDayOfMonth = $date->format('t'); + + // Find out if this is the last specific weekday of the month + if (strpos($value, 'L')) { + $weekday = (int) $this->convertLiterals(substr($value, 0, strpos($value, 'L'))); + $weekday %= 7; + + $tdate = clone $date; + $tdate = $tdate->setDate($currentYear, $currentMonth, $lastDayOfMonth); + while ($tdate->format('w') != $weekday) { + $tdateClone = new DateTime(); + $tdate = $tdateClone + ->setTimezone($tdate->getTimezone()) + ->setDate($currentYear, $currentMonth, --$lastDayOfMonth); + } + + return $date->format('j') == $lastDayOfMonth; + } + + // Handle # hash tokens + if (strpos($value, '#')) { + list($weekday, $nth) = explode('#', $value); + + if (!is_numeric($nth)) { + throw new InvalidArgumentException("Hashed weekdays must be numeric, {$nth} given"); + } else { + $nth = (int) $nth; + } + + // 0 and 7 are both Sunday, however 7 matches date('N') format ISO-8601 + if ($weekday === '0') { + $weekday = 7; + } + + $weekday = $this->convertLiterals($weekday); + + // Validate the hash fields + if ($weekday < 0 || $weekday > 7) { + throw new InvalidArgumentException("Weekday must be a value between 0 and 7. {$weekday} given"); + } + + if (!in_array($nth, $this->nthRange)) { + throw new InvalidArgumentException("There are never more than 5 or less than 1 of a given weekday in a month, {$nth} given"); + } + + // The current weekday must match the targeted weekday to proceed + if ($date->format('N') != $weekday) { + return false; + } + + $tdate = clone $date; + $tdate = $tdate->setDate($currentYear, $currentMonth, 1); + $dayCount = 0; + $currentDay = 1; + while ($currentDay < $lastDayOfMonth + 1) { + if ($tdate->format('N') == $weekday) { + if (++$dayCount >= $nth) { + break; + } + } + $tdate = $tdate->setDate($currentYear, $currentMonth, ++$currentDay); + } + + return $date->format('j') == $currentDay; + } + + // Handle day of the week values + if (strpos($value, '-')) { + $parts = explode('-', $value); + if ($parts[0] == '7') { + $parts[0] = '0'; + } elseif ($parts[1] == '0') { + $parts[1] = '7'; + } + $value = implode('-', $parts); + } + + // Test to see which Sunday to use -- 0 == 7 == Sunday + $format = in_array(7, str_split($value)) ? 'N' : 'w'; + $fieldValue = $date->format($format); + + return $this->isSatisfied($fieldValue, $value); + } + + /** + * @inheritDoc + * + * @param \DateTime|\DateTimeImmutable &$date + */ + public function increment(DateTimeInterface &$date, $invert = false) + { + if ($invert) { + $date = $date->modify('-1 day')->setTime(23, 59, 0); + } else { + $date = $date->modify('+1 day')->setTime(0, 0, 0); + } + + return $this; + } + + /** + * @inheritDoc + */ + public function validate($value) + { + $basicChecks = parent::validate($value); + + if (!$basicChecks) { + // Handle the # value + if (strpos($value, '#') !== false) { + $chunks = explode('#', $value); + $chunks[0] = $this->convertLiterals($chunks[0]); + + if (parent::validate($chunks[0]) && is_numeric($chunks[1]) && in_array($chunks[1], $this->nthRange)) { + return true; + } + } + + if (preg_match('/^(.*)L$/', $value, $matches)) { + return $this->validate($matches[1]); + } + + return false; + } + + return $basicChecks; + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/FieldFactory.php b/vendor/dragonmantank/cron-expression/src/Cron/FieldFactory.php new file mode 100644 index 00000000..545e4b83 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/FieldFactory.php @@ -0,0 +1,54 @@ +fields[$position])) { + switch ($position) { + case 0: + $this->fields[$position] = new MinutesField(); + break; + case 1: + $this->fields[$position] = new HoursField(); + break; + case 2: + $this->fields[$position] = new DayOfMonthField(); + break; + case 3: + $this->fields[$position] = new MonthField(); + break; + case 4: + $this->fields[$position] = new DayOfWeekField(); + break; + default: + throw new InvalidArgumentException( + ($position + 1) . ' is not a valid position' + ); + } + } + + return $this->fields[$position]; + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/FieldInterface.php b/vendor/dragonmantank/cron-expression/src/Cron/FieldInterface.php new file mode 100644 index 00000000..f8366eae --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/FieldInterface.php @@ -0,0 +1,41 @@ +isSatisfied($date->format('H'), $value); + } + + /** + * {@inheritDoc} + * + * @param \DateTime|\DateTimeImmutable &$date + * @param string|null $parts + */ + public function increment(DateTimeInterface &$date, $invert = false, $parts = null) + { + // Change timezone to UTC temporarily. This will + // allow us to go back or forwards and hour even + // if DST will be changed between the hours. + if (is_null($parts) || $parts == '*') { + $timezone = $date->getTimezone(); + $date = $date->setTimezone(new DateTimeZone('UTC')); + $date = $date->modify(($invert ? '-' : '+') . '1 hour'); + $date = $date->setTimezone($timezone); + + $date = $date->setTime($date->format('H'), $invert ? 59 : 0); + return $this; + } + + $parts = strpos($parts, ',') !== false ? explode(',', $parts) : array($parts); + $hours = array(); + foreach ($parts as $part) { + $hours = array_merge($hours, $this->getRangeForExpression($part, 23)); + } + + $current_hour = $date->format('H'); + $position = $invert ? count($hours) - 1 : 0; + if (count($hours) > 1) { + for ($i = 0; $i < count($hours) - 1; $i++) { + if ((!$invert && $current_hour >= $hours[$i] && $current_hour < $hours[$i + 1]) || + ($invert && $current_hour > $hours[$i] && $current_hour <= $hours[$i + 1])) { + $position = $invert ? $i : $i + 1; + break; + } + } + } + + $hour = $hours[$position]; + if ((!$invert && $date->format('H') >= $hour) || ($invert && $date->format('H') <= $hour)) { + $date = $date->modify(($invert ? '-' : '+') . '1 day'); + $date = $date->setTime($invert ? 23 : 0, $invert ? 59 : 0); + } + else { + $date = $date->setTime($hour, $invert ? 59 : 0); + } + + return $this; + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/MinutesField.php b/vendor/dragonmantank/cron-expression/src/Cron/MinutesField.php new file mode 100644 index 00000000..fecc9b6d --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/MinutesField.php @@ -0,0 +1,75 @@ +isSatisfied($date->format('i'), $value); + } + + /** + * {@inheritDoc} + * + * @param \DateTime|\DateTimeImmutable &$date + * @param string|null $parts + */ + public function increment(DateTimeInterface &$date, $invert = false, $parts = null) + { + if (is_null($parts)) { + $date = $date->modify(($invert ? '-' : '+') . '1 minute'); + return $this; + } + + $parts = strpos($parts, ',') !== false ? explode(',', $parts) : array($parts); + $minutes = array(); + foreach ($parts as $part) { + $minutes = array_merge($minutes, $this->getRangeForExpression($part, 59)); + } + + $current_minute = $date->format('i'); + $position = $invert ? count($minutes) - 1 : 0; + if (count($minutes) > 1) { + for ($i = 0; $i < count($minutes) - 1; $i++) { + if ((!$invert && $current_minute >= $minutes[$i] && $current_minute < $minutes[$i + 1]) || + ($invert && $current_minute > $minutes[$i] && $current_minute <= $minutes[$i + 1])) { + $position = $invert ? $i : $i + 1; + break; + } + } + } + + if ((!$invert && $current_minute >= $minutes[$position]) || ($invert && $current_minute <= $minutes[$position])) { + $date = $date->modify(($invert ? '-' : '+') . '1 hour'); + $date = $date->setTime($date->format('H'), $invert ? 59 : 0); + } + else { + $date = $date->setTime($date->format('H'), $minutes[$position]); + } + + return $this; + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/MonthField.php b/vendor/dragonmantank/cron-expression/src/Cron/MonthField.php new file mode 100644 index 00000000..afc9caff --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/MonthField.php @@ -0,0 +1,59 @@ + 'JAN', 2 => 'FEB', 3 => 'MAR', 4 => 'APR', 5 => 'MAY', 6 => 'JUN', 7 => 'JUL', + 8 => 'AUG', 9 => 'SEP', 10 => 'OCT', 11 => 'NOV', 12 => 'DEC']; + + /** + * @inheritDoc + */ + public function isSatisfiedBy(DateTimeInterface $date, $value) + { + if ($value == '?') { + return true; + } + + $value = $this->convertLiterals($value); + + return $this->isSatisfied($date->format('m'), $value); + } + + /** + * @inheritDoc + * + * @param \DateTime|\DateTimeImmutable &$date + */ + public function increment(DateTimeInterface &$date, $invert = false) + { + if ($invert) { + $date = $date->modify('last day of previous month')->setTime(23, 59); + } else { + $date = $date->modify('first day of next month')->setTime(0, 0); + } + + return $this; + } + + +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/AbstractFieldTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/AbstractFieldTest.php new file mode 100644 index 00000000..38114392 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/AbstractFieldTest.php @@ -0,0 +1,139 @@ + + */ +class AbstractFieldTest extends TestCase +{ + /** + * @covers \Cron\AbstractField::isRange + */ + public function testTestsIfRange() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isRange('1-2')); + $this->assertFalse($f->isRange('2')); + } + + /** + * @covers \Cron\AbstractField::isIncrementsOfRanges + */ + public function testTestsIfIncrementsOfRanges() + { + $f = new DayOfWeekField(); + $this->assertFalse($f->isIncrementsOfRanges('1-2')); + $this->assertTrue($f->isIncrementsOfRanges('1/2')); + $this->assertTrue($f->isIncrementsOfRanges('*/2')); + $this->assertTrue($f->isIncrementsOfRanges('3-12/2')); + } + + /** + * @covers \Cron\AbstractField::isInRange + */ + public function testTestsIfInRange() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isInRange('1', '1-2')); + $this->assertTrue($f->isInRange('2', '1-2')); + $this->assertTrue($f->isInRange('5', '4-12')); + $this->assertFalse($f->isInRange('3', '4-12')); + $this->assertFalse($f->isInRange('13', '4-12')); + } + + /** + * @covers \Cron\AbstractField::isInIncrementsOfRanges + */ + public function testTestsIfInIncrementsOfRangesOnZeroStartRange() + { + $f = new MinutesField(); + $this->assertTrue($f->isInIncrementsOfRanges('3', '3-59/2')); + $this->assertTrue($f->isInIncrementsOfRanges('13', '3-59/2')); + $this->assertTrue($f->isInIncrementsOfRanges('15', '3-59/2')); + $this->assertTrue($f->isInIncrementsOfRanges('14', '*/2')); + $this->assertFalse($f->isInIncrementsOfRanges('2', '3-59/13')); + $this->assertFalse($f->isInIncrementsOfRanges('14', '*/13')); + $this->assertFalse($f->isInIncrementsOfRanges('14', '3-59/2')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '2-59')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '2')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '*')); + $this->assertFalse($f->isInIncrementsOfRanges('0', '*/0')); + $this->assertFalse($f->isInIncrementsOfRanges('1', '*/0')); + + $this->assertTrue($f->isInIncrementsOfRanges('4', '4/1')); + $this->assertFalse($f->isInIncrementsOfRanges('14', '4/1')); + $this->assertFalse($f->isInIncrementsOfRanges('34', '4/1')); + } + + /** + * @covers \Cron\AbstractField::isInIncrementsOfRanges + */ + public function testTestsIfInIncrementsOfRangesOnOneStartRange() + { + $f = new MonthField(); + $this->assertTrue($f->isInIncrementsOfRanges('3', '3-12/2')); + $this->assertFalse($f->isInIncrementsOfRanges('13', '3-12/2')); + $this->assertFalse($f->isInIncrementsOfRanges('15', '3-12/2')); + $this->assertTrue($f->isInIncrementsOfRanges('3', '*/2')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '*/3')); + $this->assertTrue($f->isInIncrementsOfRanges('7', '*/3')); + $this->assertFalse($f->isInIncrementsOfRanges('14', '3-12/2')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '2-12')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '2')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '*')); + $this->assertFalse($f->isInIncrementsOfRanges('0', '*/0')); + $this->assertFalse($f->isInIncrementsOfRanges('1', '*/0')); + + $this->assertTrue($f->isInIncrementsOfRanges('4', '4/1')); + $this->assertFalse($f->isInIncrementsOfRanges('14', '4/1')); + $this->assertFalse($f->isInIncrementsOfRanges('34', '4/1')); + } + + /** + * @covers \Cron\AbstractField::isSatisfied + */ + public function testTestsIfSatisfied() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isSatisfied('12', '3-13')); + $this->assertFalse($f->isSatisfied('15', '3-7/2')); + $this->assertTrue($f->isSatisfied('12', '*')); + $this->assertTrue($f->isSatisfied('12', '12')); + $this->assertFalse($f->isSatisfied('12', '3-11')); + $this->assertFalse($f->isSatisfied('12', '3-7/2')); + $this->assertFalse($f->isSatisfied('12', '11')); + } + + /** + * Allows ranges and lists to coexist in the same expression + * + * @see https://github.com/dragonmantank/cron-expression/issues/5 + */ + public function testAllowRangesAndLists() + { + $expression = '5-7,11-13'; + $f = new HoursField(); + $this->assertTrue($f->validate($expression)); + } + + /** + * Makes sure that various types of ranges expand out properly + * + * @see https://github.com/dragonmantank/cron-expression/issues/5 + */ + public function testGetRangeForExpressionExpandsCorrectly() + { + $f = new HoursField(); + $this->assertSame([5, 6, 7, 11, 12, 13], $f->getRangeForExpression('5-7,11-13', 23)); + $this->assertSame(['5', '6', '7', '11', '12', '13'], $f->getRangeForExpression('5,6,7,11,12,13', 23)); + $this->assertSame([0, 6, 12, 18], $f->getRangeForExpression('*/6', 23)); + $this->assertSame([5, 11], $f->getRangeForExpression('5-13/6', 23)); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/CronExpressionTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/CronExpressionTest.php new file mode 100644 index 00000000..8810d43d --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/CronExpressionTest.php @@ -0,0 +1,589 @@ + + */ +class CronExpressionTest extends TestCase +{ + /** + * @covers \Cron\CronExpression::factory + */ + public function testFactoryRecognizesTemplates() + { + $this->assertSame('0 0 1 1 *', CronExpression::factory('@annually')->getExpression()); + $this->assertSame('0 0 1 1 *', CronExpression::factory('@yearly')->getExpression()); + $this->assertSame('0 0 * * 0', CronExpression::factory('@weekly')->getExpression()); + } + + /** + * @covers \Cron\CronExpression::__construct + * @covers \Cron\CronExpression::getExpression + * @covers \Cron\CronExpression::__toString + */ + public function testParsesCronSchedule() + { + // '2010-09-10 12:00:00' + $cron = CronExpression::factory('1 2-4 * 4,5,6 */3'); + $this->assertSame('1', $cron->getExpression(CronExpression::MINUTE)); + $this->assertSame('2-4', $cron->getExpression(CronExpression::HOUR)); + $this->assertSame('*', $cron->getExpression(CronExpression::DAY)); + $this->assertSame('4,5,6', $cron->getExpression(CronExpression::MONTH)); + $this->assertSame('*/3', $cron->getExpression(CronExpression::WEEKDAY)); + $this->assertSame('1 2-4 * 4,5,6 */3', $cron->getExpression()); + $this->assertSame('1 2-4 * 4,5,6 */3', (string) $cron); + $this->assertNull($cron->getExpression('foo')); + } + + /** + * @covers \Cron\CronExpression::__construct + * @covers \Cron\CronExpression::getExpression + * @covers \Cron\CronExpression::__toString + */ + public function testParsesCronScheduleThrowsAnException() + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid CRON field value A at position 0'); + + CronExpression::factory('A 1 2 3 4'); + } + + /** + * @covers \Cron\CronExpression::__construct + * @covers \Cron\CronExpression::getExpression + * @dataProvider scheduleWithDifferentSeparatorsProvider + */ + public function testParsesCronScheduleWithAnySpaceCharsAsSeparators($schedule, array $expected) + { + $cron = CronExpression::factory($schedule); + $this->assertSame($expected[0], $cron->getExpression(CronExpression::MINUTE)); + $this->assertSame($expected[1], $cron->getExpression(CronExpression::HOUR)); + $this->assertSame($expected[2], $cron->getExpression(CronExpression::DAY)); + $this->assertSame($expected[3], $cron->getExpression(CronExpression::MONTH)); + $this->assertSame($expected[4], $cron->getExpression(CronExpression::WEEKDAY)); + } + + /** + * Data provider for testParsesCronScheduleWithAnySpaceCharsAsSeparators + * + * @return array + */ + public static function scheduleWithDifferentSeparatorsProvider() + { + return array( + array("*\t*\t*\t*\t*\t", array('*', '*', '*', '*', '*', '*')), + array("* * * * * ", array('*', '*', '*', '*', '*', '*')), + array("* \t * \t * \t * \t * \t", array('*', '*', '*', '*', '*', '*')), + array("*\t \t*\t \t*\t \t*\t \t*\t \t", array('*', '*', '*', '*', '*', '*')), + ); + } + + /** + * @covers \Cron\CronExpression::__construct + * @covers \Cron\CronExpression::setExpression + * @covers \Cron\CronExpression::setPart + */ + public function testInvalidCronsWillFail() + { + $this->expectException(\InvalidArgumentException::class); + + // Only four values + $cron = CronExpression::factory('* * * 1'); + } + + /** + * @covers \Cron\CronExpression::setPart + */ + public function testInvalidPartsWillFail() + { + $this->expectException(\InvalidArgumentException::class); + + // Only four values + $cron = CronExpression::factory('* * * * *'); + $cron->setPart(1, 'abc'); + } + + /** + * Data provider for cron schedule + * + * @return array + */ + public function scheduleProvider() + { + return array( + array('*/2 */2 * * *', '2015-08-10 21:47:27', '2015-08-10 22:00:00', false), + array('* * * * *', '2015-08-10 21:50:37', '2015-08-10 21:50:00', true), + array('* 20,21,22 * * *', '2015-08-10 21:50:00', '2015-08-10 21:50:00', true), + // Handles CSV values + array('* 20,22 * * *', '2015-08-10 21:50:00', '2015-08-10 22:00:00', false), + // CSV values can be complex + array('7-9 * */9 * *', '2015-08-10 22:02:33', '2015-08-10 22:07:00', false), + // 15th minute, of the second hour, every 15 days, in January, every Friday + array('1 * * * 7', '2015-08-10 21:47:27', '2015-08-16 00:01:00', false), + // Test with exact times + array('47 21 * * *', strtotime('2015-08-10 21:47:30'), '2015-08-10 21:47:00', true), + // Test Day of the week (issue #1) + // According cron implementation, 0|7 = sunday, 1 => monday, etc + array('* * * * 0', strtotime('2011-06-15 23:09:00'), '2011-06-19 00:00:00', false), + array('* * * * 7', strtotime('2011-06-15 23:09:00'), '2011-06-19 00:00:00', false), + array('* * * * 1', strtotime('2011-06-15 23:09:00'), '2011-06-20 00:00:00', false), + // Should return the sunday date as 7 equals 0 + array('0 0 * * MON,SUN', strtotime('2011-06-15 23:09:00'), '2011-06-19 00:00:00', false), + array('0 0 * * 1,7', strtotime('2011-06-15 23:09:00'), '2011-06-19 00:00:00', false), + array('0 0 * * 0-4', strtotime('2011-06-15 23:09:00'), '2011-06-16 00:00:00', false), + array('0 0 * * 7-4', strtotime('2011-06-15 23:09:00'), '2011-06-16 00:00:00', false), + array('0 0 * * 4-7', strtotime('2011-06-15 23:09:00'), '2011-06-16 00:00:00', false), + array('0 0 * * 7-3', strtotime('2011-06-15 23:09:00'), '2011-06-19 00:00:00', false), + array('0 0 * * 3-7', strtotime('2011-06-15 23:09:00'), '2011-06-16 00:00:00', false), + array('0 0 * * 3-7', strtotime('2011-06-18 23:09:00'), '2011-06-19 00:00:00', false), + // Test lists of values and ranges (Abhoryo) + array('0 0 * * 2-7', strtotime('2011-06-20 23:09:00'), '2011-06-21 00:00:00', false), + array('0 0 * * 2-7', strtotime('2011-06-18 23:09:00'), '2011-06-19 00:00:00', false), + array('0 0 * * 4-7', strtotime('2011-07-19 00:00:00'), '2011-07-21 00:00:00', false), + // Test increments of ranges + array('0-12/4 * * * *', strtotime('2011-06-20 12:04:00'), '2011-06-20 12:04:00', true), + array('4-59/2 * * * *', strtotime('2011-06-20 12:04:00'), '2011-06-20 12:04:00', true), + array('4-59/2 * * * *', strtotime('2011-06-20 12:06:00'), '2011-06-20 12:06:00', true), + array('4-59/3 * * * *', strtotime('2011-06-20 12:06:00'), '2011-06-20 12:07:00', false), + // Test Day of the Week and the Day of the Month (issue #1) + array('0 0 1 1 0', strtotime('2011-06-15 23:09:00'), '2012-01-01 00:00:00', false), + array('0 0 1 JAN 0', strtotime('2011-06-15 23:09:00'), '2012-01-01 00:00:00', false), + array('0 0 1 * 0', strtotime('2011-06-15 23:09:00'), '2012-01-01 00:00:00', false), + // Test the W day of the week modifier for day of the month field + array('0 0 2W * *', strtotime('2011-07-01 00:00:00'), '2011-07-01 00:00:00', true), + array('0 0 1W * *', strtotime('2011-05-01 00:00:00'), '2011-05-02 00:00:00', false), + array('0 0 1W * *', strtotime('2011-07-01 00:00:00'), '2011-07-01 00:00:00', true), + array('0 0 3W * *', strtotime('2011-07-01 00:00:00'), '2011-07-04 00:00:00', false), + array('0 0 16W * *', strtotime('2011-07-01 00:00:00'), '2011-07-15 00:00:00', false), + array('0 0 28W * *', strtotime('2011-07-01 00:00:00'), '2011-07-28 00:00:00', false), + array('0 0 30W * *', strtotime('2011-07-01 00:00:00'), '2011-07-29 00:00:00', false), + array('0 0 31W * *', strtotime('2011-07-01 00:00:00'), '2011-07-29 00:00:00', false), + // Test the last weekday of a month + array('* * * * 5L', strtotime('2011-07-01 00:00:00'), '2011-07-29 00:00:00', false), + array('* * * * 6L', strtotime('2011-07-01 00:00:00'), '2011-07-30 00:00:00', false), + array('* * * * 7L', strtotime('2011-07-01 00:00:00'), '2011-07-31 00:00:00', false), + array('* * * * 1L', strtotime('2011-07-24 00:00:00'), '2011-07-25 00:00:00', false), + array('* * * 1 5L', strtotime('2011-12-25 00:00:00'), '2012-01-27 00:00:00', false), + // Test the hash symbol for the nth weekday of a given month + array('* * * * 5#2', strtotime('2011-07-01 00:00:00'), '2011-07-08 00:00:00', false), + array('* * * * 5#1', strtotime('2011-07-01 00:00:00'), '2011-07-01 00:00:00', true), + array('* * * * 3#4', strtotime('2011-07-01 00:00:00'), '2011-07-27 00:00:00', false), + + // Issue #7, documented example failed + ['3-59/15 6-12 */15 1 2-5', strtotime('2017-01-08 00:00:00'), '2017-01-31 06:03:00', false], + + // https://github.com/laravel/framework/commit/07d160ac3cc9764d5b429734ffce4fa311385403 + ['* * * * MON-FRI', strtotime('2017-01-08 00:00:00'), strtotime('2017-01-09 00:00:00'), false], + ['* * * * TUE', strtotime('2017-01-08 00:00:00'), strtotime('2017-01-10 00:00:00'), false], + ); + } + + /** + * @covers \Cron\CronExpression::isDue + * @covers \Cron\CronExpression::getNextRunDate + * @covers \Cron\DayOfMonthField + * @covers \Cron\DayOfWeekField + * @covers \Cron\MinutesField + * @covers \Cron\HoursField + * @covers \Cron\MonthField + * @covers \Cron\CronExpression::getRunDate + * @dataProvider scheduleProvider + */ + public function testDeterminesIfCronIsDue($schedule, $relativeTime, $nextRun, $isDue) + { + $relativeTimeString = is_int($relativeTime) ? date('Y-m-d H:i:s', $relativeTime) : $relativeTime; + + // Test next run date + $cron = CronExpression::factory($schedule); + if (is_string($relativeTime)) { + $relativeTime = new DateTime($relativeTime); + } elseif (is_int($relativeTime)) { + $relativeTime = date('Y-m-d H:i:s', $relativeTime); + } + + if (is_string($nextRun)) { + $nextRunDate = new DateTime($nextRun); + } elseif (is_int($nextRun)) { + $nextRunDate = new DateTime(); + $nextRunDate->setTimestamp($nextRun); + } + $this->assertSame($isDue, $cron->isDue($relativeTime)); + $next = $cron->getNextRunDate($relativeTime, 0, true); + + $this->assertEquals($nextRunDate, $next); + } + + /** + * @covers \Cron\CronExpression::isDue + */ + public function testIsDueHandlesDifferentDates() + { + $cron = CronExpression::factory('* * * * *'); + $this->assertTrue($cron->isDue()); + $this->assertTrue($cron->isDue('now')); + $this->assertTrue($cron->isDue(new DateTime('now'))); + $this->assertTrue($cron->isDue(date('Y-m-d H:i'))); + $this->assertTrue($cron->isDue(new DateTimeImmutable('now'))); + } + + /** + * @covers \Cron\CronExpression::isDue + */ + public function testIsDueHandlesDifferentDefaultTimezones() + { + $originalTimezone = date_default_timezone_get(); + $cron = CronExpression::factory('0 15 * * 3'); //Wednesday at 15:00 + $date = '2014-01-01 15:00'; //Wednesday + + date_default_timezone_set('UTC'); + $this->assertTrue($cron->isDue(new DateTime($date), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date), 'Europe/Amsterdam')); + $this->assertFalse($cron->isDue(new DateTime($date), 'Asia/Tokyo')); + + date_default_timezone_set('Europe/Amsterdam'); + $this->assertFalse($cron->isDue(new DateTime($date), 'UTC')); + $this->assertTrue($cron->isDue(new DateTime($date), 'Europe/Amsterdam')); + $this->assertFalse($cron->isDue(new DateTime($date), 'Asia/Tokyo')); + + date_default_timezone_set('Asia/Tokyo'); + $this->assertFalse($cron->isDue(new DateTime($date), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date), 'Europe/Amsterdam')); + $this->assertTrue($cron->isDue(new DateTime($date), 'Asia/Tokyo')); + + date_default_timezone_set($originalTimezone); + } + + /** + * @covers \Cron\CronExpression::isDue + */ + public function testIsDueHandlesDifferentSuppliedTimezones() + { + $cron = CronExpression::factory('0 15 * * 3'); //Wednesday at 15:00 + $date = '2014-01-01 15:00'; //Wednesday + + $this->assertTrue($cron->isDue(new DateTime($date, new DateTimeZone('UTC')), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date, new DateTimeZone('UTC')), 'Europe/Amsterdam')); + $this->assertFalse($cron->isDue(new DateTime($date, new DateTimeZone('UTC')), 'Asia/Tokyo')); + + $this->assertFalse($cron->isDue(new DateTime($date, new DateTimeZone('Europe/Amsterdam')), 'UTC')); + $this->assertTrue($cron->isDue(new DateTime($date, new DateTimeZone('Europe/Amsterdam')), 'Europe/Amsterdam')); + $this->assertFalse($cron->isDue(new DateTime($date, new DateTimeZone('Europe/Amsterdam')), 'Asia/Tokyo')); + + $this->assertFalse($cron->isDue(new DateTime($date, new DateTimeZone('Asia/Tokyo')), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date, new DateTimeZone('Asia/Tokyo')), 'Europe/Amsterdam')); + $this->assertTrue($cron->isDue(new DateTime($date, new DateTimeZone('Asia/Tokyo')), 'Asia/Tokyo')); + } + + /** + * @covers Cron\CronExpression::isDue + */ + public function testIsDueHandlesDifferentTimezonesAsArgument() + { + $cron = CronExpression::factory('0 15 * * 3'); //Wednesday at 15:00 + $date = '2014-01-01 15:00'; //Wednesday + $utc = new \DateTimeZone('UTC'); + $amsterdam = new \DateTimeZone('Europe/Amsterdam'); + $tokyo = new \DateTimeZone('Asia/Tokyo'); + $this->assertTrue($cron->isDue(new DateTime($date, $utc), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date, $amsterdam), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date, $tokyo), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date, $utc), 'Europe/Amsterdam')); + $this->assertTrue($cron->isDue(new DateTime($date, $amsterdam), 'Europe/Amsterdam')); + $this->assertFalse($cron->isDue(new DateTime($date, $tokyo), 'Europe/Amsterdam')); + $this->assertFalse($cron->isDue(new DateTime($date, $utc), 'Asia/Tokyo')); + $this->assertFalse($cron->isDue(new DateTime($date, $amsterdam), 'Asia/Tokyo')); + $this->assertTrue($cron->isDue(new DateTime($date, $tokyo), 'Asia/Tokyo')); + } + + /** + * @covers Cron\CronExpression::isDue + */ + public function testRecognisesTimezonesAsPartOfDateTime() + { + $cron = CronExpression::factory("0 7 * * *"); + $tzCron = "America/New_York"; + $tzServer = new \DateTimeZone("Europe/London"); + + $dtCurrent = \DateTime::createFromFormat("!Y-m-d H:i:s", "2017-10-17 10:00:00", $tzServer); + $dtPrev = $cron->getPreviousRunDate($dtCurrent, 0, true, $tzCron); + $this->assertEquals('1508151600 : 2017-10-16T07:00:00-04:00 : America/New_York', $dtPrev->format("U \: c \: e")); + + $dtCurrent = \DateTimeImmutable::createFromFormat("!Y-m-d H:i:s", "2017-10-17 10:00:00", $tzServer); + $dtPrev = $cron->getPreviousRunDate($dtCurrent, 0, true, $tzCron); + $this->assertEquals('1508151600 : 2017-10-16T07:00:00-04:00 : America/New_York', $dtPrev->format("U \: c \: e")); + + $dtCurrent = \DateTimeImmutable::createFromFormat("!Y-m-d H:i:s", "2017-10-17 10:00:00", $tzServer); + $dtPrev = $cron->getPreviousRunDate($dtCurrent->format("c"), 0, true, $tzCron); + $this->assertEquals('1508151600 : 2017-10-16T07:00:00-04:00 : America/New_York', $dtPrev->format("U \: c \: e")); + + $dtCurrent = \DateTimeImmutable::createFromFormat("!Y-m-d H:i:s", "2017-10-17 10:00:00", $tzServer); + $dtPrev = $cron->getPreviousRunDate($dtCurrent->format("\@U"), 0, true, $tzCron); + $this->assertEquals('1508151600 : 2017-10-16T07:00:00-04:00 : America/New_York', $dtPrev->format("U \: c \: e")); + + } + + + /** + * @covers \Cron\CronExpression::getPreviousRunDate + */ + public function testCanGetPreviousRunDates() + { + $cron = CronExpression::factory('* * * * *'); + $next = $cron->getNextRunDate('now'); + $two = $cron->getNextRunDate('now', 1); + $this->assertEquals($next, $cron->getPreviousRunDate($two)); + + $cron = CronExpression::factory('* */2 * * *'); + $next = $cron->getNextRunDate('now'); + $two = $cron->getNextRunDate('now', 1); + $this->assertEquals($next, $cron->getPreviousRunDate($two)); + + $cron = CronExpression::factory('* * * */2 *'); + $next = $cron->getNextRunDate('now'); + $two = $cron->getNextRunDate('now', 1); + $this->assertEquals($next, $cron->getPreviousRunDate($two)); + } + + /** + * @covers \Cron\CronExpression::getMultipleRunDates + */ + public function testProvidesMultipleRunDates() + { + $cron = CronExpression::factory('*/2 * * * *'); + $this->assertEquals(array( + new DateTime('2008-11-09 00:00:00'), + new DateTime('2008-11-09 00:02:00'), + new DateTime('2008-11-09 00:04:00'), + new DateTime('2008-11-09 00:06:00') + ), $cron->getMultipleRunDates(4, '2008-11-09 00:00:00', false, true)); + } + + /** + * @covers \Cron\CronExpression::getMultipleRunDates + * @covers \Cron\CronExpression::setMaxIterationCount + */ + public function testProvidesMultipleRunDatesForTheFarFuture() { + // Fails with the default 1000 iteration limit + $cron = CronExpression::factory('0 0 12 1 *'); + $cron->setMaxIterationCount(2000); + $this->assertEquals(array( + new DateTime('2016-01-12 00:00:00'), + new DateTime('2017-01-12 00:00:00'), + new DateTime('2018-01-12 00:00:00'), + new DateTime('2019-01-12 00:00:00'), + new DateTime('2020-01-12 00:00:00'), + new DateTime('2021-01-12 00:00:00'), + new DateTime('2022-01-12 00:00:00'), + new DateTime('2023-01-12 00:00:00'), + new DateTime('2024-01-12 00:00:00'), + ), $cron->getMultipleRunDates(9, '2015-04-28 00:00:00', false, true)); + } + + /** + * @covers \Cron\CronExpression + */ + public function testCanIterateOverNextRuns() + { + $cron = CronExpression::factory('@weekly'); + $nextRun = $cron->getNextRunDate("2008-11-09 08:00:00"); + $this->assertEquals($nextRun, new DateTime("2008-11-16 00:00:00")); + + // true is cast to 1 + $nextRun = $cron->getNextRunDate("2008-11-09 00:00:00", true, true); + $this->assertEquals($nextRun, new DateTime("2008-11-16 00:00:00")); + + // You can iterate over them + $nextRun = $cron->getNextRunDate($cron->getNextRunDate("2008-11-09 00:00:00", 1, true), 1, true); + $this->assertEquals($nextRun, new DateTime("2008-11-23 00:00:00")); + + // You can skip more than one + $nextRun = $cron->getNextRunDate("2008-11-09 00:00:00", 2, true); + $this->assertEquals($nextRun, new DateTime("2008-11-23 00:00:00")); + $nextRun = $cron->getNextRunDate("2008-11-09 00:00:00", 3, true); + $this->assertEquals($nextRun, new DateTime("2008-11-30 00:00:00")); + } + + /** + * @covers \Cron\CronExpression::getRunDate + */ + public function testGetRunDateHandlesDifferentDates() + { + $cron = CronExpression::factory('@weekly'); + $date = new DateTime("2019-03-10 00:00:00"); + $this->assertEquals($date, $cron->getNextRunDate("2019-03-03 08:00:00")); + $this->assertEquals($date, $cron->getNextRunDate(new DateTime("2019-03-03 08:00:00"))); + $this->assertEquals($date, $cron->getNextRunDate(new DateTimeImmutable("2019-03-03 08:00:00"))); + } + + /** + * @covers \Cron\CronExpression::getRunDate + */ + public function testSkipsCurrentDateByDefault() + { + $cron = CronExpression::factory('* * * * *'); + $current = new DateTime('now'); + $next = $cron->getNextRunDate($current); + $nextPrev = $cron->getPreviousRunDate($next); + $this->assertSame($current->format('Y-m-d H:i:00'), $nextPrev->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\CronExpression::getRunDate + * @ticket 7 + */ + public function testStripsForSeconds() + { + $cron = CronExpression::factory('* * * * *'); + $current = new DateTime('2011-09-27 10:10:54'); + $this->assertSame('2011-09-27 10:11:00', $cron->getNextRunDate($current)->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\CronExpression::getRunDate + */ + public function testFixesPhpBugInDateIntervalMonth() + { + $cron = CronExpression::factory('0 0 27 JAN *'); + $this->assertSame('2011-01-27 00:00:00', $cron->getPreviousRunDate('2011-08-22 00:00:00')->format('Y-m-d H:i:s')); + } + + public function testIssue29() + { + $cron = CronExpression::factory('@weekly'); + $this->assertSame( + '2013-03-10 00:00:00', + $cron->getPreviousRunDate('2013-03-17 00:00:00')->format('Y-m-d H:i:s') + ); + } + + /** + * @see https://github.com/mtdowling/cron-expression/issues/20 + */ + public function testIssue20() { + $e = CronExpression::factory('* * * * MON#1'); + $this->assertTrue($e->isDue(new DateTime('2014-04-07 00:00:00'))); + $this->assertFalse($e->isDue(new DateTime('2014-04-14 00:00:00'))); + $this->assertFalse($e->isDue(new DateTime('2014-04-21 00:00:00'))); + + $e = CronExpression::factory('* * * * SAT#2'); + $this->assertFalse($e->isDue(new DateTime('2014-04-05 00:00:00'))); + $this->assertTrue($e->isDue(new DateTime('2014-04-12 00:00:00'))); + $this->assertFalse($e->isDue(new DateTime('2014-04-19 00:00:00'))); + + $e = CronExpression::factory('* * * * SUN#3'); + $this->assertFalse($e->isDue(new DateTime('2014-04-13 00:00:00'))); + $this->assertTrue($e->isDue(new DateTime('2014-04-20 00:00:00'))); + $this->assertFalse($e->isDue(new DateTime('2014-04-27 00:00:00'))); + } + + /** + * @covers \Cron\CronExpression::getRunDate + */ + public function testKeepOriginalTime() + { + $now = new \DateTime; + $strNow = $now->format(DateTime::ISO8601); + $cron = CronExpression::factory('0 0 * * *'); + $cron->getPreviousRunDate($now); + $this->assertSame($strNow, $now->format(DateTime::ISO8601)); + } + + /** + * @covers \Cron\CronExpression::__construct + * @covers \Cron\CronExpression::factory + * @covers \Cron\CronExpression::isValidExpression + * @covers \Cron\CronExpression::setExpression + * @covers \Cron\CronExpression::setPart + */ + public function testValidationWorks() + { + // Invalid. Only four values + $this->assertFalse(CronExpression::isValidExpression('* * * 1')); + // Valid + $this->assertTrue(CronExpression::isValidExpression('* * * * 1')); + + // Issue #156, 13 is an invalid month + $this->assertFalse(CronExpression::isValidExpression("* * * 13 * ")); + + // Issue #155, 90 is an invalid second + $this->assertFalse(CronExpression::isValidExpression('90 * * * *')); + + // Issue #154, 24 is an invalid hour + $this->assertFalse(CronExpression::isValidExpression("0 24 1 12 0")); + + // Issue #125, this is just all sorts of wrong + $this->assertFalse(CronExpression::isValidExpression('990 14 * * mon-fri0345345')); + + // see https://github.com/dragonmantank/cron-expression/issues/5 + $this->assertTrue(CronExpression::isValidExpression('2,17,35,47 5-7,11-13 * * *')); + } + + /** + * Makes sure that 00 is considered a valid value for 0-based fields + * cronie allows numbers with a leading 0, so adding support for this as well + * + * @see https://github.com/dragonmantank/cron-expression/issues/12 + */ + public function testDoubleZeroIsValid() + { + $this->assertTrue(CronExpression::isValidExpression('00 * * * *')); + $this->assertTrue(CronExpression::isValidExpression('01 * * * *')); + $this->assertTrue(CronExpression::isValidExpression('* 00 * * *')); + $this->assertTrue(CronExpression::isValidExpression('* 01 * * *')); + + $e = CronExpression::factory('00 * * * *'); + $this->assertTrue($e->isDue(new DateTime('2014-04-07 00:00:00'))); + $e = CronExpression::factory('01 * * * *'); + $this->assertTrue($e->isDue(new DateTime('2014-04-07 00:01:00'))); + + $e = CronExpression::factory('* 00 * * *'); + $this->assertTrue($e->isDue(new DateTime('2014-04-07 00:00:00'))); + $e = CronExpression::factory('* 01 * * *'); + $this->assertTrue($e->isDue(new DateTime('2014-04-07 01:00:00'))); + } + + + /** + * Ranges with large steps should "wrap around" to the appropriate value + * cronie allows for steps that are larger than the range of a field, with it wrapping around like a ring buffer. We + * should do the same. + * + * @see https://github.com/dragonmantank/cron-expression/issues/6 + */ + public function testRangesWrapAroundWithLargeSteps() + { + $f = new MonthField(); + $this->assertTrue($f->validate('*/123')); + $this->assertSame([4], $f->getRangeForExpression('*/123', 12)); + + $e = CronExpression::factory('* * * */123 *'); + $this->assertTrue($e->isDue(new DateTime('2014-04-07 00:00:00'))); + + $nextRunDate = $e->getNextRunDate(new DateTime('2014-04-07 00:00:00')); + $this->assertSame('2014-04-07 00:01:00', $nextRunDate->format('Y-m-d H:i:s')); + + $nextRunDate = $e->getNextRunDate(new DateTime('2014-05-07 00:00:00')); + $this->assertSame('2015-04-01 00:00:00', $nextRunDate->format('Y-m-d H:i:s')); + } + + /** + * When there is an issue with a field, we should report the human readable position + * + * @see https://github.com/dragonmantank/cron-expression/issues/29 + */ + public function testFieldPositionIsHumanAdjusted() + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("6 is not a valid position"); + $e = CronExpression::factory('0 * * * * ? *'); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/DayOfMonthFieldTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/DayOfMonthFieldTest.php new file mode 100644 index 00000000..2191b6bf --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/DayOfMonthFieldTest.php @@ -0,0 +1,77 @@ + + */ +class DayOfMonthFieldTest extends TestCase +{ + /** + * @covers \Cron\DayOfMonthField::validate + */ + public function testValidatesField() + { + $f = new DayOfMonthField(); + $this->assertTrue($f->validate('1')); + $this->assertTrue($f->validate('*')); + $this->assertTrue($f->validate('L')); + $this->assertTrue($f->validate('5W')); + $this->assertTrue($f->validate('01')); + $this->assertFalse($f->validate('5W,L')); + $this->assertFalse($f->validate('1.')); + } + + /** + * @covers \Cron\DayOfMonthField::isSatisfiedBy + */ + public function testChecksIfSatisfied() + { + $f = new DayOfMonthField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime(), '?')); + $this->assertTrue($f->isSatisfiedBy(new DateTimeImmutable(), '?')); + } + + /** + * @covers \Cron\DayOfMonthField::increment + */ + public function testIncrementsDate() + { + $d = new DateTime('2011-03-15 11:15:00'); + $f = new DayOfMonthField(); + $f->increment($d); + $this->assertSame('2011-03-16 00:00:00', $d->format('Y-m-d H:i:s')); + + $d = new DateTime('2011-03-15 11:15:00'); + $f->increment($d, true); + $this->assertSame('2011-03-14 23:59:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\DayOfMonthField::increment + */ + public function testIncrementsDateTimeImmutable() + { + $d = new DateTimeImmutable('2011-03-15 11:15:00'); + $f = new DayOfMonthField(); + $f->increment($d); + $this->assertSame('2011-03-16 00:00:00', $d->format('Y-m-d H:i:s')); + } + + /** + * Day of the month cannot accept a 0 value, it must be between 1 and 31 + * See Github issue #120 + * + * @since 2017-01-22 + */ + public function testDoesNotAccept0Date() + { + $f = new DayOfMonthField(); + $this->assertFalse($f->validate(0)); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/DayOfWeekFieldTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/DayOfWeekFieldTest.php new file mode 100644 index 00000000..74e63c28 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/DayOfWeekFieldTest.php @@ -0,0 +1,156 @@ + + */ +class DayOfWeekFieldTest extends TestCase +{ + /** + * @covers \Cron\DayOfWeekField::validate + */ + public function testValidatesField() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->validate('1')); + $this->assertTrue($f->validate('01')); + $this->assertTrue($f->validate('00')); + $this->assertTrue($f->validate('*')); + $this->assertFalse($f->validate('*/3,1,1-12')); + $this->assertTrue($f->validate('SUN-2')); + $this->assertFalse($f->validate('1.')); + } + + /** + * @covers \Cron\DayOfWeekField::isSatisfiedBy + */ + public function testChecksIfSatisfied() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime(), '?')); + $this->assertTrue($f->isSatisfiedBy(new DateTimeImmutable(), '?')); + } + + /** + * @covers \Cron\DayOfWeekField::increment + */ + public function testIncrementsDate() + { + $d = new DateTime('2011-03-15 11:15:00'); + $f = new DayOfWeekField(); + $f->increment($d); + $this->assertSame('2011-03-16 00:00:00', $d->format('Y-m-d H:i:s')); + + $d = new DateTime('2011-03-15 11:15:00'); + $f->increment($d, true); + $this->assertSame('2011-03-14 23:59:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\DayOfWeekField::increment + */ + public function testIncrementsDateTimeImmutable() + { + $d = new DateTimeImmutable('2011-03-15 11:15:00'); + $f = new DayOfWeekField(); + $f->increment($d); + $this->assertSame('2011-03-16 00:00:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\DayOfWeekField::isSatisfiedBy + */ + public function testValidatesHashValueWeekday() + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Weekday must be a value between 0 and 7. 12 given'); + + $f = new DayOfWeekField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime(), '12#1')); + } + + /** + * @covers \Cron\DayOfWeekField::isSatisfiedBy + */ + public function testValidatesHashValueNth() + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('There are never more than 5 or less than 1 of a given weekday in a month'); + + $f = new DayOfWeekField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime(), '3#6')); + } + + /** + * @covers \Cron\DayOfWeekField::validate + */ + public function testValidateWeekendHash() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->validate('MON#1')); + $this->assertTrue($f->validate('TUE#2')); + $this->assertTrue($f->validate('WED#3')); + $this->assertTrue($f->validate('THU#4')); + $this->assertTrue($f->validate('FRI#5')); + $this->assertTrue($f->validate('SAT#1')); + $this->assertTrue($f->validate('SUN#3')); + $this->assertTrue($f->validate('MON#1,MON#3')); + } + + /** + * @covers \Cron\DayOfWeekField::isSatisfiedBy + */ + public function testHandlesZeroAndSevenDayOfTheWeekValues() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime('2011-09-04 00:00:00'), '0-2')); + $this->assertTrue($f->isSatisfiedBy(new DateTime('2011-09-04 00:00:00'), '6-0')); + + $this->assertTrue($f->isSatisfiedBy(new DateTime('2014-04-20 00:00:00'), 'SUN')); + $this->assertTrue($f->isSatisfiedBy(new DateTime('2014-04-20 00:00:00'), 'SUN#3')); + $this->assertTrue($f->isSatisfiedBy(new DateTime('2014-04-20 00:00:00'), '0#3')); + $this->assertTrue($f->isSatisfiedBy(new DateTime('2014-04-20 00:00:00'), '7#3')); + } + + /** + * @covers \Cron\DayOfWeekField::isSatisfiedBy + */ + public function testHandlesLastWeekdayOfTheMonth() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime('2018-12-28 00:00:00'), 'FRIL')); + $this->assertTrue($f->isSatisfiedBy(new DateTime('2018-12-28 00:00:00'), '5L')); + $this->assertFalse($f->isSatisfiedBy(new DateTime('2018-12-21 00:00:00'), 'FRIL')); + $this->assertFalse($f->isSatisfiedBy(new DateTime('2018-12-21 00:00:00'), '5L')); + } + + /** + * @see https://github.com/mtdowling/cron-expression/issues/47 + */ + public function testIssue47() { + $f = new DayOfWeekField(); + $this->assertFalse($f->validate('mon,')); + $this->assertFalse($f->validate('mon-')); + $this->assertFalse($f->validate('*/2,')); + $this->assertFalse($f->validate('-mon')); + $this->assertFalse($f->validate(',1')); + $this->assertFalse($f->validate('*-')); + $this->assertFalse($f->validate(',-')); + } + + /** + * @see https://github.com/laravel/framework/commit/07d160ac3cc9764d5b429734ffce4fa311385403 + */ + public function testLiteralsExpandProperly() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->validate('MON-FRI')); + $this->assertSame([1,2,3,4,5], $f->getRangeForExpression('MON-FRI', 7)); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/FieldFactoryTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/FieldFactoryTest.php new file mode 100644 index 00000000..e25d0707 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/FieldFactoryTest.php @@ -0,0 +1,43 @@ + + */ +class FieldFactoryTest extends TestCase +{ + /** + * @covers \Cron\FieldFactory::getField + */ + public function testRetrievesFieldInstances() + { + $mappings = array( + 0 => 'Cron\MinutesField', + 1 => 'Cron\HoursField', + 2 => 'Cron\DayOfMonthField', + 3 => 'Cron\MonthField', + 4 => 'Cron\DayOfWeekField', + ); + + $f = new FieldFactory(); + + foreach ($mappings as $position => $class) { + $this->assertSame($class, get_class($f->getField($position))); + } + } + + /** + * @covers \Cron\FieldFactory::getField + */ + public function testValidatesFieldPosition() + { + $this->expectException(\InvalidArgumentException::class); + + $f = new FieldFactory(); + $f->getField(-1); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/HoursFieldTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/HoursFieldTest.php new file mode 100644 index 00000000..1849f28b --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/HoursFieldTest.php @@ -0,0 +1,99 @@ + + */ +class HoursFieldTest extends TestCase +{ + /** + * @covers \Cron\HoursField::validate + */ + public function testValidatesField() + { + $f = new HoursField(); + $this->assertTrue($f->validate('1')); + $this->assertTrue($f->validate('00')); + $this->assertTrue($f->validate('01')); + $this->assertTrue($f->validate('*')); + $this->assertFalse($f->validate('*/3,1,1-12')); + } + + /** + * @covers \Cron\HoursField::isSatisfiedBy + */ + public function testChecksIfSatisfied() + { + $f = new HoursField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime(), '?')); + $this->assertTrue($f->isSatisfiedBy(new DateTimeImmutable(), '?')); + } + + /** + * @covers \Cron\HoursField::increment + */ + public function testIncrementsDate() + { + $d = new DateTime('2011-03-15 11:15:00'); + $f = new HoursField(); + $f->increment($d); + $this->assertSame('2011-03-15 12:00:00', $d->format('Y-m-d H:i:s')); + + $d->setTime(11, 15, 0); + $f->increment($d, true); + $this->assertSame('2011-03-15 10:59:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\HoursField::increment + */ + public function testIncrementsDateTimeImmutable() + { + $d = new DateTimeImmutable('2011-03-15 11:15:00'); + $f = new HoursField(); + $f->increment($d); + $this->assertSame('2011-03-15 12:00:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\HoursField::increment + */ + public function testIncrementsDateWithThirtyMinuteOffsetTimezone() + { + $tz = date_default_timezone_get(); + date_default_timezone_set('America/St_Johns'); + $d = new DateTime('2011-03-15 11:15:00'); + $f = new HoursField(); + $f->increment($d); + $this->assertSame('2011-03-15 12:00:00', $d->format('Y-m-d H:i:s')); + + $d->setTime(11, 15, 0); + $f->increment($d, true); + $this->assertSame('2011-03-15 10:59:00', $d->format('Y-m-d H:i:s')); + date_default_timezone_set($tz); + } + + /** + * @covers \Cron\HoursField::increment + */ + public function testIncrementDateWithFifteenMinuteOffsetTimezone() + { + $tz = date_default_timezone_get(); + date_default_timezone_set('Asia/Kathmandu'); + $d = new DateTime('2011-03-15 11:15:00'); + $f = new HoursField(); + $f->increment($d); + $this->assertSame('2011-03-15 12:00:00', $d->format('Y-m-d H:i:s')); + + $d->setTime(11, 15, 0); + $f->increment($d, true); + $this->assertSame('2011-03-15 10:59:00', $d->format('Y-m-d H:i:s')); + date_default_timezone_set($tz); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/MinutesFieldTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/MinutesFieldTest.php new file mode 100644 index 00000000..41a536d6 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/MinutesFieldTest.php @@ -0,0 +1,73 @@ + + */ +class MinutesFieldTest extends TestCase +{ + /** + * @covers \Cron\MinutesField::validate + */ + public function testValidatesField() + { + $f = new MinutesField(); + $this->assertTrue($f->validate('1')); + $this->assertTrue($f->validate('*')); + $this->assertFalse($f->validate('*/3,1,1-12')); + } + + /** + * @covers \Cron\MinutesField::isSatisfiedBy + */ + public function testChecksIfSatisfied() + { + $f = new MinutesField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime(), '?')); + $this->assertTrue($f->isSatisfiedBy(new DateTimeImmutable(), '?')); + } + + /** + * @covers \Cron\MinutesField::increment + */ + public function testIncrementsDate() + { + $d = new DateTime('2011-03-15 11:15:00'); + $f = new MinutesField(); + $f->increment($d); + $this->assertSame('2011-03-15 11:16:00', $d->format('Y-m-d H:i:s')); + $f->increment($d, true); + $this->assertSame('2011-03-15 11:15:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\MinutesField::increment + */ + public function testIncrementsDateTimeImmutable() + { + $d = new DateTimeImmutable('2011-03-15 11:15:00'); + $f = new MinutesField(); + $f->increment($d); + $this->assertSame('2011-03-15 11:16:00', $d->format('Y-m-d H:i:s')); + } + + /** + * Various bad syntaxes that are reported to work, but shouldn't. + * + * @author Chris Tankersley + * @since 2017-08-18 + */ + public function testBadSyntaxesShouldNotValidate() + { + $f = new MinutesField(); + $this->assertFalse($f->validate('*-1')); + $this->assertFalse($f->validate('1-2-3')); + $this->assertFalse($f->validate('-1')); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/MonthFieldTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/MonthFieldTest.php new file mode 100644 index 00000000..f329f4c1 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/MonthFieldTest.php @@ -0,0 +1,103 @@ + + */ +class MonthFieldTest extends TestCase +{ + /** + * @covers \Cron\MonthField::validate + */ + public function testValidatesField() + { + $f = new MonthField(); + $this->assertTrue($f->validate('12')); + $this->assertTrue($f->validate('*')); + $this->assertFalse($f->validate('*/10,2,1-12')); + $this->assertFalse($f->validate('1.fix-regexp')); + } + + /** + * @covers \Cron\MonthField::isSatisfiedBy + */ + public function testChecksIfSatisfied() + { + $f = new MonthField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime(), '?')); + $this->assertTrue($f->isSatisfiedBy(new DateTimeImmutable(), '?')); + } + + /** + * @covers \Cron\MonthField::increment + */ + public function testIncrementsDate() + { + $d = new DateTime('2011-03-15 11:15:00'); + $f = new MonthField(); + $f->increment($d); + $this->assertSame('2011-04-01 00:00:00', $d->format('Y-m-d H:i:s')); + + $d = new DateTime('2011-03-15 11:15:00'); + $f->increment($d, true); + $this->assertSame('2011-02-28 23:59:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\MonthField::increment + */ + public function testIncrementsDateTimeImmutable() + { + $d = new DateTimeImmutable('2011-03-15 11:15:00'); + $f = new MonthField(); + $f->increment($d); + $this->assertSame('2011-04-01 00:00:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\MonthField::increment + */ + public function testIncrementsDateWithThirtyMinuteTimezone() + { + $tz = date_default_timezone_get(); + date_default_timezone_set('America/St_Johns'); + $d = new DateTime('2011-03-31 11:59:59'); + $f = new MonthField(); + $f->increment($d); + $this->assertSame('2011-04-01 00:00:00', $d->format('Y-m-d H:i:s')); + + $d = new DateTime('2011-03-15 11:15:00'); + $f->increment($d, true); + $this->assertSame('2011-02-28 23:59:00', $d->format('Y-m-d H:i:s')); + date_default_timezone_set($tz); + } + + + /** + * @covers \Cron\MonthField::increment + */ + public function testIncrementsYearAsNeeded() + { + $f = new MonthField(); + $d = new DateTime('2011-12-15 00:00:00'); + $f->increment($d); + $this->assertSame('2012-01-01 00:00:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\MonthField::increment + */ + public function testDecrementsYearAsNeeded() + { + $f = new MonthField(); + $d = new DateTime('2011-01-15 00:00:00'); + $f->increment($d, true); + $this->assertSame('2010-12-31 23:59:00', $d->format('Y-m-d H:i:s')); + } +} diff --git a/vendor/egulias/email-validator/LICENSE b/vendor/egulias/email-validator/LICENSE new file mode 100644 index 00000000..c34d2c19 --- /dev/null +++ b/vendor/egulias/email-validator/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013-2016 Eduardo Gulias Davis + +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/egulias/email-validator/composer.json b/vendor/egulias/email-validator/composer.json new file mode 100644 index 00000000..a275696a --- /dev/null +++ b/vendor/egulias/email-validator/composer.json @@ -0,0 +1,38 @@ +{ + "name": "egulias/email-validator", + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": ["email", "validation", "validator", "emailvalidation", "emailvalidator"], + "license": "MIT", + "authors": [ + {"name": "Eduardo Gulias Davis"} + ], + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "require": { + "php": ">=5.5", + "doctrine/lexer": "^1.0.1", + "symfony/polyfill-intl-idn": "^1.10" + }, + "require-dev": { + "dominicsayers/isemail": "^3.0.7", + "phpunit/phpunit": "^4.8.36|^7.5.15", + "satooshi/php-coveralls": "^1.0.1" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Egulias\\EmailValidator\\Tests\\": "tests" + } + } +} diff --git a/vendor/egulias/email-validator/src/EmailLexer.php b/vendor/egulias/email-validator/src/EmailLexer.php new file mode 100644 index 00000000..59dcd587 --- /dev/null +++ b/vendor/egulias/email-validator/src/EmailLexer.php @@ -0,0 +1,283 @@ + self::S_OPENPARENTHESIS, + ')' => self::S_CLOSEPARENTHESIS, + '<' => self::S_LOWERTHAN, + '>' => self::S_GREATERTHAN, + '[' => self::S_OPENBRACKET, + ']' => self::S_CLOSEBRACKET, + ':' => self::S_COLON, + ';' => self::S_SEMICOLON, + '@' => self::S_AT, + '\\' => self::S_BACKSLASH, + '/' => self::S_SLASH, + ',' => self::S_COMMA, + '.' => self::S_DOT, + "'" => self::S_SQUOTE, + "`" => self::S_BACKTICK, + '"' => self::S_DQUOTE, + '-' => self::S_HYPHEN, + '::' => self::S_DOUBLECOLON, + ' ' => self::S_SP, + "\t" => self::S_HTAB, + "\r" => self::S_CR, + "\n" => self::S_LF, + "\r\n" => self::CRLF, + 'IPv6' => self::S_IPV6TAG, + '{' => self::S_OPENQBRACKET, + '}' => self::S_CLOSEQBRACKET, + '' => self::S_EMPTY, + '\0' => self::C_NUL, + ); + + /** + * @var bool + */ + protected $hasInvalidTokens = false; + + /** + * @var array + * + * @psalm-var array{value:string, type:null|int, position:int}|array + */ + protected $previous = []; + + /** + * The last matched/seen token. + * + * @var array + * + * @psalm-var array{value:string, type:null|int, position:int} + */ + public $token; + + /** + * The next token in the input. + * + * @var array|null + */ + public $lookahead; + + /** + * @psalm-var array{value:'', type:null, position:0} + */ + private static $nullToken = [ + 'value' => '', + 'type' => null, + 'position' => 0, + ]; + + public function __construct() + { + $this->previous = $this->token = self::$nullToken; + $this->lookahead = null; + } + + /** + * @return void + */ + public function reset() + { + $this->hasInvalidTokens = false; + parent::reset(); + $this->previous = $this->token = self::$nullToken; + } + + /** + * @return bool + */ + public function hasInvalidTokens() + { + return $this->hasInvalidTokens; + } + + /** + * @param int $type + * @throws \UnexpectedValueException + * @return boolean + * + * @psalm-suppress InvalidScalarArgument + */ + public function find($type) + { + $search = clone $this; + $search->skipUntil($type); + + if (!$search->lookahead) { + throw new \UnexpectedValueException($type . ' not found'); + } + return true; + } + + /** + * getPrevious + * + * @return array + */ + public function getPrevious() + { + return $this->previous; + } + + /** + * moveNext + * + * @return boolean + */ + public function moveNext() + { + $this->previous = $this->token; + $hasNext = parent::moveNext(); + $this->token = $this->token ?: self::$nullToken; + + return $hasNext; + } + + /** + * Lexical catchable patterns. + * + * @return string[] + */ + protected function getCatchablePatterns() + { + return array( + '[a-zA-Z_]+[46]?', //ASCII and domain literal + '[^\x00-\x7F]', //UTF-8 + '[0-9]+', + '\r\n', + '::', + '\s+?', + '.', + ); + } + + /** + * Lexical non-catchable patterns. + * + * @return string[] + */ + protected function getNonCatchablePatterns() + { + return array('[\xA0-\xff]+'); + } + + /** + * Retrieve token type. Also processes the token value if necessary. + * + * @param string $value + * @throws \InvalidArgumentException + * @return integer + */ + protected function getType(&$value) + { + if ($this->isNullType($value)) { + return self::C_NUL; + } + + if ($this->isValid($value)) { + return $this->charValue[$value]; + } + + if ($this->isUTF8Invalid($value)) { + $this->hasInvalidTokens = true; + return self::INVALID; + } + + return self::GENERIC; + } + + /** + * @param string $value + * + * @return bool + */ + protected function isValid($value) + { + if (isset($this->charValue[$value])) { + return true; + } + + return false; + } + + /** + * @param string $value + * @return bool + */ + protected function isNullType($value) + { + if ($value === "\0") { + return true; + } + + return false; + } + + /** + * @param string $value + * @return bool + */ + protected function isUTF8Invalid($value) + { + if (preg_match('/\p{Cc}+/u', $value)) { + return true; + } + + return false; + } + + /** + * @return string + */ + protected function getModifiers() + { + return 'iu'; + } +} diff --git a/vendor/egulias/email-validator/src/EmailParser.php b/vendor/egulias/email-validator/src/EmailParser.php new file mode 100644 index 00000000..6b7bad66 --- /dev/null +++ b/vendor/egulias/email-validator/src/EmailParser.php @@ -0,0 +1,137 @@ + + */ +class EmailParser +{ + const EMAIL_MAX_LENGTH = 254; + + /** + * @var array + */ + protected $warnings = []; + + /** + * @var string + */ + protected $domainPart = ''; + + /** + * @var string + */ + protected $localPart = ''; + /** + * @var EmailLexer + */ + protected $lexer; + + /** + * @var LocalPart + */ + protected $localPartParser; + + /** + * @var DomainPart + */ + protected $domainPartParser; + + public function __construct(EmailLexer $lexer) + { + $this->lexer = $lexer; + $this->localPartParser = new LocalPart($this->lexer); + $this->domainPartParser = new DomainPart($this->lexer); + } + + /** + * @param string $str + * @return array + */ + public function parse($str) + { + $this->lexer->setInput($str); + + if (!$this->hasAtToken()) { + throw new NoLocalPart(); + } + + + $this->localPartParser->parse($str); + $this->domainPartParser->parse($str); + + $this->setParts($str); + + if ($this->lexer->hasInvalidTokens()) { + throw new ExpectingATEXT(); + } + + return array('local' => $this->localPart, 'domain' => $this->domainPart); + } + + /** + * @return Warning\Warning[] + */ + public function getWarnings() + { + $localPartWarnings = $this->localPartParser->getWarnings(); + $domainPartWarnings = $this->domainPartParser->getWarnings(); + $this->warnings = array_merge($localPartWarnings, $domainPartWarnings); + + $this->addLongEmailWarning($this->localPart, $this->domainPart); + + return $this->warnings; + } + + /** + * @return string + */ + public function getParsedDomainPart() + { + return $this->domainPart; + } + + /** + * @param string $email + */ + protected function setParts($email) + { + $parts = explode('@', $email); + $this->domainPart = $this->domainPartParser->getDomainPart(); + $this->localPart = $parts[0]; + } + + /** + * @return bool + */ + protected function hasAtToken() + { + $this->lexer->moveNext(); + $this->lexer->moveNext(); + if ($this->lexer->token['type'] === EmailLexer::S_AT) { + return false; + } + + return true; + } + + /** + * @param string $localPart + * @param string $parsedDomainPart + */ + protected function addLongEmailWarning($localPart, $parsedDomainPart) + { + if (strlen($localPart . '@' . $parsedDomainPart) > self::EMAIL_MAX_LENGTH) { + $this->warnings[EmailTooLong::CODE] = new EmailTooLong(); + } + } +} diff --git a/vendor/egulias/email-validator/src/EmailValidator.php b/vendor/egulias/email-validator/src/EmailValidator.php new file mode 100644 index 00000000..a30f21dc --- /dev/null +++ b/vendor/egulias/email-validator/src/EmailValidator.php @@ -0,0 +1,67 @@ +lexer = new EmailLexer(); + } + + /** + * @param string $email + * @param EmailValidation $emailValidation + * @return bool + */ + public function isValid($email, EmailValidation $emailValidation) + { + $isValid = $emailValidation->isValid($email, $this->lexer); + $this->warnings = $emailValidation->getWarnings(); + $this->error = $emailValidation->getError(); + + return $isValid; + } + + /** + * @return boolean + */ + public function hasWarnings() + { + return !empty($this->warnings); + } + + /** + * @return array + */ + public function getWarnings() + { + return $this->warnings; + } + + /** + * @return InvalidEmail|null + */ + public function getError() + { + return $this->error; + } +} diff --git a/vendor/egulias/email-validator/src/Exception/AtextAfterCFWS.php b/vendor/egulias/email-validator/src/Exception/AtextAfterCFWS.php new file mode 100644 index 00000000..97f41a2c --- /dev/null +++ b/vendor/egulias/email-validator/src/Exception/AtextAfterCFWS.php @@ -0,0 +1,9 @@ +lexer->moveNext(); + + $this->performDomainStartChecks(); + + $domain = $this->doParseDomainPart(); + + $prev = $this->lexer->getPrevious(); + $length = strlen($domain); + + if ($prev['type'] === EmailLexer::S_DOT) { + throw new DotAtEnd(); + } + if ($prev['type'] === EmailLexer::S_HYPHEN) { + throw new DomainHyphened(); + } + if ($length > self::DOMAIN_MAX_LENGTH) { + $this->warnings[DomainTooLong::CODE] = new DomainTooLong(); + } + if ($prev['type'] === EmailLexer::S_CR) { + throw new CRLFAtTheEnd(); + } + $this->domainPart = $domain; + } + + private function performDomainStartChecks() + { + $this->checkInvalidTokensAfterAT(); + $this->checkEmptyDomain(); + + if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) { + $this->warnings[DeprecatedComment::CODE] = new DeprecatedComment(); + $this->parseDomainComments(); + } + } + + private function checkEmptyDomain() + { + $thereIsNoDomain = $this->lexer->token['type'] === EmailLexer::S_EMPTY || + ($this->lexer->token['type'] === EmailLexer::S_SP && + !$this->lexer->isNextToken(EmailLexer::GENERIC)); + + if ($thereIsNoDomain) { + throw new NoDomainPart(); + } + } + + private function checkInvalidTokensAfterAT() + { + if ($this->lexer->token['type'] === EmailLexer::S_DOT) { + throw new DotAtStart(); + } + if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN) { + throw new DomainHyphened(); + } + } + + /** + * @return string + */ + public function getDomainPart() + { + return $this->domainPart; + } + + /** + * @param string $addressLiteral + * @param int $maxGroups + */ + public function checkIPV6Tag($addressLiteral, $maxGroups = 8) + { + $prev = $this->lexer->getPrevious(); + if ($prev['type'] === EmailLexer::S_COLON) { + $this->warnings[IPV6ColonEnd::CODE] = new IPV6ColonEnd(); + } + + $IPv6 = substr($addressLiteral, 5); + //Daniel Marschall's new IPv6 testing strategy + $matchesIP = explode(':', $IPv6); + $groupCount = count($matchesIP); + $colons = strpos($IPv6, '::'); + + if (count(preg_grep('/^[0-9A-Fa-f]{0,4}$/', $matchesIP, PREG_GREP_INVERT)) !== 0) { + $this->warnings[IPV6BadChar::CODE] = new IPV6BadChar(); + } + + if ($colons === false) { + // We need exactly the right number of groups + if ($groupCount !== $maxGroups) { + $this->warnings[IPV6GroupCount::CODE] = new IPV6GroupCount(); + } + return; + } + + if ($colons !== strrpos($IPv6, '::')) { + $this->warnings[IPV6DoubleColon::CODE] = new IPV6DoubleColon(); + return; + } + + if ($colons === 0 || $colons === (strlen($IPv6) - 2)) { + // RFC 4291 allows :: at the start or end of an address + //with 7 other groups in addition + ++$maxGroups; + } + + if ($groupCount > $maxGroups) { + $this->warnings[IPV6MaxGroups::CODE] = new IPV6MaxGroups(); + } elseif ($groupCount === $maxGroups) { + $this->warnings[IPV6Deprecated::CODE] = new IPV6Deprecated(); + } + } + + /** + * @return string + */ + protected function doParseDomainPart() + { + $domain = ''; + $label = ''; + $openedParenthesis = 0; + do { + $prev = $this->lexer->getPrevious(); + + $this->checkNotAllowedChars($this->lexer->token); + + if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) { + $this->parseComments(); + $openedParenthesis += $this->getOpenedParenthesis(); + $this->lexer->moveNext(); + $tmpPrev = $this->lexer->getPrevious(); + if ($tmpPrev['type'] === EmailLexer::S_CLOSEPARENTHESIS) { + $openedParenthesis--; + } + } + if ($this->lexer->token['type'] === EmailLexer::S_CLOSEPARENTHESIS) { + if ($openedParenthesis === 0) { + throw new UnopenedComment(); + } else { + $openedParenthesis--; + } + } + + $this->checkConsecutiveDots(); + $this->checkDomainPartExceptions($prev); + + if ($this->hasBrackets()) { + $this->parseDomainLiteral(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_DOT) { + $this->checkLabelLength($label); + $label = ''; + } else { + $label .= $this->lexer->token['value']; + } + + if ($this->isFWS()) { + $this->parseFWS(); + } + + $domain .= $this->lexer->token['value']; + $this->lexer->moveNext(); + if ($this->lexer->token['type'] === EmailLexer::S_SP) { + throw new CharNotAllowed(); + } + } while (null !== $this->lexer->token['type']); + + $this->checkLabelLength($label); + + return $domain; + } + + private function checkNotAllowedChars(array $token) + { + $notAllowed = [EmailLexer::S_BACKSLASH => true, EmailLexer::S_SLASH=> true]; + if (isset($notAllowed[$token['type']])) { + throw new CharNotAllowed(); + } + } + + /** + * @return string|false + */ + protected function parseDomainLiteral() + { + if ($this->lexer->isNextToken(EmailLexer::S_COLON)) { + $this->warnings[IPV6ColonStart::CODE] = new IPV6ColonStart(); + } + if ($this->lexer->isNextToken(EmailLexer::S_IPV6TAG)) { + $lexer = clone $this->lexer; + $lexer->moveNext(); + if ($lexer->isNextToken(EmailLexer::S_DOUBLECOLON)) { + $this->warnings[IPV6ColonStart::CODE] = new IPV6ColonStart(); + } + } + + return $this->doParseDomainLiteral(); + } + + /** + * @return string|false + */ + protected function doParseDomainLiteral() + { + $IPv6TAG = false; + $addressLiteral = ''; + do { + if ($this->lexer->token['type'] === EmailLexer::C_NUL) { + throw new ExpectingDTEXT(); + } + + if ($this->lexer->token['type'] === EmailLexer::INVALID || + $this->lexer->token['type'] === EmailLexer::C_DEL || + $this->lexer->token['type'] === EmailLexer::S_LF + ) { + $this->warnings[ObsoleteDTEXT::CODE] = new ObsoleteDTEXT(); + } + + if ($this->lexer->isNextTokenAny(array(EmailLexer::S_OPENQBRACKET, EmailLexer::S_OPENBRACKET))) { + throw new ExpectingDTEXT(); + } + + if ($this->lexer->isNextTokenAny( + array(EmailLexer::S_HTAB, EmailLexer::S_SP, $this->lexer->token['type'] === EmailLexer::CRLF) + )) { + $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS(); + $this->parseFWS(); + } + + if ($this->lexer->isNextToken(EmailLexer::S_CR)) { + throw new CRNoLF(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH) { + $this->warnings[ObsoleteDTEXT::CODE] = new ObsoleteDTEXT(); + $addressLiteral .= $this->lexer->token['value']; + $this->lexer->moveNext(); + $this->validateQuotedPair(); + } + if ($this->lexer->token['type'] === EmailLexer::S_IPV6TAG) { + $IPv6TAG = true; + } + if ($this->lexer->token['type'] === EmailLexer::S_CLOSEQBRACKET) { + break; + } + + $addressLiteral .= $this->lexer->token['value']; + + } while ($this->lexer->moveNext()); + + $addressLiteral = str_replace('[', '', $addressLiteral); + $addressLiteral = $this->checkIPV4Tag($addressLiteral); + + if (false === $addressLiteral) { + return $addressLiteral; + } + + if (!$IPv6TAG) { + $this->warnings[DomainLiteral::CODE] = new DomainLiteral(); + return $addressLiteral; + } + + $this->warnings[AddressLiteral::CODE] = new AddressLiteral(); + + $this->checkIPV6Tag($addressLiteral); + + return $addressLiteral; + } + + /** + * @param string $addressLiteral + * + * @return string|false + */ + protected function checkIPV4Tag($addressLiteral) + { + $matchesIP = array(); + + // Extract IPv4 part from the end of the address-literal (if there is one) + if (preg_match( + '/\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/', + $addressLiteral, + $matchesIP + ) > 0 + ) { + $index = strrpos($addressLiteral, $matchesIP[0]); + if ($index === 0) { + $this->warnings[AddressLiteral::CODE] = new AddressLiteral(); + return false; + } + // Convert IPv4 part to IPv6 format for further testing + $addressLiteral = substr($addressLiteral, 0, (int) $index) . '0:0'; + } + + return $addressLiteral; + } + + protected function checkDomainPartExceptions(array $prev) + { + $invalidDomainTokens = array( + EmailLexer::S_DQUOTE => true, + EmailLexer::S_SQUOTE => true, + EmailLexer::S_BACKTICK => true, + EmailLexer::S_SEMICOLON => true, + EmailLexer::S_GREATERTHAN => true, + EmailLexer::S_LOWERTHAN => true, + ); + + if (isset($invalidDomainTokens[$this->lexer->token['type']])) { + throw new ExpectingATEXT(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_COMMA) { + throw new CommaInDomain(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_AT) { + throw new ConsecutiveAt(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_OPENQBRACKET && $prev['type'] !== EmailLexer::S_AT) { + throw new ExpectingATEXT(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN && $this->lexer->isNextToken(EmailLexer::S_DOT)) { + throw new DomainHyphened(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH + && $this->lexer->isNextToken(EmailLexer::GENERIC)) { + throw new ExpectingATEXT(); + } + } + + /** + * @return bool + */ + protected function hasBrackets() + { + if ($this->lexer->token['type'] !== EmailLexer::S_OPENBRACKET) { + return false; + } + + try { + $this->lexer->find(EmailLexer::S_CLOSEBRACKET); + } catch (\RuntimeException $e) { + throw new ExpectingDomainLiteralClose(); + } + + return true; + } + + /** + * @param string $label + */ + protected function checkLabelLength($label) + { + if ($this->isLabelTooLong($label)) { + $this->warnings[LabelTooLong::CODE] = new LabelTooLong(); + } + } + + /** + * @param string $label + * @return bool + */ + private function isLabelTooLong($label) + { + if (preg_match('/[^\x00-\x7F]/', $label)) { + idn_to_ascii($label, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46, $idnaInfo); + + return (bool) ($idnaInfo['errors'] & IDNA_ERROR_LABEL_TOO_LONG); + } + + return strlen($label) > self::LABEL_MAX_LENGTH; + } + + protected function parseDomainComments() + { + $this->isUnclosedComment(); + while (!$this->lexer->isNextToken(EmailLexer::S_CLOSEPARENTHESIS)) { + $this->warnEscaping(); + $this->lexer->moveNext(); + } + + $this->lexer->moveNext(); + if ($this->lexer->isNextToken(EmailLexer::S_DOT)) { + throw new ExpectingATEXT(); + } + } + + protected function addTLDWarnings() + { + if ($this->warnings[DomainLiteral::CODE]) { + $this->warnings[TLD::CODE] = new TLD(); + } + } +} diff --git a/vendor/egulias/email-validator/src/Parser/LocalPart.php b/vendor/egulias/email-validator/src/Parser/LocalPart.php new file mode 100644 index 00000000..3c21f34a --- /dev/null +++ b/vendor/egulias/email-validator/src/Parser/LocalPart.php @@ -0,0 +1,145 @@ +lexer->token['type'] !== EmailLexer::S_AT && null !== $this->lexer->token['type']) { + if ($this->lexer->token['type'] === EmailLexer::S_DOT && null === $this->lexer->getPrevious()['type']) { + throw new DotAtStart(); + } + + $closingQuote = $this->checkDQUOTE($closingQuote); + if ($closingQuote && $parseDQuote) { + $parseDQuote = $this->parseDoubleQuote(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) { + $this->parseComments(); + $openedParenthesis += $this->getOpenedParenthesis(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_CLOSEPARENTHESIS) { + if ($openedParenthesis === 0) { + throw new UnopenedComment(); + } + + $openedParenthesis--; + } + + $this->checkConsecutiveDots(); + + if ($this->lexer->token['type'] === EmailLexer::S_DOT && + $this->lexer->isNextToken(EmailLexer::S_AT) + ) { + throw new DotAtEnd(); + } + + $this->warnEscaping(); + $this->isInvalidToken($this->lexer->token, $closingQuote); + + if ($this->isFWS()) { + $this->parseFWS(); + } + + $totalLength += strlen($this->lexer->token['value']); + $this->lexer->moveNext(); + } + + if ($totalLength > LocalTooLong::LOCAL_PART_LENGTH) { + $this->warnings[LocalTooLong::CODE] = new LocalTooLong(); + } + } + + /** + * @return bool + */ + protected function parseDoubleQuote() + { + $parseAgain = true; + $special = array( + EmailLexer::S_CR => true, + EmailLexer::S_HTAB => true, + EmailLexer::S_LF => true + ); + + $invalid = array( + EmailLexer::C_NUL => true, + EmailLexer::S_HTAB => true, + EmailLexer::S_CR => true, + EmailLexer::S_LF => true + ); + $setSpecialsWarning = true; + + $this->lexer->moveNext(); + + while ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE && null !== $this->lexer->token['type']) { + $parseAgain = false; + if (isset($special[$this->lexer->token['type']]) && $setSpecialsWarning) { + $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS(); + $setSpecialsWarning = false; + } + if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH && $this->lexer->isNextToken(EmailLexer::S_DQUOTE)) { + $this->lexer->moveNext(); + } + + $this->lexer->moveNext(); + + if (!$this->escaped() && isset($invalid[$this->lexer->token['type']])) { + throw new ExpectingATEXT(); + } + } + + $prev = $this->lexer->getPrevious(); + + if ($prev['type'] === EmailLexer::S_BACKSLASH) { + if (!$this->checkDQUOTE(false)) { + throw new UnclosedQuotedString(); + } + } + + if (!$this->lexer->isNextToken(EmailLexer::S_AT) && $prev['type'] !== EmailLexer::S_BACKSLASH) { + throw new ExpectingAT(); + } + + return $parseAgain; + } + + /** + * @param bool $closingQuote + */ + protected function isInvalidToken(array $token, $closingQuote) + { + $forbidden = array( + EmailLexer::S_COMMA, + EmailLexer::S_CLOSEBRACKET, + EmailLexer::S_OPENBRACKET, + EmailLexer::S_GREATERTHAN, + EmailLexer::S_LOWERTHAN, + EmailLexer::S_COLON, + EmailLexer::S_SEMICOLON, + EmailLexer::INVALID + ); + + if (in_array($token['type'], $forbidden) && !$closingQuote) { + throw new ExpectingATEXT(); + } + } +} diff --git a/vendor/egulias/email-validator/src/Parser/Parser.php b/vendor/egulias/email-validator/src/Parser/Parser.php new file mode 100644 index 00000000..ccdc9388 --- /dev/null +++ b/vendor/egulias/email-validator/src/Parser/Parser.php @@ -0,0 +1,249 @@ +lexer = $lexer; + } + + /** + * @return \Egulias\EmailValidator\Warning\Warning[] + */ + public function getWarnings() + { + return $this->warnings; + } + + /** + * @param string $str + */ + abstract public function parse($str); + + /** @return int */ + public function getOpenedParenthesis() + { + return $this->openedParenthesis; + } + + /** + * validateQuotedPair + */ + protected function validateQuotedPair() + { + if (!($this->lexer->token['type'] === EmailLexer::INVALID + || $this->lexer->token['type'] === EmailLexer::C_DEL)) { + throw new ExpectingQPair(); + } + + $this->warnings[QuotedPart::CODE] = + new QuotedPart($this->lexer->getPrevious()['type'], $this->lexer->token['type']); + } + + protected function parseComments() + { + $this->openedParenthesis = 1; + $this->isUnclosedComment(); + $this->warnings[Comment::CODE] = new Comment(); + while (!$this->lexer->isNextToken(EmailLexer::S_CLOSEPARENTHESIS)) { + if ($this->lexer->isNextToken(EmailLexer::S_OPENPARENTHESIS)) { + $this->openedParenthesis++; + } + $this->warnEscaping(); + $this->lexer->moveNext(); + } + + $this->lexer->moveNext(); + if ($this->lexer->isNextTokenAny(array(EmailLexer::GENERIC, EmailLexer::S_EMPTY))) { + throw new ExpectingATEXT(); + } + + if ($this->lexer->isNextToken(EmailLexer::S_AT)) { + $this->warnings[CFWSNearAt::CODE] = new CFWSNearAt(); + } + } + + /** + * @return bool + */ + protected function isUnclosedComment() + { + try { + $this->lexer->find(EmailLexer::S_CLOSEPARENTHESIS); + return true; + } catch (\RuntimeException $e) { + throw new UnclosedComment(); + } + } + + protected function parseFWS() + { + $previous = $this->lexer->getPrevious(); + + $this->checkCRLFInFWS(); + + if ($this->lexer->token['type'] === EmailLexer::S_CR) { + throw new CRNoLF(); + } + + if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type'] !== EmailLexer::S_AT) { + throw new AtextAfterCFWS(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_LF || $this->lexer->token['type'] === EmailLexer::C_NUL) { + throw new ExpectingCTEXT(); + } + + if ($this->lexer->isNextToken(EmailLexer::S_AT) || $previous['type'] === EmailLexer::S_AT) { + $this->warnings[CFWSNearAt::CODE] = new CFWSNearAt(); + } else { + $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS(); + } + } + + protected function checkConsecutiveDots() + { + if ($this->lexer->token['type'] === EmailLexer::S_DOT && $this->lexer->isNextToken(EmailLexer::S_DOT)) { + throw new ConsecutiveDot(); + } + } + + /** + * @return bool + */ + protected function isFWS() + { + if ($this->escaped()) { + return false; + } + + if ($this->lexer->token['type'] === EmailLexer::S_SP || + $this->lexer->token['type'] === EmailLexer::S_HTAB || + $this->lexer->token['type'] === EmailLexer::S_CR || + $this->lexer->token['type'] === EmailLexer::S_LF || + $this->lexer->token['type'] === EmailLexer::CRLF + ) { + return true; + } + + return false; + } + + /** + * @return bool + */ + protected function escaped() + { + $previous = $this->lexer->getPrevious(); + + if ($previous && $previous['type'] === EmailLexer::S_BACKSLASH + && + $this->lexer->token['type'] !== EmailLexer::GENERIC + ) { + return true; + } + + return false; + } + + /** + * @return bool + */ + protected function warnEscaping() + { + if ($this->lexer->token['type'] !== EmailLexer::S_BACKSLASH) { + return false; + } + + if ($this->lexer->isNextToken(EmailLexer::GENERIC)) { + throw new ExpectingATEXT(); + } + + if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB, EmailLexer::C_DEL))) { + return false; + } + + $this->warnings[QuotedPart::CODE] = + new QuotedPart($this->lexer->getPrevious()['type'], $this->lexer->token['type']); + return true; + + } + + /** + * @param bool $hasClosingQuote + * + * @return bool + */ + protected function checkDQUOTE($hasClosingQuote) + { + if ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE) { + return $hasClosingQuote; + } + if ($hasClosingQuote) { + return $hasClosingQuote; + } + $previous = $this->lexer->getPrevious(); + if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type'] === EmailLexer::GENERIC) { + throw new ExpectingATEXT(); + } + + try { + $this->lexer->find(EmailLexer::S_DQUOTE); + $hasClosingQuote = true; + } catch (\Exception $e) { + throw new UnclosedQuotedString(); + } + $this->warnings[QuotedString::CODE] = new QuotedString($previous['value'], $this->lexer->token['value']); + + return $hasClosingQuote; + } + + protected function checkCRLFInFWS() + { + if ($this->lexer->token['type'] !== EmailLexer::CRLF) { + return; + } + + if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) { + throw new CRLFX2(); + } + + if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) { + throw new CRLFAtTheEnd(); + } + } +} diff --git a/vendor/egulias/email-validator/src/Validation/DNSCheckValidation.php b/vendor/egulias/email-validator/src/Validation/DNSCheckValidation.php new file mode 100644 index 00000000..491082a5 --- /dev/null +++ b/vendor/egulias/email-validator/src/Validation/DNSCheckValidation.php @@ -0,0 +1,166 @@ +error = new LocalOrReservedDomain(); + return false; + } + + return $this->checkDns($host); + } + + public function getError() + { + return $this->error; + } + + public function getWarnings() + { + return $this->warnings; + } + + /** + * @param string $host + * + * @return bool + */ + protected function checkDns($host) + { + $variant = INTL_IDNA_VARIANT_UTS46; + + $host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, $variant), '.') . '.'; + + return $this->validateDnsRecords($host); + } + + + /** + * Validate the DNS records for given host. + * + * @param string $host A set of DNS records in the format returned by dns_get_record. + * + * @return bool True on success. + */ + private function validateDnsRecords($host) + { + // Get all MX, A and AAAA DNS records for host + // Using @ as workaround to fix https://bugs.php.net/bug.php?id=73149 + $dnsRecords = @dns_get_record($host, DNS_MX + DNS_A + DNS_AAAA); + + + // No MX, A or AAAA DNS records + if (empty($dnsRecords)) { + $this->error = new NoDNSRecord(); + return false; + } + + // For each DNS record + foreach ($dnsRecords as $dnsRecord) { + if (!$this->validateMXRecord($dnsRecord)) { + return false; + } + } + + // No MX records (fallback to A or AAAA records) + if (empty($this->mxRecords)) { + $this->warnings[NoDNSMXRecord::CODE] = new NoDNSMXRecord(); + } + + return true; + } + + /** + * Validate an MX record + * + * @param array $dnsRecord Given DNS record. + * + * @return bool True if valid. + */ + private function validateMxRecord($dnsRecord) + { + if ($dnsRecord['type'] !== 'MX') { + return true; + } + + // "Null MX" record indicates the domain accepts no mail (https://tools.ietf.org/html/rfc7505) + if (empty($dnsRecord['target']) || $dnsRecord['target'] === '.') { + $this->error = new DomainAcceptsNoMail(); + return false; + } + + $this->mxRecords[] = $dnsRecord; + + return true; + } +} diff --git a/vendor/egulias/email-validator/src/Validation/EmailValidation.php b/vendor/egulias/email-validator/src/Validation/EmailValidation.php new file mode 100644 index 00000000..d5a015be --- /dev/null +++ b/vendor/egulias/email-validator/src/Validation/EmailValidation.php @@ -0,0 +1,34 @@ +errors = $errors; + parent::__construct(); + } + + /** + * @return InvalidEmail[] + */ + public function getErrors() + { + return $this->errors; + } +} diff --git a/vendor/egulias/email-validator/src/Validation/MultipleValidationWithAnd.php b/vendor/egulias/email-validator/src/Validation/MultipleValidationWithAnd.php new file mode 100644 index 00000000..feb22402 --- /dev/null +++ b/vendor/egulias/email-validator/src/Validation/MultipleValidationWithAnd.php @@ -0,0 +1,124 @@ +validations = $validations; + $this->mode = $mode; + } + + /** + * {@inheritdoc} + */ + public function isValid($email, EmailLexer $emailLexer) + { + $result = true; + $errors = []; + foreach ($this->validations as $validation) { + $emailLexer->reset(); + $validationResult = $validation->isValid($email, $emailLexer); + $result = $result && $validationResult; + $this->warnings = array_merge($this->warnings, $validation->getWarnings()); + $errors = $this->addNewError($validation->getError(), $errors); + + if ($this->shouldStop($result)) { + break; + } + } + + if (!empty($errors)) { + $this->error = new MultipleErrors($errors); + } + + return $result; + } + + /** + * @param \Egulias\EmailValidator\Exception\InvalidEmail|null $possibleError + * @param \Egulias\EmailValidator\Exception\InvalidEmail[] $errors + * + * @return \Egulias\EmailValidator\Exception\InvalidEmail[] + */ + private function addNewError($possibleError, array $errors) + { + if (null !== $possibleError) { + $errors[] = $possibleError; + } + + return $errors; + } + + /** + * @param bool $result + * + * @return bool + */ + private function shouldStop($result) + { + return !$result && $this->mode === self::STOP_ON_ERROR; + } + + /** + * Returns the validation errors. + * + * @return MultipleErrors|null + */ + public function getError() + { + return $this->error; + } + + /** + * {@inheritdoc} + */ + public function getWarnings() + { + return $this->warnings; + } +} diff --git a/vendor/egulias/email-validator/src/Validation/NoRFCWarningsValidation.php b/vendor/egulias/email-validator/src/Validation/NoRFCWarningsValidation.php new file mode 100644 index 00000000..6b31e544 --- /dev/null +++ b/vendor/egulias/email-validator/src/Validation/NoRFCWarningsValidation.php @@ -0,0 +1,41 @@ +getWarnings())) { + return true; + } + + $this->error = new RFCWarnings(); + + return false; + } + + /** + * {@inheritdoc} + */ + public function getError() + { + return $this->error ?: parent::getError(); + } +} diff --git a/vendor/egulias/email-validator/src/Validation/RFCValidation.php b/vendor/egulias/email-validator/src/Validation/RFCValidation.php new file mode 100644 index 00000000..8781e0b6 --- /dev/null +++ b/vendor/egulias/email-validator/src/Validation/RFCValidation.php @@ -0,0 +1,49 @@ +parser = new EmailParser($emailLexer); + try { + $this->parser->parse((string)$email); + } catch (InvalidEmail $invalid) { + $this->error = $invalid; + return false; + } + + $this->warnings = $this->parser->getWarnings(); + return true; + } + + public function getError() + { + return $this->error; + } + + public function getWarnings() + { + return $this->warnings; + } +} diff --git a/vendor/egulias/email-validator/src/Validation/SpoofCheckValidation.php b/vendor/egulias/email-validator/src/Validation/SpoofCheckValidation.php new file mode 100644 index 00000000..e10bfabd --- /dev/null +++ b/vendor/egulias/email-validator/src/Validation/SpoofCheckValidation.php @@ -0,0 +1,51 @@ +setChecks(Spoofchecker::SINGLE_SCRIPT); + + if ($checker->isSuspicious($email)) { + $this->error = new SpoofEmail(); + } + + return $this->error === null; + } + + /** + * @return InvalidEmail|null + */ + public function getError() + { + return $this->error; + } + + public function getWarnings() + { + return []; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/AddressLiteral.php b/vendor/egulias/email-validator/src/Warning/AddressLiteral.php new file mode 100644 index 00000000..77e70f7f --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/AddressLiteral.php @@ -0,0 +1,14 @@ +message = 'Address literal in domain part'; + $this->rfcNumber = 5321; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/CFWSNearAt.php b/vendor/egulias/email-validator/src/Warning/CFWSNearAt.php new file mode 100644 index 00000000..be43bbe6 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/CFWSNearAt.php @@ -0,0 +1,13 @@ +message = "Deprecated folding white space near @"; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/CFWSWithFWS.php b/vendor/egulias/email-validator/src/Warning/CFWSWithFWS.php new file mode 100644 index 00000000..dea3450e --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/CFWSWithFWS.php @@ -0,0 +1,13 @@ +message = 'Folding whites space followed by folding white space'; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/Comment.php b/vendor/egulias/email-validator/src/Warning/Comment.php new file mode 100644 index 00000000..704c2908 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/Comment.php @@ -0,0 +1,13 @@ +message = "Comments found in this email"; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/DeprecatedComment.php b/vendor/egulias/email-validator/src/Warning/DeprecatedComment.php new file mode 100644 index 00000000..ad43bd7c --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/DeprecatedComment.php @@ -0,0 +1,13 @@ +message = 'Deprecated comments'; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/DomainLiteral.php b/vendor/egulias/email-validator/src/Warning/DomainLiteral.php new file mode 100644 index 00000000..6f36b5e2 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/DomainLiteral.php @@ -0,0 +1,14 @@ +message = 'Domain Literal'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/DomainTooLong.php b/vendor/egulias/email-validator/src/Warning/DomainTooLong.php new file mode 100644 index 00000000..61ff17a7 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/DomainTooLong.php @@ -0,0 +1,14 @@ +message = 'Domain is too long, exceeds 255 chars'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/EmailTooLong.php b/vendor/egulias/email-validator/src/Warning/EmailTooLong.php new file mode 100644 index 00000000..497309db --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/EmailTooLong.php @@ -0,0 +1,15 @@ +message = 'Email is too long, exceeds ' . EmailParser::EMAIL_MAX_LENGTH; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/IPV6BadChar.php b/vendor/egulias/email-validator/src/Warning/IPV6BadChar.php new file mode 100644 index 00000000..ba2fcc01 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/IPV6BadChar.php @@ -0,0 +1,14 @@ +message = 'Bad char in IPV6 domain literal'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/IPV6ColonEnd.php b/vendor/egulias/email-validator/src/Warning/IPV6ColonEnd.php new file mode 100644 index 00000000..41afa78c --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/IPV6ColonEnd.php @@ -0,0 +1,14 @@ +message = ':: found at the end of the domain literal'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/IPV6ColonStart.php b/vendor/egulias/email-validator/src/Warning/IPV6ColonStart.php new file mode 100644 index 00000000..1bf754e3 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/IPV6ColonStart.php @@ -0,0 +1,14 @@ +message = ':: found at the start of the domain literal'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/IPV6Deprecated.php b/vendor/egulias/email-validator/src/Warning/IPV6Deprecated.php new file mode 100644 index 00000000..d752caaa --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/IPV6Deprecated.php @@ -0,0 +1,14 @@ +message = 'Deprecated form of IPV6'; + $this->rfcNumber = 5321; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/IPV6DoubleColon.php b/vendor/egulias/email-validator/src/Warning/IPV6DoubleColon.php new file mode 100644 index 00000000..4f823949 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/IPV6DoubleColon.php @@ -0,0 +1,14 @@ +message = 'Double colon found after IPV6 tag'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/IPV6GroupCount.php b/vendor/egulias/email-validator/src/Warning/IPV6GroupCount.php new file mode 100644 index 00000000..a59d317f --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/IPV6GroupCount.php @@ -0,0 +1,14 @@ +message = 'Group count is not IPV6 valid'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/IPV6MaxGroups.php b/vendor/egulias/email-validator/src/Warning/IPV6MaxGroups.php new file mode 100644 index 00000000..936274c1 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/IPV6MaxGroups.php @@ -0,0 +1,14 @@ +message = 'Reached the maximum number of IPV6 groups allowed'; + $this->rfcNumber = 5321; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/LabelTooLong.php b/vendor/egulias/email-validator/src/Warning/LabelTooLong.php new file mode 100644 index 00000000..daf07f40 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/LabelTooLong.php @@ -0,0 +1,14 @@ +message = 'Label too long'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/LocalTooLong.php b/vendor/egulias/email-validator/src/Warning/LocalTooLong.php new file mode 100644 index 00000000..0d08d8b3 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/LocalTooLong.php @@ -0,0 +1,15 @@ +message = 'Local part is too long, exceeds 64 chars (octets)'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/NoDNSMXRecord.php b/vendor/egulias/email-validator/src/Warning/NoDNSMXRecord.php new file mode 100644 index 00000000..b3c21a1f --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/NoDNSMXRecord.php @@ -0,0 +1,14 @@ +message = 'No MX DSN record was found for this email'; + $this->rfcNumber = 5321; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/ObsoleteDTEXT.php b/vendor/egulias/email-validator/src/Warning/ObsoleteDTEXT.php new file mode 100644 index 00000000..10f19e33 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/ObsoleteDTEXT.php @@ -0,0 +1,14 @@ +rfcNumber = 5322; + $this->message = 'Obsolete DTEXT in domain literal'; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/QuotedPart.php b/vendor/egulias/email-validator/src/Warning/QuotedPart.php new file mode 100644 index 00000000..36a4265a --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/QuotedPart.php @@ -0,0 +1,17 @@ +message = "Deprecated Quoted String found between $prevToken and $postToken"; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/QuotedString.php b/vendor/egulias/email-validator/src/Warning/QuotedString.php new file mode 100644 index 00000000..817e4e84 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/QuotedString.php @@ -0,0 +1,17 @@ +message = "Quoted String found between $prevToken and $postToken"; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/TLD.php b/vendor/egulias/email-validator/src/Warning/TLD.php new file mode 100644 index 00000000..2338b9f4 --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/TLD.php @@ -0,0 +1,13 @@ +message = "RFC5321, TLD"; + } +} diff --git a/vendor/egulias/email-validator/src/Warning/Warning.php b/vendor/egulias/email-validator/src/Warning/Warning.php new file mode 100644 index 00000000..a2ee7b0d --- /dev/null +++ b/vendor/egulias/email-validator/src/Warning/Warning.php @@ -0,0 +1,47 @@ +message; + } + + /** + * @return int + */ + public function code() + { + return static::CODE; + } + + /** + * @return int + */ + public function RFCNumber() + { + return $this->rfcNumber; + } + + public function __toString() + { + return $this->message() . " rfc: " . $this->rfcNumber . "interal code: " . static::CODE; + } +} diff --git a/vendor/fakerphp/faker/CHANGELOG.md b/vendor/fakerphp/faker/CHANGELOG.md new file mode 100644 index 00000000..b30fa41b --- /dev/null +++ b/vendor/fakerphp/faker/CHANGELOG.md @@ -0,0 +1,163 @@ +# CHANGELOG + +## [Unreleased](https://github.com/FakerPHP/Faker/compare/v1.19.0...main) + +## [2022-02-02, v1.19.0](https://github.com/FakerPHP/Faker/compare/v1.18.0..v1.19.0) + +- Added color extension to core (#442) +- Added conflict with `doctrine/persistence` below version `1.4` +- Fix for support on different Doctrine ORM versions (#414) +- Fix usage of `Doctrine\Persistence` dependency +- Fix CZ Person birthNumber docblock return type (#437) +- Fix is_IS Person docbock types (#439) +- Fix is_IS Address docbock type (#438) +- Fix regexify escape backslash in character class (#434) +- Removed UUID from Generator to be able to extend it (#441) +- +## [2022-01-23, v1.18.0](https://github.com/FakerPHP/Faker/compare/v1.17.0..v1.18.0) + +- Deprecated UUID, use uuid3 to specify version (#427) +- Reset formatters when adding a new provider (#366) +- Helper methods to use our custom generators (#155) +- Set allow-plugins for Composer 2.2 (#405) +- Fix kk_KZ\Person::individualIdentificationNumber generation (#411) +- Allow for -> syntax to be used in parsing (#423) +- Person->name was missing string return type (#424) +- Generate a valid BE TAX number (#415) +- Added the UUID extension to Core (#427) + +## [2021-12-05, v1.17.0](https://github.com/FakerPHP/Faker/compare/v1.16.0..v1.17.0) + +- Partial PHP 8.1 compatibility (#373) +- Add payment provider for `ne_NP` locale (#375) +- Add Egyptian Arabic `ar_EG` locale (#377) +- Updated list of South African TLDs (#383) +- Fixed formatting of E.164 numbers (#380) +- Allow `symfony/deprecation-contracts` `^3.0` (#397) + +## [2021-09-06, v1.16.0](https://github.com/FakerPHP/Faker/compare/v1.15.0..v1.16.0) + +- Add Company extension +- Add Address extension +- Add Person extension +- Add PhoneNumber extension +- Add VersionExtension (#350) +- Stricter types in Extension\Container and Extension\GeneratorAwareExtension (#345) +- Fix deprecated property access in `nl_NL` (#348) +- Add support for `psr/container` >= 2.0 (#354) +- Add missing union types in Faker\Generator (#352) + +## [2021-07-06, v1.15.0](https://github.com/FakerPHP/Faker/compare/v1.14.1..v1.15.0) + +- Updated the generator phpdoc to help identify magic methods (#307) +- Prevent direct access and triggered deprecation warning for "word" (#302) +- Updated length on all global e164 numbers (#301) +- Updated last names from different source (#312) +- Don't generate birth number of '000' for Swedish personal identity (#306) +- Add job list for localization id_ID (#339) + +## [2021-03-30, v1.14.1](https://github.com/FakerPHP/Faker/compare/v1.14.0..v1.14.1) + +- Fix where randomNumber and randomFloat would return a 0 value (#291 / #292) + +## [2021-03-29, v1.14.0](https://github.com/FakerPHP/Faker/compare/v1.13.0..v1.14.0) + +- Fix for realText to ensure the text keeps closer to its boundaries (#152) +- Fix where regexify produces a random character instead of a literal dot (#135 +- Deprecate zh_TW methods that only call base methods (#122) +- Add used extensions to composer.json as suggestion (#120) +- Moved TCNo and INN from calculator to localized providers (#108) +- Fix regex dot/backslash issue where a dot is replaced with a backslash as escape character (#206) +- Deprecate direct property access (#164) +- Added test to assert unique() behaviour (#233) +- Added RUC for the es_PE locale (#244) +- Test IBAN formats for Latin America (AR/PE/VE) (#260) +- Added VAT number for en_GB (#255) +- Added new districts for the ne_NP locale (#258) +- Fix for U.S. Area Code Generation (#261) +- Fix in numerify where a better random numeric value is guaranteed (#256) +- Fix e164PhoneNumber to only generate valid phone numbers with valid country codes (#264) +- Extract fixtures into separate classes (#234) +- Remove french domains that no longer exists (#277) +- Fix error that occurs when getting a polish title (#279) +- Use valid area codes for North America E164 phone numbers (#280) + +- Adding support for extensions and PSR-11 (#154) +- Adding trait for GeneratorAwareExtension (#165) +- Added helper class for extension (#162) +- Added blood extension to core (#232) +- Added barcode extension to core (#252) +- Added number extension (#257) + +- Various code style updates +- Added a note about our breaking change promise (#273) + +## [2020-12-18, v1.13.0](https://github.com/FakerPHP/Faker/compare/v1.12.1..v1.13.0) + +Several fixes and new additions in this release. A lot of cleanup has been done +on the codebase on both tests and consistency. + +- Feature/pl pl license plate (#62) +- Fix greek phone numbers (#16) +- Move AT payment provider logic to de_AT (#72) +- Fix wiktionary links (#73) +- Fix AT person links (#74) +- Fix AT cities (#75) +- Deprecate at_AT providers (#78) +- Add Austrian `ssn()` to `Person` provider (#79) +- Fix typos in id_ID Address (#83) +- Austrian post codes (#86) +- Updated Polish data (#70) +- Improve Austrian social security number generation (#88) +- Move US phone numbers with extension to own method (#91) +- Add UK National Insurance number generator (#89) +- Fix en_SG phone number generator (#100) +- Remove usage of mt_rand (#87) +- Remove whitespace from beginning of el_GR phone numbers (#105) +- Building numbers can not be 0, 00, 000 (#107) +- Add 172.16/12 local IPv4 block (#121) +- Add JCB credit card type (#124) +- Remove json_decode from emoji generation (#123) +- Remove ro street address (#146) + +## [2020-12-11, v1.12.1](https://github.com/FakerPHP/Faker/compare/v1.12.0..v1.12.1) + +This is a security release that prevents a hacker to execute code on the server. + +## [2020-11-23, v1.12.0](https://github.com/FakerPHP/Faker/compare/v1.11.0..v1.12.0) + +- Fix ro_RO first and last day of year calculation offset (#65) +- Fix en_NG locale test namespaces that did not match PSR-4 (#57) +- Added Singapore NRIC/FIN provider (#56) +- Added provider for Lithuanian municipalities (#58) +- Added blood types provider (#61) + +## [2020-11-15, v1.11.0](https://github.com/FakerPHP/Faker/compare/v1.10.1..v1.11.0) + +- Added Provider for Swedish Municipalities +- Updates to person names in pt_BR +- Many code style changes + +## [2020-10-28, v1.10.1](https://github.com/FakerPHP/Faker/compare/v1.10.0..v1.10.1) + +- Updates the Danish addresses in dk_DK +- Removed offense company names in nl_NL +- Clarify changelog with original fork +- Standin replacement for LoremPixel to Placeholder.com (#11) + +## [2020-10-27, v1.10.0](https://github.com/FakerPHP/Faker/compare/v1.9.1..v1.10.0) + +- Support PHP 7.1-8.0 +- Fix typo in de_DE Company Provider +- Fix dateTimeThisYear method +- Fix typo in de_DE jobTitleFormat +- Fix IBAN generation for CR +- Fix typos in greek first names +- Fix US job title typo +- Do not clear entity manager for doctrine orm populator +- Remove persian rude words +- Corrections to RU names + +## 2020-10-27, v1.9.1 + +- Initial version. Same as `fzaninotto/Faker:v1.9.1`. diff --git a/vendor/fakerphp/faker/LICENSE b/vendor/fakerphp/faker/LICENSE new file mode 100644 index 00000000..99ed0075 --- /dev/null +++ b/vendor/fakerphp/faker/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2011 François Zaninotto +Portions Copyright (c) 2008 Caius Durling +Portions Copyright (c) 2008 Adam Royle +Portions Copyright (c) 2008 Fiona Burrows + +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/fakerphp/faker/README.md b/vendor/fakerphp/faker/README.md new file mode 100644 index 00000000..018c70bb --- /dev/null +++ b/vendor/fakerphp/faker/README.md @@ -0,0 +1,76 @@ +

Social card of FakerPHP

+ +# Faker + +[![Packagist Downloads](https://img.shields.io/packagist/dm/FakerPHP/Faker)](https://packagist.org/packages/fakerphp/faker) +[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/FakerPHP/Faker/Tests/main)](https://github.com/FakerPHP/Faker/actions) +[![Type Coverage](https://shepherd.dev/github/FakerPHP/Faker/coverage.svg)](https://shepherd.dev/github/FakerPHP/Faker) +[![Code Coverage](https://codecov.io/gh/FakerPHP/Faker/branch/main/graph/badge.svg)](https://codecov.io/gh/FakerPHP/Faker) + +Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you. + +It's heavily inspired by Perl's [Data::Faker](https://metacpan.org/pod/Data::Faker), and by Ruby's [Faker](https://rubygems.org/gems/faker). + +## Getting Started + +### Installation + +Faker requires PHP >= 7.1. + +```shell +composer require fakerphp/faker +``` + +### Documentation + +Full documentation can be found over on [fakerphp.github.io](https://fakerphp.github.io). + +### Basic Usage + +Use `Faker\Factory::create()` to create and initialize a Faker generator, which can generate data by accessing methods named after the type of data you want. + +```php +name(); +// 'Vince Sporer' +echo $faker->email(); +// 'walter.sophia@hotmail.com' +echo $faker->text(); +// 'Numquam ut mollitia at consequuntur inventore dolorem.' +``` + +Each call to `$faker->name()` yields a different (random) result. This is because Faker uses `__call()` magic, and forwards `Faker\Generator->$method()` calls to `Faker\Generator->format($method, $attributes)`. + +```php +name() . "\n"; +} + +// 'Cyrus Boyle' +// 'Alena Cummerata' +// 'Orlo Bergstrom' +``` + +## License + +Faker is released under the MIT License. See [`LICENSE`](LICENSE) for details. + +## Backward compatibility promise + +Faker is using [Semver](https://semver.org/). This means that versions are tagged +with MAJOR.MINOR.PATCH. Only a new major version will be allowed to break backward +compatibility (BC). + +Classes marked as `@experimental` or `@internal` are not included in our backward compatibility promise. +You are also not guaranteed that the value returned from a method is always the +same. You are guaranteed that the data type will not change. + +PHP 8 introduced [named arguments](https://wiki.php.net/rfc/named_params), which +increased the cost and reduces flexibility for package maintainers. The names of the +arguments for methods in Faker is not included in our BC promise. diff --git a/vendor/fakerphp/faker/composer.json b/vendor/fakerphp/faker/composer.json new file mode 100644 index 00000000..2eda697d --- /dev/null +++ b/vendor/fakerphp/faker/composer.json @@ -0,0 +1,60 @@ +{ + "name": "fakerphp/faker", + "type": "library", + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "faker", + "fixtures", + "data" + ], + "license": "MIT", + "authors": [ + { + "name": "François Zaninotto" + } + ], + "require": { + "php": "^7.1 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "require-dev": { + "ext-intl": "*", + "bamarni/composer-bin-plugin": "^1.4.1", + "doctrine/persistence": "^1.3 || ^2.0", + "symfony/phpunit-bridge": "^4.4 || ^5.2" + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "autoload-dev": { + "psr-4": { + "Faker\\Test\\": "test/Faker/", + "Faker\\Test\\Fixture\\": "test/Fixture/" + } + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "suggest": { + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality.", + "doctrine/orm": "Required to use Faker\\ORM\\Doctrine" + }, + "config": { + "allow-plugins": { + "bamarni/composer-bin-plugin": true, + "composer/package-versions-deprecated": true + }, + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-main": "v1.19-dev" + } + } +} diff --git a/vendor/fakerphp/faker/psalm.baseline.xml b/vendor/fakerphp/faker/psalm.baseline.xml new file mode 100644 index 00000000..7d5b2683 --- /dev/null +++ b/vendor/fakerphp/faker/psalm.baseline.xml @@ -0,0 +1,196 @@ + + + + + 0 + + + string + + + + + $this->uniqueGenerator + new ChanceGenerator($this, $weight, $default) + new ValidGenerator($this, $validator, $maxRetries) + + + self + self + self + + + + + TableRegistry + + + + + $this->class + \Doctrine\ODM\MongoDB\Mapping\ClassMetadata + \Doctrine\ODM\MongoDB\Mapping\ClassMetadata + \Doctrine\ODM\MongoDB\Mapping\ClassMetadata + \Doctrine\ORM\Mapping\ClassMetadata + \Doctrine\ORM\Mapping\ClassMetadata + + + createQueryBuilder + getAssociationMappings + newInstance + + + + + Mandango + Mandango + + + + + $this->mandango + Mandango + + + + + \ColumnMap + + + + + $columnMap + $columnMap + $columnMap + $columnMap + $columnMap + $columnMap + $columnMap + $columnMap + \ColumnMap + + + + + \Propel + + + PropelPDO + + + + + ColumnMap + + + + + $columnMap + $columnMap + $columnMap + $columnMap + $columnMap + $columnMap + $columnMap + $columnMap + ColumnMap + + + + + Propel + + + PropelPDO + + + + + $this->mapper + + + string + + + $relation + $relation + BelongsTo + Locator + Mapper + + + $locator + $this->mapper + $this->mapper + $this->mapper + $this->mapper + $this->mapper + Locator + Mapper + + + + + $this->locator + Locator + + + Locator + + + + + Closure + + + + + false + + + + + $imei + + + int + + + + + static::$cityPrefix + + + + + static::birthNumber(static::GENDER_FEMALE) + static::birthNumber(static::GENDER_MALE) + + + + + $checksumArr[$checksum % 11] + + + + + $ref[$i] + + + + + static::split($text) + + + + + DateTime + + + + + static::lastName() + static::lastName() + + + diff --git a/vendor/fakerphp/faker/src/Faker/Calculator/Ean.php b/vendor/fakerphp/faker/src/Faker/Calculator/Ean.php new file mode 100644 index 00000000..9c3daf17 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Calculator/Ean.php @@ -0,0 +1,52 @@ + $digit) { + $sums += ((int) $digit) * $sequence[$n % 2]; + } + + return (10 - $sums % 10) % 10; + } + + /** + * Checks whether the provided number is an EAN compliant number and that + * the checksum is correct. + * + * @param string $ean An EAN number + * + * @return bool + */ + public static function isValid($ean) + { + if (!preg_match(self::PATTERN, $ean)) { + return false; + } + + return self::checksum(substr($ean, 0, -1)) === (int) substr($ean, -1); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Calculator/Iban.php b/vendor/fakerphp/faker/src/Faker/Calculator/Iban.php new file mode 100644 index 00000000..c8fae242 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Calculator/Iban.php @@ -0,0 +1,79 @@ += 0; $i -= 2) { + $sum += $number[$i]; + } + + for ($i = $length - 2; $i >= 0; $i -= 2) { + $sum += array_sum(str_split($number[$i] * 2)); + } + + return $sum % 10; + } + + /** + * @param string $partialNumber + * + * @return string + */ + public static function computeCheckDigit($partialNumber) + { + $checkDigit = self::checksum($partialNumber . '0'); + + if ($checkDigit === 0) { + return 0; + } + + return (string) (10 - $checkDigit); + } + + /** + * Checks whether a number (partial number + check digit) is Luhn compliant + * + * @param string $number + * + * @return bool + */ + public static function isValid($number) + { + return self::checksum($number) === 0; + } + + /** + * Generate a Luhn compliant number. + * + * @param string $partialValue + * + * @return string + */ + public static function generateLuhnNumber($partialValue) + { + if (!preg_match('/^\d+$/', $partialValue)) { + throw new \InvalidArgumentException('Argument should be an integer.'); + } + + return $partialValue . Luhn::computeCheckDigit($partialValue); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Calculator/TCNo.php b/vendor/fakerphp/faker/src/Faker/Calculator/TCNo.php new file mode 100644 index 00000000..a75c93e1 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Calculator/TCNo.php @@ -0,0 +1,43 @@ +default = $default; + $this->generator = $generator; + $this->weight = $weight; + } + + public function ext(string $id) + { + return new self($this->generator->ext($id), $this->weight, $this->default); + } + + /** + * Catch and proxy all generator calls but return only valid values + * + * @param string $attribute + * + * @deprecated Use a method instead. + */ + public function __get($attribute) + { + trigger_deprecation('fakerphp/faker', '1.14', 'Accessing property "%s" is deprecated, use "%s()" instead.', $attribute, $attribute); + + return $this->__call($attribute, []); + } + + /** + * @param string $name + * @param array $arguments + */ + public function __call($name, $arguments) + { + if (mt_rand(1, 100) <= (100 * $this->weight)) { + return call_user_func_array([$this->generator, $name], $arguments); + } + + return $this->default; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Barcode.php b/vendor/fakerphp/faker/src/Faker/Core/Barcode.php new file mode 100644 index 00000000..89f801a5 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Barcode.php @@ -0,0 +1,45 @@ +ean(); + } + + public function ean8(): string + { + return $this->ean(8); + } + + public function isbn10(): string + { + $code = Extension\Helper::numerify(str_repeat('#', 9)); + + return sprintf('%s%s', $code, Calculator\Isbn::checksum($code)); + } + + public function isbn13(): string + { + $code = '97' . mt_rand(8, 9) . Extension\Helper::numerify(str_repeat('#', 9)); + + return sprintf('%s%s', $code, Calculator\Ean::checksum($code)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Blood.php b/vendor/fakerphp/faker/src/Faker/Core/Blood.php new file mode 100644 index 00000000..48a67ff6 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Blood.php @@ -0,0 +1,42 @@ +bloodTypes); + } + + public function bloodRh(): string + { + return Extension\Helper::randomElement($this->bloodRhFactors); + } + + public function bloodGroup(): string + { + return sprintf( + '%s%s', + $this->bloodType(), + $this->bloodRh() + ); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Color.php b/vendor/fakerphp/faker/src/Faker/Core/Color.php new file mode 100644 index 00000000..d4d5d268 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Color.php @@ -0,0 +1,180 @@ +numberBetween(1, 16777215)), 6, '0', STR_PAD_LEFT); + } + + /** + * @example '#ff0044' + */ + public function safeHexColor(): string + { + $number = new Number(); + $color = str_pad(dechex($number->numberBetween(0, 255)), 3, '0', STR_PAD_LEFT); + + return sprintf( + '#%s%s%s%s%s%s', + $color[0], + $color[0], + $color[1], + $color[1], + $color[2], + $color[2] + ); + } + + /** + * @example 'array(0,255,122)' + * + * @return int[] + */ + public function rgbColorAsArray(): array + { + $color = $this->hexColor(); + + return [ + hexdec(substr($color, 1, 2)), + hexdec(substr($color, 3, 2)), + hexdec(substr($color, 5, 2)), + ]; + } + + /** + * @example '0,255,122' + */ + public function rgbColor(): string + { + return implode(',', $this->rgbColorAsArray()); + } + + /** + * @example 'rgb(0,255,122)' + */ + public function rgbCssColor(): string + { + return sprintf( + 'rgb(%s)', + $this->rgbColor() + ); + } + + /** + * @example 'rgba(0,255,122,0.8)' + */ + public function rgbaCssColor(): string + { + $number = new Number(); + + return sprintf( + 'rgba(%s,%s)', + $this->rgbColor(), + $number->randomFloat(1, 0, 1) + ); + } + + /** + * @example 'blue' + */ + public function safeColorName(): string + { + return Helper::randomElement($this->safeColorNames); + } + + /** + * @example 'NavajoWhite' + */ + public function colorName(): string + { + return Helper::randomElement($this->allColorNames); + } + + /** + * @example '340,50,20' + */ + public function hslColor(): string + { + $number = new Number(); + + return sprintf( + '%s,%s,%s', + $number->numberBetween(0, 360), + $number->numberBetween(0, 100), + $number->numberBetween(0, 100) + ); + } + + /** + * @example array(340, 50, 20) + * + * @return int[] + */ + public function hslColorAsArray(): array + { + $number = new Number(); + + return [ + $number->numberBetween(0, 360), + $number->numberBetween(0, 100), + $number->numberBetween(0, 100), + ]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Coordinates.php b/vendor/fakerphp/faker/src/Faker/Core/Coordinates.php new file mode 100644 index 00000000..40a26589 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Coordinates.php @@ -0,0 +1,68 @@ + 90 || $max > 90) { + throw new \LogicException('Latitude cannot be greater that 90.0'); + } + + return $this->randomFloat(6, $min, $max); + } + + /** + * @example '86.211205' + * + * @return float Uses signed degrees format (returns a float number between -180 and 180) + */ + public function longitude(float $min = -180.0, float $max = 180.0): float + { + if ($min < -180 || $max < -180) { + throw new \LogicException('Longitude cannot be less that -180.0'); + } + + if ($min > 180 || $max > 180) { + throw new \LogicException('Longitude cannot be greater that 180.0'); + } + + return $this->randomFloat(6, $min, $max); + } + + /** + * @example array('77.147489', '86.211205') + * + * @return array{latitude: float, longitude: float} + */ + public function localCoordinates(): array + { + return [ + 'latitude' => static::latitude(), + 'longitude' => static::longitude(), + ]; + } + + private function randomFloat(int $nbMaxDecimals, float $min, float $max): float + { + if ($min > $max) { + throw new \LogicException('Invalid coordinates boundaries'); + } + + return round($min + mt_rand() / mt_getrandmax() * ($max - $min), $nbMaxDecimals); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/File.php b/vendor/fakerphp/faker/src/Faker/Core/File.php new file mode 100644 index 00000000..adddb0cb --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/File.php @@ -0,0 +1,564 @@ + file extension(s) + * + * @see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types + */ + private $mimeTypes = [ + 'application/atom+xml' => 'atom', + 'application/ecmascript' => 'ecma', + 'application/emma+xml' => 'emma', + 'application/epub+zip' => 'epub', + 'application/java-archive' => 'jar', + 'application/java-vm' => 'class', + 'application/javascript' => 'js', + 'application/json' => 'json', + 'application/jsonml+json' => 'jsonml', + 'application/lost+xml' => 'lostxml', + 'application/mathml+xml' => 'mathml', + 'application/mets+xml' => 'mets', + 'application/mods+xml' => 'mods', + 'application/mp4' => 'mp4s', + 'application/msword' => ['doc', 'dot'], + 'application/octet-stream' => [ + 'bin', + 'dms', + 'lrf', + 'mar', + 'so', + 'dist', + 'distz', + 'pkg', + 'bpk', + 'dump', + 'elc', + 'deploy', + ], + 'application/ogg' => 'ogx', + 'application/omdoc+xml' => 'omdoc', + 'application/pdf' => 'pdf', + 'application/pgp-encrypted' => 'pgp', + 'application/pgp-signature' => ['asc', 'sig'], + 'application/pkix-pkipath' => 'pkipath', + 'application/pkixcmp' => 'pki', + 'application/pls+xml' => 'pls', + 'application/postscript' => ['ai', 'eps', 'ps'], + 'application/pskc+xml' => 'pskcxml', + 'application/rdf+xml' => 'rdf', + 'application/reginfo+xml' => 'rif', + 'application/rss+xml' => 'rss', + 'application/rtf' => 'rtf', + 'application/sbml+xml' => 'sbml', + 'application/vnd.adobe.air-application-installer-package+zip' => 'air', + 'application/vnd.adobe.xdp+xml' => 'xdp', + 'application/vnd.adobe.xfdf' => 'xfdf', + 'application/vnd.ahead.space' => 'ahead', + 'application/vnd.dart' => 'dart', + 'application/vnd.data-vision.rdz' => 'rdz', + 'application/vnd.dece.data' => ['uvf', 'uvvf', 'uvd', 'uvvd'], + 'application/vnd.dece.ttml+xml' => ['uvt', 'uvvt'], + 'application/vnd.dece.unspecified' => ['uvx', 'uvvx'], + 'application/vnd.dece.zip' => ['uvz', 'uvvz'], + 'application/vnd.denovo.fcselayout-link' => 'fe_launch', + 'application/vnd.dna' => 'dna', + 'application/vnd.dolby.mlp' => 'mlp', + 'application/vnd.dpgraph' => 'dpg', + 'application/vnd.dreamfactory' => 'dfac', + 'application/vnd.ds-keypoint' => 'kpxx', + 'application/vnd.dvb.ait' => 'ait', + 'application/vnd.dvb.service' => 'svc', + 'application/vnd.dynageo' => 'geo', + 'application/vnd.ecowin.chart' => 'mag', + 'application/vnd.enliven' => 'nml', + 'application/vnd.epson.esf' => 'esf', + 'application/vnd.epson.msf' => 'msf', + 'application/vnd.epson.quickanime' => 'qam', + 'application/vnd.epson.salt' => 'slt', + 'application/vnd.epson.ssf' => 'ssf', + 'application/vnd.ezpix-album' => 'ez2', + 'application/vnd.ezpix-package' => 'ez3', + 'application/vnd.fdf' => 'fdf', + 'application/vnd.fdsn.mseed' => 'mseed', + 'application/vnd.fdsn.seed' => ['seed', 'dataless'], + 'application/vnd.flographit' => 'gph', + 'application/vnd.fluxtime.clip' => 'ftc', + 'application/vnd.hal+xml' => 'hal', + 'application/vnd.hydrostatix.sof-data' => 'sfd-hdstx', + 'application/vnd.ibm.minipay' => 'mpy', + 'application/vnd.ibm.secure-container' => 'sc', + 'application/vnd.iccprofile' => ['icc', 'icm'], + 'application/vnd.igloader' => 'igl', + 'application/vnd.immervision-ivp' => 'ivp', + 'application/vnd.kde.karbon' => 'karbon', + 'application/vnd.kde.kchart' => 'chrt', + 'application/vnd.kde.kformula' => 'kfo', + 'application/vnd.kde.kivio' => 'flw', + 'application/vnd.kde.kontour' => 'kon', + 'application/vnd.kde.kpresenter' => ['kpr', 'kpt'], + 'application/vnd.kde.kspread' => 'ksp', + 'application/vnd.kde.kword' => ['kwd', 'kwt'], + 'application/vnd.kenameaapp' => 'htke', + 'application/vnd.kidspiration' => 'kia', + 'application/vnd.kinar' => ['kne', 'knp'], + 'application/vnd.koan' => ['skp', 'skd', 'skt', 'skm'], + 'application/vnd.kodak-descriptor' => 'sse', + 'application/vnd.las.las+xml' => 'lasxml', + 'application/vnd.llamagraphics.life-balance.desktop' => 'lbd', + 'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe', + 'application/vnd.lotus-1-2-3' => '123', + 'application/vnd.lotus-approach' => 'apr', + 'application/vnd.lotus-freelance' => 'pre', + 'application/vnd.lotus-notes' => 'nsf', + 'application/vnd.lotus-organizer' => 'org', + 'application/vnd.lotus-screencam' => 'scm', + 'application/vnd.mozilla.xul+xml' => 'xul', + 'application/vnd.ms-artgalry' => 'cil', + 'application/vnd.ms-cab-compressed' => 'cab', + 'application/vnd.ms-excel' => [ + 'xls', + 'xlm', + 'xla', + 'xlc', + 'xlt', + 'xlw', + ], + 'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam', + 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb', + 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm', + 'application/vnd.ms-excel.template.macroenabled.12' => 'xltm', + 'application/vnd.ms-fontobject' => 'eot', + 'application/vnd.ms-htmlhelp' => 'chm', + 'application/vnd.ms-ims' => 'ims', + 'application/vnd.ms-lrm' => 'lrm', + 'application/vnd.ms-officetheme' => 'thmx', + 'application/vnd.ms-pki.seccat' => 'cat', + 'application/vnd.ms-pki.stl' => 'stl', + 'application/vnd.ms-powerpoint' => ['ppt', 'pps', 'pot'], + 'application/vnd.ms-powerpoint.addin.macroenabled.12' => 'ppam', + 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 'pptm', + 'application/vnd.ms-powerpoint.slide.macroenabled.12' => 'sldm', + 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 'ppsm', + 'application/vnd.ms-powerpoint.template.macroenabled.12' => 'potm', + 'application/vnd.ms-project' => ['mpp', 'mpt'], + 'application/vnd.ms-word.document.macroenabled.12' => 'docm', + 'application/vnd.ms-word.template.macroenabled.12' => 'dotm', + 'application/vnd.ms-works' => ['wps', 'wks', 'wcm', 'wdb'], + 'application/vnd.ms-wpl' => 'wpl', + 'application/vnd.ms-xpsdocument' => 'xps', + 'application/vnd.mseq' => 'mseq', + 'application/vnd.musician' => 'mus', + 'application/vnd.oasis.opendocument.chart' => 'odc', + 'application/vnd.oasis.opendocument.chart-template' => 'otc', + 'application/vnd.oasis.opendocument.database' => 'odb', + 'application/vnd.oasis.opendocument.formula' => 'odf', + 'application/vnd.oasis.opendocument.formula-template' => 'odft', + 'application/vnd.oasis.opendocument.graphics' => 'odg', + 'application/vnd.oasis.opendocument.graphics-template' => 'otg', + 'application/vnd.oasis.opendocument.image' => 'odi', + 'application/vnd.oasis.opendocument.image-template' => 'oti', + 'application/vnd.oasis.opendocument.presentation' => 'odp', + 'application/vnd.oasis.opendocument.presentation-template' => 'otp', + 'application/vnd.oasis.opendocument.spreadsheet' => 'ods', + 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots', + 'application/vnd.oasis.opendocument.text' => 'odt', + 'application/vnd.oasis.opendocument.text-master' => 'odm', + 'application/vnd.oasis.opendocument.text-template' => 'ott', + 'application/vnd.oasis.opendocument.text-web' => 'oth', + 'application/vnd.olpc-sugar' => 'xo', + 'application/vnd.oma.dd2+xml' => 'dd2', + 'application/vnd.openofficeorg.extension' => 'oxt', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx', + 'application/vnd.openxmlformats-officedocument.presentationml.slide' => 'sldx', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx', + 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'potx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'xltx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx', + 'application/vnd.pvi.ptid1' => 'ptid', + 'application/vnd.quark.quarkxpress' => [ + 'qxd', + 'qxt', + 'qwd', + 'qwt', + 'qxl', + 'qxb', + ], + 'application/vnd.realvnc.bed' => 'bed', + 'application/vnd.recordare.musicxml' => 'mxl', + 'application/vnd.recordare.musicxml+xml' => 'musicxml', + 'application/vnd.rig.cryptonote' => 'cryptonote', + 'application/vnd.rim.cod' => 'cod', + 'application/vnd.rn-realmedia' => 'rm', + 'application/vnd.rn-realmedia-vbr' => 'rmvb', + 'application/vnd.route66.link66+xml' => 'link66', + 'application/vnd.sailingtracker.track' => 'st', + 'application/vnd.seemail' => 'see', + 'application/vnd.sema' => 'sema', + 'application/vnd.semd' => 'semd', + 'application/vnd.semf' => 'semf', + 'application/vnd.shana.informed.formdata' => 'ifm', + 'application/vnd.shana.informed.formtemplate' => 'itp', + 'application/vnd.shana.informed.interchange' => 'iif', + 'application/vnd.shana.informed.package' => 'ipk', + 'application/vnd.simtech-mindmapper' => ['twd', 'twds'], + 'application/vnd.smaf' => 'mmf', + 'application/vnd.stepmania.stepchart' => 'sm', + 'application/vnd.sun.xml.calc' => 'sxc', + 'application/vnd.sun.xml.calc.template' => 'stc', + 'application/vnd.sun.xml.draw' => 'sxd', + 'application/vnd.sun.xml.draw.template' => 'std', + 'application/vnd.sun.xml.impress' => 'sxi', + 'application/vnd.sun.xml.impress.template' => 'sti', + 'application/vnd.sun.xml.math' => 'sxm', + 'application/vnd.sun.xml.writer' => 'sxw', + 'application/vnd.sun.xml.writer.global' => 'sxg', + 'application/vnd.sun.xml.writer.template' => 'stw', + 'application/vnd.sus-calendar' => ['sus', 'susp'], + 'application/vnd.svd' => 'svd', + 'application/vnd.symbian.install' => ['sis', 'sisx'], + 'application/vnd.syncml+xml' => 'xsm', + 'application/vnd.syncml.dm+wbxml' => 'bdm', + 'application/vnd.syncml.dm+xml' => 'xdm', + 'application/vnd.tao.intent-module-archive' => 'tao', + 'application/vnd.tcpdump.pcap' => ['pcap', 'cap', 'dmp'], + 'application/vnd.tmobile-livetv' => 'tmo', + 'application/vnd.trid.tpt' => 'tpt', + 'application/vnd.triscape.mxs' => 'mxs', + 'application/vnd.trueapp' => 'tra', + 'application/vnd.ufdl' => ['ufd', 'ufdl'], + 'application/vnd.uiq.theme' => 'utz', + 'application/vnd.umajin' => 'umj', + 'application/vnd.unity' => 'unityweb', + 'application/vnd.uoml+xml' => 'uoml', + 'application/vnd.vcx' => 'vcx', + 'application/vnd.visio' => ['vsd', 'vst', 'vss', 'vsw'], + 'application/vnd.visionary' => 'vis', + 'application/vnd.vsf' => 'vsf', + 'application/vnd.wap.wbxml' => 'wbxml', + 'application/vnd.wap.wmlc' => 'wmlc', + 'application/vnd.wap.wmlscriptc' => 'wmlsc', + 'application/vnd.webturbo' => 'wtb', + 'application/vnd.wolfram.player' => 'nbp', + 'application/vnd.wordperfect' => 'wpd', + 'application/vnd.wqd' => 'wqd', + 'application/vnd.wt.stf' => 'stf', + 'application/vnd.xara' => 'xar', + 'application/vnd.xfdl' => 'xfdl', + 'application/voicexml+xml' => 'vxml', + 'application/widget' => 'wgt', + 'application/winhlp' => 'hlp', + 'application/wsdl+xml' => 'wsdl', + 'application/wspolicy+xml' => 'wspolicy', + 'application/x-7z-compressed' => '7z', + 'application/x-bittorrent' => 'torrent', + 'application/x-blorb' => ['blb', 'blorb'], + 'application/x-bzip' => 'bz', + 'application/x-cdlink' => 'vcd', + 'application/x-cfs-compressed' => 'cfs', + 'application/x-chat' => 'chat', + 'application/x-chess-pgn' => 'pgn', + 'application/x-conference' => 'nsc', + 'application/x-cpio' => 'cpio', + 'application/x-csh' => 'csh', + 'application/x-debian-package' => ['deb', 'udeb'], + 'application/x-dgc-compressed' => 'dgc', + 'application/x-director' => [ + 'dir', + 'dcr', + 'dxr', + 'cst', + 'cct', + 'cxt', + 'w3d', + 'fgd', + 'swa', + ], + 'application/x-font-ttf' => ['ttf', 'ttc'], + 'application/x-font-type1' => ['pfa', 'pfb', 'pfm', 'afm'], + 'application/x-font-woff' => 'woff', + 'application/x-freearc' => 'arc', + 'application/x-futuresplash' => 'spl', + 'application/x-gca-compressed' => 'gca', + 'application/x-glulx' => 'ulx', + 'application/x-gnumeric' => 'gnumeric', + 'application/x-gramps-xml' => 'gramps', + 'application/x-gtar' => 'gtar', + 'application/x-hdf' => 'hdf', + 'application/x-install-instructions' => 'install', + 'application/x-iso9660-image' => 'iso', + 'application/x-java-jnlp-file' => 'jnlp', + 'application/x-latex' => 'latex', + 'application/x-lzh-compressed' => ['lzh', 'lha'], + 'application/x-mie' => 'mie', + 'application/x-mobipocket-ebook' => ['prc', 'mobi'], + 'application/x-ms-application' => 'application', + 'application/x-ms-shortcut' => 'lnk', + 'application/x-ms-wmd' => 'wmd', + 'application/x-ms-wmz' => 'wmz', + 'application/x-ms-xbap' => 'xbap', + 'application/x-msaccess' => 'mdb', + 'application/x-msbinder' => 'obd', + 'application/x-mscardfile' => 'crd', + 'application/x-msclip' => 'clp', + 'application/x-msdownload' => ['exe', 'dll', 'com', 'bat', 'msi'], + 'application/x-msmediaview' => [ + 'mvb', + 'm13', + 'm14', + ], + 'application/x-msmetafile' => ['wmf', 'wmz', 'emf', 'emz'], + 'application/x-rar-compressed' => 'rar', + 'application/x-research-info-systems' => 'ris', + 'application/x-sh' => 'sh', + 'application/x-shar' => 'shar', + 'application/x-shockwave-flash' => 'swf', + 'application/x-silverlight-app' => 'xap', + 'application/x-sql' => 'sql', + 'application/x-stuffit' => 'sit', + 'application/x-stuffitx' => 'sitx', + 'application/x-subrip' => 'srt', + 'application/x-sv4cpio' => 'sv4cpio', + 'application/x-sv4crc' => 'sv4crc', + 'application/x-t3vm-image' => 't3', + 'application/x-tads' => 'gam', + 'application/x-tar' => 'tar', + 'application/x-tcl' => 'tcl', + 'application/x-tex' => 'tex', + 'application/x-tex-tfm' => 'tfm', + 'application/x-texinfo' => ['texinfo', 'texi'], + 'application/x-tgif' => 'obj', + 'application/x-ustar' => 'ustar', + 'application/x-wais-source' => 'src', + 'application/x-x509-ca-cert' => ['der', 'crt'], + 'application/x-xfig' => 'fig', + 'application/x-xliff+xml' => 'xlf', + 'application/x-xpinstall' => 'xpi', + 'application/x-xz' => 'xz', + 'application/x-zmachine' => 'z1', + 'application/xaml+xml' => 'xaml', + 'application/xcap-diff+xml' => 'xdf', + 'application/xenc+xml' => 'xenc', + 'application/xhtml+xml' => ['xhtml', 'xht'], + 'application/xml' => ['xml', 'xsl'], + 'application/xml-dtd' => 'dtd', + 'application/xop+xml' => 'xop', + 'application/xproc+xml' => 'xpl', + 'application/xslt+xml' => 'xslt', + 'application/xspf+xml' => 'xspf', + 'application/xv+xml' => ['mxml', 'xhvml', 'xvml', 'xvm'], + 'application/yang' => 'yang', + 'application/yin+xml' => 'yin', + 'application/zip' => 'zip', + 'audio/adpcm' => 'adp', + 'audio/basic' => ['au', 'snd'], + 'audio/midi' => ['mid', 'midi', 'kar', 'rmi'], + 'audio/mp4' => 'mp4a', + 'audio/mpeg' => [ + 'mpga', + 'mp2', + 'mp2a', + 'mp3', + 'm2a', + 'm3a', + ], + 'audio/ogg' => ['oga', 'ogg', 'spx'], + 'audio/vnd.dece.audio' => ['uva', 'uvva'], + 'audio/vnd.rip' => 'rip', + 'audio/webm' => 'weba', + 'audio/x-aac' => 'aac', + 'audio/x-aiff' => ['aif', 'aiff', 'aifc'], + 'audio/x-caf' => 'caf', + 'audio/x-flac' => 'flac', + 'audio/x-matroska' => 'mka', + 'audio/x-mpegurl' => 'm3u', + 'audio/x-ms-wax' => 'wax', + 'audio/x-ms-wma' => 'wma', + 'audio/x-pn-realaudio' => ['ram', 'ra'], + 'audio/x-pn-realaudio-plugin' => 'rmp', + 'audio/x-wav' => 'wav', + 'audio/xm' => 'xm', + 'image/bmp' => 'bmp', + 'image/cgm' => 'cgm', + 'image/g3fax' => 'g3', + 'image/gif' => 'gif', + 'image/ief' => 'ief', + 'image/jpeg' => ['jpeg', 'jpg', 'jpe'], + 'image/ktx' => 'ktx', + 'image/png' => 'png', + 'image/prs.btif' => 'btif', + 'image/sgi' => 'sgi', + 'image/svg+xml' => ['svg', 'svgz'], + 'image/tiff' => ['tiff', 'tif'], + 'image/vnd.adobe.photoshop' => 'psd', + 'image/vnd.dece.graphic' => ['uvi', 'uvvi', 'uvg', 'uvvg'], + 'image/vnd.dvb.subtitle' => 'sub', + 'image/vnd.djvu' => ['djvu', 'djv'], + 'image/vnd.dwg' => 'dwg', + 'image/vnd.dxf' => 'dxf', + 'image/vnd.fastbidsheet' => 'fbs', + 'image/vnd.fpx' => 'fpx', + 'image/vnd.fst' => 'fst', + 'image/vnd.fujixerox.edmics-mmr' => 'mmr', + 'image/vnd.fujixerox.edmics-rlc' => 'rlc', + 'image/vnd.ms-modi' => 'mdi', + 'image/vnd.ms-photo' => 'wdp', + 'image/vnd.net-fpx' => 'npx', + 'image/vnd.wap.wbmp' => 'wbmp', + 'image/vnd.xiff' => 'xif', + 'image/webp' => 'webp', + 'image/x-3ds' => '3ds', + 'image/x-cmu-raster' => 'ras', + 'image/x-cmx' => 'cmx', + 'image/x-freehand' => ['fh', 'fhc', 'fh4', 'fh5', 'fh7'], + 'image/x-icon' => 'ico', + 'image/x-mrsid-image' => 'sid', + 'image/x-pcx' => 'pcx', + 'image/x-pict' => ['pic', 'pct'], + 'image/x-portable-anymap' => 'pnm', + 'image/x-portable-bitmap' => 'pbm', + 'image/x-portable-graymap' => 'pgm', + 'image/x-portable-pixmap' => 'ppm', + 'image/x-rgb' => 'rgb', + 'image/x-tga' => 'tga', + 'image/x-xbitmap' => 'xbm', + 'image/x-xpixmap' => 'xpm', + 'image/x-xwindowdump' => 'xwd', + 'message/rfc822' => ['eml', 'mime'], + 'model/iges' => ['igs', 'iges'], + 'model/mesh' => ['msh', 'mesh', 'silo'], + 'model/vnd.collada+xml' => 'dae', + 'model/vnd.dwf' => 'dwf', + 'model/vnd.gdl' => 'gdl', + 'model/vnd.gtw' => 'gtw', + 'model/vnd.mts' => 'mts', + 'model/vnd.vtu' => 'vtu', + 'model/vrml' => ['wrl', 'vrml'], + 'model/x3d+binary' => 'x3db', + 'model/x3d+vrml' => 'x3dv', + 'model/x3d+xml' => 'x3d', + 'text/cache-manifest' => 'appcache', + 'text/calendar' => ['ics', 'ifb'], + 'text/css' => 'css', + 'text/csv' => 'csv', + 'text/html' => ['html', 'htm'], + 'text/n3' => 'n3', + 'text/plain' => [ + 'txt', + 'text', + 'conf', + 'def', + 'list', + 'log', + 'in', + ], + 'text/prs.lines.tag' => 'dsc', + 'text/richtext' => 'rtx', + 'text/sgml' => ['sgml', 'sgm'], + 'text/tab-separated-values' => 'tsv', + 'text/troff' => [ + 't', + 'tr', + 'roff', + 'man', + 'me', + 'ms', + ], + 'text/turtle' => 'ttl', + 'text/uri-list' => ['uri', 'uris', 'urls'], + 'text/vcard' => 'vcard', + 'text/vnd.curl' => 'curl', + 'text/vnd.curl.dcurl' => 'dcurl', + 'text/vnd.curl.scurl' => 'scurl', + 'text/vnd.curl.mcurl' => 'mcurl', + 'text/vnd.dvb.subtitle' => 'sub', + 'text/vnd.fly' => 'fly', + 'text/vnd.fmi.flexstor' => 'flx', + 'text/vnd.graphviz' => 'gv', + 'text/vnd.in3d.3dml' => '3dml', + 'text/vnd.in3d.spot' => 'spot', + 'text/vnd.sun.j2me.app-descriptor' => 'jad', + 'text/vnd.wap.wml' => 'wml', + 'text/vnd.wap.wmlscript' => 'wmls', + 'text/x-asm' => ['s', 'asm'], + 'text/x-fortran' => ['f', 'for', 'f77', 'f90'], + 'text/x-java-source' => 'java', + 'text/x-opml' => 'opml', + 'text/x-pascal' => ['p', 'pas'], + 'text/x-nfo' => 'nfo', + 'text/x-setext' => 'etx', + 'text/x-sfv' => 'sfv', + 'text/x-uuencode' => 'uu', + 'text/x-vcalendar' => 'vcs', + 'text/x-vcard' => 'vcf', + 'video/3gpp' => '3gp', + 'video/3gpp2' => '3g2', + 'video/h261' => 'h261', + 'video/h263' => 'h263', + 'video/h264' => 'h264', + 'video/jpeg' => 'jpgv', + 'video/jpm' => ['jpm', 'jpgm'], + 'video/mj2' => 'mj2', + 'video/mp4' => 'mp4', + 'video/mpeg' => ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'], + 'video/ogg' => 'ogv', + 'video/quicktime' => ['qt', 'mov'], + 'video/vnd.dece.hd' => ['uvh', 'uvvh'], + 'video/vnd.dece.mobile' => ['uvm', 'uvvm'], + 'video/vnd.dece.pd' => ['uvp', 'uvvp'], + 'video/vnd.dece.sd' => ['uvs', 'uvvs'], + 'video/vnd.dece.video' => ['uvv', 'uvvv'], + 'video/vnd.dvb.file' => 'dvb', + 'video/vnd.fvt' => 'fvt', + 'video/vnd.mpegurl' => ['mxu', 'm4u'], + 'video/vnd.ms-playready.media.pyv' => 'pyv', + 'video/vnd.uvvu.mp4' => ['uvu', 'uvvu'], + 'video/vnd.vivo' => 'viv', + 'video/webm' => 'webm', + 'video/x-f4v' => 'f4v', + 'video/x-fli' => 'fli', + 'video/x-flv' => 'flv', + 'video/x-m4v' => 'm4v', + 'video/x-matroska' => ['mkv', 'mk3d', 'mks'], + 'video/x-mng' => 'mng', + 'video/x-ms-asf' => ['asf', 'asx'], + 'video/x-ms-vob' => 'vob', + 'video/x-ms-wm' => 'wm', + 'video/x-ms-wmv' => 'wmv', + 'video/x-ms-wmx' => 'wmx', + 'video/x-ms-wvx' => 'wvx', + 'video/x-msvideo' => 'avi', + 'video/x-sgi-movie' => 'movie', + ]; + + public function mimeType(): string + { + return array_rand($this->mimeTypes, 1); + } + + public function extension(): string + { + $extension = $this->mimeTypes[array_rand($this->mimeTypes, 1)]; + + return is_array($extension) ? $extension[array_rand($extension, 1)] : $extension; + } + + public function filePath(): string + { + return tempnam(sys_get_temp_dir(), 'faker'); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Number.php b/vendor/fakerphp/faker/src/Faker/Core/Number.php new file mode 100644 index 00000000..f7af0c29 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Number.php @@ -0,0 +1,83 @@ += $except) { + ++$result; + } + + return $result; + } + + public function randomDigitNotZero(): int + { + return mt_rand(1, 9); + } + + public function randomFloat(?int $nbMaxDecimals = null, float $min = 0, ?float $max = null): float + { + if (null === $nbMaxDecimals) { + $nbMaxDecimals = $this->randomDigit(); + } + + if (null === $max) { + $max = $this->randomNumber(); + + if ($min > $max) { + $max = $min; + } + } + + if ($min > $max) { + $tmp = $min; + $min = $max; + $max = $tmp; + } + + return round($min + mt_rand() / mt_getrandmax() * ($max - $min), $nbMaxDecimals); + } + + public function randomNumber(int $nbDigits = null, bool $strict = false): int + { + if (null === $nbDigits) { + $nbDigits = $this->randomDigitNotZero(); + } + $max = 10 ** $nbDigits - 1; + + if ($max > mt_getrandmax()) { + throw new \InvalidArgumentException('randomNumber() can only generate numbers up to mt_getrandmax()'); + } + + if ($strict) { + return mt_rand(10 ** ($nbDigits - 1), $max); + } + + return mt_rand(0, $max); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Uuid.php b/vendor/fakerphp/faker/src/Faker/Core/Uuid.php new file mode 100644 index 00000000..7311e287 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Uuid.php @@ -0,0 +1,56 @@ +numberBetween(0, 2147483647) . '#' . $number->numberBetween(0, 2147483647); + + // Hash the seed and convert to a byte array + $val = md5($seed, true); + $byte = array_values(unpack('C16', $val)); + + // extract fields from byte array + $tLo = ($byte[0] << 24) | ($byte[1] << 16) | ($byte[2] << 8) | $byte[3]; + $tMi = ($byte[4] << 8) | $byte[5]; + $tHi = ($byte[6] << 8) | $byte[7]; + $csLo = $byte[9]; + $csHi = $byte[8] & 0x3f | (1 << 7); + + // correct byte order for big edian architecture + if (pack('L', 0x6162797A) == pack('N', 0x6162797A)) { + $tLo = (($tLo & 0x000000ff) << 24) | (($tLo & 0x0000ff00) << 8) + | (($tLo & 0x00ff0000) >> 8) | (($tLo & 0xff000000) >> 24); + $tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8); + $tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8); + } + + // apply version number + $tHi &= 0x0fff; + $tHi |= (3 << 12); + + // cast to string + return sprintf( + '%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x', + $tLo, + $tMi, + $tHi, + $csHi, + $csLo, + $byte[10], + $byte[11], + $byte[12], + $byte[13], + $byte[14], + $byte[15] + ); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Version.php b/vendor/fakerphp/faker/src/Faker/Core/Version.php new file mode 100644 index 00000000..66dcdfe8 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Version.php @@ -0,0 +1,60 @@ +semverPreReleaseIdentifier() : '', + $build && mt_rand(0, 1) ? '+' . $this->semverBuildIdentifier() : '' + ); + } + + /** + * Common pre-release identifier + */ + private function semverPreReleaseIdentifier(): string + { + $ident = Helper::randomElement($this->semverCommonPreReleaseIdentifiers); + + if (!mt_rand(0, 1)) { + return $ident; + } + + return $ident . '.' . mt_rand(1, 99); + } + + /** + * Common random build identifier + */ + private function semverBuildIdentifier(): string + { + if (mt_rand(0, 1)) { + // short git revision syntax: https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection + return substr(sha1(Helper::lexify('??????')), 0, 7); + } + + // date syntax + return DateTime::date('YmdHis'); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/DefaultGenerator.php b/vendor/fakerphp/faker/src/Faker/DefaultGenerator.php new file mode 100644 index 00000000..688f4766 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/DefaultGenerator.php @@ -0,0 +1,49 @@ +default = $default; + } + + public function ext() + { + return $this; + } + + /** + * @param string $attribute + * + * @deprecated Use a method instead. + */ + public function __get($attribute) + { + trigger_deprecation('fakerphp/faker', '1.14', 'Accessing property "%s" is deprecated, use "%s()" instead.', $attribute, $attribute); + + return $this->default; + } + + /** + * @param string $method + * @param array $attributes + */ + public function __call($method, $attributes) + { + return $this->default; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Documentor.php b/vendor/fakerphp/faker/src/Faker/Documentor.php new file mode 100644 index 00000000..280b8320 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Documentor.php @@ -0,0 +1,70 @@ +generator = $generator; + } + + /** + * @return array + */ + public function getFormatters() + { + $formatters = []; + $providers = array_reverse($this->generator->getProviders()); + $providers[] = new Provider\Base($this->generator); + + foreach ($providers as $provider) { + $providerClass = get_class($provider); + $formatters[$providerClass] = []; + $refl = new \ReflectionObject($provider); + + foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflmethod) { + if ($reflmethod->getDeclaringClass()->getName() == 'Faker\Provider\Base' && $providerClass != 'Faker\Provider\Base') { + continue; + } + $methodName = $reflmethod->name; + + if ($reflmethod->isConstructor()) { + continue; + } + $parameters = []; + + foreach ($reflmethod->getParameters() as $reflparameter) { + $parameter = '$' . $reflparameter->getName(); + + if ($reflparameter->isDefaultValueAvailable()) { + $parameter .= ' = ' . var_export($reflparameter->getDefaultValue(), true); + } + $parameters[] = $parameter; + } + $parameters = $parameters ? '(' . implode(', ', $parameters) . ')' : ''; + + try { + $example = $this->generator->format($methodName); + } catch (\InvalidArgumentException $e) { + $example = ''; + } + + if (is_array($example)) { + $example = "array('" . implode("', '", $example) . "')"; + } elseif ($example instanceof \DateTime) { + $example = "DateTime('" . $example->format('Y-m-d H:i:s') . "')"; + } elseif ($example instanceof Generator || $example instanceof UniqueGenerator) { // modifier + $example = ''; + } else { + $example = var_export($example, true); + } + $formatters[$providerClass][$methodName . $parameters] = $example; + } + } + + return $formatters; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Extension/AddressExtension.php b/vendor/fakerphp/faker/src/Faker/Extension/AddressExtension.php new file mode 100644 index 00000000..568ca377 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Extension/AddressExtension.php @@ -0,0 +1,39 @@ + + */ + private $definitions; + + private $services = []; + + /** + * Create a container object with a set of definitions. The array value MUST + * produce an object that implements Extension. + * + * @param array $definitions + */ + public function __construct(array $definitions) + { + $this->definitions = $definitions; + } + + /** + * @param string $id + * + * @throws \InvalidArgumentException + * @throws \RuntimeException + * @throws ContainerException + * @throws NotInContainerException + * + * @return Extension + */ + public function get($id) + { + if (!is_string($id)) { + throw new \InvalidArgumentException(sprintf( + 'First argument of %s::get() must be string', + self::class + )); + } + + if (array_key_exists($id, $this->services)) { + return $this->services[$id]; + } + + if (!$this->has($id)) { + throw new NotInContainerException(sprintf( + 'There is not service with id "%s" in the container.', + $id + )); + } + + $definition = $this->definitions[$id]; + + if (is_callable($definition)) { + try { + $service = $definition(); + } catch (\Throwable $e) { + throw new ContainerException( + sprintf( + 'Error while invoking callable for "%s"', + $id + ), + 0, + $e + ); + } + } elseif (is_object($definition)) { + $service = $definition; + } elseif (is_string($definition)) { + if (!class_exists($definition)) { + throw new ContainerException(sprintf( + 'Could not instantiate class "%s". Class was not found.', + $id + )); + } + + try { + $service = new $definition(); + } catch (\Throwable $e) { + throw new ContainerException( + sprintf( + 'Could not instantiate class "%s"', + $id + ), + 0, + $e + ); + } + } else { + throw new ContainerException(sprintf( + 'Invalid type for definition with id "%s"', + $id + )); + } + + if (!$service instanceof Extension) { + throw new \RuntimeException(sprintf( + 'Service resolved for identifier "%s" does not implement the %s" interface.', + $id, + Extension::class + )); + } + + $this->services[$id] = $service; + + return $service; + } + + /** + * @param string $id + * + * @throws \InvalidArgumentException + */ + public function has($id): bool + { + if (!is_string($id)) { + throw new \InvalidArgumentException(sprintf( + 'First argument of %s::get() must be string', + self::class + )); + } + + return array_key_exists($id, $this->definitions); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Extension/ContainerBuilder.php b/vendor/fakerphp/faker/src/Faker/Extension/ContainerBuilder.php new file mode 100644 index 00000000..954f52d2 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Extension/ContainerBuilder.php @@ -0,0 +1,84 @@ + + */ + private $definitions = []; + + /** + * @param callable|object|string $value + * + * @throws \InvalidArgumentException + */ + public function add($value, string $name = null): self + { + if (!is_string($value) && !is_callable($value) && !is_object($value)) { + throw new \InvalidArgumentException(sprintf( + 'First argument to "%s::add()" must be a string, callable or object.', + self::class + )); + } + + if ($name === null) { + if (is_string($value)) { + $name = $value; + } elseif (is_object($value)) { + $name = get_class($value); + } else { + throw new \InvalidArgumentException(sprintf( + 'Second argument to "%s::add()" is required not passing a string or object as first argument', + self::class + )); + } + } + + $this->definitions[$name] = $value; + + return $this; + } + + public function build(): ContainerInterface + { + return new Container($this->definitions); + } + + /** + * Get an array with extension that represent the default English + * functionality. + */ + public static function defaultExtensions(): array + { + return [ + BarcodeExtension::class => Core\Barcode::class, + BloodExtension::class => Core\Blood::class, + ColorExtension::class => Core\Color::class, + FileExtension::class => Core\File::class, + NumberExtension::class => Core\Number::class, + VersionExtension::class => Core\Version::class, + UuidExtension::class => Core\Uuid::class, + ]; + } + + public static function getDefault(): ContainerInterface + { + $instance = new self(); + + foreach (self::defaultExtensions() as $id => $definition) { + $instance->add($definition, $id); + } + + return $instance->build(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Extension/ContainerException.php b/vendor/fakerphp/faker/src/Faker/Extension/ContainerException.php new file mode 100644 index 00000000..b26552cd --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Extension/ContainerException.php @@ -0,0 +1,14 @@ +generator = $generator; + + return $instance; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Extension/Helper.php b/vendor/fakerphp/faker/src/Faker/Extension/Helper.php new file mode 100644 index 00000000..2820474c --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Extension/Helper.php @@ -0,0 +1,108 @@ +addProvider(new $providerClassName($generator)); + } + + return $generator; + } + + /** + * @param string $provider + * @param string $locale + * + * @return string + */ + protected static function getProviderClassname($provider, $locale = '') + { + if ($providerClass = self::findProviderClassname($provider, $locale)) { + return $providerClass; + } + // fallback to default locale + if ($providerClass = self::findProviderClassname($provider, static::DEFAULT_LOCALE)) { + return $providerClass; + } + // fallback to no locale + if ($providerClass = self::findProviderClassname($provider)) { + return $providerClass; + } + + throw new \InvalidArgumentException(sprintf('Unable to find provider "%s" with locale "%s"', $provider, $locale)); + } + + /** + * @param string $provider + * @param string $locale + * + * @return string|null + */ + protected static function findProviderClassname($provider, $locale = '') + { + $providerClass = 'Faker\\' . ($locale ? sprintf('Provider\%s\%s', $locale, $provider) : sprintf('Provider\%s', $provider)); + + if (class_exists($providerClass, true)) { + return $providerClass; + } + + return null; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Generator.php b/vendor/fakerphp/faker/src/Faker/Generator.php new file mode 100644 index 00000000..c0a907f7 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Generator.php @@ -0,0 +1,965 @@ +container = $container ?: Extension\ContainerBuilder::getDefault(); + } + + /** + * @template T of Extension\Extension + * + * @param class-string $id + * + * @throws Extension\ExtensionNotFound + * + * @return T + */ + public function ext(string $id): Extension\Extension + { + if (!$this->container->has($id)) { + throw new Extension\ExtensionNotFound(sprintf( + 'No Faker extension with id "%s" was loaded.', + $id + )); + } + + $extension = $this->container->get($id); + + if ($extension instanceof Extension\GeneratorAwareExtension) { + $extension = $extension->withGenerator($this); + } + + return $extension; + } + + public function addProvider($provider) + { + array_unshift($this->providers, $provider); + + $this->formatters = []; + } + + public function getProviders() + { + return $this->providers; + } + + /** + * With the unique generator you are guaranteed to never get the same two + * values. + * + * + * // will never return twice the same value + * $faker->unique()->randomElement(array(1, 2, 3)); + * + * + * @param bool $reset If set to true, resets the list of existing values + * @param int $maxRetries Maximum number of retries to find a unique value, + * After which an OverflowException is thrown. + * + * @throws \OverflowException When no unique value can be found by iterating $maxRetries times + * + * @return self A proxy class returning only non-existing values + */ + public function unique($reset = false, $maxRetries = 10000) + { + if ($reset || $this->uniqueGenerator === null) { + $this->uniqueGenerator = new UniqueGenerator($this, $maxRetries); + } + + return $this->uniqueGenerator; + } + + /** + * Get a value only some percentage of the time. + * + * @param float $weight A probability between 0 and 1, 0 means that we always get the default value. + * + * @return self + */ + public function optional(float $weight = 0.5, $default = null) + { + if ($weight > 1) { + trigger_deprecation('fakerphp/faker', '1.16', 'First argument ($weight) to method "optional()" must be between 0 and 1. You passed %f, we assume you meant %f.', $weight, $weight / 100); + $weight = $weight / 100; + } + + return new ChanceGenerator($this, $weight, $default); + } + + /** + * To make sure the value meet some criteria, pass a callable that verifies the + * output. If the validator fails, the generator will try again. + * + * The value validity is determined by a function passed as first argument. + * + * + * $values = array(); + * $evenValidator = function ($digit) { + * return $digit % 2 === 0; + * }; + * for ($i=0; $i < 10; $i++) { + * $values []= $faker->valid($evenValidator)->randomDigit; + * } + * print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6] + * + * + * @param ?\Closure $validator A function returning true for valid values + * @param int $maxRetries Maximum number of retries to find a valid value, + * After which an OverflowException is thrown. + * + * @throws \OverflowException When no valid value can be found by iterating $maxRetries times + * + * @return self A proxy class returning only valid values + */ + public function valid(?\Closure $validator = null, int $maxRetries = 10000) + { + return new ValidGenerator($this, $validator, $maxRetries); + } + + public function seed($seed = null) + { + if ($seed === null) { + mt_srand(); + } else { + mt_srand((int) $seed, MT_RAND_PHP); + } + } + + public function format($format, $arguments = []) + { + return call_user_func_array($this->getFormatter($format), $arguments); + } + + /** + * @param string $format + * + * @return callable + */ + public function getFormatter($format) + { + if (isset($this->formatters[$format])) { + return $this->formatters[$format]; + } + + if (method_exists($this, $format)) { + $this->formatters[$format] = [$this, $format]; + + return $this->formatters[$format]; + } + + // "Faker\Core\Barcode->ean13" + if (preg_match('|^([a-zA-Z0-9\\\]+)->([a-zA-Z0-9]+)$|', $format, $matches)) { + $this->formatters[$format] = [$this->ext($matches[1]), $matches[2]]; + + return $this->formatters[$format]; + } + + foreach ($this->providers as $provider) { + if (method_exists($provider, $format)) { + $this->formatters[$format] = [$provider, $format]; + + return $this->formatters[$format]; + } + } + + throw new \InvalidArgumentException(sprintf('Unknown format "%s"', $format)); + } + + /** + * Replaces tokens ('{{ tokenName }}') with the result from the token method call + * + * @param string $string String that needs to bet parsed + * + * @return string + */ + public function parse($string) + { + $callback = function ($matches) { + return $this->format($matches[1]); + }; + + return preg_replace_callback('/{{\s?(\w+|[\w\\\]+->\w+?)\s?}}/u', $callback, $string); + } + + /** + * Get a random MIME type + * + * @example 'video/avi' + */ + public function mimeType() + { + return $this->ext(Extension\FileExtension::class)->mimeType(); + } + + /** + * Get a random file extension (without a dot) + * + * @example avi + */ + public function fileExtension() + { + return $this->ext(Extension\FileExtension::class)->extension(); + } + + /** + * Get a full path to a new real file on the system. + */ + public function filePath() + { + return $this->ext(Extension\FileExtension::class)->filePath(); + } + + /** + * Get an actual blood type + * + * @example 'AB' + */ + public function bloodType(): string + { + return $this->ext(Extension\BloodExtension::class)->bloodType(); + } + + /** + * Get a random resis value + * + * @example '+' + */ + public function bloodRh(): string + { + return $this->ext(Extension\BloodExtension::class)->bloodRh(); + } + + /** + * Get a full blood group + * + * @example 'AB+' + */ + public function bloodGroup(): string + { + return $this->ext(Extension\BloodExtension::class)->bloodGroup(); + } + + /** + * Get a random EAN13 barcode. + * + * @example '4006381333931' + */ + public function ean13(): string + { + return $this->ext(Extension\BarcodeExtension::class)->ean13(); + } + + /** + * Get a random EAN8 barcode. + * + * @example '73513537' + */ + public function ean8(): string + { + return $this->ext(Extension\BarcodeExtension::class)->ean8(); + } + + /** + * Get a random ISBN-10 code + * + * @see http://en.wikipedia.org/wiki/International_Standard_Book_Number + * + * @example '4881416324' + */ + public function isbn10(): string + { + return $this->ext(Extension\BarcodeExtension::class)->isbn10(); + } + + /** + * Get a random ISBN-13 code + * + * @see http://en.wikipedia.org/wiki/International_Standard_Book_Number + * + * @example '9790404436093' + */ + public function isbn13(): string + { + return $this->ext(Extension\BarcodeExtension::class)->isbn13(); + } + + /** + * Returns a random number between $int1 and $int2 (any order) + * + * @example 79907610 + */ + public function numberBetween($int1 = 0, $int2 = 2147483647): int + { + return $this->ext(Extension\NumberExtension::class)->numberBetween((int) $int1, (int) $int2); + } + + /** + * Returns a random number between 0 and 9 + */ + public function randomDigit(): int + { + return $this->ext(Extension\NumberExtension::class)->randomDigit(); + } + + /** + * Generates a random digit, which cannot be $except + */ + public function randomDigitNot($except): int + { + return $this->ext(Extension\NumberExtension::class)->randomDigitNot((int) $except); + } + + /** + * Returns a random number between 1 and 9 + */ + public function randomDigitNotZero(): int + { + return $this->ext(Extension\NumberExtension::class)->randomDigitNotZero(); + } + + /** + * Return a random float number + * + * @example 48.8932 + */ + public function randomFloat($nbMaxDecimals = null, $min = 0, $max = null): float + { + return $this->ext(Extension\NumberExtension::class)->randomFloat( + $nbMaxDecimals !== null ? (int) $nbMaxDecimals : null, + (float) $min, + $max !== null ? (float) $max : null + ); + } + + /** + * Returns a random integer with 0 to $nbDigits digits. + * + * The maximum value returned is mt_getrandmax() + * + * @param int|null $nbDigits Defaults to a random number between 1 and 9 + * @param bool $strict Whether the returned number should have exactly $nbDigits + * + * @example 79907610 + */ + public function randomNumber($nbDigits = null, $strict = false): int + { + return $this->ext(Extension\NumberExtension::class)->randomNumber( + $nbDigits !== null ? (int) $nbDigits : null, + (bool) $strict + ); + } + + /** + * Get a version number in semantic versioning syntax 2.0.0. (https://semver.org/spec/v2.0.0.html) + * + * @param bool $preRelease Pre release parts may be randomly included + * @param bool $build Build parts may be randomly included + * + * @example 1.0.0 + * @example 1.0.0-alpha.1 + * @example 1.0.0-alpha.1+b71f04d + */ + public function semver(bool $preRelease = false, bool $build = false): string + { + return $this->ext(Extension\VersionExtension::class)->semver($preRelease, $build); + } + + /** + * @deprecated + */ + protected function callFormatWithMatches($matches) + { + trigger_deprecation('fakerphp/faker', '1.14', 'Protected method "callFormatWithMatches()" is deprecated and will be removed.'); + + return $this->format($matches[1]); + } + + /** + * @param string $attribute + * + * @deprecated Use a method instead. + */ + public function __get($attribute) + { + trigger_deprecation('fakerphp/faker', '1.14', 'Accessing property "%s" is deprecated, use "%s()" instead.', $attribute, $attribute); + + return $this->format($attribute); + } + + /** + * @param string $method + * @param array $attributes + */ + public function __call($method, $attributes) + { + return $this->format($method, $attributes); + } + + public function __destruct() + { + $this->seed(); + } + + public function __wakeup() + { + $this->formatters = []; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Guesser/Name.php b/vendor/fakerphp/faker/src/Faker/Guesser/Name.php new file mode 100644 index 00000000..ddb048bc --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Guesser/Name.php @@ -0,0 +1,180 @@ +generator = $generator; + } + + /** + * @param string $name + * @param int|null $size Length of field, if known + * + * @return callable|null + */ + public function guessFormat($name, $size = null) + { + $name = Base::toLower($name); + $generator = $this->generator; + + if (preg_match('/^is[_A-Z]/', $name)) { + return static function () use ($generator) { + return $generator->boolean; + }; + } + + if (preg_match('/(_a|A)t$/', $name)) { + return static function () use ($generator) { + return $generator->dateTime; + }; + } + + switch (str_replace('_', '', $name)) { + case 'firstname': + return static function () use ($generator) { + return $generator->firstName; + }; + + case 'lastname': + return static function () use ($generator) { + return $generator->lastName; + }; + + case 'username': + case 'login': + return static function () use ($generator) { + return $generator->userName; + }; + + case 'email': + case 'emailaddress': + return static function () use ($generator) { + return $generator->email; + }; + + case 'phonenumber': + case 'phone': + case 'telephone': + case 'telnumber': + return static function () use ($generator) { + return $generator->phoneNumber; + }; + + case 'address': + return static function () use ($generator) { + return $generator->address; + }; + + case 'city': + case 'town': + return static function () use ($generator) { + return $generator->city; + }; + + case 'streetaddress': + return static function () use ($generator) { + return $generator->streetAddress; + }; + + case 'postcode': + case 'zipcode': + return static function () use ($generator) { + return $generator->postcode; + }; + + case 'state': + return static function () use ($generator) { + return $generator->state; + }; + + case 'county': + if ($this->generator->locale == 'en_US') { + return static function () use ($generator) { + return sprintf('%s County', $generator->city); + }; + } + + return static function () use ($generator) { + return $generator->state; + }; + + case 'country': + switch ($size) { + case 2: + return static function () use ($generator) { + return $generator->countryCode; + }; + + case 3: + return static function () use ($generator) { + return $generator->countryISOAlpha3; + }; + + case 5: + case 6: + return static function () use ($generator) { + return $generator->locale; + }; + + default: + return static function () use ($generator) { + return $generator->country; + }; + } + + break; + + case 'locale': + return static function () use ($generator) { + return $generator->locale; + }; + + case 'currency': + case 'currencycode': + return static function () use ($generator) { + return $generator->currencyCode; + }; + + case 'url': + case 'website': + return static function () use ($generator) { + return $generator->url; + }; + + case 'company': + case 'companyname': + case 'employer': + return static function () use ($generator) { + return $generator->company; + }; + + case 'title': + if ($size !== null && $size <= 10) { + return static function () use ($generator) { + return $generator->title; + }; + } + + return static function () use ($generator) { + return $generator->sentence; + }; + + case 'body': + case 'summary': + case 'article': + case 'description': + return static function () use ($generator) { + return $generator->text; + }; + } + + return null; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php b/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php new file mode 100644 index 00000000..c2a30e67 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php @@ -0,0 +1,79 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat($column, $table) + { + $generator = $this->generator; + $schema = $table->schema(); + + switch ($schema->columnType($column)) { + case 'boolean': + return static function () use ($generator) { + return $generator->boolean; + }; + + case 'integer': + return static function () use ($generator) { + return $generator->numberBetween(0, 2147483647); + }; + + case 'biginteger': + return static function () use ($generator) { + return $generator->numberBetween(0, PHP_INT_MAX); + }; + + case 'decimal': + case 'float': + return static function () use ($generator) { + return $generator->randomFloat(); + }; + + case 'uuid': + return static function () use ($generator) { + return $generator->uuid(); + }; + + case 'string': + if (method_exists($schema, 'getColumn')) { + $columnData = $schema->getColumn($column); + } else { + $columnData = $schema->column($column); + } + $length = $columnData['length']; + + return static function () use ($generator, $length) { + return $generator->text($length); + }; + + case 'text': + return static function () use ($generator) { + return $generator->text(); + }; + + case 'date': + case 'datetime': + case 'timestamp': + case 'time': + return static function () use ($generator) { + return $generator->datetime(); + }; + + case 'binary': + default: + return null; + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/EntityPopulator.php b/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/EntityPopulator.php new file mode 100644 index 00000000..cd9890bd --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/EntityPopulator.php @@ -0,0 +1,173 @@ +class = $class; + } + + /** + * @param string $name + */ + public function __get($name) + { + return $this->{$name}; + } + + /** + * @param string $name + */ + public function __set($name, $value) + { + $this->{$name} = $value; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @return array + */ + public function guessColumnFormatters($populator) + { + $formatters = []; + $class = $this->class; + $table = $this->getTable($class); + $schema = $table->schema(); + $pk = $schema->primaryKey(); + $guessers = $populator->getGuessers() + ['ColumnTypeGuesser' => new ColumnTypeGuesser($populator->getGenerator())]; + $isForeignKey = static function ($column) use ($table) { + foreach ($table->associations()->type('BelongsTo') as $assoc) { + if ($column == $assoc->foreignKey()) { + return true; + } + } + + return false; + }; + + foreach ($schema->columns() as $column) { + if ($column == $pk[0] || $isForeignKey($column)) { + continue; + } + + foreach ($guessers as $guesser) { + if ($formatter = $guesser->guessFormat($column, $table)) { + $formatters[$column] = $formatter; + + break; + } + } + } + + return $formatters; + } + + /** + * @return array + */ + public function guessModifiers() + { + $modifiers = []; + $table = $this->getTable($this->class); + + $belongsTo = $table->associations()->type('BelongsTo'); + + foreach ($belongsTo as $assoc) { + $modifiers['belongsTo' . $assoc->name()] = function ($data, $insertedEntities) use ($assoc) { + $table = $assoc->target(); + $foreignModel = $table->alias(); + + $foreignKeys = []; + + if (!empty($insertedEntities[$foreignModel])) { + $foreignKeys = $insertedEntities[$foreignModel]; + } else { + $foreignKeys = $table->find('all') + ->select(['id']) + ->map(static function ($row) { + return $row->id; + }) + ->toArray(); + } + + if (empty($foreignKeys)) { + throw new \Exception(sprintf('%s belongsTo %s, which seems empty at this point.', $this->getTable($this->class)->table(), $assoc->table())); + } + + $foreignKey = $foreignKeys[array_rand($foreignKeys)]; + $data[$assoc->foreignKey()] = $foreignKey; + + return $data; + }; + } + + // TODO check if TreeBehavior attached to modify lft/rgt cols + + return $modifiers; + } + + /** + * @param array $options + */ + public function execute($class, $insertedEntities, $options = []) + { + $table = $this->getTable($class); + $entity = $table->newEntity(); + + foreach ($this->columnFormatters as $column => $format) { + if (null !== $format) { + $entity->{$column} = is_callable($format) ? $format($insertedEntities, $table) : $format; + } + } + + foreach ($this->modifiers as $modifier) { + $entity = $modifier($entity, $insertedEntities); + } + + if (!$entity = $table->save($entity, $options)) { + throw new \RuntimeException("Failed saving $class record"); + } + + $pk = $table->primaryKey(); + + if (is_string($pk)) { + return $entity->{$pk}; + } + + return $entity->{$pk[0]}; + } + + public function setConnection($name) + { + $this->connectionName = $name; + } + + protected function getTable($class) + { + $options = []; + + if (!empty($this->connectionName)) { + $options['connection'] = $this->connectionName; + } + + return TableRegistry::get($class, $options); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/Populator.php b/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/Populator.php new file mode 100644 index 00000000..ac195fbd --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/Populator.php @@ -0,0 +1,113 @@ +generator = $generator; + } + + /** + * @return \Faker\Generator + */ + public function getGenerator() + { + return $this->generator; + } + + /** + * @return array + */ + public function getGuessers() + { + return $this->guessers; + } + + /** + * @return $this + */ + public function removeGuesser($name) + { + if ($this->guessers[$name]) { + unset($this->guessers[$name]); + } + + return $this; + } + + /** + * @throws \Exception + * + * @return $this + */ + public function addGuesser($class) + { + if (!is_object($class)) { + $class = new $class($this->generator); + } + + if (!method_exists($class, 'guessFormat')) { + throw new \Exception('Missing required custom guesser method: ' . get_class($class) . '::guessFormat()'); + } + + $this->guessers[get_class($class)] = $class; + + return $this; + } + + /** + * @param array $customColumnFormatters + * @param array $customModifiers + * + * @return $this + */ + public function addEntity($entity, $number, $customColumnFormatters = [], $customModifiers = []) + { + if (!$entity instanceof EntityPopulator) { + $entity = new EntityPopulator($entity); + } + + $entity->columnFormatters = $entity->guessColumnFormatters($this); + + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + + $entity->modifiers = $entity->guessModifiers($this); + + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + + $class = $entity->class; + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + + return $this; + } + + /** + * @param array $options + * + * @return array + */ + public function execute($options = []) + { + $insertedEntities = []; + + foreach ($this->quantities as $class => $number) { + for ($i = 0; $i < $number; ++$i) { + $insertedEntities[$class][] = $this->entities[$class]->execute($class, $insertedEntities, $options); + } + } + + return $insertedEntities; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php new file mode 100644 index 00000000..3267fe46 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php @@ -0,0 +1,91 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat($fieldName, ClassMetadata $class) + { + $generator = $this->generator; + $type = $class->getTypeOfField($fieldName); + + switch ($type) { + case 'boolean': + return static function () use ($generator) { + return $generator->boolean; + }; + + case 'decimal': + $size = $class->fieldMappings[$fieldName]['precision'] ?? 2; + + return static function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + + case 'smallint': + return static function () use ($generator) { + return $generator->numberBetween(0, 65535); + }; + + case 'integer': + return static function () use ($generator) { + return $generator->numberBetween(0, 2147483647); + }; + + case 'bigint': + return static function () use ($generator) { + return $generator->numberBetween(0, PHP_INT_MAX); + }; + + case 'float': + return static function () use ($generator) { + return $generator->randomFloat(); + }; + + case 'string': + $size = $class->fieldMappings[$fieldName]['length'] ?? 255; + + return static function () use ($generator, $size) { + return $generator->text($size); + }; + + case 'text': + return static function () use ($generator) { + return $generator->text; + }; + + case 'datetime': + case 'date': + case 'time': + return static function () use ($generator) { + return $generator->datetime; + }; + + case 'datetime_immutable': + case 'date_immutable': + case 'time_immutable': + return static function () use ($generator) { + return \DateTimeImmutable::createFromMutable($generator->datetime); + }; + + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/EntityPopulator.php b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/EntityPopulator.php new file mode 100644 index 00000000..79d3796b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/EntityPopulator.php @@ -0,0 +1,248 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class->getName(); + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + public function setModifiers(array $modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + public function mergeModifiersWith(array $modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator) + { + $formatters = []; + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + + foreach ($this->class->getFieldNames() as $fieldName) { + if ($this->class->isIdentifier($fieldName) || !$this->class->hasField($fieldName)) { + continue; + } + + $size = $this->class->fieldMappings[$fieldName]['length'] ?? null; + + if ($formatter = $nameGuesser->guessFormat($fieldName, $size)) { + $formatters[$fieldName] = $formatter; + + continue; + } + + if ($formatter = $columnTypeGuesser->guessFormat($fieldName, $this->class)) { + $formatters[$fieldName] = $formatter; + + continue; + } + } + + foreach ($this->class->getAssociationNames() as $assocName) { + if ($this->class->isCollectionValuedAssociation($assocName)) { + continue; + } + + $relatedClass = $this->class->getAssociationTargetClass($assocName); + + $unique = $optional = false; + + if ($this->class instanceof \Doctrine\ORM\Mapping\ClassMetadata) { + $mappings = $this->class->getAssociationMappings(); + + foreach ($mappings as $mapping) { + if ($mapping['targetEntity'] == $relatedClass) { + if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadata::ONE_TO_ONE) { + $unique = true; + $optional = $mapping['joinColumns'][0]['nullable'] ?? false; + + break; + } + } + } + } elseif ($this->class instanceof \Doctrine\ODM\MongoDB\Mapping\ClassMetadata) { + $mappings = $this->class->associationMappings; + + foreach ($mappings as $mapping) { + if ($mapping['targetDocument'] == $relatedClass) { + if ($mapping['type'] == \Doctrine\ODM\MongoDB\Mapping\ClassMetadata::ONE && $mapping['association'] == \Doctrine\ODM\MongoDB\Mapping\ClassMetadata::REFERENCE_ONE) { + $unique = true; + $optional = $mapping['nullable'] ?? false; + + break; + } + } + } + } + + $index = 0; + $formatters[$assocName] = static function ($inserted) use ($relatedClass, &$index, $unique, $optional, $generator) { + if (isset($inserted[$relatedClass])) { + if ($unique) { + $related = null; + + if (isset($inserted[$relatedClass][$index]) || !$optional) { + $related = $inserted[$relatedClass][$index]; + } + + ++$index; + + return $related; + } + + return $generator->randomElement($inserted[$relatedClass]); + } + + return null; + }; + } + + return $formatters; + } + + /** + * Insert one new record using the Entity class. + * + * @param bool $generateId + * + * @return EntityPopulator + */ + public function execute(ObjectManager $manager, $insertedEntities, $generateId = false) + { + $obj = $this->class->newInstance(); + + $this->fillColumns($obj, $insertedEntities); + $this->callMethods($obj, $insertedEntities); + + if ($generateId) { + $idsName = $this->class->getIdentifier(); + + foreach ($idsName as $idName) { + $id = $this->generateId($obj, $idName, $manager); + $this->class->reflFields[$idName]->setValue($obj, $id); + } + } + + $manager->persist($obj); + + return $obj; + } + + private function fillColumns($obj, $insertedEntities) + { + foreach ($this->columnFormatters as $field => $format) { + if (null !== $format) { + // Add some extended debugging information to any errors thrown by the formatter + try { + $value = is_callable($format) ? $format($insertedEntities, $obj) : $format; + } catch (\InvalidArgumentException $ex) { + throw new \InvalidArgumentException(sprintf( + 'Failed to generate a value for %s::%s: %s', + get_class($obj), + $field, + $ex->getMessage() + )); + } + // Try a standard setter if it's available, otherwise fall back on reflection + $setter = sprintf('set%s', ucfirst($field)); + + if (is_callable([$obj, $setter])) { + $obj->$setter($value); + } else { + $this->class->reflFields[$field]->setValue($obj, $value); + } + } + } + } + + private function callMethods($obj, $insertedEntities) + { + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + } + + /** + * @return int + */ + private function generateId($obj, $column, ObjectManager $manager) + { + $repository = $manager->getRepository(get_class($obj)); + $result = $repository->createQueryBuilder('e') + ->select(sprintf('e.%s', $column)) + ->getQuery() + ->execute(); + $ids = array_map('current', $result->toArray()); + + do { + $id = mt_rand(); + } while (in_array($id, $ids, false)); + + return $id; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/Populator.php b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/Populator.php new file mode 100644 index 00000000..893d8566 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/Populator.php @@ -0,0 +1,126 @@ +generator = $generator; + $this->manager = $manager; + $this->batchSize = $batchSize; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Doctrine classname, or a \Faker\ORM\Doctrine\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = [], $customModifiers = [], $generateId = false) + { + if (!$entity instanceof \Faker\ORM\Doctrine\EntityPopulator) { + if (null === $this->manager) { + throw new \InvalidArgumentException('No entity manager passed to Doctrine Populator.'); + } + $entity = new \Faker\ORM\Doctrine\EntityPopulator($this->manager->getClassMetadata($entity)); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->mergeModifiersWith($customModifiers); + $this->generateId[$entity->getClass()] = $generateId; + + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * Please note that large amounts of data will result in more memory usage since the the Populator will return + * all newly created primary keys after executing. + * + * @param ObjectManager|null $entityManager A Doctrine connection object + * + * @return array A list of the inserted PKs + */ + public function execute($entityManager = null) + { + if (null === $entityManager) { + $entityManager = $this->manager; + } + + if (null === $entityManager) { + throw new \InvalidArgumentException('No entity manager passed to Doctrine Populator.'); + } + + $insertedEntities = []; + + foreach ($this->quantities as $class => $number) { + $generateId = $this->generateId[$class]; + + for ($i = 0; $i < $number; ++$i) { + $insertedEntities[$class][] = $this->entities[$class]->execute( + $entityManager, + $insertedEntities, + $generateId + ); + + if (count($insertedEntities) % $this->batchSize === 0) { + $entityManager->flush(); + } + } + $entityManager->flush(); + } + + return $insertedEntities; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/backward-compatibility.php b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/backward-compatibility.php new file mode 100644 index 00000000..6f545f87 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/backward-compatibility.php @@ -0,0 +1,11 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat($field) + { + $generator = $this->generator; + + switch ($field['type']) { + case 'boolean': + return static function () use ($generator) { + return $generator->boolean; + }; + + case 'integer': + return static function () use ($generator) { + return $generator->numberBetween(0, 4294967295); + }; + + case 'float': + return static function () use ($generator) { + return $generator->randomFloat(); + }; + + case 'string': + return static function () use ($generator) { + return $generator->text(255); + }; + + case 'date': + return static function () use ($generator) { + return $generator->dateTime; + }; + + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Mandango/EntityPopulator.php b/vendor/fakerphp/faker/src/Faker/ORM/Mandango/EntityPopulator.php new file mode 100644 index 00000000..515ab7b6 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Mandango/EntityPopulator.php @@ -0,0 +1,123 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator, Mandango $mandango) + { + $formatters = []; + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new \Faker\ORM\Mandango\ColumnTypeGuesser($generator); + + $metadata = $mandango->getMetadata($this->class); + + // fields + foreach ($metadata['fields'] as $fieldName => $field) { + if ($formatter = $nameGuesser->guessFormat($fieldName)) { + $formatters[$fieldName] = $formatter; + + continue; + } + + if ($formatter = $columnTypeGuesser->guessFormat($field)) { + $formatters[$fieldName] = $formatter; + + continue; + } + } + + // references + foreach (array_merge($metadata['referencesOne'], $metadata['referencesMany']) as $referenceName => $reference) { + if (!isset($reference['class'])) { + continue; + } + $referenceClass = $reference['class']; + + $formatters[$referenceName] = static function ($insertedEntities) use ($referenceClass) { + if (isset($insertedEntities[$referenceClass])) { + return Base::randomElement($insertedEntities[$referenceClass]); + } + + return null; + }; + } + + return $formatters; + } + + /** + * Insert one new record using the Entity class. + */ + public function execute(Mandango $mandango, $insertedEntities) + { + $metadata = $mandango->getMetadata($this->class); + + $obj = $mandango->create($this->class); + + foreach ($this->columnFormatters as $column => $format) { + if (null !== $format) { + $value = is_callable($format) ? $format($insertedEntities, $obj) : $format; + + if (isset($metadata['fields'][$column]) + || isset($metadata['referencesOne'][$column])) { + $obj->set($column, $value); + } + + if (isset($metadata['referencesMany'][$column])) { + $adder = 'add' . ucfirst($column); + $obj->$adder($value); + } + } + } + $mandango->persist($obj); + + return $obj; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Mandango/Populator.php b/vendor/fakerphp/faker/src/Faker/ORM/Mandango/Populator.php new file mode 100644 index 00000000..de6c3b81 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Mandango/Populator.php @@ -0,0 +1,63 @@ +generator = $generator; + $this->mandango = $mandango; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = []) + { + if (!$entity instanceof \Faker\ORM\Mandango\EntityPopulator) { + $entity = new \Faker\ORM\Mandango\EntityPopulator($entity); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator, $this->mandango)); + + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @return array A list of the inserted entities. + */ + public function execute() + { + $insertedEntities = []; + + foreach ($this->quantities as $class => $number) { + for ($i = 0; $i < $number; ++$i) { + $insertedEntities[$class][] = $this->entities[$class]->execute($this->mandango, $insertedEntities); + } + } + $this->mandango->flush(); + + return $insertedEntities; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php b/vendor/fakerphp/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php new file mode 100644 index 00000000..2d05230b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php @@ -0,0 +1,109 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat(\ColumnMap $column) + { + $generator = $this->generator; + + if ($column->isTemporal()) { + if ($column->isEpochTemporal()) { + return static function () use ($generator) { + return $generator->dateTime; + }; + } + + return static function () use ($generator) { + return $generator->dateTimeAD; + }; + } + $type = $column->getType(); + + switch ($type) { + case \PropelColumnTypes::BOOLEAN: + case \PropelColumnTypes::BOOLEAN_EMU: + return static function () use ($generator) { + return $generator->boolean; + }; + + case \PropelColumnTypes::NUMERIC: + case \PropelColumnTypes::DECIMAL: + $size = $column->getSize(); + + return static function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + + case \PropelColumnTypes::TINYINT: + return static function () use ($generator) { + return $generator->numberBetween(0, 127); + }; + + case \PropelColumnTypes::SMALLINT: + return static function () use ($generator) { + return $generator->numberBetween(0, 32767); + }; + + case \PropelColumnTypes::INTEGER: + return static function () use ($generator) { + return $generator->numberBetween(0, 2147483647); + }; + + case \PropelColumnTypes::BIGINT: + return static function () use ($generator) { + return $generator->numberBetween(0, PHP_INT_MAX); + }; + + case \PropelColumnTypes::FLOAT: + case \PropelColumnTypes::DOUBLE: + case \PropelColumnTypes::REAL: + return static function () use ($generator) { + return $generator->randomFloat(); + }; + + case \PropelColumnTypes::CHAR: + case \PropelColumnTypes::VARCHAR: + case \PropelColumnTypes::BINARY: + case \PropelColumnTypes::VARBINARY: + $size = $column->getSize(); + + return static function () use ($generator, $size) { + return $generator->text($size); + }; + + case \PropelColumnTypes::LONGVARCHAR: + case \PropelColumnTypes::LONGVARBINARY: + case \PropelColumnTypes::CLOB: + case \PropelColumnTypes::CLOB_EMU: + case \PropelColumnTypes::BLOB: + return static function () use ($generator) { + return $generator->text; + }; + + case \PropelColumnTypes::ENUM: + $valueSet = $column->getValueSet(); + + return static function () use ($generator, $valueSet) { + return $generator->randomElement($valueSet); + }; + + case \PropelColumnTypes::OBJECT: + case \PropelColumnTypes::PHP_ARRAY: + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Propel/EntityPopulator.php b/vendor/fakerphp/faker/src/Faker/ORM/Propel/EntityPopulator.php new file mode 100644 index 00000000..bee659d5 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Propel/EntityPopulator.php @@ -0,0 +1,204 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator) + { + $formatters = []; + $class = $this->class; + $peerClass = $class::PEER; + $tableMap = $peerClass::getTableMap(); + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new \Faker\ORM\Propel\ColumnTypeGuesser($generator); + + foreach ($tableMap->getColumns() as $columnMap) { + // skip behavior columns, handled by modifiers + if ($this->isColumnBehavior($columnMap)) { + continue; + } + + if ($columnMap->isForeignKey()) { + $relatedClass = $columnMap->getRelation()->getForeignTable()->getClassname(); + $formatters[$columnMap->getPhpName()] = static function ($inserted) use ($relatedClass, $generator) { + return isset($inserted[$relatedClass]) ? $generator->randomElement($inserted[$relatedClass]) : null; + }; + + continue; + } + + if ($columnMap->isPrimaryKey()) { + continue; + } + + if ($formatter = $nameGuesser->guessFormat($columnMap->getPhpName(), $columnMap->getSize())) { + $formatters[$columnMap->getPhpName()] = $formatter; + + continue; + } + + if ($formatter = $columnTypeGuesser->guessFormat($columnMap)) { + $formatters[$columnMap->getPhpName()] = $formatter; + + continue; + } + } + + return $formatters; + } + + /** + * @return bool + */ + protected function isColumnBehavior(\ColumnMap $columnMap) + { + foreach ($columnMap->getTable()->getBehaviors() as $name => $params) { + $columnName = Base::toLower($columnMap->getName()); + + switch ($name) { + case 'nested_set': + $columnNames = [$params['left_column'], $params['right_column'], $params['level_column']]; + + if (in_array($columnName, $columnNames, false)) { + return true; + } + + break; + + case 'timestampable': + $columnNames = [$params['create_column'], $params['update_column']]; + + if (in_array($columnName, $columnNames, false)) { + return true; + } + + break; + } + } + + return false; + } + + public function setModifiers($modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @return array + */ + public function guessModifiers(\Faker\Generator $generator) + { + $modifiers = []; + $class = $this->class; + $peerClass = $class::PEER; + $tableMap = $peerClass::getTableMap(); + + foreach ($tableMap->getBehaviors() as $name => $params) { + switch ($name) { + case 'nested_set': + $modifiers['nested_set'] = static function ($obj, $inserted) use ($class, $generator) { + if (isset($inserted[$class])) { + $queryClass = $class . 'Query'; + $parent = $queryClass::create()->findPk($generator->randomElement($inserted[$class])); + $obj->insertAsLastChildOf($parent); + } else { + $obj->makeRoot(); + } + }; + + break; + + case 'sortable': + $modifiers['sortable'] = static function ($obj, $inserted) use ($class, $generator) { + $obj->insertAtRank($generator->numberBetween(1, count($inserted[$class] ?? []) + 1)); + }; + + break; + } + } + + return $modifiers; + } + + /** + * Insert one new record using the Entity class. + */ + public function execute($con, $insertedEntities) + { + $obj = new $this->class(); + + foreach ($this->getColumnFormatters() as $column => $format) { + if (null !== $format) { + $obj->setByName($column, is_callable($format) ? $format($insertedEntities, $obj) : $format); + } + } + + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + $obj->save($con); + + return $obj->getPrimaryKey(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Propel/Populator.php b/vendor/fakerphp/faker/src/Faker/ORM/Propel/Populator.php new file mode 100644 index 00000000..e3d42981 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Propel/Populator.php @@ -0,0 +1,90 @@ +generator = $generator; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = [], $customModifiers = []) + { + if (!$entity instanceof \Faker\ORM\Propel\EntityPopulator) { + $entity = new \Faker\ORM\Propel\EntityPopulator($entity); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->setModifiers($entity->guessModifiers($this->generator)); + + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param PropelPDO $con A Propel connection object + * + * @return array A list of the inserted PKs + */ + public function execute($con = null) + { + if (null === $con) { + $con = $this->getConnection(); + } + $isInstancePoolingEnabled = \Propel::isInstancePoolingEnabled(); + \Propel::disableInstancePooling(); + $insertedEntities = []; + $con->beginTransaction(); + + foreach ($this->quantities as $class => $number) { + for ($i = 0; $i < $number; ++$i) { + $insertedEntities[$class][] = $this->entities[$class]->execute($con, $insertedEntities); + } + } + $con->commit(); + + if ($isInstancePoolingEnabled) { + \Propel::enableInstancePooling(); + } + + return $insertedEntities; + } + + protected function getConnection() + { + // use the first connection available + $class = key($this->entities); + + if (!$class) { + throw new \RuntimeException('No class found from entities. Did you add entities to the Populator ?'); + } + + $peer = $class::PEER; + + return \Propel::getConnection($peer::DATABASE_NAME, \Propel::CONNECTION_WRITE); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php b/vendor/fakerphp/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php new file mode 100644 index 00000000..66e109c7 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php @@ -0,0 +1,112 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat(ColumnMap $column) + { + $generator = $this->generator; + + if ($column->isTemporal()) { + if ($column->getType() == PropelTypes::BU_DATE || $column->getType() == PropelTypes::BU_TIMESTAMP) { + return static function () use ($generator) { + return $generator->dateTime; + }; + } + + return static function () use ($generator) { + return $generator->dateTimeAD; + }; + } + $type = $column->getType(); + + switch ($type) { + case PropelTypes::BOOLEAN: + case PropelTypes::BOOLEAN_EMU: + return static function () use ($generator) { + return $generator->boolean; + }; + + case PropelTypes::NUMERIC: + case PropelTypes::DECIMAL: + $size = $column->getSize(); + + return static function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + + case PropelTypes::TINYINT: + return static function () use ($generator) { + return $generator->numberBetween(0, 127); + }; + + case PropelTypes::SMALLINT: + return static function () use ($generator) { + return $generator->numberBetween(0, 32767); + }; + + case PropelTypes::INTEGER: + return static function () use ($generator) { + return $generator->numberBetween(0, 2147483647); + }; + + case PropelTypes::BIGINT: + return static function () use ($generator) { + return $generator->numberBetween(0, PHP_INT_MAX); + }; + + case PropelTypes::FLOAT: + case PropelTypes::DOUBLE: + case PropelTypes::REAL: + return static function () use ($generator) { + return $generator->randomFloat(); + }; + + case PropelTypes::CHAR: + case PropelTypes::VARCHAR: + case PropelTypes::BINARY: + case PropelTypes::VARBINARY: + $size = $column->getSize(); + + return static function () use ($generator, $size) { + return $generator->text($size); + }; + + case PropelTypes::LONGVARCHAR: + case PropelTypes::LONGVARBINARY: + case PropelTypes::CLOB: + case PropelTypes::CLOB_EMU: + case PropelTypes::BLOB: + return static function () use ($generator) { + return $generator->text; + }; + + case PropelTypes::ENUM: + $valueSet = $column->getValueSet(); + + return static function () use ($generator, $valueSet) { + return $generator->randomElement($valueSet); + }; + + case PropelTypes::OBJECT: + case PropelTypes::PHP_ARRAY: + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Propel2/EntityPopulator.php b/vendor/fakerphp/faker/src/Faker/ORM/Propel2/EntityPopulator.php new file mode 100644 index 00000000..199f4563 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Propel2/EntityPopulator.php @@ -0,0 +1,207 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator) + { + $formatters = []; + $class = $this->class; + $peerClass = $class::TABLE_MAP; + $tableMap = $peerClass::getTableMap(); + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new \Faker\ORM\Propel2\ColumnTypeGuesser($generator); + + foreach ($tableMap->getColumns() as $columnMap) { + // skip behavior columns, handled by modifiers + if ($this->isColumnBehavior($columnMap)) { + continue; + } + + if ($columnMap->isForeignKey()) { + $relatedClass = $columnMap->getRelation()->getForeignTable()->getClassname(); + $formatters[$columnMap->getPhpName()] = static function ($inserted) use ($relatedClass, $generator) { + $relatedClass = trim($relatedClass, '\\'); + + return isset($inserted[$relatedClass]) ? $generator->randomElement($inserted[$relatedClass]) : null; + }; + + continue; + } + + if ($columnMap->isPrimaryKey()) { + continue; + } + + if ($formatter = $nameGuesser->guessFormat($columnMap->getPhpName(), $columnMap->getSize())) { + $formatters[$columnMap->getPhpName()] = $formatter; + + continue; + } + + if ($formatter = $columnTypeGuesser->guessFormat($columnMap)) { + $formatters[$columnMap->getPhpName()] = $formatter; + + continue; + } + } + + return $formatters; + } + + /** + * @return bool + */ + protected function isColumnBehavior(ColumnMap $columnMap) + { + foreach ($columnMap->getTable()->getBehaviors() as $name => $params) { + $columnName = Base::toLower($columnMap->getName()); + + switch ($name) { + case 'nested_set': + $columnNames = [$params['left_column'], $params['right_column'], $params['level_column']]; + + if (in_array($columnName, $columnNames, false)) { + return true; + } + + break; + + case 'timestampable': + $columnNames = [$params['create_column'], $params['update_column']]; + + if (in_array($columnName, $columnNames, false)) { + return true; + } + + break; + } + } + + return false; + } + + public function setModifiers($modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @return array + */ + public function guessModifiers(\Faker\Generator $generator) + { + $modifiers = []; + $class = $this->class; + $peerClass = $class::TABLE_MAP; + $tableMap = $peerClass::getTableMap(); + + foreach ($tableMap->getBehaviors() as $name => $params) { + switch ($name) { + case 'nested_set': + $modifiers['nested_set'] = static function ($obj, $inserted) use ($class, $generator) { + if (isset($inserted[$class])) { + $queryClass = $class . 'Query'; + $parent = $queryClass::create()->findPk($generator->randomElement($inserted[$class])); + $obj->insertAsLastChildOf($parent); + } else { + $obj->makeRoot(); + } + }; + + break; + + case 'sortable': + $modifiers['sortable'] = static function ($obj, $inserted) use ($class, $generator) { + $obj->insertAtRank($generator->numberBetween(1, count($inserted[$class] ?? []) + 1)); + }; + + break; + } + } + + return $modifiers; + } + + /** + * Insert one new record using the Entity class. + */ + public function execute($con, $insertedEntities) + { + $obj = new $this->class(); + + foreach ($this->getColumnFormatters() as $column => $format) { + if (null !== $format) { + $obj->setByName($column, is_callable($format) ? $format($insertedEntities, $obj) : $format); + } + } + + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + $obj->save($con); + + return $obj->getPrimaryKey(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Propel2/Populator.php b/vendor/fakerphp/faker/src/Faker/ORM/Propel2/Populator.php new file mode 100644 index 00000000..7698f80e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Propel2/Populator.php @@ -0,0 +1,93 @@ +generator = $generator; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel2\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = [], $customModifiers = []) + { + if (!$entity instanceof \Faker\ORM\Propel2\EntityPopulator) { + $entity = new \Faker\ORM\Propel2\EntityPopulator($entity); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->setModifiers($entity->guessModifiers($this->generator)); + + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param PropelPDO $con A Propel connection object + * + * @return array A list of the inserted PKs + */ + public function execute($con = null) + { + if (null === $con) { + $con = $this->getConnection(); + } + $isInstancePoolingEnabled = Propel::isInstancePoolingEnabled(); + Propel::disableInstancePooling(); + $insertedEntities = []; + $con->beginTransaction(); + + foreach ($this->quantities as $class => $number) { + for ($i = 0; $i < $number; ++$i) { + $insertedEntities[$class][] = $this->entities[$class]->execute($con, $insertedEntities); + } + } + $con->commit(); + + if ($isInstancePoolingEnabled) { + Propel::enableInstancePooling(); + } + + return $insertedEntities; + } + + protected function getConnection() + { + // use the first connection available + $class = key($this->entities); + + if (!$class) { + throw new \RuntimeException('No class found from entities. Did you add entities to the Populator ?'); + } + + $peer = $class::TABLE_MAP; + + return Propel::getConnection($peer::DATABASE_NAME, ServiceContainerInterface::CONNECTION_WRITE); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php b/vendor/fakerphp/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php new file mode 100644 index 00000000..f06ba048 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php @@ -0,0 +1,84 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat(array $field) + { + $generator = $this->generator; + $type = $field['type']; + + switch ($type) { + case 'boolean': + return static function () use ($generator) { + return $generator->boolean; + }; + + case 'decimal': + $size = $field['precision'] ?? 2; + + return static function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + + case 'smallint': + return static function () use ($generator) { + return $generator->numberBetween(0, 65535); + }; + + case 'integer': + return static function () use ($generator) { + return $generator->numberBetween(0, 2147483647); + }; + + case 'bigint': + return static function () use ($generator) { + return $generator->numberBetween(0, PHP_INT_MAX); + }; + + case 'float': + return static function () use ($generator) { + return $generator->randomFloat(null, 0, 4294967295); + }; + + case 'string': + $size = $field['length'] ?? 255; + + return static function () use ($generator, $size) { + return $generator->text($size); + }; + + case 'text': + return static function () use ($generator) { + return $generator->text; + }; + + case 'datetime': + case 'date': + case 'time': + return static function () use ($generator) { + return $generator->datetime; + }; + + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Spot/EntityPopulator.php b/vendor/fakerphp/faker/src/Faker/ORM/Spot/EntityPopulator.php new file mode 100644 index 00000000..c0afbb7c --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Spot/EntityPopulator.php @@ -0,0 +1,199 @@ +mapper = $mapper; + $this->locator = $locator; + $this->useExistingData = $useExistingData; + } + + /** + * @return string + */ + public function getMapper() + { + return $this->mapper; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + public function setModifiers(array $modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + public function mergeModifiersWith(array $modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @return array + */ + public function guessColumnFormatters(Generator $generator) + { + $formatters = []; + $nameGuesser = new Name($generator); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + $fields = $this->mapper->fields(); + + foreach ($fields as $fieldName => $field) { + if ($field['primary'] === true) { + continue; + } + + if ($formatter = $nameGuesser->guessFormat($fieldName)) { + $formatters[$fieldName] = $formatter; + + continue; + } + + if ($formatter = $columnTypeGuesser->guessFormat($field)) { + $formatters[$fieldName] = $formatter; + + continue; + } + } + $entityName = $this->mapper->entity(); + $entity = $this->mapper->build([]); + $relations = $entityName::relations($this->mapper, $entity); + + foreach ($relations as $relation) { + // We don't need any other relation here. + if ($relation instanceof BelongsTo) { + $fieldName = $relation->localKey(); + $entityName = $relation->entityName(); + $field = $fields[$fieldName]; + $required = $field['required']; + + $locator = $this->locator; + + $formatters[$fieldName] = function ($inserted) use ($required, $entityName, $locator, $generator) { + if (!empty($inserted[$entityName])) { + return $generator->randomElement($inserted[$entityName])->get('id'); + } + + if ($required && $this->useExistingData) { + // We did not add anything like this, but it's required, + // So let's find something existing in DB. + $mapper = $locator->mapper($entityName); + $records = $mapper->all()->limit(self::RELATED_FETCH_COUNT)->toArray(); + + if (empty($records)) { + return null; + } + + return $generator->randomElement($records)['id']; + } + + return null; + }; + } + } + + return $formatters; + } + + /** + * Insert one new record using the Entity class. + * + * @return string + */ + public function execute($insertedEntities) + { + $obj = $this->mapper->build([]); + + $this->fillColumns($obj, $insertedEntities); + $this->callMethods($obj, $insertedEntities); + + $this->mapper->insert($obj); + + return $obj; + } + + private function fillColumns($obj, $insertedEntities) + { + foreach ($this->columnFormatters as $field => $format) { + if (null !== $format) { + $value = is_callable($format) ? $format($insertedEntities, $obj) : $format; + $obj->set($field, $value); + } + } + } + + private function callMethods($obj, $insertedEntities) + { + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Spot/Populator.php b/vendor/fakerphp/faker/src/Faker/ORM/Spot/Populator.php new file mode 100644 index 00000000..67202bb3 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Spot/Populator.php @@ -0,0 +1,89 @@ +generator = $generator; + $this->locator = $locator; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param string $entityName Name of Entity object to generate + * @param int $number The number of entities to populate + * @param array $customColumnFormatters + * @param array $customModifiers + * @param bool $useExistingData Should we use existing rows (e.g. roles) to populate relations? + */ + public function addEntity( + $entityName, + $number, + $customColumnFormatters = [], + $customModifiers = [], + $useExistingData = false + ) { + $mapper = $this->locator->mapper($entityName); + + if (null === $mapper) { + throw new \InvalidArgumentException('No mapper can be found for entity ' . $entityName); + } + $entity = new EntityPopulator($mapper, $this->locator, $useExistingData); + + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->mergeModifiersWith($customModifiers); + + $this->entities[$entityName] = $entity; + $this->quantities[$entityName] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param Locator $locator A Spot locator + * + * @return array A list of the inserted PKs + */ + public function execute($locator = null) + { + if (null === $locator) { + $locator = $this->locator; + } + + if (null === $locator) { + throw new \InvalidArgumentException('No entity manager passed to Spot Populator.'); + } + + $insertedEntities = []; + + foreach ($this->quantities as $entityName => $number) { + for ($i = 0; $i < $number; ++$i) { + $insertedEntities[$entityName][] = $this->entities[$entityName]->execute( + $insertedEntities + ); + } + } + + return $insertedEntities; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/Address.php new file mode 100644 index 00000000..9727497b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Address.php @@ -0,0 +1,166 @@ +generator->parse($format); + } + + /** + * @example 'Crist Parks' + * + * @return string + */ + public function streetName() + { + $format = static::randomElement(static::$streetNameFormats); + + return $this->generator->parse($format); + } + + /** + * @example '791 Crist Parks' + * + * @return string + */ + public function streetAddress() + { + $format = static::randomElement(static::$streetAddressFormats); + + return $this->generator->parse($format); + } + + /** + * @example 86039-9874 + * + * @return string + */ + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + /** + * @example '791 Crist Parks, Sashabury, IL 86039-9874' + * + * @return string + */ + public function address() + { + $format = static::randomElement(static::$addressFormats); + + return $this->generator->parse($format); + } + + /** + * @example 'Japan' + * + * @return string + */ + public static function country() + { + return static::randomElement(static::$country); + } + + /** + * Uses signed degrees format (returns a float number between -90 and 90) + * + * @example '77.147489' + * + * @param float|int $min + * @param float|int $max + * + * @return float + */ + public static function latitude($min = -90, $max = 90) + { + return static::randomFloat(6, $min, $max); + } + + /** + * Uses signed degrees format (returns a float number between -180 and 180) + * + * @example '86.211205' + * + * @param float|int $min + * @param float|int $max + * + * @return float + */ + public static function longitude($min = -180, $max = 180) + { + return static::randomFloat(6, $min, $max); + } + + /** + * @example array('77.147489', '86.211205') + * + * @return float[] + */ + public static function localCoordinates() + { + return [ + 'latitude' => static::latitude(), + 'longitude' => static::longitude(), + ]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Barcode.php b/vendor/fakerphp/faker/src/Faker/Provider/Barcode.php new file mode 100644 index 00000000..0d39a61e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Barcode.php @@ -0,0 +1,107 @@ +ean(13); + } + + /** + * Get a random EAN8 barcode. + * + * @return string + * + * @example '73513537' + */ + public function ean8() + { + return $this->ean(8); + } + + /** + * Get a random ISBN-10 code + * + * @see http://en.wikipedia.org/wiki/International_Standard_Book_Number + * + * @return string + * + * @example '4881416324' + */ + public function isbn10() + { + $code = static::numerify(str_repeat('#', 9)); + + return $code . Isbn::checksum($code); + } + + /** + * Get a random ISBN-13 code + * + * @see http://en.wikipedia.org/wiki/International_Standard_Book_Number + * + * @return string + * + * @example '9790404436093' + */ + public function isbn13() + { + $code = '97' . self::numberBetween(8, 9) . static::numerify(str_repeat('#', 9)); + + return $code . Ean::checksum($code); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Base.php b/vendor/fakerphp/faker/src/Faker/Provider/Base.php new file mode 100644 index 00000000..9086ea55 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Base.php @@ -0,0 +1,661 @@ +generator = $generator; + } + + /** + * Returns a random number between 0 and 9 + * + * @return int + */ + public static function randomDigit() + { + return mt_rand(0, 9); + } + + /** + * Returns a random number between 1 and 9 + * + * @return int + */ + public static function randomDigitNotNull() + { + return mt_rand(1, 9); + } + + /** + * Generates a random digit, which cannot be $except + * + * @param int $except + * + * @return int + */ + public static function randomDigitNot($except) + { + $result = self::numberBetween(0, 8); + + if ($result >= $except) { + ++$result; + } + + return $result; + } + + /** + * Returns a random integer with 0 to $nbDigits digits. + * + * The maximum value returned is mt_getrandmax() + * + * @param int $nbDigits Defaults to a random number between 1 and 9 + * @param bool $strict Whether the returned number should have exactly $nbDigits + * + * @example 79907610 + * + * @return int + */ + public static function randomNumber($nbDigits = null, $strict = false) + { + if (!is_bool($strict)) { + throw new \InvalidArgumentException('randomNumber() generates numbers of fixed width. To generate numbers between two boundaries, use numberBetween() instead.'); + } + + if (null === $nbDigits) { + $nbDigits = static::randomDigitNotNull(); + } + $max = 10 ** $nbDigits - 1; + + if ($max > mt_getrandmax()) { + throw new \InvalidArgumentException('randomNumber() can only generate numbers up to mt_getrandmax()'); + } + + if ($strict) { + return mt_rand(10 ** ($nbDigits - 1), $max); + } + + return mt_rand(0, $max); + } + + /** + * Return a random float number + * + * @param int $nbMaxDecimals + * @param float|int $min + * @param float|int $max + * + * @example 48.8932 + * + * @return float + */ + public static function randomFloat($nbMaxDecimals = null, $min = 0, $max = null) + { + if (null === $nbMaxDecimals) { + $nbMaxDecimals = static::randomDigit(); + } + + if (null === $max) { + $max = static::randomNumber(); + + if ($min > $max) { + $max = $min; + } + } + + if ($min > $max) { + $tmp = $min; + $min = $max; + $max = $tmp; + } + + return round($min + mt_rand() / mt_getrandmax() * ($max - $min), $nbMaxDecimals); + } + + /** + * Returns a random number between $int1 and $int2 (any order) + * + * @param int $int1 default to 0 + * @param int $int2 defaults to 32 bit max integer, ie 2147483647 + * + * @example 79907610 + * + * @return int + */ + public static function numberBetween($int1 = 0, $int2 = 2147483647) + { + $min = $int1 < $int2 ? $int1 : $int2; + $max = $int1 < $int2 ? $int2 : $int1; + + return mt_rand($min, $max); + } + + /** + * Returns the passed value + */ + public static function passthrough($value) + { + return $value; + } + + /** + * Returns a random letter from a to z + * + * @return string + */ + public static function randomLetter() + { + return chr(mt_rand(97, 122)); + } + + /** + * Returns a random ASCII character (excluding accents and special chars) + * + * @return string + */ + public static function randomAscii() + { + return chr(mt_rand(33, 126)); + } + + /** + * Returns randomly ordered subsequence of $count elements from a provided array + * + * @param array $array Array to take elements from. Defaults to a-c + * @param int $count Number of elements to take. + * @param bool $allowDuplicates Allow elements to be picked several times. Defaults to false + * + * @throws \LengthException When requesting more elements than provided + * + * @return array New array with $count elements from $array + */ + public static function randomElements($array = ['a', 'b', 'c'], $count = 1, $allowDuplicates = false) + { + $traversables = []; + + if ($array instanceof \Traversable) { + foreach ($array as $element) { + $traversables[] = $element; + } + } + + $arr = count($traversables) ? $traversables : $array; + + $allKeys = array_keys($arr); + $numKeys = count($allKeys); + + if (!$allowDuplicates && $numKeys < $count) { + throw new \LengthException(sprintf('Cannot get %d elements, only %d in array', $count, $numKeys)); + } + + $highKey = $numKeys - 1; + $keys = $elements = []; + $numElements = 0; + + while ($numElements < $count) { + $num = mt_rand(0, $highKey); + + if (!$allowDuplicates) { + if (isset($keys[$num])) { + continue; + } + $keys[$num] = true; + } + + $elements[] = $arr[$allKeys[$num]]; + ++$numElements; + } + + return $elements; + } + + /** + * Returns a random element from a passed array + * + * @param array $array + */ + public static function randomElement($array = ['a', 'b', 'c']) + { + if (!$array || ($array instanceof \Traversable && !count($array))) { + return null; + } + $elements = static::randomElements($array, 1); + + return $elements[0]; + } + + /** + * Returns a random key from a passed associative array + * + * @param array $array + * + * @return int|string|null + */ + public static function randomKey($array = []) + { + if (!$array) { + return null; + } + $keys = array_keys($array); + + return $keys[mt_rand(0, count($keys) - 1)]; + } + + /** + * Returns a shuffled version of the argument. + * + * This function accepts either an array, or a string. + * + * @example $faker->shuffle([1, 2, 3]); // [2, 1, 3] + * @example $faker->shuffle('hello, world'); // 'rlo,h eold!lw' + * + * @see shuffleArray() + * @see shuffleString() + * + * @param array|string $arg The set to shuffle + * + * @return array|string The shuffled set + */ + public static function shuffle($arg = '') + { + if (is_array($arg)) { + return static::shuffleArray($arg); + } + + if (is_string($arg)) { + return static::shuffleString($arg); + } + + throw new \InvalidArgumentException('shuffle() only supports strings or arrays'); + } + + /** + * Returns a shuffled version of the array. + * + * This function does not mutate the original array. It uses the + * Fisher–Yates algorithm, which is unbiased, together with a Mersenne + * twister random generator. This function is therefore more random than + * PHP's shuffle() function, and it is seedable. + * + * @see http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle + * + * @example $faker->shuffleArray([1, 2, 3]); // [2, 1, 3] + * + * @param array $array The set to shuffle + * + * @return array The shuffled set + */ + public static function shuffleArray($array = []) + { + $shuffledArray = []; + $i = 0; + reset($array); + + foreach ($array as $key => $value) { + if ($i == 0) { + $j = 0; + } else { + $j = mt_rand(0, $i); + } + + if ($j == $i) { + $shuffledArray[] = $value; + } else { + $shuffledArray[] = $shuffledArray[$j]; + $shuffledArray[$j] = $value; + } + ++$i; + } + + return $shuffledArray; + } + + /** + * Returns a shuffled version of the string. + * + * This function does not mutate the original string. It uses the + * Fisher–Yates algorithm, which is unbiased, together with a Mersenne + * twister random generator. This function is therefore more random than + * PHP's shuffle() function, and it is seedable. Additionally, it is + * UTF8 safe if the mb extension is available. + * + * @see http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle + * + * @example $faker->shuffleString('hello, world'); // 'rlo,h eold!lw' + * + * @param string $string The set to shuffle + * @param string $encoding The string encoding (defaults to UTF-8) + * + * @return string The shuffled set + */ + public static function shuffleString($string = '', $encoding = 'UTF-8') + { + if (function_exists('mb_strlen')) { + // UTF8-safe str_split() + $array = []; + $strlen = mb_strlen($string, $encoding); + + for ($i = 0; $i < $strlen; ++$i) { + $array[] = mb_substr($string, $i, 1, $encoding); + } + } else { + $array = str_split($string, 1); + } + + return implode('', static::shuffleArray($array)); + } + + private static function replaceWildcard($string, $wildcard = '#', $callback = 'static::randomDigit') + { + if (($pos = strpos($string, $wildcard)) === false) { + return $string; + } + + for ($i = $pos, $last = strrpos($string, $wildcard, $pos) + 1; $i < $last; ++$i) { + if ($string[$i] === $wildcard) { + $string[$i] = call_user_func($callback); + } + } + + return $string; + } + + /** + * Replaces all hash sign ('#') occurrences with a random number + * Replaces all percentage sign ('%') occurrences with a not null number + * + * @param string $string String that needs to bet parsed + * + * @return string + */ + public static function numerify($string = '###') + { + // instead of using randomDigit() several times, which is slow, + // count the number of hashes and generate once a large number + $toReplace = []; + + if (($pos = strpos($string, '#')) !== false) { + for ($i = $pos, $last = strrpos($string, '#', $pos) + 1; $i < $last; ++$i) { + if ($string[$i] === '#') { + $toReplace[] = $i; + } + } + } + + if ($nbReplacements = count($toReplace)) { + $maxAtOnce = strlen((string) mt_getrandmax()) - 1; + $numbers = ''; + $i = 0; + + while ($i < $nbReplacements) { + $size = min($nbReplacements - $i, $maxAtOnce); + $numbers .= str_pad(static::randomNumber($size), $size, '0', STR_PAD_LEFT); + $i += $size; + } + + for ($i = 0; $i < $nbReplacements; ++$i) { + $string[$toReplace[$i]] = $numbers[$i]; + } + } + $string = self::replaceWildcard($string, '%', 'static::randomDigitNotNull'); + + return $string; + } + + /** + * Replaces all question mark ('?') occurrences with a random letter + * + * @param string $string String that needs to bet parsed + * + * @return string + */ + public static function lexify($string = '????') + { + return self::replaceWildcard($string, '?', 'static::randomLetter'); + } + + /** + * Replaces hash signs ('#') and question marks ('?') with random numbers and letters + * An asterisk ('*') is replaced with either a random number or a random letter + * + * @param string $string String that needs to bet parsed + * + * @return string + */ + public static function bothify($string = '## ??') + { + $string = self::replaceWildcard($string, '*', static function () { + return mt_rand(0, 1) ? '#' : '?'; + }); + + return static::lexify(static::numerify($string)); + } + + /** + * Replaces * signs with random numbers and letters and special characters + * + * @example $faker->asciify(''********'); // "s5'G!uC3" + * + * @param string $string String that needs to bet parsed + * + * @return string + */ + public static function asciify($string = '****') + { + return preg_replace_callback('/\*/u', 'static::randomAscii', $string); + } + + /** + * Transforms a basic regular expression into a random string satisfying the expression. + * + * @example $faker->regexify('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'); // sm0@y8k96a.ej + * + * Regex delimiters '/.../' and begin/end markers '^...$' are ignored. + * + * Only supports a small subset of the regex syntax. For instance, + * unicode, negated classes, unbounded ranges, subpatterns, back references, + * assertions, recursive patterns, and comments are not supported. Escaping + * support is extremely fragile. + * + * This method is also VERY slow. Use it only when no other formatter + * can generate the fake data you want. For instance, prefer calling + * `$faker->email` rather than `regexify` with the previous regular + * expression. + * + * Also note than `bothify` can probably do most of what this method does, + * but much faster. For instance, for a dummy email generation, try + * `$faker->bothify('?????????@???.???')`. + * + * @see https://github.com/icomefromthenet/ReverseRegex for a more robust implementation + * + * @param string $regex A regular expression (delimiters are optional) + * + * @return string + */ + public static function regexify($regex = '') + { + // ditch the anchors + $regex = preg_replace('/^\/?\^?/', '', $regex); + $regex = preg_replace('/\$?\/?$/', '', $regex); + // All {2} become {2,2} + $regex = preg_replace('/\{(\d+)\}/', '{\1,\1}', $regex); + // Single-letter quantifiers (?, *, +) become bracket quantifiers ({0,1}, {0,rand}, {1, rand}) + $regex = preg_replace('/(? 0 && $weight < 1 && mt_rand() / mt_getrandmax() <= $weight) { + return $this->generator; + } + + // new system with percentage + if (is_int($weight) && mt_rand(1, 100) <= $weight) { + return $this->generator; + } + + return new DefaultGenerator($default); + } + + /** + * Chainable method for making any formatter unique. + * + * + * // will never return twice the same value + * $faker->unique()->randomElement(array(1, 2, 3)); + * + * + * @param bool $reset If set to true, resets the list of existing values + * @param int $maxRetries Maximum number of retries to find a unique value, + * After which an OverflowException is thrown. + * + * @throws \OverflowException When no unique value can be found by iterating $maxRetries times + * + * @return UniqueGenerator A proxy class returning only non-existing values + */ + public function unique($reset = false, $maxRetries = 10000) + { + if ($reset || !$this->unique) { + $this->unique = new UniqueGenerator($this->generator, $maxRetries); + } + + return $this->unique; + } + + /** + * Chainable method for forcing any formatter to return only valid values. + * + * The value validity is determined by a function passed as first argument. + * + * + * $values = array(); + * $evenValidator = function ($digit) { + * return $digit % 2 === 0; + * }; + * for ($i=0; $i < 10; $i++) { + * $values []= $faker->valid($evenValidator)->randomDigit; + * } + * print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6] + * + * + * @param Closure $validator A function returning true for valid values + * @param int $maxRetries Maximum number of retries to find a unique value, + * After which an OverflowException is thrown. + * + * @throws \OverflowException When no valid value can be found by iterating $maxRetries times + * + * @return ValidGenerator A proxy class returning only valid values + */ + public function valid($validator = null, $maxRetries = 10000) + { + return new ValidGenerator($this->generator, $validator, $maxRetries); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Biased.php b/vendor/fakerphp/faker/src/Faker/Provider/Biased.php new file mode 100644 index 00000000..42c70bcc --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Biased.php @@ -0,0 +1,65 @@ +generator->parse($format); + } + + /** + * @example 'Ltd' + * + * @return string + */ + public static function companySuffix() + { + return static::randomElement(static::$companySuffix); + } + + /** + * @example 'Job' + * + * @return string + */ + public function jobTitle() + { + $format = static::randomElement(static::$jobTitleFormat); + + return $this->generator->parse($format); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/DateTime.php b/vendor/fakerphp/faker/src/Faker/Provider/DateTime.php new file mode 100644 index 00000000..26cddf29 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/DateTime.php @@ -0,0 +1,381 @@ +getTimestamp(); + } + + return strtotime(empty($max) ? 'now' : $max); + } + + /** + * Get a timestamp between January 1, 1970 and now + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return int + * + * @example 1061306726 + */ + public static function unixTime($max = 'now') + { + return self::numberBetween(0, static::getMaxTimestamp($max)); + } + + /** + * Get a datetime object for a date between January 1, 1970 and now + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @example DateTime('2005-08-16 20:39:21') + * + * @return \DateTime + * + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTime($max = 'now', $timezone = null) + { + return static::setTimezone( + new \DateTime('@' . static::unixTime($max)), + $timezone + ); + } + + /** + * Get a datetime object for a date between January 1, 001 and now + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @example DateTime('1265-03-22 21:15:52') + * + * @return \DateTime + * + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTimeAD($max = 'now', $timezone = null) + { + $min = (PHP_INT_SIZE > 4 ? -62135597361 : -PHP_INT_MAX); + + return static::setTimezone( + new \DateTime('@' . self::numberBetween($min, static::getMaxTimestamp($max))), + $timezone + ); + } + + /** + * get a date string formatted with ISO8601 + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '2003-10-21T16:05:52+0000' + */ + public static function iso8601($max = 'now') + { + return static::date(\DateTime::ISO8601, $max); + } + + /** + * Get a date string between January 1, 1970 and now + * + * @param string $format + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '2008-11-27' + */ + public static function date($format = 'Y-m-d', $max = 'now') + { + return static::dateTime($max)->format($format); + } + + /** + * Get a time string (24h format by default) + * + * @param string $format + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '15:02:34' + */ + public static function time($format = 'H:i:s', $max = 'now') + { + return static::dateTime($max)->format($format); + } + + /** + * Get a DateTime object based on a random date between two given dates. + * Accepts date strings that can be recognized by strtotime(). + * + * @param \DateTime|string $startDate Defaults to 30 years ago + * @param \DateTime|string $endDate Defaults to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @example DateTime('1999-02-02 11:42:52') + * + * @return \DateTime + * + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTimeBetween($startDate = '-30 years', $endDate = 'now', $timezone = null) + { + $startTimestamp = $startDate instanceof \DateTime ? $startDate->getTimestamp() : strtotime($startDate); + $endTimestamp = static::getMaxTimestamp($endDate); + + if ($startTimestamp > $endTimestamp) { + throw new \InvalidArgumentException('Start date must be anterior to end date.'); + } + + $timestamp = self::numberBetween($startTimestamp, $endTimestamp); + + return static::setTimezone( + new \DateTime('@' . $timestamp), + $timezone + ); + } + + /** + * Get a DateTime object based on a random date between one given date and + * an interval + * Accepts date string that can be recognized by strtotime(). + * + * @param \DateTime|string $date Defaults to 30 years ago + * @param string $interval Defaults to 5 days after + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @example dateTimeInInterval('1999-02-02 11:42:52', '+ 5 days') + * + * @return \DateTime + * + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTimeInInterval($date = '-30 years', $interval = '+5 days', $timezone = null) + { + $intervalObject = \DateInterval::createFromDateString($interval); + $datetime = $date instanceof \DateTime ? $date : new \DateTime($date); + $otherDatetime = clone $datetime; + $otherDatetime->add($intervalObject); + + $begin = $datetime > $otherDatetime ? $otherDatetime : $datetime; + $end = $datetime === $begin ? $otherDatetime : $datetime; + + return static::dateTimeBetween( + $begin, + $end, + $timezone + ); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @example DateTime('1964-04-04 11:02:02') + * + * @return \DateTime + */ + public static function dateTimeThisCentury($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-100 year', $max, $timezone); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @example DateTime('2010-03-10 05:18:58') + * + * @return \DateTime + */ + public static function dateTimeThisDecade($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-10 year', $max, $timezone); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @example DateTime('2011-09-19 09:24:37') + * + * @return \DateTime + */ + public static function dateTimeThisYear($max = 'now', $timezone = null) + { + return static::dateTimeBetween('first day of january this year', $max, $timezone); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @example DateTime('2011-10-05 12:51:46') + * + * @return \DateTime + */ + public static function dateTimeThisMonth($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-1 month', $max, $timezone); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example 'am' + */ + public static function amPm($max = 'now') + { + return static::dateTime($max)->format('a'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '22' + */ + public static function dayOfMonth($max = 'now') + { + return static::dateTime($max)->format('d'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example 'Tuesday' + */ + public static function dayOfWeek($max = 'now') + { + return static::dateTime($max)->format('l'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '7' + */ + public static function month($max = 'now') + { + return static::dateTime($max)->format('m'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example 'September' + */ + public static function monthName($max = 'now') + { + return static::dateTime($max)->format('F'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '1673' + */ + public static function year($max = 'now') + { + return static::dateTime($max)->format('Y'); + } + + /** + * @return string + * + * @example 'XVII' + */ + public static function century() + { + return static::randomElement(static::$century); + } + + /** + * @return string + * + * @example 'Europe/Paris' + */ + public static function timezone() + { + return static::randomElement(\DateTimeZone::listIdentifiers()); + } + + /** + * Internal method to set the time zone on a DateTime. + * + * @param string|null $timezone + * + * @return \DateTime + */ + private static function setTimezone(\DateTime $dt, $timezone) + { + return $dt->setTimezone(new \DateTimeZone(static::resolveTimezone($timezone))); + } + + /** + * Sets default time zone. + * + * @param string $timezone + */ + public static function setDefaultTimezone($timezone = null) + { + static::$defaultTimezone = $timezone; + } + + /** + * Gets default time zone. + * + * @return string|null + */ + public static function getDefaultTimezone() + { + return static::$defaultTimezone; + } + + /** + * @param string|null $timezone + * + * @return string|null + */ + private static function resolveTimezone($timezone) + { + return (null === $timezone) ? ((null === static::$defaultTimezone) ? date_default_timezone_get() : static::$defaultTimezone) : $timezone; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/File.php b/vendor/fakerphp/faker/src/Faker/Provider/File.php new file mode 100644 index 00000000..3cf3db9f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/File.php @@ -0,0 +1,610 @@ + file extension(s) + * + * @see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types + */ + protected static $mimeTypes = [ + 'application/atom+xml' => 'atom', + 'application/ecmascript' => 'ecma', + 'application/emma+xml' => 'emma', + 'application/epub+zip' => 'epub', + 'application/java-archive' => 'jar', + 'application/java-vm' => 'class', + 'application/javascript' => 'js', + 'application/json' => 'json', + 'application/jsonml+json' => 'jsonml', + 'application/lost+xml' => 'lostxml', + 'application/mathml+xml' => 'mathml', + 'application/mets+xml' => 'mets', + 'application/mods+xml' => 'mods', + 'application/mp4' => 'mp4s', + 'application/msword' => ['doc', 'dot'], + 'application/octet-stream' => [ + 'bin', + 'dms', + 'lrf', + 'mar', + 'so', + 'dist', + 'distz', + 'pkg', + 'bpk', + 'dump', + 'elc', + 'deploy', + ], + 'application/ogg' => 'ogx', + 'application/omdoc+xml' => 'omdoc', + 'application/pdf' => 'pdf', + 'application/pgp-encrypted' => 'pgp', + 'application/pgp-signature' => ['asc', 'sig'], + 'application/pkix-pkipath' => 'pkipath', + 'application/pkixcmp' => 'pki', + 'application/pls+xml' => 'pls', + 'application/postscript' => ['ai', 'eps', 'ps'], + 'application/pskc+xml' => 'pskcxml', + 'application/rdf+xml' => 'rdf', + 'application/reginfo+xml' => 'rif', + 'application/rss+xml' => 'rss', + 'application/rtf' => 'rtf', + 'application/sbml+xml' => 'sbml', + 'application/vnd.adobe.air-application-installer-package+zip' => 'air', + 'application/vnd.adobe.xdp+xml' => 'xdp', + 'application/vnd.adobe.xfdf' => 'xfdf', + 'application/vnd.ahead.space' => 'ahead', + 'application/vnd.dart' => 'dart', + 'application/vnd.data-vision.rdz' => 'rdz', + 'application/vnd.dece.data' => ['uvf', 'uvvf', 'uvd', 'uvvd'], + 'application/vnd.dece.ttml+xml' => ['uvt', 'uvvt'], + 'application/vnd.dece.unspecified' => ['uvx', 'uvvx'], + 'application/vnd.dece.zip' => ['uvz', 'uvvz'], + 'application/vnd.denovo.fcselayout-link' => 'fe_launch', + 'application/vnd.dna' => 'dna', + 'application/vnd.dolby.mlp' => 'mlp', + 'application/vnd.dpgraph' => 'dpg', + 'application/vnd.dreamfactory' => 'dfac', + 'application/vnd.ds-keypoint' => 'kpxx', + 'application/vnd.dvb.ait' => 'ait', + 'application/vnd.dvb.service' => 'svc', + 'application/vnd.dynageo' => 'geo', + 'application/vnd.ecowin.chart' => 'mag', + 'application/vnd.enliven' => 'nml', + 'application/vnd.epson.esf' => 'esf', + 'application/vnd.epson.msf' => 'msf', + 'application/vnd.epson.quickanime' => 'qam', + 'application/vnd.epson.salt' => 'slt', + 'application/vnd.epson.ssf' => 'ssf', + 'application/vnd.ezpix-album' => 'ez2', + 'application/vnd.ezpix-package' => 'ez3', + 'application/vnd.fdf' => 'fdf', + 'application/vnd.fdsn.mseed' => 'mseed', + 'application/vnd.fdsn.seed' => ['seed', 'dataless'], + 'application/vnd.flographit' => 'gph', + 'application/vnd.fluxtime.clip' => 'ftc', + 'application/vnd.hal+xml' => 'hal', + 'application/vnd.hydrostatix.sof-data' => 'sfd-hdstx', + 'application/vnd.ibm.minipay' => 'mpy', + 'application/vnd.ibm.secure-container' => 'sc', + 'application/vnd.iccprofile' => ['icc', 'icm'], + 'application/vnd.igloader' => 'igl', + 'application/vnd.immervision-ivp' => 'ivp', + 'application/vnd.kde.karbon' => 'karbon', + 'application/vnd.kde.kchart' => 'chrt', + 'application/vnd.kde.kformula' => 'kfo', + 'application/vnd.kde.kivio' => 'flw', + 'application/vnd.kde.kontour' => 'kon', + 'application/vnd.kde.kpresenter' => ['kpr', 'kpt'], + 'application/vnd.kde.kspread' => 'ksp', + 'application/vnd.kde.kword' => ['kwd', 'kwt'], + 'application/vnd.kenameaapp' => 'htke', + 'application/vnd.kidspiration' => 'kia', + 'application/vnd.kinar' => ['kne', 'knp'], + 'application/vnd.koan' => ['skp', 'skd', 'skt', 'skm'], + 'application/vnd.kodak-descriptor' => 'sse', + 'application/vnd.las.las+xml' => 'lasxml', + 'application/vnd.llamagraphics.life-balance.desktop' => 'lbd', + 'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe', + 'application/vnd.lotus-1-2-3' => '123', + 'application/vnd.lotus-approach' => 'apr', + 'application/vnd.lotus-freelance' => 'pre', + 'application/vnd.lotus-notes' => 'nsf', + 'application/vnd.lotus-organizer' => 'org', + 'application/vnd.lotus-screencam' => 'scm', + 'application/vnd.mozilla.xul+xml' => 'xul', + 'application/vnd.ms-artgalry' => 'cil', + 'application/vnd.ms-cab-compressed' => 'cab', + 'application/vnd.ms-excel' => [ + 'xls', + 'xlm', + 'xla', + 'xlc', + 'xlt', + 'xlw', + ], + 'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam', + 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb', + 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm', + 'application/vnd.ms-excel.template.macroenabled.12' => 'xltm', + 'application/vnd.ms-fontobject' => 'eot', + 'application/vnd.ms-htmlhelp' => 'chm', + 'application/vnd.ms-ims' => 'ims', + 'application/vnd.ms-lrm' => 'lrm', + 'application/vnd.ms-officetheme' => 'thmx', + 'application/vnd.ms-pki.seccat' => 'cat', + 'application/vnd.ms-pki.stl' => 'stl', + 'application/vnd.ms-powerpoint' => ['ppt', 'pps', 'pot'], + 'application/vnd.ms-powerpoint.addin.macroenabled.12' => 'ppam', + 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 'pptm', + 'application/vnd.ms-powerpoint.slide.macroenabled.12' => 'sldm', + 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 'ppsm', + 'application/vnd.ms-powerpoint.template.macroenabled.12' => 'potm', + 'application/vnd.ms-project' => ['mpp', 'mpt'], + 'application/vnd.ms-word.document.macroenabled.12' => 'docm', + 'application/vnd.ms-word.template.macroenabled.12' => 'dotm', + 'application/vnd.ms-works' => ['wps', 'wks', 'wcm', 'wdb'], + 'application/vnd.ms-wpl' => 'wpl', + 'application/vnd.ms-xpsdocument' => 'xps', + 'application/vnd.mseq' => 'mseq', + 'application/vnd.musician' => 'mus', + 'application/vnd.oasis.opendocument.chart' => 'odc', + 'application/vnd.oasis.opendocument.chart-template' => 'otc', + 'application/vnd.oasis.opendocument.database' => 'odb', + 'application/vnd.oasis.opendocument.formula' => 'odf', + 'application/vnd.oasis.opendocument.formula-template' => 'odft', + 'application/vnd.oasis.opendocument.graphics' => 'odg', + 'application/vnd.oasis.opendocument.graphics-template' => 'otg', + 'application/vnd.oasis.opendocument.image' => 'odi', + 'application/vnd.oasis.opendocument.image-template' => 'oti', + 'application/vnd.oasis.opendocument.presentation' => 'odp', + 'application/vnd.oasis.opendocument.presentation-template' => 'otp', + 'application/vnd.oasis.opendocument.spreadsheet' => 'ods', + 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots', + 'application/vnd.oasis.opendocument.text' => 'odt', + 'application/vnd.oasis.opendocument.text-master' => 'odm', + 'application/vnd.oasis.opendocument.text-template' => 'ott', + 'application/vnd.oasis.opendocument.text-web' => 'oth', + 'application/vnd.olpc-sugar' => 'xo', + 'application/vnd.oma.dd2+xml' => 'dd2', + 'application/vnd.openofficeorg.extension' => 'oxt', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx', + 'application/vnd.openxmlformats-officedocument.presentationml.slide' => 'sldx', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx', + 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'potx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'xltx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx', + 'application/vnd.pvi.ptid1' => 'ptid', + 'application/vnd.quark.quarkxpress' => [ + 'qxd', + 'qxt', + 'qwd', + 'qwt', + 'qxl', + 'qxb', + ], + 'application/vnd.realvnc.bed' => 'bed', + 'application/vnd.recordare.musicxml' => 'mxl', + 'application/vnd.recordare.musicxml+xml' => 'musicxml', + 'application/vnd.rig.cryptonote' => 'cryptonote', + 'application/vnd.rim.cod' => 'cod', + 'application/vnd.rn-realmedia' => 'rm', + 'application/vnd.rn-realmedia-vbr' => 'rmvb', + 'application/vnd.route66.link66+xml' => 'link66', + 'application/vnd.sailingtracker.track' => 'st', + 'application/vnd.seemail' => 'see', + 'application/vnd.sema' => 'sema', + 'application/vnd.semd' => 'semd', + 'application/vnd.semf' => 'semf', + 'application/vnd.shana.informed.formdata' => 'ifm', + 'application/vnd.shana.informed.formtemplate' => 'itp', + 'application/vnd.shana.informed.interchange' => 'iif', + 'application/vnd.shana.informed.package' => 'ipk', + 'application/vnd.simtech-mindmapper' => ['twd', 'twds'], + 'application/vnd.smaf' => 'mmf', + 'application/vnd.stepmania.stepchart' => 'sm', + 'application/vnd.sun.xml.calc' => 'sxc', + 'application/vnd.sun.xml.calc.template' => 'stc', + 'application/vnd.sun.xml.draw' => 'sxd', + 'application/vnd.sun.xml.draw.template' => 'std', + 'application/vnd.sun.xml.impress' => 'sxi', + 'application/vnd.sun.xml.impress.template' => 'sti', + 'application/vnd.sun.xml.math' => 'sxm', + 'application/vnd.sun.xml.writer' => 'sxw', + 'application/vnd.sun.xml.writer.global' => 'sxg', + 'application/vnd.sun.xml.writer.template' => 'stw', + 'application/vnd.sus-calendar' => ['sus', 'susp'], + 'application/vnd.svd' => 'svd', + 'application/vnd.symbian.install' => ['sis', 'sisx'], + 'application/vnd.syncml+xml' => 'xsm', + 'application/vnd.syncml.dm+wbxml' => 'bdm', + 'application/vnd.syncml.dm+xml' => 'xdm', + 'application/vnd.tao.intent-module-archive' => 'tao', + 'application/vnd.tcpdump.pcap' => ['pcap', 'cap', 'dmp'], + 'application/vnd.tmobile-livetv' => 'tmo', + 'application/vnd.trid.tpt' => 'tpt', + 'application/vnd.triscape.mxs' => 'mxs', + 'application/vnd.trueapp' => 'tra', + 'application/vnd.ufdl' => ['ufd', 'ufdl'], + 'application/vnd.uiq.theme' => 'utz', + 'application/vnd.umajin' => 'umj', + 'application/vnd.unity' => 'unityweb', + 'application/vnd.uoml+xml' => 'uoml', + 'application/vnd.vcx' => 'vcx', + 'application/vnd.visio' => ['vsd', 'vst', 'vss', 'vsw'], + 'application/vnd.visionary' => 'vis', + 'application/vnd.vsf' => 'vsf', + 'application/vnd.wap.wbxml' => 'wbxml', + 'application/vnd.wap.wmlc' => 'wmlc', + 'application/vnd.wap.wmlscriptc' => 'wmlsc', + 'application/vnd.webturbo' => 'wtb', + 'application/vnd.wolfram.player' => 'nbp', + 'application/vnd.wordperfect' => 'wpd', + 'application/vnd.wqd' => 'wqd', + 'application/vnd.wt.stf' => 'stf', + 'application/vnd.xara' => 'xar', + 'application/vnd.xfdl' => 'xfdl', + 'application/voicexml+xml' => 'vxml', + 'application/widget' => 'wgt', + 'application/winhlp' => 'hlp', + 'application/wsdl+xml' => 'wsdl', + 'application/wspolicy+xml' => 'wspolicy', + 'application/x-7z-compressed' => '7z', + 'application/x-bittorrent' => 'torrent', + 'application/x-blorb' => ['blb', 'blorb'], + 'application/x-bzip' => 'bz', + 'application/x-cdlink' => 'vcd', + 'application/x-cfs-compressed' => 'cfs', + 'application/x-chat' => 'chat', + 'application/x-chess-pgn' => 'pgn', + 'application/x-conference' => 'nsc', + 'application/x-cpio' => 'cpio', + 'application/x-csh' => 'csh', + 'application/x-debian-package' => ['deb', 'udeb'], + 'application/x-dgc-compressed' => 'dgc', + 'application/x-director' => [ + 'dir', + 'dcr', + 'dxr', + 'cst', + 'cct', + 'cxt', + 'w3d', + 'fgd', + 'swa', + ], + 'application/x-font-ttf' => ['ttf', 'ttc'], + 'application/x-font-type1' => ['pfa', 'pfb', 'pfm', 'afm'], + 'application/x-font-woff' => 'woff', + 'application/x-freearc' => 'arc', + 'application/x-futuresplash' => 'spl', + 'application/x-gca-compressed' => 'gca', + 'application/x-glulx' => 'ulx', + 'application/x-gnumeric' => 'gnumeric', + 'application/x-gramps-xml' => 'gramps', + 'application/x-gtar' => 'gtar', + 'application/x-hdf' => 'hdf', + 'application/x-install-instructions' => 'install', + 'application/x-iso9660-image' => 'iso', + 'application/x-java-jnlp-file' => 'jnlp', + 'application/x-latex' => 'latex', + 'application/x-lzh-compressed' => ['lzh', 'lha'], + 'application/x-mie' => 'mie', + 'application/x-mobipocket-ebook' => ['prc', 'mobi'], + 'application/x-ms-application' => 'application', + 'application/x-ms-shortcut' => 'lnk', + 'application/x-ms-wmd' => 'wmd', + 'application/x-ms-wmz' => 'wmz', + 'application/x-ms-xbap' => 'xbap', + 'application/x-msaccess' => 'mdb', + 'application/x-msbinder' => 'obd', + 'application/x-mscardfile' => 'crd', + 'application/x-msclip' => 'clp', + 'application/x-msdownload' => ['exe', 'dll', 'com', 'bat', 'msi'], + 'application/x-msmediaview' => [ + 'mvb', + 'm13', + 'm14', + ], + 'application/x-msmetafile' => ['wmf', 'wmz', 'emf', 'emz'], + 'application/x-rar-compressed' => 'rar', + 'application/x-research-info-systems' => 'ris', + 'application/x-sh' => 'sh', + 'application/x-shar' => 'shar', + 'application/x-shockwave-flash' => 'swf', + 'application/x-silverlight-app' => 'xap', + 'application/x-sql' => 'sql', + 'application/x-stuffit' => 'sit', + 'application/x-stuffitx' => 'sitx', + 'application/x-subrip' => 'srt', + 'application/x-sv4cpio' => 'sv4cpio', + 'application/x-sv4crc' => 'sv4crc', + 'application/x-t3vm-image' => 't3', + 'application/x-tads' => 'gam', + 'application/x-tar' => 'tar', + 'application/x-tcl' => 'tcl', + 'application/x-tex' => 'tex', + 'application/x-tex-tfm' => 'tfm', + 'application/x-texinfo' => ['texinfo', 'texi'], + 'application/x-tgif' => 'obj', + 'application/x-ustar' => 'ustar', + 'application/x-wais-source' => 'src', + 'application/x-x509-ca-cert' => ['der', 'crt'], + 'application/x-xfig' => 'fig', + 'application/x-xliff+xml' => 'xlf', + 'application/x-xpinstall' => 'xpi', + 'application/x-xz' => 'xz', + 'application/x-zmachine' => 'z1', + 'application/xaml+xml' => 'xaml', + 'application/xcap-diff+xml' => 'xdf', + 'application/xenc+xml' => 'xenc', + 'application/xhtml+xml' => ['xhtml', 'xht'], + 'application/xml' => ['xml', 'xsl'], + 'application/xml-dtd' => 'dtd', + 'application/xop+xml' => 'xop', + 'application/xproc+xml' => 'xpl', + 'application/xslt+xml' => 'xslt', + 'application/xspf+xml' => 'xspf', + 'application/xv+xml' => ['mxml', 'xhvml', 'xvml', 'xvm'], + 'application/yang' => 'yang', + 'application/yin+xml' => 'yin', + 'application/zip' => 'zip', + 'audio/adpcm' => 'adp', + 'audio/basic' => ['au', 'snd'], + 'audio/midi' => ['mid', 'midi', 'kar', 'rmi'], + 'audio/mp4' => 'mp4a', + 'audio/mpeg' => [ + 'mpga', + 'mp2', + 'mp2a', + 'mp3', + 'm2a', + 'm3a', + ], + 'audio/ogg' => ['oga', 'ogg', 'spx'], + 'audio/vnd.dece.audio' => ['uva', 'uvva'], + 'audio/vnd.rip' => 'rip', + 'audio/webm' => 'weba', + 'audio/x-aac' => 'aac', + 'audio/x-aiff' => ['aif', 'aiff', 'aifc'], + 'audio/x-caf' => 'caf', + 'audio/x-flac' => 'flac', + 'audio/x-matroska' => 'mka', + 'audio/x-mpegurl' => 'm3u', + 'audio/x-ms-wax' => 'wax', + 'audio/x-ms-wma' => 'wma', + 'audio/x-pn-realaudio' => ['ram', 'ra'], + 'audio/x-pn-realaudio-plugin' => 'rmp', + 'audio/x-wav' => 'wav', + 'audio/xm' => 'xm', + 'image/bmp' => 'bmp', + 'image/cgm' => 'cgm', + 'image/g3fax' => 'g3', + 'image/gif' => 'gif', + 'image/ief' => 'ief', + 'image/jpeg' => ['jpeg', 'jpg', 'jpe'], + 'image/ktx' => 'ktx', + 'image/png' => 'png', + 'image/prs.btif' => 'btif', + 'image/sgi' => 'sgi', + 'image/svg+xml' => ['svg', 'svgz'], + 'image/tiff' => ['tiff', 'tif'], + 'image/vnd.adobe.photoshop' => 'psd', + 'image/vnd.dece.graphic' => ['uvi', 'uvvi', 'uvg', 'uvvg'], + 'image/vnd.dvb.subtitle' => 'sub', + 'image/vnd.djvu' => ['djvu', 'djv'], + 'image/vnd.dwg' => 'dwg', + 'image/vnd.dxf' => 'dxf', + 'image/vnd.fastbidsheet' => 'fbs', + 'image/vnd.fpx' => 'fpx', + 'image/vnd.fst' => 'fst', + 'image/vnd.fujixerox.edmics-mmr' => 'mmr', + 'image/vnd.fujixerox.edmics-rlc' => 'rlc', + 'image/vnd.ms-modi' => 'mdi', + 'image/vnd.ms-photo' => 'wdp', + 'image/vnd.net-fpx' => 'npx', + 'image/vnd.wap.wbmp' => 'wbmp', + 'image/vnd.xiff' => 'xif', + 'image/webp' => 'webp', + 'image/x-3ds' => '3ds', + 'image/x-cmu-raster' => 'ras', + 'image/x-cmx' => 'cmx', + 'image/x-freehand' => ['fh', 'fhc', 'fh4', 'fh5', 'fh7'], + 'image/x-icon' => 'ico', + 'image/x-mrsid-image' => 'sid', + 'image/x-pcx' => 'pcx', + 'image/x-pict' => ['pic', 'pct'], + 'image/x-portable-anymap' => 'pnm', + 'image/x-portable-bitmap' => 'pbm', + 'image/x-portable-graymap' => 'pgm', + 'image/x-portable-pixmap' => 'ppm', + 'image/x-rgb' => 'rgb', + 'image/x-tga' => 'tga', + 'image/x-xbitmap' => 'xbm', + 'image/x-xpixmap' => 'xpm', + 'image/x-xwindowdump' => 'xwd', + 'message/rfc822' => ['eml', 'mime'], + 'model/iges' => ['igs', 'iges'], + 'model/mesh' => ['msh', 'mesh', 'silo'], + 'model/vnd.collada+xml' => 'dae', + 'model/vnd.dwf' => 'dwf', + 'model/vnd.gdl' => 'gdl', + 'model/vnd.gtw' => 'gtw', + 'model/vnd.mts' => 'mts', + 'model/vnd.vtu' => 'vtu', + 'model/vrml' => ['wrl', 'vrml'], + 'model/x3d+binary' => 'x3db', + 'model/x3d+vrml' => 'x3dv', + 'model/x3d+xml' => 'x3d', + 'text/cache-manifest' => 'appcache', + 'text/calendar' => ['ics', 'ifb'], + 'text/css' => 'css', + 'text/csv' => 'csv', + 'text/html' => ['html', 'htm'], + 'text/n3' => 'n3', + 'text/plain' => [ + 'txt', + 'text', + 'conf', + 'def', + 'list', + 'log', + 'in', + ], + 'text/prs.lines.tag' => 'dsc', + 'text/richtext' => 'rtx', + 'text/sgml' => ['sgml', 'sgm'], + 'text/tab-separated-values' => 'tsv', + 'text/troff' => [ + 't', + 'tr', + 'roff', + 'man', + 'me', + 'ms', + ], + 'text/turtle' => 'ttl', + 'text/uri-list' => ['uri', 'uris', 'urls'], + 'text/vcard' => 'vcard', + 'text/vnd.curl' => 'curl', + 'text/vnd.curl.dcurl' => 'dcurl', + 'text/vnd.curl.scurl' => 'scurl', + 'text/vnd.curl.mcurl' => 'mcurl', + 'text/vnd.dvb.subtitle' => 'sub', + 'text/vnd.fly' => 'fly', + 'text/vnd.fmi.flexstor' => 'flx', + 'text/vnd.graphviz' => 'gv', + 'text/vnd.in3d.3dml' => '3dml', + 'text/vnd.in3d.spot' => 'spot', + 'text/vnd.sun.j2me.app-descriptor' => 'jad', + 'text/vnd.wap.wml' => 'wml', + 'text/vnd.wap.wmlscript' => 'wmls', + 'text/x-asm' => ['s', 'asm'], + 'text/x-fortran' => ['f', 'for', 'f77', 'f90'], + 'text/x-java-source' => 'java', + 'text/x-opml' => 'opml', + 'text/x-pascal' => ['p', 'pas'], + 'text/x-nfo' => 'nfo', + 'text/x-setext' => 'etx', + 'text/x-sfv' => 'sfv', + 'text/x-uuencode' => 'uu', + 'text/x-vcalendar' => 'vcs', + 'text/x-vcard' => 'vcf', + 'video/3gpp' => '3gp', + 'video/3gpp2' => '3g2', + 'video/h261' => 'h261', + 'video/h263' => 'h263', + 'video/h264' => 'h264', + 'video/jpeg' => 'jpgv', + 'video/jpm' => ['jpm', 'jpgm'], + 'video/mj2' => 'mj2', + 'video/mp4' => 'mp4', + 'video/mpeg' => ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'], + 'video/ogg' => 'ogv', + 'video/quicktime' => ['qt', 'mov'], + 'video/vnd.dece.hd' => ['uvh', 'uvvh'], + 'video/vnd.dece.mobile' => ['uvm', 'uvvm'], + 'video/vnd.dece.pd' => ['uvp', 'uvvp'], + 'video/vnd.dece.sd' => ['uvs', 'uvvs'], + 'video/vnd.dece.video' => ['uvv', 'uvvv'], + 'video/vnd.dvb.file' => 'dvb', + 'video/vnd.fvt' => 'fvt', + 'video/vnd.mpegurl' => ['mxu', 'm4u'], + 'video/vnd.ms-playready.media.pyv' => 'pyv', + 'video/vnd.uvvu.mp4' => ['uvu', 'uvvu'], + 'video/vnd.vivo' => 'viv', + 'video/webm' => 'webm', + 'video/x-f4v' => 'f4v', + 'video/x-fli' => 'fli', + 'video/x-flv' => 'flv', + 'video/x-m4v' => 'm4v', + 'video/x-matroska' => ['mkv', 'mk3d', 'mks'], + 'video/x-mng' => 'mng', + 'video/x-ms-asf' => ['asf', 'asx'], + 'video/x-ms-vob' => 'vob', + 'video/x-ms-wm' => 'wm', + 'video/x-ms-wmv' => 'wmv', + 'video/x-ms-wmx' => 'wmx', + 'video/x-ms-wvx' => 'wvx', + 'video/x-msvideo' => 'avi', + 'video/x-sgi-movie' => 'movie', + ]; + + /** + * Get a random MIME type + * + * @return string + * + * @example 'video/avi' + */ + public static function mimeType() + { + return static::randomElement(array_keys(static::$mimeTypes)); + } + + /** + * Get a random file extension (without a dot) + * + * @example avi + * + * @return string + */ + public static function fileExtension() + { + $random_extension = static::randomElement(array_values(static::$mimeTypes)); + + return is_array($random_extension) ? static::randomElement($random_extension) : $random_extension; + } + + /** + * Copy a random file from the source directory to the target directory and returns the filename/fullpath + * + * @param string $sourceDirectory The directory to look for random file taking + * @param string $targetDirectory + * @param bool $fullPath Whether to have the full path or just the filename + * + * @return string + */ + public static function file($sourceDirectory = '/tmp', $targetDirectory = '/tmp', $fullPath = true) + { + if (!is_dir($sourceDirectory)) { + throw new \InvalidArgumentException(sprintf('Source directory %s does not exist or is not a directory.', $sourceDirectory)); + } + + if (!is_dir($targetDirectory)) { + throw new \InvalidArgumentException(sprintf('Target directory %s does not exist or is not a directory.', $targetDirectory)); + } + + if ($sourceDirectory == $targetDirectory) { + throw new \InvalidArgumentException('Source and target directories must differ.'); + } + + // Drop . and .. and reset array keys + $files = array_filter(array_values(array_diff(scandir($sourceDirectory), ['.', '..'])), static function ($file) use ($sourceDirectory) { + return is_file($sourceDirectory . DIRECTORY_SEPARATOR . $file) && is_readable($sourceDirectory . DIRECTORY_SEPARATOR . $file); + }); + + if (empty($files)) { + throw new \InvalidArgumentException(sprintf('Source directory %s is empty.', $sourceDirectory)); + } + + $sourceFullPath = $sourceDirectory . DIRECTORY_SEPARATOR . static::randomElement($files); + + $destinationFile = Uuid::uuid() . '.' . pathinfo($sourceFullPath, PATHINFO_EXTENSION); + $destinationFullPath = $targetDirectory . DIRECTORY_SEPARATOR . $destinationFile; + + if (false === copy($sourceFullPath, $destinationFullPath)) { + return false; + } + + return $fullPath ? $destinationFullPath : $destinationFile; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/HtmlLorem.php b/vendor/fakerphp/faker/src/Faker/Provider/HtmlLorem.php new file mode 100644 index 00000000..06bcd87d --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/HtmlLorem.php @@ -0,0 +1,307 @@ +addProvider(new Lorem($generator)); + $generator->addProvider(new Internet($generator)); + } + + /** + * @param int $maxDepth + * @param int $maxWidth + * + * @return string + */ + public function randomHtml($maxDepth = 4, $maxWidth = 4) + { + if (!class_exists(\DOMDocument::class, false)) { + throw new \RuntimeException('ext-dom is required to use randomHtml.'); + } + + $document = new \DOMDocument(); + $this->idGenerator = new UniqueGenerator($this->generator); + + $head = $document->createElement('head'); + $this->addRandomTitle($head); + + $body = $document->createElement('body'); + $this->addLoginForm($body); + $this->addRandomSubTree($body, $maxDepth, $maxWidth); + + $html = $document->createElement('html'); + $html->appendChild($head); + $html->appendChild($body); + + $document->appendChild($html); + + return $document->saveHTML(); + } + + private function addRandomSubTree(\DOMElement $root, $maxDepth, $maxWidth) + { + --$maxDepth; + + if ($maxDepth <= 0) { + return $root; + } + + $siblings = self::numberBetween(1, $maxWidth); + + for ($i = 0; $i < $siblings; ++$i) { + if ($maxDepth == 1) { + $this->addRandomLeaf($root); + } else { + $sibling = $root->ownerDocument->createElement('div'); + $root->appendChild($sibling); + $this->addRandomAttribute($sibling); + $this->addRandomSubTree($sibling, self::numberBetween(0, $maxDepth), $maxWidth); + } + } + + return $root; + } + + private function addRandomLeaf(\DOMElement $node) + { + $rand = self::numberBetween(1, 10); + + switch ($rand) { + case 1: + $this->addRandomP($node); + + break; + + case 2: + $this->addRandomA($node); + + break; + + case 3: + $this->addRandomSpan($node); + + break; + + case 4: + $this->addRandomUL($node); + + break; + + case 5: + $this->addRandomH($node); + + break; + + case 6: + $this->addRandomB($node); + + break; + + case 7: + $this->addRandomI($node); + + break; + + case 8: + $this->addRandomTable($node); + + break; + + default: + $this->addRandomText($node); + + break; + } + } + + private function addRandomAttribute(\DOMElement $node) + { + $rand = self::numberBetween(1, 2); + + switch ($rand) { + case 1: + $node->setAttribute('class', $this->generator->word()); + + break; + + case 2: + $node->setAttribute('id', (string) $this->idGenerator->randomNumber(5)); + + break; + } + } + + private function addRandomP(\DOMElement $element, $maxLength = 10) + { + $node = $element->ownerDocument->createElement(static::P_TAG); + $node->textContent = $this->generator->sentence(self::numberBetween(1, $maxLength)); + $element->appendChild($node); + } + + private function addRandomText(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $element->appendChild($text); + } + + private function addRandomA(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::A_TAG); + $node->setAttribute('href', $this->generator->safeEmailDomain()); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomTitle(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::TITLE_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomH(\DOMElement $element, $maxLength = 10) + { + $h = static::H_TAG . (string) self::numberBetween(1, 3); + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $node = $element->ownerDocument->createElement($h); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomB(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::B_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomI(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::I_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomSpan(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::SPAN_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addLoginForm(\DOMElement $element) + { + $textInput = $element->ownerDocument->createElement(static::INPUT_TAG); + $textInput->setAttribute('type', 'text'); + $textInput->setAttribute('id', 'username'); + + $textLabel = $element->ownerDocument->createElement(static::LABEL_TAG); + $textLabel->setAttribute('for', 'username'); + $textLabel->textContent = $this->generator->word(); + + $passwordInput = $element->ownerDocument->createElement(static::INPUT_TAG); + $passwordInput->setAttribute('type', 'password'); + $passwordInput->setAttribute('id', 'password'); + + $passwordLabel = $element->ownerDocument->createElement(static::LABEL_TAG); + $passwordLabel->setAttribute('for', 'password'); + $passwordLabel->textContent = $this->generator->word(); + + $submit = $element->ownerDocument->createElement(static::INPUT_TAG); + $submit->setAttribute('type', 'submit'); + $submit->setAttribute('value', $this->generator->word()); + + $submit = $element->ownerDocument->createElement(static::FORM_TAG); + $submit->setAttribute('action', $this->generator->safeEmailDomain()); + $submit->setAttribute('method', 'POST'); + $submit->appendChild($textLabel); + $submit->appendChild($textInput); + $submit->appendChild($passwordLabel); + $submit->appendChild($passwordInput); + $element->appendChild($submit); + } + + private function addRandomTable(\DOMElement $element, $maxRows = 10, $maxCols = 6, $maxTitle = 4, $maxLength = 10) + { + $rows = self::numberBetween(1, $maxRows); + $cols = self::numberBetween(1, $maxCols); + + $table = $element->ownerDocument->createElement(static::TABLE_TAG); + $thead = $element->ownerDocument->createElement(static::THEAD_TAG); + $tbody = $element->ownerDocument->createElement(static::TBODY_TAG); + + $table->appendChild($thead); + $table->appendChild($tbody); + + $tr = $element->ownerDocument->createElement(static::TR_TAG); + $thead->appendChild($tr); + + for ($i = 0; $i < $cols; ++$i) { + $th = $element->ownerDocument->createElement(static::TH_TAG); + $th->textContent = $this->generator->sentence(self::numberBetween(1, $maxTitle)); + $tr->appendChild($th); + } + + for ($i = 0; $i < $rows; ++$i) { + $tr = $element->ownerDocument->createElement(static::TR_TAG); + $tbody->appendChild($tr); + + for ($j = 0; $j < $cols; ++$j) { + $th = $element->ownerDocument->createElement(static::TD_TAG); + $th->textContent = $this->generator->sentence(self::numberBetween(1, $maxLength)); + $tr->appendChild($th); + } + } + $element->appendChild($table); + } + + private function addRandomUL(\DOMElement $element, $maxItems = 11, $maxLength = 4) + { + $num = self::numberBetween(1, $maxItems); + $ul = $element->ownerDocument->createElement(static::UL_TAG); + + for ($i = 0; $i < $num; ++$i) { + $li = $element->ownerDocument->createElement(static::LI_TAG); + $li->textContent = $this->generator->sentence(self::numberBetween(1, $maxLength)); + $ul->appendChild($li); + } + $element->appendChild($ul); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Image.php b/vendor/fakerphp/faker/src/Faker/Provider/Image.php new file mode 100644 index 00000000..167641c1 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Image.php @@ -0,0 +1,139 @@ + 0 ? '?text=' . urlencode(implode(' ', $imageParts)) : '' + ); + } + + /** + * Download a remote random image to disk and return its location + * + * Requires curl, or allow_url_fopen to be on in php.ini. + * + * @example '/path/to/dir/13b73edae8443990be1aa8f1a483bc27.png' + * + * @return bool|string + */ + public static function image( + $dir = null, + $width = 640, + $height = 480, + $category = null, + $fullPath = true, + $randomize = true, + $word = null, + $gray = false + ) { + $dir = null === $dir ? sys_get_temp_dir() : $dir; // GNU/Linux / OS X / Windows compatible + // Validate directory path + if (!is_dir($dir) || !is_writable($dir)) { + throw new \InvalidArgumentException(sprintf('Cannot write to directory "%s"', $dir)); + } + + // Generate a random filename. Use the server address so that a file + // generated at the same time on a different server won't have a collision. + $name = md5(uniqid(empty($_SERVER['SERVER_ADDR']) ? '' : $_SERVER['SERVER_ADDR'], true)); + $filename = $name . '.png'; + $filepath = $dir . DIRECTORY_SEPARATOR . $filename; + + $url = static::imageUrl($width, $height, $category, $randomize, $word, $gray); + + // save file + if (function_exists('curl_exec')) { + // use cURL + $fp = fopen($filepath, 'w'); + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_FILE, $fp); + $success = curl_exec($ch) && curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200; + fclose($fp); + curl_close($ch); + + if (!$success) { + unlink($filepath); + + // could not contact the distant URL or HTTP error - fail silently. + return false; + } + } elseif (ini_get('allow_url_fopen')) { + // use remote fopen() via copy() + $success = copy($url, $filepath); + + if (!$success) { + // could not contact the distant URL or HTTP error - fail silently. + return false; + } + } else { + return new \RuntimeException('The image formatter downloads an image from a remote HTTP server. Therefore, it requires that PHP can request remote hosts, either via cURL or fopen()'); + } + + return $fullPath ? $filepath : $filename; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/Internet.php new file mode 100644 index 00000000..122d9c0c --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Internet.php @@ -0,0 +1,407 @@ +generator->parse($format); + } + + /** + * @example 'jdoe@example.com' + * + * @return string + */ + final public function safeEmail() + { + return preg_replace('/\s/u', '', $this->userName() . '@' . static::safeEmailDomain()); + } + + /** + * @example 'jdoe@gmail.com' + * + * @return string + */ + public function freeEmail() + { + return preg_replace('/\s/u', '', $this->userName() . '@' . static::freeEmailDomain()); + } + + /** + * @example 'jdoe@dawson.com' + * + * @return string + */ + public function companyEmail() + { + return preg_replace('/\s/u', '', $this->userName() . '@' . $this->domainName()); + } + + /** + * @example 'gmail.com' + * + * @return string + */ + public static function freeEmailDomain() + { + return static::randomElement(static::$freeEmailDomain); + } + + /** + * @example 'example.org' + * + * @return string + */ + final public static function safeEmailDomain() + { + $domains = [ + 'example.com', + 'example.org', + 'example.net', + ]; + + return static::randomElement($domains); + } + + /** + * @example 'jdoe' + * + * @return string + */ + public function userName() + { + $format = static::randomElement(static::$userNameFormats); + $username = static::bothify($this->generator->parse($format)); + + $username = strtolower(static::transliterate($username)); + + // check if transliterate() didn't support the language and removed all letters + if (trim($username, '._') === '') { + throw new \Exception('userName failed with the selected locale. Try a different locale or activate the "intl" PHP extension.'); + } + + // clean possible trailing dots from first/last names + $username = str_replace('..', '.', $username); + $username = rtrim($username, '.'); + + return $username; + } + + /** + * @example 'fY4èHdZv68' + * + * @return string + */ + public function password($minLength = 6, $maxLength = 20) + { + $pattern = str_repeat('*', $this->numberBetween($minLength, $maxLength)); + + return $this->asciify($pattern); + } + + /** + * @example 'tiramisu.com' + * + * @return string + */ + public function domainName() + { + return $this->domainWord() . '.' . $this->tld(); + } + + /** + * @example 'faber' + * + * @return string + */ + public function domainWord() + { + $lastName = $this->generator->format('lastName'); + + $lastName = strtolower(static::transliterate($lastName)); + + // check if transliterate() didn't support the language and removed all letters + if (trim($lastName, '._') === '') { + throw new \Exception('domainWord failed with the selected locale. Try a different locale or activate the "intl" PHP extension.'); + } + + // clean possible trailing dot from last name + $lastName = rtrim($lastName, '.'); + + return $lastName; + } + + /** + * @example 'com' + * + * @return string + */ + public function tld() + { + return static::randomElement(static::$tld); + } + + /** + * @example 'http://www.runolfsdottir.com/' + * + * @return string + */ + public function url() + { + $format = static::randomElement(static::$urlFormats); + + return $this->generator->parse($format); + } + + /** + * @example 'aut-repellat-commodi-vel-itaque-nihil-id-saepe-nostrum' + * + * @return string + */ + public function slug($nbWords = 6, $variableNbWords = true) + { + if ($nbWords <= 0) { + return ''; + } + + if ($variableNbWords) { + $nbWords = (int) ($nbWords * self::numberBetween(60, 140) / 100) + 1; + } + $words = $this->generator->words($nbWords); + + return implode('-', $words); + } + + /** + * @example '237.149.115.38' + * + * @return string + */ + public function ipv4() + { + return long2ip(Miscellaneous::boolean() ? self::numberBetween(-2147483648, -2) : self::numberBetween(16777216, 2147483647)); + } + + /** + * @example '35cd:186d:3e23:2986:ef9f:5b41:42a4:e6f1' + * + * @return string + */ + public function ipv6() + { + $res = []; + + for ($i = 0; $i < 8; ++$i) { + $res[] = dechex(self::numberBetween(0, 65535)); + } + + return implode(':', $res); + } + + /** + * @example '10.1.1.17' + * + * @return string + */ + public static function localIpv4() + { + $ipBlock = self::randomElement(static::$localIpBlocks); + + return long2ip(static::numberBetween(ip2long($ipBlock[0]), ip2long($ipBlock[1]))); + } + + /** + * @example '32:F1:39:2F:D6:18' + * + * @return string + */ + public static function macAddress() + { + $mac = []; + + for ($i = 0; $i < 6; ++$i) { + $mac[] = sprintf('%02X', self::numberBetween(0, 0xff)); + } + + return implode(':', $mac); + } + + protected static function transliterate($string) + { + if (0 === preg_match('/[^A-Za-z0-9_.]/', $string)) { + return $string; + } + + $transId = 'Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC;'; + + if (class_exists(\Transliterator::class, false) && $transliterator = \Transliterator::create($transId)) { + $transString = $transliterator->transliterate($string); + } else { + $transString = static::toAscii($string); + } + + return preg_replace('/[^A-Za-z0-9_.]/u', '', $transString); + } + + protected static function toAscii($string) + { + static $arrayFrom, $arrayTo; + + if (empty($arrayFrom)) { + $transliterationTable = [ + 'IJ' => 'I', 'Ö' => 'O', 'Œ' => 'O', 'Ü' => 'U', 'ä' => 'a', 'æ' => 'a', + 'ij' => 'i', 'ö' => 'o', 'œ' => 'o', 'ü' => 'u', 'ß' => 's', 'ſ' => 's', + 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', + 'Æ' => 'A', 'Ā' => 'A', 'Ą' => 'A', 'Ă' => 'A', 'Ç' => 'C', 'Ć' => 'C', + 'Č' => 'C', 'Ĉ' => 'C', 'Ċ' => 'C', 'Ď' => 'D', 'Đ' => 'D', 'È' => 'E', + 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ē' => 'E', 'Ę' => 'E', 'Ě' => 'E', + 'Ĕ' => 'E', 'Ė' => 'E', 'Ĝ' => 'G', 'Ğ' => 'G', 'Ġ' => 'G', 'Ģ' => 'G', + 'Ĥ' => 'H', 'Ħ' => 'H', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', + 'Ī' => 'I', 'Ĩ' => 'I', 'Ĭ' => 'I', 'Į' => 'I', 'İ' => 'I', 'Ĵ' => 'J', + 'Ķ' => 'K', 'Ľ' => 'K', 'Ĺ' => 'K', 'Ļ' => 'K', 'Ŀ' => 'K', 'Ł' => 'L', + 'Ñ' => 'N', 'Ń' => 'N', 'Ň' => 'N', 'Ņ' => 'N', 'Ŋ' => 'N', 'Ò' => 'O', + 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ø' => 'O', 'Ō' => 'O', 'Ő' => 'O', + 'Ŏ' => 'O', 'Ŕ' => 'R', 'Ř' => 'R', 'Ŗ' => 'R', 'Ś' => 'S', 'Ş' => 'S', + 'Ŝ' => 'S', 'Ș' => 'S', 'Š' => 'S', 'Ť' => 'T', 'Ţ' => 'T', 'Ŧ' => 'T', + 'Ț' => 'T', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ū' => 'U', 'Ů' => 'U', + 'Ű' => 'U', 'Ŭ' => 'U', 'Ũ' => 'U', 'Ų' => 'U', 'Ŵ' => 'W', 'Ŷ' => 'Y', + 'Ÿ' => 'Y', 'Ý' => 'Y', 'Ź' => 'Z', 'Ż' => 'Z', 'Ž' => 'Z', 'à' => 'a', + 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ā' => 'a', 'ą' => 'a', 'ă' => 'a', + 'å' => 'a', 'ç' => 'c', 'ć' => 'c', 'č' => 'c', 'ĉ' => 'c', 'ċ' => 'c', + 'ď' => 'd', 'đ' => 'd', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', + 'ē' => 'e', 'ę' => 'e', 'ě' => 'e', 'ĕ' => 'e', 'ė' => 'e', 'ƒ' => 'f', + 'ĝ' => 'g', 'ğ' => 'g', 'ġ' => 'g', 'ģ' => 'g', 'ĥ' => 'h', 'ħ' => 'h', + 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ī' => 'i', 'ĩ' => 'i', + 'ĭ' => 'i', 'į' => 'i', 'ı' => 'i', 'ĵ' => 'j', 'ķ' => 'k', 'ĸ' => 'k', + 'ł' => 'l', 'ľ' => 'l', 'ĺ' => 'l', 'ļ' => 'l', 'ŀ' => 'l', 'ñ' => 'n', + 'ń' => 'n', 'ň' => 'n', 'ņ' => 'n', 'ʼn' => 'n', 'ŋ' => 'n', 'ò' => 'o', + 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ø' => 'o', 'ō' => 'o', 'ő' => 'o', + 'ŏ' => 'o', 'ŕ' => 'r', 'ř' => 'r', 'ŗ' => 'r', 'ś' => 's', 'š' => 's', + 'ť' => 't', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ū' => 'u', 'ů' => 'u', + 'ű' => 'u', 'ŭ' => 'u', 'ũ' => 'u', 'ų' => 'u', 'ŵ' => 'w', 'ÿ' => 'y', + 'ý' => 'y', 'ŷ' => 'y', 'ż' => 'z', 'ź' => 'z', 'ž' => 'z', 'Α' => 'A', + 'Ά' => 'A', 'Ἀ' => 'A', 'Ἁ' => 'A', 'Ἂ' => 'A', 'Ἃ' => 'A', 'Ἄ' => 'A', + 'Ἅ' => 'A', 'Ἆ' => 'A', 'Ἇ' => 'A', 'ᾈ' => 'A', 'ᾉ' => 'A', 'ᾊ' => 'A', + 'ᾋ' => 'A', 'ᾌ' => 'A', 'ᾍ' => 'A', 'ᾎ' => 'A', 'ᾏ' => 'A', 'Ᾰ' => 'A', + 'Ᾱ' => 'A', 'Ὰ' => 'A', 'ᾼ' => 'A', 'Β' => 'B', 'Γ' => 'G', 'Δ' => 'D', + 'Ε' => 'E', 'Έ' => 'E', 'Ἐ' => 'E', 'Ἑ' => 'E', 'Ἒ' => 'E', 'Ἓ' => 'E', + 'Ἔ' => 'E', 'Ἕ' => 'E', 'Ὲ' => 'E', 'Ζ' => 'Z', 'Η' => 'I', 'Ή' => 'I', + 'Ἠ' => 'I', 'Ἡ' => 'I', 'Ἢ' => 'I', 'Ἣ' => 'I', 'Ἤ' => 'I', 'Ἥ' => 'I', + 'Ἦ' => 'I', 'Ἧ' => 'I', 'ᾘ' => 'I', 'ᾙ' => 'I', 'ᾚ' => 'I', 'ᾛ' => 'I', + 'ᾜ' => 'I', 'ᾝ' => 'I', 'ᾞ' => 'I', 'ᾟ' => 'I', 'Ὴ' => 'I', 'ῌ' => 'I', + 'Θ' => 'T', 'Ι' => 'I', 'Ί' => 'I', 'Ϊ' => 'I', 'Ἰ' => 'I', 'Ἱ' => 'I', + 'Ἲ' => 'I', 'Ἳ' => 'I', 'Ἴ' => 'I', 'Ἵ' => 'I', 'Ἶ' => 'I', 'Ἷ' => 'I', + 'Ῐ' => 'I', 'Ῑ' => 'I', 'Ὶ' => 'I', 'Κ' => 'K', 'Λ' => 'L', 'Μ' => 'M', + 'Ν' => 'N', 'Ξ' => 'K', 'Ο' => 'O', 'Ό' => 'O', 'Ὀ' => 'O', 'Ὁ' => 'O', + 'Ὂ' => 'O', 'Ὃ' => 'O', 'Ὄ' => 'O', 'Ὅ' => 'O', 'Ὸ' => 'O', 'Π' => 'P', + 'Ρ' => 'R', 'Ῥ' => 'R', 'Σ' => 'S', 'Τ' => 'T', 'Υ' => 'Y', 'Ύ' => 'Y', + 'Ϋ' => 'Y', 'Ὑ' => 'Y', 'Ὓ' => 'Y', 'Ὕ' => 'Y', 'Ὗ' => 'Y', 'Ῠ' => 'Y', + 'Ῡ' => 'Y', 'Ὺ' => 'Y', 'Φ' => 'F', 'Χ' => 'X', 'Ψ' => 'P', 'Ω' => 'O', + 'Ώ' => 'O', 'Ὠ' => 'O', 'Ὡ' => 'O', 'Ὢ' => 'O', 'Ὣ' => 'O', 'Ὤ' => 'O', + 'Ὥ' => 'O', 'Ὦ' => 'O', 'Ὧ' => 'O', 'ᾨ' => 'O', 'ᾩ' => 'O', 'ᾪ' => 'O', + 'ᾫ' => 'O', 'ᾬ' => 'O', 'ᾭ' => 'O', 'ᾮ' => 'O', 'ᾯ' => 'O', 'Ὼ' => 'O', + 'ῼ' => 'O', 'α' => 'a', 'ά' => 'a', 'ἀ' => 'a', 'ἁ' => 'a', 'ἂ' => 'a', + 'ἃ' => 'a', 'ἄ' => 'a', 'ἅ' => 'a', 'ἆ' => 'a', 'ἇ' => 'a', 'ᾀ' => 'a', + 'ᾁ' => 'a', 'ᾂ' => 'a', 'ᾃ' => 'a', 'ᾄ' => 'a', 'ᾅ' => 'a', 'ᾆ' => 'a', + 'ᾇ' => 'a', 'ὰ' => 'a', 'ᾰ' => 'a', 'ᾱ' => 'a', 'ᾲ' => 'a', 'ᾳ' => 'a', + 'ᾴ' => 'a', 'ᾶ' => 'a', 'ᾷ' => 'a', 'β' => 'b', 'γ' => 'g', 'δ' => 'd', + 'ε' => 'e', 'έ' => 'e', 'ἐ' => 'e', 'ἑ' => 'e', 'ἒ' => 'e', 'ἓ' => 'e', + 'ἔ' => 'e', 'ἕ' => 'e', 'ὲ' => 'e', 'ζ' => 'z', 'η' => 'i', 'ή' => 'i', + 'ἠ' => 'i', 'ἡ' => 'i', 'ἢ' => 'i', 'ἣ' => 'i', 'ἤ' => 'i', 'ἥ' => 'i', + 'ἦ' => 'i', 'ἧ' => 'i', 'ᾐ' => 'i', 'ᾑ' => 'i', 'ᾒ' => 'i', 'ᾓ' => 'i', + 'ᾔ' => 'i', 'ᾕ' => 'i', 'ᾖ' => 'i', 'ᾗ' => 'i', 'ὴ' => 'i', 'ῂ' => 'i', + 'ῃ' => 'i', 'ῄ' => 'i', 'ῆ' => 'i', 'ῇ' => 'i', 'θ' => 't', 'ι' => 'i', + 'ί' => 'i', 'ϊ' => 'i', 'ΐ' => 'i', 'ἰ' => 'i', 'ἱ' => 'i', 'ἲ' => 'i', + 'ἳ' => 'i', 'ἴ' => 'i', 'ἵ' => 'i', 'ἶ' => 'i', 'ἷ' => 'i', 'ὶ' => 'i', + 'ῐ' => 'i', 'ῑ' => 'i', 'ῒ' => 'i', 'ῖ' => 'i', 'ῗ' => 'i', 'κ' => 'k', + 'λ' => 'l', 'μ' => 'm', 'ν' => 'n', 'ξ' => 'k', 'ο' => 'o', 'ό' => 'o', + 'ὀ' => 'o', 'ὁ' => 'o', 'ὂ' => 'o', 'ὃ' => 'o', 'ὄ' => 'o', 'ὅ' => 'o', + 'ὸ' => 'o', 'π' => 'p', 'ρ' => 'r', 'ῤ' => 'r', 'ῥ' => 'r', 'σ' => 's', + 'ς' => 's', 'τ' => 't', 'υ' => 'y', 'ύ' => 'y', 'ϋ' => 'y', 'ΰ' => 'y', + 'ὐ' => 'y', 'ὑ' => 'y', 'ὒ' => 'y', 'ὓ' => 'y', 'ὔ' => 'y', 'ὕ' => 'y', + 'ὖ' => 'y', 'ὗ' => 'y', 'ὺ' => 'y', 'ῠ' => 'y', 'ῡ' => 'y', 'ῢ' => 'y', + 'ῦ' => 'y', 'ῧ' => 'y', 'φ' => 'f', 'χ' => 'x', 'ψ' => 'p', 'ω' => 'o', + 'ώ' => 'o', 'ὠ' => 'o', 'ὡ' => 'o', 'ὢ' => 'o', 'ὣ' => 'o', 'ὤ' => 'o', + 'ὥ' => 'o', 'ὦ' => 'o', 'ὧ' => 'o', 'ᾠ' => 'o', 'ᾡ' => 'o', 'ᾢ' => 'o', + 'ᾣ' => 'o', 'ᾤ' => 'o', 'ᾥ' => 'o', 'ᾦ' => 'o', 'ᾧ' => 'o', 'ὼ' => 'o', + 'ῲ' => 'o', 'ῳ' => 'o', 'ῴ' => 'o', 'ῶ' => 'o', 'ῷ' => 'o', 'А' => 'A', + 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'E', + 'Ж' => 'Z', 'З' => 'Z', 'И' => 'I', 'Й' => 'I', 'К' => 'K', 'Л' => 'L', + 'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S', + 'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'K', 'Ц' => 'T', 'Ч' => 'C', + 'Ш' => 'S', 'Щ' => 'S', 'Ы' => 'Y', 'Э' => 'E', 'Ю' => 'Y', 'Я' => 'Y', + 'а' => 'A', 'б' => 'B', 'в' => 'V', 'г' => 'G', 'д' => 'D', 'е' => 'E', + 'ё' => 'E', 'ж' => 'Z', 'з' => 'Z', 'и' => 'I', 'й' => 'I', 'к' => 'K', + 'л' => 'L', 'м' => 'M', 'н' => 'N', 'о' => 'O', 'п' => 'P', 'р' => 'R', + 'с' => 'S', 'т' => 'T', 'у' => 'U', 'ф' => 'F', 'х' => 'K', 'ц' => 'T', + 'ч' => 'C', 'ш' => 'S', 'щ' => 'S', 'ы' => 'Y', 'э' => 'E', 'ю' => 'Y', + 'я' => 'Y', 'ð' => 'd', 'Ð' => 'D', 'þ' => 't', 'Þ' => 'T', 'ა' => 'a', + 'ბ' => 'b', 'გ' => 'g', 'დ' => 'd', 'ე' => 'e', 'ვ' => 'v', 'ზ' => 'z', + 'თ' => 't', 'ი' => 'i', 'კ' => 'k', 'ლ' => 'l', 'მ' => 'm', 'ნ' => 'n', + 'ო' => 'o', 'პ' => 'p', 'ჟ' => 'z', 'რ' => 'r', 'ს' => 's', 'ტ' => 't', + 'უ' => 'u', 'ფ' => 'p', 'ქ' => 'k', 'ღ' => 'g', 'ყ' => 'q', 'შ' => 's', + 'ჩ' => 'c', 'ც' => 't', 'ძ' => 'd', 'წ' => 't', 'ჭ' => 'c', 'ხ' => 'k', + 'ჯ' => 'j', 'ჰ' => 'h', 'ţ' => 't', 'ʼ' => "'", '̧' => '', 'ḩ' => 'h', + '‘' => "'", '’' => "'", 'ừ' => 'u', '/' => '', 'ế' => 'e', 'ả' => 'a', + 'ị' => 'i', 'ậ' => 'a', 'ệ' => 'e', 'ỉ' => 'i', 'ồ' => 'o', 'ề' => 'e', + 'ơ' => 'o', 'ạ' => 'a', 'ẵ' => 'a', 'ư' => 'u', 'ằ' => 'a', 'ầ' => 'a', + 'ḑ' => 'd', 'Ḩ' => 'H', 'Ḑ' => 'D', 'ș' => 's', 'ț' => 't', 'ộ' => 'o', + 'ắ' => 'a', 'ş' => 's', "'" => '', 'ու' => 'u', 'ա' => 'a', 'բ' => 'b', + 'գ' => 'g', 'դ' => 'd', 'ե' => 'e', 'զ' => 'z', 'է' => 'e', 'ը' => 'y', + 'թ' => 't', 'ժ' => 'zh', 'ի' => 'i', 'լ' => 'l', 'խ' => 'kh', 'ծ' => 'ts', + 'կ' => 'k', 'հ' => 'h', 'ձ' => 'dz', 'ղ' => 'gh', 'ճ' => 'ch', 'մ' => 'm', + 'յ' => 'y', 'ն' => 'n', 'շ' => 'sh', 'ո' => 'o', 'չ' => 'ch', 'պ' => 'p', + 'ջ' => 'j', 'ռ' => 'r', 'ս' => 's', 'վ' => 'v', 'տ' => 't', 'ր' => 'r', + 'ց' => 'ts', 'փ' => 'p', 'ք' => 'q', 'և' => 'ev', 'օ' => 'o', 'ֆ' => 'f', + ]; + $arrayFrom = array_keys($transliterationTable); + $arrayTo = array_values($transliterationTable); + } + + return str_replace($arrayFrom, $arrayTo, $string); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Lorem.php b/vendor/fakerphp/faker/src/Faker/Provider/Lorem.php new file mode 100644 index 00000000..a55144a5 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Lorem.php @@ -0,0 +1,220 @@ +generator->parse('{{bloodType}}{{bloodRh}}'); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Miscellaneous.php b/vendor/fakerphp/faker/src/Faker/Provider/Miscellaneous.php new file mode 100644 index 00000000..91d992ec --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Miscellaneous.php @@ -0,0 +1,341 @@ + [ + '4539###########', + '4556###########', + '4916###########', + '4532###########', + '4929###########', + '40240071#######', + '4485###########', + '4716###########', + '4##############', + ], + 'Visa Retired' => [ + '4539########', + '4556########', + '4916########', + '4532########', + '4929########', + '40240071####', + '4485########', + '4716########', + '4###########', + ], + 'MasterCard' => [ + '2221###########', + '23#############', + '24#############', + '25#############', + '26#############', + '2720###########', + '51#############', + '52#############', + '53#############', + '54#############', + '55#############', + ], + 'American Express' => [ + '34############', + '37############', + ], + 'Discover Card' => [ + '6011###########', + ], + 'JCB' => [ + '3528###########', + '3589###########', + ], + ]; + + /** + * @var array list of IBAN formats, source: @see https://www.swift.com/standards/data-standards/iban + */ + protected static $ibanFormats = [ + 'AD' => [['n', 4], ['n', 4], ['c', 12]], + 'AE' => [['n', 3], ['n', 16]], + 'AL' => [['n', 8], ['c', 16]], + 'AT' => [['n', 5], ['n', 11]], + 'AZ' => [['a', 4], ['c', 20]], + 'BA' => [['n', 3], ['n', 3], ['n', 8], ['n', 2]], + 'BE' => [['n', 3], ['n', 7], ['n', 2]], + 'BG' => [['a', 4], ['n', 4], ['n', 2], ['c', 8]], + 'BH' => [['a', 4], ['c', 14]], + 'BR' => [['n', 8], ['n', 5], ['n', 10], ['a', 1], ['c', 1]], + 'CH' => [['n', 5], ['c', 12]], + 'CR' => [['n', 4], ['n', 14]], + 'CY' => [['n', 3], ['n', 5], ['c', 16]], + 'CZ' => [['n', 4], ['n', 6], ['n', 10]], + 'DE' => [['n', 8], ['n', 10]], + 'DK' => [['n', 4], ['n', 9], ['n', 1]], + 'DO' => [['c', 4], ['n', 20]], + 'EE' => [['n', 2], ['n', 2], ['n', 11], ['n', 1]], + 'EG' => [['n', 4], ['n', 4], ['n', 17]], + 'ES' => [['n', 4], ['n', 4], ['n', 1], ['n', 1], ['n', 10]], + 'FI' => [['n', 6], ['n', 7], ['n', 1]], + 'FR' => [['n', 5], ['n', 5], ['c', 11], ['n', 2]], + 'GB' => [['a', 4], ['n', 6], ['n', 8]], + 'GE' => [['a', 2], ['n', 16]], + 'GI' => [['a', 4], ['c', 15]], + 'GR' => [['n', 3], ['n', 4], ['c', 16]], + 'GT' => [['c', 4], ['c', 20]], + 'HR' => [['n', 7], ['n', 10]], + 'HU' => [['n', 3], ['n', 4], ['n', 1], ['n', 15], ['n', 1]], + 'IE' => [['a', 4], ['n', 6], ['n', 8]], + 'IL' => [['n', 3], ['n', 3], ['n', 13]], + 'IS' => [['n', 4], ['n', 2], ['n', 6], ['n', 10]], + 'IT' => [['a', 1], ['n', 5], ['n', 5], ['c', 12]], + 'KW' => [['a', 4], ['n', 22]], + 'KZ' => [['n', 3], ['c', 13]], + 'LB' => [['n', 4], ['c', 20]], + 'LI' => [['n', 5], ['c', 12]], + 'LT' => [['n', 5], ['n', 11]], + 'LU' => [['n', 3], ['c', 13]], + 'LV' => [['a', 4], ['c', 13]], + 'MC' => [['n', 5], ['n', 5], ['c', 11], ['n', 2]], + 'MD' => [['c', 2], ['c', 18]], + 'ME' => [['n', 3], ['n', 13], ['n', 2]], + 'MK' => [['n', 3], ['c', 10], ['n', 2]], + 'MR' => [['n', 5], ['n', 5], ['n', 11], ['n', 2]], + 'MT' => [['a', 4], ['n', 5], ['c', 18]], + 'MU' => [['a', 4], ['n', 2], ['n', 2], ['n', 12], ['n', 3], ['a', 3]], + 'NL' => [['a', 4], ['n', 10]], + 'NO' => [['n', 4], ['n', 6], ['n', 1]], + 'PK' => [['a', 4], ['c', 16]], + 'PL' => [['n', 8], ['n', 16]], + 'PS' => [['a', 4], ['c', 21]], + 'PT' => [['n', 4], ['n', 4], ['n', 11], ['n', 2]], + 'RO' => [['a', 4], ['c', 16]], + 'RS' => [['n', 3], ['n', 13], ['n', 2]], + 'SA' => [['n', 2], ['c', 18]], + 'SE' => [['n', 3], ['n', 16], ['n', 1]], + 'SI' => [['n', 5], ['n', 8], ['n', 2]], + 'SK' => [['n', 4], ['n', 6], ['n', 10]], + 'SM' => [['a', 1], ['n', 5], ['n', 5], ['c', 12]], + 'TN' => [['n', 2], ['n', 3], ['n', 13], ['n', 2]], + 'TR' => [['n', 5], ['n', 1], ['c', 16]], + 'VG' => [['a', 4], ['n', 16]], + ]; + + /** + * @return string Returns a credit card vendor name + * + * @example 'MasterCard' + */ + public static function creditCardType() + { + return static::randomElement(static::$cardVendors); + } + + /** + * Returns the String of a credit card number. + * + * @param string $type Supporting any of 'Visa', 'MasterCard', 'American Express', 'Discover' and 'JCB' + * @param bool $formatted Set to true if the output string should contain one separator every 4 digits + * @param string $separator Separator string for formatting card number. Defaults to dash (-). + * + * @return string + * + * @example '4485480221084675' + */ + public static function creditCardNumber($type = null, $formatted = false, $separator = '-') + { + if (null === $type) { + $type = static::creditCardType(); + } + $mask = static::randomElement(static::$cardParams[$type]); + + $number = static::numerify($mask); + $number .= Luhn::computeCheckDigit($number); + + if ($formatted) { + $p1 = substr($number, 0, 4); + $p2 = substr($number, 4, 4); + $p3 = substr($number, 8, 4); + $p4 = substr($number, 12); + $number = $p1 . $separator . $p2 . $separator . $p3 . $separator . $p4; + } + + return $number; + } + + /** + * @param bool $valid True (by default) to get a valid expiration date, false to get a maybe valid date + * + * @return \DateTime + * + * @example 04/13 + */ + public function creditCardExpirationDate($valid = true) + { + if ($valid) { + return $this->generator->dateTimeBetween('now', '36 months'); + } + + return $this->generator->dateTimeBetween('-36 months', '36 months'); + } + + /** + * @param bool $valid True (by default) to get a valid expiration date, false to get a maybe valid date + * @param string $expirationDateFormat + * + * @return string + * + * @example '04/13' + */ + public function creditCardExpirationDateString($valid = true, $expirationDateFormat = null) + { + return $this->creditCardExpirationDate($valid)->format(null === $expirationDateFormat ? static::$expirationDateFormat : $expirationDateFormat); + } + + /** + * @param bool $valid True (by default) to get a valid expiration date, false to get a maybe valid date + * + * @return array + */ + public function creditCardDetails($valid = true) + { + $type = static::creditCardType(); + + return [ + 'type' => $type, + 'number' => static::creditCardNumber($type), + 'name' => $this->generator->name(), + 'expirationDate' => $this->creditCardExpirationDateString($valid), + ]; + } + + /** + * International Bank Account Number (IBAN) + * + * @see http://en.wikipedia.org/wiki/International_Bank_Account_Number + * + * @param string $countryCode ISO 3166-1 alpha-2 country code + * @param string $prefix for generating bank account number of a specific bank + * @param int $length total length without country code and 2 check digits + * + * @return string + */ + public static function iban($countryCode = null, $prefix = '', $length = null) + { + $countryCode = null === $countryCode ? self::randomKey(self::$ibanFormats) : strtoupper($countryCode); + + $format = !isset(static::$ibanFormats[$countryCode]) ? null : static::$ibanFormats[$countryCode]; + + if ($length === null) { + if ($format === null) { + $length = 24; + } else { + $length = 0; + + foreach ($format as $part) { + [$class, $groupCount] = $part; + $length += $groupCount; + } + } + } + + if ($format === null) { + $format = [['n', $length]]; + } + + $expandedFormat = ''; + + foreach ($format as $item) { + [$class, $length] = $item; + $expandedFormat .= str_repeat($class, $length); + } + + $result = $prefix; + $expandedFormat = substr($expandedFormat, strlen($result)); + + foreach (str_split($expandedFormat) as $class) { + switch ($class) { + default: + case 'c': + $result .= Miscellaneous::boolean() ? static::randomDigit() : strtoupper(static::randomLetter()); + + break; + + case 'a': + $result .= strtoupper(static::randomLetter()); + + break; + + case 'n': + $result .= static::randomDigit(); + + break; + } + } + + $checksum = Iban::checksum($countryCode . '00' . $result); + + return $countryCode . $checksum . $result; + } + + /** + * Return the String of a SWIFT/BIC number + * + * @example 'RZTIAT22263' + * + * @see http://en.wikipedia.org/wiki/ISO_9362 + * + * @return string Swift/Bic number + */ + public static function swiftBicNumber() + { + return self::regexify('^([A-Z]){4}([A-Z]){2}([0-9A-Z]){2}([0-9A-Z]{3})?$'); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/Person.php new file mode 100644 index 00000000..c11a72bd --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Person.php @@ -0,0 +1,147 @@ +generator->parse($format); + } + + /** + * @param string|null $gender 'male', 'female' or null for any + * + * @return string + * + * @example 'John' + */ + public function firstName($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::firstNameMale(); + } + + if ($gender === static::GENDER_FEMALE) { + return static::firstNameFemale(); + } + + return $this->generator->parse(static::randomElement(static::$firstNameFormat)); + } + + /** + * @return string + */ + public static function firstNameMale() + { + return static::randomElement(static::$firstNameMale); + } + + /** + * @return string + */ + public static function firstNameFemale() + { + return static::randomElement(static::$firstNameFemale); + } + + /** + * @example 'Doe' + * + * @return string + */ + public function lastName() + { + return static::randomElement(static::$lastName); + } + + /** + * @example 'Mrs.' + * + * @param string|null $gender 'male', 'female' or null for any + * + * @return string + */ + public function title($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::titleMale(); + } + + if ($gender === static::GENDER_FEMALE) { + return static::titleFemale(); + } + + return $this->generator->parse(static::randomElement(static::$titleFormat)); + } + + /** + * @example 'Mr.' + * + * @return string + */ + public static function titleMale() + { + return static::randomElement(static::$titleMale); + } + + /** + * @example 'Mrs.' + * + * @return string + */ + public static function titleFemale() + { + return static::randomElement(static::$titleFemale); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/PhoneNumber.php new file mode 100644 index 00000000..515ef57e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/PhoneNumber.php @@ -0,0 +1,270 @@ +generator->parse(static::randomElement(static::$formats))); + } + + /** + * @example +11134567890 + * + * @return string + */ + public function e164PhoneNumber() + { + return static::numerify($this->generator->parse(static::randomElement(static::$e164Formats))); + } + + /** + * International Mobile Equipment Identity (IMEI) + * + * @see http://en.wikipedia.org/wiki/International_Mobile_Station_Equipment_Identity + * @see http://imei-number.com/imei-validation-check/ + * + * @example '720084494799532' + * + * @return int $imei + */ + public function imei() + { + $imei = (string) static::numerify('##############'); + $imei .= Luhn::computeCheckDigit($imei); + + return $imei; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/Text.php new file mode 100644 index 00000000..585d5b5a --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Text.php @@ -0,0 +1,202 @@ +realTextBetween((int) round($maxNbChars * 0.8), $maxNbChars, $indexSize); + } + + /** + * Generate a text string by the Markov chain algorithm. + * + * Depending on the $maxNbChars, returns a random valid looking text. The algorithm + * generates a weighted table with the specified number of words as the index and the + * possible following words as the value. + * + * @example 'Alice, swallowing down her flamingo, and began by taking the little golden key' + * + * @param int $minNbChars Minimum number of characters the text should contain (maximum: 8) + * @param int $maxNbChars Maximum number of characters the text should contain (minimum: 10) + * @param int $indexSize Determines how many words are considered for the generation of the next word. + * The minimum is 1, and it produces a higher level of randomness, although the + * generated text usually doesn't make sense. Higher index sizes (up to 5) + * produce more correct text, at the price of less randomness. + * + * @return string + */ + public function realTextBetween($minNbChars = 160, $maxNbChars = 200, $indexSize = 2) + { + if ($minNbChars < 1) { + throw new \InvalidArgumentException('minNbChars must be at least 1'); + } + + if ($maxNbChars < 10) { + throw new \InvalidArgumentException('maxNbChars must be at least 10'); + } + + if ($indexSize < 1) { + throw new \InvalidArgumentException('indexSize must be at least 1'); + } + + if ($indexSize > 5) { + throw new \InvalidArgumentException('indexSize must be at most 5'); + } + + if ($minNbChars >= $maxNbChars) { + throw new \InvalidArgumentException('minNbChars must be smaller than maxNbChars'); + } + + $words = $this->getConsecutiveWords($indexSize); + $iterations = 0; + + do { + ++$iterations; + + if ($iterations >= 100) { + throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a valid real text', $iterations)); + } + + $result = $this->generateText($maxNbChars, $words); + } while (static::strlen($result) <= $minNbChars); + + return $result; + } + + /** + * @param int $maxNbChars + * @param array $words + * + * @return string + */ + protected function generateText($maxNbChars, $words) + { + $result = []; + $resultLength = 0; + // take a random starting point + $next = static::randomKey($words); + + while ($resultLength < $maxNbChars && isset($words[$next])) { + // fetch a random word to append + $word = static::randomElement($words[$next]); + + // calculate next index + $currentWords = static::explode($next); + $currentWords[] = $word; + array_shift($currentWords); + $next = static::implode($currentWords); + + // ensure text starts with an uppercase letter + if ($resultLength == 0 && !static::validStart($word)) { + continue; + } + + // append the element + $result[] = $word; + $resultLength += static::strlen($word) + static::$separatorLen; + } + + // remove the element that caused the text to overflow + array_pop($result); + + // build result + $result = static::implode($result); + + return static::appendEnd($result); + } + + protected function getConsecutiveWords($indexSize) + { + if (!isset($this->consecutiveWords[$indexSize])) { + $parts = $this->getExplodedText(); + $words = []; + $index = []; + + for ($i = 0; $i < $indexSize; ++$i) { + $index[] = array_shift($parts); + } + + for ($i = 0, $count = count($parts); $i < $count; ++$i) { + $stringIndex = static::implode($index); + + if (!isset($words[$stringIndex])) { + $words[$stringIndex] = []; + } + $word = $parts[$i]; + $words[$stringIndex][] = $word; + array_shift($index); + $index[] = $word; + } + // cache look up words for performance + $this->consecutiveWords[$indexSize] = $words; + } + + return $this->consecutiveWords[$indexSize]; + } + + protected function getExplodedText() + { + if ($this->explodedText === null) { + $this->explodedText = static::explode(preg_replace('/\s+/u', ' ', static::$baseText)); + } + + return $this->explodedText; + } + + protected static function explode($text) + { + return explode(static::$separator, $text); + } + + protected static function implode($words) + { + return implode(static::$separator, $words); + } + + protected static function strlen($text) + { + return function_exists('mb_strlen') ? mb_strlen($text, 'UTF-8') : strlen($text); + } + + protected static function validStart($word) + { + $isValid = true; + + if (static::$textStartsWithUppercase) { + $isValid = preg_match('/^\p{Lu}/u', $word); + } + + return $isValid; + } + + protected static function appendEnd($text) + { + return preg_replace("/([ ,-:;\x{2013}\x{2014}]+$)/us", '', $text) . '.'; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/UserAgent.php b/vendor/fakerphp/faker/src/Faker/Provider/UserAgent.php new file mode 100644 index 00000000..a63b7d1f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/UserAgent.php @@ -0,0 +1,187 @@ +> 8) | (($tLo & 0xff000000) >> 24); + $tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8); + $tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8); + } + + // apply version number + $tHi &= 0x0fff; + $tHi |= (3 << 12); + + // cast to string + return sprintf( + '%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x', + $tLo, + $tMi, + $tHi, + $csHi, + $csLo, + $byte[10], + $byte[11], + $byte[12], + $byte[13], + $byte[14], + $byte[15] + ); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Address.php new file mode 100644 index 00000000..8fe73f50 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Address.php @@ -0,0 +1,207 @@ +generator->parse($format)); + } + + /** + * @example 'wewebit.jo' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Payment.php b/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Payment.php new file mode 100644 index 00000000..1e2eaaf0 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Payment.php @@ -0,0 +1,16 @@ +generator->parse($format)); + } + + /** + * @example 'wewebit.jo' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ar_JO/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/ar_JO/Person.php new file mode 100644 index 00000000..27db4e54 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ar_JO/Person.php @@ -0,0 +1,108 @@ +generator->parse($format)); + } + + /** + * @example 'wewebit.jo' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ar_SA/Payment.php b/vendor/fakerphp/faker/src/Faker/Provider/ar_SA/Payment.php new file mode 100644 index 00000000..a09a281d --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ar_SA/Payment.php @@ -0,0 +1,22 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/bg_BG/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/bg_BG/PhoneNumber.php new file mode 100644 index 00000000..22051df4 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/bg_BG/PhoneNumber.php @@ -0,0 +1,20 @@ +generator->parse($format)); + } + + /** + * Generates valid czech IČO + * + * @see http://phpfashion.com/jak-overit-platne-ic-a-rodne-cislo + * + * @return string + */ + public function ico() + { + $ico = static::numerify('#######'); + $split = str_split($ico); + $prod = 0; + + foreach ([8, 7, 6, 5, 4, 3, 2] as $i => $p) { + $prod += $p * $split[$i]; + } + $mod = $prod % 11; + + if ($mod === 0 || $mod === 10) { + return "{$ico}1"; + } + + if ($mod === 1) { + return "{$ico}0"; + } + + return $ico . (11 - $mod); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/DateTime.php b/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/DateTime.php new file mode 100644 index 00000000..e136e651 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/DateTime.php @@ -0,0 +1,65 @@ +format('w')]; + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '2' + */ + public static function dayOfMonth($max = 'now') + { + return static::dateTime($max)->format('j'); + } + + /** + * Full date with inflected month + * + * @return string + * + * @example '16. listopadu 2003' + */ + public function formattedDate() + { + $format = static::randomElement(static::$formattedDateFormat); + + return $this->generator->parse($format); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/Internet.php new file mode 100644 index 00000000..ce5b2661 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/Internet.php @@ -0,0 +1,9 @@ +generator->boolean() ? static::GENDER_MALE : static::GENDER_FEMALE; + } + + $startTimestamp = strtotime("-${maxAge} year"); + $endTimestamp = strtotime("-${minAge} year"); + $randTimestamp = self::numberBetween($startTimestamp, $endTimestamp); + + $year = (int) (date('Y', $randTimestamp)); + $month = (int) (date('n', $randTimestamp)); + $day = (int) (date('j', $randTimestamp)); + $suffix = self::numberBetween(0, 999); + + // women has +50 to month + if ($gender == static::GENDER_FEMALE) { + $month += 50; + } + // from year 2004 everyone has +20 to month when birth numbers in one day are exhausted + if ($year >= 2004 && $this->generator->boolean(10)) { + $month += 20; + } + + $birthNumber = sprintf('%02d%02d%02d%03d', $year % 100, $month, $day, $suffix); + + // from year 1954 birth number includes CRC + if ($year >= 1954) { + $crc = intval($birthNumber, 10) % 11; + + if ($crc == 10) { + $crc = 0; + } + $birthNumber .= sprintf('%d', $crc); + } + + // add slash + if ($this->generator->boolean($slashProbability)) { + $birthNumber = substr($birthNumber, 0, 6) . '/' . substr($birthNumber, 6); + } + + return $birthNumber; + } + + public static function birthNumberMale() + { + return static::birthNumber(static::GENDER_MALE); + } + + public static function birthNumberFemale() + { + return static::birthNumber(static::GENDER_FEMALE); + } + + public function title($gender = null) + { + return static::titleMale(); + } + + /** + * replaced by specific unisex Czech title + */ + public static function titleMale() + { + return static::randomElement(static::$title); + } + + /** + * replaced by specific unisex Czech title + */ + public static function titleFemale() + { + return static::titleMale(); + } + + /** + * @param string|null $gender 'male', 'female' or null for any + * + * @example 'Albrecht' + */ + public function lastName($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::lastNameMale(); + } + + if ($gender === static::GENDER_FEMALE) { + return static::lastNameFemale(); + } + + return $this->generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php new file mode 100644 index 00000000..a527a254 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php @@ -0,0 +1,14 @@ +format('dmy'), static::numerify('%###')); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/da_DK/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/da_DK/PhoneNumber.php new file mode 100644 index 00000000..6e8c28da --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/da_DK/PhoneNumber.php @@ -0,0 +1,18 @@ +format('dmy'); + + do { + $consecutiveNumber = (string) self::numberBetween(100, 999); + + $verificationNumber = ( + (int) $consecutiveNumber[0] * 3 + + (int) $consecutiveNumber[1] * 7 + + (int) $consecutiveNumber[2] * 9 + + (int) $birthDateString[0] * 5 + + (int) $birthDateString[1] * 8 + + (int) $birthDateString[2] * 4 + + (int) $birthDateString[3] * 2 + + (int) $birthDateString[4] * 1 + + (int) $birthDateString[5] * 6 + ) % 11; + } while ($verificationNumber == 10); + + return sprintf('%s%s%s', $consecutiveNumber, $verificationNumber, $birthDateString); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/de_AT/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/de_AT/PhoneNumber.php new file mode 100644 index 00000000..00fbe676 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/de_AT/PhoneNumber.php @@ -0,0 +1,23 @@ + 'Aargau'], + ['AI' => 'Appenzell Innerrhoden'], + ['AR' => 'Appenzell Ausserrhoden'], + ['BE' => 'Bern'], + ['BL' => 'Basel-Landschaft'], + ['BS' => 'Basel-Stadt'], + ['FR' => 'Freiburg'], + ['GE' => 'Genf'], + ['GL' => 'Glarus'], + ['GR' => 'Graubünden'], + ['JU' => 'Jura'], + ['LU' => 'Luzern'], + ['NE' => 'Neuenburg'], + ['NW' => 'Nidwalden'], + ['OW' => 'Obwalden'], + ['SG' => 'St. Gallen'], + ['SH' => 'Schaffhausen'], + ['SO' => 'Solothurn'], + ['SZ' => 'Schwyz'], + ['TG' => 'Thurgau'], + ['TI' => 'Tessin'], + ['UR' => 'Uri'], + ['VD' => 'Waadt'], + ['VS' => 'Wallis'], + ['ZG' => 'Zug'], + ['ZH' => 'Zürich'], + ]; + + protected static $country = [ + 'Afghanistan', 'Alandinseln', 'Albanien', 'Algerien', 'Amerikanisch-Ozeanien', 'Amerikanisch-Samoa', 'Amerikanische Jungferninseln', 'Andorra', 'Angola', 'Anguilla', 'Antarktis', 'Antigua und Barbuda', 'Argentinien', 'Armenien', 'Aruba', 'Aserbaidschan', 'Australien', 'Ägypten', 'Äquatorialguinea', 'Äthiopien', 'Äusseres Ozeanien', + 'Bahamas', 'Bahrain', 'Bangladesch', 'Barbados', 'Belarus', 'Belgien', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivien', 'Bosnien und Herzegowina', 'Botsuana', 'Bouvetinsel', 'Brasilien', 'Britische Jungferninseln', 'Britisches Territorium im Indischen Ozean', 'Brunei Darussalam', 'Bulgarien', 'Burkina Faso', 'Burundi', + 'Chile', 'China', 'Cookinseln', 'Costa Rica', 'Côte d’Ivoire', + 'Demokratische Republik Kongo', 'Demokratische Volksrepublik Korea', 'Deutschland', 'Dominica', 'Dominikanische Republik', 'Dschibuti', 'Dänemark', + 'Ecuador', 'El Salvador', 'Eritrea', 'Estland', 'Europäische Union', + 'Falklandinseln', 'Fidschi', 'Finnland', 'Frankreich', 'Französisch-Guayana', 'Französisch-Polynesien', 'Französische Süd- und Antarktisgebiete', 'Färöer', + 'Gabun', 'Gambia', 'Georgien', 'Ghana', 'Gibraltar', 'Grenada', 'Griechenland', 'Grönland', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana', + 'Haiti', 'Heard- und McDonald-Inseln', 'Honduras', + 'Indien', 'Indonesien', 'Irak', 'Iran', 'Irland', 'Island', 'Isle of Man', 'Israel', 'Italien', + 'Jamaika', 'Japan', 'Jemen', 'Jersey', 'Jordanien', + 'Kaimaninseln', 'Kambodscha', 'Kamerun', 'Kanada', 'Kap Verde', 'Kasachstan', 'Katar', 'Kenia', 'Kirgisistan', 'Kiribati', 'Kokosinseln', 'Kolumbien', 'Komoren', 'Kongo', 'Kroatien', 'Kuba', 'Kuwait', + 'Laos', 'Lesotho', 'Lettland', 'Libanon', 'Liberia', 'Libyen', 'Liechtenstein', 'Litauen', 'Luxemburg', + 'Madagaskar', 'Malawi', 'Malaysia', 'Malediven', 'Mali', 'Malta', 'Marokko', 'Marshallinseln', 'Martinique', 'Mauretanien', 'Mauritius', 'Mayotte', 'Mazedonien', 'Mexiko', 'Mikronesien', 'Monaco', 'Mongolei', 'Montenegro', 'Montserrat', 'Mosambik', 'Myanmar', + 'Namibia', 'Nauru', 'Nepal', 'Neukaledonien', 'Neuseeland', 'Nicaragua', 'Niederlande', 'Niederländische Antillen', 'Niger', 'Nigeria', 'Niue', 'Norfolkinsel', 'Norwegen', 'Nördliche Marianen', + 'Oman', 'Osttimor', 'Österreich', + 'Pakistan', 'Palau', 'Palästinensische Gebiete', 'Panama', 'Papua-Neuguinea', 'Paraguay', 'Peru', 'Philippinen', 'Pitcairn', 'Polen', 'Portugal', 'Puerto Rico', + 'Republik Korea', 'Republik Moldau', 'Ruanda', 'Rumänien', 'Russische Föderation', 'Réunion', + 'Salomonen', 'Sambia', 'Samoa', 'San Marino', 'Saudi-Arabien', 'Schweden', 'Schweiz', 'Senegal', 'Serbien', 'Serbien und Montenegro', 'Seychellen', 'Sierra Leone', 'Simbabwe', 'Singapur', 'Slowakei', 'Slowenien', 'Somalia', 'Sonderverwaltungszone Hongkong', 'Sonderverwaltungszone Macao', 'Spanien', 'Sri Lanka', 'St. Barthélemy', 'St. Helena', 'St. Kitts und Nevis', 'St. Lucia', 'St. Martin', 'St. Pierre und Miquelon', 'St. Vincent und die Grenadinen', 'Sudan', 'Suriname', 'Svalbard und Jan Mayen', 'Swasiland', 'Syrien', 'São Tomé und Príncipe', 'Südafrika', 'Südgeorgien und die Südlichen Sandwichinseln', + 'Tadschikistan', 'Taiwan', 'Tansania', 'Thailand', 'Togo', 'Tokelau', 'Tonga', 'Trinidad und Tobago', 'Tschad', 'Tschechische Republik', 'Tunesien', 'Turkmenistan', 'Turks- und Caicosinseln', 'Tuvalu', 'Türkei', + 'Uganda', 'Ukraine', 'Unbekannte oder ungültige Region', 'Ungarn', 'Uruguay', 'Usbekistan', + 'Vanuatu', 'Vatikanstadt', 'Venezuela', 'Vereinigte Arabische Emirate', 'Vereinigte Staaten', 'Vereinigtes Königreich', 'Vietnam', + 'Wallis und Futuna', 'Weihnachtsinsel', 'Westsahara', + 'Zentralafrikanische Republik', 'Zypern', + ]; + + protected static $cityFormats = [ + '{{cityName}}', + ]; + + protected static $streetNameFormats = [ + '{{lastName}}{{streetSuffixShort}}', + '{{cityName}}{{streetSuffixShort}}', + '{{firstName}}-{{lastName}}-{{streetSuffixLong}}', + ]; + + protected static $streetAddressFormats = [ + '{{streetName}} {{buildingNumber}}', + ]; + protected static $addressFormats = [ + "{{streetAddress}}\n{{postcode}} {{city}}", + ]; + + /** + * Returns a random city name. + * + * @example Luzern + * + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a random street suffix. + * + * @example str. + * + * @return string + */ + public function streetSuffixShort() + { + return static::randomElement(static::$streetSuffixShort); + } + + /** + * Returns a random street suffix. + * + * @example Strasse + * + * @return string + */ + public function streetSuffixLong() + { + return static::randomElement(static::$streetSuffixLong); + } + + /** + * Returns a canton + * + * @example array('BE' => 'Bern') + * + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + + return key($canton); + } + + /** + * Returns the name of canton. + * + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + + return current($canton); + } + + public static function buildingNumber() + { + return static::regexify(self::numerify(static::randomElement(static::$buildingNumber))); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/de_CH/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/de_CH/Company.php new file mode 100644 index 00000000..ead2781e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/de_CH/Company.php @@ -0,0 +1,15 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + /** + * @example 'Θεωδωρόπουλος' + */ + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + /** + * @example 'Κοκκίνου' + */ + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/el_GR/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/el_GR/PhoneNumber.php new file mode 100644 index 00000000..6fe5000e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/el_GR/PhoneNumber.php @@ -0,0 +1,324 @@ +generator->parse( + static::randomElement(static::$fixedLineFormats) + ))); + } + + /** + * Generate a code for a mobile number. + * + * @internal Used to generate mobile numbers. + * + * @return string + */ + public static function mobileCode() + { + return static::randomElement(static::$mobileCodes); + } + + /** + * Generate a mobile number. + * + * @example A mobile number: '6901234567' + * @example A mobile number with spaces: '690 123 4567' + * @example A mobile number with international code prefix: '+306901234567' + * @example A mobile number with international code prefix and spaces: '+30 690 123 4567' + * + * @return string + */ + public function mobileNumber() + { + return ltrim(static::numerify($this->generator->parse( + static::randomElement(static::$mobileFormats) + ))); + } + + /** + * @deprecated Use PhoneNumber::mobileNumber() instead. + */ + public static function mobilePhoneNumber() + { + return static::numerify( + strtr(static::randomElement(static::$mobileFormats), [ + '{{internationalCodePrefix}}' => static::internationalCodePrefix(), + '{{mobileCode}}' => static::mobileCode(), + ]) + ); + } + + /** + * Generate a personal number. + * + * @example A personal number: '7012345678' + * @example A personal number with spaces: '70 1234 5678' + * @example A personal number with international code prefix: '+307012345678' + * @example A personal number with international code prefix and spaces: '+30 70 1234 5678' + * + * @return string + */ + public function personalNumber() + { + return ltrim(static::numerify($this->generator->parse( + static::randomElement(static::$personalFormats) + ))); + } + + /** + * Generate a toll-free number. + * + * @example A toll-free number: '8001234567' + * @example A toll-free number with spaces: '800 123 4567' + * @example A toll-free number with international code prefix: '+308001234567' + * @example A toll-free number with international code prefix and spaces: '+30 800 123 4567' + * + * @return string + */ + public static function tollFreeNumber() + { + return ltrim(static::numerify( + strtr(static::randomElement(static::$tollFreeFormats), [ + '{{internationalCodePrefix}}' => static::internationalCodePrefix(), + ]) + )); + } + + /** + * Generate a code for a shared-cost number. + * + * @internal Used to generate shared-cost numbers. + * + * @return string + */ + public static function sharedCostCode() + { + return static::randomElement(static::$sharedCostCodes); + } + + /** + * Generate a shared-cost number. + * + * @example A shared-cost number: '8011234567' + * @example A shared-cost number with spaces: '801 123 4567' + * @example A shared-cost number with international code prefix: '+308011234567' + * @example A shared-cost number with international code prefix and spaces: '+30 801 123 4567' + * + * @return string + */ + public function sharedCostNumber() + { + return ltrim(static::numerify($this->generator->parse( + static::randomElement(static::$sharedCostFormats) + ))); + } + + /** + * Generate a code for a premium-rate number. + * + * @internal Used to generate premium-rate numbers. + * + * @return string + */ + public static function premiumRateCode() + { + return static::randomElement(static::$premiumRateCodes); + } + + /** + * Generate a premium-rate number. + * + * @example A premium-rate number: '9011234567' + * @example A premium-rate number with spaces: '901 123 4567' + * @example A premium-rate number with international code prefix: '+309011234567' + * @example A premium-rate number with international code prefix and spaces: '+30 901 123 4567' + * + * @return string + */ + public function premiumRateNumber() + { + return ltrim(static::numerify($this->generator->parse( + static::randomElement(static::$premiumRateFormats) + ))); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/el_GR/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/el_GR/Text.php new file mode 100644 index 00000000..f4be7606 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/el_GR/Text.php @@ -0,0 +1,2582 @@ + 0) { + $sum -= 97; + } + $sum = $sum * -1; + + return str_pad((string) $sum, 2, '0', STR_PAD_LEFT); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_GB/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/en_GB/Internet.php new file mode 100644 index 00000000..ef5934ab --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_GB/Internet.php @@ -0,0 +1,9 @@ +generator->parse(static::randomElement(static::$towns)); + } + + public function syllable() + { + return static::randomElement(static::$syllables); + } + + public function direction() + { + return static::randomElement(static::$directions); + } + + public function englishStreetName() + { + return static::randomElement(static::$englishStreetNames); + } + + public function villageSuffix() + { + return static::randomElement(static::$villageSuffixes); + } + + public function estateSuffix() + { + return static::randomElement(static::$estateSuffixes); + } + + public function village() + { + return $this->generator->parse(static::randomElement(static::$villageNameFormats)); + } + + public function estate() + { + return $this->generator->parse(static::randomElement(static::$estateNameFormats)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_HK/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/en_HK/Internet.php new file mode 100644 index 00000000..2de48a53 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_HK/Internet.php @@ -0,0 +1,14 @@ +generator->parse(static::randomElement(static::$societyNameFormat)); + } + + /** + * @example Mumbai + */ + public function city() + { + return static::randomElement(static::$city); + } + + /** + * @example Vaishali Nagar + */ + public function locality() + { + return $this->generator->parse(static::randomElement(static::$localityFormats)); + } + + /** + * @example Kharadi + */ + public function localityName() + { + return $this->generator->parse(static::randomElement(static::$localityName)); + } + + /** + * @example Nagar + */ + public function areaSuffix() + { + return static::randomElement(static::$areaSuffix); + } + + /** + * @example 'Delhi' + */ + public static function state() + { + return static::randomElement(static::$state); + } + + /** + * @example 'DL' + */ + public static function stateAbbr() + { + return static::randomElement(static::$stateAbbr); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_IN/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/en_IN/Internet.php new file mode 100644 index 00000000..a5435352 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_IN/Internet.php @@ -0,0 +1,9 @@ +format('y'); + $checksumArr = ['J', 'Z', 'I', 'H', 'G', 'F', 'E', 'D', 'C', 'B', 'A']; + } + + $length = count($weights); + + for ($i = strlen($result); $i < $length; ++$i) { + $result .= static::randomDigit(); + } + + $checksum = in_array($prefix, ['G', 'T'], true) ? 4 : 0; + + for ($i = 0; $i < $length; ++$i) { + $checksum += (int) $result[$i] * $weights[$i]; + } + + return $prefix . $result . $checksumArr[$checksum % 11]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_SG/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/en_SG/PhoneNumber.php new file mode 100644 index 00000000..f5e3ca6b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_SG/PhoneNumber.php @@ -0,0 +1,105 @@ +generator->parse($format)); + } + + public function fixedLineNumber() + { + $format = static::randomElement(static::$fixedLineNumberFormats); + + return static::numerify($this->generator->parse($format)); + } + + public function voipNumber() + { + $format = static::randomElement(static::$voipNumber); + + return static::numerify($this->generator->parse($format)); + } + + public function internationalCodePrefix() + { + return static::randomElement(static::$internationalCodePrefix); + } + + public function zeroToEight() + { + return static::randomElement(static::$zeroToEight); + } + + public function oneToEight() + { + return static::randomElement(static::$oneToEight); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_UG/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/en_UG/Address.php new file mode 100644 index 00000000..9024b8b7 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_UG/Address.php @@ -0,0 +1,101 @@ + + */ + protected static $areaCodeRegexes = [ + 2 => '(0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])', + 3 => '(0[1-57-9]|1[02-9]|2[0135]|3[0-24679]|4[167]|5[12]|6[014]|8[056])', + 4 => '(0[124-9]|1[02-579]|2[3-5]|3[0245]|4[0235]|58|6[39]|7[0589]|8[04])', + 5 => '(0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[19]|6[1-47]|7[013-5]|8[056])', + 6 => '(0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[017]|6[0-279]|78|8[0-29])', + 7 => '(0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[02-59]|8[156])', + 8 => '(0[1-68]|1[02-8]|2[08]|3[0-28]|4[3578]|5[046-9]|6[02-5]|7[028])', + 9 => '(0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[0179]|5[12469]|7[0-389]|8[04-69])', + ]; + + /** + * @see https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#United_States.2C_Canada.2C_and_other_NANP_countries + */ + protected static $formats = [ + // International format + '+1-{{areaCode}}-{{exchangeCode}}-####', + '+1 ({{areaCode}}) {{exchangeCode}}-####', + '+1-{{areaCode}}-{{exchangeCode}}-####', + '+1.{{areaCode}}.{{exchangeCode}}.####', + '+1{{areaCode}}{{exchangeCode}}####', + + // Standard formats + '{{areaCode}}-{{exchangeCode}}-####', + '({{areaCode}}) {{exchangeCode}}-####', + '1-{{areaCode}}-{{exchangeCode}}-####', + '{{areaCode}}.{{exchangeCode}}.####', + + '{{areaCode}}-{{exchangeCode}}-####', + '({{areaCode}}) {{exchangeCode}}-####', + '1-{{areaCode}}-{{exchangeCode}}-####', + '{{areaCode}}.{{exchangeCode}}.####', + ]; + + protected static $formatsWithExtension = [ + '{{areaCode}}-{{exchangeCode}}-#### x###', + '({{areaCode}}) {{exchangeCode}}-#### x###', + '1-{{areaCode}}-{{exchangeCode}}-#### x###', + '{{areaCode}}.{{exchangeCode}}.#### x###', + + '{{areaCode}}-{{exchangeCode}}-#### x####', + '({{areaCode}}) {{exchangeCode}}-#### x####', + '1-{{areaCode}}-{{exchangeCode}}-#### x####', + '{{areaCode}}.{{exchangeCode}}.#### x####', + + '{{areaCode}}-{{exchangeCode}}-#### x#####', + '({{areaCode}}) {{exchangeCode}}-#### x#####', + '1-{{areaCode}}-{{exchangeCode}}-#### x#####', + '{{areaCode}}.{{exchangeCode}}.#### x#####', + ]; + + protected static $e164Formats = [ + '+1{{areaCode}}{{exchangeCode}}####', + ]; + + /** + * @see https://en.wikipedia.org/wiki/Toll-free_telephone_number#United_States + */ + protected static $tollFreeAreaCodes = [ + 800, 844, 855, 866, 877, 888, + ]; + protected static $tollFreeFormats = [ + // Standard formats + '{{tollFreeAreaCode}}-{{exchangeCode}}-####', + '({{tollFreeAreaCode}}) {{exchangeCode}}-####', + '1-{{tollFreeAreaCode}}-{{exchangeCode}}-####', + '{{tollFreeAreaCode}}.{{exchangeCode}}.####', + ]; + + public function tollFreeAreaCode() + { + return self::randomElement(static::$tollFreeAreaCodes); + } + + public function tollFreePhoneNumber() + { + $format = self::randomElement(static::$tollFreeFormats); + + return self::numerify($this->generator->parse($format)); + } + + /** + * @return string + * + * @example '555-123-546 x123' + */ + public function phoneNumberWithExtension() + { + return static::numerify($this->generator->parse(static::randomElement(static::$formatsWithExtension))); + } + + /** + * NPA-format area code + * + * @see https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Numbering_system + * + * @return string + */ + public static function areaCode() + { + $firstDigit = self::numberBetween(2, 9); + + return $firstDigit . self::regexify(self::$areaCodeRegexes[$firstDigit]); + } + + /** + * NXX-format central office exchange code + * + * @see https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Numbering_system + * + * @return string + */ + public static function exchangeCode() + { + $digits[] = self::numberBetween(2, 9); + $digits[] = self::randomDigit(); + + if ($digits[1] === 1) { + $digits[] = self::randomDigitNot(1); + } else { + $digits[] = self::randomDigit(); + } + + return implode('', $digits); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_US/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/en_US/Text.php new file mode 100644 index 00000000..c15d89d9 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_US/Text.php @@ -0,0 +1,3721 @@ +format('Y'), + static::randomNumber(6, true), + static::randomElement(static::$legalEntities) + ); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_ZA/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/en_ZA/Internet.php new file mode 100644 index 00000000..c2222276 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_ZA/Internet.php @@ -0,0 +1,23 @@ +generator->dateTimeThisCentury(); + } + $birthDateString = $birthdate->format('ymd'); + + switch (strtolower($gender ?: '')) { + case static::GENDER_FEMALE: + $genderDigit = self::numberBetween(0, 4); + + break; + + case static::GENDER_MALE: + $genderDigit = self::numberBetween(5, 9); + + break; + + default: + $genderDigit = self::numberBetween(0, 9); + } + $sequenceDigits = str_pad(self::randomNumber(3), 3, 0, STR_PAD_BOTH); + $citizenDigit = ($citizen === true) ? '0' : '1'; + $raceDigit = self::numberBetween(8, 9); + + $partialIdNumber = $birthDateString . $genderDigit . $sequenceDigits . $citizenDigit . $raceDigit; + + return $partialIdNumber . Luhn::computeCheckDigit($partialIdNumber); + } + + /** + * @see https://en.wikipedia.org/wiki/Driving_licence_in_South_Africa + * + * @return string + */ + public function licenceCode() + { + return static::randomElement(static::$licenceCodes); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_ZA/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/en_ZA/PhoneNumber.php new file mode 100644 index 00000000..567631a0 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_ZA/PhoneNumber.php @@ -0,0 +1,116 @@ +generator->parse($format)); + } + + public function tollFreeNumber() + { + $format = static::randomElement(static::$specialFormats); + + return self::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/es_AR/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/es_AR/Address.php new file mode 100644 index 00000000..457f8caf --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/es_AR/Address.php @@ -0,0 +1,68 @@ +numberBetween(10000, 100000000); + } + + return $id . $separator . $this->numberBetween(80000000, 100000000); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/es_VE/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/es_VE/PhoneNumber.php new file mode 100644 index 00000000..cfe6438f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/es_VE/PhoneNumber.php @@ -0,0 +1,29 @@ +generator->parse($format); + } + + /** + * @example 'کد پستی' + */ + public static function postcodePrefix() + { + return static::randomElement(static::$postcodePrefix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/Company.php new file mode 100644 index 00000000..15da3c5a --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/Company.php @@ -0,0 +1,60 @@ +generator->parse($format)); + } + + /** + * @example 'ahmad.ir' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/Person.php new file mode 100644 index 00000000..546e2a3f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/Person.php @@ -0,0 +1,210 @@ + 1; --$i) { + $sum += $subNationalCodeString[$count] * ($i); + ++$count; + } + + if (($sum % 11) < 2) { + return $sum % 11; + } + + return 11 - ($sum % 11); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/PhoneNumber.php new file mode 100644 index 00000000..a9606d02 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/PhoneNumber.php @@ -0,0 +1,76 @@ + 5) { + throw new \InvalidArgumentException('indexSize must be at most 5'); + } + + $words = $this->getConsecutiveWords($indexSize); + $result = []; + $resultLength = 0; + // take a random starting point + $next = static::randomKey($words); + + while ($resultLength < $maxNbChars && isset($words[$next])) { + // fetch a random word to append + $word = static::randomElement($words[$next]); + + // calculate next index + $currentWords = explode(' ', $next); + + $currentWords[] = $word; + array_shift($currentWords); + $next = implode(' ', $currentWords); + + if ($resultLength == 0 && !preg_match('/^[\x{0600}-\x{06FF}]/u', $word)) { + continue; + } + // append the element + $result[] = $word; + $resultLength += strlen($word) + 1; + } + + // remove the element that caused the text to overflow + array_pop($result); + + // build result + $result = implode(' ', $result); + + return $result . '.'; + } + + /** + * License: Creative Commons Attribution-ShareAlike License + * + * Title: مدیر مدرسه + * Author: جلال آل‌احمد + * Language: Persian + * + * @see http://fa.wikisource.org/wiki/%D9%85%D8%AF%DB%8C%D8%B1_%D9%85%D8%AF%D8%B1%D8%B3%D9%87 + * + * @var string + */ + protected static $baseText = <<<'EOT' +از در که وارد شدم سیگارم دستم بود. زورم آمد سلام کنم. همین طوری دنگم گرفته بود قد باشم. رئیس فرهنگ که اجازه‌ی نشستن داد، نگاهش لحظه‌ای روی دستم مکث کرد و بعد چیزی را که می‌نوشت، تمام کرد و می‌خواست متوجه من بشود که رونویس حکم را روی میزش گذاشته بودم. حرفی نزدیم. رونویس را با کاغذهای ضمیمه‌اش زیر و رو کرد و بعد غبغب انداخت و آرام و مثلاً خالی از عصبانیت گفت: + +- جا نداریم آقا. این که نمی‌شه! هر روز یه حکم می‌دند دست یکی می‌فرستنش سراغ من... دیروز به آقای مدیر کل... + +حوصله‌ی این اباطیل را نداشتم. حرفش را بریدم که: + +- ممکنه خواهش کنم زیر همین ورقه مرقوم بفرمایید؟ + +و سیگارم را توی زیرسیگاری براق روی میزش تکاندم. روی میز، پاک و مرتب بود. درست مثل اتاق همان مهمان‌خانه‌ی تازه‌عروس‌ها. هر چیز به جای خود و نه یک ذره گرد. فقط خاکستر سیگار من زیادی بود. مثل تفی در صورت تازه تراشیده‌ای.... قلم را برداشت و زیر حکم چیزی نوشت و امضا کرد و من از در آمده بودم بیرون. خلاص. تحمل این یکی را نداشتم. با اداهایش. پیدا بود که تازه رئیس شده. زورکی غبغب می‌انداخت و حرفش را آهسته توی چشم آدم می‌زد. انگار برای شنیدنش گوش لازم نیست. صد و پنجاه تومان در کارگزینی کل مایه گذاشته بودم تا این حکم را به امضا رسانده بودم. توصیه هم برده بودم و تازه دو ماه هم دویده بودم. مو، لای درزش نمی‌رفت. می‌دانستم که چه او بپذیرد، چه نپذیرد، کار تمام است. خودش هم می‌دانست. حتماً هم دستگیرش شد که با این نک و نالی که می‌کرد، خودش را کنف کرده. ولی کاری بود و شده بود. در کارگزینی کل، سفارش کرده بودند که برای خالی نبودن عریضه رونویس را به رؤیت رئیس فرهنگ هم برسانم تازه این طور شد. و گر نه بالی حکم کارگزینی کل چه کسی می‌توانست حرفی بزند؟ یک وزارت خانه بود و یک کارگزینی! شوخی که نبود. ته دلم قرص‌تر از این‌ها بود که محتاج به این استدلال‌ها باشم. اما به نظرم همه‌ی این تقصیرها از این سیگار لعنتی بود که به خیال خودم خواسته بودم خرجش را از محل اضافه حقوق شغل جدیدم در بیاورم. البته از معلمی، هم اُقم نشسته بود. ده سال «الف.ب.» درس دادن و قیافه‌های بهت‌زده‌ی بچه‌های مردم برای مزخرف‌ترین چرندی که می‌گویی... و استغناء با غین و استقراء با قاف و خراسانی و هندی و قدیمی‌ترین شعر دری و صنعت ارسال مثل و ردالعجز... و از این مزخرفات! دیدم دارم خر می‌شوم. گفتم مدیر بشوم. مدیر دبستان! دیگر نه درس خواهم داد و نه مجبور خواهم بود برای فرار از اتلاف وقت، در امتحان تجدیدی به هر احمق بی‌شعوری هفت بدهم تا ایام آخر تابستانم را که لذیذترین تکه‌ی تعطیلات است، نجات داده باشم. این بود که راه افتادم. رفتم و از اهلش پرسیدم. از یک کار چاق کن. دستم را توی دست کارگزینی گذاشت و قول و قرار و طرفین خوش و خرم و یک روز هم نشانی مدرسه را دستم دادند که بروم وارسی، که باب میلم هست یا نه. + +و رفتم. مدرسه دو طبقه بود و نوساز بود و در دامنه‌ی کوه تنها افتاده بود و آفتاب‌رو بود. یک فرهنگ‌دوست خرپول، عمارتش را وسط زمین خودش ساخته بود و بیست و پنج سال هم در اختیار فرهنگ گذاشته بود که مدرسه‌اش کنند و رفت و آمد بشود و جاده‌ها کوبیده بشود و این قدر ازین بشودها بشود، تا دل ننه باباها بسوزد و برای این‌که راه بچه‌هاشان را کوتاه بکنند، بیایند همان اطراف مدرسه را بخرند و خانه بسازند و زمین یارو از متری یک عباسی بشود صد تومان. یارو اسمش را هم روی دیوار مدرسه کاشی‌کاری کرده بود. هنوز در و همسایه پیدا نکرده بودند که حرف‌شان بشود و لنگ و پاچه‌ی سعدی و باباطاهر را بکشند میان و یک ورق دیگر از تاریخ‌الشعرا را بکوبند روی نبش دیوار کوچه‌شان. تابلوی مدرسه هم حسابی و بزرگ و خوانا. از صد متری داد می‌زد که توانا بود هر.... هر چه دلتان بخواهد! با شیر و خورشیدش که آن بالا سر، سه پا ایستاده بود و زورکی تعادل خودش را حفظ می‌کرد و خورشید خانم روی کولش با ابروهای پیوسته و قمچیلی که به دست داشت و تا سه تیر پرتاب، اطراف مدرسه بیابان بود. درندشت و بی آب و آبادانی و آن ته رو به شمال، ردیف کاج‌های درهم فرو رفته‌ای که از سر دیوار گلی یک باغ پیدا بود روی آسمان لکه‌ی دراز و تیره‌ای زده بود. حتماً تا بیست و پنج سال دیگر همه‌ی این اطراف پر می‌شد و بوق ماشین و ونگ ونگ بچه‌ها و فریاد لبویی و زنگ روزنامه‌فروشی و عربده‌ی گل به سر دارم خیار! نان یارو توی روغن بود. + +- راستی شاید متری ده دوازده شاهی بیشتر نخریده باشد؟ شاید هم زمین‌ها را همین جوری به ثبت داده باشد؟ هان؟ + +- احمق به توچه؟!... + +بله این فکرها را همان روزی کردم که ناشناس به مدرسه سر زدم و آخر سر هم به این نتیجه رسیدم که مردم حق دارند جایی بخوابند که آب زیرشان نرود. + +- تو اگر مردی، عرضه داشته باش مدیر همین مدرسه هم بشو. + +و رفته بودم و دنبال کار را گرفته بودم تا رسیده بودم به این‌جا. همان روز وارسی فهمیده بودم که مدیر قبلی مدرسه زندانی است. لابد کله‌اش بوی قرمه‌سبزی می‌داده و باز لابد حالا دارد کفاره‌ی گناهانی را می‌دهد که یا خودش نکرده یا آهنگری در بلخ کرده. جزو پر قیچی‌های رئیس فرهنگ هم کسی نبود که با مدیرشان، اضافه حقوقی نصیبش بشود و ناچار سر و دستی برای این کار بشکند. خارج از مرکز هم نداشت. این معلومات را توی کارگزینی به دست آورده بودم. هنوز «گه خوردم نامه‌نویسی» هم مد نشده بود که بگویم یارو به این زودی‌ها از سولدونی در خواهد آمد. فکر نمی‌کردم که دیگری هم برای این وسط بیابان دلش لک زده باشد با زمستان سختش و با رفت و آمد دشوارش. + +این بود که خیالم راحت بود. از همه‌ی این‌ها گذشته کارگزینی کل موافقت کرده بود! دست است که پیش از بلند شدن بوی اسکناس، آن جا هم دو سه تا عیب شرعی و عرفی گرفته بودند و مثلاً گفته بودن لابد کاسه‌ای زیر نیم کاسه است که فلانی یعنی من، با ده سال سابقه‌ی تدریس، می‌خواهد مدیر دبستان بشود! غرض‌شان این بود که لابد خل شدم که از شغل مهم و محترم دبیری دست می‌شویم. ماهی صد و پنجاه تومان حق مقام در آن روزها پولی نبود که بتوانم نادیده بگیرم. و تازه اگر ندیده می‌گرفتم چه؟ باز باید بر می‌گشتم به این کلاس‌ها و این جور حماقت‌ها. این بود که پیش رئیس فرهنگ، صاف برگشتم به کارگزینی کل، سراغ آن که بفهمی نفهمی، دلال کارم بود. و رونویس حکم را گذاشتم و گفتم که چه طور شد و آمدم بیرون. + +دو روز بعد رفتم سراغش. معلوم شد که حدسم درست بوده است و رئیس فرهنگ گفته بوده: «من از این لیسانسه‌های پر افاده نمی‌خواهم که سیگار به دست توی هر اتاقی سر می‌کنند.» + +و یارو برایش گفته بود که اصلاً وابدا..! فلانی همچین و همچون است و مثقالی هفت صنار با دیگران فرق دارد و این هندوانه‌ها و خیال من راحت باشد و پنج‌شنبه یک هفته‌ی دیگر خودم بروم پهلوی او... و این کار را کردم. این بار رئیس فرهنگ جلوی پایم بلند شد که: «ای آقا... چرا اول نفرمودید؟!...» و از کارمندهایش گله کرد و به قول خودش، مرا «در جریان موقعیت محل» گذاشت و بعد با ماشین خودش مرا به مدرسه رساند و گفت زنگ را زودتر از موعد زدند و در حضور معلم‌ها و ناظم، نطق غرایی در خصائل مدیر جدید – که من باشم – کرد و بعد هم مرا گذاشت و رفت با یک مدرسه‌ی شش کلاسه‌ی «نوبنیاد» و یک ناظم و هفت تا معلم و دویست و سی و پنج تا شاگرد. دیگر حسابی مدیر مدرسه شده بودم! + +ناظم، جوان رشیدی بود که بلند حرف می‌زد و به راحتی امر و نهی می‌کرد و بیا و برویی داشت و با شاگردهای درشت، روی هم ریخته بود که خودشان ترتیب کارها را می‌دادند و پیدا بود که به سر خر احتیاجی ندارد و بی‌مدیر هم می‌تواند گلیم مدرسه را از آب بکشد. معلم کلاس چهار خیلی گنده بود. دو تای یک آدم حسابی. توی دفتر، اولین چیزی که به چشم می‌آمد. از آن‌هایی که اگر توی کوچه ببینی، خیال می‌کنی مدیر کل است. لفظ قلم حرف می‌زد و شاید به همین دلیل بود که وقتی رئیس فرهنگ رفت و تشریفات را با خودش برد، از طرف همکارانش تبریک ورود گفت و اشاره کرد به اینکه «ان‌شاءالله زیر سایه‌ی سرکار، سال دیگر کلاس‌های دبیرستان را هم خواهیم داشت.» پیدا بود که این هیکل کم‌کم دارد از سر دبستان زیادی می‌کند! وقتی حرف می‌زد همه‌اش درین فکر بودم که با نان آقا معلمی چه طور می‌شد چنین هیکلی به هم زد و چنین سر و تیپی داشت؟ و راستش تصمیم گرفتم که از فردا صبح به صبح ریشم را بتراشم و یخه‌ام تمیز باشد و اتوی شلوارم تیز. + +معلم کلاس اول باریکه‌ای بود، سیاه سوخته. با ته ریشی و سر ماشین کرده‌ای و یخه‌ی بسته. بی‌کراوات. شبیه میرزابنویس‌های دم پست‌خانه. حتی نوکر باب می‌نمود. و من آن روز نتوانستم بفهمم وقتی حرف می‌زند کجا را نگاه می‌کند. با هر جیغ کوتاهی که می‌زد هرهر می‌خندید. با این قضیه نمی‌شد کاری کرد. معلم کلاس سه، یک جوان ترکه‌ای بود؛ بلند و با صورت استخوانی و ریش از ته تراشیده و یخه‌ی بلند آهاردار. مثل فرفره می‌جنبید. چشم‌هایش برق عجیبی می‌زد که فقط از هوش نبود، چیزی از ناسلامتی در برق چشم‌هایش بود که مرا واداشت از ناظم بپرسم مبادا مسلول باشد. البته مسلول نبود، تنها بود و در دانشگاه درس می‌خواند. کلاس‌های پنجم و ششم را دو نفر با هم اداره می‌کردند. یکی فارسی و شرعیات و تاریخ، جغرافی و کاردستی و این جور سرگرمی‌ها را می‌گفت، که جوانکی بود بریانتین زده، با شلوار پاچه تنگ و پوشت و کراوات زرد و پهنی که نعش یک لنگر بزرگ آن را روی سینه‌اش نگه داشته بود و دائماً دستش حمایل موهای سرش بود و دم به دم توی شیشه‌ها نگاه می‌کرد. و آن دیگری که حساب و مرابحه و چیزهای دیگر می‌گفت، جوانی بود موقر و سنگین مازندرانی به نظر می‌آمد و به خودش اطمینان داشت. غیر از این‌ها، یک معلم ورزش هم داشتیم که دو هفته بعد دیدمش و اصفهانی بود و از آن قاچاق‌ها. + +رئیس فرهنگ که رفت، گرم و نرم از همه‌شان حال و احوال پرسیدم. بعد به همه سیگار تعارف کردم. سراپا همکاری و همدردی بود. از کار و بار هر کدامشان پرسیدم. فقط همان معلم کلاس سه، دانشگاه می‌رفت. آن که لنگر به سینه انداخته بود، شب‌ها انگلیسی می‌خواند که برود آمریکا. چای و بساطی در کار نبود و ربع ساعت‌های تفریح، فقط توی دفتر جمع می‌شدند و دوباره از نو. و این نمی‌شد. باید همه‌ی سنن را رعایت کرد. دست کردم و یک پنج تومانی روی میز گذاشتم و قرار شد قبل و منقلی تهیه کنند و خودشان چای را راه بیندازند. + +بعد از زنگ قرار شد من سر صف نطقی بکنم. ناظم قضیه را در دو سه کلمه برای بچه‌ها گفت که من رسیدم و همه دست زدند. چیزی نداشتم برایشان بگویم. فقط یادم است اشاره‌ای به این کردم که مدیر خیلی دلش می‌خواست یکی از شما را به جای فرزند داشته باشد و حالا نمی‌داند با این همه فرزند چه بکند؟! که بی‌صدا خندیدند و در میان صف‌های عقب یکی پکی زد به خنده. واهمه برم داشت که «نه بابا. کار ساده‌ای هم نیست!» قبلاً فکر کرده بودم که می‌روم و فارغ از دردسر اداره‌ی کلاس، در اتاق را روی خودم می‌بندم و کار خودم را می‌کنم. اما حالا می‌دیدم به این سادگی‌ها هم نیست. اگر فردا یکی‌شان زد سر اون یکی را شکست، اگر یکی زیر ماشین رفت؛ اگر یکی از ایوان افتاد؛ چه خاکی به سرم خواهم ریخت؟ + +حالا من مانده بودم و ناظم که چیزی از لای در آهسته خزید تو. کسی بود؛ فراش مدرسه با قیافه‌ای دهاتی و ریش نتراشیده و قدی کوتاه و گشاد گشاد راه می‌رفت و دست‌هایش را دور از بدن نگه می‌داشت. آمد و همان کنار در ایستاد. صاف توی چشمم نگاه می‌کرد. حال او را هم پرسیدم. هر چه بود او هم می‌توانست یک گوشه‌ی این بار را بگیرد. در یک دقیقه همه‌ی درد دل‌هایش را کرد و التماس دعاهایش که تمام شد، فرستادمش برایم چای درست کند و بیاورد. بعد از آن من به ناظم پرداختم. سال پیش، از دانشسرای مقدماتی در آمده بود. یک سال گرمسار و کرج کار کرده بود و امسال آمده بود این‌جا. پدرش دو تا زن داشته. از اولی دو تا پسر که هر دو تا چاقوکش از آب در آمده‌اند و از دومی فقط او مانده بود که درس‌خوان شده و سرشناس و نان مادرش را می‌دهد که مریض است و از پدر سال‌هاست که خبری نیست و... یک اتاق گرفته‌اند به پنجاه تومان و صد و پنجاه تومان حقوق به جایی نمی‌رسد و تازه زور که بزند سه سال دیگر می‌تواند از حق فنی نظامت مدرسه استفاده کند + +... بعد بلند شدیم که به کلاس‌ها سرکشی کنیم. بعد با ناظم به تک تک کلاس‌ها سر زدیم در این میان من به یاد دوران دبستان خودم افتادم. در کلاس ششم را باز کردیم «... ت بی پدرو مادر» جوانک بریانتین زده خورد توی صورت‌مان. یکی از بچه‌ها صورتش مثل چغندر قرمز بود. لابد بزک فحش هنوز باقی بود. قرائت فارسی داشتند. معلم دستهایش توی جیبش بود و سینه‌اش را پیش داده بود و زبان به شکایت باز کرد: + +- آقای مدیر! اصلاً دوستی سرشون نمی‌شه. تو سَری می‌خوان. ملاحظه کنید بنده با چه صمیمیتی... + +حرفش را در تشدید «ایت» بریدم که: + +- صحیح می‌فرمایید. این بار به من ببخشید. + +و از در آمدیم بیرون. بعد از آن به اطاقی که در آینده مال من بود سر زدیم. بهتر از این نمی‌شد. بی سر و صدا، آفتاب‌رو، دور افتاده. + +وسط حیاط، یک حوض بزرگ بود و کم‌عمق. تنها قسمت ساختمان بود که رعایت حال بچه‌های قد و نیم قد در آن شده بود. دور حیاط دیوار بلندی بود درست مثل دیوار چین. سد مرتفعی در مقابل فرار احتمالی فرهنگ و ته حیاط مستراح و اتاق فراش بغلش و انبار زغال و بعد هم یک کلاس. به مستراح هم سر کشیدیم. همه بی در و سقف و تیغه‌ای میان آن‌ها. نگاهی به ناظم کردم که پا به پایم می‌آمد. گفت: + +- دردسر عجیبی شده آقا. تا حالا صد تا کاغذ به ادارفردا صبح رفتم مدرسه. بچه‌ها با صف‌هاشان به طرف کلاس‌ها می‌رفتند و ناظم چوب به دست توی ایوان ایستاده بود و توی دفتر دو تا از معلم‌ها بودند. معلوم شد کار هر روزه‌شان است. ناظم را هم فرستادم سر یک کلاس دیگر و خودم آمدم دم در مدرسه به قدم زدن؛ فکر کردم از هر طرف که بیایند مرا این ته، دم در مدرسه خواهند دید و تمام طول راه در این خجالت خواهند ماند و دیگر دیر نخواهند آمد. یک سیاهی از ته جاده‌ی جنوبی پیداشد. جوانک بریانتین زده بود. مسلماً او هم مرا می‌دید، ولی آهسته‌تر از آن می‌آمد که یک معلم تأخیر کرده جلوی مدیرش می‌آمد. جلوتر که آمد حتی شنیدم که سوت می‌زد. اما بی‌انصاف چنان سلانه سلانه می‌آمد که دیدم هیچ جای گذشت نیست. اصلاً محل سگ به من نمی‌گذاشت. داشتم از کوره در می‌رفتم که یک مرتبه احساس کردم تغییری در رفتار خود داد و تند کرد. + +به خیر گذشت و گرنه خدا عالم است چه اتفاقی می‌افتاد. سلام که کرد مثل این که می‌خواست چیزی بگوید که پیش دستی کردم: + +- بفرمایید آقا. بفرمایید، بچه‌ها منتظرند. + +واقعاً به خیر گذشت. شاید اتوبوسش دیر کرده. شاید راه‌بندان بوده؛ جاده قرق بوده و باز یک گردن‌کلفتی از اقصای عالم می‌آمده که ازین سفره‌ی مرتضی علی بی‌نصیب نماند. به هر صورت در دل بخشیدمش. چه خوب شد که بد و بی‌راهی نگفتی! که از دور علم افراشته‌ی هیکل معلم کلاس چهارم نمایان شد. از همان ته مرا دیده بود. تقریباً می‌دوید. تحمل این یکی را نداشتم. «بدکاری می‌کنی. اول بسم‌الله و مته به خشخاش!» رفتم و توی دفتر نشستم و خودم را به کاری مشغول کردم که هن هن کنان رسید. چنان عرق از پیشانی‌اش می‌ریخت که راستی خجالت کشیدم. یک لیوان آب از کوه به دستش دادم و مسخ‌شده‌ی خنده‌اش را با آب به خوردش دادم و بلند که شد برود، گفتم: + +- عوضش دو کیلو لاغر شدید. + +برگشت نگاهی کرد و خنده‌ای و رفت. ناگهان ناظم از در وارد شد و از را ه نرسیده گفت: + +- دیدید آقا! این جوری می‌آند مدرسه. اون قرتی که عین خیالش هم نبود آقا! اما این یکی... + +از او پرسیدم: + +- انگار هنوز دو تا از کلاس‌ها ولند؟ + +- بله آقا. کلاس سه ورزش دارند. گفتم بنشینند دیکته بنویسند آقا. معلم حساب پنج و شش هم که نیومده آقا. + +در همین حین یکی از عکس‌های بزرگ دخمه‌های هخامنشی را که به دیوار کوبیده بود پس زد و: + +- نگاه کنید آقا... + +روی گچ دیوار با مداد قرمز و نه چندان درشت، به عجله و ناشیانه علامت داس کشیده بودند. همچنین دنبال کرد: + +- از آثار دوره‌ی اوناست آقا. کارشون همین چیزها بود. روزنومه بفروشند. تبلیغات کنند و داس چکش بکشند آقا. رئیس‌شون رو که گرفتند چه جونی کندم آقا تا حالی‌شون کنم که دست ور دارند آقا. و از روی میز پرید پایین. + +- گفتم مگه باز هم هستند؟ + +- آره آقا، پس چی! یکی همین آقازاده که هنوز نیومده آقا. هر روز نیم ساعت تأخیر داره آقا. یکی هم مثل کلاس سه. + +- خوب چرا تا حالا پاکش نکردی؟ + +- به! آخه آدم درد دلشو واسه‌ی کی بگه؟ آخه آقا در میان تو روی آدم می‌گند جاسوس، مأمور! باهاش حرفم شده آقا. کتک و کتک‌کاری! + +و بعد یک سخنرانی که چه طور مدرسه را خراب کرده‌اند و اعتماد اهل محله را چه طور از بین برده‌اند که نه انجمنی، نه کمکی به بی‌بضاعت‌ها؛ و از این حرف ها. + +بعد از سخنرانی آقای ناظم دستمالم را دادم که آن عکس‌ها را پاک کند و بعد هم راه افتادم که بروم سراغ اتاق خودم. در اتاقم را که باز کردم، داشتم دماغم با بوی خاک نم کشیده‌اش اخت می‌کرد که آخرین معلم هم آمد. آمدم توی ایوان و با صدای بلند، جوری که در تمام مدرسه بشنوند، ناظم را صدا زدم و گفتم با قلم قرمز برای آقا یک ساعت تأخیر بگذارند.ه‌ی ساختمان نوشتیم آقا. می‌گند نمی‌شه پول دولت رو تو ملک دیگرون خرج کرد. + +- گفتم راست می‌گند. + +دیگه کافی بود. آمدیم بیرون. همان توی حیاط تا نفسی تازه کنیم وضع مالی و بودجه و ازین حرف‌های مدرسه را پرسیدم. هر اتاق ماهی پانزده ریال حق نظافت داشت. لوازم‌التحریر و دفترها را هم اداره‌ی فرهنگ می‌داد. ماهی بیست و پنج تومان هم برای آب خوردن داشتند که هنوز وصول نشده بود. برای نصب هر بخاری سالی سه تومان. ماهی سی تومان هم تنخواه‌گردان مدرسه بود که مثل پول آب سوخت شده بود و حالا هم ماه دوم سال بود. اواخر آبان. حالیش کردم که حوصله‌ی این کارها را ندارم و غرضم را از مدیر شدن برایش خلاصه کردم و گفتم حاضرم همه‌ی اختیارات را به او بدهم. «اصلاً انگار که هنوز مدیر نیامده.» مهر مدرسه هم پهلوی خودش باشد. البته او را هنوز نمی‌شناختم. شنیده بودم که مدیرها قبلاً ناظم خودشان را انتخاب می‌کنند، اما من نه کسی را سراغ داشتم و نه حوصله‌اش را. حکم خودم را هم به زور گرفته بودم. سنگ‌هامان را وا کندیم و به دفتر رفتیم و چایی را که فراش از بساط خانه‌اش درست کرده بود، خوردیم تا زنگ را زدند و باز هم زدند و من نگاهی به پرونده‌های شاگردها کردم که هر کدام عبارت بود از دو برگ کاغذ. از همین دو سه برگ کاغذ دانستم که اولیای بچه‌ها اغلب زارع و باغبان و اویارند و قبل از این‌که زنگ آخر را بزنند و مدرسه تعطیل بشود بیرون آمدم. برای روز اول خیلی زیاد بود. + +فردا صبح رفتم مدرسه. بچه‌ها با صف‌هاشان به طرف کلاس‌ها می‌رفتند و ناظم چوب به دست توی ایوان ایستاده بود و توی دفتر دو تا از معلم‌ها بودند. معلوم شد کار هر روزه‌شان است. ناظم را هم فرستادم سر یک کلاس دیگر و خودم آمدم دم در مدرسه به قدم زدن؛ فکر کردم از هر طرف که بیایند مرا این ته، دم در مدرسه خواهند دید و تمام طول راه در این خجالت خواهند ماند و دیگر دیر نخواهند آمد. یک سیاهی از ته جاده‌ی جنوبی پیداشد. جوانک بریانتین زده بود. مسلماً او هم مرا می‌دید، ولی آهسته‌تر از آن می‌آمد که یک معلم تأخیر کرده جلوی مدیرش می‌آمد. جلوتر که آمد حتی شنیدم که سوت می‌زد. اما بی‌انصاف چنان سلانه سلانه می‌آمد که دیدم هیچ جای گذشت نیست. اصلاً محل سگ به من نمی‌گذاشت. داشتم از کوره در می‌رفتم که یک مرتبه احساس کردم تغییری در رفتار خود داد و تند کرد. + +به خیر گذشت و گرنه خدا عالم است چه اتفاقی می‌افتاد. سلام که کرد مثل این که می‌خواست چیزی بگوید که پیش دستی کردم: + +- بفرمایید آقا. بفرمایید، بچه‌ها منتظرند. + +واقعاً به خیر گذشت. شاید اتوبوسش دیر کرده. شاید راه‌بندان بوده؛ جاده قرق بوده و باز یک گردن‌کلفتی از اقصای عالم می‌آمده که ازین سفره‌ی مرتضی علی بی‌نصیب نماند. به هر صورت در دل بخشیدمش. چه خوب شد که بد و بی‌راهی نگفتی! که از دور علم افراشته‌ی هیکل معلم کلاس چهارم نمایان شد. از همان ته مرا دیده بود. تقریباً می‌دوید. تحمل این یکی را نداشتم. «بدکاری می‌کنی. اول بسم‌الله و مته به خشخاش!» رفتم و توی دفتر نشستم و خودم را به کاری مشغول کردم که هن هن کنان رسید. چنان عرق از پیشانی‌اش می‌ریخت که راستی خجالت کشیدم. یک لیوان آب از کوه به دستش دادم و مسخ‌شده‌ی خنده‌اش را با آب به خوردش دادم و بلند که شد برود، گفتم: + +- عوضش دو کیلو لاغر شدید. + +برگشت نگاهی کرد و خنده‌ای و رفت. ناگهان ناظم از در وارد شد و از را ه نرسیده گفت: + +- دیدید آقا! این جوری می‌آند مدرسه. اون قرتی که عین خیالش هم نبود آقا! اما این یکی... + +از او پرسیدم: + +- انگار هنوز دو تا از کلاس‌ها ولند؟ + +- بله آقا. کلاس سه ورزش دارند. گفتم بنشینند دیکته بنویسند آقا. معلم حساب پنج و شش هم که نیومده آقا. + +در همین حین یکی از عکس‌های بزرگ دخمه‌های هخامنشی را که به دیوار کوبیده بود پس زد و: + +- نگاه کنید آقا... + +روی گچ دیوار با مداد قرمز و نه چندان درشت، به عجله و ناشیانه علامت داس کشیده بودند. همچنین دنبال کرد: + +- از آثار دوره‌ی اوناست آقا. کارشون همین چیزها بود. روزنومه بفروشند. تبلیغات کنند و داس چکش بکشند آقا. رئیس‌شون رو که گرفتند چه جونی کندم آقا تا حالی‌شون کنم که دست ور دارند آقا. و از روی میز پرید پایین. + +- گفتم مگه باز هم هستند؟ + +- آره آقا، پس چی! یکی همین آقازاده که هنوز نیومده آقا. هر روز نیم ساعت تأخیر داره آقا. یکی هم مثل کلاس سه. + +- خوب چرا تا حالا پاکش نکردی؟ + +- به! آخه آدم درد دلشو واسه‌ی کی بگه؟ آخه آقا در میان تو روی آدم می‌گند جاسوس، مأمور! باهاش حرفم شده آقا. کتک و کتک‌کاری! + +و بعد یک سخنرانی که چه طور مدرسه را خراب کرده‌اند و اعتماد اهل محله را چه طور از بین برده‌اند که نه انجمنی، نه کمکی به بی‌بضاعت‌ها؛ و از این حرف ها. + +بعد از سخنرانی آقای ناظم دستمالم را دادم که آن عکس‌ها را پاک کند و بعد هم راه افتادم که بروم سراغ اتاق خودم. در اتاقم را که باز کردم، داشتم دماغم با بوی خاک نم کشیده‌اش اخت می‌کرد که آخرین معلم هم آمد. آمدم توی ایوان و با صدای بلند، جوری که در تمام مدرسه بشنوند، ناظم را صدا زدم و گفتم با قلم قرمز برای آقا یک ساعت تأخیر بگذارند. + +روز سوم باز اول وقت مدرسه بودم. هنوز از پشت دیوار نپیچیده بودم که صدای سوز و بریز بچه‌ها به پیشبازم آمد. تند کردم. پنج تا از بچه‌ها توی ایوان به خودشان می‌پیچیدند و ناظم ترکه‌ای به دست داشت و به نوبت به کف دست‌شان می‌زد. بچه‌ها التماس می‌کردند؛ گریه می‌کردند؛ اما دستشان را هم دراز می‌کردند. نزدیک بود داد بزنم یا با لگد بزنم و ناظم را پرت کنم آن طرف. پشتش به من بود و من را نمی‌دید. ناگهان زمزمه‌ای توی صف‌ها افتاد که یک مرتبه مرا به صرافت انداخت که در مقام مدیریت مدرسه، به سختی می‌شود ناظم را کتک زد. این بود که خشمم را فرو خوردم و آرام از پله‌ها رفتم بالا. ناظم، تازه متوجه من شده بود در همین حین دخالتم را کردم و خواهش کردم این بار همه‌شان را به من ببخشند. + +نمی‌دانم چه کار خطایی از آنها سر زده بود که ناظم را تا این حد عصبانی کرده بود. بچه‌ها سکسکه‌کنان رفتند توی صف‌ها و بعد زنگ را زدند و صف‌ها رفتند به کلاس‌ها و دنبالشان هم معلم‌ها که همه سر وقت حاضر بودند. نگاهی به ناظم انداختم که تازه حالش سر جا آمده بود و گفتم در آن حالی که داشت، ممکن بود گردن یک کدامشان را بشکند. که مرتبه براق شد: + +- اگه یک روز جلوشونو نگیرید سوارتون می‌شند آقا. نمی‌دونید چه قاطرهای چموشی شده‌اند آقا. + +مثل بچه مدرسه‌ای‌ها آقا آقا می‌کرد. موضوع را برگرداندم و احوال مادرش را پرسیدم. خنده، صورتش را از هم باز کرد و صدا زد فراش برایش آب بیاورد. یادم هست آن روز نیم ساعتی برای آقای ناظم صحبت کردم. پیرانه. و او جوان بود و زود می‌شد رامش کرد. بعد ازش خواستم که ترکه‌ها را بشکند و آن وقت من رفتم سراغ اتاق خودم. + +در همان هفته‌ی اول به کارها وارد شدم. فردای زمستان و نه تا بخاری زغال سنگی و روزی چهار بار آب آوردن و آب و جاروی اتاق‌ها با یک فراش جور در نمی‌آید. یک فراش دیگر از اداره ی فرهنگ خواستم که هر روز منتظر ورودش بودیم. بعد از ظهرها را نمی‌رفتم. روزهای اول با دست و دل لرزان، ولی سه چهار روزه جرأت پیدا کردم. احساس می‌کردم که مدرسه زیاد هم محض خاطر من نمی‌گردد. کلاس اول هم یکسره بود و به خاطر بچه‌های جغله دلهره‌ای نداشتم. در بیابان‌های اطراف مدرسه هم ماشینی آمد و رفت نداشت و گرچه پست و بلند بود اما به هر صورت از حیاط مدرسه که بزرگ‌تر بود. معلم ها هم، هر بعد از ظهری دو تاشان به نوبت می‌رفتند یک جوری باهم کنار آمده بودند. و ترسی هم از این نبود که بچه‌ها از علم و فرهنگ ثقل سرد بکنند. یک روز هم بازرس آمد و نیم ساعتی پیزر لای پالان هم گذاشتیم و چای و احترامات متقابل! و در دفتر بازرسی تصدیق کرد که مدرسه «با وجود عدم وسایل» بسیار خوب اداره می‌شود. + +بچه‌ها مدام در مدرسه زمین می‌خوردند، بازی می‌کردند، زمین می‌خوردند. مثل اینکه تاتوله خورده بودند. ساده‌ترین شکل بازی‌هایشان در ربع ساعت‌های تفریح، دعوا بود. فکر می‌کردم علت این همه زمین خوردن شاید این باشد که بیش‌ترشان کفش حسابی ندارند. آن‌ها هم که داشتند، بچه‌ننه بودند و بلد نبودند بدوند و حتی راه بروند. این بود که روزی دو سه بار، دست و پایی خراش بر می‌داشت. پرونده‌ی برق و تلفن مدرسه را از بایگانی بسیار محقر مدرسه بیرون کشیده بودم و خوانده بودم. اگر یک خرده می‌دویدی تا دو سه سال دیگر هم برق مدرسه درست می‌شد و هم تلفنش. دوباره سری به اداره ساختمان زدم و موضوع را تازه کردم و به رفقایی که دورادور در اداره‌ی برق و تلفن داشتم، یکی دو بار رو انداختم که اول خیال می‌کردند کار خودم را می‌خواهم به اسم مدرسه راه بیندازم و ناچار رها کردم. این قدر بود که ادای وظیفه‌ای می‌کرد. مدرسه آب نداشت. نه آب خوراکی و نه آب جاری. با هرزاب بهاره، آب انبار زیر حوض را می‌انباشتند که تلمبه‌ای سرش بود و حوض را با همان پر می‌کردند و خود بچه‌ها. اما برای آب خوردن دو تا منبع صد لیتری داشتیم از آهن سفید که مثل امامزاده‌ای یا سقاخانه‌ای دو قلو، روی چهار پایه کنار حیاط بود و روزی دو بار پر و خالی می‌شد. این آب را از همان باغی می‌آوردیم که ردیف کاج‌هایش روی آسمان، لکه‌ی دراز سیاه انداخته بود. البته فراش می‌آورد. با یک سطل بزرگ و یک آب‌پاش که سوراخ بود و تا به مدرسه می‌رسید، نصف شده بود. هر دو را از جیب خودم دادم تعمیر کردند. + +یک روز هم مالک مدرسه آمد. پیرمردی موقر و سنگین که خیال می‌کرد برای سرکشی به خانه‌ی مستأجرنشینش آمده. از در وارد نشده فریادش بلند شد و فحش را کشید به فراش و به فرهنگ که چرا بچه‌ها دیوار مدرسه را با زغال سیاه کرده‌اند واز همین توپ و تشرش شناختمش. کلی با او صحبت کردیم البته او دو برابر سن من را داشت. برایش چای هم آوردیم و با معلم‌ها آشنا شد و قول‌ها داد و رفت. کنه‌ای بود. درست یک پیرمرد. یک ساعت و نیم درست نشست. ماهی یک بار هم این برنامه را داشتند که بایست پیه‌اش را به تن می‌مالیدم. + +اما معلم‌ها. هر کدام یک ابلاغ بیست و چهار ساعته در دست داشتند، ولی در برنامه به هر کدام‌شان بیست ساعت درس بیشتر نرسیده بود. کم کم قرار شد که یک معلم از فرهنگ بخواهیم و به هر کدام‌شان هجده ساعت درس بدهیم، به شرط آن‌که هیچ بعد از ظهری مدرسه تعطیل نباشد. حتی آن که دانشگاه می‌رفت می‌توانست با هفته‌ای هجده ساعت درس بسازد. و دشوارترین کار همین بود که با کدخدامنشی حل شد و من یک معلم دیگر از فرهنگ خواستم. + +اواخر هفته‌ی دوم، فراش جدید آمد. مرد پنجاه ساله‌ای باریک و زبر و زرنگ که شب‌کلاه می‌گذاشت و لباس آبی می‌پوشید و تسبیح می‌گرداند و از هر کاری سر رشته داشت. آب خوردن را نوبتی می‌آوردند. مدرسه تر و تمیز شد و رونقی گرفت. فراش جدید سرش توی حساب بود. هر دو مستخدم با هم تمام بخاری‌ها را راه انداختند و یک کارگر هم برای کمک به آن‌ها آمد. فراش قدیمی را چهار روز پشت سر هم، سر ظهر می‌فرستادیم اداره‌ی فرهنگ و هر آن منتظر زغال بودیم. هنوز یک هفته از آمدن فراش جدید نگذشته بود که صدای همه‌ی معلم‌ها در آمده بود. نه به هیچ کدامشان سلام می‌کرد و نه به دنبال خرده فرمایش‌هایشان می‌رفت. درست است که به من سلام می‌کرد، اما معلم‌ها هم، لابد هر کدام در حدود من صاحب فضایل و عنوان و معلومات بودند که از یک فراش مدرسه توقع سلام داشته باشند. اما انگار نه انگار. + +بدتر از همه این که سر خر معلم‌ها بود. من که از همان اول، خرجم را سوا کرده بودم و آن‌ها را آزاد گذاشته بودم که در مواقع بیکاری در دفتر را روی خودشان ببندند و هر چه می‌خواهند بگویند و هر کاری می‌خواهند بکنند. اما او در فاصله‌ی ساعات درس، همچه که معلم‌ها می‌آمدند، می‌آمد توی دفتر و همین طوری گوشه‌ی اتاق می‌ایستاد و معلم‌ها کلافه می‌شدند. نه می‌توانستند شلکلک‌های معلمی‌شان را در حضور او کنار بگذارند و نه جرأت می‌کردند به او چیزی بگویند. بدزبان بود و از عهده‌ی همه‌شان بر می‌آمد. یکی دوبار دنبال نخود سیاه فرستاده بودندش. اما زرنگ بود و فوری کار را انجام می‌داد و بر می‌گشت. حسابی موی دماغ شده بود. ده سال تجربه این حداقل را به من آموخته بود که اگر معلم‌ها در ربع ساعت‌های تفریح نتوانند بخندند، سر کلاس، بچه‌های مردم را کتک خواهند زد. این بود که دخالت کردم. یک روز فراش جدید را صدا زدم. اول حال و احوالپرسی و بعد چند سال سابقه دارد و چند تا بچه و چه قدر می‌گیرد... که قضیه حل شد. سی صد و خرده‌ای حقوق می‌گرفت. با بیست و پنج سال سابقه. کار از همین جا خراب بود. پیدا بود که معلم‌ها حق دارند او را غریبه بدانند. نه دیپلمی، نه کاغذپاره‌ای، هر چه باشد یک فراش که بیشتر نبود! و تازه قلدر هم بود و حق هم داشت. اول به اشاره و کنایه و بعد با صراحت بهش فهماندم که گر چه معلم جماعت اجر دنیایی ندارد، اما از او که آدم متدین و فهمیده‌ای است بعید است و از این حرف‌ها... که یک مرتبه پرید توی حرفم که: + +- ای آقا! چه می‌فرمایید؟ شما نه خودتون این کاره‌اید و نه اینارو می‌شناسید. امروز می‌خواند سیگار براشون بخرم، فردا می‌فرستنم سراغ عرق. من این‌ها رو می‌شناسم. + +راست می‌گفت. زودتر از همه، او دندان‌های مرا شمرده بود. فهمیده بود که در مدرسه هیچ‌کاره‌ام. می‌خواستم کوتاه بیایم، ولی مدیر مدرسه بودن و در مقابل یک فراش پررو ساکت ماندن!... که خر خر کامیون زغال به دادم رسید. ترمز که کرد و صدا خوابید گفتم: + +- این حرف‌ها قباحت داره. معلم جماعت کجا پولش به عرق می‌رسه؟ حالا بدو زغال آورده‌اند. + +و همین طور که داشت بیرون می‌رفت، افزودم: + +- دو روز دیگه که محتاجت شدند و ازت قرض خواستند با هم رفیق می‌شید. + +و آمدم توی ایوان. در بزرگ آهنی مدرسه را باز کرده بودند و کامیون آمده بود تو و داشتند بارش را جلوی انبار ته حیاط خالی می‌کردند و راننده، کاغذی به دست ناظم داد که نگاهی به آن انداخت و مرا نشان داد که در ایوان بالا ایستاده بودم و فرستادش بالا. کاغذش را با سلام به دستم داد. بیجک زغال بود. رسید رسمی اداره‌ی فرهنگ بود در سه نسخه و روی آن ورقه‌ی ماشین شده‌ی «باسکول» که می‌گفت کامیون و محتویاتش جمعاً دوازده خروار است. اما رسیدهای رسمی اداری فرهنگ ساکت بودند. جای مقدار زغالی که تحویل مدرسه داده شده بود، در هر سه نسخه خالی بود. پیدا بود که تحویل گیرنده باید پرشان کند. همین کار را کردم. اوراق را بردم توی اتاق و با خودنویسم عدد را روی هر سه ورق نوشتم و امضا کردم و به دست راننده دادم که راه افتاد و از همان بالا به ناظم گفتم: + +- اگر مهر هم بایست زد، خودت بزن بابا. + +و رفتم سراغ کارم که ناگهان در باز شد و ناظم آمد تو؛ بیجک زغال دستش بود و: + +- مگه نفهمیدین آقا؟ مخصوصاً جاش رو خالی گذاشته بودند آقا... + +نفهمیده بودم. اما اگر هم فهمیده بودم، فرقی نمی‌کرد و به هر صورت از چنین کودنی نا به هنگام از جا در رفتم و به شدت گفتم: + +- خوب؟ + +- هیچ چی آقا.... رسم‌شون همینه آقا. اگه باهاشون کنار نیایید کارمونو لنگ می‌گذارند آقا... + +که از جا در رفتم. به چنین صراحتی مرا که مدیر مدرسه بودم در معامله شرکت می‌داد. و فریاد زدم: + +- عجب! حالا سرکار برای من تکلیف هم معین می‌کنید؟... خاک بر سر این فرهنگ با مدیرش که من باشم! برو ورقه رو بده دست‌شون، گورشون رو گم کنند. پدر سوخته‌ها... + +چنان فریاد زده بودم که هیچ کس در مدرسه انتظار نداشت. مدیر سر به زیر و پا به راهی بودم که از همه خواهش می‌کردم و حالا ناظم مدرسه، داشت به من یاد می‌داد که به جای نه خروار زغال مثلا هجده خروار تحویل بگیرم و بعد با اداره‌ی فرهنگ کنار بیایم. هی هی!.... تا ظهر هیچ کاری نتوانستم بکنم، جز این‌که چند بار متن استعفانامه‌ام را بنویسم و پاره کنم... قدم اول را این جور جلوی پای آدم می‌گذارند. + +بارندگی که شروع شد دستور دادم بخاری‌ها را از هفت صبح بسوزانند. بچه‌ها همیشه زود می‌آمدند. حتی روزهای بارانی. مثل این‌که اول آفتاب از خانه بیرون‌شان می‌کنند. یا ناهارنخورده. خیلی سعی کردم یک روز زودتر از بچه‌ها مدرسه باشم. اما عاقبت نشد که مدرسه را خالی از نفسِ به علم‌آلوده‌ی بچه‌ها استنشاق کنم. از راه که می‌رسیدند دور بخاری جمع می‌شدند و گیوه‌هاشان را خشک می‌کردند. و خیلی زود فهمیدم که ظهر در مدرسه ماندن هم مسأله کفش بود. هر که داشت نمی‌ماند.این قاعده در مورد معلم‌ها هم صدق می‌کرد اقلاً یک پول واکس جلو بودند. وقتی که باران می‌بارید تمام کوهپایه و بدتر از آن تمام حیاط مدرسه گل می‌شد. بازی و دویدن متوقف شده بود. مدرسه سوت و کور بود. این جا هم مسأله کفش بود. چشم اغلبشان هم قرمز بود. پیدا بود باز آن روز صبح یک فصل گریه کرده‌اند و در خانه‌شان علم صراطی بوده است. + +مدرسه داشت تخته می‌شد. عده‌ی غایب‌های صبح ده برابر شده بود و ساعت اول هیچ معلمی نمی‌توانست درس بدهد. دست‌های ورم‌کرده و سرمازده کار نمی‌کرد. حتی معلم کلاس اولمان هم می‌دانست که فرهنگ و معلومات مدارس ما صرفاً تابع تمرین است. مشق و تمرین. ده بار بیست بار. دست یخ‌کرده بیل و رنده را هم نمی‌تواند به کار بگیرد که خیلی هم زمخت‌اند و دست پر کن. این بود که به فکر افتادیم. فراش جدید واردتر از همه‌ی ما بود. یک روز در اتاق دفتر، شورامانندی داشتیم که البته او هم بود. خودش را کم‌کم تحمیل کرده بود. گفت حاضر است یکی از دُم‌کلفت‌های همسایه‌ی مدرسه را وادارد که شن برایمان بفرستد به شرط آن که ما هم برویم و از انجمن محلی برای بچه‌ها کفش و لباس بخواهیم. قرار شد خودش قضیه را دنبال کند که هفته‌ی آینده جلسه‌شان کجاست و حتی بخواهد که دعوت‌مانندی از ما بکنند. دو روز بعد سه تا کامیون شن آمد. دوتایش را توی حیاط مدرسه، خالی کردیم و سومی را دم در مدرسه، و خود بچه‌ها نیم ساعته پهنش کردند. با پا و بیل و هر چه که به دست می‌رسید. + +عصر همان روز ما را به انجمن دعوت کردند. خود من و ناظم باید می‌رفتیم. معلم کلاس چهارم را هم با خودمان بردیم. خانه‌ای که محل جلسه‌ی آن شب انجمن بود، درست مثل مدرسه، دور افتاده و تنها بود. قالی‌ها و کناره‌ها را به فرهنگ می‌آلودیم و می‌رفتیم. مثل این‌که سه تا سه تا روی هم انداخته بودند. اولی که کثیف شد دومی. به بالا که رسیدیم یک حاجی آقا در حال نماز خواندن بود. و صاحب‌خانه با لهجه‌ی غلیظ یزدی به استقبال‌مان آمد. همراهانم را معرفی کردم و لابد خودش فهمید مدیر کیست. برای ما چای آوردند. سیگارم را چاق کردم و با صاحب‌خانه از قالی‌هایش حرف زدیم. ناظم به بچه‌هایی می‌ماند که در مجلس بزرگترها خوابشان می‌گیرد و دل‌شان هم نمی‌خواست دست به سر شوند. سر اعضای انجمن باز شده بود. حاجی آقا صندوقدار بود. من و ناظم عین دو طفلان مسلم بودیم و معلم کلاس چهارم عین خولی وسطمان نشسته. اغلب اعضای انجمن به زبان محلی صحبت می‌کردند و رفتار ناشی داشتند. حتی یک کدامشان نمی‌دانستند که دست و پاهای خود را چه جور ضبط و ربط کنند. بلند بلند حرف می‌زدند. درست مثل این‌که وزارتخانه‌ی دواب سه تا حیوان تازه برای باغ وحش محله‌شان وارد کرده. جلسه که رسمی شد، صاحبخانه معرفی‌مان کرد و شروع کردند. مدام از خودشان صحبت می‌کردند از این‌که دزد دیشب فلان جا را گرفته و باید درخواست پاسبان شبانه کنیم و... + +همین طور یک ساعت حرف زدند و به مهام امور رسیدگی کردند و من و معلم کلاس چهارم سیگار کشیدیم. انگار نه انگار که ما هم بودیم. نوکرشان که آمد استکان‌ها را جمع کند، چیزی روی جلد اشنو نوشتم و برای صاحبخانه فرستادم که یک مرتبه به صرافت ما افتاد و اجازه خواست و: + +- آقایان عرضی دارند. بهتر است کارهای خودمان را بگذاریم برای بعد. + +مثلاً می‌خواست بفهماند که نباید همه‌ی حرف‌ها را در حضور ما زده باشند. و اجازه دادند معلم کلاس چهار شروع کرد به نطق و او هم شروع کرد که هر چه باشد ما زیر سایه‌ی آقایانیم و خوش‌آیند نیست که بچه‌هایی باشند که نه لباس داشته باشند و نه کفش درست و حسابی و از این حرف‌ها و مدام حرف می‌زد. ناظم هم از چُرت در آمد چیزهایی را که از حفظ کرده بود گفت و التماس دعا و کار را خراب کرد.تشری به ناظم زدم که گدابازی را بگذارد کنار و حالی‌شان کردم که صحبت از تقاضا نیست و گدایی. بلکه مدرسه دور افتاده است و مستراح بی در و پیکر و از این اباطیل... چه خوب شد که عصبانی نشدم. و قرار شد که پنج نفرشان فردا عصر بیایند که مدرسه را وارسی کنند و تشکر و اظهار خوشحالی و در آمدیم. + +در تاریکی بیابان هفت تا سواری پشت در خانه ردیف بودند و راننده‌ها توی یکی از آن‌ها جمع شده بودند و اسرار ارباب‌هاشان را به هم می‌گفتند. در این حین من مدام به خودم می‌گفتم من چرا رفتم؟ به من چه؟ مگر من در بی کفش و کلاهی‌شان مقصر بودم؟ می‌بینی احمق؟ مدیر مدرسه هم که باشی باید شخصیت و غرورت را لای زرورق بپیچی و طاق کلاهت بگذاری که اقلاً نپوسد. حتی اگر بخواهی یک معلم کوفتی باشی، نه چرا دور می‌زنی؟ حتی اگر یک فراش ماهی نود تومانی باشی، باید تا خرخره توی لجن فرو بروی.در همین حین که من در فکر بودم ناظم گفت: + +- دیدید آقا چه طور باهامون رفتار کردند؟ با یکی از قالی‌هاشون آقا تمام مدرسه رو می‌خرید. + +گفتم: + +- تا سر و کارت با الف.ب است به‌پا قیاس نکنی. خودخوری می‌آره. + +و معلم کلاس چهار گفت: + +- اگه فحشمون هم می‌دادند من باز هم راضی بودم، باید واقع‌بین بود. خدا کنه پشیمون نشند. + +بعد هم مدتی درد دل کردیم و تا اتوبوس برسد و سوار بشیم، معلوم شد که معلم کلاس چهار با زنش متارکه کرده و مادر ناظم را سرطانی تشخیص دادند. و بعد هم شب بخیر... + +دو روز تمام مدرسه نرفتم. خجالت می‌کشیدم توی صورت یک کدام‌شان نگاه کنم. و در همین دو روز حاجی آقا با دو نفر آمده بودند، مدرسه را وارسی و صورت‌برداری و ناظم می‌گفت که حتی بچه‌هایی هم که کفش و کلاهی داشتند پاره و پوره آمده بودند. و برای بچه‌ها کفش و لباس خریدند. روزهای بعد احساس کردم زن‌هایی که سر راهم لب جوی آب ظرف می‌شستند، سلام می‌کنند و یک بار هم دعای خیر یکی‌شان را از عقب سر شنیدم.اما چنان از خودم بدم آمده بود که رغبتم نمی‌شد به کفش و لباس‌هاشان نگاه کنم. قربان همان گیوه‌های پاره! بله، نان گدایی فرهنگ را نو نوار کرده بود. + +تازه از دردسرهای اول کار مدرسه فارغ شده بودم که شنیدم که یک روز صبح، یکی از اولیای اطفال آمد. بعد از سلام و احوالپرسی دست کرد توی جیبش و شش تا عکس در آورد، گذاشت روی میزم. شش تا عکس زن . و هر کدام به یک حالت. یعنی چه؟ نگاه تندی به او کردم. آدم مرتبی بود. اداری مانند. کسر شأن خودم می‌دانستم که این گوشه‌ی از زندگی را طبق دستور عکاس‌باشی فلان خانه‌ی بندری ببینم. اما حالا یک مرد اتو کشیده‌ی مرتب آمده بود و شش تا از همین عکس‌ها را روی میزم پهن کرده بود و به انتظار آن که وقاحت عکس‌ها چشم‌هایم را پر کند داشت سیگار چاق می‌کرد. + +حسابی غافلگیر شده بودم... حتماً تا هر شش تای عکس‌ها را ببینم، بیش از یک دقیقه طول کشید. همه از یک نفر بود. به این فکر گریختم که الان هزار ها یا میلیون ها نسخه‌ی آن، توی جیب چه جور آدم‌هایی است و در کجاها و چه قدر خوب بود که همه‌ی این آدم‌ها را می‌شناختم یا می‌دیدم. بیش ازین نمی‌شد گریخت. یارو به تمام وزنه وقاحتش، جلوی رویم نشسته بود. سیگاری آتش زدم و چشم به او دوختم. کلافه بود و پیدا بود برای کتک‌کاری هم آماده باشد. سرخ شده بود و داشت در دود سیگارش تکیه‌گاهی برای جسارتی که می‌خواست به خرج بدهد می‌جست. عکس‌ها را با یک ورقه از اباطیلی که همان روز سیاه کرده بودم، پوشاندم و بعد با لحنی که دعوا را با آن شروع می‌کنند؛ پرسیدم: + +- خوب، غرض؟ + +و صدایم توی اتاق پیچید. حرکتی از روی بیچارگی به خودش داد و همه‌ی جسارت‌ها را با دستش توی جیبش کرد و آرام‌تر از آن چیزی که با خودش تو آورده بود، گفت: + +- چه عرض کنم؟... از معلم کلاس پنج تون بپرسید. + +که راحت شدم و او شروع کرد به این که «این چه فرهنگی است؟ خراب بشود. پس بچه‌های مردم با چه اطمینانی به مدرسه بیایند؟ + +و از این حرف‌ها... + +خلاصه این آقا معلم کاردستی کلاس پنجم، این عکس‌ها را داده به پسر آقا تا آن‌ها را روی تخته سه لایی بچسباند و دورش را سمباده بکشد و بیاورد. به هر صورت معلم کلاس پنج بی‌گدار به آب زده. و حالا من چه بکنم؟ به او چه جوابی بدهم؟ بگویم معلم را اخراج می‌کنم؟ که نه می‌توانم و نه لزومی دارد. او چه بکند؟ حتماً در این شهر کسی را ندارد که به این عکس‌ها دلخوش کرده. ولی آخر چرا این جور؟ یعنی این قدر احمق است که حتی شاگردهایش را نمی‌شناسد؟... پاشدم ناظم را صدا بزنم که خودش آمده بود بالا، توی ایوان منتظر ایستاده بود. من آخرین کسی بودم که از هر اتفاقی در مدرسه خبردار می‌شدم. حضور این ولی طفل گیجم کرده بود که چنین عکس‌هایی را از توی جیب پسرش، و لابد به همین وقاحتی که آن‌ها را روی میز من ریخت، در آورده بوده. وقتی فهمید هر دو در مانده‌ایم سوار بر اسب شد که اله می‌کنم و بله می‌کنم، در مدرسه را می‌بندم، و از این جفنگیات.... + +حتماً نمی‌دانست که اگر در هر مدرسه بسته بشود، در یک اداره بسته شده است. اما من تا او بود نمی‌توانستم فکرم را جمع کنم. می‌خواست پسرش را بخواهیم تا شهادت بدهد و چه جانی کندیم تا حالیش کنیم که پسرش هر چه خفت کشیده، بس است و وعده‌ها دادیم که معلمش را دم خورشید کباب کنیم و از نان خوردن بیندازیم. یعنی اول ناظم شروع کرد که از دست او دل پری داشت و من هم دنبالش را گرفتم. برای دک کردن او چاره‌ای جز این نبود. و بعد رفت، ما دو نفری ماندیم با شش تا عکس زن . حواسم که جمع شد به ناظم سپردم صدایش را در نیاورد و یک هفته‌ی تمام مطلب را با عکس‌ها، توی کشوی میزم قفل کردم و بعد پسرک را صدا زدم. نه عزیزدُردانه می‌نمود و نه هیچ جور دیگر. داد می‌زد که از خانواده‌ی عیال‌واری است. کم‌خونی و فقر. دیدم معلمش زیاد هم بد تشخیص نداده. یعنی زیاد بی‌گدار به آب نزده. گفتم: + +- خواهر برادر هم داری؟ + +- آ... آ...آقا داریم آقا. + +- چند تا؟ + +- آ... آقا چهار تا آقا. + +- عکس‌ها رو خودت به بابات نشون دادی؟ + +- نه به خدا آقا... به خدا قسم... + +- پس چه طور شد؟ + +و دیدم از ترس دارد قالب تهی می‌کند. گرچه چوب‌های ناظم شکسته بود، اما ترس او از من که مدیر باشم و از ناظم و از مدرسه و از تنبیه سالم مانده بود. + +- نترس بابا. کاریت نداریم. تقصیر آقا معلمه که عکس‌ها رو داده... تو کار بدی نکردی بابا جان. فهمیدی؟ اما می‌خواهم ببینم چه طور شد که عکس‌ها دست بابات افتاد. + +- آ.. آ... آخه آقا... آخه... + +می‌دانستم که باید کمکش کنم تا به حرف بیاید. + +گفتم: + +- می‌دونی بابا؟ عکس‌هام چیز بدی نبود. تو خودت فهمیدی چی بود؟ + +- آخه آقا...نه آقا.... خواهرم آقا... خواهرم می‌گفت... + +- خواهرت؟ از تو کوچک‌تره؟ + +- نه آقا. بزرگ‌تره. می‌گفتش که آقا... می‌گفتش که آقا... هیچ چی سر عکس‌ها دعوامون شد. + +دیگر تمام بود. عکس‌ها را به خواهرش نشان داده بود که لای دفترچه پر بوده از عکس آرتیست‌ها. به او پز داده بوده. اما حاضر نبوده، حتی یکی از آن‌ها را به خواهرش بدهد. آدم مورد اعتماد معلم باشد و چنین خبطی بکند؟ و تازه جواب معلم را چه بدهد؟ ناچار خواهر او را لو داده بوده. بعد از او معلم را احضار کردم. علت احضار را می‌دانست. و داد می‌زد که چیزی ندارد بگوید. پس از یک هفته مهلت، هنوز از وقاحتی که من پیدا کرده بودم، تا از آدم خلع سلاح‌شده‌ای مثل او، دست بر ندارم، در تعجب بود. به او سیگار تعارف کردم و این قصه را برایش تعریف کردم که در اوایل تأسیس وزارت معارف، یک روز به وزیر خبر می‌دهند که فلان معلم با فلان بچه روابطی دارد. وزیر فوراً او را می‌خواهد و حال و احوال او را می‌پرسد و این‌که چرا تا به حال زن نگرفته و ناچار تقصیر گردن بی‌پولی می‌افتد و دستور که فلان قدر به او کمک کنند تا عروسی راه بیندازد و خود او هم دعوت بشود و قضیه به همین سادگی تمام می‌شود. و بعد گفتم که خیلی جوان‌ها هستند که نمی‌توانند زن بگیرند و وزرای فرهنگ هم این روزها گرفتار مصاحبه‌های روزنامه‌ای و رادیویی هستند. اما در نجیب‌خانه‌ها که باز است و ازین مزخرفات... و هم‌دردی و نگذاشتم یک کلمه حرف بزند. بعد هم عکس را که توی پاکت گذاشته بودم، به دستش دادم و وقاحت را با این جمله به حد اعلا رساندم که: + +- اگر به تخته نچسبونید، ضررشون کم‌تره. + +تا حقوقم به لیست اداره‌ی فرهنگ برسه، سه ماه طول کشید. فرهنگی‌های گداگشنه و خزانه‌ی خالی و دست‌های از پا درازتر! اما خوبیش این بود که در مدرسه‌ی ما فراش جدیدمان پولدار بود و به همه‌شان قرض داد. کم کم بانک مدرسه شده بود. از سیصد و خرده‌ای تومان که می‌گرفت، پنجاه تومان را هم خرج نمی‌کرد. نه سیگار می‌کشید و نه اهل سینما بود و نه برج دیگری داشت. از این گذشته، باغبان یکی از دم‌کلفت‌های همان اطراف بود و باغی و دستگاهی و سور و ساتی و لابد آشپزخانه‌ی مرتبی. خیلی زود معلم‌ها فهمیدند که یک فراش پولدار خیلی بیش‌تر به درد می‌خورد تا یک مدیر بی‌بو و خاصیت. + +این از معلم‌ها. حقوق مرا هم هنوز از مرکز می‌دادند. با حقوق ماه بعد هم اسم مرا هم به لیست اداره منتقل کردند. درین مدت خودم برای خودم ورقه انجام کار می‌نوشتم و امضا می‌کردم و می‌رفتم از مدرسه‌ای که قبلاً در آن درس می‌دادم، حقوقم را می‌گرفتم. سر و صدای حقوق که بلند می‌شد معلم‌ها مرتب می‌شدند و کلاس ماهی سه چهار روز کاملاً دایر بود. تا ورقه‌ی انجام کار به دستشان بدهم. غیر از همان یک بار - در اوایل کار- که برای معلم حساب پنج و شش قرمز توی دفتر گذاشتیم، دیگر با مداد قرمز کاری نداشتیم و خیال همه‌شان راحت بود. وقتی برای گرفتن حقوقم به اداره رفتم، چنان شلوغی بود که به خودم گفتم کاش اصلاً حقوقم را منتقل نکرده بودم. نه می‌توانستم سر صف بایستم و نه می‌توانستم از حقوقم بگذرم. تازه مگر مواجب‌بگیر دولت چیزی جز یک انبان گشاده‌ی پای صندوق است؟..... و اگر هم می‌ماندی با آن شلوغی باید تا دو بعداز ظهر سر پا بایستی. همه‌ی جیره‌خوارهای اداره بو برده بودند که مدیرم. و لابد آن‌قدر ساده لوح بودند که فکر کنند روزی گذارشان به مدرسه‌ی ما بیفتد. دنبال سفته‌ها می‌گشتند، به حسابدار قبلی فحش می‌دادند، التماس می‌کردند که این ماه را ندیده بگیرید و همه‌ی حق و حساب‌دان شده بودند و یکی که زودتر از نوبت پولش را می‌گرفت صدای همه در می‌آمد. در لیست مدرسه، بزرگ‌ترین رقم مال من بود. درست مثل بزرگ‌ترین گناه در نامه‌ی عمل. دو برابر فراش جدیدمان حقوق می‌گرفتم. از دیدن رقم‌های مردنی حقوق دیگران چنان خجالت کشیدم که انگار مال آن‌ها را دزدیده‌ام. و تازه خلوت که شد و ده پانزده تا امضا که کردم، صندوق‌دار چشمش به من افتاد و با یک معذرت، شش صد تومان پول دزدی را گذاشت کف دستم... مرده شور! + +هنوز برف اول نباریده بود که یک روز عصر، معلم کلاس چهار رفت زیر ماشین. زیر یک سواری. مثل همه‌ی عصرها من مدرسه نبودم. دم غروب بود که فراش قدیمی مدرسه دم در خونه‌مون، خبرش را آورد. که دویدم به طرف لباسم و تا حاضر بشوم، می‌شنیدم که دارد قضیه را برای زنم تعریف می‌کند. ماشین برای یکی از آمریکایی‌ها بوده. باقیش را از خانه که در آمدیم برایم تعریف کرد. گویا یارو خودش پشت فرمون بوده و بعد هم هول شده و در رفته. بچه‌ها خبر را به مدرسه برگردانده‌اند و تا فراش و زنش برسند، جمعیت و پاسبان‌ها سوارش کرده بودند و فرستاده بوده‌اند مریض‌خانه. به اتوبوس که رسیدم، دیدم لاک پشت است. فراش را مرخص کردم و پریدم توی تاکسی. اول رفتم سراغ پاسگاه جدید کلانتری. تعاریف تکه و پاره‌ای از پرونده مطلع بود. اما پرونده تصریحی نداشت که راننده که بوده. اما هیچ کس نمی‌دانست عاقبت چه بلایی بر سر معلم کلاس چهار ما آمده است. کشیک پاسگاه همین قدر مطلع بود که درین جور موارد «طبق جریان اداری» اول می‌روند سرکلانتری، بعد دایره‌ی تصادفات و بعد بیمارستان. اگر آشنا در نمی‌آمدیم، کشیک پاسگاه مسلماً نمی‌گذاشت به پرونده نگاه چپ بکنم. احساس کردم میان اهل محل کم‌کم دارم سرشناس می‌شوم. و از این احساس خنده‌ام گرفت. + +ساعت ۸ دم در بیمارستان بودم، اگر سالم هم بود حتماً یه چیزیش شده بود. همان طور که من یه چیزیم می‌شد. روی در بیمارستان نوشته شده بود: «از ساعت ۷ به بعد ورود ممنوع». در زدم. از پشت در کسی همین آیه را صادر کرد. دیدم فایده ندارد و باید از یک چیزی کمک بگیرم. از قدرتی، از مقامی، از هیکلی، از یک چیزی. صدایم را کلفت کردم و گفتم:« من...» می‌خواستم بگویم من مدیر مدرسه‌ام. ولی فوراً پشیمان شدم. یارو لابد می‌گفت مدیر مدرسه کدام سگی است؟ این بود با کمی مکث و طمطراق فراوان جمله‌ام را این طور تمام کردم: + +- ...بازرس وزارت فرهنگم. + +که کلون صدایی کرد و لای در باز شد. یارو با چشم‌هایش سلام کرد. رفتم تو و با همان صدا پرسیدم: + +- این معلمه مدرسه که تصادف کرده... + +تا آخرش را خواند. یکی را صدا زد و دنبالم فرستاد که طبقه‌ی فلان، اتاق فلان. از حیاط به راهرو و باز به حیاط دیگر که نصفش را برف پوشانده بود و من چنان می‌دویدم که یارو از عقب سرم هن هن می‌کرد. طبقه‌ی اول و دوم و چهارم. چهار تا پله یکی. راهرو تاریک بود و پر از بوهای مخصوص بود. هن هن کنان دری را نشان داد که هل دادم و رفتم تو. بو تندتر بود و تاریکی بیشتر. تالاری بود پر از تخت و جیرجیر کفش و خرخر یک نفر. دور یک تخت چهار نفر ایستاده بودند. حتماً خودش بود. پای تخت که رسیدم، احساس کردم همه‌ی آنچه از خشونت و تظاهر و ابهت به کمک خواسته بودم آب شد و بر سر و صورتم راه افتاد. و این معلم کلاس چهارم مدرسه‌ام بود. سنگین و با شکم بر آمده دراز کشیده بود. خیلی کوتاه‌تر از زمانی که سر پا بود به نظرم آمد. صورت و سینه‌اش از روپوش چرک‌مُرد بیرون بود. صورتش را که شسته بودند کبود کبود بود، درست به رنگ جای سیلی روی صورت بچه‌ها. مرا که دید، لبخند و چه لبخندی! شاید می‌خواست بگوید مدرسه‌ای که مدیرش عصرها سر کار نباشد، باید همین جورها هم باشد. خنده توی صورت او همین طور لرزید و لرزید تا یخ زد. + +«آخر چرا تصادف کردی؟...» + +مثل این که سوال را ازو کردم. اما وقتی که دیدم نمی‌تواند حرف بزند و به جای هر جوابی همان خنده‌ی یخ‌بسته را روی صورت دارد، خودم را به عنوان او دم چک گرفتم. «آخه چرا؟ چرا این هیکل مدیر کلی را با خودت این قد این ور و آن ور می‌بری تا بزنندت؟ تا زیرت کنند؟ مگر نمی‌دانستی که معلم حق ندارد این قدر خوش‌هیکل باشد؟ آخر چرا تصادف کردی؟» به چنان عتاب و خطابی این‌ها را می‌گفتم که هیچ مطمئن نیستم بلند بلند به خودش نگفته باشم. و یک مرتبه به کله‌ام زد که «مبادا خودت چشمش زده باشی؟» و بعد: «احمق خاک بر سر! بعد از سی و چند سال عمر، تازه خرافاتی شدی!» و چنان از خودم بیزاریم گرفت که می‌خواستم به یکی فحش بدهم، کسی را بزنم. که چشمم به دکتر کشیک افتاد. + +- مرده شور این مملکتو ببره. ساعت چهار تا حالا از تن این مرد خون می‌ره. حیفتون نیومد؟... + +دستی روی شانه‌ام نشست و فریادم را خواباند. برگشتم پدرش بود. او هم می‌خندید. دو نفر دیگر هم با او بودند. همه دهاتی‌وار؛ همه خوش قد و قواره. حظ کردم! آن دو تا پسرهایش بودند یا برادرزاده‌هایش یا کسان دیگرش. تازه داشت گل از گلم می‌شکفت که شنیدم: + +- آقا کی باشند؟ + +این راهم دکتر کشیک گفت که من باز سوار شدم: + +- مرا می‌گید آقا؟ من هیشکی. یک آقا مدیر کوفتی. این هم معلمم. + +که یک مرتبه عقل هی زد و «پسر خفه شو» و خفه شدم. بغض توی گلویم بود. دلم می‌خواست یک کلمه دیگر بگوید. یک کنایه بزند... نسبت به مهارت هیچ دکتری تا کنون نتوانسته‌ام قسم بخورم. دستش را دراز کرد که به اکراه فشار دادم و بعد شیشه‌ی بزرگی را نشانم داد که وارونه بالای تخت آویزان بود و خرفهمم کرد که این جوری غذا به او می‌رسانند و عکس هم گرفته‌اند و تا فردا صبح اگر زخم‌ها چرک نکند، جا خواهند انداخت و گچ خواهند کرد. که یکی دیگر از راه رسید. گوشی به دست و سفید پوش و معطر. با حرکاتی مثل آرتیست سینما. سلامم کرد. صدایش در ته ذهنم چیزی را مختصر تکانی داد. اما احتیاجی به کنجکاوی نبود. یکی از شاگردهای نمی‌دانم چند سال پیشم بود. خودش خودش را معرفی کرد. آقای دکتر...! عجب روزگاری! هر تکه از وجودت را با مزخرفی از انبان مزخرفاتت، مثل ذره‌ای روزی در خاکی ریخته‌ای که حالا سبز کرده. چشم داری احمق. این تویی که روی تخت دراز کشیده‌ای. ده سال آزگار از پلکان ساعات و دقایق عمرت هر لحظه یکی بالا رفته و تو فقط خستگی این بار را هنوز در تن داری. این جوجه‌فکلی و جوجه‌های دیگر که نمی‌شناسی‌شان، همه از تخمی سر در آورده‌اند که روزی حصار جوانی تو بوده و حالا شکسته و خالی مانده. دستش را گرفتم و کشیدمش کناری و در گوشش هر چه بد و بی‌راه می‌دانستم، به او و همکارش و شغلش دادم. مثلاً می‌خواستم سفارش معلم کلاس چهار مدرسه‌ام را کرده باشم. بعد هم سری برای پدر تکان دادم و گریختم. از در که بیرون آمدم، حیاط بود و هوای بارانی. از در بزرگ که بیرون آمدم به این فکر می‌کردم که «اصلا به تو چه؟ اصلاً چرا آمدی؟ می‌خواستی کنجکاوی‌ات را سیرکنی؟» و دست آخر به این نتیجه رسیدم که «طعمه‌ای برای میزنشین‌های شهربانی و دادگستری به دست آمده و تو نه می‌توانی این طعمه را از دستشان بیرون بیاوری و نه هیچ کار دیگری می‌توانی بکنی...» + +و داشتم سوار تاکسی می‌شدم تا برگردم خانه که یک دفعه به صرافت افتادم که اقلاً چرا نپرسیدی چه بلایی به سرش آمده؟» خواستم عقب‌گرد کنم، اما هیکل کبود معلم کلاس چهارم روی تخت بود و دیدم نمی‌توانم. خجالت می‌کشیدم و یا می‌ترسیدم. آن شب تا ساعت دو بیدار بودم و فردا یک گزارش مفصل به امضای مدیر مدرسه و شهادت همه‌ی معلم‌ها برای اداره‌ی فرهنگ و کلانتری محل و بعد هم دوندگی در اداره‌ی بیمه و قرار بر این که روزی نه تومان بودجه برای خرج بیمارستان او بدهند و عصر پس از مدتی رفتم مدرسه و کلاس‌ها را تعطیل کردم و معلم‌ها و بچه‌های ششم را فرستادم عیادتش و دسته گل و ازین بازی‌ها... و یک ساعتی در مدرسه تنها ماندم و فارغ از همه چیز برای خودم خیال بافتم.... و فردا صبح پدرش آمد سلام و احوالپرسی و گفت یک دست و یک پایش شکسته و کمی خونریزی داخل مغز و از طرف یارو آمریکاییه آمده‌اند عیادتش و وعده و وعید که وقتی خوب شد، در اصل چهار استخدامش کنند و با زبان بی‌زبانی حالیم کرد که گزارش را بیخود داده‌ام و حالا هم داده‌ام، دنبالش نکنم و رضایت طرفین و کاسه‌ی از آش داغ‌تر و از این حرف‌ها... خاک بر سر مملکت. + +اوایل امر توجهی به بچه‌ها نداشتم. خیال می‌کردم اختلاف سِنی میان‌مان آن قدر هست که کاری به کار همدیگر نداشته باشیم. همیشه سرم به کار خودم بود. در دفتر را می‌بستم و در گرمای بخاری دولت قلم صد تا یک غاز می‌زدم. اما این کار مرتب سه چهار هفته بیش‌تر دوام نکرد. خسته شدم. ناچار به مدرسه بیشتر می‌رسیدم. یاد روزهای قدیمی با دوستان قدیمی به خیر چه آدم‌های پاک و بی‌آلایشی بودند، چه شخصیت‌های بی‌نام و نشانی و هر کدام با چه زبانی و با چه ادا و اطوارهای مخصوص به خودشان و این جوان‌های چلفته‌ای. چه مقلدهای بی‌دردسری برای فرهنگی‌مابی! نه خبری از دیروزشان داشتند و نه از املاک تازه‌ای که با هفتاد واسطه به دست‌شان داده بودند، چیزی سرشان می‌شد. بدتر از همه بی‌دست و پایی‌شان بود. آرام و مرتب درست مثل واگن شاه عبدالعظیم می‌آمدند و می‌رفتند. فقط بلد بودند روزی ده دقیقه دیرتر بیایند و همین. و از این هم بدتر تنگ‌نظری‌شان بود. + +سه بار شاهد دعواهایی بودم که سر یک گلدان میخک یا شمعدانی بود. بچه‌باغبان‌ها زیاد بودند و هر کدام‌شان حداقل ماهی یک گلدان میخک یا شمعدانی می‌آوردند که در آن برف و سرما نعمتی بود. اول تصمیم گرفتم، مدرسه را با آن‌ها زینت دهم. ولی چه فایده؟ نه کسی آب‌شان می‌داد و نه مواظبتی. و باز بدتر از همه‌ی این‌ها، بی‌شخصیتی معلم‌ها بود که درمانده‌ام کرده بود. دو کلمه نمی‌توانستند حرف بزنند. عجب هیچ‌کاره‌هایی بودند! احساس کردم که روز به روز در کلاس‌ها معلم‌ها به جای دانش‌آموزان جاافتاده‌تر می‌شوند. در نتیجه گفتم بیش‌تر متوجه بچه‌ها باشم. + +آن‌ها که تنها با ناظم سر و کار داشتند و مثل این بود که به من فقط یک سلام نیمه‌جویده بدهکارند. با این همه نومیدکننده نبودند. توی کوچه مواظب‌شان بودم. می‌خواستم حرف و سخن‌ها و درد دل‌ها و افکارشان را از یک فحش نیمه‌کاره یا از یک ادای نیمه‌تمام حدس بزنم، که سلام‌نکرده در می‌رفتند. خیلی کم تنها به مدرسه می‌آمدند. پیدا بود که سر راه همدیگر می‌ایستند یا در خانه‌ی یکدیگر می‌روند. سه چهار نفرشان هم با اسکورت می‌آمدند. از بیست سی نفری که ناهار می‌ماندند، فقط دو نفرشان چلو خورش می‌آوردند؛ فراش اولی مدرسه برایم خبر می‌آورد. بقیه گوشت‌کوبیده، پنیر گردوئی، دم پختکی و از این جور چیزها. دو نفرشان هم بودند که نان سنگک خالی می‌آوردند. برادر بودند. پنجم و سوم. صبح که می‌آمدند، جیب‌هاشان باد کرده بود. سنگک را نصف می‌کردند و توی جیب‌هاشان می‌تپاندند و ظهر می‌شد، مثل آن‌هایی که ناهارشان را در خانه می‌خورند، می‌رفتند بیرون. من فقط بیرون رفتن‌شان را می‌دیدم. اما حتی همین‌ها هر کدام روزی، یکی دو قران از فراش مدرسه خرت و خورت می‌خریدند. از همان فراش قدیمی مدرسه که ماهی پنج تومان سرایداریش را وصول کرده بودم. هر روز که وارد اتاقم می‌شدم پشت سر من می‌آمد بارانی‌ام را بر می‌داشت و شروع می‌کرد به گزارش دادن، که دیروز باز دو نفر از معلم‌ها سر یک گلدان دعوا کرده‌اند یا مأمور فرماندار نظامی آمده یا دفتردار عوض شده و از این اباطیل... پیدا بود که فراش جدید هم در مطالبی که او می‌گفت، سهمی دارد. + +یک روز در حین گزارش دادن، اشاره‌ای کرد به این مطلب که دیروز عصر یکی از بچه‌های کلاس چهار دو تا کله قند به او فروخته است. درست مثل اینکه سر کلاف را به دستم داده باشد پرسیدم: + +- چند؟ + +- دو تومنش دادم آقا. + +- زحمت کشیدی. نگفتی از کجا آورده؟ + +- من که ضامن بهشت و جهنمش نبودم آقا. + +بعد پرسیدم: + +- چرا به آقای ناظم خبر ندادی؟ + +می‌دانستم که هم او و هم فراش جدید، ناظم را هووی خودشان می‌دانند و خیلی چیزهاشان از او مخفی بود. این بود که میان من و ناظم خاصه‌خرجی می‌کردند. در جوابم همین طور مردد مانده بود که در باز شد و فراش جدید آمد تو. که: + +- اگه خبرش می‌کرد آقا بایست سهمش رو می‌داد... + +اخمم را درهم کشیدم و گفتم: + +- تو باز رفتی تو کوک مردم! اونم این جوری سر نزده که نمی‌آیند تو اتاق کسی، پیرمرد! + +و بعد اسم پسرک را ازشان پرسیدم و حالی‌شان کردم که چندان مهم نیست و فرستادمشان برایم چای بیاورند. بعد کارم را زودتر تمام کردم و رفتم به اتاق دفتر احوالی از مادر ناظم پرسیدم و به هوای ورق زدن پرونده‌ها فهمیدم که پسرک شاگرد دوساله است و پدرش تاجر بازار. بعد برگشتم به اتاقم. یادداشتی برای پدر نوشتم که پس فردا صبح، بیاید مدرسه و دادم دست فراش جدید که خودش برساند و رسیدش را بیاورد. + +و پس فردا صبح یارو آمد. باید مدیر مدرسه بود تا دانست که اولیای اطفال چه راحت تن به کوچک‌ترین خرده‌فرمایش‌های مدرسه می‌دهند. حتم دارم که اگر از اجرای ثبت هم دنبال‌شان بفرستی به این زودی‌ها آفتابی نشوند. چهل و پنج ساله مردی بود با یخه‌ی بسته بی‌کراوات و پالتویی که بیش‌تر به قبا می‌ماند. و خجالتی می‌نمود. هنوز ننشسته، پرسیدم: + +- شما دو تا زن دارید آقا؟ + +درباره‌ی پسرش برای خودم پیش‌گویی‌هایی کرده بودم و گفتم این طوری به او رودست می‌زنم. پیدا بود که از سؤالم زیاد یکه نخورده است. گفتم برایش چای آوردند و سیگاری تعارفش کردم که ناشیانه دود کرد از ترس این که مبادا جلویم در بیاید که - به شما چه مربوط است و از این اعتراض‌ها - امانش ندادم و سؤالم را این جور دنبال کردم: + +- البته می‌بخشید. چون لابد به همین علت بچه شما دو سال در یک کلاس مانده. + +شروع کرده بودم برایش یک میتینگ بدهم که پرید وسط حرفم: + +- به سر شما قسم، روزی چهار زار پول تو جیبی داره آقا. پدرسوخته‌ی نمک به حروم...! + +حالیش کردم که علت، پول تو جیبی نیست و خواستم که عصبانی نشود و قول گرفتم که اصلاً به روی پسرش هم نیاورد و آن وقت میتینگم را برایش دادم که لابد پسر در خانه مهر و محبتی نمی‌بیند و غیب‌گویی‌های دیگر... تا عاقبت یارو خجالتش ریخت و سرِ درد دلش باز شد که عفریته زن اولش همچه بوده و همچون بوده و پسرش هم به خودش برده و کی طلاقش داده و از زن دومش چند تا بچه دارد و این نره‌خر حالا باید برای خودش نان‌آور شده باشد و زنش حق دارد که با دو تا بچه‌ی خرده‌پا به او نرسد... من هم کلی برایش صحبت کردم. چایی دومش را هم سر کشید و قول‌هایش را که داد و رفت، من به این فکر افتادم که «نکند علمای تعلیم و تربیت هم، همین جورها تخم دوزرده می‌کنند!» + +یک روز صبح که رسیدم، ناظم هنوز نیامده بود. از این اتفاق‌ها کم می‌افتاد. ده دقیقه‌ای از زنگ می‌گذشت و معلم‌ها در دفتر سرگرم اختلاط بودند. خودم هم وقتی معلم بودم به این مرض دچار بودم. اما وقتی مدیر شدم تازه فهمیدم که معلم‌ها چه لذتی می‌برند. حق هم داشتند. آدم وقتی مجبور باشد شکلکی را به صورت بگذارد که نه دیگران از آن می‌خندند و نه خود آدم لذتی می‌برد، پیداست که رفع تکلیف می‌کند. زنگ را گفتم زدند و بچه‌ها سر کلاس رفتند. دو تا از کلاس‌ها بی‌معلم بود. یکی از ششمی‌ها را فرستادم سر کلاس سوم که برای‌شان دیکته بگوید و خودم رفتم سر کلاس چهار. مدیر هم که باشی، باز باید تمرین کنی که مبادا فوت و فن معلمی از یادت برود. در حال صحبت با بچه‌ها بودم که فراش خبر آورد که خانمی توی دفتر منتظرم است. خیال کردم لابد همان زنکه‌ی بیکاره‌ای است که هفته‌ای یک بار به هوای سرکشی، به وضع درس و مشق بچه‌اش سری می‌زند. زن سفیدرویی بود با چشم‌های درشت محزون و موی بور. بیست و پنج ساله هم نمی‌نمود. اما بچه‌اش کلاس سوم بود. روز اول که دیدمش لباس نارنجی به تن داشت و تن بزک کرده بود. از زیارت من خیلی خوشحال شد و از مراتب فضل و ادبم خبر داشت. + +خیلی ساده آمده بود تا با دو تا مرد حرفی زده باشد. آن طور که ناظم خبر می‌داد، یک سالی طلاق گرفته بود و روی هم رفته آمد و رفتنش به مدرسه باعث دردسر بود. وسط بیابان و مدرسه‌ای پر از معلم‌های عزب و بی‌دست و پا و یک زن زیبا... ناچار جور در نمی‌آمد. این بود که دفعات بعد دست به سرش می‌کردم، اما از رو نمی‌رفت. سراغ ناظم و اتاق دفتر را می‌گرفت و صبر می‌کرد تا زنگ را بزنند و معلم‌ها جمع بشوند و لابد حرف و سخنی و خنده‌ای و بعد از معلم کلاس سوم سراغ کار و بار و بچه‌اش را می‌گرفت و زنگ بعد را که می‌زدند، خداحافظی می‌کرد و می‌رفت. آزاری نداشت. با چشم‌هایش نفس معلم‌ها را می‌برید. و حالا باز هم همان زن بود و آمده بود و من تا از پلکان پایین بروم در ذهنم جملات زننده‌ای ردیف می‌کردم، تا پایش را از مدرسه ببرد که در را باز کردم و سلام... + +عجب! او نبود. دخترک یکی دو ساله‌ای بود با دهان گشاد و موهای زبرش را به زحمت عقب سرش گلوله کرده بود و بفهمی نفهمی دستی توی صورتش برده بود. روی هم رفته زشت نبود. اما داد می‌زد که معلم است. گفتم که مدیر مدرسه‌ام و حکمش را داد دستم که دانشسرا دیده بود و تازه استخدام شده بود. برایمان معلم فرستاده بودند. خواستم بگویم «مگر رئیس فرهنگ نمی‌داند که این جا بیش از حد مرد است» ولی دیدم لزومی ندارد و فکر کردم این هم خودش تنوعی است. + +به هر صورت زنی بود و می‌توانست محیط خشن مدرسه را که به طرز ناشیانه‌ای پسرانه بود، لطافتی بدهد و خوش‌آمد گفتم و چای آوردند که نخورد و بردمش کلاس‌های سوم و چهارم را نشانش دادم که هر کدام را مایل است، قبول کند و صحبت از هجده ساعت درس که در انتظار او بود و برگشتیم به دفتر .پرسید غیر از او هم، معلم زن داریم. گفتم: + +- متأسفانه راه مدرسه‌ی ما را برای پاشنه‌ی کفش خانم‌ها نساخته‌اند. + +که خندید و احساس کردم زورکی می‌خندد. بعد کمی این دست و آن دست کرد و عاقبت: + +- آخه من شنیده بودم شما با معلماتون خیلی خوب تا می‌کنید. + +صدای جذابی داشت. فکر کردم حیف که این صدا را پای تخته سیاه خراب خواهد کرد. و گفتم: + +- اما نه این قدر که مدرسه تعطیل بشود خانم! و لابد به عرض‌تون رسیده که همکارهای شما، خودشون نشسته‌اند و تصمیم گرفته‌اند که هجده ساعت درس بدهند. بنده هیچ‌کاره‌ام. + +- اختیار دارید. + +و نفهمیدم با این «اختیار دارید» چه می‌خواست بگوید. اما پیدا بود که بحث سر ساعات درس نیست. آناً تصمیم گرفتم، امتحانی بکنم: + +- این را هم اطلاع داشته باشید که فقط دو تا از معلم‌های ما متأهل‌اند. + +که قرمز شد و برای این که کار دیگری نکرده باشد، برخاست و حکمش را از روی میز برداشت. پا به پا می‌شد که دیدم باید به دادش برسم. ساعت را از او پرسیدم. وقت زنگ بود. فراش را صدا کردم که زنگ را بزند و بعد به او گفتم، بهتر است مشورت دیگری هم با رئیس فرهنگ بکند و ما به هر صورت خوشحال خواهیم شد که افتخار همکاری با خانمی مثل ایشان را داشته باشیم و خداحافظ شما. از در دفتر که بیرون رفت، صدای زنگ برخاست و معلم‌ها انگار موشان را آتش زده‌اند، به عجله رسیدند و هر کدام از پشت سر، آن قدر او را پاییدند تا از در بزرگ آهنی مدرسه بیرون رفت. + +فردا صبح معلوم شد که ناظم، دنبال کار مادرش بوده است که قرار بود بستری شود، تا جای سرطان گرفته را یک دوره برق بگذارند. کل کار بیمارستان را من به کمک دوستانم انجام دادم و موقع آن رسیده بود که مادرش برود بیمارستان اما وحشتش گرفته بود و حاضر نبود به بیمارستان برود. و ناظم می‌خواست رسماً دخالت کنم و با هم برویم خانه‌شان و با زبان چرب و نرمی که به قول ناظم داشتم مادرش را راضی کنم. چاره‌ای نبود. مدرسه را به معلم‌ها سپردیم و راه افتادیم. بالاخره به خانه‌ی آن‌ها رسیدیم. خانه‌ای بسیار کوچک و اجاره‌ای. مادر با چشم‌های گود نشسته و انگار زغال به صورت مالیده! سیاه نبود اما رنگش چنان تیره بود که وحشتم گرفت. اصلاً صورت نبود. زخم سیاه شده‌ای بود که انگار از جای چشم‌ها و دهان سر باز کرده است. کلی با مادرش صحبت کردم. از پسرش و کلی دروغ و دونگ، و چادرش را روی چارقدش انداختیم و علی... و خلاصه در بیمارستان بستری شدند. + +فردا که به مدرسه آمدم، ناظم سرحال بود و پیدا بود که از شر چیزی خلاص شده است و خبر داد که معلم کلاس سه را گرفته‌اند. یک ماه و خرده‌ای می‌شد که مخفی بود و ما ورقه‌ی انجام کارش را به جانشین غیر رسمی‌اش داده بودیم و حقوقش لنگ نشده بود و تا خبر رسمی بشنود و در روزنامه‌ای بیابد و قضیه به اداره‌ی فرهنگ و لیست حقوق بکشد، باز هم می‌دادیم. اما خبر که رسمی شد، جانشین واجد شرایط هم نمی‌توانست بفرستد و باید طبق مقررات رفتار می‌کردیم و بدیش همین بود. کم کم احساس کردم که مدرسه خلوت شده است و کلاس‌ها اغلب اوقات بی‌کارند. جانشین معلم کلاس چهار هنوز سر و صورتی به کارش نداده بود و حالا یک کلاس دیگر هم بی‌معلم شد. این بود که باز هم به سراغ رئیس فرهنگ رفتم. معلوم شد آن دخترک ترسیده و «نرسیده متلک پیچش کرده‌اید» رئیس فرهنگ این طور می‌گفت. و ترجیح داده بود همان زیر نظر خودش دفترداری کند. و بعد قول و قرار و فردا و پس فردا و عاقبت چهار روز دوندگی تا دو تا معلم گرفتم. یکی جوانکی رشتی که گذاشتیمش کلاس چهار و دیگری باز یکی ازین آقاپسرهای بریانتین‌زده که هر روز کراوات عوض می‌کرد، با نقش‌ها و طرح‌های عجیب. عجب فرهنگ را با قرتی‌ها در آمیخته بودند! باداباد. او را هم گذاشتیم سر کلاس سه. اواخر بهمن، یک روز ناظم آمد اتاقم که بودجه‌ی مدرسه را زنده کرده است. گفتم: + +- مبارکه، چه قدر گرفتی؟ + +- هنوز هیچ چی آقا. قراره فردا سر ظهر بیاند این جا آقا و همین جا قالش رو بکنند. + +و فردا اصلاً مدرسه نرفتم. حتماً می‌خواست من هم باشم و در بده بستان ماهی پانزده قران، حق نظافت هر اتاق نظارت کنم و از مدیریتم مایه بگذارم تا تنخواه‌گردان مدرسه و حق آب و دیگر پول‌های عقب‌افتاده وصول بشود... فردا سه نفری آمده بودند مدرسه. ناهار هم به خرج ناظم خورده بودند. و قرار دیگری برای یک سور حسابی گذاشته بودند و رفته بودند و ناظم با زبان بی‌زبانی حالیم کرد که این بار حتماً باید باشم و آن طور که می‌گفت، جای شکرش باقی بود که مراعات کرده بودند و حق بوقی نخواسته بودند. اولین باری بود که چنین اهمیتی پیدا می‌کردم. این هم یک مزیت دیگر مدیری مدرسه بود! سی صد تومان از بودجه‌ی دولت بسته به این بود که به فلان مجلس بروی یا نروی. تا سه روز دیگر موعد سور بود، اصلاً یادم نیست چه کردم. اما همه‌اش در این فکر بودم که بروم یا نروم؟ یک بار دیگر استعفانامه‌ام را توی جیبم گذاشتم و بی این که صدایش را در بیاورم، روز سور هم نرفتم. + +بعد دیدم این طور که نمی‌شود. گفتم بروم قضایا را برای رئیس فرهنگ بگویم. و رفتم. سلام و احوالپرسی نشستم. اما چه بگویم؟ بگویم چون نمی‌خواستم در خوردن سور شرکت کنم، استعفا می‌دهم؟... دیدم چیزی ندارم که بگویم. و از این گذشته خفت‌آور نبود که به خاطر سیصد تومان جا بزنم و استعفا بدهم؟ و «خداحافظ؛ فقط آمده بودم سلام عرض کنم.» و از این دروغ‌ها و استعفانامه‌ام را توی جوی آب انداختم. اما ناظم؛ یک هفته‌ای مثل سگ بود. عصبانی، پر سر و صدا و شارت و شورت! حتی نرفتم احوال مادرش را بپرسم. یک هفته‌ی تمام می‌رفتم و در اتاقم را می‌بستم و سوراخ‌های گوشم را می‌گرفتم و تا اِز و چِزّ بچه‌ها بخوابد، از این سر تا آن سر اتاق را می‌کوبیدم. ده روز تمام، قلب من و بچه‌ها با هم و به یک اندازه از ترس و وحشت تپید. تا عاقبت پول‌ها وصول شد. منتها به جای سیصد و خرده‌ای، فقط صد و پنجاه تومان. علت هم این بود که در تنظیم صورت حساب‌ها اشتباهاتی رخ داده بود که ناچار اصلاحش کرده بودند! + +غیر از آن زنی که هفته‌ای یک بار به مدرسه سری می‌زد، از اولیای اطفال دو سه نفر دیگر هم بودند که مرتب بودند. یکی همان پاسبانی که با کمربند، پاهای پسرش را بست و فلک کرد. یکی هم کارمند پست و تلگرافی بود که ده روزی یک بار می‌آمد و پدر همان بچه‌ی شیطان. و یک استاد نجار که پسرش کلاس اول بود و خودش سواد داشت و به آن می‌بالید و کارآمد می‌نمود. یک مقنی هم بود درشت استخوان و بلندقد که بچه‌اش کلاس سوم بود و هفته‌ای یک بار می‌آمد و همان توی حیاط، ده پانزده دقیقه‌ای با فراش‌ها اختلاط می‌کرد و بی سر و صدا می‌رفت. نه کاری داشت، نه چیزی از آدم می‌خواست و همان طور که آمده بود چند دقیقه‌ای را با فراش صحبت می‌کرد و بعد می رفت. فقط یک روز نمی‌دانم چرا رفته بود بالای دیوار مدرسه. البته اول فکر کردم مأمور اداره برق است ولی بعد متوجه شدم که همان مرد مقنی است. بچه‌ها جیغ و فریاد می‌کردند و من همه‌اش درین فکر بودم که چه طور به سر دیوار رفته است؟ ماحصل داد و فریادش این بود که چرا اسم پسر او را برای گرفتن کفش و لباس به انجمن ندادیم. وقتی به او رسیدم نگاهی به او انداختم و بعد تشری به ناظم و معلم ها زدم که ولش کردند و بچه‌ها رفتند سر کلاس و بعد بی این که نگاهی به او بکنم، گفتم: + +- خسته نباشی اوستا. + +و همان طور که به طرف دفتر می‌رفتم رو به ناظم و معلم‌ها افزودم: + +- لابد جواب درست و حسابی نشنیده که رفته سر دیوار. + +که پشت سرم گرپ صدایی آمد و از در دفتر که رفتم تو، او و ناظم با هم وارد شدند. گفتم نشست. و به جای این‌که حرفی بزند به گریه افتاد. هرگز گمان نمی‌کردم از چنان قد و قامتی صدای گریه در بیاید. این بود که از اتاق بیرون آمدم و فراش را صدا زدم که آب برایش بیاورد و حالش که جا آمد، بیاوردش پهلوی من. اما دیگر از او خبری نشد که نشد. نه آن روز و نه هیچ روز دیگر. آن روز چند دقیقه‌ای بعد از شیشه‌ی اتاق خودم دیدمش که دمش را لای پایش گذاشته بود از در مدرسه بیرون می‌رفت و فراش جدید آمد که بله می‌گفتند از پسرش پنج تومان خواسته بودند تا اسمش را برای کفش و لباس به انجمن بدهند. پیدا بود باز توی کوک ناظم رفته است. مرخصش کردم و ناظم را خواستم. معلوم شد می‌خواسته ناظم را بزند. همین جوری و بی‌مقدمه. + +اواخر بهمن بود که یکی از روزهای برفی با یکی دیگر از اولیای اطفال آشنا شدم. یارو مرد بسیار کوتاهی بود؛ فرنگ مآب و بزک کرده و اتو کشیده که ننشسته از تحصیلاتش و از سفرهای فرنگش حرف زد. می‌خواست پسرش را آن وقت سال از مدرسه‌ی دیگر به آن جا بیاورد. پسرش از آن بچه‌هایی بود که شیر و مربای صبحانه‌اش را با قربان صدقه توی حلقشان می‌تپانند. کلاس دوم بود و ثلث اول دو تا تجدید آورده بود. می‌گفت در باغ ییلاقی‌اش که نزدیک مدرسه است، باغبانی دارند که پسرش شاگرد ماست و درس‌خوان است و پیدا است که بچه‌ها زیر سایه شما خوب پیشرفت می‌کنند. و از این پیزرها. و حال به خاطر همین بچه، توی این برف و سرما، آمده‌اند ساکن باغ ییلاقی شده‌اند. بلند شدم ناظم را صدا کردم و دست او و بچه‌اش را توی دست ناظم گذاشتم و خداحافظ شما... و نیم ساعت بعد ناظم برگشت که یارو خانه‌ی شهرش را به یک دبیرستان اجاره داده، به ماهی سه هزار و دویست تومان، و التماس دعا داشته، یعنی معلم سرخانه می‌خواسته و حتی بدش نمی‌آمده است که خود مدیر زحمت بکشند و ازین گنده‌گوزی‌ها... احساس کردم که ناظم دهانش آب افتاده است. و من به ناظم حالی کردم خودش برود بهتر است و فقط کاری بکند که نه صدای معلم‌ها در بیاید و نه آخر سال، برای یک معدل ده احتیاجی به من بمیرم و تو بمیری پیدا کند. همان روز عصر ناظم رفته بود و قرار و مدار برای هر روز عصر یک ساعت به ماهی صد و پنجاه تومان. + +دیگر دنیا به کام ناظم بود. حال مادرش هم بهتر بود و از بیمارستان مرخصش کرده بودند و به فکر زن گرفتن افتاده بود. و هر روز هم برای یک نفر نقشه می‌کشید حتی برای من هم. یک روز در آمد که چرا ما خودمان «انجمن خانه و مدرسه» نداشته باشیم؟ نشسته بود و حسابش را کرده بود دیده بود که پنجاه شصت نفری از اولیای مدرسه دستشان به دهان‌شان می‌رسد و از آن هم که به پسرش درس خصوصی می‌داد قول مساعد گرفته بود. حالیش کردم که مواظب حرف و سخن اداره‌ای باشد و هر کار دلش می‌خواهد بکند. کاغذ دعوت را هم برایش نوشتم با آب و تاب و خودش برای اداره‌ی فرهنگ، داد ماشین کردند و به وسیله‌ی خود بچه‌ها فرستاد. و جلسه با حضور بیست و چند نفری از اولیای بچه‌ها رسمی شد. خوبیش این بود که پاسبان کشیک پاسگاه هم آمده بود و دم در برای همه، پاشنه‌هایش را به هم می‌کوبید و معلم‌ها گوش تا گوش نشسته بودند و مجلس ابهتی داشت و ناظم، چای و شیرینی تهیه کرده بود و چراغ زنبوری کرایه کرده بود و باران هم گذاشت پشتش و سالون برای اولین بار در عمرش به نوایی رسید. + +یک سرهنگ بود که رئیسش کردیم و آن زن را که هفته‌ای یک بار می‌آمد نایب رئیس. آن که ناظم به پسرش درس خصوصی می‌داد نیامده بود. اما پاکت سربسته‌ای به اسم مدیر فرستاده بود که فی‌المجلس بازش کردیم. عذرخواهی از این‌که نتوانسته بود بیاید و وجه ناقابلی جوف پاکت. صد و پنجاه تومان. و پول را روی میز صندوق‌دار گذاشتیم که ضبط و ربط کند. نائب رئیس بزک کرده و معطر شیرینی تعارف می‌کرد و معلم‌ها با هر بار که شیرینی بر می‌داشتند، یک بار تا بناگوش سرخ می‌شدند و فراش‌ها دست به دست چای می‌آوردند. + +در فکر بودم که یک مرتبه احساس کردم، سیصد چهارصد تومان پول نقد، روی میز است و هشت صد تومان هم تعهد کرده بودند. پیرزن صندوقدار که کیف پولش را همراهش نیاورده بود ناچار حضار تصویب کردند که پول‌ها فعلاً پیش ناظم باشد. و صورت مجلس مرتب شد و امضاها ردیف پای آن و فردا فهمیدم که ناظم همان شب روی خشت نشسته بوده و به معلم‌ها سور داده بوده است. اولین کاری که کردم رونوشت مجلس آن شب را برای اداره‌ی فرهنگ فرستادم. و بعد همان استاد نجار را صدا کردم و دستور دادم برای مستراح‌ها دو روزه در بسازد که ناظم خیلی به سختی پولش را داد. و بعد در کوچه‌ی مدرسه درخت کاشتیم. تور والیبال را تعویض و تعدادی توپ در اختیار بچه‌ها گذاشتیم برای تمرین در بعد از ظهرها و آمادگی برای مسابقه با دیگر مدارس و در همین حین سر و کله‌ی بازرس تربیت بدنی هم پیدا شد و هر روز سرکشی و بیا و برو. تا یک روز که به مدرسه رسیدم شنیدم که از سالون سر و صدا می‌آید. صدای هالتر بود. ناظم سر خود رفته بود و سرخود دویست سیصد تومان داده بود و هالتر خریده بود و بچه‌های لاغر زیر بار آن گردن خود را خرد می‌کردند. من در این میان حرفی نزدم. می‌توانستم حرفی بزنم؟ من چیکاره بودم؟ اصلاً به من چه ربطی داشت؟ هر کار که دلشان می‌خواهد بکنند. مهم این بود که سالون مدرسه رونقی گرفته بود. ناظم هم راضی بود و معلم‌ها هم. چون نه خبر از حسادتی بود و نه حرف و سخنی پیش آمد. فقط می‌بایست به ناظم سفارش می کردم که فکر فراش‌ها هم باشد. + +کم کم خودمان را برای امتحان‌های ثلث دوم آماده می‌کردیم. این بود که اوایل اسفند، یک روز معلم‌ها را صدا زدم و در شورا مانندی که کردیم بی‌مقدمه برایشان داستان یکی از همکاران سابقم را گفتم که هر وقت بیست می‌داد تا دو روز تب داشت. البته معلم‌ها خندیدند. ناچار تشویق شدم و داستان آخوندی را گفتم که در بچگی معلم شرعیاتمان بود و زیر عبایش نمره می‌داد و دستش چنان می‌لرزید که عبا تکان می‌خورد و درست ده دقیقه طول می‌کشید. و تازه چند؟ بهترین شاگردها دوازده. و البته باز هم خندیدند. که این بار کلافه‌ام کرد. و بعد حالیشان کردم که بد نیست در طرح سؤال‌ها مشورت کنیم و از این حرف‌ها... + +و از شنبه‌ی بعد، امتحانات شروع شد. درست از نیمه‌ی دوم اسفند. سؤال‌ها را سه نفری می‌دیدیم. خودم با معلم هر کلاس و ناظم. در سالون میزها را چیده بودیم البته از وقتی هالتردار شده بود خیلی زیباتر شده بود. در سالون کاردستی‌های بچه‌ها در همه جا به چشم می‌خورد. هر کسی هر چیزی را به عنوان کاردستی درست کرده بودند و آورده بودند. که برای این کاردستی‌ها چه پول‌ها که خرج نشده بود و چه دست‌ها که نبریده بود و چه دعواها که نشده بود و چه عرق‌ها که ریخته نشده بود. پیش از هر امتحان که می‌شد، خودم یک میتینگ برای بچه‌ها می‌دادم که ترس از معلم و امتحان بی‌جا است و باید اعتماد به نفس داشت و ازین مزخرفات....ولی مگر حرف به گوش کسی می‌رفت؟ از در که وارد می‌شدند، چنان هجومی می‌بردند که نگو! به جاهای دور از نظر. یک بار چنان بود که احساس کردم مثل این‌که از ترس، لذت می‌برند. اگر معلم نبودی یا مدیر، به راحتی می‌توانستی حدس بزنی که کی‌ها با هم قرار و مداری دارند و کدام یک پهلو دست کدام یک خواهد نشست. یکی دو بار کوشیدم بالای دست یکی‌شان بایستم و ببینم چه می‌نویسد. ولی چنان مضطرب می‌شدند و دستشان به لرزه می‌افتاد که از نوشتن باز می‌ماندند. می‌دیدم که این مردان آینده، درین کلاس‌ها و امتحان‌ها آن قدر خواهند ترسید که وقتی دیپلمه بشوند یا لیسانسه، اصلاً آدم نوع جدیدی خواهند شد. آدمی انباشته از وحشت، انبانی از ترس و دلهره. به این ترتیب یک روز بیشتر دوام نیاوردم. چون دیدم نمی‌توانم قلب بچگانه‌ای داشته باشم تا با آن ترس و وحشت بچه‌ها را درک کنم و هم‌دردی نشان بدهم.این جور بود که می‌دیدم که معلم مدرسه هم نمی‌توانم باشم. + +دو روز قبل از عید کارنامه‌ها آماده بود و منتظر امضای مدیر. دویست و سی و شش تا امضا اقلاً تا ظهر طول می‌کشید. پیش از آن هم تا می‌توانستم از امضای دفترهای حضور و غیاب می‌گریختم. خیلی از جیره‌خورهای دولت در ادارات دیگر یا در میان همکارانم دیده بودم که در مواقع بیکاری تمرین امضا می‌کنند. پیش از آن نمی‌توانستم بفهمم چه طور از مدیری یک مدرسه یا کارمندی ساده یک اداره می‌شود به وزارت رسید. یا اصلاً آرزویش را داشت. نیم‌قراضه امضای آماده و هر کدام معرف یک شخصیت، بعد نیم‌ذرع زبان چرب و نرم که با آن، مار را از سوراخ بیرون بکشی، یا همه جا را بلیسی و یک دست هم قیافه. نه یک جور. دوازده جور. + +در این فکرها بودم که ناگهان در میان کارنامه‌ها چشمم به یک اسم آشنا افتاد. به اسم پسران جناب سرهنگ که رئیس انجمن بود. رفتم توی نخ نمراتش. همه متوسط بود و جای ایرادی نبود. و یک مرتبه به صرافت افتادم که از اول سال تا به حال بچه‌های مدرسه را فقط به اعتبار وضع مالی پدرشان قضاوت کرده‌ام. درست مثل این پسر سرهنگ که به اعتبار کیابیای پدرش درس نمی‌خواند. دیدم هر کدام که پدرشان فقیرتر است به نظر من باهوش‌تر می‌آمده‌اند. البته ناظم با این حرف‌ها کاری نداشت. مر قانونی را عمل می‌کرد. از یکی چشم می‌پوشید به دیگری سخت می‌گرفت. + +اما من مثل این که قضاوتم را درباره‌ی بچه‌ها از پیش کرده باشم و چه خوب بود که نمره‌ها در اختیار من نبود و آن یکی هم «انظباط» مال آخر سال بود. مسخره‌ترین کارها آن است که کسی به اصلاح وضعی دست بزند، اما در قلمروی که تا سر دماغش بیشتر نیست. و تازه مدرسه‌ی من، این قلمروی فعالیت من، تا سر دماغم هم نبود. به همان توی ذهنم ختم می‌شد. وضعی را که دیگران ترتیب داده بودند. به این ترتیب بعد از پنج شش ماه، می‌فهمیدم که حسابم یک حساب عقلایی نبوده است. احساساتی بوده است. ضعف‌های احساساتی مرا خشونت‌های عملی ناظم جبران می‌کرد و این بود که جمعاً نمی‌توانستم ازو بگذرم. مرد عمل بود. کار را می‌برید و پیش می‌رفت. در زندگی و در هر کاری، هر قدمی بر می‌داشت، برایش هدف بود. و چشم از وجوه دیگر قضیه می‌پوشید. این بود که برش داشت. و من نمی‌توانستم. چرا که اصلاً مدیر نبودم. خلاص... + +و کارنامه‌ی پسر سرهنگ را که زیر دستم عرق کرده بود، به دقت و احتیاج خشک کردم و امضایی زیر آن گذاشتم به قدری بد خط و مسخره بود که به یاد امضای فراش جدیدمان افتادم. حتماً جناب سرهنگ کلافه می‌شد که چرا چنین آدم بی‌سوادی را با این خط و ربط امضا مدیر مدرسه کرده‌اند. آخر یک جناب سرهنگ هم می‌داند که امضای آدم معرف شخصیت آدم است. + +اواخر تعطیلات نوروز رفتم به ملاقات معلم ترکه‌ای کلاس سوم. ناظم که با او میانه‌ی خوشی نداشت. ناچار با معلم حساب کلاس پنج و شش قرار و مداری گذاشته بودم که مختصری علاقه‌ای هم به آن حرف و سخن‌ها داشت. هم به وسیله‌ی او بود که می‌دانستم نشانی‌اش کجا است و توی کدام زندان است. در راه قبل از هر چیز خبر داد که رئیس فرهنگ عوض شده و این طور که شایع است یکی از هم دوره‌ای‌های من، جایش آمده. گفتم: + +- عجب! چرا؟ مگه رئیس قبلی چپش کم بود؟ + +- چه عرض کنم. می‌گند پا تو کفش یکی از نماینده‌ها کرده. شما خبر ندارید؟ + +- چه طور؟ از کجا خبر داشته باشم؟ + +- هیچ چی... می گند دو تا از کارچاق‌کن‌های انتخاباتی یارو از صندوق فرهنگ حقوق می‌گرفته‌اند؛ شب عیدی رئیس فرهنگ حقوق‌شون رو زده. + +- عجب! پس اونم می‌خواسته اصلاحات کنه! بیچاره. + +و بعد از این حرف زدیم که الحمدالله مدرسه مرتب است و آرام و معلم‌ها همکاری می‌کنند و ناظم بیش از اندازه همه‌کاره شده است. و من فهمیدم که باز لابد مشتری خصوصی تازه‌ای پیدا شده است که سر و صدای همه همکارها بلند شده. دم در زندان شلوغ بود. کلاه مخملی‌ها، عم‌قزی گل‌بته‌ها، خاله خانباجی‌ها و... اسم نوشتیم و نوبت گرفتیم و به جای پاها، دست‌هامان زیر بار کوچکی که داشتیم، خسته شد و خواب رفت تا نوبتمان شد. از این اتاق به آن اتاق و عاقبت نرده‌های آهنی و پشت آن معلم کلاس سه و... عجب چاق شده بود!درست مثل یک آدم حسابی شده بود. خوشحال شدیم و احوالپرسی و تشکر؛ و دیگر چه بگویم؟ بگویم چرا خودت را به دردسر انداختی؟ پیدا بود از مدرسه و کلاس به او خوش‌تر می‌گذرد. ایمانی بود و او آن را داشت و خوشبخت بود و دردسری نمی‌دید و زندان حداقل برایش کلاس درس بود. عاقبت پرسیدم: + +- پرونده‌ای هم برات درست کردند یا هنوز بلاتکلیفی؟ + +- امتحانمو دادم آقا مدیر، بد از آب در نیومد. + +- یعنی چه؟ + +- یعنی بی‌تکلیف نیستم. چون اسمم تو لیست جیره‌ی زندون رفته. خیالم راحته. چون سختی‌هاش گذشته. + +دیگر چه بگویم. دیدم چیزی ندارم خداحافظی کردم و او را با معلم حساب تنها گذاشتم و آمدم بیرون و تا مدت ملاقات تمام بشود، دم در زندان قدم زدم و به زندانی فکر کردم که برای خودم ساخته بودم. یعنی آن خرپول فرهنگ‌دوست ساخته بود. و من به میل و رغبت خودم را در آن زندانی کرده بودم. این یکی را به ضرب دگنک این جا آورده بودند. ناچار حق داشت که خیالش راحت باشد. اما من به میل و رغبت رفته بودم و چه بکنم؟ ناظم چه طور؟ راستی اگر رئیس فرهنگ از هم دوره‌ای‌های خودم باشد؛ چه طور است بروم و ازو بخواهم که ناظم را جای من بگذارد، یا همین معلم حساب را؟... که معلم حساب در آمد و راه افتادیم. با او هم دیگر حرفی نداشتم. سر پیچ خداحافظ شما و تاکسی گرفتم و یک سر به اداره‌ی فرهنگ زدم. گرچه دهم عید بود، اما هنوز رفت و آمد سال نو تمام نشده بود. برو و بیا و شیرینی و چای دو جانبه. رفتم تو. سلام و تبریک و همین تعارفات را پراندم. + +بله خودش بود. یکی از پخمه‌های کلاس. که آخر سال سوم کشتیارش شدم دو بیت شعر را حفظ کند، نتوانست که نتوانست. و حالا او رئیس بود و من آقا مدیر. راستی حیف از من، که حتی وزیر چنین رئیس فرهنگ‌هایی باشم! میز همان طور پاک بود و رفته. اما زیرسیگاری انباشته از خاکستر و ته سیگار. بلند شد و چلپ و چولوپ روبوسی کردیم و پهلوی خودش جا باز کرد و گوش تا گوش جیره‌خورهای فرهنگ تبریکات صمیمانه و بدگویی از ماسبق و هندوانه و پیزرها! و دو نفر که قد و قواره‌شان به درد گود زورخانه می‌خورد یا پای صندوق انتخابات شیرینی به مردم می‌دادند. نزدیک بود شیرینی را توی ظرفش بیندازم که دیدم بسیار احمقانه است. سیگارم که تمام شد قضیه‌ی رئیس فرهنگ قبلی و آن دو نفر را در گوشی ازش پرسیدم، حرفی نزد. فقط نگاهی می‌کرد که شبیه التماس بود و من فرصت جستم تا وضع معلم کلاس سوم را برایش روشن کنم و از او بخواهم تا آن جا که می‌تواند جلوی حقوقش را نگیرد. و از در که آمدم بیرون، تازه یادم آمد که برای کار دیگری پیش رئیس فرهنگ بودم. + +باز دیروز افتضاحی به پا شد. معقول یک ماهه‌ی فروردین راحت بودیم. اول اردیبهشت ماه جلالی و کوس رسوایی سر دیوار مدرسه. نزدیک آخر وقت یک جفت پدر و مادر، بچه‌شان در میان، وارد اتاق شدند. یکی بر افروخته و دیگری رنگ و رو باخته و بچه‌شان عیناً مثل این عروسک‌های کوکی. سلام و علیک و نشستند. خدایا دیگر چه اتفاقی افتاده است؟ + +- چه خبر شده که با خانوم سرافرازمون کردید؟ + +مرد اشاره‌ای به زنش کرد که بلند شد و دست بچه را گرفت و رفت بیرون و من ماندم و پدر. اما حرف نمی‌زد. به خودش فرصت می‌داد تا عصبانیتش بپزد. سیگارم را در آوردم و تعارفش کردم. مثل این که مگس مزاحمی را از روی دماغش بپراند، سیگار را رد کرد و من که سیگارم را آتش می‌زدم، فکر کردم لابد دردی دارد که چنین دست و پا بسته و چنین متکی به خانواده به مدرسه آمده. باز پرسیدم: + +- خوب، حالا چه فرمایش داشتید؟ + +که یک مرتبه ترکید: + +- اگه من مدیر مدرسه بودم و هم‌چه اتفاقی می‌افتاد، شیکم خودمو پاره می‌کردم. خجالت بکش مرد! برو استعفا بده. تا اهل محل نریختن تیکه تیکه‌ات کنند، دو تا گوشتو وردار و دررو. بچه‌های مردم می‌آن این جا درس بخونن و حسن اخلاق. نمی‌آن که... + +- این مزخرفات کدومه آقا! حرف حساب سرکار چیه؟ + +و حرکتی کردم که او را از در بیندازم بیرون. اما آخر باید می‌فهمیدم چه مرگش است. «ولی آخر با من چه کار دارد؟» + +- آبروی من رفته. آبروی صد ساله‌ی خونواده‌ام رفته. اگه در مدرسه‌ی تو رو تخته نکنم، تخم بابام نیستم. آخه من دیگه با این بچه چی کار کنم؟ تو این مدرسه ناموس مردم در خطره. کلانتری فهمیده؛ پزشک قانونی فهمیده؛ یک پرونده درست شده پنجاه ورق؛ تازه می‌گی حرف حسابم چیه؟ حرف حسابم اینه که صندلی و این مقام از سر تو زیاده. حرف حسابم اینه که می‌دم محاکمه‌ات کنند و از نون خوردن بندازنت... + +او می‌گفت و من گوش می‌کردم و مثل دو تا سگ هار به جان هم افتاده بودیم که در باز شد و ناظم آمد تو. به دادم رسید. در همان حال که من و پدر بچه در حال دعوا بودیم زن و بچه همان آقا رفته بودند و قضایا را برای ناظم تعریف کرده بودند و او فرستاده بوده فاعل را از کلاس کشیده بودند بیرون... و گفت چه طور است زنگ بزنیم و جلوی بچه‌ها ادبش کنیم و کردیم. یعنی این بار خود من رفتم میدان. پسرک نره‌خری بود از پنجمی‌ها با لباس مرتب و صورت سرخ و سفید و سالکی به گونه. جلوی روی بچه‌ها کشیدمش زیر مشت و لگد و بعد سه تا از ترکه‌ها را که فراش جدید فوری از باغ همسایه آورده بود، به سر و صورتش خرد کردم. چنان وحشی شده بودم که اگر ترکه‌ها نمی‌رسید، پسرک را کشته بودم. این هم بود که ناظم به دادش رسید و وساطت کرد و لاشه‌اش را توی دفتر بردند و بچه‌ها را مرخص کردند و من به اتاقم برگشتم و با حالی زار روی صندلی افتادم، نه از پدر خبری بود و نه از مادر و نه از عروسک‌های کوکی‌شان که ناموسش دست کاری شده بود. و تازه احساس کردم که این کتک‌کاری را باید به او می‌زدم. خیس عرق بودم و دهانم تلخ بود. تمام فحش‌هایی که می‌بایست به آن مردکه‌ی دبنگ می‌دادم و نداده بودم، در دهانم رسوب کرده بود و مثل دم مار تلخ شده بود. اصلاً چرا زدمش؟ چرا نگذاشتم مثل همیشه ناظم میدان‌داری کند که هم کارکشته‌تر بود و هم خونسردتر. لابد پسرک با دخترعمه‌اش هم نمی‌تواند بازی کند. لابد توی خانواده‌شان، دخترها سر ده دوازده سالگی باید از پسرهای هم سن رو بگیرند. نکند عیبی کرده باشد؟ و یک مرتبه به صرافت افتادم که بروم ببینم چه بلایی به سرش آورده‌ام. بلند شدم و یکی از فراش‌ها را صدا کردم که فهمیدم روانه‌اش کرده‌اند. آبی آورد که روی دستم می‌ریخت و صورتم را می‌شستم و می‌کوشیدم که لرزش دست‌هایم را نبیند. و در گوشم آهسته گفت که پسر مدیر شرکت اتوبوسرانی است و بدجوری کتک خورده و آن‌ها خیلی سعی کرده‌اند که تر و تمیزش کنند... + +احمق مثلا داشت توی دل مرا خالی می‌کرد. نمی‌دانست که من اول تصمیم را گرفتم، بعد مثل سگ هار شدم. و تازه می‌فهمیدم کسی را زده‌ام که لیاقتش را داشته. حتماً از این اتفاق‌ها جای دیگر هم می‌افتد. آدم بردارد پایین تنه بچه‌ی خودش را، یا به قول خودش ناموسش را بگذارد سر گذر که کلانتر محل و پزشک معاینه کنند! تا پرونده درست کنند؟ با این پدرو مادرها بچه‌ها حق دارند که قرتی و دزد و دروغگو از آب در بیایند. این مدرسه‌ها را اول برای پدر و مادرها باز کنند... + +با این افکار به خانه رسیدم. زنم در را که باز کرد؛ چشم‌هایش گرد شد. همیشه وقتی می‌ترسد این طور می‌شود. برای اینکه خیال نکند آدم کشته‌ام، زود قضایا را برایش گفتم. و دیدم که در ماند. یعنی ساکت ماند. آب سرد، عرق بیدمشک، سیگار پشت سیگار فایده نداشت، لقمه از گلویم پایین نمی‌رفت و دست‌ها هنوز می‌لرزید. هر کدام به اندازه‌ی یک ماه فعالیت کرده بودند. با سیگار چهارم شروع کردم: + +- می‌دانی زن؟ بابای یارو پول‌داره. مسلماً کار به دادگستری و این جور خنس‌ها می‌کشه. مدیریت که الفاتحه. اما خیلی دلم می‌خواد قضیه به دادگاه برسه. یک سال آزگار رو دل کشیده‌ام و دیگه خسته شده‌ام. دلم می‌خواد یکی بپرسه چرا بچه‌ی مردم رو این طوری زدی، چرا تنبیه بدنی کردی! آخه یک مدیر مدرسه هم حرف‌هایی داره که باید یک جایی بزنه... + +که بلند شد و رفت سراغ تلفن. دو سه تا از دوستانم را که در دادگستری کاره‌ای بودند، گرفت و خودم قضیه را برایشان گفتم که مواظب باشند. فردا پسرک فاعل به مدرسه نیامده بود. و ناظم برایم گفت که قضیه ازین قرار بوده است که دوتایی به هوای دیدن مجموعه تمبرهای فاعل با هم به خانه‌ای می‌روند و قضایا همان جا اتفاق می‌افتد و داد و هوار و دخالت پدر و مادرهای طرفین و خط و نشان و شبانه کلانتری؛ و تمام اهل محل خبر دارند. او هم نظرش این بود که کار به دادگستری خواهد کشید. + +و من یک هفته‌ی تمام به انتظار اخطاریه‌ی دادگستری صبح و عصر به مدرسه رفتم و مثل بخت‌النصر پشت پنجره ایستادم. اما در تمام این مدت نه از فاعل خبری شد، نه از مفعول و نه از پدر و مادر ناموس‌پرست و نه از مدیر شرکت اتوبوسرانی. انگار نه انگار که اتفاقی افتاده. بچه‌ها می‌آمدند و می‌رفتند؛ برای آب خوردن عجله می‌کردند؛ به جای بازی کتک‌کاری می‌کردند و همه چیز مثل قبل بود. فقط من ماندم و یک دنیا حرف و انتظار. تا عاقبت رسید.... احضاریه‌ای با تعیین وقت قبلی برای دو روز بعد، در فلان شعبه و پیش فلان بازپرس دادگستری. آخر کسی پیدا شده بود که به حرفم گوش کند. + +تا دو روز بعد که موعد احضار بود، اصلاً از خانه در نیامدم. نشستم و ماحصل حرف‌هایم را روی کاغذ آوردم. حرف‌هایی که با همه‌ی چرندی هر وزیر فرهنگی می‌توانست با آن یک برنامه‌ی هفت ساله برای کارش بریزد. و سر ساعت معین رفتم دادگستری. اتاق معین و بازپرس معین. در را باز کردم و سلام، و تا آمدم خودم را معرفی کنم و احضاریه را در بیاورم، یارو پیش‌دستی کرد و صندلی آورد و چای سفارش داد و «احتیاجی به این حرف‌ها نیست و قضیه‌ی کوچک بود و حل شد و راضی به زحمت شما نبودیم...» + +که عرق سرد بر بدن من نشست. چایی‌ام را که خوردم، روی همان کاغذ نشان‌دار دادگستری استعفانامه‌ام را نوشتم و به نام هم‌کلاسی پخمه‌ام که تازه رئیس شده بود، دم در پست کردم. +EOT; +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fi_FI/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/fi_FI/Address.php new file mode 100644 index 00000000..d72951be --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fi_FI/Address.php @@ -0,0 +1,85 @@ +format('dmy'); + + switch ((int) ($birthdate->format('Y') / 100)) { + case 18: + $centurySign = '+'; + + break; + + case 19: + $centurySign = '-'; + + break; + + case 20: + $centurySign = 'A'; + + break; + + default: + throw new \InvalidArgumentException('Year must be between 1800 and 2099 inclusive.'); + } + + $randomDigits = self::numberBetween(0, 89); + + if ($gender && $gender == static::GENDER_MALE) { + if ($randomDigits === 0) { + $randomDigits .= static::randomElement([3, 5, 7, 9]); + } else { + $randomDigits .= static::randomElement([1, 3, 5, 7, 9]); + } + } elseif ($gender && $gender == static::GENDER_FEMALE) { + if ($randomDigits === 0) { + $randomDigits .= static::randomElement([2, 4, 6, 8]); + } else { + $randomDigits .= static::randomElement([0, 2, 4, 6, 8]); + } + } else { + if ($randomDigits === 0) { + $randomDigits .= self::numberBetween(2, 9); + } else { + $randomDigits .= (string) static::numerify('#'); + } + } + $randomDigits = str_pad($randomDigits, 3, '0', STR_PAD_LEFT); + + $checksum = $checksumCharacters[(int) ($datePart . $randomDigits) % strlen($checksumCharacters)]; + + return $datePart . $centurySign . $randomDigits . $checksum; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fi_FI/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/fi_FI/PhoneNumber.php new file mode 100644 index 00000000..db06ce26 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fi_FI/PhoneNumber.php @@ -0,0 +1,101 @@ + 'Argovie'], + ['AI' => 'Appenzell Rhodes-Intérieures'], + ['AR' => 'Appenzell Rhodes-Extérieures'], + ['BE' => 'Berne'], + ['BL' => 'Bâle-Campagne'], + ['BS' => 'Bâle-Ville'], + ['FR' => 'Fribourg'], + ['GE' => 'Genève'], + ['GL' => 'Glaris'], + ['GR' => 'Grisons'], + ['JU' => 'Jura'], + ['LU' => 'Lucerne'], + ['NE' => 'Neuchâtel'], + ['NW' => 'Nidwald'], + ['OW' => 'Obwald'], + ['SG' => 'Saint-Gall'], + ['SH' => 'Schaffhouse'], + ['SO' => 'Soleure'], + ['SZ' => 'Schwytz'], + ['TG' => 'Thurgovie'], + ['TI' => 'Tessin'], + ['UR' => 'Uri'], + ['VD' => 'Vaud'], + ['VS' => 'Valais'], + ['ZG' => 'Zoug'], + ['ZH' => 'Zurich'], + ]; + + protected static $cityFormats = [ + '{{cityName}}', + ]; + + protected static $streetNameFormats = [ + '{{streetPrefix}} {{lastName}}', + '{{streetPrefix}} de {{cityName}}', + '{{streetPrefix}} de {{lastName}}', + ]; + + protected static $streetAddressFormats = [ + '{{streetName}} {{buildingNumber}}', + ]; + protected static $addressFormats = [ + "{{streetAddress}}\n{{postcode}} {{city}}", + ]; + + /** + * Returns a random street prefix + * + * @example Rue + * + * @return string + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Returns a random city name. + * + * @example Luzern + * + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a canton + * + * @example array('BE' => 'Bern') + * + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + + return key($canton); + } + + /** + * Returns the name of canton. + * + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + + return current($canton); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fr_CH/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/fr_CH/Company.php new file mode 100644 index 00000000..fe2d2551 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fr_CH/Company.php @@ -0,0 +1,15 @@ + 'Ain'], ['02' => 'Aisne'], ['03' => 'Allier'], ['04' => 'Alpes-de-Haute-Provence'], ['05' => 'Hautes-Alpes'], + ['06' => 'Alpes-Maritimes'], ['07' => 'Ardèche'], ['08' => 'Ardennes'], ['09' => 'Ariège'], ['10' => 'Aube'], + ['11' => 'Aude'], ['12' => 'Aveyron'], ['13' => 'Bouches-du-Rhône'], ['14' => 'Calvados'], ['15' => 'Cantal'], + ['16' => 'Charente'], ['17' => 'Charente-Maritime'], ['18' => 'Cher'], ['19' => 'Corrèze'], ['2A' => 'Corse-du-Sud'], + ['2B' => 'Haute-Corse'], ['21' => "Côte-d'Or"], ['22' => "Côtes-d'Armor"], ['23' => 'Creuse'], ['24' => 'Dordogne'], + ['25' => 'Doubs'], ['26' => 'Drôme'], ['27' => 'Eure'], ['28' => 'Eure-et-Loir'], ['29' => 'Finistère'], ['30' => 'Gard'], + ['31' => 'Haute-Garonne'], ['32' => 'Gers'], ['33' => 'Gironde'], ['34' => 'Hérault'], ['35' => 'Ille-et-Vilaine'], + ['36' => 'Indre'], ['37' => 'Indre-et-Loire'], ['38' => 'Isère'], ['39' => 'Jura'], ['40' => 'Landes'], ['41' => 'Loir-et-Cher'], + ['42' => 'Loire'], ['43' => 'Haute-Loire'], ['44' => 'Loire-Atlantique'], ['45' => 'Loiret'], ['46' => 'Lot'], + ['47' => 'Lot-et-Garonne'], ['48' => 'Lozère'], ['49' => 'Maine-et-Loire'], ['50' => 'Manche'], ['51' => 'Marne'], + ['52' => 'Haute-Marne'], ['53' => 'Mayenne'], ['54' => 'Meurthe-et-Moselle'], ['55' => 'Meuse'], ['56' => 'Morbihan'], + ['57' => 'Moselle'], ['58' => 'Nièvre'], ['59' => 'Nord'], ['60' => 'Oise'], ['61' => 'Orne'], ['62' => 'Pas-de-Calais'], + ['63' => 'Puy-de-Dôme'], ['64' => 'Pyrénées-Atlantiques'], ['65' => 'Hautes-Pyrénées'], ['66' => 'Pyrénées-Orientales'], + ['67' => 'Bas-Rhin'], ['68' => 'Haut-Rhin'], ['69' => 'Rhône'], ['70' => 'Haute-Saône'], ['71' => 'Saône-et-Loire'], + ['72' => 'Sarthe'], ['73' => 'Savoie'], ['74' => 'Haute-Savoie'], ['75' => 'Paris'], ['76' => 'Seine-Maritime'], + ['77' => 'Seine-et-Marne'], ['78' => 'Yvelines'], ['79' => 'Deux-Sèvres'], ['80' => 'Somme'], ['81' => 'Tarn'], + ['82' => 'Tarn-et-Garonne'], ['83' => 'Var'], ['84' => 'Vaucluse'], ['85' => 'Vendée'], ['86' => 'Vienne'], + ['87' => 'Haute-Vienne'], ['88' => 'Vosges'], ['89' => 'Yonne'], ['90' => 'Territoire de Belfort'], ['91' => 'Essonne'], + ['92' => 'Hauts-de-Seine'], ['93' => 'Seine-Saint-Denis'], ['94' => 'Val-de-Marne'], ['95' => "Val-d'Oise"], + ['971' => 'Guadeloupe'], ['972' => 'Martinique'], ['973' => 'Guyane'], ['974' => 'La Réunion'], ['976' => 'Mayotte'], + ]; + + protected static $secondaryAddressFormats = ['Apt. ###', 'Suite ###', 'Étage ###', 'Bât. ###', 'Chambre ###']; + + /** + * @example 'Appt. 350' + */ + public static function secondaryAddress() + { + return static::numerify(static::randomElement(static::$secondaryAddressFormats)); + } + + /** + * @example 'rue' + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Randomly returns a french region. + * + * @example 'Guadeloupe' + * + * @return string + */ + public static function region() + { + return static::randomElement(static::$regions); + } + + /** + * Randomly returns a french department ('departmentNumber' => 'departmentName'). + * + * @example array('2B' => 'Haute-Corse') + * + * @return array + */ + public static function department() + { + return static::randomElement(static::$departments); + } + + /** + * Randomly returns a french department name. + * + * @example 'Ardèche' + * + * @return string + */ + public static function departmentName() + { + $randomDepartmentName = array_values(static::department()); + + return $randomDepartmentName[0]; + } + + /** + * Randomly returns a french department number. + * + * @example '59' + * + * @return string + */ + public static function departmentNumber() + { + $randomDepartmentNumber = array_keys(static::department()); + + return $randomDepartmentNumber[0]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Company.php new file mode 100644 index 00000000..fcc142da --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Company.php @@ -0,0 +1,480 @@ +generator->parse($format)); + + if ($this->isCatchPhraseValid($catchPhrase)) { + break; + } + } while (true); + + return $catchPhrase; + } + + /** + * Generates a siret number (14 digits) that passes the Luhn check. + * + * @see http://fr.wikipedia.org/wiki/Syst%C3%A8me_d'identification_du_r%C3%A9pertoire_des_%C3%A9tablissements + * + * @return string + */ + public function siret($formatted = true) + { + $siret = self::siren(false); + $nicFormat = static::randomElement(static::$siretNicFormats); + $siret .= $this->numerify($nicFormat); + $siret .= Luhn::computeCheckDigit($siret); + + if ($formatted) { + $siret = substr($siret, 0, 3) . ' ' . substr($siret, 3, 3) . ' ' . substr($siret, 6, 3) . ' ' . substr($siret, 9, 5); + } + + return $siret; + } + + /** + * Generates a siren number (9 digits) that passes the Luhn check. + * + * @see http://fr.wikipedia.org/wiki/Syst%C3%A8me_d%27identification_du_r%C3%A9pertoire_des_entreprises + * + * @return string + */ + public static function siren($formatted = true) + { + $siren = self::numerify('%#######'); + $siren .= Luhn::computeCheckDigit($siren); + + if ($formatted) { + $siren = substr($siren, 0, 3) . ' ' . substr($siren, 3, 3) . ' ' . substr($siren, 6, 3); + } + + return $siren; + } + + /** + * @var array An array containing string which should not appear twice in a catch phrase. + */ + protected static $wordsWhichShouldNotAppearTwice = ['sécurité', 'simpl']; + + /** + * Validates a french catch phrase. + * + * @param string $catchPhrase The catch phrase to validate. + * + * @return bool (true if valid, false otherwise) + */ + protected static function isCatchPhraseValid($catchPhrase) + { + foreach (static::$wordsWhichShouldNotAppearTwice as $word) { + // Fastest way to check if a piece of word does not appear twice. + $beginPos = strpos($catchPhrase, $word); + $endPos = strrpos($catchPhrase, $word); + + if ($beginPos !== false && $beginPos != $endPos) { + return false; + } + } + + return true; + } + + /** + * @see http://www.pole-emploi.fr/candidat/le-code-rome-et-les-fiches-metiers-@/article.jspz?id=60702 + * @note Randomly took 300 from this list + */ + protected static $jobTitleFormat = [ + 'Agent d\'accueil', + 'Agent d\'enquêtes', + 'Agent d\'entreposage', + 'Agent de curage', + 'Agro-économiste', + 'Aide couvreur', + 'Aide à domicile', + 'Aide-déménageur', + 'Ambassadeur', + 'Analyste télématique', + 'Animateur d\'écomusée', + 'Animateur web', + 'Appareilleur-gazier', + 'Archéologue', + 'Armurier d\'art', + 'Armurier spectacle', + 'Artificier spectacle', + 'Artiste dramatique', + 'Aspigiculteur', + 'Assistant de justice', + 'Assistant des ventes', + 'Assistant logistique', + 'Assistant styliste', + 'Assurance', + 'Auteur-adaptateur', + 'Billettiste voyages', + 'Brigadier', + 'Bruiteur', + 'Bâtonnier d\'art', + 'Bûcheron', + 'Cameraman', + 'Capitaine de pêche', + 'Carrier', + 'Caviste', + 'Chansonnier', + 'Chanteur', + 'Chargé de recherche', + 'Chasseur-bagagiste', + 'Chef de fabrication', + 'Chef de scierie', + 'Chef des ventes', + 'Chef du personnel', + 'Chef géographe', + 'Chef monteur son', + 'Chef porion', + 'Chiropraticien', + 'Choréologue', + 'Chromiste', + 'Cintrier-machiniste', + 'Clerc hors rang', + 'Coach sportif', + 'Coffreur béton armé', + 'Coffreur-ferrailleur', + 'Commandant de police', + 'Commandant marine', + 'Commis de coupe', + 'Comptable unique', + 'Conception et études', + 'Conducteur de jumbo', + 'Conseiller culinaire', + 'Conseiller funéraire', + 'Conseiller relooking', + 'Consultant ergonome', + 'Contrebassiste', + 'Convoyeur garde', + 'Copiste offset', + 'Corniste', + 'Costumier-habilleur', + 'Coutelier d\'art', + 'Cueilleur de cerises', + 'Céramiste concepteur', + 'Danse', + 'Danseur', + 'Data manager', + 'Dee-jay', + 'Designer produit', + 'Diététicien conseil', + 'Diététique', + 'Doreur sur métaux', + 'Décorateur-costumier', + 'Défloqueur d\'amiante', + 'Dégustateur', + 'Délégué vétérinaire', + 'Délégué à la tutelle', + 'Désamianteur', + 'Détective', + 'Développeur web', + 'Ecotoxicologue', + 'Elagueur-botteur', + 'Elagueur-grimpeur', + 'Elastiqueur', + 'Eleveur d\'insectes', + 'Eleveur de chats', + 'Eleveur de volailles', + 'Embouteilleur', + 'Employé d\'accueil', + 'Employé d\'étage', + 'Employé de snack-bar', + 'Endivier', + 'Endocrinologue', + 'Epithésiste', + 'Essayeur-retoucheur', + 'Etainier', + 'Etancheur', + 'Etancheur-bardeur', + 'Etiqueteur', + 'Expert back-office', + 'Exploitant de tennis', + 'Extraction', + 'Facteur', + 'Facteur de clavecins', + 'Facteur de secteur', + 'Fantaisiste', + 'Façadier-bardeur', + 'Façadier-ravaleur', + 'Feutier', + 'Finance', + 'Flaconneur', + 'Foreur pétrole', + 'Formateur d\'italien', + 'Fossoyeur', + 'Fraiseur', + 'Fraiseur mouliste', + 'Frigoriste maritime', + 'Fromager', + 'Galeriste', + 'Gardien de résidence', + 'Garçon de chenil', + 'Garçon de hall', + 'Gendarme mobile', + 'Guitariste', + 'Gynécologue', + 'Géodésien', + 'Géologue prospecteur', + 'Géomètre', + 'Géomètre du cadastre', + 'Gérant d\'hôtel', + 'Gérant de tutelle', + 'Gériatre', + 'Hydrothérapie', + 'Hématologue', + 'Hôte de caisse', + 'Ingénieur bâtiment', + 'Ingénieur du son', + 'Ingénieur géologue', + 'Ingénieur géomètre', + 'Ingénieur halieute', + 'Ingénieur logistique', + 'Instituteur', + 'Jointeur de placage', + 'Juge des enfants', + 'Juriste financier', + 'Kiwiculteur', + 'Lexicographe', + 'Liftier', + 'Litigeur transport', + 'Logistique', + 'Logopède', + 'Magicien', + 'Manager d\'artiste', + 'Mannequin détail', + 'Maquilleur spectacle', + 'Marbrier-poseur', + 'Marin grande pêche', + 'Matelassier', + 'Maçon', + 'Maçon-fumiste', + 'Maçonnerie', + 'Maître de ballet', + 'Maïeuticien', + 'Menuisier', + 'Miroitier', + 'Modéliste industriel', + 'Moellonneur', + 'Moniteur de sport', + 'Monteur audiovisuel', + 'Monteur de fermettes', + 'Monteur de palettes', + 'Monteur en siège', + 'Monteur prototypiste', + 'Monteur-frigoriste', + 'Monteur-truquiste', + 'Mouleur sable', + 'Mouliste drapeur', + 'Mécanicien-armurier', + 'Médecin du sport', + 'Médecin scolaire', + 'Médiateur judiciaire', + 'Médiathécaire', + 'Net surfeur surfeuse', + 'Oenologue', + 'Opérateur de plateau', + 'Opérateur du son', + 'Opérateur géomètre', + 'Opérateur piquage', + 'Opérateur vidéo', + 'Ouvrier d\'abattoir', + 'Ouvrier serriste', + 'Ouvrier sidérurgiste', + 'Palefrenier', + 'Paléontologue', + 'Pareur en abattoir', + 'Parfumeur', + 'Parqueteur', + 'Percepteur', + 'Photographe d\'art', + 'Pilote automobile', + 'Pilote de soutireuse', + 'Pilote fluvial', + 'Piqueur en ganterie', + 'Pisteur secouriste', + 'Pizzaïolo', + 'Plaquiste enduiseur', + 'Plasticien', + 'Plisseur', + 'Poissonnier-traiteur', + 'Pontonnier', + 'Porion', + 'Porteur de hottes', + 'Porteur de journaux', + 'Portier', + 'Poseur de granit', + 'Posticheur spectacle', + 'Potier', + 'Praticien dentaire', + 'Praticiens médicaux', + 'Premier clerc', + 'Preneur de son', + 'Primeuriste', + 'Professeur d\'italien', + 'Projeteur béton armé', + 'Promotion des ventes', + 'Présentateur radio', + 'Pyrotechnicien', + 'Pédicure pour bovin', + 'Pédologue', + 'Pédopsychiatre', + 'Quincaillier', + 'Radio chargeur', + 'Ramasseur d\'asperges', + 'Ramasseur d\'endives', + 'Ravaleur-ragréeur', + 'Recherche', + 'Recuiseur', + 'Relieur-doreur', + 'Responsable de salle', + 'Responsable télécoms', + 'Revenue Manager', + 'Rippeur spectacle', + 'Rogneur', + 'Récupérateur', + 'Rédacteur des débats', + 'Régleur funéraire', + 'Régleur sur tour', + 'Sapeur-pompier', + 'Scannériste', + 'Scripte télévision', + 'Sculpteur sur verre', + 'Scénariste', + 'Second de cuisine', + 'Secrétaire juridique', + 'Semencier', + 'Sertisseur', + 'Services funéraires', + 'Solier-moquettiste', + 'Sommelier', + 'Sophrologue', + 'Staffeur', + 'Story boarder', + 'Stratifieur', + 'Stucateur', + 'Styliste graphiste', + 'Surjeteur-raseur', + 'Séismologue', + 'Technicien agricole', + 'Technicien bovin', + 'Technicien géomètre', + 'Technicien plateau', + 'Technicien énergie', + 'Terminologue', + 'Testeur informatique', + 'Toiliste', + 'Topographe', + 'Toréro', + 'Traducteur d\'édition', + 'Traffic manager', + 'Trieur de métaux', + 'Turbinier', + 'Téléconseiller', + 'Tôlier-traceur', + 'Vendeur carreau', + 'Vendeur en lingerie', + 'Vendeur en meubles', + 'Vendeur en épicerie', + 'Verrier d\'art', + 'Verrier à la calotte', + 'Verrier à la main', + 'Verrier à main levée', + 'Vidéo-jockey', + 'Vitrier', + ]; +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Internet.php new file mode 100644 index 00000000..679919da --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Internet.php @@ -0,0 +1,9 @@ +numberBetween(1, 2); + } + + $nir .= + // Year of birth (aa) + $this->numerify('##') . + // Mont of birth (mm) + sprintf('%02d', $this->numberBetween(1, 12)); + + // Department + $department = key(Address::department()); + $nir .= $department; + + // Town number, depends on department length + if (strlen($department) === 2) { + $nir .= $this->numerify('###'); + } elseif (strlen($department) === 3) { + $nir .= $this->numerify('##'); + } + + // Born number (depending of town and month of birth) + $nir .= $this->numerify('###'); + + /** + * The key for a given NIR is `97 - 97 % NIR` + * NIR has to be an integer, so we have to do a little replacment + * for departments 2A and 2B + */ + if ($department === '2A') { + $nirInteger = str_replace('2A', '19', $nir); + } elseif ($department === '2B') { + $nirInteger = str_replace('2B', '18', $nir); + } else { + $nirInteger = $nir; + } + $nir .= sprintf('%02d', 97 - $nirInteger % 97); + + // Format is x xx xx xx xxx xxx xx + if ($formatted) { + $nir = substr($nir, 0, 1) . ' ' . substr($nir, 1, 2) . ' ' . substr($nir, 3, 2) . ' ' . substr($nir, 5, 2) . ' ' . substr($nir, 7, 3) . ' ' . substr($nir, 10, 3) . ' ' . substr($nir, 13, 2); + } + + return $nir; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/PhoneNumber.php new file mode 100644 index 00000000..292c546f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/PhoneNumber.php @@ -0,0 +1,148 @@ +phoneNumber07WithSeparator(); + + return str_replace(' ', '', $phoneNumber); + } + + /** + * Only 073 to 079 are acceptable prefixes with 07 + * + * @see http://www.arcep.fr/index.php?id=8146 + */ + public function phoneNumber07WithSeparator() + { + $phoneNumber = $this->generator->numberBetween(3, 9); + $phoneNumber .= $this->numerify('# ## ## ##'); + + return $phoneNumber; + } + + public function phoneNumber08() + { + $phoneNumber = $this->phoneNumber08WithSeparator(); + + return str_replace(' ', '', $phoneNumber); + } + + /** + * Valid formats for 08: + * + * 0# ## ## ## + * 1# ## ## ## + * 2# ## ## ## + * 91 ## ## ## + * 92 ## ## ## + * 93 ## ## ## + * 97 ## ## ## + * 98 ## ## ## + * 99 ## ## ## + * + * Formats 089(4|6)## ## ## are valid, but will be + * attributed when other 089 resource ranges are exhausted. + * + * @see https://www.arcep.fr/index.php?id=8146#c9625 + * @see https://issuetracker.google.com/u/1/issues/73269839 + */ + public function phoneNumber08WithSeparator() + { + $regex = '([012]{1}\d{1}|(9[1-357-9])( \d{2}){3}'; + + return $this->regexify($regex); + } + + /** + * @example '0601020304' + */ + public function mobileNumber() + { + $format = static::randomElement(static::$mobileFormats); + + return static::numerify($this->generator->parse($format)); + } + + /** + * @example '0891951357' + */ + public function serviceNumber() + { + $format = static::randomElement(static::$serviceFormats); + + return static::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Text.php new file mode 100644 index 00000000..bcd3167a --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Text.php @@ -0,0 +1,15532 @@ + static::latitude(46.262740, 47.564721), + 'longitude' => static::longitude(17.077949, 20.604560), + ]; + } + + protected static $streetSuffix = [ + 'árok', 'átjáró', 'dűlősor', 'dűlőút', 'erdősor', 'fasor', 'forduló', 'gát', 'határsor', 'határút', 'híd', 'játszótér', 'kert', 'körönd', 'körtér', 'körút', 'köz', 'lakótelep', 'lejáró', 'lejtő', 'lépcső', 'liget', 'mélyút', 'orom', 'országút', 'ösvény', 'park', 'part', 'pincesor', 'rakpart', 'sétány', 'sétaút', 'sor', 'sugárút', 'tér', 'tere', 'turistaút', 'udvar', 'út', 'útja', 'utca', 'üdülőpart', + ]; + protected static $postcode = ['####']; + protected static $state = [ + 'Budapest', 'Bács-Kiskun', 'Baranya', 'Békés', 'Borsod-Abaúj-Zemplén', 'Csongrád', 'Fejér', 'Győr-Moson-Sopron', 'Hajdú-Bihar', 'Heves', 'Jász-Nagykun-Szolnok', 'Komárom-Esztergom', 'Nógrád', 'Pest', 'Somogy', 'Szabolcs-Szatmár-Bereg', 'Tolna', 'Vas', 'Veszprém', 'Zala', + ]; + protected static $country = [ + 'Afganisztán', 'Albánia', 'Algéria', 'Amerikai Egyesült Államok', 'Andorra', 'Angola', 'Antigua és Barbuda', 'Argentína', 'Ausztria', 'Ausztrália', 'Azerbajdzsán', + 'Bahama-szigetek', 'Bahrein', 'Banglades', 'Barbados', 'Belgium', 'Belize', 'Benin', 'Bhután', 'Bolívia', 'Bosznia-Hercegovina', 'Botswana', 'Brazília', 'Brunei', 'Bulgária', 'Burkina Faso', 'Burma', 'Burundi', + 'Chile', 'Ciprus', 'Costa Rica', 'Csehország', 'Csád', + 'Dominikai Köztársaság', 'Dominikai Közösség', 'Dzsibuti', 'Dánia', 'Dél-Afrika', 'Dél-Korea', 'Dél-Szudán', + 'Ecuador', 'Egyenlítői-Guinea', 'Egyesült Arab Emírségek', 'Egyesült Királyság', 'Egyiptom', 'Elefántcsontpart', 'Eritrea', 'Etiópia', + 'Fehéroroszország', 'Fidzsi-szigetek', 'Finnország', 'Franciaország', 'Fülöp-szigetek', + 'Gabon', 'Gambia', 'Ghána', 'Grenada', 'Grúzia', 'Guatemala', 'Guinea', 'Guyana', 'Görögország', + 'Haiti', 'Hollandia', 'Horvátország', + 'India', 'Indonézia', 'Irak', 'Irán', 'Izland', 'Izrael', + 'Japán', 'Jemen', 'Jordánia', + 'Kambodzsa', 'Kamerun', 'Kanada', 'Katar', 'Kazahsztán', 'Kelet-Timor', 'Kenya', 'Kirgizisztán', 'Kiribati', 'Kolumbia', 'Kongói Demokratikus Köztársaság', 'Kongói Köztársaság', 'Kuba', 'Kuvait', 'Kína', 'Közép-Afrika', + 'Laosz', 'Lengyelország', 'Lesotho', 'Lettország', 'Libanon', 'Libéria', 'Liechtenstein', 'Litvánia', 'Luxemburg', 'Líbia', + 'Macedónia', 'Madagaszkár', 'Magyarország', 'Malawi', 'Maldív-szigetek', 'Mali', 'Malájzia', 'Marokkó', 'Marshall-szigetek', 'Mauritánia', 'Mexikó', 'Mikronézia', 'Moldova', 'Monaco', 'Mongólia', 'Montenegró', 'Mozambik', 'Málta', + 'Namíbia', 'Nauru', 'Nepál', 'Nicaragua', 'Niger', 'Nigéria', 'Norvégia', 'Németország', + 'Olaszország', 'Omán', 'Oroszország', + 'Pakisztán', 'Palau', 'Panama', 'Paraguay', 'Peru', 'Portugália', 'Pápua Új-Guinea', + 'Románia', 'Ruanda', + 'Saint Kitts és Nevis', 'Saint Vincent', 'Salamon-szigetek', 'Salvador', 'San Marino', 'Seychelle-szigetek', 'Spanyolország', 'Srí Lanka', 'Suriname', 'Svájc', 'Svédország', 'Szamoa', 'Szaúd-Arábia', 'Szenegál', 'Szerbia', 'Szingapúr', 'Szlovákia', 'Szlovénia', 'Szomália', 'Szudán', 'Szváziföld', 'Szíria', 'São Tomé és Príncipe', + 'Tadzsikisztán', 'Tanzánia', 'Thaiföld', 'Togo', 'Tonga', 'Trinidad és Tobago', 'Tunézia', 'Tuvalu', 'Törökország', 'Türkmenisztán', + 'Uganda', 'Ukrajna', 'Uruguay', + 'Vanuatu', 'Venezuela', 'Vietnám', + 'Zambia', 'Zimbabwe', 'Zöld-foki-szigetek', + 'Észak-Korea', 'Észtország', 'Írország', 'Örményország', 'Új-Zéland', 'Üzbegisztán', + ]; + + /** + * Source: https://hu.wikipedia.org/wiki/Magyarorsz%C3%A1g_v%C3%A1rosainak_list%C3%A1ja + */ + protected static $capitals = ['Budapest']; + protected static $bigCities = [ + 'Békéscsaba', 'Debrecen', 'Dunaújváros', 'Eger', 'Érd', 'Győr', 'Hódmezővásárhely', 'Kaposvár', 'Kecskemét', 'Miskolc', 'Nagykanizsa', 'Nyíregyháza', 'Pécs', 'Salgótarján', 'Sopron', 'Szeged', 'Székesfehérvár', 'Szekszárd', 'Szolnok', 'Szombathely', 'Tatabánya', 'Veszprém', 'Zalaegerszeg', + ]; + protected static $smallerCities = [ + 'Ajka', 'Aszód', 'Bácsalmás', + 'Baja', 'Baktalórántháza', 'Balassagyarmat', 'Balatonalmádi', 'Balatonfüred', 'Balmazújváros', 'Barcs', 'Bátonyterenye', 'Békés', 'Bélapátfalva', 'Berettyóújfalu', 'Bicske', 'Bóly', 'Bonyhád', 'Budakeszi', + 'Cegléd', 'Celldömölk', 'Cigánd', 'Csenger', 'Csongrád', 'Csorna', 'Csurgó', + 'Dabas', 'Derecske', 'Devecser', 'Dombóvár', 'Dunakeszi', + 'Edelény', 'Encs', 'Enying', 'Esztergom', + 'Fehérgyarmat', 'Fonyód', 'Füzesabony', + 'Gárdony', 'Gödöllő', 'Gönc', 'Gyál', 'Gyomaendrőd', 'Gyöngyös', 'Gyula', + 'Hajdúböszörmény', 'Hajdúhadház', 'Hajdúnánás', 'Hajdúszoboszló', 'Hatvan', 'Heves', + 'Ibrány', + 'Jánoshalma', 'Jászapáti', 'Jászberény', + 'Kalocsa', 'Kapuvár', 'Karcag', 'Kazincbarcika', 'Kemecse', 'Keszthely', 'Kisbér', 'Kiskőrös', 'Kiskunfélegyháza', 'Kiskunhalas', 'Kiskunmajsa', 'Kistelek', 'Kisvárda', 'Komárom', 'Komló', 'Körmend', 'Kőszeg', 'Kunhegyes', 'Kunszentmárton', 'Kunszentmiklós', + 'Lenti', 'Letenye', + 'Makó', 'Marcali', 'Martonvásár', 'Mátészalka', 'Mezőcsát', 'Mezőkovácsháza', 'Mezőkövesd', 'Mezőtúr', 'Mohács', 'Monor', 'Mór', 'Mórahalom', 'Mosonmagyaróvár', + 'Nagyatád', 'Nagykálló', 'Nagykáta', 'Nagykőrös', 'Nyíradony', 'Nyírbátor', + 'Orosháza', 'Oroszlány', 'Ózd', + 'Paks', 'Pannonhalma', 'Pápa', 'Pásztó', 'Pécsvárad', 'Pétervására', 'Pilisvörösvár', 'Polgárdi', 'Püspökladány', 'Putnok', + 'Ráckeve', 'Rétság', + 'Sárbogárd', 'Sarkad', 'Sárospatak', 'Sárvár', 'Sásd', 'Sátoraljaújhely', 'Sellye', 'Siklós', 'Siófok', 'Sümeg', 'Szarvas', 'Szécsény', 'Szeghalom', 'Szentendre', 'Szentes', 'Szentgotthárd', 'Szentlőrinc', 'Szerencs', 'Szigetszentmiklós', 'Szigetvár', 'Szikszó', 'Szob', + 'Tab', 'Tamási', 'Tapolca', 'Tata', 'Tét', 'Tiszafüred', 'Tiszakécske', 'Tiszaújváros', 'Tiszavasvári', 'Tokaj', 'Tolna', 'Törökszentmiklós', + 'Vác', 'Várpalota', 'Vásárosnamény', 'Vasvár', 'Vecsés', + 'Záhony', 'Zalaszentgrót', 'Zirc', + ]; +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/hu_HU/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/hu_HU/Company.php new file mode 100644 index 00000000..ccda8aac --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/hu_HU/Company.php @@ -0,0 +1,13 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/hy_AM/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/hy_AM/Color.php new file mode 100644 index 00000000..ebdda0da --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/hy_AM/Color.php @@ -0,0 +1,12 @@ +generator->parse(static::randomElement(static::$formats))); + } + + public function code() + { + return static::randomElement(static::$codes); + } + + public function numberFormat() + { + return static::randomElement(static::$numberFormats); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/id_ID/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/id_ID/Address.php new file mode 100644 index 00000000..1fb2270a --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/id_ID/Address.php @@ -0,0 +1,318 @@ +generator->parse($format); + } + + public static function street() + { + return static::randomElement(static::$street); + } + + public static function buildingNumber() + { + return (string) self::numberBetween(1, 999); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/id_ID/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/id_ID/Color.php new file mode 100644 index 00000000..14995b62 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/id_ID/Color.php @@ -0,0 +1,40 @@ +generator->parse($lastNameRandomElement); + } + + /** + * Return last name for male + * + * @return string last name + */ + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + /** + * Return last name for female + * + * @return string last name + */ + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + /** + * For academic title + * + * @return string suffix + */ + public static function suffix() + { + return static::randomElement(static::$suffix); + } + + /** + * Generates Nomor Induk Kependudukan (NIK) + * + * @see https://en.wikipedia.org/wiki/National_identification_number#Indonesia + * + * @param string|null $gender + * @param \DateTime|null $birthDate + * + * @return string + */ + public function nik($gender = null, $birthDate = null) + { + // generate first numbers (region data) + $nik = $this->birthPlaceCode(); + $nik .= $this->generator->numerify('##'); + + if (!$birthDate) { + $birthDate = $this->generator->dateTimeBetween(); + } + + if (!$gender) { + $gender = $this->generator->randomElement([self::GENDER_MALE, self::GENDER_FEMALE]); + } + + // if gender is female, add 40 to days + if ($gender == self::GENDER_FEMALE) { + $nik .= $birthDate->format('d') + 40; + } else { + $nik .= $birthDate->format('d'); + } + + $nik .= $birthDate->format('my'); + + // add last random digits + $nik .= $this->generator->numerify('####'); + + return $nik; + } + + /** + * Generates birth place code for NIK + * + * @see https://id.wikipedia.org/wiki/Nomor_Induk_Kependudukan + * @see http://informasipedia.com/wilayah-indonesia/daftar-kabupaten-kota-di-indonesia/ + */ + protected function birthPlaceCode() + { + return static::randomElement(static::$birthPlaceCode); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/id_ID/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/id_ID/PhoneNumber.php new file mode 100644 index 00000000..c0bfaf5b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/id_ID/PhoneNumber.php @@ -0,0 +1,55 @@ + Icelandic names for women. + */ + protected static $firstNameFemale = ['Aagot', 'Abela', 'Abigael', 'Ada', 'Adda', 'Addý', 'Adela', 'Adelía', 'Adríana', 'Aðalbjörg', 'Aðalbjört', 'Aðalborg', 'Aðaldís', 'Aðalfríður', 'Aðalheiður', 'Aðalrós', 'Aðalsteina', 'Aðalsteinunn', 'Aðalveig', 'Agata', 'Agatha', 'Agða', 'Agla', 'Agnea', 'Agnes', 'Agneta', 'Alanta', 'Alba', 'Alberta', 'Albína', 'Alda', 'Aldís', 'Aldný', 'Aleta', 'Aletta', 'Alexa', 'Alexandra', 'Alexandría', 'Alexis', 'Alexía', 'Alfa', 'Alfífa', 'Alice', 'Alida', 'Alída', 'Alína', 'Alís', 'Alísa', 'Alla', 'Allý', 'Alma', 'Alrún', 'Alva', 'Alvilda', 'Amadea', 'Amal', 'Amalía', 'Amanda', 'Amelía', 'Amilía', 'Amíra', 'Amy', 'Amý', 'Analía', 'Anastasía', 'Andra', 'Andrá', 'Andrea', 'Anetta', 'Angela', 'Angelíka', 'Anika', 'Anita', 'Aníka', 'Anína', 'Aníta', 'Anja', 'Ann', 'Anna', 'Annabella', 'Annalísa', 'Anne', 'Annelí', 'Annetta', 'Anney', 'Annika', 'Annía', 'Anný', 'Antonía', 'Apríl', 'Ardís', 'Arey', 'Arinbjörg', 'Aris', 'Arisa', 'Aría', 'Aríanna', 'Aríella', 'Arín', 'Arína', 'Arís', 'Armenía', 'Arna', 'Arnbjörg', 'Arnborg', 'Arndís', 'Arney', 'Arnfinna', 'Arnfríður', 'Arngerður', 'Arngunnur', 'Arnheiður', 'Arnhildur', 'Arnika', 'Arnkatla', 'Arnlaug', 'Arnleif', 'Arnlín', 'Arnljót', 'Arnóra', 'Arnrós', 'Arnrún', 'Arnþóra', 'Arnþrúður', 'Asírí', 'Askja', 'Assa', 'Astrid', 'Atalía', 'Atena', 'Athena', 'Atla', 'Atlanta', 'Auðbjörg', 'Auðbjört', 'Auðdís', 'Auðlín', 'Auðna', 'Auðný', 'Auðrún', 'Auður', 'Aurora', 'Axelía', 'Axelma', 'Aþena', 'Ágústa', 'Ágústína', 'Álfdís', 'Álfey', 'Álfgerður', 'Álfheiður', 'Álfhildur', 'Álfrós', 'Álfrún', 'Álfsól', 'Árbjörg', 'Árbjört', 'Árdís', 'Árelía', 'Árlaug', 'Ármey', 'Árna', 'Árndís', 'Árney', 'Árnheiður', 'Árnína', 'Árný', 'Áróra', 'Ársól', 'Ársæl', 'Árún', 'Árveig', 'Árvök', 'Árþóra', 'Ása', 'Ásbjörg', 'Ásborg', 'Ásdís', 'Ásfríður', 'Ásgerður', 'Áshildur', 'Áskatla', 'Ásla', 'Áslaug', 'Ásleif', 'Ásný', 'Ásrós', 'Ásrún', 'Ást', 'Ásta', 'Ástbjörg', 'Ástbjört', 'Ástdís', 'Ástfríður', 'Ástgerður', 'Ástheiður', 'Ásthildur', 'Ástríður', 'Ástrós', 'Ástrún', 'Ástveig', 'Ástþóra', 'Ástþrúður', 'Ásvör', 'Baldey', 'Baldrún', 'Baldvina', 'Barbara', 'Barbára', 'Bassí', 'Bára', 'Bebba', 'Begga', 'Belinda', 'Bella', 'Benedikta', 'Bengta', 'Benidikta', 'Benía', 'Beníta', 'Benna', 'Benney', 'Benný', 'Benta', 'Bentey', 'Bentína', 'Bera', 'Bergdís', 'Bergey', 'Bergfríður', 'Bergheiður', 'Berghildur', 'Berglaug', 'Berglind', 'Berglín', 'Bergljót', 'Bergmannía', 'Bergný', 'Bergrán', 'Bergrín', 'Bergrós', 'Bergrún', 'Bergþóra', 'Berit', 'Bernódía', 'Berta', 'Bertha', 'Bessí', 'Bestla', 'Beta', 'Betanía', 'Betsý', 'Bettý', 'Bil', 'Birgit', 'Birgitta', 'Birna', 'Birta', 'Birtna', 'Bíbí', 'Bína', 'Bjargdís', 'Bjargey', 'Bjargheiður', 'Bjarghildur', 'Bjarglind', 'Bjarkey', 'Bjarklind', 'Bjarma', 'Bjarndís', 'Bjarney', 'Bjarnfríður', 'Bjarngerður', 'Bjarnheiður', 'Bjarnhildur', 'Bjarnlaug', 'Bjarnrún', 'Bjarnveig', 'Bjarný', 'Bjarnþóra', 'Bjarnþrúður', 'Bjartey', 'Bjartmey', 'Björg', 'Björgey', 'Björgheiður', 'Björghildur', 'Björk', 'Björney', 'Björnfríður', 'Björt', 'Bláey', 'Blíða', 'Blín', 'Blómey', 'Blædís', 'Blær', 'Bobba', 'Boga', 'Bogdís', 'Bogey', 'Bogga', 'Boghildur', 'Borg', 'Borgdís', 'Borghildur', 'Borgný', 'Borgrún', 'Borgþóra', 'Botnía', 'Bóel', 'Bót', 'Bóthildur', 'Braga', 'Braghildur', 'Branddís', 'Brá', 'Brák', 'Brigitta', 'Brimdís', 'Brimhildur', 'Brimrún', 'Brit', 'Britt', 'Britta', 'Bríana', 'Bríanna', 'Bríet', 'Bryndís', 'Brynfríður', 'Bryngerður', 'Brynheiður', 'Brynhildur', 'Brynja', 'Brynný', 'Burkney', 'Bylgja', 'Camilla', 'Carla', 'Carmen', 'Cecilia', 'Cecilía', 'Charlotta', 'Charlotte', 'Christina', 'Christine', 'Clara', 'Daðey', 'Daðína', 'Dagbjörg', 'Dagbjört', 'Dagfríður', 'Daggrós', 'Dagheiður', 'Dagmar', 'Dagmey', 'Dagný', 'Dagrún', 'Daldís', 'Daley', 'Dalía', 'Dalla', 'Dallilja', 'Dalrós', 'Dana', 'Daney', 'Danfríður', 'Danheiður', 'Danhildur', 'Danía', 'Daníela', 'Daníella', 'Dara', 'Debora', 'Debóra', 'Dendý', 'Didda', 'Dilja', 'Diljá', 'Dimmblá', 'Dimmey', 'Día', 'Díana', 'Díanna', 'Díma', 'Dís', 'Dísa', 'Dísella', 'Donna', 'Doris', 'Dorothea', 'Dóa', 'Dómhildur', 'Dóra', 'Dórey', 'Dóris', 'Dórothea', 'Dórótea', 'Dóróthea', 'Drauma', 'Draumey', 'Drífa', 'Droplaug', 'Drótt', 'Dröfn', 'Dúa', 'Dúfa', 'Dúna', 'Dýrborg', 'Dýrfinna', 'Dýrleif', 'Dýrley', 'Dýrunn', 'Dæja', 'Dögg', 'Dögun', 'Ebba', 'Ebonney', 'Edda', 'Edel', 'Edil', 'Edit', 'Edith', 'Eðna', 'Efemía', 'Egedía', 'Eggrún', 'Egla', 'Eiðný', 'Eiðunn', 'Eik', 'Einbjörg', 'Eindís', 'Einey', 'Einfríður', 'Einhildur', 'Einína', 'Einrún', 'Eir', 'Eirdís', 'Eirfinna', 'Eiríka', 'Eirný', 'Eirún', 'Elba', 'Eldbjörg', 'Eldey', 'Eldlilja', 'Eldrún', 'Eleina', 'Elektra', 'Elena', 'Elenborg', 'Elfa', 'Elfur', 'Elina', 'Elinborg', 'Elisabeth', 'Elía', 'Elíana', 'Elín', 'Elína', 'Elíná', 'Elínbet', 'Elínbjörg', 'Elínbjört', 'Elínborg', 'Elíndís', 'Elíngunnur', 'Elínheiður', 'Elínrós', 'Elírós', 'Elísa', 'Elísabet', 'Elísabeth', 'Elka', 'Ella', 'Ellen', 'Elley', 'Ellisif', 'Ellín', 'Elly', 'Ellý', 'Elma', 'Elna', 'Elsa', 'Elsabet', 'Elsie', 'Elsí', 'Elsý', 'Elva', 'Elvi', 'Elvíra', 'Elvý', 'Embla', 'Emelía', 'Emelíana', 'Emelína', 'Emeralda', 'Emilía', 'Emilíana', 'Emilíanna', 'Emilý', 'Emma', 'Emmý', 'Emý', 'Enea', 'Eneka', 'Engilbjört', 'Engilráð', 'Engilrós', 'Engla', 'Enika', 'Enja', 'Enóla', 'Eres', 'Erika', 'Erin', 'Erla', 'Erlen', 'Erlín', 'Erna', 'Esja', 'Esmeralda', 'Ester', 'Esther', 'Estiva', 'Ethel', 'Etna', 'Eufemía', 'Eva', 'Evelyn', 'Evey', 'Evfemía', 'Evgenía', 'Evíta', 'Evlalía', 'Ey', 'Eybjörg', 'Eybjört', 'Eydís', 'Eyfríður', 'Eygerður', 'Eygló', 'Eyhildur', 'Eyja', 'Eyjalín', 'Eyleif', 'Eylín', 'Eyrós', 'Eyrún', 'Eyveig', 'Eyvör', 'Eyþóra', 'Eyþrúður', 'Fanndís', 'Fanney', 'Fannlaug', 'Fanny', 'Fanný', 'Febrún', 'Fema', 'Filipía', 'Filippa', 'Filippía', 'Finna', 'Finnbjörg', 'Finnbjörk', 'Finnboga', 'Finnborg', 'Finndís', 'Finney', 'Finnfríður', 'Finnlaug', 'Finnrós', 'Fía', 'Fídes', 'Fífa', 'Fjalldís', 'Fjóla', 'Flóra', 'Folda', 'Fransiska', 'Franziska', 'Frán', 'Fregn', 'Freydís', 'Freygerður', 'Freyja', 'Freylaug', 'Freyleif', 'Friðbjörg', 'Friðbjört', 'Friðborg', 'Friðdís', 'Friðdóra', 'Friðey', 'Friðfinna', 'Friðgerður', 'Friðjóna', 'Friðlaug', 'Friðleif', 'Friðlín', 'Friðmey', 'Friðný', 'Friðrika', 'Friðrikka', 'Friðrós', 'Friðrún', 'Friðsemd', 'Friðveig', 'Friðþóra', 'Frigg', 'Fríða', 'Fríður', 'Frostrós', 'Fróðný', 'Fura', 'Fönn', 'Gabríela', 'Gabríella', 'Gauja', 'Gauthildur', 'Gefjun', 'Gefn', 'Geira', 'Geirbjörg', 'Geirdís', 'Geirfinna', 'Geirfríður', 'Geirhildur', 'Geirlaug', 'Geirlöð', 'Geirný', 'Geirríður', 'Geirrún', 'Geirþrúður', 'Georgía', 'Gerða', 'Gerður', 'Gestheiður', 'Gestný', 'Gestrún', 'Gillý', 'Gilslaug', 'Gissunn', 'Gía', 'Gígja', 'Gísela', 'Gísla', 'Gísley', 'Gíslína', 'Gíslný', 'Gíslrún', 'Gíslunn', 'Gíta', 'Gjaflaug', 'Gloría', 'Gló', 'Glóa', 'Glóbjört', 'Glódís', 'Glóð', 'Glóey', 'Gná', 'Góa', 'Gógó', 'Grein', 'Gret', 'Greta', 'Grélöð', 'Grét', 'Gréta', 'Gríma', 'Grímey', 'Grímheiður', 'Grímhildur', 'Gróa', 'Guðbjörg', 'Guðbjört', 'Guðborg', 'Guðdís', 'Guðfinna', 'Guðfríður', 'Guðjóna', 'Guðlaug', 'Guðleif', 'Guðlín', 'Guðmey', 'Guðmunda', 'Guðmundína', 'Guðný', 'Guðríður', 'Guðrún', 'Guðsteina', 'Guðveig', 'Gullbrá', 'Gullveig', 'Gullý', 'Gumma', 'Gunnbjörg', 'Gunnbjört', 'Gunnborg', 'Gunndís', 'Gunndóra', 'Gunnella', 'Gunnfinna', 'Gunnfríður', 'Gunnharða', 'Gunnheiður', 'Gunnhildur', 'Gunnjóna', 'Gunnlaug', 'Gunnleif', 'Gunnlöð', 'Gunnrún', 'Gunnur', 'Gunnveig', 'Gunnvör', 'Gunný', 'Gunnþóra', 'Gunnþórunn', 'Gurrý', 'Gúa', 'Gyða', 'Gyðja', 'Gyðríður', 'Gytta', 'Gæfa', 'Gæflaug', 'Hadda', 'Haddý', 'Hafbjörg', 'Hafborg', 'Hafdís', 'Hafey', 'Hafliða', 'Haflína', 'Hafný', 'Hafrós', 'Hafrún', 'Hafsteina', 'Hafþóra', 'Halla', 'Hallbera', 'Hallbjörg', 'Hallborg', 'Halldís', 'Halldóra', 'Halley', 'Hallfríður', 'Hallgerður', 'Hallgunnur', 'Hallkatla', 'Hallný', 'Hallrún', 'Hallveig', 'Hallvör', 'Hanna', 'Hanney', 'Hansa', 'Hansína', 'Harpa', 'Hauður', 'Hákonía', 'Heba', 'Hedda', 'Hedí', 'Heiða', 'Heiðbjörg', 'Heiðbjörk', 'Heiðbjört', 'Heiðbrá', 'Heiðdís', 'Heiðlaug', 'Heiðlóa', 'Heiðný', 'Heiðrós', 'Heiðrún', 'Heiður', 'Heiðveig', 'Hekla', 'Helen', 'Helena', 'Helga', 'Hella', 'Helma', 'Hendrikka', 'Henný', 'Henrietta', 'Henrika', 'Henríetta', 'Hera', 'Herbjörg', 'Herbjört', 'Herborg', 'Herdís', 'Herfríður', 'Hergerður', 'Herlaug', 'Hermína', 'Hersilía', 'Herta', 'Hertha', 'Hervör', 'Herþrúður', 'Hilda', 'Hildegard', 'Hildibjörg', 'Hildigerður', 'Hildigunnur', 'Hildiríður', 'Hildisif', 'Hildur', 'Hilma', 'Himinbjörg', 'Hind', 'Hinrika', 'Hinrikka', 'Hjalta', 'Hjaltey', 'Hjálmdís', 'Hjálmey', 'Hjálmfríður', 'Hjálmgerður', 'Hjálmrós', 'Hjálmrún', 'Hjálmveig', 'Hjördís', 'Hjörfríður', 'Hjörleif', 'Hjörný', 'Hjörtfríður', 'Hlaðgerður', 'Hlédís', 'Hlíf', 'Hlín', 'Hlökk', 'Hólmbjörg', 'Hólmdís', 'Hólmfríður', 'Hrafna', 'Hrafnborg', 'Hrafndís', 'Hrafney', 'Hrafngerður', 'Hrafnheiður', 'Hrafnhildur', 'Hrafnkatla', 'Hrafnlaug', 'Hrafntinna', 'Hraundís', 'Hrefna', 'Hreindís', 'Hróðný', 'Hrólfdís', 'Hrund', 'Hrönn', 'Hugbjörg', 'Hugbjört', 'Hugborg', 'Hugdís', 'Hugljúf', 'Hugrún', 'Huld', 'Hulda', 'Huldís', 'Huldrún', 'Húnbjörg', 'Húndís', 'Húngerður', 'Hvönn', 'Hödd', 'Högna', 'Hörn', 'Ida', 'Idda', 'Iða', 'Iðunn', 'Ilmur', 'Immý', 'Ina', 'Inda', 'India', 'Indiana', 'Indía', 'Indíana', 'Indíra', 'Indra', 'Inga', 'Ingdís', 'Ingeborg', 'Inger', 'Ingey', 'Ingheiður', 'Inghildur', 'Ingibjörg', 'Ingibjört', 'Ingiborg', 'Ingifinna', 'Ingifríður', 'Ingigerður', 'Ingilaug', 'Ingileif', 'Ingilín', 'Ingimaría', 'Ingimunda', 'Ingiríður', 'Ingirós', 'Ingisól', 'Ingiveig', 'Ingrid', 'Ingrún', 'Ingunn', 'Ingveldur', 'Inna', 'Irena', 'Irene', 'Irja', 'Irma', 'Irmý', 'Irpa', 'Isabel', 'Isabella', 'Ída', 'Íma', 'Ína', 'Ír', 'Íren', 'Írena', 'Íris', 'Írunn', 'Ísabel', 'Ísabella', 'Ísadóra', 'Ísafold', 'Ísalind', 'Ísbjörg', 'Ísdís', 'Ísey', 'Ísfold', 'Ísgerður', 'Íshildur', 'Ísis', 'Íslaug', 'Ísleif', 'Ísmey', 'Ísold', 'Ísól', 'Ísrún', 'Íssól', 'Ísveig', 'Íunn', 'Íva', 'Jakobína', 'Jana', 'Jane', 'Janetta', 'Jannika', 'Jara', 'Jarún', 'Jarþrúður', 'Jasmín', 'Járnbrá', 'Járngerður', 'Jenetta', 'Jenna', 'Jenný', 'Jensína', 'Jessý', 'Jovina', 'Jóa', 'Jóanna', 'Jódís', 'Jófríður', 'Jóhanna', 'Jólín', 'Jóna', 'Jónanna', 'Jónasína', 'Jónbjörg', 'Jónbjört', 'Jóndís', 'Jóndóra', 'Jóney', 'Jónfríður', 'Jóngerð', 'Jónheiður', 'Jónhildur', 'Jóninna', 'Jónída', 'Jónína', 'Jónný', 'Jóný', 'Jóra', 'Jóríður', 'Jórlaug', 'Jórunn', 'Jósebína', 'Jósefín', 'Jósefína', 'Judith', 'Júdea', 'Júdit', 'Júlía', 'Júlíana', 'Júlíanna', 'Júlíetta', 'Júlírós', 'Júnía', 'Júníana', 'Jökla', 'Jökulrós', 'Jörgína', 'Kaðlín', 'Kaja', 'Kalla', 'Kamilla', 'Kamí', 'Kamma', 'Kapitola', 'Kapítóla', 'Kara', 'Karen', 'Karin', 'Karitas', 'Karí', 'Karín', 'Karína', 'Karítas', 'Karla', 'Karlinna', 'Karlína', 'Karlotta', 'Karolína', 'Karó', 'Karólín', 'Karólína', 'Kassandra', 'Kata', 'Katarína', 'Katerína', 'Katharina', 'Kathinka', 'Katinka', 'Katla', 'Katrín', 'Katrína', 'Katý', 'Kára', 'Kellý', 'Kendra', 'Ketilbjörg', 'Ketilfríður', 'Ketilríður', 'Kiddý', 'Kira', 'Kirsten', 'Kirstín', 'Kittý', 'Kjalvör', 'Klara', 'Kládía', 'Klementína', 'Kleópatra', 'Kolbjörg', 'Kolbrá', 'Kolbrún', 'Koldís', 'Kolfinna', 'Kolfreyja', 'Kolgríma', 'Kolka', 'Konkordía', 'Konný', 'Korka', 'Kormlöð', 'Kornelía', 'Kókó', 'Krista', 'Kristbjörg', 'Kristborg', 'Kristel', 'Kristensa', 'Kristey', 'Kristfríður', 'Kristgerður', 'Kristin', 'Kristine', 'Kristíana', 'Kristíanna', 'Kristín', 'Kristína', 'Kristjana', 'Kristjóna', 'Kristlaug', 'Kristlind', 'Kristlín', 'Kristný', 'Kristólína', 'Kristrós', 'Kristrún', 'Kristveig', 'Kristvina', 'Kristþóra', 'Kría', 'Kæja', 'Laila', 'Laíla', 'Lana', 'Lara', 'Laufey', 'Laufheiður', 'Laufhildur', 'Lauga', 'Laugey', 'Laugheiður', 'Lára', 'Lárensína', 'Láretta', 'Lárey', 'Lea', 'Leikný', 'Leila', 'Lena', 'Leonóra', 'Leóna', 'Leónóra', 'Lilja', 'Liljá', 'Liljurós', 'Lill', 'Lilla', 'Lillian', 'Lillý', 'Lily', 'Lilý', 'Lind', 'Linda', 'Linddís', 'Lingný', 'Lisbeth', 'Listalín', 'Liv', 'Líba', 'Líf', 'Lífdís', 'Lín', 'Lína', 'Línbjörg', 'Líndís', 'Líneik', 'Líney', 'Línhildur', 'Lísa', 'Lísabet', 'Lísandra', 'Lísbet', 'Lísebet', 'Lív', 'Ljósbjörg', 'Ljósbrá', 'Ljótunn', 'Lofn', 'Loftveig', 'Logey', 'Lokbrá', 'Lotta', 'Louisa', 'Lousie', 'Lovísa', 'Lóa', 'Lóreley', 'Lukka', 'Lúcía', 'Lúðvíka', 'Lúísa', 'Lúna', 'Lúsinda', 'Lúsía', 'Lúvísa', 'Lydia', 'Lydía', 'Lyngheiður', 'Lýdía', 'Læla', 'Maddý', 'Magda', 'Magdalena', 'Magðalena', 'Magga', 'Maggey', 'Maggý', 'Magna', 'Magndís', 'Magnea', 'Magnes', 'Magney', 'Magnfríður', 'Magnheiður', 'Magnhildur', 'Magnúsína', 'Magný', 'Magnþóra', 'Maía', 'Maídís', 'Maísól', 'Maj', 'Maja', 'Malen', 'Malena', 'Malía', 'Malín', 'Malla', 'Manda', 'Manúela', 'Mara', 'Mardís', 'Marela', 'Marella', 'Maren', 'Marey', 'Marfríður', 'Margit', 'Margot', 'Margret', 'Margrét', 'Margrjet', 'Margunnur', 'Marheiður', 'Maria', 'Marie', 'Marikó', 'Marinella', 'Marit', 'Marí', 'María', 'Maríam', 'Marían', 'Maríana', 'Maríanna', 'Marín', 'Marína', 'Marínella', 'Maríon', 'Marísa', 'Marísól', 'Marít', 'Maríuerla', 'Marja', 'Markrún', 'Marlaug', 'Marlena', 'Marlín', 'Marlís', 'Marólína', 'Marsa', 'Marselía', 'Marselína', 'Marsibil', 'Marsilía', 'Marsý', 'Marta', 'Martha', 'Martína', 'Mary', 'Marý', 'Matta', 'Mattea', 'Matthea', 'Matthilda', 'Matthildur', 'Matthía', 'Mattíana', 'Mattína', 'Mattý', 'Maxima', 'Mábil', 'Málfríður', 'Málhildur', 'Málmfríður', 'Mánadís', 'Máney', 'Mára', 'Meda', 'Mekkin', 'Mekkín', 'Melinda', 'Melissa', 'Melkorka', 'Melrós', 'Messíana', 'Metta', 'Mey', 'Mikaela', 'Mikaelína', 'Mikkalína', 'Milda', 'Mildríður', 'Milla', 'Millý', 'Minerva', 'Minna', 'Minney', 'Minný', 'Miriam', 'Mirja', 'Mirjam', 'Mirra', 'Mist', 'Mía', 'Mínerva', 'Míra', 'Míranda', 'Mítra', 'Mjaðveig', 'Mjalldís', 'Mjallhvít', 'Mjöll', 'Mona', 'Monika', 'Módís', 'Móeiður', 'Móey', 'Móheiður', 'Móna', 'Mónika', 'Móníka', 'Munda', 'Mundheiður', 'Mundhildur', 'Mundína', 'Myrra', 'Mýr', 'Mýra', 'Mýrún', 'Mörk', 'Nadia', 'Nadía', 'Nadja', 'Nana', 'Nanna', 'Nanný', 'Nansý', 'Naomí', 'Naómí', 'Natalie', 'Natalía', 'Náttsól', 'Nella', 'Nellý', 'Nenna', 'Nicole', 'Niðbjörg', 'Nikíta', 'Nikoletta', 'Nikólína', 'Ninja', 'Ninna', 'Nína', 'Níní', 'Njála', 'Njóla', 'Norma', 'Nóa', 'Nóra', 'Nótt', 'Nýbjörg', 'Odda', 'Oddbjörg', 'Oddfreyja', 'Oddfríður', 'Oddgerður', 'Oddhildur', 'Oddlaug', 'Oddleif', 'Oddný', 'Oddrún', 'Oddveig', 'Oddvör', 'Oktavía', 'Októvía', 'Olga', 'Ollý', 'Ora', 'Orka', 'Ormheiður', 'Ormhildur', 'Otkatla', 'Otta', 'Óda', 'Ófelía', 'Óla', 'Ólafía', 'Ólafína', 'Ólavía', 'Ólivía', 'Ólína', 'Ólöf', 'Ósa', 'Ósk', 'Ótta', 'Pamela', 'París', 'Patricia', 'Patrisía', 'Pála', 'Páldís', 'Páley', 'Pálfríður', 'Pálhanna', 'Pálheiður', 'Pálhildur', 'Pálín', 'Pálína', 'Pálmey', 'Pálmfríður', 'Pálrún', 'Perla', 'Peta', 'Petra', 'Petrea', 'Petrína', 'Petronella', 'Petrónella', 'Petrós', 'Petrún', 'Petrúnella', 'Pétrína', 'Pétrún', 'Pía', 'Polly', 'Pollý', 'Pría', 'Rafney', 'Rafnhildur', 'Ragna', 'Ragnbjörg', 'Ragney', 'Ragnfríður', 'Ragnheiður', 'Ragnhildur', 'Rakel', 'Ramóna', 'Randalín', 'Randíður', 'Randý', 'Ranka', 'Rannva', 'Rannveig', 'Ráðhildur', 'Rán', 'Rebekka', 'Reginbjörg', 'Regína', 'Rein', 'Renata', 'Reyn', 'Reyndís', 'Reynheiður', 'Reynhildur', 'Rikka', 'Ripley', 'Rita', 'Ríkey', 'Rín', 'Ríta', 'Ronja', 'Rorí', 'Roxanna', 'Róberta', 'Róbjörg', 'Rós', 'Rósa', 'Rósalind', 'Rósanna', 'Rósbjörg', 'Rósborg', 'Róselía', 'Rósey', 'Rósfríður', 'Róshildur', 'Rósinkara', 'Rósinkransa', 'Róska', 'Róslaug', 'Róslind', 'Róslinda', 'Róslín', 'Rósmary', 'Rósmarý', 'Rósmunda', 'Rósný', 'Runný', 'Rut', 'Ruth', 'Rúbý', 'Rún', 'Rúna', 'Rúndís', 'Rúnhildur', 'Rúrí', 'Röfn', 'Rögn', 'Röskva', 'Sabína', 'Sabrína', 'Saga', 'Salbjörg', 'Saldís', 'Salgerður', 'Salín', 'Salína', 'Salka', 'Salma', 'Salný', 'Salome', 'Salóme', 'Salvör', 'Sandra', 'Sanna', 'Santía', 'Sara', 'Sarína', 'Sefanía', 'Selja', 'Selka', 'Selma', 'Senía', 'Septíma', 'Sera', 'Serena', 'Seselía', 'Sesilía', 'Sesselía', 'Sesselja', 'Sessilía', 'Sif', 'Sigdís', 'Sigdóra', 'Sigfríð', 'Sigfríður', 'Sigga', 'Siggerður', 'Sigmunda', 'Signa', 'Signhildur', 'Signý', 'Sigríður', 'Sigrún', 'Sigurást', 'Sigurásta', 'Sigurbára', 'Sigurbirna', 'Sigurbjörg', 'Sigurbjört', 'Sigurborg', 'Sigurdís', 'Sigurdóra', 'Sigurdríf', 'Sigurdrífa', 'Sigurða', 'Sigurey', 'Sigurfinna', 'Sigurfljóð', 'Sigurgeira', 'Sigurhanna', 'Sigurhelga', 'Sigurhildur', 'Sigurjóna', 'Sigurlaug', 'Sigurleif', 'Sigurlilja', 'Sigurlinn', 'Sigurlín', 'Sigurlína', 'Sigurmunda', 'Sigurnanna', 'Sigurósk', 'Sigurrós', 'Sigursteina', 'Sigurunn', 'Sigurveig', 'Sigurvina', 'Sigurþóra', 'Sigyn', 'Sigþóra', 'Sigþrúður', 'Silfa', 'Silfá', 'Silfrún', 'Silja', 'Silka', 'Silla', 'Silva', 'Silvana', 'Silvía', 'Sirra', 'Sirrý', 'Siv', 'Sía', 'Símonía', 'Sísí', 'Síta', 'Sjöfn', 'Skarpheiður', 'Skugga', 'Skuld', 'Skúla', 'Skúlína', 'Snjáfríður', 'Snjáka', 'Snjófríður', 'Snjólaug', 'Snorra', 'Snót', 'Snæbjörg', 'Snæbjört', 'Snæborg', 'Snæbrá', 'Snædís', 'Snæfríður', 'Snælaug', 'Snærós', 'Snærún', 'Soffía', 'Sofie', 'Sofía', 'Solveig', 'Sonja', 'Sonný', 'Sophia', 'Sophie', 'Sól', 'Sóla', 'Sólbjörg', 'Sólbjört', 'Sólborg', 'Sólbrá', 'Sólbrún', 'Sóldís', 'Sóldögg', 'Sóley', 'Sólfríður', 'Sólgerður', 'Sólhildur', 'Sólín', 'Sólkatla', 'Sóllilja', 'Sólný', 'Sólrós', 'Sólrún', 'Sólveig', 'Sólvör', 'Sónata', 'Stefana', 'Stefanía', 'Stefánný', 'Steina', 'Steinbjörg', 'Steinborg', 'Steindís', 'Steindóra', 'Steiney', 'Steinfríður', 'Steingerður', 'Steinhildur', 'Steinlaug', 'Steinrós', 'Steinrún', 'Steinunn', 'Steinvör', 'Steinþóra', 'Stella', 'Stígheiður', 'Stígrún', 'Stína', 'Stjarna', 'Styrgerður', 'Sumarlína', 'Sumarrós', 'Sunna', 'Sunnefa', 'Sunneva', 'Sunniva', 'Sunníva', 'Susan', 'Súla', 'Súsan', 'Súsanna', 'Svafa', 'Svala', 'Svalrún', 'Svana', 'Svanbjörg', 'Svanbjört', 'Svanborg', 'Svandís', 'Svaney', 'Svanfríður', 'Svanheiður', 'Svanhildur', 'Svanhvít', 'Svanlaug', 'Svanrós', 'Svanþrúður', 'Svava', 'Svea', 'Sveina', 'Sveinbjörg', 'Sveinborg', 'Sveindís', 'Sveiney', 'Sveinfríður', 'Sveingerður', 'Sveinhildur', 'Sveinlaug', 'Sveinrós', 'Sveinrún', 'Sveinsína', 'Sveinveig', 'Sylgja', 'Sylva', 'Sylvía', 'Sæbjörg', 'Sæbjört', 'Sæborg', 'Sædís', 'Sæfinna', 'Sæfríður', 'Sæhildur', 'Sælaug', 'Sæmunda', 'Sæný', 'Særós', 'Særún', 'Sæsól', 'Sæunn', 'Sævör', 'Sölva', 'Sölvey', 'Sölvína', 'Tala', 'Talía', 'Tamar', 'Tamara', 'Tanía', 'Tanja', 'Tanya', 'Tanya', 'Tara', 'Tea', 'Teitný', 'Tekla', 'Telma', 'Tera', 'Teresa', 'Teresía', 'Thea', 'Thelma', 'Theodóra', 'Theódóra', 'Theresa', 'Tindra', 'Tinna', 'Tirsa', 'Tía', 'Tíbrá', 'Tína', 'Todda', 'Torbjörg', 'Torfey', 'Torfheiður', 'Torfhildur', 'Tóbý', 'Tóka', 'Tóta', 'Tristana', 'Trú', 'Tryggva', 'Tryggvína', 'Týra', 'Ugla', 'Una', 'Undína', 'Unna', 'Unnbjörg', 'Unndís', 'Unnur', 'Urður', 'Úa', 'Úlfa', 'Úlfdís', 'Úlfey', 'Úlfheiður', 'Úlfhildur', 'Úlfrún', 'Úlla', 'Úna', 'Úndína', 'Úranía', 'Úrsúla', 'Vagna', 'Vagnbjörg', 'Vagnfríður', 'Vaka', 'Vala', 'Valbjörg', 'Valbjörk', 'Valbjört', 'Valborg', 'Valdheiður', 'Valdís', 'Valentína', 'Valería', 'Valey', 'Valfríður', 'Valgerða', 'Valgerður', 'Valhildur', 'Valka', 'Vallý', 'Valný', 'Valrós', 'Valrún', 'Valva', 'Valý', 'Valþrúður', 'Vanda', 'Vár', 'Veig', 'Veiga', 'Venus', 'Vera', 'Veronika', 'Verónika', 'Veróníka', 'Vetrarrós', 'Vébjörg', 'Védís', 'Végerður', 'Vélaug', 'Véný', 'Vibeka', 'Victoría', 'Viðja', 'Vigdís', 'Vigný', 'Viktoria', 'Viktoría', 'Vilborg', 'Vildís', 'Vilfríður', 'Vilgerður', 'Vilhelmína', 'Villa', 'Villimey', 'Vilma', 'Vilný', 'Vinbjörg', 'Vinný', 'Vinsý', 'Virginía', 'Víbekka', 'Víf', 'Vígdögg', 'Víggunnur', 'Víóla', 'Víóletta', 'Vísa', 'Von', 'Von', 'Voney', 'Vordís', 'Ylfa', 'Ylfur', 'Ylja', 'Ylva', 'Ynja', 'Yrja', 'Yrsa', 'Ýja', 'Ýma', 'Ýr', 'Ýrr', 'Þalía', 'Þeba', 'Þeódís', 'Þeódóra', 'Þjóðbjörg', 'Þjóðhildur', 'Þoka', 'Þorbjörg', 'Þorfinna', 'Þorgerður', 'Þorgríma', 'Þorkatla', 'Þorlaug', 'Þorleif', 'Þorsteina', 'Þorstína', 'Þóra', 'Þóranna', 'Þórarna', 'Þórbjörg', 'Þórdís', 'Þórða', 'Þórelfa', 'Þórelfur', 'Þórey', 'Þórfríður', 'Þórgunna', 'Þórgunnur', 'Þórhalla', 'Þórhanna', 'Þórheiður', 'Þórhildur', 'Þórkatla', 'Þórlaug', 'Þórleif', 'Þórný', 'Þórodda', 'Þórsteina', 'Þórsteinunn', 'Þórstína', 'Þórunn', 'Þórveig', 'Þórvör', 'Þrá', 'Þrúða', 'Þrúður', 'Þula', 'Þura', 'Þurí', 'Þuríður', 'Þurý', 'Þúfa', 'Þyri', 'Þyrí', 'Þöll', 'Ægileif', 'Æsa', 'Æsgerður', 'Ögmunda', 'Ögn', 'Ölrún', 'Ölveig', 'Örbrún', 'Örk', 'Ösp']; + + /** + * @var array Icelandic names for men. + */ + protected static $firstNameMale = ['Aage', 'Abel', 'Abraham', 'Adam', 'Addi', 'Adel', 'Adíel', 'Adólf', 'Adrían', 'Adríel', 'Aðalberg', 'Aðalbergur', 'Aðalbert', 'Aðalbjörn', 'Aðalborgar', 'Aðalgeir', 'Aðalmundur', 'Aðalráður', 'Aðalsteinn', 'Aðólf', 'Agnar', 'Agni', 'Albert', 'Aldar', 'Alex', 'Alexander', 'Alexíus', 'Alfons', 'Alfred', 'Alfreð', 'Ali', 'Allan', 'Alli', 'Almar', 'Alrekur', 'Alvar', 'Alvin', 'Amír', 'Amos', 'Anders', 'Andreas', 'André', 'Andrés', 'Andri', 'Anes', 'Anfinn', 'Angantýr', 'Angi', 'Annar', 'Annarr', 'Annas', 'Annel', 'Annes', 'Anthony', 'Anton', 'Antoníus', 'Aran', 'Arent', 'Ares', 'Ari', 'Arilíus', 'Arinbjörn', 'Aríel', 'Aríus', 'Arnald', 'Arnaldur', 'Arnar', 'Arnberg', 'Arnbergur', 'Arnbjörn', 'Arndór', 'Arnes', 'Arnfinnur', 'Arnfreyr', 'Arngeir', 'Arngils', 'Arngrímur', 'Arnkell', 'Arnlaugur', 'Arnleifur', 'Arnljótur', 'Arnmóður', 'Arnmundur', 'Arnoddur', 'Arnold', 'Arnór', 'Arnsteinn', 'Arnúlfur', 'Arnviður', 'Arnþór', 'Aron', 'Arthur', 'Arthúr', 'Artúr', 'Asael', 'Askur', 'Aspar', 'Atlas', 'Atli', 'Auðbergur', 'Auðbert', 'Auðbjörn', 'Auðgeir', 'Auðkell', 'Auðmundur', 'Auðólfur', 'Auðun', 'Auðunn', 'Austar', 'Austmann', 'Austmar', 'Austri', 'Axel', 'Ágúst', 'Áki', 'Álfar', 'Álfgeir', 'Álfgrímur', 'Álfur', 'Álfþór', 'Ámundi', 'Árbjartur', 'Árbjörn', 'Árelíus', 'Árgeir', 'Árgils', 'Ármann', 'Árni', 'Ársæll', 'Ás', 'Ásberg', 'Ásbergur', 'Ásbjörn', 'Ásgautur', 'Ásgeir', 'Ásgils', 'Ásgrímur', 'Ási', 'Áskell', 'Áslaugur', 'Áslákur', 'Ásmar', 'Ásmundur', 'Ásólfur', 'Ásröður', 'Ástbjörn', 'Ástgeir', 'Ástmar', 'Ástmundur', 'Ástráður', 'Ástríkur', 'Ástvald', 'Ástvaldur', 'Ástvar', 'Ástvin', 'Ástþór', 'Ásvaldur', 'Ásvarður', 'Ásþór', 'Baldur', 'Baldvin', 'Baldwin', 'Baltasar', 'Bambi', 'Barði', 'Barri', 'Bassi', 'Bastían', 'Baugur', 'Bárður', 'Beinir', 'Beinteinn', 'Beitir', 'Bekan', 'Benedikt', 'Benidikt', 'Benjamín', 'Benoný', 'Benóní', 'Benóný', 'Bent', 'Berent', 'Berg', 'Bergfinnur', 'Berghreinn', 'Bergjón', 'Bergmann', 'Bergmar', 'Bergmundur', 'Bergsteinn', 'Bergsveinn', 'Bergur', 'Bergvin', 'Bergþór', 'Bernhard', 'Bernharð', 'Bernharður', 'Berni', 'Bernódus', 'Bersi', 'Bertel', 'Bertram', 'Bessi', 'Betúel', 'Bill', 'Birgir', 'Birkir', 'Birnir', 'Birtingur', 'Birtir', 'Bjargar', 'Bjargmundur', 'Bjargþór', 'Bjarkan', 'Bjarkar', 'Bjarki', 'Bjarmar', 'Bjarmi', 'Bjarnar', 'Bjarnfinnur', 'Bjarnfreður', 'Bjarnharður', 'Bjarnhéðinn', 'Bjarni', 'Bjarnlaugur', 'Bjarnleifur', 'Bjarnólfur', 'Bjarnsteinn', 'Bjarnþór', 'Bjartmann', 'Bjartmar', 'Bjartur', 'Bjartþór', 'Bjólan', 'Bjólfur', 'Björgmundur', 'Björgólfur', 'Björgúlfur', 'Björgvin', 'Björn', 'Björnólfur', 'Blængur', 'Blær', 'Blævar', 'Boði', 'Bogi', 'Bolli', 'Borgar', 'Borgúlfur', 'Borgþór', 'Bóas', 'Bói', 'Bótólfur', 'Bragi', 'Brandur', 'Breki', 'Bresi', 'Brestir', 'Brimar', 'Brimi', 'Brimir', 'Brími', 'Brjánn', 'Broddi', 'Bruno', 'Bryngeir', 'Brynjar', 'Brynjólfur', 'Brynjúlfur', 'Brynleifur', 'Brynsteinn', 'Bryntýr', 'Brynþór', 'Burkni', 'Búi', 'Búri', 'Bæring', 'Bæringur', 'Bæron', 'Böðvar', 'Börkur', 'Carl', 'Cecil', 'Christian', 'Christopher', 'Cýrus', 'Daði', 'Dagbjartur', 'Dagfari', 'Dagfinnur', 'Daggeir', 'Dagmann', 'Dagnýr', 'Dagur', 'Dagþór', 'Dalbert', 'Dalli', 'Dalmann', 'Dalmar', 'Dalvin', 'Damjan', 'Dan', 'Danelíus', 'Daniel', 'Danival', 'Daníel', 'Daníval', 'Dante', 'Daríus', 'Darri', 'Davíð', 'Demus', 'Deníel', 'Dennis', 'Diðrik', 'Díómedes', 'Dofri', 'Dolli', 'Dominik', 'Dómald', 'Dómaldi', 'Dómaldur', 'Dónald', 'Dónaldur', 'Dór', 'Dóri', 'Dósóþeus', 'Draupnir', 'Dreki', 'Drengur', 'Dufgus', 'Dufþakur', 'Dugfús', 'Dúi', 'Dúnn', 'Dvalinn', 'Dýri', 'Dýrmundur', 'Ebbi', 'Ebeneser', 'Ebenezer', 'Eberg', 'Edgar', 'Edilon', 'Edílon', 'Edvard', 'Edvin', 'Edward', 'Eðvald', 'Eðvar', 'Eðvarð', 'Efraím', 'Eggert', 'Eggþór', 'Egill', 'Eiðar', 'Eiður', 'Eikar', 'Eilífur', 'Einar', 'Einir', 'Einvarður', 'Einþór', 'Eiríkur', 'Eivin', 'Elberg', 'Elbert', 'Eldar', 'Eldgrímur', 'Eldjárn', 'Eldmar', 'Eldon', 'Eldór', 'Eldur', 'Elentínus', 'Elfar', 'Elfráður', 'Elimar', 'Elinór', 'Elis', 'Elí', 'Elías', 'Elíeser', 'Elímar', 'Elínbergur', 'Elínmundur', 'Elínór', 'Elís', 'Ellert', 'Elli', 'Elliði', 'Ellís', 'Elmar', 'Elvar', 'Elvin', 'Elvis', 'Emanúel', 'Embrek', 'Emerald', 'Emil', 'Emmanúel', 'Engilbert', 'Engilbjartur', 'Engiljón', 'Engill', 'Enok', 'Eric', 'Erik', 'Erlar', 'Erlendur', 'Erling', 'Erlingur', 'Ernestó', 'Ernir', 'Ernst', 'Eron', 'Erpur', 'Esekíel', 'Esjar', 'Esra', 'Estefan', 'Evald', 'Evan', 'Evert', 'Eyberg', 'Eyjólfur', 'Eylaugur', 'Eyleifur', 'Eymar', 'Eymundur', 'Eyríkur', 'Eysteinn', 'Eyvar', 'Eyvindur', 'Eyþór', 'Fabrisíus', 'Falgeir', 'Falur', 'Fannar', 'Fannberg', 'Fanngeir', 'Fáfnir', 'Fálki', 'Felix', 'Fengur', 'Fenrir', 'Ferdinand', 'Ferdínand', 'Fertram', 'Feykir', 'Filip', 'Filippus', 'Finn', 'Finnbjörn', 'Finnbogi', 'Finngeir', 'Finnjón', 'Finnlaugur', 'Finnur', 'Finnvarður', 'Fífill', 'Fjalar', 'Fjarki', 'Fjólar', 'Fjólmundur', 'Fjölnir', 'Fjölvar', 'Fjörnir', 'Flemming', 'Flosi', 'Flóki', 'Flórent', 'Flóvent', 'Forni', 'Fossmar', 'Fólki', 'Francis', 'Frank', 'Franklín', 'Frans', 'Franz', 'Fránn', 'Frár', 'Freybjörn', 'Freygarður', 'Freymar', 'Freymóður', 'Freymundur', 'Freyr', 'Freysteinn', 'Freyviður', 'Freyþór', 'Friðberg', 'Friðbergur', 'Friðbert', 'Friðbjörn', 'Friðfinnur', 'Friðgeir', 'Friðjón', 'Friðlaugur', 'Friðleifur', 'Friðmann', 'Friðmar', 'Friðmundur', 'Friðrik', 'Friðsteinn', 'Friður', 'Friðvin', 'Friðþjófur', 'Friðþór', 'Friedrich', 'Fritz', 'Frímann', 'Frosti', 'Fróði', 'Fróðmar', 'Funi', 'Fúsi', 'Fylkir', 'Gabriel', 'Gabríel', 'Gael', 'Galdur', 'Gamalíel', 'Garðar', 'Garibaldi', 'Garpur', 'Garri', 'Gaui', 'Gaukur', 'Gauti', 'Gautrekur', 'Gautur', 'Gautviður', 'Geir', 'Geirarður', 'Geirfinnur', 'Geirharður', 'Geirhjörtur', 'Geirhvatur', 'Geiri', 'Geirlaugur', 'Geirleifur', 'Geirmundur', 'Geirólfur', 'Geirröður', 'Geirtryggur', 'Geirvaldur', 'Geirþjófur', 'Geisli', 'Gellir', 'Georg', 'Gerald', 'Gerðar', 'Geri', 'Gestur', 'Gilbert', 'Gilmar', 'Gils', 'Gissur', 'Gizur', 'Gídeon', 'Gígjar', 'Gísli', 'Gjúki', 'Glói', 'Glúmur', 'Gneisti', 'Gnúpur', 'Gnýr', 'Goði', 'Goðmundur', 'Gottskálk', 'Gottsveinn', 'Gói', 'Grani', 'Grankell', 'Gregor', 'Greipur', 'Greppur', 'Gretar', 'Grettir', 'Grétar', 'Grímar', 'Grímkell', 'Grímlaugur', 'Grímnir', 'Grímólfur', 'Grímur', 'Grímúlfur', 'Guðberg', 'Guðbergur', 'Guðbjarni', 'Guðbjartur', 'Guðbjörn', 'Guðbrandur', 'Guðfinnur', 'Guðfreður', 'Guðgeir', 'Guðjón', 'Guðlaugur', 'Guðleifur', 'Guðleikur', 'Guðmann', 'Guðmar', 'Guðmon', 'Guðmundur', 'Guðni', 'Guðráður', 'Guðröður', 'Guðsteinn', 'Guðvarður', 'Guðveigur', 'Guðvin', 'Guðþór', 'Gumi', 'Gunnar', 'Gunnberg', 'Gunnbjörn', 'Gunndór', 'Gunngeir', 'Gunnhallur', 'Gunnlaugur', 'Gunnleifur', 'Gunnólfur', 'Gunnóli', 'Gunnröður', 'Gunnsteinn', 'Gunnvaldur', 'Gunnþór', 'Gustav', 'Gutti', 'Guttormur', 'Gústaf', 'Gústav', 'Gylfi', 'Gyrðir', 'Gýgjar', 'Gýmir', 'Haddi', 'Haddur', 'Hafberg', 'Hafgrímur', 'Hafliði', 'Hafnar', 'Hafni', 'Hafsteinn', 'Hafþór', 'Hagalín', 'Hagbarður', 'Hagbert', 'Haki', 'Hallberg', 'Hallbjörn', 'Halldór', 'Hallfreður', 'Hallgarður', 'Hallgeir', 'Hallgils', 'Hallgrímur', 'Hallkell', 'Hallmann', 'Hallmar', 'Hallmundur', 'Hallsteinn', 'Hallur', 'Hallvarður', 'Hallþór', 'Hamar', 'Hannes', 'Hannibal', 'Hans', 'Harald', 'Haraldur', 'Harri', 'Harry', 'Harrý', 'Hartmann', 'Hartvig', 'Hauksteinn', 'Haukur', 'Haukvaldur', 'Hákon', 'Háleygur', 'Hálfdan', 'Hálfdán', 'Hámundur', 'Hárekur', 'Hárlaugur', 'Hásteinn', 'Hávar', 'Hávarður', 'Hávarr', 'Hávarr', 'Heiðar', 'Heiðarr', 'Heiðberg', 'Heiðbert', 'Heiðlindur', 'Heiðmann', 'Heiðmar', 'Heiðmundur', 'Heiðrekur', 'Heikir', 'Heilmóður', 'Heimir', 'Heinrekur', 'Heisi', 'Hektor', 'Helgi', 'Helmút', 'Hemmert', 'Hendrik', 'Henning', 'Henrik', 'Henry', 'Henrý', 'Herbert', 'Herbjörn', 'Herfinnur', 'Hergeir', 'Hergill', 'Hergils', 'Herjólfur', 'Herlaugur', 'Herleifur', 'Herluf', 'Hermann', 'Hermóður', 'Hermundur', 'Hersir', 'Hersteinn', 'Hersveinn', 'Hervar', 'Hervarður', 'Hervin', 'Héðinn', 'Hilaríus', 'Hilbert', 'Hildar', 'Hildibergur', 'Hildibrandur', 'Hildigeir', 'Hildiglúmur', 'Hildimar', 'Hildimundur', 'Hildingur', 'Hildir', 'Hildiþór', 'Hilmar', 'Hilmir', 'Himri', 'Hinrik', 'Híram', 'Hjallkár', 'Hjalti', 'Hjarnar', 'Hjálmar', 'Hjálmgeir', 'Hjálmtýr', 'Hjálmur', 'Hjálmþór', 'Hjörleifur', 'Hjörtur', 'Hjörtþór', 'Hjörvar', 'Hleiðar', 'Hlégestur', 'Hlér', 'Hlini', 'Hlíðar', 'Hlíðberg', 'Hlífar', 'Hljómur', 'Hlynur', 'Hlöðmundur', 'Hlöður', 'Hlöðvarður', 'Hlöðver', 'Hnefill', 'Hnikar', 'Hnikarr', 'Holgeir', 'Holger', 'Holti', 'Hólm', 'Hólmar', 'Hólmbert', 'Hólmfastur', 'Hólmgeir', 'Hólmgrímur', 'Hólmkell', 'Hólmsteinn', 'Hólmþór', 'Hóseas', 'Hrafn', 'Hrafnar', 'Hrafnbergur', 'Hrafnkell', 'Hrafntýr', 'Hrannar', 'Hrappur', 'Hraunar', 'Hreggviður', 'Hreiðar', 'Hreiðmar', 'Hreimur', 'Hreinn', 'Hringur', 'Hrímnir', 'Hrollaugur', 'Hrolleifur', 'Hróaldur', 'Hróar', 'Hróbjartur', 'Hróðgeir', 'Hróðmar', 'Hróðólfur', 'Hróðvar', 'Hrói', 'Hrólfur', 'Hrómundur', 'Hrútur', 'Hrærekur', 'Hugberg', 'Hugi', 'Huginn', 'Hugleikur', 'Hugo', 'Hugó', 'Huldar', 'Huxley', 'Húbert', 'Húgó', 'Húmi', 'Húnbogi', 'Húni', 'Húnn', 'Húnröður', 'Hvannar', 'Hyltir', 'Hylur', 'Hængur', 'Hænir', 'Höður', 'Högni', 'Hörður', 'Höskuldur', 'Illugi', 'Immanúel', 'Indriði', 'Ingberg', 'Ingi', 'Ingiberg', 'Ingibergur', 'Ingibert', 'Ingibjartur', 'Ingibjörn', 'Ingileifur', 'Ingimagn', 'Ingimar', 'Ingimundur', 'Ingivaldur', 'Ingiþór', 'Ingjaldur', 'Ingmar', 'Ingólfur', 'Ingvaldur', 'Ingvar', 'Ingvi', 'Ingþór', 'Ismael', 'Issi', 'Ían', 'Ígor', 'Ími', 'Ísak', 'Ísar', 'Ísarr', 'Ísbjörn', 'Íseldur', 'Ísgeir', 'Ísidór', 'Ísleifur', 'Ísmael', 'Ísmar', 'Ísólfur', 'Ísrael', 'Ívan', 'Ívar', 'Jack', 'Jafet', 'Jaki', 'Jakob', 'Jakop', 'Jamil', 'Jan', 'Janus', 'Jarl', 'Jason', 'Járngrímur', 'Játgeir', 'Játmundur', 'Játvarður', 'Jenni', 'Jens', 'Jeremías', 'Jes', 'Jesper', 'Jochum', 'Johan', 'John', 'Joshua', 'Jóakim', 'Jóann', 'Jóel', 'Jóhann', 'Jóhannes', 'Jói', 'Jómar', 'Jómundur', 'Jón', 'Jónar', 'Jónas', 'Jónatan', 'Jónbjörn', 'Jóndór', 'Jóngeir', 'Jónmundur', 'Jónsteinn', 'Jónþór', 'Jósafat', 'Jósavin', 'Jósef', 'Jósep', 'Jósteinn', 'Jósúa', 'Jóvin', 'Julian', 'Júlí', 'Júlían', 'Júlíus', 'Júní', 'Júníus', 'Júrek', 'Jökull', 'Jörfi', 'Jörgen', 'Jörmundur', 'Jörri', 'Jörundur', 'Jörvar', 'Jörvi', 'Kaj', 'Kakali', 'Kaktus', 'Kaldi', 'Kaleb', 'Kali', 'Kalman', 'Kalmann', 'Kalmar', 'Kaprasíus', 'Karel', 'Karim', 'Karkur', 'Karl', 'Karles', 'Karli', 'Karvel', 'Kaspar', 'Kasper', 'Kastíel', 'Katarínus', 'Kató', 'Kár', 'Kári', 'Keran', 'Ketilbjörn', 'Ketill', 'Kilían', 'Kiljan', 'Kjalar', 'Kjallakur', 'Kjaran', 'Kjartan', 'Kjarval', 'Kjárr', 'Kjói', 'Klemens', 'Klemenz', 'Klængur', 'Knútur', 'Knörr', 'Koðrán', 'Koggi', 'Kolbeinn', 'Kolbjörn', 'Kolfinnur', 'Kolgrímur', 'Kolmar', 'Kolskeggur', 'Kolur', 'Kolviður', 'Konráð', 'Konstantínus', 'Kormákur', 'Kornelíus', 'Kort', 'Kópur', 'Kraki', 'Kris', 'Kristall', 'Kristberg', 'Kristbergur', 'Kristbjörn', 'Kristdór', 'Kristens', 'Krister', 'Kristfinnur', 'Kristgeir', 'Kristian', 'Kristinn', 'Kristján', 'Kristjón', 'Kristlaugur', 'Kristleifur', 'Kristmann', 'Kristmar', 'Kristmundur', 'Kristofer', 'Kristófer', 'Kristvaldur', 'Kristvarður', 'Kristvin', 'Kristþór', 'Krummi', 'Kveldúlfur', 'Lambert', 'Lars', 'Laufar', 'Laugi', 'Lauritz', 'Lár', 'Lárent', 'Lárentíus', 'Lárus', 'Leiðólfur', 'Leif', 'Leifur', 'Leiknir', 'Leo', 'Leon', 'Leonard', 'Leonhard', 'Leó', 'Leópold', 'Leví', 'Lér', 'Liljar', 'Lindar', 'Lindberg', 'Línberg', 'Líni', 'Ljósálfur', 'Ljótur', 'Ljúfur', 'Loðmundur', 'Loftur', 'Logi', 'Loki', 'Lórens', 'Lórenz', 'Ludvig', 'Lundi', 'Lúðvíg', 'Lúðvík', 'Lúkas', 'Lúter', 'Lúther', 'Lyngar', 'Lýður', 'Lýtingur', 'Maggi', 'Magngeir', 'Magni', 'Magnús', 'Magnþór', 'Makan', 'Manfred', 'Manfreð', 'Manúel', 'Mar', 'Marbjörn', 'Marel', 'Margeir', 'Margrímur', 'Mari', 'Marijón', 'Marinó', 'Marías', 'Marínó', 'Marís', 'Maríus', 'Marjón', 'Markó', 'Markús', 'Markþór', 'Maron', 'Marri', 'Mars', 'Marsellíus', 'Marteinn', 'Marten', 'Marthen', 'Martin', 'Marvin', 'Mathías', 'Matthías', 'Matti', 'Mattías', 'Max', 'Maximus', 'Máni', 'Már', 'Márus', 'Mekkinó', 'Melkíor', 'Melkólmur', 'Melrakki', 'Mensalder', 'Merkúr', 'Methúsalem', 'Metúsalem', 'Meyvant', 'Michael', 'Mikael', 'Mikjáll', 'Mikkael', 'Mikkel', 'Mildinberg', 'Mías', 'Mímir', 'Míó', 'Mír', 'Mjöllnir', 'Mjölnir', 'Moli', 'Morgan', 'Moritz', 'Mosi', 'Móði', 'Móri', 'Mórits', 'Móses', 'Muggur', 'Muni', 'Muninn', 'Múli', 'Myrkvi', 'Mýrkjartan', 'Mörður', 'Narfi', 'Natan', 'Natanael', 'Nataníel', 'Náttmörður', 'Náttúlfur', 'Neisti', 'Nenni', 'Neptúnus', 'Nicolas', 'Nikanor', 'Nikolai', 'Nikolas', 'Nikulás', 'Nils', 'Níels', 'Níls', 'Njáll', 'Njörður', 'Nonni', 'Norbert', 'Norðmann', 'Normann', 'Nóam', 'Nóel', 'Nói', 'Nóni', 'Nóri', 'Nóvember', 'Númi', 'Nývarð', 'Nökkvi', 'Oddbergur', 'Oddbjörn', 'Oddfreyr', 'Oddgeir', 'Oddi', 'Oddkell', 'Oddleifur', 'Oddmar', 'Oddsteinn', 'Oddur', 'Oddvar', 'Oddþór', 'Oktavíus', 'Októ', 'Októvíus', 'Olaf', 'Olav', 'Olgeir', 'Oliver', 'Olivert', 'Orfeus', 'Ormar', 'Ormur', 'Orri', 'Orvar', 'Otkell', 'Otri', 'Otti', 'Ottó', 'Otur', 'Óðinn', 'Ófeigur', 'Ólafur', 'Óli', 'Óliver', 'Ólíver', 'Ómar', 'Ómi', 'Óskar', 'Ósvald', 'Ósvaldur', 'Ósvífur', 'Óttar', 'Óttarr', 'Parmes', 'Patrek', 'Patrekur', 'Patrick', 'Patrik', 'Páll', 'Pálmar', 'Pálmi', 'Pedró', 'Per', 'Peter', 'Pétur', 'Pjetur', 'Príor', 'Rafael', 'Rafn', 'Rafnar', 'Rafnkell', 'Ragnar', 'Ragúel', 'Randver', 'Rannver', 'Rasmus', 'Ráðgeir', 'Ráðvarður', 'Refur', 'Reginbaldur', 'Reginn', 'Reidar', 'Reifnir', 'Reimar', 'Reinar', 'Reinhart', 'Reinhold', 'Reynald', 'Reynar', 'Reynir', 'Reyr', 'Richard', 'Rikharð', 'Rikharður', 'Ríkarður', 'Ríkharð', 'Ríkharður', 'Ríó', 'Robert', 'Rolf', 'Ronald', 'Róbert', 'Rólant', 'Róman', 'Rómeó', 'Rósant', 'Rósar', 'Rósberg', 'Rósenberg', 'Rósi', 'Rósinberg', 'Rósinkar', 'Rósinkrans', 'Rósmann', 'Rósmundur', 'Rudolf', 'Runi', 'Runólfur', 'Rúbar', 'Rúben', 'Rúdólf', 'Rúnar', 'Rúrik', 'Rútur', 'Röðull', 'Rögnvald', 'Rögnvaldur', 'Rögnvar', 'Rökkvi', 'Safír', 'Sakarías', 'Salmann', 'Salmar', 'Salómon', 'Salvar', 'Samson', 'Samúel', 'Sandel', 'Sandri', 'Sandur', 'Saxi', 'Sebastian', 'Sebastían', 'Seifur', 'Seimur', 'Sesar', 'Sesil', 'Sigbergur', 'Sigbert', 'Sigbjartur', 'Sigbjörn', 'Sigdór', 'Sigfastur', 'Sigfinnur', 'Sigfreður', 'Sigfús', 'Siggeir', 'Sighvatur', 'Sigjón', 'Siglaugur', 'Sigmann', 'Sigmar', 'Sigmundur', 'Signar', 'Sigri', 'Sigríkur', 'Sigsteinn', 'Sigtryggur', 'Sigtýr', 'Sigur', 'Sigurbaldur', 'Sigurberg', 'Sigurbergur', 'Sigurbjarni', 'Sigurbjartur', 'Sigurbjörn', 'Sigurbrandur', 'Sigurdór', 'Sigurður', 'Sigurfinnur', 'Sigurgeir', 'Sigurgestur', 'Sigurgísli', 'Sigurgrímur', 'Sigurhans', 'Sigurhjörtur', 'Sigurjón', 'Sigurkarl', 'Sigurlaugur', 'Sigurlás', 'Sigurleifur', 'Sigurliði', 'Sigurlinni', 'Sigurmann', 'Sigurmar', 'Sigurmon', 'Sigurmundur', 'Sigurnýas', 'Sigurnýjas', 'Siguroddur', 'Siguróli', 'Sigurpáll', 'Sigursteinn', 'Sigursveinn', 'Sigurvaldi', 'Sigurvin', 'Sigurþór', 'Sigvaldi', 'Sigvarður', 'Sigþór', 'Silli', 'Sindri', 'Símon', 'Sírnir', 'Sírus', 'Sívar', 'Sjafnar', 'Skafti', 'Skapti', 'Skarphéðinn', 'Skefill', 'Skeggi', 'Skíði', 'Skírnir', 'Skjöldur', 'Skorri', 'Skuggi', 'Skúli', 'Skúta', 'Skær', 'Skæringur', 'Smári', 'Smiður', 'Smyrill', 'Snjóki', 'Snjólaugur', 'Snjólfur', 'Snorri', 'Snæbjartur', 'Snæbjörn', 'Snæhólm', 'Snælaugur', 'Snær', 'Snæringur', 'Snævar', 'Snævarr', 'Snæþór', 'Soffanías', 'Sophanías', 'Sophus', 'Sófónías', 'Sófus', 'Sókrates', 'Sólberg', 'Sólbergur', 'Sólbjartur', 'Sólbjörn', 'Sólimann', 'Sólmar', 'Sólmundur', 'Sólon', 'Sólver', 'Sólvin', 'Spartakus', 'Sporði', 'Spói', 'Stanley', 'Stapi', 'Starkaður', 'Starri', 'Stefan', 'Stefán', 'Stefnir', 'Steinar', 'Steinarr', 'Steinberg', 'Steinbergur', 'Steinbjörn', 'Steindór', 'Steinfinnur', 'Steingrímur', 'Steini', 'Steinkell', 'Steinmann', 'Steinmar', 'Steinmóður', 'Steinn', 'Steinólfur', 'Steinröður', 'Steinvarður', 'Steinþór', 'Stirnir', 'Stígur', 'Stormur', 'Stórólfur', 'Sturla', 'Sturlaugur', 'Sturri', 'Styr', 'Styrbjörn', 'Styrkár', 'Styrmir', 'Styrr', 'Sumarliði', 'Svafar', 'Svali', 'Svan', 'Svanberg', 'Svanbergur', 'Svanbjörn', 'Svangeir', 'Svanhólm', 'Svani', 'Svanlaugur', 'Svanmundur', 'Svanur', 'Svanþór', 'Svavar', 'Sváfnir', 'Sveinar', 'Sveinberg', 'Sveinbjartur', 'Sveinbjörn', 'Sveinjón', 'Sveinlaugur', 'Sveinmar', 'Sveinn', 'Sveinungi', 'Sveinþór', 'Svend', 'Sverre', 'Sverrir', 'Svölnir', 'Svörfuður', 'Sýrus', 'Sæberg', 'Sæbergur', 'Sæbjörn', 'Sæi', 'Sælaugur', 'Sæmann', 'Sæmundur', 'Sær', 'Sævald', 'Sævaldur', 'Sævar', 'Sævarr', 'Sævin', 'Sæþór', 'Sölmundur', 'Sölvar', 'Sölvi', 'Sören', 'Sörli', 'Tandri', 'Tarfur', 'Teitur', 'Theodór', 'Theódór', 'Thomas', 'Thor', 'Thorberg', 'Thór', 'Tindar', 'Tindri', 'Tindur', 'Tinni', 'Tími', 'Tímon', 'Tímoteus', 'Tímóteus', 'Tístran', 'Tjaldur', 'Tjörfi', 'Tjörvi', 'Tobías', 'Tolli', 'Tonni', 'Torfi', 'Tóbías', 'Tói', 'Tóki', 'Tómas', 'Tór', 'Trausti', 'Tristan', 'Trostan', 'Trúmann', 'Tryggvi', 'Tumas', 'Tumi', 'Tyrfingur', 'Týr', 'Ubbi', 'Uggi', 'Ulrich', 'Uni', 'Unnar', 'Unnbjörn', 'Unndór', 'Unnsteinn', 'Unnþór', 'Urðar', 'Uxi', 'Úddi', 'Úlfar', 'Úlfgeir', 'Úlfhéðinn', 'Úlfkell', 'Úlfljótur', 'Úlftýr', 'Úlfur', 'Úlrik', 'Úranus', 'Vagn', 'Vakur', 'Valberg', 'Valbergur', 'Valbjörn', 'Valbrandur', 'Valdemar', 'Valdi', 'Valdimar', 'Valdór', 'Valentín', 'Valentínus', 'Valgarð', 'Valgarður', 'Valgeir', 'Valíant', 'Vallaður', 'Valmar', 'Valmundur', 'Valsteinn', 'Valter', 'Valtýr', 'Valur', 'Valves', 'Valþór', 'Varmar', 'Vatnar', 'Váli', 'Vápni', 'Veigar', 'Veigur', 'Ver', 'Vermundur', 'Vernharð', 'Vernharður', 'Vestar', 'Vestmar', 'Veturliði', 'Vébjörn', 'Végeir', 'Vékell', 'Vélaugur', 'Vémundur', 'Vésteinn', 'Victor', 'Viðar', 'Vigfús', 'Viggó', 'Vignir', 'Vigri', 'Vigtýr', 'Vigur', 'Vikar', 'Viktor', 'Vilberg', 'Vilbergur', 'Vilbert', 'Vilbjörn', 'Vilbogi', 'Vilbrandur', 'Vilgeir', 'Vilhelm', 'Vilhjálmur', 'Vili', 'Viljar', 'Vilji', 'Villi', 'Vilmar', 'Vilmundur', 'Vincent', 'Vinjar', 'Virgill', 'Víðar', 'Víðir', 'Vífill', 'Víglundur', 'Vígmar', 'Vígmundur', 'Vígsteinn', 'Vígþór', 'Víkingur', 'Vopni', 'Vorm', 'Vöggur', 'Völundur', 'Vörður', 'Vöttur', 'Walter', 'Werner', 'Wilhelm', 'Willard', 'William', 'Willum', 'Ylur', 'Ymir', 'Yngvar', 'Yngvi', 'Yrkill', 'Ýmir', 'Ýrar', 'Zakaría', 'Zakarías', 'Zophanías', 'Zophonías', 'Zóphanías', 'Zóphonías', 'Þangbrandur', 'Þengill', 'Þeyr', 'Þiðrandi', 'Þiðrik', 'Þinur', 'Þjálfi', 'Þjóðann', 'Þjóðbjörn', 'Þjóðgeir', 'Þjóðleifur', 'Þjóðmar', 'Þjóðólfur', 'Þjóðrekur', 'Þjóðvarður', 'Þjóstar', 'Þjóstólfur', 'Þorberg', 'Þorbergur', 'Þorbjörn', 'Þorbrandur', 'Þorfinnur', 'Þorgarður', 'Þorgautur', 'Þorgeir', 'Þorgestur', 'Þorgils', 'Þorgísl', 'Þorgnýr', 'Þorgrímur', 'Þorkell', 'Þorlaugur', 'Þorlákur', 'Þorleifur', 'Þorleikur', 'Þormar', 'Þormóður', 'Þormundur', 'Þorri', 'Þorsteinn', 'Þorvaldur', 'Þorvar', 'Þorvarður', 'Þór', 'Þórar', 'Þórarinn', 'Þórbergur', 'Þórbjörn', 'Þórður', 'Þórgnýr', 'Þórgrímur', 'Þórhaddur', 'Þórhalli', 'Þórhallur', 'Þórir', 'Þórlaugur', 'Þórleifur', 'Þórlindur', 'Þórmar', 'Þórmundur', 'Þóroddur', 'Þórormur', 'Þórólfur', 'Þórsteinn', 'Þórörn', 'Þrastar', 'Þráinn', 'Þrándur', 'Þróttur', 'Þrúðmar', 'Þrymur', 'Þröstur', 'Þyrnir', 'Ægir', 'Æsir', 'Ævar', 'Ævarr', 'Ögmundur', 'Ögri', 'Ölnir', 'Ölver', 'Ölvir', 'Öndólfur', 'Önundur', 'Örlaugur', 'Örlygur', 'Örn', 'Örnólfur', 'Örvar', 'Össur', 'Öxar']; + + /** + * @var array Icelandic middle names. + */ + protected static $middleName = [ + 'Aðaldal', 'Aldan', 'Arnberg', 'Arnfjörð', 'Austan', 'Austdal', 'Austfjörð', 'Áss', 'Bakkdal', 'Bakkmann', 'Bald', 'Ben', 'Bergholt', 'Bergland', 'Bíldsfells', 'Bjarg', 'Bjarndal', 'Bjarnfjörð', 'Bláfeld', 'Blómkvist', 'Borgdal', 'Brekkmann', 'Brim', 'Brúnsteð', 'Dalhoff', 'Dan', 'Diljan', 'Ektavon', 'Eldberg', 'Elísberg', 'Elvan', 'Espólín', 'Eyhlíð', 'Eyvík', 'Falk', 'Finndal', 'Fossberg', 'Freydal', 'Friðhólm', 'Giljan', 'Gilsfjörð', 'Gnarr', 'Gnurr', 'Grendal', 'Grindvík', 'Gull', 'Haffjörð', 'Hafnes', 'Hafnfjörð', 'Har', 'Heimdal', 'Heimsberg', 'Helgfell', 'Herberg', 'Hildiberg', 'Hjaltdal', 'Hlíðkvist', 'Hnappdal', 'Hnífsdal', 'Hofland', 'Hofteig', 'Hornfjörð', 'Hólmberg', 'Hrafnan', 'Hrafndal', 'Hraunberg', 'Hreinberg', 'Hreindal', 'Hrútfjörð', 'Hvammdal', 'Hvítfeld', 'Höfðdal', 'Hörðdal', 'Íshólm', 'Júl', 'Kjarrval', 'Knaran', 'Knarran', 'Krossdal', 'Laufkvist', 'Laufland', 'Laugdal', 'Laxfoss', 'Liljan', 'Linddal', 'Línberg', 'Ljós', 'Loðmfjörð', 'Lyngberg', 'Magdal', 'Magg', 'Matt', 'Miðdal', 'Miðvík', 'Mjófjörð', 'Móberg', 'Mýrmann', 'Nesmann', 'Norðland', 'Núpdal', 'Ólfjörð', 'Ósland', 'Ósmann', 'Reginbald', 'Reykfell', 'Reykfjörð', 'Reynholt', 'Salberg', 'Sandhólm', 'Seljan', 'Sigurhólm', 'Skagalín', 'Skíðdal', 'Snæberg', 'Snædahl', 'Sólan', 'Stardal', 'Stein', 'Steinbekk', 'Steinberg', 'Storm', 'Straumberg', 'Svanhild', 'Svarfdal', 'Sædal', 'Val', 'Valagils', 'Vald', 'Varmdal', 'Vatnsfjörð', 'Vattar', 'Vattnes', 'Viðfjörð', 'Vídalín', 'Víking', 'Vopnfjörð', 'Yngling', 'Þor', 'Önfjörð', 'Örbekk', 'Öxdal', 'Öxndal', + ]; + + /** + * Randomly return an Icelandic middle name. + * + * @return string + */ + public static function middleName() + { + return static::randomElement(static::$middleName); + } + + /** + * Generate prepared last name for further processing. + * + * @return string + */ + public function lastName() + { + $name = static::firstNameMale(); + + if (substr($name, -2) === 'ur') { + $name = substr($name, 0, strlen($name) - 2); + } + + if (substr($name, -1) !== 's') { + $name .= 's'; + } + + return $name; + } + + /** + * Randomly return an Icelandic last name for a woman. + * + * @return string + */ + public function lastNameMale() + { + return $this->lastName() . 'son'; + } + + /** + * Randomly return an Icelandic last name for a man. + * + * @return string + */ + public function lastNameFemale() + { + return $this->lastName() . 'dóttir'; + } + + /** + * Return a random Icelandic Kennitala (Social Security number). + * + * @see http://en.wikipedia.org/wiki/Kennitala + * + * @return string + */ + public static function ssn() + { + // random birth date + $birthdate = DateTime::dateTimeThisCentury(); + + // last four buffer + $lastFour = null; + + // security variable reference + $ref = '32765432'; + + // valid flag + $valid = false; + + while (!$valid) { + // make two random numbers + $rand = static::randomDigit() . static::randomDigit(); + + // 8 char string with birth date and two random numbers + $tmp = $birthdate->format('dmy') . $rand; + + // loop through temp string + for ($i = 7, $sum = 0; $i >= 0; --$i) { + // calculate security variable + $sum += ($tmp[$i] * $ref[$i]); + } + + // subtract 11 if not 11 + $chk = ($sum % 11 === 0) ? 0 : (11 - ($sum % 11)); + + if ($chk < 10) { + $lastFour = $rand . $chk . substr($birthdate->format('Y'), 1, 1); + + $valid = true; + } + } + + return sprintf('%s-%s', $birthdate->format('dmy'), $lastFour); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/is_IS/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/is_IS/PhoneNumber.php new file mode 100644 index 00000000..7118666e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/is_IS/PhoneNumber.php @@ -0,0 +1,17 @@ + 'Argovia'], + ['AI' => 'Appenzello Interno'], + ['AR' => 'Appenzello Esterno'], + ['BE' => 'Berna'], + ['BL' => 'Basilea Campagna'], + ['BS' => 'Basilea Città'], + ['FR' => 'Friburgo'], + ['GE' => 'Ginevra'], + ['GL' => 'Glarona'], + ['GR' => 'Grigioni'], + ['JU' => 'Giura'], + ['LU' => 'Lucerna'], + ['NE' => 'Neuchâtel'], + ['NW' => 'Nidvaldo'], + ['OW' => 'Obvaldo'], + ['SG' => 'San Gallo'], + ['SH' => 'Sciaffusa'], + ['SO' => 'Soletta'], + ['SZ' => 'Svitto'], + ['TG' => 'Turgovia'], + ['TI' => 'Ticino'], + ['UR' => 'Uri'], + ['VD' => 'Vaud'], + ['VS' => 'Vallese'], + ['ZG' => 'Zugo'], + ['ZH' => 'Zurigo'], + ]; + + protected static $cityFormats = [ + '{{cityName}}', + ]; + + protected static $streetNameFormats = [ + '{{streetSuffix}} {{firstName}}', + '{{streetSuffix}} {{lastName}}', + ]; + + protected static $streetAddressFormats = [ + '{{streetName}} {{buildingNumber}}', + ]; + protected static $addressFormats = [ + "{{streetAddress}}\n{{postcode}} {{city}}", + ]; + + /** + * Returns a random street prefix + * + * @example Via + * + * @return string + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Returns a random city name. + * + * @example Luzern + * + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a canton + * + * @example array('BE' => 'Bern') + * + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + + return key($canton); + } + + /** + * Returns the name of canton. + * + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + + return current($canton); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/it_CH/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/it_CH/Company.php new file mode 100644 index 00000000..bb5f9460 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/it_CH/Company.php @@ -0,0 +1,15 @@ +generator->parse($format); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/Company.php new file mode 100644 index 00000000..0e4b88df --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/Company.php @@ -0,0 +1,17 @@ +generator->parse($format)); + } + + /** + * @example 'yamada.jp' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/Person.php new file mode 100644 index 00000000..399e5595 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/Person.php @@ -0,0 +1,147 @@ +generator->parse($format); + } + + /** + * @param string|null $gender 'male', 'female' or null for any + * + * @return string + * + * @example 'アキラ' + */ + public function firstKanaName($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::firstKanaNameMale(); + } + + if ($gender === static::GENDER_FEMALE) { + return static::firstKanaNameFemale(); + } + + return $this->generator->parse(static::randomElement(static::$firstKanaNameFormat)); + } + + /** + * @example 'アキラ' + */ + public static function firstKanaNameMale() + { + return static::randomElement(static::$firstKanaNameMale); + } + + /** + * @example 'アケミ' + */ + public static function firstKanaNameFemale() + { + return static::randomElement(static::$firstKanaNameFemale); + } + + /** + * @example 'アオタ' + */ + public static function lastKanaName() + { + return static::randomElement(static::$lastKanaName); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/PhoneNumber.php new file mode 100644 index 00000000..1e0595e0 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/PhoneNumber.php @@ -0,0 +1,19 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefixes); + } + + public static function companyNameElement() + { + return static::randomElement(static::$companyElements); + } + + public static function companyNameSuffix() + { + return static::randomElement(static::$companyNameSuffixes); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ka_GE/DateTime.php b/vendor/fakerphp/faker/src/Faker/Provider/ka_GE/DateTime.php new file mode 100644 index 00000000..375c32a7 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ka_GE/DateTime.php @@ -0,0 +1,43 @@ + 'კვირა', + 'Monday' => 'ორშაბათი', + 'Tuesday' => 'სამშაბათი', + 'Wednesday' => 'ოთხშაბათი', + 'Thursday' => 'ხუთშაბათი', + 'Friday' => 'პარასკევი', + 'Saturday' => 'შაბათი', + ]; + $week = static::dateTime($max)->format('l'); + + return $map[$week] ?? $week; + } + + public static function monthName($max = 'now') + { + $map = [ + 'January' => 'იანვარი', + 'February' => 'თებერვალი', + 'March' => 'მარტი', + 'April' => 'აპრილი', + 'May' => 'მაისი', + 'June' => 'ივნისი', + 'July' => 'ივლისი', + 'August' => 'აგვისტო', + 'September' => 'სექტემბერი', + 'October' => 'ოქტომბერი', + 'November' => 'ნოემბერი', + 'December' => 'დეკემბერი', + ]; + $month = static::dateTime($max)->format('F'); + + return $map[$month] ?? $month; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ka_GE/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/ka_GE/Internet.php new file mode 100644 index 00000000..d07e41cc --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ka_GE/Internet.php @@ -0,0 +1,15 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefixes); + } + + public static function companyNameElement() + { + return static::randomElement(static::$companyElements); + } + + public static function companyNameSuffix() + { + return static::randomElement(static::$companyNameSuffixes); + } + + /** + * National Business Identification Numbers + * + * @see http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Fbus_business%2Ffor_businessmen%2Farticle%2Fbusiness_identification_number&lang=en + * + * @param \DateTime $registrationDate + * + * @return string 12 digits, like 150140000019 + */ + public static function businessIdentificationNumber(\DateTime $registrationDate = null) + { + if (!$registrationDate) { + $registrationDate = \Faker\Provider\DateTime::dateTimeThisYear(); + } + + $dateAsString = $registrationDate->format('ym'); + $legalEntityType = (string) self::numberBetween(4, 6); + $legalEntityAdditionalType = (string) self::numberBetween(0, 3); + $randomDigits = (string) static::numerify('######'); + + return $dateAsString . $legalEntityType . $legalEntityAdditionalType . $randomDigits; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/kk_KZ/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/kk_KZ/Internet.php new file mode 100644 index 00000000..0328da09 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/kk_KZ/Internet.php @@ -0,0 +1,9 @@ + [ + self::CENTURY_19TH => self::MALE_CENTURY_19TH, + self::CENTURY_20TH => self::MALE_CENTURY_20TH, + self::CENTURY_21ST => self::MALE_CENTURY_21ST, + ], + self::GENDER_FEMALE => [ + self::CENTURY_19TH => self::FEMALE_CENTURY_19TH, + self::CENTURY_20TH => self::FEMALE_CENTURY_20TH, + self::CENTURY_21ST => self::FEMALE_CENTURY_21ST, + ], + ]; + + /** + * @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B7%D0%B0%D1%85%D1%81%D0%BA%D0%B0%D1%8F_%D1%84%D0%B0%D0%BC%D0%B8%D0%BB%D0%B8%D1%8F + * + * @var array + */ + protected static $maleNameFormats = [ + '{{lastName}}ұлы {{firstNameMale}}', + ]; + + /** + * @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B7%D0%B0%D1%85%D1%81%D0%BA%D0%B0%D1%8F_%D1%84%D0%B0%D0%BC%D0%B8%D0%BB%D0%B8%D1%8F + * + * @var array + */ + protected static $femaleNameFormats = [ + '{{lastName}}қызы {{firstNameFemale}}', + ]; + + /** + * @see http://koshpendi.kz/index.php/nomad/imena/ + * + * @var array + */ + protected static $firstNameMale = [ + 'Аылғазы', + 'Әбдіқадыр', + 'Бабағожа', + 'Ғайса', + 'Дәмен', + 'Егізбек', + 'Жазылбек', + 'Зұлпықар', + 'Игісін', + 'Кәдіржан', + 'Қадырқан', + 'Латиф', + 'Мағаз', + 'Нармағамбет', + 'Оңалбай', + 'Өндіріс', + 'Пердебек', + 'Рақат', + 'Сағындық', + 'Танабай', + 'Уайыс', + 'Ұйықбай', + 'Үрімбай', + 'Файзрахман', + 'Хангелді', + 'Шаттық', + 'Ыстамбақы', + 'Ібни', + ]; + + /** + * @see http://koshpendi.kz/index.php/nomad/imena/ + * + * @var array + */ + protected static $firstNameFemale = [ + 'Асылтас', + 'Әужа', + 'Бүлдіршін', + 'Гүлшаш', + 'Ғафура', + 'Ділдә', + 'Еркежан', + 'Жібек', + 'Зылиқа', + 'Ирада', + 'Күнсұлу', + 'Қырмызы', + 'Ләтипа', + 'Мүштәри', + 'Нұршара', + 'Орынша', + 'Өрзия', + 'Перизат', + 'Рухия', + 'Сындыбала', + 'Тұрсынай', + 'Уәсима', + 'Ұрқия', + 'Үрия', + 'Фируза', + 'Хафиза', + 'Шырынгүл', + 'Ырысты', + 'Іңкәр', + ]; + + /** + * @see http://koshpendi.kz/index.php/nomad/imena/ + * @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B7%D0%B0%D1%85%D1%81%D0%BA%D0%B0%D1%8F_%D1%84%D0%B0%D0%BC%D0%B8%D0%BB%D0%B8%D1%8F + * + * @var array + */ + protected static $lastName = [ + 'Адырбай', + 'Әжібай', + 'Байбөрі', + 'Ғизат', + 'Ділдабек', + 'Ешмұхамбет', + 'Жігер', + 'Зікірия', + 'Иса', + 'Кунту', + 'Қыдыр', + 'Лұқпан', + 'Мышырбай', + 'Нысынбай', + 'Ошақбай', + 'Өтетілеу', + 'Пірәлі', + 'Рүстем', + 'Сырмұхамбет', + 'Тілеміс', + 'Уәлі', + 'Ұлықбек', + 'Үстем', + 'Фахир', + 'Хұсайын', + 'Шілдебай', + 'Ыстамбақы', + 'Ісмет', + ]; + + /** + * Note! When calculating individual identification number + * 2000-01-01 - 2000-12-31 counts as 21th century + * 1900-01-01 - 1900-12-31 counts as 20th century + * + * @param int $year + * + * @return int + */ + private static function getCenturyByYear($year) + { + if (($year >= 2100) || ($year < 1800)) { + throw new \InvalidArgumentException('Unexpected century'); + } + + if ($year >= 2000) { + return self::CENTURY_21ST; + } + + if ($year >= 1900) { + return self::CENTURY_20TH; + } + + return self::CENTURY_19TH; + } + + /** + * National Individual Identification Numbers + * + * @see http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Fcitizen_migration%2Fpassport_id_card%2Farticle%2Fiin_info&lang=en + * @see https://ru.wikipedia.org/wiki/%D0%98%D0%BD%D0%B4%D0%B8%D0%B2%D0%B8%D0%B4%D1%83%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_%D0%B8%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BD%D0%BE%D0%BC%D0%B5%D1%80 + * + * @param \DateTime $birthDate + * @param int $gender + * + * @return string 12 digits, like 780322300455 + */ + public static function individualIdentificationNumber(\DateTime $birthDate = null, $gender = self::GENDER_MALE) + { + if (!$birthDate) { + $birthDate = DateTime::dateTimeBetween(); + } + + do { + $population = self::numberBetween(1000, 2000); + $century = self::getCenturyByYear((int) $birthDate->format('Y')); + + $iin = $birthDate->format('ymd'); + $iin .= (string) self::$genderCenturyMap[$gender][$century]; + $iin .= (string) $population; + $checksum = self::checkSum($iin); + } while ($checksum === 10); + + return $iin . (string) $checksum; + } + + /** + * @param string $iinValue + * + * @return int + */ + public static function checkSum($iinValue) + { + $controlDigit = self::getControlDigit($iinValue, self::$firstSequenceBitWeights); + + if ($controlDigit === 10) { + return self::getControlDigit($iinValue, self::$secondSequenceBitWeights); + } + + return $controlDigit; + } + + /** + * @param string $iinValue + * @param array $sequence + * + * @return int + */ + protected static function getControlDigit($iinValue, $sequence) + { + $sum = 0; + + for ($i = 0; $i <= 10; ++$i) { + $sum += (int) $iinValue[$i] * $sequence[$i]; + } + + return $sum % 11; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php new file mode 100644 index 00000000..c5d6440d --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php @@ -0,0 +1,16 @@ +generator->parse($format)); + } + + /** + * @example 'kim.kr' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ko_KR/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/ko_KR/Person.php new file mode 100644 index 00000000..71f6175b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ko_KR/Person.php @@ -0,0 +1,54 @@ +generator->parse($format)); + } + + public function cellPhoneNumber() + { + $format = self::randomElement(array_slice(static::$formats, 6, 1)); + + return self::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ko_KR/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/ko_KR/Text.php new file mode 100644 index 00000000..8182f899 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ko_KR/Text.php @@ -0,0 +1,1725 @@ +에 나오는 요귀의 불빛 모양으로 푸르무레 하게 허공을 비추오. 동경의 불바다는 내 마음을 더욱 음침하게 하였소. +이 때에 뒤에서, +"모시모시(여보세요)." +하는 소리가 들렸소. 그것은 흰 저고리를 입은 호텔 보이였소. +"왜?" +하고 나는 고개만 돌렸소. +"손님이 오셨습니다." +"손님?" +하고 나는 보이에게로 한 걸음 가까이 갔소. 나를 찾을 손님이 어디 있나 하고 나는 놀란 것이오. +"따님께서 오셨습니다. 방으로 모셨습니다." +하고 보이는 들어가 버리고 말았소. +"따님?" +하고 나는 더욱 놀랐소. 순임이가 서울서 나를 따라왔나? 그것은 안 될 말이오. 순임이가 내 뒤를 따라 떠났더라도 아무리 빨리 와도 내일이 아니면 못 왔을 것이오. 그러면 누군가. 정임인가. 정임이가 병원에서 뛰어온 것인가. +나는 두근거리는 가슴을 억지로 진정하면서 내 방문을 열었소. +그것은 정임이었소. 정임은 내가 쓰다가 둔 편지를 보고 있다가 벌떡 일어나 내게 달려들어 안겨 버렸소. 나는 얼빠진 듯이 정임이가 하라는 대로 내버려두었소. 그 편지는 부치려고 쓴 것도 아닌데 그 편지를 정임이가 본 것이 안되었다고 생각하였소. +형! 나를 책망하시오. 심히 부끄러운 말이지마는 나는 정임을 힘껏 껴안아 주고 싶었소. 나는 몇 번이나 정임의 등을 굽어 보면서 내 팔에 힘을 넣으려고 하였소. 정임은 심히 귀여웠소. 정임이가 그처럼 나를 사모하는 것이 심히 기뻤소. 나는 감정이 재우쳐서 눈이 안 보이고 정신이 몽롱하여짐을 깨달았소. 나는 아프고 쓰린 듯한 기쁨을 깨달았소. 영어로 엑스터시라든지, 한문으로 무아의 경지란 이런 것이 아닌가 하였소. 나는 사십 평생에 이러한 경험을 처음 한 것이오. +형! 형이 아시다시피 나는 내 아내 이외에 젊은 여성에게 이렇게 안겨 본 일이 없소. 물론 안아 본 일도 없소. +그러나 형! 나는 나를 눌렀소. 내 타오르는 애욕을 차디찬 이지의 입김으로 불어서 끄려고 애를 썼소. +"글쎄 웬일이냐. 앓는 것이 이 밤중에 비를 맞고 왜 나온단 말이냐. 철없는 것 같으니." +하고 나는 아버지의 위엄으로 정임의 두 어깨를 붙들어 암체어에 앉혔소. 그리고 나도 테이블을 하나 세워 두고 맞은편에 앉았소. +정임은 부끄러운 듯이 두 손으로 낯을 가리우고 제 무릎에 엎드려 울기를 시작하오. +정임은 누런 갈색의 외투를 입었소. 무엇을 타고 왔는지 모르지마는 구두에는 꽤 많이 물이 묻고 모자에는 빗방울 얼룩이 보이오. +"네가 이러다가 다시 병이 더치면 어찌한단 말이냐. 아이가 왜 그렇게 철이 없니?" +하고 나는 더욱 냉정한 어조로 책망하고 데스크 위에 놓인 내 편지 초를 집어 박박 찢어 버렸소. 종이 찢는 소리에 정임은 잠깐 고개를 들어서 처음에는 내 손을 보고 다음에는 내 얼굴을 보았소. 그러나 나는 모르는 체하고 도로 교의에 돌아와 앉아서 가만히 눈을 감았소. 그리고 도무지 흥분되지 아니한 모양을 꾸몄소. +형! 어떻게나 힘드는 일이오? 참으면 참을수록 내 이빨이 마주 부딪고, 얼굴의 근육은 씰룩거리고 손은 불끈불끈 쥐어지오. +"정말 내일 가세요?" +하고 아마 오 분 동안이나 침묵을 지키다가 정임이가 고개를 들고 물었소. +"그럼, 가야지." +하고 나는 빙그레 웃어 보였소. +"저도 데리고 가세요!" +하는 정임의 말은 마치 서릿발이 날리는 칼날과 같았소. 나는 깜짝 놀라서 정임을 바라보았소. 그의 눈은 빛나고 입은 꼭 다물고 얼굴의 근육은 팽팽하게 켕겼소. 정임의 얼굴에는 찬바람이 도는 무서운 기운이 있었소. +나는 즉각적으로 죽기를 결심한 여자의 모양이라고 생각하였소. 열정으로 불덩어리가 되었던 정임은 내가 보이는 냉랭한 태도로 말미암아 갑자기 얼어 버린 것 같았소. +"어디를?" +하고 나는 정임의 `저도 데리고 가세요.' 하는 담대한 말에 놀라면서 물었소. +"어디든지, 아버지 가시는 데면 어디든지 저를 데리고 가세요. 저는 아버지를 떠나서는 혼자서는 못 살 것을 지나간 반 달 동안에 잘 알았습니다. 아까 아버지 오셨다 가신 뒤에 생각해 보니깐 암만해도 아버지는 다시 저에게 와 보시지 아니하고 가실 것만 같애요. 그리고 저로 해서 아버지께서는 무슨 큰 타격을 당하신 것만 같으셔요. 처음 뵈올 적에 벌써 가슴이 뜨끔했습니다. 그리고 여행을 떠나신다는 말씀을 듣고는 반드시 무슨 큰일이 나셨느니라고만 생각했습니다. 그리고 저어, 저로 해서 그러신 것만 같고, 저를 버리시고 혼자 가시려는 것만 같고, 그래서 달려왔더니 여기 써 놓으신 편지를 보고 그 편지에 다른 말씀은 어찌 됐든지, 네 일기를 보았다 하신 말씀을 보고는 다 알았습니다. 저와 한 방에 있는 애가 암만해도 어머니 스파인가봐요. 제가 입원하기 전에도 제 눈치를 슬슬 보고 또 책상 서랍도 뒤지는 눈치가 보이길래 일기책은 늘 쇠 잠그는 서랍에 넣어 두었는데 아마 제가 정신 없이 앓고 누웠는 동안에 제 핸드백에서 쇳대를 훔쳐 갔던가봐요. 그래서는 그 일기책을 꺼내서 서울로 보냈나봐요. 그걸루 해서 아버지께서는 불명예스러운 누명을 쓰시고 학교일도 내놓으시게 되고 집도 떠나시게 되셨나봐요. 다시는 집에 안 돌아오실 양으로 결심을 하셨나봐요. 아까 병원에서도 하시는 말씀이 모두 유언하시는 것만 같아서 퍽 의심을 가졌었는데 지금 그 쓰시던 편지를 보고는 다 알았습니다. 그렇지만 그렇지만." +하고 웅변으로 내려 말하던 정임은 갑자기 복받치는 열정을 이기지 못하는 듯이, 한 번 한숨을 지우고, +"그렇지만 저는 아버지를 따라가요. 절루 해서 아버지께서는 집도 잃으시고 명예도 잃으시고 사업도 잃으시고 인생의 모든 것을 다 잃으셨으니 저는 아버지를 따라가요. 어디를 가시든지 저는 어린 딸로 아버지를 따라다니다가 아버지께서 먼저 돌아가시면 저도 따라 죽어서 아버지 발 밑에 묻힐 테야요. 제가 먼저 죽거든 제가 병이 있으니깐 물론 제가 먼저 죽지요. 죽어도 좋습니다. 병원에서 앓다가 혼자 죽는 건 싫어요. 아버지 곁에서 죽으면 아버지께서, 오 내 딸 정임아 하시고 귀해 주시고 불쌍히 여겨 주시겠지요. 그리고 제 몸을 어디든지 땅에 묻으시고 `사랑하는 내 딸 정임의 무덤'이라고 패라도 손수 쓰셔서 세워 주시지 않겠습니까." +하고 정임은 비쭉비쭉하다가 그만 무릎 위에 엎더져 울고 마오. +나는 다만 죽은 사람 모양으로 반쯤 눈을 감고 앉아 있었소. 가슴 속에는 정임의 곁에서 지지 않는 열정을 품으면서도 정임의 말대로 정임을 데리고 아무도 모르는 곳으로 가 버리고 싶으면서도 나는 이 열정의 불길을 내 입김으로 꺼 버리지 아니하면 아니 되는 것이었소. +"아아, 제가 왜 났어요? 왜 하나님께서 저를 세상에 보내셨어요? 아버지의 일생을 파멸시키려 난 것이지요? 제가 지금 죽어 버려서 아버지의 명예를 회복할 수 있다면 저는 죽어 버릴 터이야요. 기쁘게 죽어 버리겠습니다. 제가 여덟 살부터 오늘날까지 받은 은혜를 제 목숨 하나로 갚을 수가 있다면 저는 지금으로 죽어 버리겠습니다. 그렇지만 그렇지만……. +그렇지만 그렇지만 저는 다만 얼마라도 다만 하루라도 아버지 곁에서 살고 싶어요 다만 하루만이라도, 아버지! 제가 왜 이렇습니까, 네? 제가 어려서 이렇습니까. 미친 년이 되어서 이렇습니까. 아버지께서는 아실 테니 말씀해 주세요. 하루만이라도 아버지를 모시고 아버지 곁에서 살았으면 죽어도 한이 없겠습니다. 제 생각이 잘못이야요? 제 생각이 죄야요? 왜 죄입니까? 아버지, 저를 버리시고 혼자 가시지 마세요, 네? `정임아, 너를 데리고 가마.' 하고 약속해 주세요, 네." +정임은 아주 담대하게 제가 하고자 하는 말을 다 하오. 그 얌전한, 수삽한정임의 속에 어디 그러한 용기가 있었던가, 참 이상한 일이오. 나는 귀여운 어린 계집애 정임의 속에 엉큼한 여자가 들어앉은 것을 발견하였소. 그가 몇 가지 재료(내가 여행을 떠난다는 것과 제 일기를 보았다는 것)를 종합하여 나와 저와의 새에, 또 그 때문에 어떠한 일이 일어난 것을 추측하는 그 상상력도 놀랍거니와 그렇게 내 앞에서는 별로 입도 벌리지 아니하던 그가 이처럼 담대하게 제 속에 있는 말을 거리낌없이 다 해 버리는 용기를 아니 놀랄 수 없었소. 내가, 사내요 어른인 내가 도리어 정임에게 리드를 받고 놀림을 받음을 깨달았소. +그러나 정임을 위해서든지, 중년 남자의 위신을 위해서든지 나는 의지력으로, 도덕력으로, 정임을 누르고 훈계하지 아니하면 아니 되겠다고 생각하였소. +"정임아." +하고 나는 비로소 입을 열어서 불렀소. 내 어성은 장중하였소. 나는 할 수 있는 위엄을 다하여 `정임아.' 하고 부른 것이오. +"정임아, 네 속은 다 알았다. 네 마음 네 뜻은 그만하면 다 알았다. 네가 나를 그처럼 생각해 주는 것을 고맙게 생각한다. 기쁘게도 생각한다. 그러나 정임아." +하고 나는 일층 태도와 소리를 엄숙하게 하여, +"네가 청하는 말은 절대로 들을 수 없는 말이다. 내가 너를 친딸같이 사랑하기 때문에 나는 너를 데리고 가지 못하는 것이다. 나는 세상에서 죽고 조선에서 죽더라도 너는 죽어서 아니 된다. 차마 너까지는 죽이고 싶지 아니하단 말이다. 내가 어디 가서 없어져 버리면 세상은 네게 씌운 누명이 애매한 줄을 알게 될 것이 아니냐. 그리되면 너는 조선의 좋은 일꾼이 되어서 일도 많이 하고 또 사랑하는 남편을 맞아서 행복된 생활도 할 수 있을 것이 아니냐. 그것이 내가 네게 바라는 것이다. 내가 어디 가 있든지, 내가 살아 있는 동안 나는 네가 잘되는 것만, 행복되게 사는 것만 바라보고 혼자 기뻐할 것이 아니냐. +네가 다 옳게 알았다. 나는 네 말대로 조선을 영원히 떠나기로 하였다. 그렇지마는 나는 이렇게 된 것을 조금도 슬퍼하지 아니한다. 너를 위해서 내가 무슨 희생을 한다고 하면 내게는 그것이 큰 기쁨이다. 그뿐 아니라, 나는 인제는 세상이 싫어졌다. 더 살기가 싫어졌다. 내가 십여 년 동안 전생명을 바쳐서 교육한 학생들에게까지 배척을 받을 때에는 나는 지금까지 살아온 것을 생각만 하여도 진저리가 난다. 그렇지마는 나는 이것이 다 내가 부족한 때문인 줄을 잘 안다. 나는 조선을 원망한다든가, 내 동포를 원망한다든가, 그럴 생각은 없다. 원망을 한다면 나 자신의 부족을 원망할 뿐이다. 내가 원체 교육을 한다든지 남의 지도자가 된다든지 할 자격이 없음을 원망한다면 원망할까, 내가 어떻게 조선이나 조선 사람을 원망하느냐. 그러니까 인제 내게 남은 일은 나를 조선에서 없애 버리는 것이다. 감히 십여 년 간 교육가라고 자처해 오던 거짓되고 외람된 생활을 끊어 버리는 것이다. 남편 노릇도 못 하고 아버지 노릇도 못 하는 사람이 남의 스승은 어떻게 되고 지도자는 어떻게 되느냐. 하니까 나는 이제 세상을 떠나 버리는 것이 조금도 슬프지 아니하고 도리어 몸이 가뜬하고 유쾌해지는 것 같다. +오직 하나 마음에 걸리는 것은 내 선배요 사랑하는 동지이던 남 선생의 유일한 혈육이던 네게다가 누명을 씌우고 가는 것이다." +"그게 어디 아버지 잘못입니까?" +하고 정임은 입술을 깨물었소. +"모두 제가 철이 없어서 저 때문에……." +하고 정임은 몸을 떨고 울었소. +"아니! 그렇게 생각하지 마라. 내가 지금 세상을 버릴 때에 무슨 기쁨이 한 가지 남는 것이 있다고 하면 너 하나가, 이 세상에서 오직 너 하나가 나를 따라 주는 것이다. 아마 너도 나를 잘못 알고 따라 주는 것이겠지마는 세상이 다 나를 버리고, 처자까지도 다 나를 버릴 때에 오직 너 하나가 나를 소중히 알아 주니 어찌 고맙지 않겠느냐. 그러니까 정임아 너는 몸을 조심하여서 건강을 회복하여서 오래 잘 살고, 그리고 나를 생각해 다오." +하고 나도 울었소. +형! 내가 정임에게 이런 말을 한 것이 잘못이지요. 그러나 나는 그 때에 이런 말을 아니 할 수 없었소. 왜 그런고 하니, 그것이 내 진정이니까. 나도 학교 선생으로, 교장으로, 또 주제넘게 지사로의 일생을 보내노라고 마치 오직 얼음 같은 의지력만 가진 사람 모양으로 사십 평생을 살아 왔지마는 내 속에도 열정은 있었던 것이오. 다만 그 열정을 누르고 죽이고 있었을 뿐이오. 물론 나는 아마 일생에 이 열정의 고삐를 놓아 줄 날이 없겠지요. 만일 내가 이 열정의 고삐를 놓아서 자유로 달리게 한다고 하면 나는 이 경우에 정임을 안고, 내 열정으로 정임을 태워 버렸을는지도 모르오. 그러나 나는 정임이가 열정으로 탈수록 나는 내 열정의 고삐를 두 손으로 꽉 붙들고 이를 악물고 매달릴 결심을 한 것이오. +열한 시! +"정임아. 인제 병원으로 가거라." +하고 나는 엄연하게 명령하였소. +"내일 저를 보시고 떠나시지요?" +하고 정임은 눈물을 씻고 물었소. +"그럼, J조교수도 만나고 너도 보고 떠나지." +하고 나는 거짓말을 하였소. 이 경우에 내가 거짓말쟁이라는 큰 죄인이 되는 것이 정임에게 대하여 정임을 위하여 가장 옳은 일이라고 생각한 까닭이오. +정임은, 무서운 직각력과 상상력을 가진 정임은 내 말의 진실성을 의심하는 듯이 나를 뚫어지게 바라보았소. 나는 차마 정임의 시선을 마주 보지 못하여 외면하여 버렸소. +정임은 수건으로 눈물을 씻고 체경 앞에 가서 화장을 고치고 그리고, +"저는 가요." +하고 내 앞에 허리를 굽혀서 작별 인사를 하였소. +"오, 가 자거라." +하고 나는 극히 범연하게 대답하였소. 나는 자리옷을 입었기 때문에 현관까지 작별할 수도 없어서 보이를 불러 자동차를 하나 준비하라고 명하고 내 방에서 작별할 생각을 하였소. +"내일 병원에 오세요?" +하고 정임은 고개를 숙이고 낙루하였소. +"오, 가마." +하고 나는 또 거짓말을 하였소. 세상을 버리기로 결심한 사람의 거짓말은 하나님께서도 용서하시겠지요. 설사 내가 거짓말을 한 죄로 지옥에 간다 하더라도 이 경우에 정임을 위하여 거짓말을 아니 할 수가 없지 않소? 내가 거짓말을 아니 하면 정임은 아니 갈 것이 분명하였소. +"전 가요." +하고 정임은 또 한 번 절을 하였으나 소리를 내어서 울었소. +"울지 마라! 몸 상한다." +하고 나는 정임에게 대한 최후의 친절을 정임의 곁에 한 걸음 가까이 가서 어깨를 또닥또닥하여 주고, 외투를 입혀 주었소. +"안녕히 주무세요." +하고 정임은 문을 열고 나가 버렸소. +정임의 걸어가는 소리가 차차 멀어졌소. +나는 얼빠진 사람 모양으로 그 자리에 우두커니 서 있었소. +창에 부딪히는 빗발 소리가 들리고 자동차 소리가 먼 나라에서 오는 것같이 들리오. 이것이 정임이가 타고 가는 자동차 소리인가. 나는 정임을 따라가서 붙들어 오고 싶었소. 내 몸과 마음은 정임을 따라서 허공에 떠가는 것 같았소. +아아 이렇게 나는 정임을 곁에 두고 싶을까. 이렇게 내가 정임의 곁에 있고 싶을까. 그러하건마는 나는 정임을 떼어 버리고 가지 아니하면 아니 된다! 그것은 애끓는 일이다. 기막히는 일이다! 그러나 내 도덕적 책임은 엄정하게 그렇게 명령하지 않느냐. 나는 이 도덕적 책임의 명령 그것은 더위가 없는 명령이다 을 털끝만치라도 휘어서는 아니 된다. +그러나 정임이가 호텔 현관까지 자동차를 타기 전에 한 번만 더 바라보는 것도 못 할 일일까. 한 번만, 잠깐만 더 바라보는 것도 못 할 일일까. 잠깐만 일 분만 아니 일 초만 한 시그마라는 극히 짧은 동안만 바라보는 것도 못 할 일일까. 아니, 정임을 한 시그마 동안만 더 보고 싶다 나는 이렇게 생각하고 벌떡 일어나서 도어의 핸들에 손을 대었소. +`안 된다! 옳잖다!' +하고 나는 내 소파에 돌아와서 털썩 몸을 던졌소. +`최후의 순간이 아니냐. 최후의 순간에 용감히 이겨야 할 것이 아니냐. 아서라! 아서라!' +하고 나는 혼자 주먹을 불끈불끈 쥐었소. +이 때에 짜박짜박 하고 걸어오는 소리가 들리오. 내 가슴은 쌍방망이로 두들기는 것같이 뛰었소. +`설마 정임일까.' +하면서도 나는 숨을 죽이고 귀를 기울였소. +그 발자국 소리는 분명 내 문 밖에 와서 그쳤소. 그리고는 소리가 없었소. +`내 귀의 환각인가.' +하고 나는 한숨을 내쉬었소. +그러나 다음 순간 또 두어 번 문을 두드리는 소리가 들렸소. +"이에스." +하고 나는 대답하고 문을 바라보았소. +문이 열렸소. +들어오는 이는 정임이었소. +"웬일이냐." +하고 나는 엄숙한 태도를 지었소. 그것으로 일 초의 일천분지 일이라도 다시 한 번 보고 싶던 정임을 보고 기쁨을 카무플라주한 것이오. +정임은 서슴지 않고 내 뒤에 와서 내 교의에 몸을 기대며, +"암만해도 오늘이 마지막인 것만 같아서, 다시 뵈올 기약은 없는 것만 같아서 가다가 도로 왔습니다. 한 번만 더 뵙고 갈 양으로요. 그래 도로 와서도 들어올까 말까 하고 주저주저하다가 이것이 마지막인데 하고 용기를 내어서 들어왔습니다. 내일 저를 보시고 가신다는 것이 부러 하신 말씀만 같고, 마지막 뵈옵고, 뵈온대도 그래도 한 번 더 뵈옵기만 해도……." +하고 정임의 말은 끝을 아물지 못하였소. 그는 내 등 뒤에 서 있기 때문에 그가 어떠한 표정을 하고 있는지는 볼 수가 없었소. 나는 다만 아버지의 위엄으로 정면을 바라보고 있었을 뿐이오. +`정임아, 나도 네가 보고 싶었다. 네 뒤를 따라가고 싶었다. 내 몸과 마음은 네 뒤를 따라서 허공으로 날았다. 나는 너를 한 초라도 한 초의 천분지 일 동안이라도 한 번 더 보고 싶었다. 정임아, 내 진정은 너를 언제든지 내 곁에 두고 싶다. 정임아, 지금 내 생명이 가진 것은 오직 너뿐이다.' +이런 말이라도 하고 싶었소. 그러나 이런 말을 하여서는 아니 되오! 만일 내가 이런 말을 하여 준다면 정임이가 기뻐하겠지요. 그러나 나는 정임이에게 이런 기쁨을 주어서는 아니 되오! +나는 어디까지든지 아버지의 위엄, 아버지의 냉정함을 아니 지켜서는 아니 되오. +그렇지마는 내 가슴에 타오르는 이름지을 수 없는 열정의 불길은 내 이성과 의지력을 태워 버리려 하오. 나는 눈이 아뜩아뜩함을 깨닫소. 나는 내 생명의 불길이 깜박깜박함을 깨닫소. +그렇지마는! 아아 그렇지마는 나는 이 도덕적 책임의 무상 명령의 발령자인 쓴 잔을 마시지 아니하여서는 아니 되는 것이오. +`산! 바위!' +나는 정신을 가다듬어서 이것을 염하였소. +그러나 열정의 파도가 치는 곳에 산은 움직이지 아니하오? 바위는 흔들리지 아니하오? 태산과 반석이 그 흰 불길에 타서 재가 되지는 아니하오? 인생의 모든 힘 가운데 열정보다 더 폭력적인 것이 어디 있소? 아마도 우주의 모든 힘 가운데 사람의 열정과 같이 폭력적, 불가항력적인 것은 없으리라. 뇌성, 벽력, 글쎄 그것에나 비길까. 차라리 천체와 천체가 수학적으로 계산할 수 없는 비상한 속력을 가지고 마주 달려들어서 우리의 귀로 들을 수 없는 큰 소리와 우리가 굳다고 일컫는 금강석이라도 증기를 만들고야 말 만한 열을 발하는 충돌의 순간에나 비길까. 형. 사람이라는 존재가 우주의 모든 존재 중에 가장 비상한 존재인 것 모양으로 사람의 열정의 힘은 우주의 모든 신비한 힘 가운데 가장 신비한 힘이 아니겠소? 대체 우주의 모든 힘은 그것이 아무리 큰 힘이라고 하더라도 저 자신을 깨뜨리는 것은 없소. 그렇지마는 사람이라는 존재의 열정은 능히 제 생명을 깨뜨려 가루를 만들고 제 생명을 살라서 소지를 올리지 아니하오? 여보, 대체 이에서 더 폭력이요, 신비적인 것이 어디 있단 말이오. +이 때 내 상태, 어깨 뒤에서 열정으로 타고 섰는 정임을 느끼는 내 상태는 바야흐로 대폭발, 대충돌을 기다리는 아슬아슬한 때가 아니었소. 만일 조금만이라도 내가 내 열정의 고삐에 늦춤을 준다고 하면 무서운 대폭발이 일어났을 것이오. +"정임아!" +하고 나는 충분히 마음을 진정해 가지고 고개를 옆으로 돌려 정임의 얼굴을 찾았소. +"네에." +하고 정임은 입을 약간 내 귀 가까이로 가져와서 그 씨근거리는 소리가 분명히 내 귀에 들리고 그 후끈후끈하는 뜨거운 입김이 내 목과 뺨에 감각되었소. +억지로 진정하였던 내 가슴은 다시 설레기를 시작하였소. 그 불규칙한 숨소리와 뜨거운 입김 때문이었을까. +"시간 늦는다. 어서 가거라. 이 아버지는 언제까지든지 너를 사랑하는 딸 로 소중히 소중히 가슴에 품고 있으마. 또 후일에 다시 만날 때도 있을지 아느냐. 설사 다시 만날 때가 없다기로니 그것이 무엇이 그리 대수냐. 나이 많은 사람은 먼저 죽고 젊은 사람은 오래 살아서 인생의 일을 많이 하는 것이 순서가 아니냐. 너는 몸이 아직 약하니 마음을 잘 안정해서 어서 건강을 회복하여라. 그리고 굳세게 굳세게, 힘있게 힘있게 살아 다오. 조선은 사람을 구한다. 나 같은 사람은 인제 조선서 더 일할 자격을 잃어버린 사람이지마는 네야 어떠냐. 설사 누가 무슨 말을 해서 학교에서 학비를 아니 준다거든 내가 네게 준 재산을 가지고 네 마음대로 공부를 하려무나. 네가 그렇게 해 주어야 나를 위하는 것이다. 자 인제 가거라. 네 앞길이 양양하지 아니하냐. 자 인제 가거라. 나는 내일 아침 동경을 떠날란다. 자 어서." +하고 나는 화평하게 웃는 낯으로 일어섰소. +정임은 울먹울먹하고 고개를 숙이오. +밖에서는 바람이 점점 강해져서 소리를 하고 유리창을 흔드오. +"그럼, 전 가요." +하고 정임은 고개를 들었소. +"그래. 어서 가거라. 벌써 열한시 반이다. 병원 문은 아니 닫니!" +정임은 대답이 없소. +"어서!" +하고 나는 보이를 불러 자동차를 하나 준비하라고 일렀소. +"갈랍니다." +하고 정임은 고개를 숙여서 내게 인사를 하고 문을 향하여 한 걸음 걷다가 잠깐 주저하더니, 다시 돌아서서, +"저를 한 번만 안아 주셔요. 아버지가 어린 딸을 안듯이 한 번만 안아 주셔요." +하고 내 앞으로 가까이 와 서오. +나는 팔을 벌려 주었소. 정임은 내 가슴을 향하고 몸을 던졌소. 그리고 제 이뺨 저뺨을 내 가슴에 대고 비볐소. 나는 두 팔을 정임의 어깨 위에 가벼이 놓았소. +이러한 지 몇 분이 지났소. 아마 일 분도 다 못 되었는지 모르오. +정임은 내 가슴에서 고개를 들어 나를 뚫어지게 우러러보더니, 다시 내 가슴에 낯을 대더니 아마 내 심장이 무섭게 뛰는 소리를 정임은 들었을 것이오 정임은 다시 고개를 들고, +"어디를 가시든지 편지나 주셔요." +하고 굵은 눈물을 떨구고는 내게서 물러서서 또 한 번 절하고, +"안녕히 가셔요. 만주든지 아령이든지 조선 사람 많이 사는 곳에 가셔서 일하고 사셔요. 돌아가실 생각은 마셔요. 제가, 아버지 말씀대로 혼자 떨어져 있으니 아버지도 제 말씀대로 돌아가실 생각은 마셔요, 네, 그렇다고 대답하셔요!" +하고는 또 한 번 내 가슴에 몸을 기대오. +죽기를 결심한 나는 `오냐, 그러마.' 하는 대답을 할 수는 없었소. 그래서, +"오, 내 살도록 힘쓰마." +하는 약속을 주어서 정임을 돌려보냈소. +정임의 발자국 소리가 안 들리게 된 때에 나는 빠른 걸음으로 옥상 정원으로 나갔소. 비가 막 뿌리오. +나는 정임이가 타고 나가는 자동차라도 볼 양으로 호텔 현관 앞이 보이는 꼭대기로 올라갔소. 현관을 떠난 자동차 하나가 전찻길로 나서서는 북을 향하고 달아나서 순식간에 그 꽁무니에 달린 붉은 불조차 스러져 버리고 말았소. +나는 미친 사람 모양으로, +"정임아, 정임아!" +하고 수없이 불렀소. 나는 사 층이나 되는 이 꼭대기에서 뛰어내려서 정임이가 타고 간 자동차의 뒤를 따르고 싶었소. +"아아 영원한 인생의 이별!" +나는 그 옥상에 얼마나 오래 섰던지를 모르오. 내 머리와 낯과 배스로브에서는 물이 흐르오. 방에 들어오니 정임이가 끼치고 간 향기와 추억만 남았소. +나는 방 안 구석구석에 정임의 모양이 보이는 것을 깨달았소. 특별히 정임이가 고개를 숙이고 서 있던 내 교의 뒤에는 분명히 갈색 외투를 입은 정임의 모양이 완연하오. +"정임아!" +하고 나는 그 곳으로 따라가오. 그러나 가면 거기는 정임은 없소. +나는 교의에 앉소. 그러면 정임의 씨근씨근하는 숨소리와 더운 입김이 분명 내 오른편에 감각이 되오. 아아 무서운 환각이여! +나는 자리에 눕소. 그리고 정임의 환각을 피하려고 불을 끄오. 그러면 정임이가 내게 안기던 자리쯤에 환하게 정임의 모양이 나타나오. +나는 불을 켜오. 또 불을 끄오. +날이 밝자 나는 비가 갠 것을 다행으로 비행장에 달려가서 비행기를 얻어 탔소. +나는 다시 조선의 하늘을 통과하기가 싫어서 북강에서 비행기에서 내려서 문사에 와서 대련으로 가는 배를 탔소. +나는 대련에서 내려서 하룻밤을 여관에서 자고는 곧 장춘 가는 급행을 탔소. 물론 아무에게도 엽서 한 장 한 일 없었소. 그것은 인연을 끊은 세상에 대하여 연연한 마음을 가지는 것을 부끄럽게 생각한 까닭이오. +차가 옛날에는 우리 조상네가 살고 문화를 짓던 옛 터전인 만주의 벌판을 달릴 때에는 감회도 없지 아니하였소. 그러나 나는 지금 그런 한가한 감상을 쓸 겨를이 없소. +내가 믿고 가는 곳은 하얼빈에 있는 어떤 친구요. 그는 R라는 사람으로서 경술년에 A씨 등의 망명객을 따라 나갔다가 아라사에서 무관 학교를 졸업하고 아라사 사관으로서 구주 대전에도 출정을 하였다가, 혁명 후에도 이내 적위군에 머물러서 지금까지 소비에트 장교로 있는 사람이오. 지금은 육군 소장이라던가. +나는 하얼빈에 그 사람을 찾아가는 것이오. 그 사람을 찾아야 아라사에 들어갈 여행권을 얻을 것이요, 여행권을 얻어야 내가 평소에 이상하게도 그리워하던 바이칼 호를 볼 것이오. +하얼빈에 내린 것은 해가 뉘엿뉘엿 넘어가는 석양이었소. +나는 안중근이 이등박문(伊藤博文:이토 히로부미)을 쏜 곳이 어딘가 하고 벌판과 같이 넓은 플랫폼에 내렸소. 과연 국제 도시라 서양 사람, 중국 사람, 일본 사람이 각기 제 말로 지껄이오. 아아 조선 사람도 있을 것이오마는 다들 양복을 입거나 청복을 입거나 하고 또 사람이 많은 곳에서는 말도 잘 하지 아니하여 아무쪼록 조선 사람인 것을 표시하지 아니하는 판이라 그 골격과 표정을 살피기 전에는 어느 것이 조선 사람인지 알 길이 없소. 아마 허름하게 차리고 기운 없이, 비창한 빛을 띠고 사람의 눈을 슬슬 피하는 저 순하게 생긴 사람들이 조선 사람이겠지요. 언제나 한 번 가는 곳마다 동양이든지, 서양이든지, +`나는 조선 사람이오!' +하고 뽐내고 다닐 날이 있을까 하면 눈물이 나오. 더구나, 하얼빈과 같은 각색 인종이 모여서 생존 경쟁을 하는 마당에 서서 이런 비감이 간절하오. 아아 이 불쌍한 유랑의 무리 중에 나도 하나를 더 보태는가 하면 눈물을 씻지 아니할 수 없었소. +나는 역에서 나와서 어떤 아라사 병정 하나를 붙들고 R의 아라사 이름을 불렀소. 그리고 아느냐고 영어로 물었소. +그 병정은 내 말을 잘못 알아들었는지, 또는 R를 모르는지 무엇이라고 아라사말로 지껄이는 모양이나 나는 물론 그것을 알아들을 수가 없었소. 그러나 나는 그 병정의 표정에서 내게 호의를 가진 것을 짐작하고 한 번 더 분명히, +"요십 알렉산드로비치 리가이." +라고 불러 보았소. +그 병정은 빙그레 웃고 고개를 흔드오. 이 두 외국 사람의 이상한 교섭에 흥미를 가지고 여러 아라사 병정과 동양 사람들이 십여 인이나 우리 주위에 모여드오. +그 병정이 나를 바라보고 또 한 번 그 이름을 불러 보라는 모양 같기로 나는 이번에는 R의 아라사 이름에 `제너럴'이라는 말을 붙여 불러 보았소. +그랬더니 어떤 다른 병정이 뛰어들며, +"게네라우 리가이!" +하고 안다는 표정을 하오. `게네라우'라는 것이 아마 아라사말로 장군이란 말인가 하였소. +"예스. 예스." +하고 나는 기쁘게 대답하였소. 그리고는 아라사 병정들끼리 무에라고 지껄이더니, 그 중에 한 병정이 나서면서 고개를 끄덕끄덕하고, 제가 마차 하나를 불러서 나를 태우고 저도 타고 어디로 달려가오. +그 아라사 병정은 친절히 알지도 못하는 말로 이것저것을 가리키면서 설명을 하더니 내가 못 알아듣는 줄을 생각하고 내 어깨를 툭 치고 웃소. 어린애와 같이 순한 사람들이구나 하고 나는 고맙다는 표로 고개만 끄덕끄덕하였소. +어디로 어떻게 가는지 서양 시가로 달려가다가 어떤 큰 저택 앞에 이르러서 마차를 그 현관 앞으로 들이몰았소. +현관에서는 종졸이 나왔소. 내가 명함을 들여보냈더니 부관인 듯한 아라사 장교가 나와서 나를 으리으리한 응접실로 인도하였소. 얼마 있노라니 중년이 넘은 어떤 대장이 나오는데 군복에 칼끈만 늘였소. +"이게 누구요." +하고 그 대장은 달려들어서 나를 껴안았소. 이십오 년 만에 만나는 우리는 서로 알아본 것이오. +이윽고 나는 그의 부인과 자녀들도 만났소. 그들은 다 아라사 사람이오. +저녁이 끝난 뒤에 나는 R의 부인과 딸의 음악과 그림 구경과 기타의 관대를 받고 단둘이 이야기할 기회를 얻었소. 경술년 당시 이야기도 나오고, A씨의 이야기도 나오고, R의 신세 타령도 나오고, 내 이십오 년 간의 생활 이야기도 나오고, 소비에트 혁명 이야기도 나오고, 하얼빈 이야기도 나오고, 우리네가 어려서 서로 사귀던 회구담도 나오고 이야기가 그칠 바를 몰랐소. "조선은 그립지 않은가." +하는 내 말에 쾌활하던 R는 고개를 숙이고 추연한 빛을 보였소. +나는 R의 추연한 태도를 아마 고국을 그리워하는 것으로만 여겼소. 그래서 나는 그리 침음하는 것을 보고, +"얼마나 고국이 그립겠나. 나는 고국을 떠난 지가 일 주일도 안 되건마는 못 견디게 그리운데." +하고 동정하는 말을 하였소. +했더니, 이 말 보시오. 그는 침음을 깨뜨리고 고개를 번쩍 들며, +"아니! 나는 고국이 조금도 그립지 아니하이. 내가 지금 생각한 것은 자네 말을 듣고 고국이 그리운가 그리워할 것이 있는가를 생각해 본 것일세. 그랬더니 아무리 생각하여도 나는 고국이 그립다는 생각을 가질 수가 없어. 그야 어려서 자라날 때에 보던 강산이라든지 내 기억에 남은 아는 사람들이라든지, 보고 싶다 하는 생각도 없지 아니하지마는 그것이 고국이 그리운 것이라고 할 수가 있을까. 그 밖에는 나는 아무리 생각하여도 고국이 그리운 것을 찾을 길이 없네. 나도 지금 자네를 보고 또 자네 말을 듣고 오래 잊어버렸던 고국을 좀 그립게, 그립다 하게 생각하려고 해 보았지마는 도무지 나는 고국이 그립다는 생각이 나지 않네." +이 말에 나는 깜짝 놀랐소. 몸서리치게 무서웠소. 나는 해외에 오래 표랑하는 사람은 으레 고국을 그리워할 것으로 믿고 있었소. 그런데 이 사람이, 일찍은 고국을 사랑하여 목숨까지도 바치려던 이 사람이 도무지 이처럼 고국을 잊어버린다는 것은 놀라운 정도를 지나서 괘씸하기 그지없었소. 나도 비록 조선을 떠난다고, 영원히 버린다고 나서기는 했지마는 나로는 죽기 전에는 아니 비록 죽더라도 잊어버리지 못할 고국을 잊어버린 R의 심사가 난측하고 원망스러웠소. +"고국이 그립지가 않아?" +하고 R에게 묻는 내 어성에는 격분한 빛이 있었소. +"이상하게 생각하시겠지. 하지만 고국에 무슨 그리울 것이 있단 말인가. 그 빈대 끓는 오막살이가 그립단 말인가. 나무 한 개 없는 산이 그립단 말인가. 물보다도 모래가 많은 다 늙어빠진 개천이 그립단 말인가. 그 무기력하고 가난한, 시기 많고 싸우고 하는 그 백성을 그리워한단 말인가. 그렇지 아니하면 무슨 그리워할 음악이 있단 말인가, 미술이 있단 말인가, 문학이 있단 말인가, 사상이 있단 말인가, 사모할 만한 인물이 있단 말인가! 날더러 고국의 무엇을 그리워하란 말인가. 나는 조국이 없는 사람일세. 내가 소비에트 군인으로 있으니 소비에트가 내 조국이겠지. 그러나 진심으로 내 조국이라는 생각은 나지 아니하네." +하고 저녁 먹을 때에 약간 붉었던 R의 얼굴은 이상한 흥분으로 더욱 붉어지오.유 정유 정 +R는 먹던 담배를 화나는 듯이 재떨이에 집어던지며, +"내가 하얼빈에 온 지가 인제 겨우 삼사 년밖에 안 되지마는 조선 사람 때문에 나는 견딜 수가 없어. 와서 달라는 것도 달라는 것이지마는 조선 사람이 또 어찌하였느니 또 어찌하였느니 하는 불명예한 말을 들을 때에는 나는 금시에 죽어 버리고 싶단 말일세. 내게 가장 불쾌한 것이 있다고 하면 그것은 고국이라는 기억과 조선 사람의 존잴세. 내가 만일 어느 나라의 독재자가 된다고 하면 나는 첫째로 조선인 입국 금지를 단행하려네. 만일 조선이라는 것을 잊어버릴 약이 있다고 하면 나는 생명과 바꾸어서라도 사 먹고 싶어." +하고 R는 약간 흥분된 어조를 늦추어서, +"나도 모스크바에 있다가 처음 원동에 나왔을 적에는 길을 다녀도 혹시 동포가 눈에 뜨이지나 아니하나 하고 찾았네. 그래서 어디서든지 동포를 만나면 반가이 손을 잡았지. 했지만 점점 그들은 오직 귀찮은 존재에 지나지 못하다는 것을 알았단 말일세. 인제는 조선 사람이라고만 하면 만나기가 무섭고 끔찍끔찍하고 진저리가 나는 걸 어떡허나. 자네 명함이 들어온 때에도 조선 사람인가 하고 가슴이 뜨끔했네." +하고 R는 웃지도 아니하오. 그의 얼굴에는, 군인다운 기운찬 얼굴에는 증오와 분노의 빛이 넘쳤소. +"나도 자네 집에 환영받는 나그네는 아닐세그려." +하고 나는 이 견디기 어려운 불쾌하고 무서운 공기를 완화하기 위하여 농담삼아 한 마디를 던지고 웃었소. +나는 R의 말이 과격함에 놀랐지마는, 또 생각하면 R가 한 말 가운데는 들을 만한 이유도 없지 아니하오. 그것을 생각할 때에 나는 R를 괘씸하게 생각하기 전에 내가 버린다는 조선을 위하여서 가슴이 아팠소. 그렇지만 이제 나 따위가 가슴을 아파한대야 무슨 소용이 있소. 조선에 남아 계신 형이나 R의 말을 참고삼아 쓰시기 바라오. 어쨌으나 나는 R에게서 목적한 여행권을 얻었소. R에게는 다만, +`나는 피곤한 몸을 좀 정양하고 싶다. 나는 내가 평소에 즐겨하는 바이칼 호반에서 눈과 얼음의 한겨울을 지내고 싶다.' +는 것을 여행의 이유로 삼았소. +R는 나의 초췌한 모양을 짐작하고 내 핑계를 그럴듯하게 아는 모양이었소. 그리고 나더러, `이왕 정양하려거든 카프카 지방으로 가거라. 거기는 기후 풍경도 좋고 또 요양원의 설비도 있다.'는 것을 말하였소. 나도 톨스토이의 소설에서, 기타의 여행기 등속에서 이 지방에 관한 말을 못 들은 것이 아니나 지금 내 처지에는 그런 따뜻하고 경치 좋은 지방을 가릴 여유도 없고 또 그러한 지방보다도 눈과 얼음과 바람의 시베리아의 겨울이 합당한 듯하였소. +그러나 나는 R의 호의를 굳이 사양할 필요도 없어서 그가 써 주는 대로 소개장을 다 받아 넣었소. 그는 나를 처남 매부 간이라고 소개해 주었소. +나는 모스크바 가는 다음 급행을 기다리는 사흘 동안 R의 집의 손이 되어서 R부처의 친절한 대우를 받았소. +그 후에는 나는 R와 조선에 관한 토론을 한 일은 없지마는 R가 이름지어 말을 할 때에는 조선을 잊었노라, 그리워할 것이 없노라, 하지마는 무의식적으로 말을 할 때에는 조선을 못 잊고 또 조선을 여러 점으로 그리워하는 양을 보았소. 나는 그것으로써 만족하게 여겼소. +나는 금요일 오후 세시 모스크바 가는 급행으로 하얼빈을 떠났소. 역두에는 R와 R의 가족이 나와서 꽃과 과일과 여러 가지 선물로 나를 전송하였소. R와 R의 가족은 나를 정말 형제의 예로 대우하여 차가 떠나려 할 때에 포옹과 키스로 작별하여 주었소. +이 날은 퍽 따뜻하고 일기가 좋은 날이었소. 하늘에 구름 한 점, 땅에 바람 한 점 없이 마치 늦은 봄날과 같이 따뜻한 날이었소. +차는 떠났소. 판다는 둥 안 판다는 둥 말썽 많은 동중로(지금은 북만 철로라고 하오.)의 국제 열차에 몸을 의탁한 것이오. +송화강(松花江:쑹화 강)의 철교를 건너오. 아아 그리도 낯익은 송화강! 송화강이 왜 낯이 익소. 이 송화강은 불함산(장백산)에 근원을 발하여 광막한 북만주의 사람도 없는 벌판을 혼자 소리도 없이 흘러가는 것이 내 신세와 같소. 이 북만주의 벌판을 만든 자가 송화강이지마는 나는 그만한 힘이 없는 것이 부끄러울 뿐이오. 이 광막한 북만의 벌판을 내 손으로 개척하여서 조선 사람의 낙원을 만들자 하고 뽐내어 볼까. 그것은 형이 하시오. 내 어린것이 자라거든 그놈에게나 그러한 생각을 넣어 주시오. +동양의 국제적 괴물인 하얼빈 시가도 까맣게 안개에서 스러져 버리고 말았소. 그러나 그 시가를 싼 까만 기운이 국제적 풍운을 포장한 것이라고 할까요. +가도가도 벌판. 서리맞은 마른 풀바다. 실개천 하나도 없는 메마른 사막. 어디를 보아도 산 하나 없으니 하늘과 땅이 착 달라붙은 듯한 천지. 구름 한 점 없건만도 그 큰 태양 가지고도 미처 다 비추지 못하여 지평선 호를 그린 지평선 위에는 항상 황혼이 떠도는 듯한 세계. 이 속으로 내가 몸을 담은 열차는 서쪽으로 서쪽으로 해가 가는 걸음을 따라서 달리고 있소. 열차가 달리는 바퀴 소리도 반향할 곳이 없어 힘없는 한숨같이 스러지고 마오. +기쁨 가진 사람이 지루해서 못 견딜 이 풍경은 나같이 수심 가진 사람에게는 가장 공상의 말을 달리기에 합당한 곳이오. +이 곳에도 산도 있고 냇물도 있고 삼림도 있고 꽃도 피고 날짐승, 길짐승이 날고 기던 때도 있었겠지요. 그러던 것이 몇만 년 지나는 동안에 산은 낮아지고 골은 높아져서 마침내 이 꼴이 된 것인가 하오. 만일 큰 힘이 있어 이 광야를 파낸다 하면 물 흐르고 고기 놀던 강과, 울고 웃던 생물이 살던 자취가 있을 것이오. 아아 이 모든 기억을 꽉 품고 죽은 듯이 잠잠한 광야에! +내가 탄 차가 F역에 도착하였을 때에는 북만주 광야의 석양의 아름다움은 그 극도에 달한 것 같았소. 둥긋한 지평선 위에 거의 걸린 커다란 해! 아마 그 신비하고 장엄함이 내 경험으로는 이 곳에서밖에는 볼 수 없는 것이라고생각하오. 이글이글 이글이글 그러면서도 둥글다는 체모를 변치 아니하는 그 지는 해! +게다가 먼 지평선으로부터 기어드는 황혼은 인제는 대지를 거의 다 덮어 버려서 마른 풀로 된 지면은 가뭇가뭇한 빛을 띠고 사막의 가는 모래를 머금은 지는 해의 광선을 반사하여서 대기는 짙은 자줏빛을 바탕으로 한 가지각색의 명암을 가진, 오색이 영롱한, 도무지 내가 일찍 경험해 보지 못한 색채의 세계를 이루었소. 아 좋다! +그 속에 수은같이 빛나는, 수없는 작고 큰 호수들의 빛! 그 속으로 날아오는 수없고 이름 모를 새들의 떼도 이 세상의 것이라고는 생각하지 아니하오. +나는 거의 무의식적으로 차에서 뛰어내렸소. 거의 떠날 시간이 다 되어서 짐의 일부분은 미처 가지지도 못하고 뛰어내렸소. 반쯤 미친 것이오. +정거장 앞 조그마한 아라사 사람의 여관에다가 짐을 맡겨 버리고 나는 단장을 끌고 철도 선로를 뛰어 건너서 호수의 수은빛 나는 곳을 찾아서 지향 없이 걸었소. +한 호수를 가서 보면 또 저 편 호수가 더 아름다워 보이오. 원컨대 저 지는 해가 다 지기 전에 이 광야에 있는 호수를 다 돌아보고 싶소. +내가 호숫 가에 섰을 때에 그 거울같이 잔잔한 호수면에 비치는 내 그림자의 외로움이여, 그러나 아름다움이여! 그 호수는 영원한 우주의 신비를 품고 하늘이 오면 하늘을, 새가 오면 새를, 구름이 오면 구름을, 그리고 내가 오면 나를 비추지 아니하오. 나는 호수가 되고 싶소. 그러나 형! 나는 이 호수면에서 얼마나 정임의 얼굴을 찾았겠소. 그것은 물리학적으로 불가능한 일이겠지요. 동경의 병실에 누워 있는 정임의 모양이 몽고 사막의 호수면에 비칠 리야 있겠소. 없겠지마는 나는 호수마다 정임의 그림자를 찾았소. 그러나 보이는 것은 외로운 내 그림자뿐이오. +`가자. 끝없는 사막으로 한없이 가자. 가다가 내 기운이 진하는 자리에 나는 내 손으로 모래를 파고 그 속에 내 몸을 묻고 죽어 버리자. 살아서 다시 볼 수 없는 정임의 「이데아」를 안고 이 깨끗한 광야에서 죽어 버리 자.' +하고 나는 지는 해를 향하고 한정 없이 걸었소. 사막이 받았던 따뜻한 기운은 아직도 다 식지는 아니하였소. 사막에는 바람 한 점도 없소. 소리 하나도 없소. 발자국 밑에서 우는 마른 풀과 모래의 바스락거리는 소리가 들릴 뿐이오. +나는 허리를 지평선에 걸었소. 그 신비한 광선은 내 가슴으로부터 위에만을 비추고 있소. +문득 나는 해를 따라가는 별 두 개를 보았소. 하나는 앞을 서고 하나는 뒤를 섰소. 앞의 별은 좀 크고 뒤의 별은 좀 작소. 이런 별들은 산 많은 나라 다시 말하면 서쪽 지평선을 보기 어려운 나라에서만 생장한 나로서는 보지 못하던 별이오. 나는 그 별의 이름을 모르오. `두 별'이오. +해가 지평선에서 뚝 떨어지자 대기의 자줏빛은 남빛으로 변하였소. 오직 해가 금시 들어간 자리에만 주홍빛의 여광이 있을 뿐이오. 내 눈앞에서는 남빛 안개가 피어오르는 듯하였소. 앞에 보이는 호수만이 유난히 빛나오. 또 한 떼의 이름 모를 새들이 수면을 스치며 날 저문 것을 놀라는 듯이 어지러이 날아 지나가오. 그들은 소리도 아니 하오. 날개치는 소리도 아니 들리오. 그것들은 사막의 황혼의 허깨비인 것 같소. +나는 자꾸 걷소. 해를 따르던 나는 두 별을 따라서 자꾸 걷소. +별들은 진 해를 따라서 바삐 걷는 것도 같고, 헤매는 나를 어떤 나라로 끄는 것도 같소. +아니 두 별 중에 앞선 별이 한 번 반짝하고는 최후로 한 번 반짝하고는 지평선 밑에 숨어 버리고 마오. 뒤에 남은 외별의 외로움이여! 나는 울고 싶었소. 그러나 나는 하나만 남은 작은 별 외로운 작은 별을 따라서 더 빨리 걸음을 걸었소. 그 한 별마저 넘어가 버리면 나는 어찌하오. +내가 웬일이오. 나는 시인도 아니요, 예술가도 아니오. 나는 정으로 행동한 일은 없다고 믿는 사람이오. 그러나 형! 이 때에 미친 것이 아니요, 내 가슴에는 무엇인지 모를 것을 따를 요샛말로 이른바 동경으로 찼소. +`아아 저 작은 별!' +그것도 지평선에 닿았소. +`아아 저 작은 별. 저것마저 넘어가면 나는 어찌하나.' +인제는 어둡소. 광야의 황혼은 명색뿐이요, 순식간이요, 해지자 신비하다고 할 만한 극히 짧은 동안에 아름다운 황혼을 조금 보이고는 곧 칠과 같은 암흑이오. 호수의 물만이 어디서 은빛을 받았는지 뿌옇게 나만이 유일한 존재다, 나만이 유일한 빛이다 하는 듯이 인제는 수은빛이 아니라 남빛을 발하고 있을 뿐이오. +나는 그 중 빛을 많이 받은, 그 중 환해 보이는 호수면을 찾아 두리번거리며, 그러나 빠른 걸음으로 헤매었소. 그러나 내가 좀더 맑은 호수면을 찾는 동안에 이 광야의 어둠은 더욱더욱 짙어지오. +나는 어떤 조그마한 호숫 가에 펄썩 앉았소. 내 앞에는 짙은 남빛의 수면에 조그마한 거울만한 밝은 데가 있소. 마치 내 눈에서 무슨 빛이 나와서, 아마 정임을 그리워하는 빛이 나와서 그 수면에 반사하는 듯이. 나는 허겁지겁 그 빤한 수면을 들여다보았소. 혹시나 정임의 모양이 거기 나타나지나 아니할까 하고. 세상에는 그러한 기적도 있지 아니한가 하고. +물에는 정임의 얼굴이 어른거리는 것 같았소. 이따금 정임의 눈도 어른거리고 코도 번뜻거리고 입도 번뜻거리는 것 같소. 그러나 수면은 점점 어두워 가서 그 환영조차 더욱 희미해지오. +나는 호수면에 빤하던 한 조각조차 캄캄해지는 것을 보고 숨이 막힐 듯함을 깨달으면서 고개를 들었소. +고개를 들려고 할 때에, 형이여, 이상한 일도 다 있소. 그 수면에 정임의 모양이, 얼굴만 아니라, 그 몸 온통이 그 어깨, 가슴, 팔, 다리까지도, 그 눈과 입까지도, 그 얼굴의 흰 것과 입술이 불그레한 것까지도, 마치 환한 대낮에 실물을 대한 모양으로 소상하게 나타났소. +"정임이!" +하고 나는 소리를 지르며 물로 뛰어들려 하였소. 그러나 형, 그 순간에 정임의 모양은 사라져 버리고 말았소. +나는 이 어둠 속에 어디 정임이가 나를 따라온 것같이 생각했소. 혹시나 정임이가 죽어서 그 몸은 동경의 대학 병원에 벗어 내어던지고 혼이 빠져 나와서 물에 비치었던 것이 아닐까, 나는 가슴이 울렁거림을 진정치 못하면서 호숫 가에서 벌떡 일어나서 어둠 속에 정임을 만져보려는 듯이, 어두워서 눈에 보지는 못하더라도 자꾸 헤매노라면 몸에 부딪히기라도 할 것 같아서 함부로 헤매었소. 그리고는 눈앞에 번뜻거리는 정임의 환영을 팔을 벌려서 안고 소리를 내어서 불렀소. +"정임이, 정임이." +하고 나는 수없이 정임을 부르면서 헤매었소. +그러나 형, 이것도 죄지요. 이것도 하나님께서 금하시는 일이지요. 그러길래 광야에 아주 어둠이 덮이고 새까만 하늘에 별이 총총하게 나고는 영 정임의 헛그림자조차 아니 보이지요. 나는 죄를 피해서 정임을 떠나서 멀리 온 것이니 정임의 헛그림자를 따라다니는 것도 옳지 않지요. +그렇지만 내가 이렇게 혼자서 정임을 생각만 하는 것이야 무슨 죄 될 것이 있을까요. 내가 정임을 만 리나 떠나서 이렇게 헛그림자나 그리며 그리워하는 것이야 무슨 죄가 될까요. 설사 죄가 되기로서니 낸들 이것까지야 어찌하오. 내가 내 혼을 죽여 버리기 전에야 내 힘으로 어찌하오. 설사 죄가 되어서 내가 지옥의 꺼지지 않는 유황불 속에서 영원한 형벌을 받게 되기로서니 그것을 어찌하오. 형, 이것, 이것도 말아야 옳은가요. 정임의 헛그림자까지도 끊어 버려야 옳은가요. +이 때요. 바로 이 때요. 내 앞 수십 보나 될까(캄캄한 밤이라 먼지 가까운지 분명히 알 수 없지마는) 하는 곳에 난데없는 등불 하나가 나서오. 나는 깜짝 놀라서 우뚝 섰소. 이 무인지경, 이 밤중에 갑자기 보이는 등불 그것은 마치 이 세상 같지 아니하였소. +저 등불이 어떤 등불일까, 그 등불이 몇 걸음 가까이 오니, 그 등불 뒤에 사람의 다리가 보이오. +"누구요?" +하는 것은 귀에 익은 조선말이오. 어떻게 이 몽고의 광야에서 조선말을 들을까 하고 나는 등불을 처음 볼 때보다 더욱 놀랐소. +"나는 지나가던 사람이오." +하고 나도 등불을 향하여 마주 걸어갔소. +그 사람은 등불을 들어서 내 얼굴을 비추어 보더니, +"당신 조선 사람이오?" +하고 묻소. +"네, 나는 조선 사람이오. 당신도 음성을 들으니 조선 사람인데, 어떻게 이런 광야에, 아닌 밤중에, 여기 계시단 말이오." +하고 나는 놀라는 표정 그대로 대답하였소. +"나는 이 근방에 사는 사람이니까 여기 오는 것도 있을 일이지마는 당신이야말로 이 아닌 밤중에." +하고 육혈포를 집어넣고, 손을 내밀어서 내게 악수를 구하오. +나는 반갑게 그의 손을 잡았소. 그러나 나는 `죽을 지경에 어떻게 오셨단 말이오.' 하고, 그가 내가 무슨 악의를 가진 흉한이 아닌 줄을 알고 손에 빼어들었던 육혈포로 시기를 잠깐이라도 노린 것을 불쾌하게 생각하였던 것이오. +그도 내 이름도 묻지 아니하고 또 나도 그의 이름을 묻지 아니하고 나는 그에게 끌려서 그가 인도하는 곳으로 갔소. 그 곳이란 것은 아까 등불이 처음 나타나던 곳인 듯한데, 거기서 또 한 번 놀란 것은 어떤 부인이 있는 것이오. 남자는 아라사식 양복을 입었으나 부인은 중국 옷 비슷한 옷을 입었소. 남자는 나를 끌어서 그 부인에게 인사하게 하고, +"이는 내 아내요." +하고 또 그 아내라는 부인에게는, +"이 이는 조선 양반이오. 성함이 뉘시죠?" +하고 그는 나를 바라보오. 나는, +"최석입니다." +하고 바로 대답하였소. +"최석 씨?" +하고 그 남자는 소개하던 것도 잊어버리고 내 얼굴을 들여다보오. +"네, 최석입니다." +"아 ●●학교 교장으로 계신 최석 씨." +하고 그 남자는 더욱 놀라오. +"네, 어떻게 내 이름을 아세요?" +하고 나도 그가 혹시 아는 사람이나 아닌가 하고 등불 빛에 얼굴을 들여다 보았으나 도무지 그 얼굴이 본 기억이 없소. +"최 선생을 내가 압니다. 남 선생한테 말씀을 많이 들었지요. 그런데 남 선생도 돌아가신 지가 벌써 몇 핸가." +하고 감개무량한 듯이 그 아내를 돌아보오. +"십오 년이지요." +하고 곁에 섰던 부인이 말하오. +"벌써 십오 년인가." +하고 그 남자는 나를 보고, +"정임이 잘 자랍니까? 벌써 이십이 넘었지." +하고 또 부인을 돌아보오. +"스물세 살이지." +하고 부인이 확실치 아니한 듯이 대답하오. +"네, 스물세 살입니다. 지금 동경에 있습니다. 병이 나서 입원한 것을 보고 왔는데." +하고 나는 번개같이 정임의 병실과 정임의 호텔 장면 등을 생각하고 가슴이 설렘을 깨달았소. 의외인 곳에서 의외인 사람들을 만나서 정임의 말을 하게 된 것을 기뻐하였소. +"무슨 병입니까. 정임이가 본래 몸이 약해서." +하고 부인이 직접 내게 묻소. +"네. 몸이 좀 약합니다. 병이 좀 나은 것을 보고 떠났습니다마는 염려가 됩니다." +하고 나는 무의식중에 고개를 동경이 있는 방향으로 돌렸소. 마치 고개를 동으로 돌리면 정임이가 보이기나 할 것같이. +"자, 우리 집으로 갑시다." +하고 나는 아직 그의 성명도 모르는 남자는, 그의 아내를 재촉하더니, +"우리가 조선 동포를 만난 것이 십여 년 만이오. 그런데 최 선생, 이것을 좀 보시고 가시지요." +하고 그는 빙그레 웃으면서 나를 서너 걸음 끌고 가오. 거기는 조그마한 무덤이 있고 그 앞에는 석 자 높이나 되는 목패를 세웠는데 그 목패에는 `두 별 무덤'이라는 넉 자를 썼소. +내가 이상한 눈으로 그 무덤과 목패를 보고 있는 것을 보고 그는, +"이게 무슨 무덤인지 아십니까?" +하고 유쾌하게 묻소. +"두 별 무덤이라니 무슨 뜻인가요?" +하고 나도 그의 유쾌한 표정에 전염이 되어서 웃고 물었소. +"이것은 우리 둘의 무덤이외다." +하고 그는 아내의 어깨를 치며 유쾌하게 웃었소. 부인은 부끄러운 듯이 웃고 고개를 숙이오. +도무지 모두 꿈 같고 환영 같소. +"자 갑시다. 자세한 말은 우리 집에 가서 합시다." +하고 서너 걸음 어떤 방향으로 걸어가니 거기는 말을 세 필이나 맨 마차가 있소. 몽고 사람들이 가족을 싣고 수초를 따라 돌아다니는 그러한 마차요. 삿자리로 홍예형의 지붕을 만들고 그 속에 들어가 앉게 되었소. 그의 부인과 나와는 이 지붕 속에 들어앉고 그는 손수 어자대에 앉아서 입으로 쮸쮸쮸쮸 하고 말을 모오. 등불도 꺼 버리고 캄캄한 속으로 달리오. +"불이 있으면 군대에서 의심을 하지요. 도적놈이 엿보지요. 게다가 불이 있으면 도리어 앞이 안 보인단 말요. 쯧쯧쯧쯧!" +하는 소리가 들리오. +대체 이 사람은 무슨 사람인가. 또 이 부인은 무슨 사람인가 하고 나는 어두운 속에서 혼자 생각하였소. 다만 잠시 본 인상으로 보아서 그들은 행복된 부부인 것 같았소. 그들이 무엇 하러 이 아닌 밤중에 광야에 나왔던가. 또 그 이상야릇한 두 별 무덤이란 무엇인가. +나는 불현듯 집을 생각하였소. 내 아내와 어린것들을 생각하였소. 가정과 사회에서 쫓겨난 내가 아니오. 쫓겨난 자의 생각은 언제나 슬픔뿐이었소. +나는 내 아내를 원망치 아니하오. 그는 결코 악한 여자가 아니오. 다만 보통 여자요. 그는 질투 때문에 이성의 힘을 잃은 것이오. 여자가 질투 때문에 이성을 잃는 것이 천직이 아닐까요. 그가 나를 사랑하길래 나를 위해서 질투를 가지는 것이 아니오. +설사 질투가 그로 하여금 칼을 들어 내 가슴을 찌르게 하였다 하더라도 나는 감사한 생각을 가지고 눈을 감을 것이오. 사랑하는 자는 질투한다고 하오. 질투를 누르는 것도 아름다운 일이지마는 질투에 타는 것도 아름다운 일이 아닐까요. +덜크럭덜크럭 하고 차바퀴가 철로길을 넘어가는 소리가 나더니 이윽고 마차는 섰소. +앞에 빨갛게 불이 비치오. +"자 이게 우리 집이오." +하고 그가 마차에서 뛰어내리는 양이 보이오. 내려 보니까 달이 올라오오. 굉장히 큰 달이, 붉은 달이 지평선으로서 넘석하고 올라오오. +달빛에 비추인 바를 보면 네모나게 담 담이라기보다는 성을 둘러쌓은 달 뜨는 곳으로 열린 대문을 들어서서 넓은 마당에 내린 것을 발견하였소. +"아버지!" +"엄마!" +하고 아이들이 뛰어나오오. 말만큼이나 큰 개가 네 놈이나 꼬리를 치고 나오오. 그놈들이 주인집 마차 소리를 알아듣고 짖지 아니한 모양이오. +큰 아이는 계집애로 여남은 살, 작은 아이는 사내로 육칠 세, 모두 중국 옷을 입었소. +우리는 방으로 들어갔소. 방은 아라사식 절반, 중국식 절반으로 세간이 놓여 있고 벽에는 조선 지도와 단군의 초상이 걸려 있소. +그들 부처는 지도와 단군 초상 앞에 허리를 굽혀 배례하오. 나도 무의식적으로 그대로 하였소. +그는 차를 마시며 이렇게 말하오. +"우리는 자식들을 이 흥안령 가까운 무변 광야에서 기르는 것으로 낙을 삼고 있지요. 조선 사람들은 하도 마음이 작아서 걱정이니 이런 호호탕탕한 넓은 벌판에서 길러나면 마음이 좀 커질까 하지요. 또 흥안령 밑에서 지나 중원을 통일한 제왕이 많이 났으니 혹시나 그 정기가 남아 있을까 하지요. 우리 부처의 자손이 몇 대를 두고 퍼지는 동안에는 행여나 마음 큰 인물이 하나 둘 날는지 알겠어요, 하하하하." +하고 그는 제 말을 제가 비웃는 듯이 한바탕 웃고 나서, +"그러나 이건 내 진정이외다. 우리도 이렇게 고국을 떠나 있지마는 그래도 고국 소식이 궁금해서 신문 하나는 늘 보지요. 하지만 어디 시원한 소식이 있어요. 그저 조리복소니가 되어가는 것이 아니면 조그마한 생각을 가지고, 눈곱만한 야심을 가지고, 서 푼어치 안 되는 이상을 가지고 찧고 까불고 싸우고 하는 것밖에 안 보이니 이거 어디 살 수가 있나. 그래서 나는 마음 큰 자손을 낳아서 길러 볼까 하고 이를테면 새 민족을 하나 만들어 볼까 하고, 둘째 단군, 둘째 아브라함이나 하나 낳아 볼까 하고 하하하하앗하." +하고 유쾌하게, 그러나 비통하게 웃소. +나는 저녁을 굶어서 배가 고프고, 밤길을 걸어서 몸이 곤한 것도 잊고 그의 말을 들었소. +부인이 김이 무럭무럭 나는 호떡을 큰 뚝배기에 담고 김치를 작은 뚝배기에 담고, 또 돼지고기 삶은 것을 한 접시 담아다가 탁자 위에 놓소. +건넌방이라고 할 만한 방에서 젖먹이 우는 소리가 들리오. 부인은 삼십이나 되었을까, 남편은 서른댓 되었을 듯한 키가 훨쩍 크고 눈과 코가 크고 손도 큰 건장한 대장부요, 음성이 부드러운 것이 체격에 어울리지 아니하나 그것이 아마 그의 정신 생활이 높은 표겠지요. +"신문에서 최 선생이 학교를 고만두시게 되었다는 말도 보았지요. 그러나 나는 그것이 다 최 선생에게 대한 중상인 줄을 짐작하였고, 또 오늘 이렇게 만나 보니까 더구나 그것이 다 중상인 줄을 알지요." +하고 그는 확신 있는 어조로 말하오. +"고맙습니다." +나는 이렇게밖에 대답할 말이 없었소. +"아, 머, 고맙다고 하실 것도 없지요." +하고 그는 머리를 뒤로 젖히고 한참이나 생각을 하더니 우선 껄껄 한바탕 웃고 나서, +"내가 최 선생이 당하신 경우와 꼭 같은 경우를 당하였거든요. 이를테면 과부 설움은 동무 과부가 안다는 것이지요." +하고 그는 자기의 내력을 말하기 시작하오. +"내 집은 본래 서울입니다. 내가 어렸을 적에 내 선친께서 시국에 대해서 불평을 품고 당신 삼 형제의 가족을 끌고 재산을 모두 팔아 가지고 간도에를 건너오셨지요. 간도에 맨 먼저 ●●학교를 세운 이가 내 선친이지요." +여기까지 하는 말을 듣고 나는 그가 누구인지를 알았소. 그는 R씨라고 간도 개척자요, 간도에 조선인 문화를 세운 이로 유명한 이의 아들인 것이 분명하오. 나는 그의 이름이 누구인지도 물어 볼 것 없이 알았소. +"아 그러십니까. 네, 그러세요." +하고 나는 감탄하였소. +"네, 내 선친을 혹 아실는지요. 선친의 말씀이 노 그러신단 말씀야요. 조선 사람은 속이 좁아서 못쓴다고 <정감록>에도 그런 말이 있다고 조선은 산이 많고 들이 좁아서 사람의 마음이 작아서 큰일하기가 어렵고, 큰사람이 나기가 어렵다고. 웬만치 큰사람이 나면 서로 시기해서 큰일할 새가 없이 한다고 그렇게 <정감록>에도 있다더군요. 그래서 선친께서 자손에게나 희망을 붙이고 간도로 오신 모양이지요. 거기서 자라났다는 것이 내 꼴입니다마는, 아하하. +내가 자라서 아버지께서 세우신 K여학교의 교사로 있을 때 일입니다. 지금 내 아내는 그 때 학생으로 있었구. 그러자 내 아버지께서 재산이 다 없어져서 학교를 독담하실 수가 없고, 또 얼마 아니해서 아버지께서 돌아가시고 보니 학교에는 세력 다툼이 생겨서 아버지의 후계자로 추정되는 나를 배척하게 되었단 말씀이오. 거기서 나를 배척하는 자료를 삼은 것이 나와 지금 내 아내가 된 학생의 관계란 것인데 이것은 전연 무근지설인 것은 말할 것도 없소. 나도 총각이요, 그는 처녀니까 혼인을 하자면 못 할 것도 없지마는 그것이 사제 관계라면 중대 문제거든. 그래서 나는 단연히 사직을 하고 내가 사직한 것은 제 죄를 승인한 것이라 하여서 그 학생 지금 내 아내도 출교 처분을 당한 것이오. 그러고 보니, 그 여자의 아버지 내 장인이지요 그 여자의 아버지는 나를 죽일 놈같이 원망을 하고 그 딸을 죽일 년이라고 감금을 하고 어쨌으나 조그마한 간도 사회에서 큰 파문을 일으켰단 말이오. +이 문제를 더 크게 만든 것은 지금 내 아내인, 그 딸의 자백이오. 무어라고 했는고 하니, 나는 그 사람을 사랑하오, 그 사람한테가 아니면 시집을 안 가오, 하고 뻗댔단 말요. +나는 이 여자가 이렇게 나를 생각하는가 할 때 의분심이 나서 나는 어떻게 해서든지 이 여자와 혼인하리라고 결심을 하였소. 나는 마침내 정식으로 K장로라는 내 장인에게 청혼을 하였으나 단박에 거절을 당하고 말았지요. K장로는 그 딸을 간도에 두는 것이 옳지 않다고 해서 서울로 보내기로 하였단 말을 들었소. 그래서 나는 최후의 결심으로 그 여자 지금 내 아내 된 사람을 데리고 간도에서 도망하였소. 하하하하. 밤중에 단둘이서. +지금 같으면야 사제간에 결혼을 하기로 그리 큰 문제가 될 것이 없지마는 그 때에 어디 그랬나요. 사제간에 혼인이란 것은 부녀간에 혼인한다는 것과 같이 생각하였지요. 더구나 그 때 간도 사회에는 청교도적 사상과 열렬한 애국심이 있어서 도덕 표준이 여간 높지 아니하였지요. 그런 시대니까 내가 내 제자인 여학생을 데리고 달아난다는 것은 살인 강도를 하는 이상으로 무서운 일이었지요. 지금도 나는 그렇게 생각합니다마는. +그래서 우리 두 사람은 우리 두 사람이라는 것보다도 내 생각에는 어찌하였으나 나를 위해서 제 목숨을 버리려는 그에게 사실 나도 마음 속으로는 그를 사랑하였지요. 다만 사제간이니까 영원히 달할 수는 없는 사랑이라고 단념하였을 뿐이지요. 그러니까 비록 부처 생활은 못 하더라도 내가 그의 사랑을 안다는 것과 나도 그를 이만큼 사랑한다는 것만을 보여 주자는 것이지요. +때는 마침 가을이지마는, 몸에 지닌 돈도 얼마 없고 천신만고로 길림까지를 나와 가지고는 배를 타고 송화강을 내려서 하얼빈에 가 가지고 거 기서 간신히 치타까지의 여비와 여행권을 얻어 가지고 차를 타고 떠나지 않았어요. 그것이 바로 십여 년 전 오늘이란 말이오." +이 때에 부인이 옥수수로 만든 국수와 감자 삶은 것을 가지고 들어오오. +나는 R의 말을 듣던 끝이라 유심히 부인을 바라보았소. 그는 중키나 되는 둥근 얼굴이 혈색이 좋고 통통하여 미인이라기보다는 씩씩한 여자요. 그런 중에 조선 여자만이 가지는 아담하고 점잖은 맛이 있소. +"앉으시지요. 지금 두 분께서 처음 사랑하시던 말씀을 듣고 있습니다." +하고 나는 부인에게 교의를 권하였소. +"아이, 그런 말씀은 왜 하시오." +하고 부인은 갑자기 십 년이나 어려지는 모양으로 수삽한 빛을 보이고 고개를 숙이고 달아나오. +"그래서요. 그래 오늘이 기념일이외다그려." +하고 나도 웃었소. +"그렇지요. 우리는 해마다 오늘이 오면 우리 무덤에 성묘를 가서 하룻밤을 새우지요. 오늘은 손님이 오셔서 중간에 돌아왔지만, 하하하하." +하고 그는 유쾌하게 웃소. +"성묘라니?" +하고 나는 물었소. +"아까 보신 두 별 무덤 말이오. 그것이 우리 내외의 무덤이지요. 하하하하." +"…………." +나는 영문을 모르고 가만히 앉았소. +"내 이야기를 들으시지요. 그래 둘이서 차를 타고 오지 않았겠어요. 물론 여전히 선생님과 제자지요. 그렇지만 워낙 여러 날 단둘이서 같이 고생을 하고 여행을 했으니 사랑의 불길이 탈 것이야 물론 아니겠어요. 다만 사제라는 굳은 의리가 그것을 겉에 나오지 못하도록 누른 것이지요. ……그런데 꼭 오늘같이 좋은 날인데 여기는 대개 일기가 일정합니다. 좀체로 비가 오는 일도 없고 흐리는 날도 없지요. 헌데 F역에를 오니까 참 석양 경치가 좋단 말이오. 그 때에 불현듯, 에라 여기서 내려서 이 석양 속에 저 호숫 가에 둘이서 헤매다가 깨끗이 사제의 몸으로 이 깨끗한 광야에 묻혀 버리자 하는 생각이 나겠지요. 그래 그 때 말을 내 아내 그 때에는 아직 아내가 아니지요 내 아내에게 그런 말을 하였더니 참 좋다고 박장을 하고 내 어깨에 매달리는구려. 그래서 우리 둘은 차가 거의 떠날 임박해서 차에서 뛰어내렸지요." +하고 그는 그때 광경을 눈앞에 그리는 모양으로 말을 끊고 우두커니 허공을 바라보오. 그러나 그의 입 언저리에는 유쾌한 회고에서 나오는 웃음이었소. +"이야기 다 끝났어요?" +하고 부인이 크바스라는 청량 음료를 들고 들어오오. +"아니오. 이제부터가 정통이니 당신도 거기 앉으시오. 지금 차에서 내린 데까지 왔는데 당신도 앉아서 한 파트를 맡으시오." +하고 R는 부인의 손을 잡아서 자리에 앉히오. 부인도 웃으면서 앉소. +"최 선생 처지가 꼭 나와 같단 말요. 정임의 처지가 당신과 같고." +하고 그는 말을 계속하오. +"그래 차에서 내려서 나는 이 양반하고 물을 찾아 헤매었지요. 아따, 석양이 어떻게 좋은지 이 양반은 박장을 하고 노래를 부르고 우리 둘은 마치 유쾌하게 산보하는 사람 같았지요." +"참 좋았어요. 그 때에는 참 좋았어요. 그 석양에 비친 광야와 호수라는 건 어떻게 좋은지 그 수은 같은 물 속에 텀벙 뛰어들고 싶었어요. 그 후엔 해마다 보아도 그만 못해." +하고 부인이 참견을 하오. +아이들은 다 자는 모양이오. +"그래 지향없이 헤매는데 해는 뉘엿뉘엿 넘어가구, 어스름은 기어들고 그 때 마침 하늘에는 별 둘이 나타났단 말이야. 그것을 이 여학생이 먼저 보고서 갑자기 추연해지면서 선생님 저 별 보셔요, 앞선 큰 별은 선생님이 구 따라가는 작은 별은 저야요, 하겠지요. 그 말이, 또 그 태도가 어떻게 가련한지. 그래서 나는 하늘을 바라보니깐 과연 별 두 개가 지는 해를 따르는 듯이 따라간다 말요. 말을 듣고 보니 과연 우리 신세와도 같지 않아요? +그리고는 이 사람이 또 이럽니다그려 `선생님, 앞선 큰 별은 아무리 따라도 저 작은 별은 영원히 따라잡지 못하겠지요. 영원히 영원히 따라가다가 따라가다가 못 해서 마침내는 저 작은 별은 죽어서 검은 재가 되고 말겠지요? 저 작은 별이 제 신세와 어쩌면 그리 같을까.' 하고 한탄을 하겠지요. 그 때에 한탄을 하고 눈물을 흘리고 섰는 어린 처녀의 석양빛에 비췬 모양을 상상해 보세요, 하하하하. 그 때에는 당신도 미인이었소. 하하하하." +하고 내외가 유쾌하게 웃는 것을 보니 나는 더욱 적막하여짐을 깨달았소. 어쩌면 그 석양, 그 두 별이 이들에게와 내게 꼭 같은 인상을 주었을까 하니 참으로 이상하다 하였소. +"그래 인제." +하고 R는 다시 이야기를 계속하오. +"그래 인제 둘이서 그야말로 감개무량하게 두 별을 바라보며 걸었지요. 그러다가 해가 넘어가고 앞선 큰 별이 넘어가고 그리고는 혼자서 깜빡깜빡하고 가던 작은 별이 넘어가니 우리는 그만 땅에 주저앉았소. 거기가 어딘고 하니 그 두 별 무덤이 있는 곳이지요. `선생님 저를 여기다가 파묻어 주시고 가셔요. 선생님 손수 저를 여기다가 묻어 놓고 가 주셔요.' 하고 이 사람이 조르지요." +하는 것을 부인은, +"내가 언제." +하고 남편을 흘겨보오. +"그럼 무에라고 했소? 어디 본인이 한 번 옮겨 보오." +하고 R가 말을 끊소. +"간도를 떠난 지가 한 달이 되도록 단둘이 다녀도 요만큼도 귀해 주는 점이 안 뵈니 그럼 파묻어 달라고 안 해요?" +하고 부인은 웃소. +"흥흥." +하고 R는 부인의 말에 웃고 나서, +"그 자리에 묻어 달란 말을 들으니까, 어떻게 측은한지, 그럼 나도 함께 묻히자고 그랬지요. 나는 그 때에 참말 그 자리에 함께 묻히고 싶었어요. 그래서 나는 손으로 곧 구덩이를 팠지요. 떡가루 같은 모래판이니까 파기는 힘이 아니 들겠지요. 이이도 물끄러미 내가 땅을 파는 것을 보고 섰더니만 자기도 파기를 시작하겠지요." +하고 내외가 다 웃소. +"그래 순식간에……." +하고 R는 이야기를 계속하오. +"순식간에 둘이 드러누울 만한 구덩이를 아마 두 자 깊이나 되게, 네모나게 파 놓고는 내가 들어가 누워 보고 그러고는 또 파고 하여 아주 편안한 구덩이를 파고 나서는 나는 아주 세상을 하직할 셈으로 사방을 둘러보 고 사방이래야 컴컴한 어둠밖에 없지만 사방을 둘러보고, 이를테면 세상과 작별을 하고 드러누웠지요. 지금 이렇게 회고담을 할 때에는 우습기도 하지마는 그 때에는 참으로 종교적이라 할 만한 엄숙이었소. 그때 우리 둘의 처지는 앞도 절벽, 뒤도 절벽이어서 죽는 길밖에 없었지요. 또 그뿐 아니라 인생의 가장 깨끗하고 가장 사랑의 맑은 정이 타고 가장 기쁘고도 슬프고도 이를테면 모든 감정이 절정에 달하고, 그러한 순간에 목숨을 끊어 버리는 것이 가장 좋은 일이요, 가장 마땅한 일같이 생각하였지요. 광야에 아름다운 황혼이 순간에 스러지는 모양으로 우리 두 생명의 아름다움도 순간에 스러지자는 우리는 철학자도 시인도 아니지마는 우리들의 환경이 우리 둘에게 그러한 생각을 넣어 준 것이지요. +그래서 내가 가만히 드러누워 있는 것을 저이가 물끄러미 보고 있더니 자기도 내 곁에 들어와 눕겠지요. 그런 뒤에는 황혼에 남은 빛도 다 스러지고 아주 캄캄한 암흑 세계가 되어 버렸지요. 하늘에 어떻게 그렇게 별이 많은지. 가만히 하늘을 바라보노라면 참 별이 많아요. 우주란 참 커요. 그런데 이 끝없이 큰 우주에 한없이 많은 별들이 다 제자리를 지키고 제 길을 지켜서 서로 부딪지도 아니하고 끝없이 긴 시간에 질서를 유지하고 있는 것을 보면 우주에는 어떤 주재하는 뜻, 섭리하는 뜻이 있다 하는 생각이 나겠지요. 나도 예수교인의 가정에서 자라났지마는 이 때처럼 하나님이라 할까 이름은 무엇이라고 하든지 간에 우주의 섭리자의 존재를 강렬하게 의식한 일은 없었지요. +그렇지만 `사람의 마음에 비기면 저까짓 별들이 다 무엇이오?' 하고 그때 겨우 열여덟 살밖에 안 된 이이가 내 귀에 입을 대고 말할 때에는 나도 참으로 놀랐습니다. 나이는 나보다 오륙 년 상관밖에 안 되지마는 이십 세 내외에 오륙 년 상관이 적은 것인가요? 게다가 나는 선생이요 자기는 학생이니까 어린애로만 알았던 것이 그런 말을 하니 놀랍지 않아요? 어째서 사람의 마음이 하늘보다도 더 이상할까 하고 내가 물으니까, 그 대답이 `나는 무엇이라고 설명할 수가 없지마는 내 마음 속에 일어나는 것이 하늘이나 땅에 일어나는 모든 것보다도 더 아름답고 더 알 수 없고 더 뜨겁고 그런 것 같아요.' 그러겠지요. 생명이란 모든 아름다운 것 중에 가장 아름다운 것이라는 것을 나는 깨달았어요. 그 말에, `그렇다 하면 이 아름답고 신비한 생명을 내는 우주는 더 아름다운 것이 아니오?' 하고 내가 반문하니까, 당신(부인을 향하여) 말이, `전 모르겠어요, 어쨌으나 전 행복합니다. 저는 이 행복을 깨뜨리고 싶지 않습니다. 놓쳐 버리고 싶지 않습니다. 이 행복 선생님 곁에 있는 이 행복을 꽉 안고 죽고 싶어요.' 그러지 않았소?" +"누가 그랬어요? 아이 난 다 잊어버렸어요." +하고 부인은 차를 따르오. R는 인제는 하하하 하는 웃음조차 잊어버리고, 부인에게 농담을 붙이는 것조차 잊어버리고, 그야말로 종교적 엄숙 그대로말을 이어, +"`자 저는 약을 먹어요.' 하고 손을 입으로 가져가는 동작이 감행되겠지요. 약이란 것은 하얼빈에서 준비한 아편이지요. 하얼빈서 치타까지 가는 동안에 흥안령이나 어느 삼림지대나 어디서나 죽을 자리를 찾자고 준비한 것이니까. 나는 입 근처로 가는 그의 손을 붙들었어요. 붙들면서 나는 `잠깐만 기다리오. 오늘 밤 안으로 그 약을 먹으면 고만이 아니오? 이 행복된 순간을 잠깐이라도 늘립시다. 달 올라올 때까지만.' 나는 이렇게 말했지요. `선생님도 행복되셔요? 선생님은 불행이시지. 저 때문에 불행이시지. 저만 이곳에 묻어 주시구는 선생님은 세상에 돌아가 사셔요, 오래오래 사셔요, 일 많이 하고 사셔요.' 하고 울지 않겠어요. 나는 그 때에 내 아내가 하던 말을 한 마디도 잊지 아니합니다. 그 말을 듣던 때의 내 인상은 아마 일생 두고 잊히지 아니하겠지요. +나는 자백합니다. 그 순간에 나는 처음으로 내 아내를 안고 키스를 하였지요. 내 속에 눌리고 눌리고 쌓이고 하였던 열정이 그만 일시에 폭발되었던 것이오. 아아 이것이 최초의 것이요, 동시에 최후의 것이로구나 할 때에 내 눈에서는 끓는 듯한 눈물이 흘렀소이다. 두 사람의 심장이 뛰는 소리, 두 사람의 풀무 불길 같은 숨소리. +이윽고 달이 떠올라 왔습니다. 가이없는 벌판이니까 달이 뜨니까 갑자기 천지가 환해지고 우리 둘이 손으로 파서 쌓아 놓은 흙무더기가 이 산 없는 세상에 산이나 되는 것같이 조그마한 검은 그림자를 지고 있겠지요. `자 우리 달빛을 띠고 좀 돌아다닐까.' 하고 나는 아내를 안아 일으켰지요. 내 팔에 안겨서 고개를 뒤로 젖힌 내 아내의 얼굴이 달빛에 비친 양을 나는 잘 기억합니다. 실신한 듯한, 만족한 듯한, 그리고도 절망한 듯한 그 표정을 무엇으로 그릴지 모릅니다. 그림도 그릴 줄 모르고 조각도 할 줄 모르고 글도 쓸 줄 모르는 내가 그것을 어떻게 그립니까. 그저 가슴 속에 품고 이렇게 오늘의 내 아내를 바라볼 뿐이지요. +나는 내 아내를 팔에 걸고 네, 걸었다고 하는 것이 가장 합당하지 요 이렇게 팔에다 걸고 달빛을 받은 황량한 벌판, 아무리 하여도 환하게 밝아지지는 아니하는 벌판을 헤매었습니다. 이따금 내 아내가, `어서 죽고 싶어요, 전 죽고만 싶어요.' 하는 말에는 대답도 아니 하고. 죽고 싶다는 그 말은 물론 진정일 것이지요. 아무리 맑은 일기라 하더라도 오후가 되면 흐려지는 법이니까 오래 살아가는 동안에 늘 한 모양으로 이 순간같이 깨끗하고 뜨거운 기분으로 갈 수는 없지 않아요? 불쾌한 일도 생기고, 보기 흉한 일도 생길는지 모르거든. 그러니까 이 완전한 깨끗과 완전한 사랑과 완전한 행복 속에 죽어 버리자는 뜻을 나는 잘 알지요. 더구나 우리들이 살아 남는대야 앞길이 기구하지 평탄할 리는 없지 아니해요? 그래서 나는 `죽지, 우리 이 달밤에 실컷 돌아다니다가, 더 돌아다니기가 싫거든 그 구덩에 돌아가서 약을 먹읍시다.' 이렇게 말하고 우리 둘은 헤맸지요. 낮에 보면 어디까지나 평평한 벌판인 것만 같지마는 달밤에 보면 이 사막에도 아직 채 스러지지 아니한 산의 형적이 남아 있어서 군데군데 거뭇거뭇한 그림자가 있겠지요. 그 그림자 속에는 걸어 들어가면 어떤 데는 우리 허리만큼 그림자에 가리우고 어떤 데는 우리 둘을 다 가리워 버리는 데도 있단 말야요. 죽음의 그림자라는 생각이 나면 그래도 몸에 소름이 끼쳐요. +차차 달이 높아지고 추위가 심해져서 바람결이 지나갈 때에는 눈에서 눈물이 날 지경이지요. 원체 대기 중에 수분이 적으니까 서리도 많지 않지마는, 그래도 대기 중에 있는 수분은 다 얼어 버려서 얼음가루가 되었는 게지요. 공중에는 반짝반짝하는 수정가루 같은 것이 보입니다. 낮에는 땀이 흐르리만큼 덥던 사막도 밤이 되면 이렇게 기온이 내려가지요. 춥다고 생각은 하면서도 춥다는 말은 아니 하고 우리는 어떤 때에는 달을 따라서, 어떤 때에는 달을 등지고, 어떤 때에는 호수에 비친 달을 굽어보고, 이 모양으로 한없이 말도 없이 돌아다녔지요. 이 세상 생명의 마지막 순간을 힘껏 의식하려는 듯이. +마침내 `나는 더 못 걸어요.' 하고 이이가 내 어깨에 매달려 버리고 말았지요." +하고 R가 부인을 돌아보니 부인은 편물하던 손을 쉬고, +"다리가 아픈 줄은 모르겠는데 다리가 이리 뉘구 저리 뉘구 해서 걸음을 걸을 수가 없었어요. 춥기는 하구." +하고 소리를 내어서 웃소. +"그럴 만도 하지." +하고 R는 긴장한 표정을 약간 풀고 앉은 자세를 잠깐 고치며, +"그 후에 그 날 밤 돌아다닌 곳을 더듬어 보니까, 자세히는 알 수 없지마는 삼십 리는 더 되는 것 같거든. 다리가 아프지 아니할 리가 있나." +하고 차를 한 모금 마시고 나서 말을 계속하오. +"그래서 나는 내 외투를 벗어서, 이이(부인)를 싸서 어린애 안듯이 안고 걸었지요. 외투로 쌌으니 자기도 춥지 않구, 나는 또 무거운 짐을 안았으니 땀이 날 지경이구, 그뿐 아니라 내가 제게 주는 최후의 서비스라 하니 기쁘고, 말하자면 일거 삼득이지요. 하하하하. 지난 일이니 웃지마는 그 때 사정을 생각해 보세요, 어떠했겠나." +하고 R는 약간 처참한 빛을 띠면서, +"그러니 그 구덩이를 어디 찾을 수가 있나. 얼마를 찾아 돌아다니다가 아무 데서나 죽을 생각도 해 보았지마는 몸뚱이를 그냥 벌판에 내놓고 죽고 싶지는 아니하고 또 그 구덩이가 우리 두 사람에게 특별한 의미가 있는 것 같아서 기어코 그것을 찾아 내고야 말았지요. 그 때는 벌써 새벽이 가까웠던 모양이오. 열 시나 넘어서 뜬 하현달이 낮이 기울었으니 그렇지 않겠어요. 그 구덩이에 와서 우리는 한 번 더 하늘과 달과 별과, 그리고 마음 속에 떠오른 사람들과 하직하고 약 먹을 준비를 했지요. +약을 검은 고약과 같은 아편을 맛이 쓰다는 아편을 물도 없이 먹으려 들었지요. +우리 둘은 아까 모양으로 가지런히 누워서 하늘을 바라보았는데 달이 밝으니까 보이던 별들 중에 숨은 별이 많고 또 별들의 위치 우리에게 낯익은 북두칠성 자리도 변했을 것 아니야요. 이상한 생각이 나요. 우리가 벌판으로 헤매는 동안에 천지가 모두 변한 것 같아요. 사실 변하였지요. 그 변한 것이 우스워서 나는 껄껄 웃었지요. 워낙 내가 웃음이 좀 헤프지만 이 때처럼 헤프게 실컷 웃어 본 일은 없습니다. +왜 웃느냐고 아내가 좀 성을 낸 듯이 묻기로, `천지와 인생이 변하는 것이 우스워서 웃었소.' 그랬지요. 그랬더니, `천지와 인생은 변할는지 몰라도 내 마음은 안 변해요!' 하고 소리를 지르겠지요. 퍽 분개했던 모양이야." +하고 R는 그 아내를 보오. +"그럼 분개 안 해요? 남은 죽을 결심을 하고 발발 떨구 있는데 곁에서 껄껄거리고 웃으니, 어째 분하지가 않아요. 나는 분해서 달아나려고 했어요." +하고 부인은 아직도 분함이 남은 것같이 말하오. +"그래 달아나지 않았소?" +하고 R는 부인이 벌떡 일어나서 비틀거리고 달아나는 흉내를 팔과 다리로 내고 나서, +"이래서 죽는 시간이 지체가 되었지요. 그래서 내가 빌고 달래고 해서 가까스로 안정을 시키고 나니 손에 쥐었던 아편이 땀에 푹 젖었겠지요. 내가 웃은 것은 죽기 전 한 번 천지와 인생을 웃어 버린 것인데 그렇게 야단이니…… 하하하하." +R는 식은 차를 한 모금 더 마시며, +"참 목도 마르기도 하더니. 입에는 침 한 방울 없고. 그러나 못물을 먹을 생각도 없고. 나중에는 말을 하려고 해도 혀가 안 돌아가겠지요. +이러는 동안에 달빛이 희미해지길래 웬일인가 하고 고개를 번쩍 들었더니 해가 떠오릅니다그려. 어떻게 붉고 둥글고 씩씩한지. `저 해 보오.' 하고 나는 기계적으로 벌떡 일어나서 구덩이에서 뛰어나왔지요." +하고 빙그레 웃소. R의 빙그레 웃는 양이 참 좋았소. +"내가 뛰어나오는 것을 보고 이이도 뿌시시 일어났지요. 그 해! 그 해의 새 빛을 받는 하늘과 땅의 빛! 나는 그것을 형용할 말을 가지지 못합니다. 다만 힘껏 소리치고 싶고 기운껏 달음박질치고 싶은 생각이 날 뿐이어요. +`우리 삽시다, 죽지 말고 삽시다, 살아서 새 세상을 하나 만들어 봅시다.' 이렇게 말하였지요. 하니까 이이가 처음에는 깜짝 놀라는 것 같아요. 그러나 마침내 아내도 죽을 뜻을 변하였지요. 그래서 남 선생을 청하여다가 그 말씀을 여쭈었더니 남 선생께서 고개를 끄덕끄덕하시고 우리 둘의 혼인 주례를 하셨지요. 그 후 십여 년에 우리는 밭 갈고 아이 기르고 이런 생활을 하고 있는데 언제나 여기 새 민족이 생기고 누가 새 단군이 될는지요. 하하하하, 아하하하. 피곤하시겠습니다. 이야기가 너무 길어서." +하고 R는 말을 끊소. +나는 R부처가 만류하는 것도 다 뿌리치고 여관으로 돌아왔소. R와 함께 달빛 속, 개 짖는 소리 속을 지나서 아라사 사람의 조그마한 여관으로 돌아왔소. 여관 주인도 R를 아는 모양이어서 반갑게 인사하고 또 내게 대한 부탁도 하는 모양인가 보오. +R는 내 방에 올라와서 내일 하루 지날 일도 이야기하고 또 남 선생과 정임에게 관한 이야기도 하였으나, 나는 그가 무슨 이야기를 하는지 잘 들을 만한 마음의 여유도 없어서 마음 없는 대답을 할 뿐이었소. +R가 돌아간 뒤에 나는 옷도 벗지 아니하고 침대에 드러누웠소. 페치카를 때기는 한 모양이나 방이 써늘하기 그지없소. +`그 두 별 무덤이 정말 R와 그 여학생과 두 사람이 영원히 달치 못할 꿈을 안은 채로 깨끗하게 죽어서 묻힌 무덤이었으면 얼마나 좋을까. 만일 그렇다 하면 내일 한 번 더 가서 보토라도 하고 오련마는.' +하고 나는 R부처의 생활에 대하여 일종의 불만과 환멸을 느꼈소. +그리고 내가 정임을 여기나 시베리아나 어떤 곳으로 불러다가 만일 R와 같은 흉내를 낸다 하면, 하고 생각해 보고는 나는 진저리를 쳤소. 나는 내머리 속에 다시 그러한 생각이 한 조각이라도 들어올 것을 두려워하였소. +급행을 기다리자면 또 사흘을 기다리지 아니하면 아니 되기로 나는 이튿날 새벽에 떠나는 구간차를 타고 F역을 떠나 버렸소. R에게는 고맙다는 편지 한 장만을 써 놓고. 나는 R를 더 보기를 원치 아니하였소. 그것은 반드시 R를 죄인으로 보아서 그런 것은 아니오마는 그저 나는 다시 R를 대면하기를 원치 아니한 것이오. +나는 차가 R의 집 앞을 지날 때에도 R의 집에 대하여서는 외면하였소. +이 모양으로 나는 흥안령을 넘고, 하일라르의 솔밭을 지나서 마침내 이 곳에 온 것이오. +형! 나는 인제는 이 편지를 끝내오. 더 쓸 말도 없거니와 인제는 이것을 쓰기도 싫증이 났소. +이 편지를 쓰기 시작할 때에는 바이칼에 물결이 흉용하더니 이 편지를 끝내는 지금에는 가의 가까운 물에는 얼음이 얼었소. 그리고 저 멀리 푸른 물이 늠실늠실 하얗게 눈 덮인 산 빛과 어울리게 되었소. +사흘이나 이어서 오던 눈이 밤새에 개고 오늘 아침에는 칼날 같은 바람이 눈을 날리고 있소. +나는 이 얼음 위로 걸어서 저 푸른 물 있는 곳까지 가고 싶은 유혹을 금할 수 없소. 더구나 이 편지도 다 쓰고 나니, 인제는 내가 이 세상에서 할 마지막 일까지 다 한 것 같소. +내가 이 앞에 어디로 가서 어찌 될는지는 나도 모르지마는 희미한 소원을 말하면 눈 덮인 시베리아의 인적 없는 삼림 지대로 한정 없이 헤매다가 기운 진하는 곳에서 이 목숨을 마치고 싶소. +최석 군은 `끝'이라는 글자를 썼다가 지워 버리고 딴 종이에다가 이런 말을 썼다 +다 쓰고 나니 이런 편지도 다 부질없는 일이오. 내가 이런 말을 한대야 세상이 믿어 줄 리도 없지 않소. 말이란 소용 없는 것이오. 내가 아무리 내 아내에게 말을 했어도 아니 믿었거든 내 아내도 내 말을 아니 믿었거든 하물며 세상이 내 말을 믿을 리가 있소. 믿지 아니할 뿐 아니라 내 말 중에서 자기네 목적에 필요한 부분만은 믿고, 또 자기네 목적에 필요한 부분은 마음대로 고치고 뒤집고 보태고 할 것이니까, 나는 이 편지를 쓴 것이 한 무익하고 어리석은 일인 줄을 깨달았소. +형이야 이 편지를 아니 보기로니 나를 안 믿겠소? 그 중에는 혹 형이 지금까지 모르던 자료도 없지 아니하니, 형만 혼자 보시고 형만 혼자 내 사정을 알아 주시면 다행이겠소. 세상에 한 믿는 친구를 가지는 것이 저마다 하는 일이겠소? +나는 이 쓸데없는 편지를 몇 번이나 불살라 버리려고 하였으나 그래도 거기도 일종의 애착심이 생기고 미련이 생기는구려. 형 한 분이라도 보여 드리고 싶은 마음이 생기는구려. 내가 S형무소에 입감해 있을 적에 형무소 벽에 죄수가 손톱으로 성명을 새긴 것을 보았소. 뒤에 물었더니 그것은 흔히 사형수가 하는 짓이라고. 사형수가 교수대에 끌려 나가기 바로 전에 흔히 손톱으로 담벼락이나 마룻바닥에 제 이름을 새기는 일이 있다고 하는 말을 들었소. 내가 형에게 쓰는 이 편지도 그 심리와 비슷한 것일까요? +형! 나는 보통 사람보다는, 정보다는 지로, 상식보다는 이론으로, 이해보다는 의리로 살아 왔다고 자신하오. 이를테면 논리학적으로 윤리학적으로 살아온 것이라고 할까. 나는 엄격한 교사요, 교장이었소. 내게는 의지력과 이지력밖에 없는 것 같았소. 그러한 생활을 수십 년 해 오지 아니하였소? 나는 이 앞에 몇십 년을 더 살더라도 내 이 성격이나 생활 태도에는 변함이 없으리라고 자신하였소. 불혹지년이 지났으니 그렇게 생각하였을 것이 아니오? +그런데 형! 참 이상한 일이 있소. 그것은 내가 지금까지 처해 있던 환경을벗어나서 호호 탕탕하게 넓은 세계에 알몸을 내어던짐을 당하니 내 마음 속에는 무서운 여러 가지 변화가 일어나는구려. 나는 이 말도 형에게 아니 하려고 생각하였소. 노여워하지 마시오, 내게까지도 숨기느냐고. 그런 것이 아니오, 형은커녕 나 자신에게까지도 숨기려고 하였던 것이오. 혹시 그런 기다리지 아니 하였던 원, 그런 생각이 내 마음의 하늘에 일어나리라고 상상도 아니하였던, 그런 생각이 일어날 때에는 나는 스스로 놀라고 스스로 슬퍼하였소. 그래서 스스로 숨기기로 하였소. +그 숨긴다는 것이 무엇이냐 하면 그것은 열정이요, 정의 불길이요, 정의 광풍이요, 정의 물결이오. 만일 내 의식이 세계를 평화로운 풀 있고, 꽃 있고, 나무 있는 벌판이라고 하면 거기 난데없는 미친 짐승들이 불을 뿜고 소리를 지르고 싸우고, 영각을 하고 날쳐서, 이 동산의 평화의 화초를 다 짓밟아 버리고 마는 그러한 모양과 같소. +형! 그 이상야릇한 짐승들이 여태껏, 사십 년 간을 어느 구석에 숨어 있었소? 그러다가 인제 뛰어나와 각각 제 권리를 주장하오? +지금 내 가슴 속은 끓소. 내 몸은 바짝 여위었소. 그것은 생리학적으로나 심리학적으로나 타는 것이요, 연소하는 것이오. 그래서 다만 내 몸의 지방만이 타는 것이 아니라, 골수까지 타고, 몸이 탈 뿐이 아니라 생명 그 물건이 타고 있는 것이오. 그러면 어찌할까. +지위, 명성, 습관, 시대 사조 등등으로 일생에 눌리고 눌렸던 내 자아의 일부분이 혁명을 일으킨 것이오? 한 번도 자유로 권세를 부려 보지 못한 본능과 감정들이 내 생명이 끝나기 전에 한 번 날뛰어 보려는 것이오. 이것이 선이오? 악이오? +그들은 내가 지금까지 옳다고 여기고 신성하다고 여기던 모든 권위를 모조리 둘러엎으려고 드오. 그러나 형! 나는 도저히 이 혁명을 용인할 수가 없소. 나는 죽기까지 버티기로 결정을 하였소. 내 속에서 두 세력이 싸우다가 싸우다가 승부가 결정이 못 된다면 나는 승부의 결정을 기다리지 아니하고 살기를 그만두려오. +나는 눈 덮인 삼림 속으로 들어가려오. 나는 V라는 대삼림 지대가 어디인 줄도 알고 거기를 가려면 어느 정거장에서 내릴 것도 다 알아 놓았소. +만일 단순히 죽는다 하면 구태여 멀리 찾아갈 필요도 없지마는 그래도 나 혼자로는 내 사상과 감정의 청산을 하고 싶소. 살 수 있는 날까지 세상을 떠난 곳에서 살다가 완전한 해결을 얻는 날 나는 혹은 승리의, 혹은 패배의 종막을 닫칠 것이오. 만일 해결이 안 되면 안 되는 대로 그치면 그만이지요. +나는 이 붓을 놓기 전에 어젯밤에 꾼 꿈 이야기 하나는 하려오. 꿈이 하도 수상해서 마치 내 전도에 대한 신의 계시와도 같기로 하는 말이오. 그 꿈은 이러하였소. +내가 꽁이깨(꼬이까라는 아라사말로 침대라는 말이 조선 동포의 입으로 변한 말이오.) 짐을 지고 삽을 메고 눈이 덮인 삼림 속을 혼자 걸었소. 이 꽁이깨 짐이란 것은 금점꾼들이 그 여행 중에 소용품, 마른 빵, 소금, 내복 등속을 침대 매트리스에 넣어서 지고 다니는 것이오. 이 짐하고 삽 한 개, 도끼 한 개, 그것이 시베리아로 금을 찾아 헤매는 조선 동포들의 행색이오. 내가 이르쿠츠크에서 이러한 동포를 만났던 것이 꿈으로 되어 나온 모양이오. +나는 꿈에는 세상을 다 잊어버린, 아주 깨끗하고 침착한 사람으로 이 꽁이깨 짐을 지고 삽을 메고 밤인지 낮인지 알 수 없으나 땅은 눈빛으로 희고, 하늘은 구름빛으로 회색인 삼림 지대를 허덕허덕 걸었소. 길도 없는 데를, 인적도 없는 데를. +꿈에도 내 몸은 퍽 피곤해서 쉴 자리를 찾는 마음이었소. +나는 마침내 어떤 언덕 밑 한 군데를 골랐소. 그리고 상시에 이야기에서 들은 대로 삽으로 내가 누울 자리만한 눈을 치고, 그리고는 도끼로 곁에 선 나무 몇 개를 찍어 누이고 거기다가 불을 놓고 그 불김에 녹은 땅을 두어 자나 파내고 그 속에 드러누웠소. 훈훈한 것이 아주 편안하였소. +하늘에는 별이 반짝거렸소. F역에서 보던 바와 같이 큰 별 작은 별도 보이고 평시에 보지 못하던 붉은 별, 푸른 별 들도 보였소. 나는 이 이상한 하늘, 이상한 별들이 있는 하늘을 보고 드러누워 있노라니까 문득 어디서 발자국 소리가 들렸소. 퉁퉁퉁퉁 우루루루…… 나는 벌떡 일어나려 하였으나 몸이 천 근이나 되어서 움직일 수가 없었소. 가까스로 고개를 조금 들고 보니 뿔이 길다랗고 눈이 불같이 붉은 사슴의 떼가 무엇에 놀랐는지 껑충껑충 뛰어 지나가오. 이것은 아마 크로포트킨의 <상호 부조론> 속에 말한 시베리아의 사슴의 떼가 꿈이 되어 나온 모양이오. +그러더니 그 사슴의 떼가 다 지나간 뒤에, 그 사슴의 떼가 오던 방향으로서 정임이가 걸어오는 것이 아니라 스르륵 하고 미끄러져 오오. 마치 인형을 밀어 주는 것같이. +"정임아!" +하고 나는 소리를 치고 몸을 일으키려 하였소. +정임의 모양은 나를 잠깐 보고는 미끄러지는 듯이 흘러가 버리오. +나는 정임아, 정임아를 부르고 팔다리를 부둥거렸소. 그러다가 마침내 내 몸이 번쩍 일으켜짐을 깨달았소. 나는 정임의 뒤를 따랐소. +나는 눈 위로 삼림 속으로 정임의 그림자를 따랐소. 보일 듯 안 보일 듯, 잡힐 듯 안 잡힐 듯, 나는 무거운 다리를 끌고 정임을 따랐소. +정임은 이 추운 날이언만 눈과 같이 흰 옷을 입었소. 그 옷은 옛날 로마 여인의 옷과 같이 바람결에 펄렁거렸소. +"오지 마세요. 저를 따라오지 못하십니다." +하고 정임은 눈보라 속에 가리워 버리고 말았소. 암만 불러도 대답이 없고 눈보라가 다 지나간 뒤에도 붉은 별, 푸른 별과 뿔 긴 사슴의 떼뿐이오. 정임은 보이지 아니하였소. 나는 미칠 듯이 정임을 찾고 부르다가 잠을 깨었소. +꿈은 이것뿐이오. 꿈을 깨어서 창 밖을 바라보니 얼음과 눈에 덮인 바이칼호 위에는 새벽의 겨울 달이 비치어 있었소. 저 멀리 검푸르게 보이는 것이 채 얼어붙지 아니한 물이겠지요. 오늘 밤에 바람이 없고 기온이 내리면 그것마저 얼어붙을는지 모르지요. 벌써 살얼음이 잡혔는지도 모르지요. 아아, 그 속은 얼마나 깊을까. 나는 바이칼의 물 속이 관심이 되어서 못 견디겠소. +형! 나는 자백하지 아니할 수 없소. 이 꿈은 내 마음의 어떤 부분을 설명한 것이라고. 그러나 형! 나는 이것을 부정하려오. 굳세게 부정하려오. 나는 이 꿈을 부정하려오. 억지로라도 부정하려오. 나는 결코 내 속에 일어난 혁명을 용인하지 아니하려오. 나는 그것을 혁명으로 인정하지 아니하려오. 아니오! 아니오! 그것은 반란이오! 내 인격의 통일에 대한 반란이오. 단연코 무단적으로 진정하지 아니하면 아니 될 반란이오. 보시오! 나는 굳게 서서 한 걸음도 뒤로 물러서지 아니할 것이오. 만일에 형이 광야에 구르는 내 시체나 해골을 본다든지, 또는 무슨 인연으로 내 무덤을 발견하는 날이 있다고 하면 그 때에 형은 내가 이 모든 반란을 진정한 개선의 군주로 죽은 것을 알아 주시오. +인제 바이칼에 겨울의 석양이 비치었소. 눈을 인 나지막한 산들이 지는 햇빛에 자줏빛을 발하고 있소. 극히 깨끗하고 싸늘한 광경이오. 아디유! +이 편지를 우편에 부치고는 나는 최후의 방랑의 길을 떠나오. 찾을 수도 없고, 편지 받을 수도 없는 곳으로. +부디 평안히 계시오. 일 많이 하시오. 부인께 문안 드리오. 내 가족과 정임의 일 맡기오. 아디유! +이것으로 최석 군의 편지는 끝났다. +나는 이 편지를 받고 울었다. 이것이 일 편의 소설이라 하더라도 슬픈 일이어든, 하물며 내가 가장 믿고 사랑하는 친구의 일임에야. +이 편지를 받고 나는 곧 최석 군의 집을 찾았다. 주인을 잃은 이 집에서는아이들이 마당에서 떠들고 있었다. +"삼청동 아자씨 오셨수. 어머니, 삼청동 아자씨." +하고 최석 군의 작은딸이 나를 보고 뛰어들어갔다. +최석의 부인이 나와 나를 맞았다. +부인은 머리도 빗지 아니하고, 얼굴에는 조금도 화장을 아니하고, 매무시도 흘러내릴 지경으로 정돈되지 못하였다. 일 주일이나 못 만난 동안에 부인의 모양은 더욱 초췌하였다. +"노석헌테서 무슨 기별이나 있습니까." +하고 나는 무슨 말로 말을 시작할지 몰라서 이런 말을 하였다. +"아니오. 왜 그이가 집에 편지하나요?" +하고 부인은 성난 빛을 보이며, +"집을 떠난 지가 근 사십 일이 되건만 엽서 한 장 있나요. 집안 식구가 다 죽기로 눈이나 깜짝할 인가요. 그저 정임이헌테만 미쳐서 죽을지 살지를 모르지요." +하고 울먹울먹한다. +"잘못 아십니다. 부인께서 노석의 마음을 잘못 아십니다. 그런 것이 아닙니다." +하고 나는 확신 있는 듯이 말을 시작하였다. +"노석의 생각을 부인께서 오해하신 줄은 벌써부터 알았지마는 오늘 노석의 편지를 받아보고 더욱 분명히 알았습니다." +하고 나는 부인의 표정의 변화를 엿보았다. +"편지가 왔어요?" +하고 부인은 놀라면서, +"지금 어디 있어요? 일본 있지요?" +하고 질투의 불길을 눈으로 토하였다. +"일본이 아닙니다. 노석은 지금 아라사에 있습니다." +"아라사요?" +하고 부인은 놀라는 빛을 보이더니, +"그럼 정임이를 데리고 아주 아라사로 가케오치를 하였군요." +하고 히스테리컬한 웃음을 보이고는 몸을 한 번 떨었다. +부인은 남편과 정임의 관계를 말할 때마다 이렇게 경련적인 웃음을 웃고 몸을 떠는 것이 버릇이었다. +"아닙니다. 노석은 혼자 가 있습니다. 그렇게 오해를 마세요." +하고 나는 보에 싼 최석의 편지를 내어서 부인의 앞으로 밀어 놓으며, +"이것을 보시면 다 아실 줄 압니다. 어쨌으나 노석은 결코 정임이를 데리고 간 것이 아니요, 도리어 정임이를 멀리 떠나서 간 것입니다. 그러나 그보다도 중대 문제가 있습니다. 노석은 이 편지를 보면 죽을 결심을 한 모양입니다." +하고 부인의 주의를 질투로부터 그 남편에게 대한 동정에 끌어 보려 하였다. +"흥. 왜요? 시체 정사를 하나요? 좋겠습니다. 머리가 허연 것이 딸자식 같은 계집애허구 정사를 한다면 그 꼴 좋겠습니다. 죽으라지요. 죽으래요. 죽는 것이 낫지요. 그리구 살아서 무엇 해요?" +내 뜻은 틀려 버렸다. 부인의 표정과 말에서는 더욱더욱 독한 질투의 안개와 싸늘한 얼음가루가 날았다. +나는 부인의 이 태도에 반감을 느꼈다. 아무리 질투의 감정이 강하다 하기로, 사람의 생명이 제 남편의 생명이 위태함에도 불구하고 오직 제 질투의 감정에만 충실하려 하는 그 태도가 불쾌하였다. 그래서 나는, +"나는 그만큼 말씀해 드렸으니 더 할 말씀은 없습니다. 아무려나 좀더 냉정하게 생각해 보세요. 그리고 이것을 읽어 보세요." +하고 일어나서 집으로 돌아와 버리고 말았다. +도무지 불쾌하기 그지없는 날이다. 최석의 태도까지도 불쾌하다. 달아나긴 왜 달아나? 죽기는 왜 죽어? 못난 것! 기운 없는 것! 하고 나는 최석이가 곁에 섰기나 한 것처럼 눈을 흘기고 중얼거렸다. +최석의 말대로 최석의 부인은 악한 사람이 아니요, 그저 보통인 여성일는지 모른다. 그렇다 하면 여자의 마음이란 너무도 질투의 종이 아닐까. 설사 남편 되는 최석의 사랑이 아내로부터 정임에게로 옮아 갔다고 하더라도 그것을 질투로 회복하려는 것은 어리석은 일이다. 이미 사랑이 떠난 남편을 네 마음대로 가거라 하고 자발적으로 내어버릴 것이지마는 그것을 못 할 사정이 있다고 하면 모르는 체하고 내버려 둘 것이 아닌가. 그래도 이것은 우리네 남자의 이론이요, 여자로는 이런 경우에 질투라는 반응밖에 없도록 생긴 것일까 나는 이런 생각을 하고 있었다. +시계가 아홉시를 친다. +남대문 밖 정거장을 떠나는 열차의 기적 소리가 들린다. +나는 만주를 생각하고, 시베리아를 생각하고 최석을 생각하였다. 마음으로는 정임을 사랑하면서 그 사랑을 발표할 수 없어서 시베리아의 눈 덮인 삼림 속으로 방황하는 최석의 모양이 최석의 꿈 이야기에 있는 대로 눈앞에 선하게 떠나온다. +`사랑은 목숨을 빼앗는다.' +하고 나는 사랑일래 일어나는 인생의 비극을 생각하였다. 그러나 최석의 경우는 보통 있는 공식과는 달라서 사랑을 죽이기 위해서 제 목숨을 죽이는 것이었다. 그렇다 하더라도, +`사랑은 목숨을 빼앗는다.' +는 데에는 다름이 없다. +나는 불쾌도 하고 몸도 으스스하여 얼른 자리에 누웠다. 며느리가 들어온 뒤부터 사랑 생활을 하는 지가 벌써 오 년이나 되었다. 우리 부처란 인제는 한 역사적 존재요, 윤리적 관계에 불과하였다. 오래 사귄 친구와 같은 익숙함이 있고, 집에 없지 못할 사람이라는 필요감도 있지마는 젊은 부처가 가지는 듯한 그런 정은 벌써 없는 지 오래였다. 아내도 나를 대하면 본체만체, 나도 아내를 대하면 본체만체, 무슨 필요가 있어서 말을 붙이더라도 아무쪼록 듣기 싫기를 원하는 듯이 톡톡 내던졌다. 아내도 근래에 와서는 옷도 아무렇게나, 머리도 아무렇게나, 어디 출입할 때밖에는 도무지 화장을 아니 하였다. +그러나 그렇다고 우리 부처의 새가 좋지 못한 것도 아니었다. 서로 소중히 여기는 마음도 있었다. 아내가 안에 있다고 생각하면 마음이 든든하고 또 아내의 말에 의하건대 내가 사랑에 있거니 하면 마음이 든든하다고 한다. +우리 부처의 관계는 이러한 관계다. +나는 한 방에서 혼자 잠을 자는 것이 습관이 되어서 누가 곁에 있으면 잠이 잘 들지 아니하였다. 혹시 어린것들이 매를 얻어맞고 사랑으로 피난을 와서 울다가 내 자리에서 잠이 들면 귀엽기는 귀여워도 잠자리는 편안치 아니하였다. 나는 책을 보고 글을 쓰고 공상을 하고 있으면 족하였다. 내게는 아무 애욕적 요구도 없었다. 이것은 내 정력이 쇠모한 까닭인지 모른다. +그러나 최석의 편지를 본 그 날 밤에는 도무지 잠이 잘 들지 아니하였다. 최석의 편지가 최석의 고민이 내 졸던 의식에 무슨 자극을 준 듯하였다. 적막한 듯하였다. 허전한 듯하였다. 무엇인지 모르나 그리운 것이 있는 것 같았다. +"어, 이거 안되었군." +하고 나는 벌떡 일어나 담배를 피워 물었다. +"나으리 주무셔 곕시오?" +하고 아범이 전보를 가지고 왔다. +"명조 경성 착 남정임" +이라는 것이었다. +"정임이가 와?" +하고 나는 전보를 다시 읽었다. +최석의 그 편지를 보면 최석 부인에게는 어떤 반응이 일어나고 정임에게는 어떤 반응이 일어날까, 하고 생각하면 자못 마음이 편하지 못하였다. +이튿날 아침에 나는 부산서 오는 차를 맞으려고 정거장에를 나갔다. +차는 제 시간에 들어왔다. 남정임은 슈트케이스 하나를 들고 차에서 내렸다. 검은 외투에 검은 모자를 쓴 그의 얼굴은 더욱 해쓱해 보였다. +"선생님!" +하고 정임은 나를 보고 손에 들었던 짐을 땅바닥에 내려놓고, 내 앞으로 왔다. +"풍랑이나 없었나?" +하고 나는 내 손에 잡힌 정임의 손이 싸늘한 것을 근심하였다. +"네. 아주 잔잔했습니다. 저같이 약한 사람도 밖에 나와서 바다 경치를 구경하였습니다." +하고 정임은 사교적인 웃음을 웃었다. 그러나 그의 눈에는 눈물이 있는 것 같았다. +"최 선생님 어디 계신지 아세요?" +하고 정임은 나를 따라 서면서 물었다. +"나도 지금까지 몰랐는데 어제 편지를 하나 받았지." +하는 것이 내 대답이었다. +"네? 편지 받으셨어요? 어디 계십니까?" +하고 정임은 걸음을 멈추었다. +"나도 몰라." +하고 나도 정임과 같이 걸음을 멈추고, +"그 편지를 쓴 곳도 알고 부친 곳도 알지마는 지금 어디로 갔는지 그것은 모르지. 찾을 생각도 말고 편지할 생각도 말라고 했으니까." +하고 사실대로 대답하였다. +"어디야요? 그 편지 부치신 곳이 어디야요? 저 이 차로 따라갈 테야요." +하고 정임은 조급하였다. +"갈 때에는 가더라도 이 차에야 갈 수가 있나." +하고 나는 겨우 정임을 끌고 들어왔다. +정임을 집으로 데리고 와서 대강 말을 하고, 이튿날 새벽 차로 떠난다는 것을, +"가만 있어. 어떻게 계획을 세워 가지고 해야지." +하여 가까스로 붙들어 놓았다. +아침을 먹고 나서 최석 집에를 가 보려고 할 즈음에 순임이가 와서 마루 끝에 선 채로, +"선생님, 어머니가 잠깐만 오십시사구요." +하였다. +"정임이가 왔다." +하고 내가 그러니까, +"정임이가요?" +하고 순임은 깜짝 놀라면서, +"정임이는 아버지 계신 데를 알아요?" +하고 물었다. +"정임이도 모른단다. 너 아버지는 시베리아에 계시고 정임이는 동경 있다가 왔는데 알 리가 있니?" +하고 나는 순임의 생각을 깨뜨리려 하였다. 순임은, +"정임이가 어디 있어요?" +하고 방들 있는 곳을 둘러보며, +"언제 왔어요?" +하고는 그제야 정임에게 대한 반가운 정이 발하는 듯이, +"정임아!" +하고 불러 본다. +"언니요? 여기 있수." +하고 정임이가 머릿방 문을 열고 옷을 갈아입던 채로 고개를 내어민다. +순임은 구두를 차내버리듯이 벗어 놓고 정임의 방으로 뛰어들어간다. +나는 최석의 집에를 가느라고 외투를 입고 모자를 쓰고 정임의 방문을 열어 보았다. 두 처녀는 울고 있었다. +"정임이도 가지. 아주머니 뵈러 안 가?" +하고 나는 정임을 재촉하였다. +"선생님 먼저 가 계셔요." +하고 순임이가 눈물을 씻고 일어나면서, +"이따가 제가 정임이허구 갑니다." +하고 내게 눈을 끔쩍거려 보였다. 갑자기 정임이가 가면 어머니와 정임이와 사이에 어떠한 파란이 일어나지나 아니할까 하고 순임이가 염려하는 것이었다. 순임도 인제는 노성하여졌다고 나는 생각하였다. +"선생님 이 편지가 다 참말일까요?" +하고 나를 보는 길로 최석 부인이 물었다. 최석 부인은 히스테리를 일으킨 사람 모양으로 머리와 손을 떨었다. +나는 참말이냐 하는 것이 무엇을 가리키는 말인지 분명하지 아니하여서, +"노석이 거짓말할 사람입니까?" +하고 대체론으로 대답하였다. +"앉으십쇼. 앉으시란 말씀도 안 하고." +하고 부인은 침착한 모양을 보이려고 빙그레 웃었으나, 그것은 실패였다. +"그게 참말일까요? 정임이가 아기를 뗀 것이 아니라, 폐가 나빠서 피를 토하고 입원하였다는 것이?" +하고 부인은 중대하다는 표정을 가지고 묻는다. +"그럼 그것이 참말이 아니구요. 아직도 그런 의심을 가지고 계십니까. 정임이와 한 방에 있는 학생이 모함한 것이라고 안 그랬어요? 그게 말이 됩니까." +하고 언성을 높여서 대답하였다. +"그럼 왜 정임이가 호텔에서 왜 아버지한테 한 번 안아 달라고 그래요? 그 편지에 쓴 대로 한 번 안아만 보았을까요?" +이것은 부인의 둘째 물음이었다. +"나는 그뿐이라고 믿습니다. 그것이 도리어 깨끗하다는 표라고 믿습니다. 안 그렇습니까?" +하고 나는 딱하다는 표정을 하였다. +"글쎄요." +하고 부인은 한참이나 생각하고 있다가, +"정말 애 아버지가 혼자 달아났을까요? 정임이를 데리고 가케오치한 것이 아닐까요? 꼭 그랬을 것만 같은데." +하고 부인은 괴로운 표정을 감추려는 듯이 고개를 숙인다. +나는 남편에게 대한 아내의 의심이 어떻게 깊은가에 아니 놀랄 수가 없어서, +"허." +하고 한 마디 웃고, +"그렇게 수십 년 동안 부부 생활을 하시고도 그렇게 노석의 인격을 몰라 주십니까. 나는 부인께서 하시는 말씀이 부러 하시는 농담으로밖에 아니 들립니다. 정임이가 지금 서울 있습니다." +하고 또 한 번 웃었다. 정말 기막힌 웃음이었다. +"정임이가 서울 있어요?" +하고 부인은 펄쩍 뛰면서, +"어디 있다가 언제 왔습니까? 그게 정말입니까?" +하고 의아한 빛을 보인다. 꼭 최석이하고 함께 달아났을 정임이가 서울에 있을 리가 없는 것이었다. +"동경서 오늘 아침에 왔습니다. 지금 우리 집에서 순임이허구 이야기를 하고 있으니까 조금 있으면 뵈오러 올 것입니다." +하고 나는 정임이가 분명히 서울 있는 것을 일일이 증거를 들어서 증명하였다. 그리고 우스운 것을 속으로 참았다. 그러나 다음 순간에는 이 병들고 늙은 아내의 질투와 의심으로 괴로워서 덜덜덜덜 떨고 앉았는 것을 가엾게 생각하였다. +정임이가 지금 서울에 있는 것이 더 의심할 여지가 없는 사실임이 판명되매, 부인은 도리어 낙망하는 듯하였다. 그가 제 마음대로 그려 놓고 믿고 하던 모든 철학의 계통이 무너진 것이었다. +한참이나 흩어진 정신을 못 수습하는 듯이 앉아 있더니 아주 기운 없는 어조로, +"선생님 애 아버지가 정말 죽을까요? 정말 영영 집에를 안 돌아올까요?" +하고 묻는다. 그 눈에는 벌써 눈물이 어리었다. +"글쎄요. 내 생각 같아서는 다시는 집에 돌아오지 아니할 것 같습니다. 또 그만치 망신을 했으니, 이제 무슨 낯으로 돌아옵니까. 내라도 다시 집에 돌아올 생각은 아니 내겠습니다." +하고 나는 의식적으로 악의를 가지고 부인의 가슴에 칼을 하나 박았다. +그 칼은 분명히 부인의 가슴에 아프게 박힌 모양이었다. +"선생님. 어떡하면 좋습니까. 애 아버지가 죽지 않게 해 주세요. 그렇지 않아도 순임이년이 제가 걔 아버지를 달아나게나 한 것처럼 원망을 하는데요. 그러다가 정녕 죽으면 어떻게 합니까. 제일 딴 자식들의 원망을 들을까봐 겁이 납니다. 선생님, 어떻게 애 아버지를 붙들어다 주세요." +하고 마침내 참을 수 없이 울었다. 말은 비록 자식들의 원망이 두렵다고 하지마는 질투의 감정이 스러질 때에 그에게는 남편에게 대한 아내의 애정이 막혔던 물과 같이 터져 나온 것이라고 나는 해석하였다. +"글쎄, 어디 있는 줄 알고 찾습니까. 노석의 성미에 한번 아니 한다고 했으면 다시 편지할 리는 만무하다고 믿습니다." +하여 나는 부인의 가슴에 둘째 칼날을 박았다. +나는 비록 최석의 부인이 청하지 아니하더라도 최석을 찾으러 떠나지 아니하면 아니 될 의무를 진다. 산 최석을 못 찾더라도 최석의 시체라도, 무덤이라도, 죽은 자리라도, 마지막 있던 곳이라도 찾아보지 아니하면 아니 될 의무를 깨닫는다. +그러나 시국이 변하여 그 때에는 아라사에 가는 것은 여간 곤란한 일이 아니었다. 그 때에는 북만의 풍운이 급박하여 만주리를 통과하기는 사실상 불가능에 가까웠다. 마점산(馬占山) 일파의 군대가 흥안령, 하일라르 등지에 웅거하여 언제 대충돌이 폭발될는지 모르던 때였다. 이 때문에 시베리아에 들어가기는 거의 절망 상태라고 하겠고, 또 관헌도 아라사에 들어가는 여행권을 잘 교부할 것 같지 아니하였다. +부인은 울고, 나는 이런 생각 저런 생각 하고 있는 동안에 문 밖에는 순임이, 정임이가 들어오는 소리가 들렸다. +"아이, 정임이냐." +하고 부인은 반갑게 허리 굽혀 인사하는 정임의 어깨에 손을 대고, +"자 앉아라. 그래 인제 병이 좀 나으냐…… 수척했구나. 더 노성해지구 반 년도 못 되었는데." +하고 정임에게 대하여 애정을 표하는 것을 보고 나는 의외지마는 다행으로 생각하였다. 나는 정임이가 오면 보기 싫은 한 신을 연출하지 않나 하고 근심하였던 것이다. +"희 잘 자라요?" +하고 정임은 한참이나 있다가 비로소 입을 열었다. +"응, 잘 있단다. 컸나 가 보아라." +하고 부인은 더욱 반가운 표정을 보인다. +"어느 방이야?" +하고 정임은 선물 보퉁이를 들고 순임과 함께 나가 버린다. 여자인 정임은 희와 순임과 부인과 또 순임의 다른 동생에게 선물 사 오는 것을 잊어버리지 아니하였다. +정임과 순임은 한 이삼 분 있다가 돌아왔다. 밖에서 희가 무엇이라고 지절대는 소리가 들린다. 아마 정임이가 사다 준 선물을 받고 좋아하는 모양이다. +정임은 들고 온 보퉁이에서 여자용 배스로브 하나를 내어서 부인에게주며, +"맞으실까?" +하였다. +"아이 그건 무어라고 사 왔니?" +하고 부인은 좋아라고 입어 보고, 이리 보고 저리 보고 하면서, +"난 이런 거 처음 입어 본다." +하고 자꾸 끈을 동여맨다. +"정임이가 난 파자마를 사다 주었어." +하고 순임은 따로 쌌던 굵은 줄 있는 융 파자마를 내어서 경매장 사람 모양으로 흔들어 보이며, +"어머니 그 배스로브 나 주우. 어머닌 늙은이가 그건 입어서 무엇 하우?" +하고 부인이 입은 배스로브를 벗겨서 제가 입고 두 호주머니에 손을 넣고 어기죽어기죽하고 서양 부인네 흉내를 낸다. +"저런 말괄량이가 너도 정임이처럼 좀 얌전해 보아라." +하고 부인은 순임을 향하여 눈을 흘긴다. +이 모양으로 부인과 정임과의 대면은 가장 원만하게 되었다. +그러나 부인은 정임에게 최석의 편지를 보이기를 원치 아니하였다. 편지가 왔다는 말조차 입 밖에 내지 아니하였다. 그러나 순임이가 정임에게 대하여 표하는 애정은 여간 깊지 아니하였다. 그 둘은 하루 종일 같이 있었다. 정임은 그 날 저녁에 나를 보고, +"순임이헌테 최 선생님 편지 사연은 다 들었어요. 순임이가 그 편지를 훔쳐다가 얼른얼른 몇 군데 읽어도 보았습니다. 순임이가 저를 퍽 동정하면서 절더러 최 선생을 따라가 보라고 그래요. 혼자 가기가 어려우면 자기허구 같이 가자고. 가서 최 선생을 데리고 오자고. 어머니가 못 가게 하거든 몰래 둘이 도망해 가자고. 그래서 그러자고 그랬습니다. 안됐지요. 선생님?" +하고 저희끼리 작정은 다 해 놓고는 슬쩍 내 의향을 물었다. +"젊은 여자 단둘이서 먼 여행을 어떻게 한단 말이냐? 게다가 지금 북만주 형세가 대단히 위급한 모양인데. 또 정임이는 그 건강 가지고 어디를 가, 이 추운 겨울에?" +하고 나는 이런 말이 다 쓸데없는 말인 줄 알면서도 어른으로서 한 마디 안 할 수 없어서 하였다. 정임은 더 제 뜻을 주장하지도 아니하였다. +그 날 저녁에 정임은 순임의 집에서 잤는지 집에 오지를 아니하였다. +나는 이 일을 어찌하면 좋은가, 이 두 여자의 행동을 어찌하면 좋은가 하고 혼자 끙끙 생각하고 있었다. +이튿날 나는 궁금해서 최석의 집에를 갔더니 부인이, +"우리 순임이 댁에 갔어요?" +하고 의외의 질문을 하였다. +"아니오." +하고 나는 놀랐다. +"그럼, 이것들이 어딜 갔어요? 난 정임이허구 댁에서 잔 줄만 알았는데." +하고 부인은 무슨 불길한 것이나 본 듯이 몸을 떤다. 히스테리가 일어난 것이었다. +나는 입맛을 다시었다. 분명히 이 두 여자가 시베리아를 향하고 떠났구나 하였다. +그 날은 소식이 없이 지났다. 그 이튿날도 소식이 없이 지났다. +최석 부인은 딸까지 잃어버리고 미친 듯이 울고 애통하다가 머리를 싸매고 누워 버리고 말았다. +정임이와 순임이가 없어진 지 사흘 만에 아침 우편에 편지 한 장을 받았다. 그 봉투는 봉천 야마도 호텔 것이었다. 그 속에는 편지 두 장이 들어 있었다. 한 장은 , +선생님! 저는 아버지를 위하여, 정임을 위하여 정임과 같이 집을 떠났습니다. +어머님께서 슬퍼하실 줄은 알지마는 저희들이 다행히 아버지를 찾아서 모시고 오면 어머니께서도 기뻐하실 것을 믿습니다. 저희들이 가지 아니하고는 아버지는 살아서 돌아오실 것 같지 아니합니다. 아버지를 이처럼 불행하시게 한 죄는 절반은 어머니께 있고, 절반은 제게 있습니다. 저는 아버지 일을 생각하면 가슴이 미어지고 이가 갈립니다. 저는 아무리 해서라도 아버지를 찾아내어야겠습니다. +저는 정임을 무한히 동정합니다. 저는 어려서 정임을 미워하고 아버지를 미워하였지마는 지금은 아버지의 마음과 정임의 마음을 알아볼 만치 자랐습니다. +선생님! 저희들은 둘이 손을 잡고 어디를 가서든지 아버지를 찾아내겠습니다. 하나님의 사자가 낮에는 구름이 되고 밤에는 별이 되어서 반드시 저희들의 앞길을 인도할 줄 믿습니다. +선생님, 저희 어린것들의 뜻을 불쌍히 여기셔서 돈 천 원만 전보로 보내 주시기를 바랍니다. +만일 만주리로 가는 길이 끊어지면 몽고로 자동차로라도 가려고 합니다. 아버지 편지에 적힌 F역의 R씨를 찾고, 그리고 바이칼 호반의 바이칼리스코에를 찾아, 이 모양으로 찾으면 반드시 아버지를 찾아 내고야 말 것을 믿습니다. +선생님, 돈 천 원만 봉천 야마도 호텔 최순임 이름으로 부쳐 주세요. 그리고 어머니헌테는 아직 말씀 말아 주세요. +선생님. 이렇게 걱정하시게 해서 미안합니다. 용서하세요. +순임 상서 +이렇게 써 있다. 또 한 장에는, +선생님! 저는 마침내 돌아오지 못할 길을 떠나나이다. 어디든지 최 선생님을 뵈옵는 곳에서 이 몸을 묻어 버리려 하나이다. 지금 또 몸에 열이 나는 모양이요, 혈담도 보이오나 최 선생을 뵈올 때까지는 아무리 하여서라도 이 목숨을 부지하려 하오며, 최 선생을 뵈옵고 제가 진 은혜를 감사하는 한 말씀만 사뢰면 고대 죽사와도 여한이 없을까 하나이다. +순임 언니가 제게 주시는 사랑과 동정은 오직 눈물과 감격밖에 더 표할 말씀이 없나이다. 순임 언니가 저를 보호하여 주니 마음이 든든하여이다……. +이라고 하였다. +편지를 보아야 별로 놀랄 것은 없었다. 다만 말괄량이로만 알았던 순임의 속에 어느새에 그러한 감정이 발달하였나 하는 것을 놀랄 뿐이었다. +그러나 걱정은 이것이다. 순임이나 정임이나 다 내가 감독해야 할 처지에 있거늘 그들이 만리 긴 여행을 떠난다고 하니 감독자인 내 태도를 어떻게 할까 하는 것이다. +나는 편지를 받는 길로 우선 돈 천 원을 은행에 가서 찾아다 놓았다. +암만해도 내가 서울에 가만히 앉아서 두 아이에게 돈만 부쳐 주는 것이 인정에 어그러지는 것 같아서 나는 여러 가지로 주선을 하여서 여행의 양해를 얻어 가지고 봉천을 향하여 떠났다. +내가 봉천에 도착한 것은 밤 열시가 지나서였다. 순임과 정임은 자리옷 바람으로 내 방으로 달려와서 반가워하였다. 그들이 반가워하는 양은 실로 눈물이 흐를 만하였다. +"아이구 선생님!" +"아이구 어쩌면!" +하는 것이 그들의 내게 대한 인사의 전부였다. +"정임이 어떠오?" +하고 나는 순임의 편지에 정임이가 열이 있단 말을 생각하였다. +"무어요. 괜찮습니다." +하고 정임은 웃었다. +전등빛에 보이는 정임의 얼굴은 그야말로 대리석으로 깎은 듯하였다. 여위고 핏기가 없는 것이 더욱 정임의 용모에 엄숙한 맛을 주었다. +"돈 가져오셨어요?" +하고 순임이가 어리광 절반으로 묻다가 내가 웃고 대답이 없음을 보고, +"우리를 붙들러 오셨어요?" +하고 성내는 양을 보인다. +"그래 둘이서들 간다니 어떻게 간단 말인가. 시베리아가 어떤 곳에 붙었는지 알지도 못하면서." +하고 나는 두 사람이 그리 슬퍼하지 아니하는 순간을 보는 것이 다행하여서 농담삼아 물었다. +"왜 몰라요? 시베리아가 저기 아니야요?" +하고 순임이가 산해관 쪽을 가리키며, +"우리도 지리에서 배워서 다 알아요. 어저께 하루 종일 지도를 사다 놓고 연구를 하였답니다. 봉천서 신경, 신경서 하얼빈, 하얼빈에서 만주리, 만주리에서 이르쿠츠크, 보세요, 잘 알지 않습니까. 또 만일 중동 철도가 불통이면 어떻게 가는고 하니 여기서 산해관을 가고, 산해관서 북경을 가지요. 그리고는 북경서 장가구를 가지 않습니까. 장가구서 자동차를 타고 몽고를 통과해서 가거든요. 잘 알지 않습니까." +하고 정임의 허리를 안으며, +"그렇지이?" +하고 자신 있는 듯이 웃는다. +"또 몽고로도 못 가게 되어서 구라파를 돌게 되면?" +하고 나는 교사가 생도에게 묻는 모양으로 물었다. +"네, 저 인도양으로 해서 지중해로 해서 프랑스로 해서 그렇게 가지요." +"허, 잘 아는구나." +하고 나는 웃었다. +"그렇게만 알아요? 또 해삼위로 해서 가는 길도 알아요. 저희를 어린애로 아시네." +"잘못했소." +"하하." +"후후." +사실 그들은 벌써 어린애들은 아니었다. 순임도 벌써 그 아버지의 말할 수 없는 사정에 동정할 나이가 되었다. 순임이가 기어다닌 것은 본 나로는 이것도 이상하게 보였다. 나는 벌써 나이 많았구나 하는 생각이 나지 아니할 수 없었다. +나는 잠 안 드는 하룻밤을 지내면서 옆방에서 정임이가 기침을 짓는 소리를 들었다. 그 소리는 내 가슴을 아프게 하였다. +이튿날 나는 두 사람에게 돈 천 원을 주어서 신경 가는 급행차를 태워 주었다. 대륙의 이 건조하고 추운 기후에 정임의 병든 폐가 견디어 날까 하고 마음이 놓이지 아니하였다. 그러나 나는 그들을 가라고 권할 수는 있어도 가지 말라고 붙들 수는 없었다. 다만 제 아버지, 제 애인을 죽기 전에 만날 수 있기만 빌 뿐이었다. +나는 두 아이를 북쪽으로 떠나 보내고 혼자 여관에 들어와서 도무지 정신을 진정하지 못하여 술을 먹고 잊으려 하였다. 그러다가 그 날 밤차로 서울로 돌아왔다. +이튿날 아침에 나는 최석 부인을 찾아서 순임과 정임이가 시베리아로 갔단 말을 전하였다. +그 때에 최 부인은 거의 아무 정신이 없는 듯하였다. 아무 말도 하지 아니하고 울고만 있었다. +얼마 있다가 부인은, +"그것들이 저희들끼리 가서 괜찮을까요?" +하는 한 마디를 할 뿐이었다. +며칠 후에 순임에게서 편지가 왔다. 그것은 하얼빈에서 부친 것이었다. +하얼빈을 오늘 떠납니다. 하얼빈에 와서 아버지 친구 되시는 R소장을 만나뵈옵고 아버지 일을 물어 보았습니다. 그리고 저희 둘이서 찾아 떠났다는 말씀을 하였더니 R소장이 대단히 동정하여서 여행권도 준비해 주시기로 저희는 아버지를 찾아서 오늘 오후 모스크바 가는 급행으로 떠납니다. 가다가 F역에 내리기는 어려울 듯합니다. 정임의 건강이 대단히 좋지 못합니다. 일기가 갑자기 추워지는 관계인지 정임의 신열이 오후면 삼십팔 도를 넘고 기침도 대단합니다. 저는 염려가 되어서 정임더러 하얼빈에서 입원하여 조리를 하라고 권하였지마는 도무지 듣지를 아니합니다. 어디까지든지 가는 대로 가다가 더 못 가게 되면 그 곳에서 죽는다고 합니다. +저는 그 동안 며칠 정임과 같이 있는 중에 정임이가 어떻게 아름답고 높고 굳세게 깨끗한 여자인 것을 발견하였습니다. 저는 지금까지 정임을 몰라본 것을 부끄럽게 생각합니다. 그리고 또 제 아버지께서 어떻게 갸륵한 어른이신 것을 인제야 깨달았습니다. 자식 된 저까지도 아버지와 정임과의 관계를 의심하였습니다. 의심하는 것보다는 세상에서 말하는 대로 믿고 있었습니다. 그러나 정임을 만나 보고 정임의 말을 듣고 아버지께서 선생님께 드린 편지가 모두 참인 것을 깨달았습니다. 아버지께서는 친구의 의지 없는 딸인 정임을 당신의 친혈육인 저와 꼭 같이 사랑하려고 하신 것이었습니다. 그것이 얼마나 갸륵한 일입니까. 그런데 제 어머니와 저는 그 갸륵하신 정신을 몰라보고 오해하였습니다. 어머니는 질투하시고 저는 시기하였습니다. 이것이 얼마나 아버지를 그렇게 갸륵하신 아버지를 몰라뵈온 것입니다. 이것이 얼마나 부끄럽고 원통한 일입니까. +선생님께서도 여러 번 아버지의 인격이 높다는 것을 저희 모녀에게 설명해 주셨습니다마는 마음이 막힌 저는 선생님의 말씀도 믿지 아니하였습니다. +선생님, 정임은 참으로 아버지를 사랑합니다. 정임에게는 이 세상에 아버지밖에는 사랑하는 아무것도 없이, 그렇게 외●으로, 그렇게 열렬하게 아버지를 사모하고 사랑합니다. 저는 잘 압니다. 정임이가 처음에는 아버지로 사랑하였던 것을, 그러나 어느 새에 정임의 아버지에게 대한 사랑이 무엇인지 모를 사랑으로 변한 것을, 그것이 연애냐 하고 물으면 정임은 아니라고 할 것입니다. 정임의 그 대답은 결코 거짓이 아닙니다. 정임은 숙성하지마는 아직도 극히 순결합니다. 정임은 부모를 잃은 후에 아버지밖에 사랑한 사람이 없습니다. 또 아버지에게밖에 사랑받던 일도 없습니다. 그러니깐 정임은 아버지를 그저 사랑합니다 전적으로 사랑합니다. 선생님, 정임의 사랑에는 아버지에 대한 자식의 사랑, 오라비에 대한 누이의 사랑, 사내 친구에 대한 여자 친구의 사랑, 애인에 대한 애인의 사랑, 이 밖에 존경하고 숭배하는 선생에 대한 제자의 사랑까지, 사랑의 모든 종류가 포함되어 있는 것을 저는 발견하였습니다. +선생님, 정임의 정상은 차마 볼 수가 없습니다. 아버지의 안부를 근심하는 양은 제 몇십 배나 되는지 모르게 간절합니다. 정임은 저 때문에 아버지가 불행하게 되셨다고 해서 차마 볼 수 없게 애통하고 있습니다. 진정을 말씀하오면 저는 지금 아버지보다도 어머니보다도 정임에게 가장 동정이 끌립니다. 선생님, 저는 아버지를 찾아가는 것이 아니라 정임을 돕기 위하여 간호하기 위하여 가는 것 같습니다. +선생님, 저는 아직 사랑이란 것이 무엇인지를 모릅니다. 그러나 정임을 보고 사랑이란 것이 어떻게 신비하고 열렬하고 놀라운 것인가를 안 것 같습니다. +순임의 편지는 계속된다. +선생님, 하얼빈에 오는 길에 송화강 굽이를 볼 때에는 정임이가 어떻게나 울었는지, 그것은 차마 볼 수가 없었습니다. 아버지께서 송화강을 보시고 감상이 깊으셨더란 것을 생각한 것입니다. 무인지경으로, 허옇게 눈이 덮인 벌판으로 흘러가는 송화강 굽이, 그것은 슬픈 풍경입니다. 아버지께서 여기를 지나실 때에는 마른 풀만 있는 광야였을 것이니 그 때에는 더욱 황량하였을 것이라고 정임은 말하고 웁니다. +정임은 제가 아버지를 아는 것보다 아버지를 잘 아는 것 같습니다. 평소에 아버지와는 그리 접촉이 없건마는 정임은 아버지의 의지력, 아버지의 숨은 열정, 아버지의 성미까지 잘 압니다. 저는 정임의 말을 듣고야 비로소 참 그래, 하는 감탄을 발한 일이 여러 번 있습니다. +정임의 말을 듣고야 비로소 아버지가 남보다 뛰어나신 인물인 것을 깨달았습니다. 아버지는 정의감이 굳세고 겉으로는 싸늘하도록 이지적이지마는 속에는 불 같은 열정이 있으시고, 아버지는 쇠 같은 의지력과 칼날 같은 판단력이 있어서 언제나 주저하심이 없고 또 흔들리심이 없다는 것, 아버지께서는 모든 것을 용서하고 모든 것을 호의로 해석하여서 누구를 미워하거나 원망하심이 없는 등, 정임은 아버지의 마음의 목록과 설명서를 따로 외우는 것처럼 아버지의 성격을 설명합니다. 듣고 보아서 비로소 아버지의 딸인 저는 내 아버지가 어떤 아버지인가를 알았습니다. +선생님, 이해가 사랑을 낳는단 말씀이 있지마는 저는 정임을 보아서 사랑이 이해를 낳는 것이 아닌가 합니다. +어쩌면 어머니와 저는 평생을 아버지를 모시고 있으면서도 아버지를 몰랐습니까. 이성이 무디고 양심이 흐려서 그랬습니까. 정임은 진실로 존경할 여자입니다. 제가 남자라 하더라도 정임을 아니 사랑하고는 못 견디겠습니다. +아버지는 분명 정임을 사랑하신 것입니다. 처음에는 친구의 딸로, 다음에는 친딸과 같이, 또 다음에는 무엇인지 모르게 뜨거운 사랑이 생겼으리라고 믿습니다. 그것을 아버지는 죽인 것입니다. 그것을 죽이려고 이 달할 수 없는 사랑을 죽이려고 시베리아로 달아나신 것입니다. 인제야 아버지께서 선생님께 하신 편지의 뜻이 알아진 것 같습니다. 백설이 덮인 시베리아의 삼림 속으로 혼자 헤매며 정임에게로 향하는 사랑을 죽이려고 무진 애를 쓰시는 그 심정이 알아지는 것 같습니다. +선생님 이것이 얼마나 비참한 일입니까. 저는 정임의 짐에 지니고 온 일기를 보다가 이러한 구절을 발견하였습니다. +선생님. 저는 세인트 오거스틴의 <참회록>을 절반이나 다 보고 나도 잠이 들지 아니합니다. 잠이 들기 전에 제가 항상 즐겨하는 아베마리아의 노래를 유성기로 듣고 나서 오늘 일기를 쓰려고 하니 슬픈 소리만 나옵니다. +사랑하는 어른이여. 저는 멀리서 당신을 존경하고 신뢰하는 마음에서만 살아야 할 것을 잘 압니다. 여기에서 영원한 정지를 하지 아니하면 아니 됩니다. 비록 제 생명이 괴로움으로 끊어지고 제 혼이 피어 보지 못하고 스러져 버리더라도 저는 이 멀리서 바라보는 존경과 신뢰의 심경에서 한 발자국이라도 옮기지 않아야 할 것을 잘 압니다. 나를 위하여 놓여진 생의 궤도는 나의 생명을 부인하는 억지의 길입니다. 제가 몇 년 전 기숙사 베드에서 이런 밤에 내다보면 즐겁고 아름답던 내 생의 꿈은 다 깨어졌습니다. +제 영혼의 한 조각이 먼 세상 알지 못할 세계로 떠다니고 있습니다. 잃어버린 마음 조각 어찌하다가 제가 이렇게 되었는지 모릅니다. +피어 오르는 생명의 광채를 스스로 사형에 처하지 아니하면 아니 될 때 어찌 슬픔이 없겠습니까. 이것은 현실로 사람의 생명을 죽이는 것보다 더 무서운 죄가 아니오리까. 나의 세계에서 처음이요 마지막으로 발견한 빛을 어둠 속에 소멸해 버리라는 이 일이 얼마나 떨리는 직무오리까. 이 허깨비의 형의 사람이 살기 위하여 내 손으로 칼을 들어 내 영혼의 환희를 쳐야 옳습니까. 저는 하나님을 원망합니다. +이렇게 씌어 있습니다. 선생님 이것이 얼마나 피 흐르는 고백입니까. +선생님, 저는 정임의 이 고백을 보고 무조건으로 정임의 사랑을 시인합니다. 선생님, 제 목숨을 바쳐서 하는 일에 누가 시비를 하겠습니까. 더구나 그 동기에 티끌만큼도 불순한 것이 없음에야 무조건으로 시인하지 아니하고 어찌합니까. +바라기는 정임의 병이 크게 되지 아니하고 아버지께서 무사히 계셔서 속히 만나뵙게 되는 것입니다마는 앞길이 망망하여 가슴이 두근거림을 금치 못합니다. 게다가 오늘은 함박눈이 퍼부어서 천지가 온통 회색으로 한 빛이 되었으니 더욱 전도가 막막합니다. 그러나 선생님 저는 앓는 정임을 데리고 용감하게 시베리아 길을 떠납니다. +한 일 주일 후에 또 편지 한 장이 왔다. 그것도 순임의 편지여서 이러한 말이 있었다. +……오늘 새벽에 흥안령을 지났습니다. 플랫폼의 한란계는 영하 이십삼 도를 가리켰습니다. 사람들의 얼굴은 솜털에 성에가 슬어서 남녀 노소 할 것 없이 하얗게 분을 바른 것 같습니다. 유리에 비친 내 얼굴도 그와 같이 흰 것을 보고 놀랐습니다. 숨을 들이쉴 때에는 코털이 얼어서 숨이 끊기고 바람결이 지나가면 눈물이 얼어서 눈썹이 마주 붙습니다. 사람들은 털과 가죽에 싸여서 곰같이 보입니다. +또 이런 말도 있었다. +아라사 계집애들이 우유병들을 품에 품고 서서 손님이 사기를 기다리고 있습니다. 저도 두 병을 사서 정임이와 나누어 먹었습니다. 우유는 따뜻합니다. 그것을 식히지 아니할 양으로 품에 품고 섰던 것입니다. +또 이러한 구절도 있었다. +정거장에 닿을 때마다 저희들은 밖을 내다봅니다. 행여나 아버지가 거기 계시지나 아니할까 하고요. 차가 어길 때에는 더구나 마음이 조입니다. 아버지가 그 차를 타고 지나가시지나 아니하는가 하고요. 그리고는 정임은 웁니다. 꼭 뵈올 어른을 놓쳐나 버린 듯이. +그리고는 이 주일 동안이나 소식이 없다가 편지 한 장이 왔다. 그것은 정임의 글씨였다. +선생님, 저는 지금 최 선생께서 계시던 바이칼 호반의 그 집에 와서 홀로 누웠습니다. 순임은 주인 노파와 함께 F역으로 최 선생을 찾아서 오늘 아침에 떠나고 병든 저만 혼자 누워서 얼음에 싸인 바이칼 호의 눈보라치는 바람 소리를 듣고 있습니다. 열은 삼십팔 도로부터 구 도 사이를 오르내리고 기침은 나고 몸의 괴로움을 견딜 수 없습니다. 그러하오나 선생님, 저는 하나님을 불러서 축원합니다. 이 실낱 같은 생명이 다 타 버리기 전에 최 선생의 낯을 다만 일 초 동안이라도 보여지이라고. 그러하오나 선생님, 이 축원이 이루어지겠습니까. +저는 한사코 F역까지 가려 하였사오나 순임 형이 울고 막사오며 또 주인 노파가 본래 미국 사람과 살던 사람으로 영어를 알아서 순임 형의 도움이 되겠기로 저는 이 곳에 누워 있습니다. 순임 형은 기어코 아버지를 찾아 모시고 오마고 약속하였사오나 이 넓은 시베리아에서 어디 가서 찾겠습니까. +선생님, 저는 죽음을 봅니다. 죽음이 바로 제 앞에 와서 선 것을 봅니다. 그의 손은 제 여윈 손을 잡으려고 들먹거림을 봅니다. +선생님, 죽은 뒤에도 의식이 남습니까. 만일 의식이 남는다 하면 죽은 뒤에도 이 아픔과 괴로움을 계속하지 아니하면 아니 됩니까. 죽은 뒤에는 오직 영원한 어둠과 잊어버림이 있습니까. 죽은 뒤에는 혹시나 생전에 먹었던 마음을 자유로 펼 도리가 있습니까. 이 세상에서 그립고 사모하던 이를 죽은 뒤에는 자유로 만나 보고 언제나 마음껏 같이할 수가 있습니까. 그런 일도 있습니까. 이런 일을 바라는 것도 죄가 됩니까. +정임의 편지는 더욱 절망적인 어조로 찬다. +저는 처음 병이 났을 때에는 죽는 것이 싫고 무서웠습니다. 그러나 지금은 죽는 것이 조금도 무섭지 아니합니다. 다만 차마 죽지 못하는 것이 한. +하고는 `다만 차마' 이하를 박박 지워 버렸다. 그리고는 새로 시작하여 나와내 가족에게 대한 문안을 하고는 끝을 막았다. +나는 이 편지를 받고 울었다. 무슨 큰 비극이 가까운 것을 예상하게 하였다. +그 후 한 십여 일이나 지나서 전보가 왔다. 그것은 영문으로 씌었는데, +"아버지 병이 급하다. 나로는 어쩔 수 없다. 돈 가지고 곧 오기를 바란다." +하고 그 끝에 B호텔이라고 주소를 적었다. 전보 발신국이 이르쿠츠크인 것을 보니 B호텔이라 함은 이르쿠츠크인 것이 분명하였다. +나는 최석 부인에게 최석이가 아직 살아 있다는 것을 전하고 곧 여행권 수속을 하였다. 절망으로 알았던 여행권은 사정이 사정인만큼 곧 발부되었다. +나는 비행기로 여의도를 떠났다. 백설에 개개한 땅을, 남빛으로 푸른 바다를 굽어보는 동안에 대련을 들러 거기서 다른 비행기를 갈아타고 봉천, 신경, 하얼빈을 거쳐, 치치하얼에 들렀다가 만주리로 급행하였다. +웅대한 대륙의 설경도 나에게 아무러한 인상도 주지 못하였다. 다만 푸른 하늘과 희고 평평한 땅과의 사이로 한량 없이 허공을 날아간다는 생각밖에 없었다. 그것은 사랑하는 두 친구가 목숨이 경각에 달린 것을 생각할 때에 마음에 아무 여유도 없는 까닭이었다. +만주리에서도 비행기를 타려 하였으나 소비에트 관헌이 허락을 아니 하여 열차로 갈 수밖에 없었다. +초조한 몇 밤을 지나고 이르쿠츠크에 내린 것이 오전 두시. 나는 B호텔로 이스보스치카라는 마차를 몰았다. 죽음과 같이 고요하게 눈 속에 자는 시간에는 여기저기 전등이 반짝거릴 뿐, 이따금 밤의 시가를 경계하는 병정들의 눈이 무섭게 빛나는 것이 보였다. +B호텔에서 미스 초이(최 양)를 찾았으나 순임은 없고 어떤 서양 노파가 나와서, +"유 미스터 Y?" +하고 의심스러운 눈으로 나를 보았다. +그렇다는 내 대답을 듣고는 노파는 반갑게 손을 내밀어서 내 손을 잡았다. +나는 넉넉하지 못한 영어로 그 노파에게서 최석이가 아직 살았다는 말과 정임의 소식은 들은 지 오래라는 말과 최석과 순임은 여기서 삼십 마일이나 떨어진 F역에서도 썰매로 더 가는 삼림 속에 있다는 말을 들었다. +나는 그 밤을 여기서 지내고 이튿날 아침에 떠나는 완행차로 그 노파와 함께 이르쿠츠크를 떠났다. +이 날도 천지는 오직 눈뿐이었다. 차는 가끔 삼림 중으로 가는 모양이나 모두 회색빛에 가리워서 분명히 보이지를 아니하였다. +F역이라는 것은 삼림 속에 있는 조그마한 정거장으로 집이라고는 정거장 집밖에 없었다. 역부 두엇이 털옷에 하얗게 눈을 뒤쓰고 졸리는 듯이 오락가락할 뿐이었다. +우리는 썰매 하나를 얻어 타고 어디가 길인지 분명치도 아니한 눈 속으로 말을 몰았다. +바람은 없는 듯하지마는 그래도 눈발을 한편으로 비끼는 모양이어서 아름드리 나무들의 한쪽은 하얗게 눈으로 쌓이고 한쪽은 검은 빛이 더욱 돋보였다. 백 척은 넘을 듯한 꼿꼿한 침엽수(전나무 따윈가)들이 어디까지든지, 하늘에서 곧 내려박은 못 모양으로, 수없이 서 있는 사이로 우리 썰매는 간다. 땅에 덮인 눈은 새로 피워 놓은 솜같이 희지마는 하늘에서 내리는 눈은 구름빛과 공기빛과 어울려서 밥 잦힐 때에 굴뚝에서 나오는 연기와 같이 연회색이다. +바람도 불지 아니하고 새도 날지 아니하건마는 나무 높은 가지에 쌓인 눈이 이따금 덩치로 떨어져서는 고요한 수풀 속에 작은 동요를 일으킨다. +우리 썰매가 가는 길이 자연스러운 복잡한 커브를 도는 것을 보면 필시 얼음 언 개천 위로 달리는 모양이었다. +한 시간이나 달린 뒤에 우리 썰매는 늦은 경사지를 올랐다. 말을 어거하는 아라사 사람은 쭈쭈쭈쭈, 후르르 하고 주문을 외우듯이 입으로 말을 재촉하고 고삐를 이리 들고 저리 들어 말에게 방향을 가리킬 뿐이요, 채찍은 보이기만하고 한 번도 쓰지 아니하였다. 그와 말과는 완전히 뜻과 정이 맞는 동지인 듯하였다. +처음에는 몰랐으나 차차 추워짐을 깨달았다. 발과 무르팍이 시렸다. +"얼마나 머오?" +하고 나는 오래간만에 입을 열어서 노파에게 물었다. 노파는 털수건으로 머리를 싸매고 깊숙한 눈만 남겨 가지고 실신한 사람 모양으로 허공만 바라보고 있다가, 내가 묻는 말에 비로소 잠이나 깬 듯이, +"멀지 않소. 인젠 한 십오 마일." +하고는 나를 바라보았다. 그 눈은 아마 웃는 모양이었다. +그 얼굴, 그 눈, 그 음성이 모두 이 노파가 인생 풍파의 슬픈 일 괴로운 일에 부대끼고 지친 것을 표하였다. 그리고 죽는 날까지 살아간다 하는 듯하였다. +경사지를 올라서서 보니 그것은 한 산등성이였다. 방향은 알 수 없으나 우리가 가는 방향에는 더 높은 등성이가 있는 모양이나 다른 곳은 다 이보다 낮은 것 같아서 하얀 눈바다가 끝없이 보이는 듯하였다. 그 눈보라는 들쑹날쑹이 있는 것을 보면 삼림의 꼭대기인 것이 분명하였다. 더구나 여기저기 뾰족뾰족 눈송이 붙을 수 없는 마른 나뭇가지가 거뭇거뭇 보이는 것을 보아서 그러하였다. 만일 눈이 걷혀 주었으면 얼마나 안계가 넓으랴, 최석 군이 고민하는 가슴을 안고 이리로 헤매었구나 하면서 나는 목을 둘러서 사방을 바라보았다. +우리는 그 등성이를 내려갔다. 말이 미처 발을 땅에 놓을 수가 없는 정도로 빨리 내려갔다. 여기는 산불이 났던 자리인 듯하여 거뭇거뭇 불탄 자국 있는 마른 나무들이 드문드문 서 있었다. 그 나무들은 찍어 가는 사람도 없으매 저절로 썩어서 없어지기를 기다릴 수밖에 없었다. 그들은 나서 아주 썩어 버리기까지 천 년 이상은 걸린다고 하니 또한 장한 일이다. +이 대삼림에 불이 붙는다 하면 그것은 장관일 것이다. 달밤에 높은 곳에서 이 경치를 내려다본다 하면 그도 장관일 것이요, 여름에 한창 기운을 펼 때도 장관일 것이다. 나는 오뉴월경에 시베리아를 여행하는 이들이 끝없는 꽃바다를 보았다는 기록을 생각하였다. +"저기요!" +하는 노파의 말에 나는 생각의 줄을 끊었다. 저기라고 가리키는 곳을 보니 거기는 집이라고 생각되는 물건이 나무 사이로 보였다. 창이 있으니 분명 집이었다. +우리 이스보스치카가 가까이 오는 것을 보았는지, 그 집 같은 물건의 문 같은 것이 열리며 검은 외투 입은 여자 하나가 팔을 허우적거리며 뛰어나온다. 아마 소리도 치는 모양이겠지마는 그 소리는 아니 들렸다. 나는 그것이 순임인 줄을 얼른 알았다. 또 순임이밖에 될 사람도 없었다. +순임은 한참 달음박질로 오다가 눈이 깊어서 걸음을 걷기가 힘이 드는지 멈칫 섰다. 그의 검은 외투는 어느덧 흰 점으로 얼려져 가지고 어깨는 희게 되는 것이 보였다. +순임의 갸름한 얼굴이 보였다. +"선생님!" +하고 순임도 나를 알아보고는 또 팔을 허우적거리며 소리를 질렀다. +나도 반가워서 모자를 벗어 둘렀다. +"아이 선생님!" +하고 순임은 내가 썰매에서 일어서기도 전에 내게 와서 매달리며 울었다. +"아버지 어떠시냐?" +하고 나는 순임의 등을 두드렸다. 나는 다리가 마비가 되어서 곧 일어설 수가 없었다. +"아버지 어떠시냐?" +하고 나는 한 번 더 물었다. +순임은 벌떡 일어나 두 주먹으로 흐르는 눈물을 쳐내 버리며, +"대단하셔요." +하고도 울음을 금치 못하였다. +노파는 벌써 썰매에서 내려서 기운 없는 걸음으로 비틀비틀 걷기를 시작하였다. +나는 순임을 따라서 언덕을 오르며, +"그래 무슨 병환이시냐?" +하고 물었다. +"몰라요. 신열이 대단하셔요." +"정신은 차리시든?" +"처음 제가 여기 왔을 적에는 그렇지 않더니 요새에는 가끔 혼수 상태에 빠지시는 모양이야요." +이만한 지식을 가지고 나는 최석이가 누워 있는 집 앞에 다다랐다. +이 집은 통나무를 댓 개 우물 정자로 가로놓고 지붕은 무엇으로 했는지 모르나 눈이 덮이고, 문 하나 창 하나를 내었는데 문은 나무껍질인 모양이나 창은 젖빛 나는 유리창인 줄 알았더니 뒤에 알아본즉 그것은 유리가 아니요, 양목을 바르고 물을 뿜어서 얼려 놓은 것이었다. 그리고 통나무와 통나무 틈바구니에는 쇠털과 같은 마른 풀을 꼭꼭 박아서 바람을 막았다. +문을 열고 들어서니 부엌에 들어서는 모양으로 쑥 빠졌는데 화끈화끈하는 것이 한증과 같다. 그렇지 않아도 침침한 날에 언 눈으로 광선 부족한 방에 들어오니, 캄캄 절벽이어서 아무것도 보이지 아니하였다. +순임이가 앞서서 양초에 불을 켠다. 촛불 빛은 방 한편 쪽 침대라고 할 만한 높은 곳에 담요를 덮고 누운 최석의 시체와 같은 흰 얼굴을 비춘다. +"아버지, 아버지 샌전 아저씨 오셨어요." +하고 순임은 최석의 귀에 입을 대고 가만히 불렀다. +그러나 대답이 없었다. +나는 최석의 이마를 만져 보았다. 축축하게 땀이 흘렀다. 그러나 그리 더운 줄은 몰랐다. +방 안의 공기는 숨이 막힐 듯하였다. 그 난방 장치는 삼굿의 원리를 이용한 것이었다. 돌멩이로 아궁이를 쌓고 그 위에 큰 돌멩이들을 많이 쌓고 거기다가 불을 때어서 달게 한 뒤에 거기 눈을 부어 뜨거운 증기를 발하는 것이었다. +이 건축법은 조선 동포들이 시베리아로 금광을 찾아다니면서 하는 법이란 말을 들었으나 최석이가 누구에게서 배워 가지고 어떤 모양으로 지었는지는 최석의 말을 듣기 전에는 알 수 없는 일이다. +나는 내 힘이 미치는 데까지 최석의 병 치료에 대한 손을 쓰고 어떻게 해서든지 이르쿠츠크의 병원으로 최석을 데려다가 입원시킬 도리를 궁리하였다. 그러나 냉정하게 생각하면 최석은 살아날 가망이 없는 것만 같았다. +내가 간 지 사흘 만에 최석은 처음으로 정신을 차려서 눈을 뜨고 나를 알아보았다. +그는 반가운 표정을 하고 빙그레 웃기까지 하였다. +"다 일없나?" +이런 말도 알아들을 수가 있었다. +그러나 심히 기운이 없는 모양이기로 나는 많이 말을 하지 아니하였다. +최석은 한참이나 눈을 감고 있더니, +"정임이 소식 들었나?" +하였다. +"괜찮대요." +하고 곁에서 순임이가 말하였다. +그리고는 또 혼몽하는 듯하였다. +그 날 또 한 번 최석은 정신을 차리고 순임더러는 저리로 가라는 뜻을 표하고 나더러 귀를 가까이 대라는 뜻을 보이기로 그대로 하였더니, +"내 가방 속에 일기가 있으니 그걸 자네만 보고는 불살라 버려. 내가 죽은 뒤에라도 그것이 세상 사람의 눈에 들면 안 되지. 순임이가 볼까 걱정이 되지마는 내가 몸을 꼼짝할 수가 있나." +하는 뜻을 말하였다. +"그러지." +하고 나는 고개를 끄덕여 보였다. +그러고 난 뒤에 나는 최석이가 시킨 대로 가방을 열고 책들을 뒤져서 그 일기책이라는 공책을 꺼내었다. +"순임이 너 이거 보았니?" +하고 나는 곁에서 내가 책 찾는 것을 보고 섰던 순임에게 물었다. +"아니오. 그게 무어여요?" +하고 순임은 내 손에 든 책을 빼앗으려는 듯이 손을 내밀었다. +나는 순임의 손이 닿지 않도록 책을 한편으로 비키며, +"이것이 네 아버지 일기인 모양인데 너는 보이지 말고 나만 보라고 하셨다. 네 아버지가 네가 이것을 보았을까 해서 염려를 하시는데 안 보았으면 다행이다." +하고 나는 그 책을 들고 밖으로 나왔다. +날이 밝다. 해는 중천에 있다. 중천이래야 저 남쪽 지평선 가까운 데다. 밤이 열여덟 시간, 낮이 대여섯 시간밖에 안 되는 북쪽 나라다. 멀건 햇빛이다. +나는 볕이 잘 드는 곳을 골라서 나무에 몸을 기대고 최석의 일기를 읽기 시작하였다. 읽은 중에서 몇 구절을 골라 볼까. +"집이 다 되었다. 이 집은 내가 생전 살고 그 속에서 이 세상을 마칠 집이다. 마음이 기쁘다. 시끄러운 세상은 여기서 멀지 아니하냐. 내가 여기 홀로 있기로 누가 찾을 사람도 없을 것이다. 내가 여기서 죽기로 누가 슬퍼해 줄 사람도 없을 것이다. 때로 곰이나 찾아올까. 지나가던 사슴이나 들여다볼까. +이것이 내 소원이 아니냐. 세상의 시끄러움을 떠나는 것이 내 소원이 아니냐. 이 속에서 나는 나를 이기기를 공부하자." +첫날은 이런 평범한 소리를 썼다. +그 이튿날에는. +"어떻게나 나는 약한 사람인고. 제 마음을 제가 지배하지 못하는 사람인고. 밤새도록 나는 정임을 생각하였다. 어두운 허공을 향하여 정임을 불렀다. 정임이가 나를 찾아서 동경을 떠나서 이리로 오지나 아니하나 하고 생각하였다. 어떻게나 부끄러운 일인고? 어떻게나 가증한 일인고? +나는 아내를 생각하려 하였다. 아이들을 생각하려 하였다. 아내와 아이들을 생각함으로 정임의 생각을 이기려 하였다. +최석아, 너는 남편이 아니냐. 아버지가 아니냐. 정임은 네 딸이 아니냐. 이런 생각을 하였다. +그래도 정임의 일류전은 아내와 아이들의 생각을 밀치고 달려오는 절대 위력을 가진 듯하였다. +아, 나는 어떻게나 파렴치한 사람인고. 나이 사십이 넘어 오십을 바라보는 놈이 아니냐. 사십에 불혹이라고 아니 하느냐. 교육가로 깨끗한 교인으로 일생을 살아 왔다고 자처하는 내가 아니냐 하고 나는 내 입으로 내 손가락을 물어서 두 군데나 피를 내었다." +최석의 둘째 날 일기는 계속된다. +"내 손가락에서 피가 날 때에 나는 유쾌하였다. 나는 승첩의 기쁨을 깨달았다. +그러나 아아 그러나 그 빨간, 참회의 핏방울 속에서도 애욕의 불길이 일지 아니하는가. 나는 마침내 제도할 수 없는 인생인가." +이 집에 든 지 둘째날에 벌써 이러한 비관적 말을 하였다. +또 며칠을 지난 뒤 일기에, +"나는 동경으로 돌아가고 싶다. 정임의 곁으로 가고 싶다. 시베리아의광야의 유혹도 아무 힘이 없다. 어젯밤은 삼림의 좋은 달을 보았으나 그 달을 아름답게 보려 하였으나 아무리 하여도 아름답게 보이지를 아니하였다. +하늘이나 달이나 삼림이나 모두 무의미한 존재다. 이처럼 무의미한 존재를 나는 경험한 일이 없다. 그것은 다만 기쁨을 자아내지 아니할 뿐더러 슬픔도 자아내지 못하였다. 그것은 잿더미였다. 아무도 듣는 이 없는 데서 내 진정을 말하라면 그것은 이 천지에 내게 의미 있는 것은 정임이밖에 없다는 것이다. +나는 정임의 곁에 있고 싶다. 정임을 내 곁에 두고 싶다. 왜? 그것은 나도 모른다. +만일 이 움 속에라도 정임이가 있다 하면 얼마나 이것이 즐거운 곳이 될까. +그러나 이것은 불가능한 일이다. 이 일이 있어서는 아니 된다. 나는 이 생각을 죽여야 한다. 다시 거두를 못 하도록 목숨을 끊어 버려야 한다. +이것을 나는 원한다. 원하지마는 내게는 그 힘이 없는 모양이다. +나는 종교를 생각하여 본다. 철학을 생각하여 본다. 인류를 생각하여 본다. 나라를 생각하여 본다. 이것을 가지고 내 애욕과 바꾸려고 애써 본다. 그렇지마는 내게 그러한 힘이 없다. 나는 완전히 헬플리스함을 깨닫는다. +아아 나는 어찌할꼬? +나는 못생긴 사람이다. 그까짓 것을 못 이겨? 그까짓 것을 못 이겨? +나는 예수의 광야에서의 유혹을 생각한다. 천하를 주마 하는 유혹을 생각한다. 나는 싯다르타 태자가 왕궁을 버리고 나온 것을 생각하고, 또 스토아 철학자의 의지력을 생각하였다. +그러나 나는 그러한 생각으로도 이 생각을 이길 수가 없는 것 같다. +나는 혁명가를 생각하였다. 모든 것 사랑도 목숨도 다 헌신짝같이 집어던지고 피 흐르는 마당으로 뛰어나가는 용사를 생각하였다. 나는 이끝없는 삼림 속으로 혁명의 용사 모양으로 달음박질치다가 기운이 진한 곳에서 죽어 버리는 것이 소원이었다. 그러나 거기까지도 이 생각은 따르지 아니할까. +나는 지금 곧 죽어 버릴까. 나는 육혈포를 손에 들어 보았다. 이 방아쇠를 한 번만 튕기면 내 생명은 없어지는 것이 아닌가. 그리 되면 모든 이 마음의 움직임은 소멸되는 것이 아닌가. 이것으로 만사가 해결되는 것이 아닌가. +아 하나님이시여, 힘을 주시옵소서. 천하를 이기는 힘보다도 나 자신을 이기는 힘을 주시옵소서. 이 죄인으로 하여금 하나님의 눈에 의롭고 깨끗한 사람으로 이 일생을 마치게 하여 주시옵소서, 이렇게 나는 기도를 한다. +그러나 하나님께서는 나를 버리셨다. 하나님께서는 내게 힘을 주시지 아니하시었다. 나를 이 비참한 자리에서 썩어져 죽게 하시었다." +최석은 어떤 날 일기에 또 이런 것도 썼다. 그것은 예전 내게 보낸 편지에 있던 꿈 이야기를 연상시키는 것이었다. 그것은 이러하다. +"오늘 밤은 달이 좋다. 시베리아의 겨울 해는 참 못생긴 사람과도 같이 기운이 없지마는 하얀 땅, 검푸른 하늘에 저쪽 지평선을 향하고 흘러가는 반달은 참으로 맑음 그것이었다. +나는 평생 처음 시 비슷한 것을 지었다. +임과 이별하던 날 밤에는 남쪽 나라에 바람비가 쳤네 +임 타신 자동차의 뒷불이 빨간 뒷불이 빗발에 찢겼네 +임 떠나 혼자 헤매는 시베리아의 오늘 밤에는 +지려는 쪽달이 눈 덮인 삼림에 걸렸구나 +아아 저 쪽달이여 +억지로 반을 갈겨진 것도 같아라 +아아 저 쪽달이여 +잃어진 짝을 찾아 +차디찬 허공 속을 영원히 헤매는 것도 같구나 +나도 저 달과 같이 잃어버린 반쪽을 찾아 무궁한 시간과 공간에서 헤매는 것만 같다. +에익. 내가 왜 이리 약한가. 어찌하여 크나큰 많은 일을 돌아보지 못하고 요만한 애욕의 포로가 되는가. +그러나 나는 차마 그 달을 버리고 들어올 수가 없었다. 내가 왜 이렇게 센티멘털하게 되었는고. 내 쇠 같은 의지력이 어디로 갔는고. 내 누를 수 없는 자존심이 어디로 갔는고. 나는 마치 유모의 손에 달린 젖먹이와도 같다. 내 일신은 도시 애욕 덩어리로 화해 버린 것 같다. +이른바 사랑 사랑이란 말은 종교적 의미인 것 이외에도 입에 담기도 싫어하던 말이다 이런 것은 내 의지력과 자존심을 녹여 버렸는가. 또 이 부자연한 고독의 생활이 나를 이렇게 내 인격을 이렇게 파괴하였는가. +그렇지 아니하면 내 자존심이라는 것이나, 의지력이라는 것이나, 인격이라는 것이 모두 세상의 습관과 사조에 휩쓸리던 것인가. 남들이 그러니까 남들이 옳다니까 남들이 무서우니까 이 애욕의 무덤에 회를 발랐던 것인가. 그러다가 고독과 반성의 기회를 얻으매 모든 회칠과 가면을 떼어 버리고 빨가벗은 애욕의 뭉텅이가 나온 것인가. +그렇다 하면, 이것이 참된 나인가. 이것이 하나님께서 지어 주신 대로의 나인가. 가슴에 타오르는 애욕의 불길 이 불길이 곧 내 영혼의 불길인가. +어쩌면 그 모든 높은 이상들 인류에 대한, 민족에 대한, 도덕에 대한, 신앙에 대한 그 높은 이상들이 이렇게도 만만하게 마치 바람에 불리는 재 모양으로 자취도 없이 흩어져 버리고 말까. 그리고 그 뒤에는 평소에그렇게도 미워하고 천히 여기던 애욕의 검은 흙만 남고 말까. +아아 저 눈 덮인 땅이여, 차고 맑은 달이여, 허공이여! 나는 너희들을 부러워하노라. +불교도들의 해탈이라는 것이 이러한 애욕이 불붙는 지옥에서 눈과 같이 싸늘하고 허공과 같이 빈 곳으로 들어감을 이름인가. +석가의 팔 년 간 설산 고행이 이 애욕의 뿌리를 끊으려 함이라 하고 예수의 사십 일 광야의 고행과 겟세마네의 고민도 이 애욕의 뿌리 때문이었던가. +그러나 그것을 이기어 낸 사람이 천지 개벽 이래에 몇몇이나 되었는고? 나 같은 것이 그 중에 한 사람 되기를 바랄 수가 있을까. +나 같아서는 마침내 이 애욕의 불길에 다 타서 재가 되어 버릴 것만 같다. 아아 어떻게나 힘있고 무서운 불길인고." +이러한 고민의 자백도 있었다. +또 어떤 날 일기에는 최석은 이런 말을 썼다. +"나는 단연히 동경으로 돌아가기를 결심하였다." +그리고는 그 이튿날은, +"나는 단연히 동경으로 돌아가리란 결심을 한 것을 굳세게 취소한다. 나는 이러한 결심을 하는 나 자신을 굳세게 부인한다." +또 이런 말도 있다. +"나는 정임을 시베리아로 부르련다." +또 그 다음에는, +"아아 나는 하루바삐 죽어야 한다. 이 목숨을 연장하였다가는 무슨 일을 저지를는지 모른다. 나는 깨끗하게 나를 이기는 도덕적 인격으로 이 일생을 마쳐야 한다. 이 밖에 내 사업이 무엇이냐." +또 어떤 곳에는, +"아아 무서운 하룻밤이었다. 나는 지난 하룻밤을 누를 수 없는 애욕의 불길에 탔다. 나는 내 주먹으로 내 가슴을 두드리고 머리를 벽에 부딪쳤다. 나는 주먹으로 담벽을 두드려 손등이 터져서 피가 흘렀다. 나는 내 머리카락을 쥐어뜯었다. 나는 수없이 발을 굴렀다. 나는 이 무서운 유혹을 이기려고 내 몸을 아프게 하였다. 나는 견디다 못하여 문을 박차고 뛰어나갔다. 밖에는 달이 있고 눈이 있었다. 그러나 눈은 핏빛이요, 달은 찌그러진 것 같았다. 나는 눈 속으로 달음박질쳤다. 달을 따라서 엎드러지며 자빠지며 달음질쳤다. 나는 소리를 질렀다. 나는 미친 사람 같았다." +그러고는 어디까지 갔다가 어느 때에 어떠한 심경의 변화를 얻어 가지고 돌아왔다는 말은 쓰이지 아니하였으나 최석의 병의 원인을 설명하는 것 같았다. +"열이 나고 기침이 난다. 가슴이 아프다. 이것이 폐렴이 되어서 혼자 깨끗하게 이 생명을 마치게 하여 주소서 하고 빈다. 나는 오늘부터 먹고 마시기를 그치련다." +이러한 말을 썼다. 그러고는, +"정임, 정임, 정임, 정임." +하고 정임의 이름을 수없이 쓴 것도 있고, 어떤 데는, +"Overcome, Overcome." +하고 영어로 쓴 것도 있었다. +그리고 마지막에, +"나는 죽음과 대면하였다. 사흘째 굶고 앓은 오늘에 나는 극히 맑고 침착한 정신으로 죽음과 대면하였다. 죽음은 검은 옷을 입었으나 그 얼굴에는 자비의 표정이 있었다. 죽음은 곧 검은 옷을 입은 구원의 손이었다. 죽음은 아름다운 그림자였다. 죽음은 반가운 애인이요, 결코 무서운 원수가 아니었다. 나는 죽음의 손을 잡노라. 감사하는 마음으로 죽음의 품에 안기노라. 아멘." +이것을 쓴 뒤에는 다시는 일기가 없었다. 이것으로 최석이가 그 동안 지난 일을 적어도 심리적 변화만은 대강 추측할 수가 있었다. +다행히 최석의 병은 점점 돌리는 듯하였다. 열도 내리고 식은땀도 덜 흘렸다. 안 먹는다고 고집하던 음식도 먹기를 시작하였다. +정임에게로 갔던 노파에게서는 정임도 열이 내리고 일어나 앉을 만하다는 편지가 왔다. +나는 노파의 편지를 최석에게 읽어 주었다. 최석은 그 편지를 듣고 매우 흥분하는 모양이었으나 곧 안심하는 빛을 보였다. +나는 최석의 병이 돌리는 것을 보고 정임을 찾아볼 양으로 떠나려 하였으나 순임이가 듣지 아니하였다. 혼자서 앓는 아버지를 맡아 가지고 있을 수는 없다는 것이었다. 그래서 노파가 오기를 기다리기로 하였다. +나는 최석이가 먹을 음식도 살 겸 우편국에도 들를 겸 시가까지 가기로 하고 이 곳 온 지 일 주일이나 지나서 처음으로 산에서 나왔다. +나는 이르쿠츠크에 가서 최석을 위하여 약품과 먹을 것을 사고 또 순임을 위해서도 먹을 것과 의복과 또 하모니카와 손풍금도 사 가지고 정거장에 나와서 돌아올 차를 기다리고 있었다. +나는 순후해 보이는 아라사 사람들이 정거장에서 오락가락하는 것을 보고 속으로는 최석이가 병이 좀 나은 것을 다행으로 생각하고, 또 최석과 정임의 장래가 어찌 될까 하는 것도 생각하면서 뷔페(식당)에서 뜨거운 차이(차)를 마시고 있었다. +이 때에 밖을 바라보고 있던 내 눈은 문득 이상한 것을 보았다. 그것은 그 노파가 이리로 향하고 걸어오는 것인데 그 노파와 팔을 걸은 젊은 여자가 있는 것이다. 머리를 검은 수건으로 싸매고 입과 코를 가리웠으니 분명히 알 수 없으나 혹은 정임이나 아닌가 할 수밖에 없었다. 정임이가 몸만 기동하게 되면 최석을 보러 올 것은 정임의 열정적인 성격으로 보아서 당연한 일이기 때문이었다. +나는 반쯤 먹던 차를 놓고 뷔페 밖으로 뛰어나갔다. +"오 미시즈 체스터필드?" +하고 나는 노파 앞에 손을 내어밀었다. 노파는 체스터필드라는 미국 남편의 성을 따라서 부르는 것을 기억하였다. +"선생님!" +하는 것은 정임이었다. 그 소리만은 변치 아니하였다. 나는 검은 장갑을 낀 정임의 손을 잡았다. 나는 여러 말 아니하고 노파와 정임을 뷔페로 끌고 들어왔다. +늙은 뷔페 보이는 번쩍번쩍하는 사모바르에서 차 두 잔을 따라다가 노파와 정임의 앞에 놓았다. +노파는 어린애에게 하는 모양으로 정임의 수건을 벗겨 주었다. 그 속에서는 해쓱하게 여윈 정임의 얼굴이 나왔다. 두 볼에 불그레하게 홍훈이 도는 것도 병 때문인가. +"어때? 신열은 없나?" +하고 나는 정임에게 물었다. +"괜찮아요." +하고 정임은 웃으며, +"최 선생님께서는 어떠세요?" +하고 묻는다. +"좀 나으신 모양이야. 그래서 나는 오늘 정임을 좀 보러 가려고 했는데 이 체스터필드 부인께서 아니 오시면 순임이가 혼자 있을 수가 없다고 해서, 그래 이렇게 최 선생 자실 것을 사 가지고 가는 길이야." +하고 말을 하면서도 나는 정임의 눈과 입과 목에서 그의 병과 마음을 알아보려고 애를 썼다. +중병을 앓은 깐 해서는 한 달 전 남대문서 볼 때보다 얼마 더 초췌한 것 같지는 아니하였다. +"네에." +하고 정임은 고개를 숙였다. 그의 안경알에는 이슬이 맺혔다. +"선생님 댁은 다 안녕하셔요?" +"응, 내가 떠날 때에는 괜찮았어." +"최 선생님 댁도?" +"응." +"선생님 퍽은 애를 쓰셨어요." +하고 정임은 울음인지 웃음인지 모를 웃음을 웃는다. +말을 모르는 노파는 우리가 하는 말을 눈치나 채려는 듯이 멀거니 보고 있다가 서투른 영어로, +"아직 미스 남은 신열이 있답니다. 그래도 가 본다고, 죽어도 가 본다고 내 말을 안 듣고 따라왔지요." +하고 정임에게 애정 있는 눈흘김을 주며, +"유 노티 차일드(말썽꾼이)." +하고 입을 씰룩하며 정임을 안경 위로 본다. +"니체워, 마뚜슈까(괜찮아요, 어머니)." +하고 정임은 노파를 보고 웃었다. 정임의 서양 사람에게 대한 행동은 서양식으로 째었다고 생각하였다. +정임은 도리어 유쾌한 빛을 보였다. 다만 그의 붉은빛 띤 눈과 마른 입술이 그의 몸에 열이 있음을 보였다. 나는 그의 손끝과 발끝이 싸늘하게 얼었을 것을 상상하였다. +마침 이 날은 날이 온화하였다. 엷은 햇빛도 오늘은 두꺼워진 듯하였다. +우리 세 사람은 F역에서 내려서 썰매 하나를 얻어 타고 산으로 향하였다. 산도 아니지마는 산 있는 나라에서 살던 우리는 최석이가 사는 곳을 산이라고 부르는 습관을 지었다. 삼림이 있으니 산같이 생각된 까닭이었다. +노파가 오른편 끝에 앉고, 가운데다가 정임을 앉히고 왼편 끝에 내가 앉았다. +쩟쩟쩟 하는 소리에 말은 달리기 시작하였다. 한 필은 키 큰 말이요, 한 필은 키가 작은 말인데 키 큰 말은 아마 늙은 군마 퇴물인가 싶게 허우대는 좋으나 몸이 여위고 털에는 윤이 없었다. 조금만 올라가는 길이 되어도 고개를 숙이고 애를 썼다. 작은 말은 까불어서 가끔 채찍으로 얻어맞았다. +"아이 삼림이 좋아요." +하고 정임은 정말 기쁜 듯이 나를 돌아보았다. +"좋아?" +하고 나는 멋없이 대꾸하고 나서, 후회되는 듯이, +"밤낮 삼림 속에서만 사니까 지루한데." +하는 말을 붙였다. +"저는 저 눈 있는 삼림 속으로 한정 없이 가고 싶어요. 그러나 저는 인제 기운이 없으니깐 웬걸 그래 보겠어요?" +하고 한숨을 쉬었다. +"왜 그런 소릴 해. 인제 나을걸." +하고 나는 정임의 눈을 들여다보았다. 마치 슬픈 눈물 방울이나 찾으려는 듯이. +"제가 지금도 열이 삼십팔 도가 넘습니다. 정신이 흐릿해지는 것을 보니까 아마 더 올라가나 봐요. 그래도 괜찮아요. 오늘 하루야 못 살라고요. 오늘 하루만 살면 괜찮아요. 최 선생님만 한 번 뵙고 죽으면 괜찮아요." +"왜 그런 소릴 해?" +하고 나는 책망하는 듯이 언성을 높였다. +정임은 기침을 시작하였다. 한바탕 기침을 하고는 기운이 진한 듯이 노파에게 기대며 조선말로, +"추워요." +하였다. 이 여행이 어떻게 정임의 병에 좋지 못할 것은 의사가 아닌 나로도 짐작할 수가 있었다. 그러나 나로는 더 어찌할 수가 없었다. +나는 외투를 벗어서 정임에게 입혀 주고 노파는 정임을 안아서 몸이 덜 흔들리도록 또 춥지 않도록 하였다. +나는 정임의 모양을 애처로워서 차마 볼 수가 없었다. 그러나 이것은 하나님밖에는 어찌할 도리가 없는 일이었다. +얼마를 지나서 정임은 갑자기 고개를 들고 일어나며, +"인제 몸이 좀 녹았습니다. 선생님 추우시겠어요. 이 외투 입으셔요." +하고 그의 입만 웃는 웃음을 웃었다. +"난 춥지 않아. 어서 입고 있어." +하고 나는 정임이가 외투를 벗는 것을 막았다. 정임은 더 고집하려고도 아니하고, +"선생님 시베리아의 삼림은 참 좋아요. 눈 덮인 것이 더 좋은 것 같아요. 저는 이 인적 없고 자유로운 삼림 속으로 헤매어 보고 싶어요." +하고 아까 하던 것과 같은 말을 또 하였다. +"며칠 잘 정양하여서, 날이나 따뜻하거든 한 번 산보나 해 보지." +하고 나는 정임의 말 뜻이 다른 데 있는 줄을 알면서도 부러 평범하게 대답하였다. +정임은 대답이 없었다. +"여기서도 아직 멀어요?" +하고 정임은 몸이 흔들리는 것을 심히 괴로워하는 모양으로 두 손을 자리에 짚어 몸을 버티면서 말하였다. +"고대야, 최 선생이 반가워할 터이지. 오죽이나 반갑겠나." +하고 나는 정임을 위로하는 뜻으로 말하였다. +"아이 참 미안해요. 제가 죄인이야요. 저 때문에 애매한 누명을 쓰시고 저렇게 사업도 버리시고 병환까지 나시니 저는 어떡허면 이 죄를 씻습니까?" +하고 눈물 고인 눈으로 정임은 나를 쳐다보았다. +나는 정임과 최석을 이 자유로운 시베리아의 삼림 속에 단둘이 살게 하고 싶었다. 그러나 최석은 살아나가겠지마는 정임이가 살아날 수가 있을까, 하고 나는 정임의 어깨를 바라보았다. 그의 목숨은 실낱 같은 것 같았다. 바람받이에 놓인 등잔불과만 같은 것 같았다. 이 목숨이 끊어지기 전에 사랑하는 이의 얼굴을 한 번 대하겠다는 것밖에 아무 소원이 없는 정임은 참으로 가엾어서 가슴이 미어지는 것 같았다. +"염려 말어. 무슨 걱정이야? 최 선생도 병이 돌리고 정임도 인제 얼마 정양하면 나을 것 아닌가. 아무 염려 말아요." +하고 나는 더욱 최석과 정임과 두 사람의 사랑을 달하게 할 결심을 하였다. 하나님께서 계시다면 이 가엾은 간절한 두 사람의 마음을 가슴 미어지게 아니 생각할 리가 없다고 생각하였다. 우주의 모든 일 중에 정임의 정경보다 더 슬프고 불쌍한 정경이 또 있을까 하였다. 차디찬 눈으로 덮인 시베리아의 광야에 병든 정임의 사랑으로 타는 불똥과 같이 날아가는 이 정경은 인생이 가질 수 있는 최대한 비극인 것 같았다. +정임은 지쳐서 고개를 숙이고 있다가도 가끔 고개를 들어서는 기운 나는 양을 보이려고, 유쾌한 양을 보이려고 애를 썼다. +"저 나무 보셔요. 오백 년은 살았겠지요?" +이런 말도 하였다. 그러나 그것은 다 억지로 지어서 하는 것이었다. 그러다가는 또 기운이 지쳐서는 고개를 숙이고, 혹은 노파의 어깨에 혹은 내 어깨에 쓰러졌다. +마침내 우리가 향하고 가는 움집이 보였다. +"정임이, 저기야." +하고 나는 움집을 가리켰다. +"네에?" +하고 정임은 내 손가락 가는 곳을 보고 다음에는 내 얼굴을 보았다. 잘 보이지 않는 모양이다. +"저기 저것 말야. 저기 저 고작 큰 전나무 두 개가 있지 않아? 그 사이로 보이는 저, 저거 말야. 옳지 옳지, 순임이 지금 나오지 않아?" +하였다. +순임이가 무엇을 가지러 나오는지 문을 열고 나와서는 밥 짓느라고 지어 놓은 이를테면 부엌에를 들어갔다가 나오는 길에 이 쪽을 바라보다가 우리를 발견하였는지 몇 걸음 빨리 오다가는 서서 보고 오다가는 서서 보더니 내가 모자를 내두르는 것을 보고야 우리 일행인 것을 확실히 알고 달음박질을 쳐서 나온다. +우리 썰매를 만나자, +"정임이야? 어쩌면 이 추운데." +하고 순임은 정임을 안고 그 안경으로 정임의 눈을 들여다본다. +"어쩌면 앓으면서 이렇게 와?" +하고 순임은 노파와 나를 책망하는 듯이 돌아보았다. +"아버지 어떠시냐?" +하고 나는 짐을 들고 앞서서 오면서 뒤따르는 순임에게 물었다. +"아버지요?" +하고 순임은 어른에게 대한 경의를 표하노라고 내 곁에 와서 걸으며, +"아버지께서 오늘은 말씀을 많이 하셨어요. 순임이가 고생하는구나 고맙다, 이런 말씀도 하시고, 지금 같아서는 일어날 것도 같은데 기운이 없어서, 이런 말씀도 하시고, 또 선생님이 이르쿠츠크에를 들어가셨으니 무엇을 사 오실 듯싶으냐, 알아맞혀 보아라, 이런 농담도 하시고, 정임이가 어떤가 한 번 보았으면, 이런 말씀도 하시겠지요. 또 순임아, 내가 죽더라도 정임을 네 친동생으로 알아서 부디 잘 사랑해 주어라, 정임은 불쌍한 애다, 참 정임은 불쌍해! 이런 말씀도 하시겠지요. 그렇게 여러 가지 말씀을 많이 하시더니, 순임아 내가 죽거든 선생님을 아버지로 알고 그 지도를 받아라, 그러시길래 제가 아버지 안 돌아가셔요! 그랬더니 아버지께서 웃으시면서, 죽지 말까, 하시고는 어째 가슴이 좀 거북한가, 하시더니 잠이 드셨어요. 한 시간이나 되었을까, 온." +집 앞에 거의 다 가서는 순임은 정임의 팔을 꼈던 것을 놓고 빨리 집으로 뛰어들어갔다. +치마폭을 펄럭거리고 뛰는 양에는 어렸을 적 말괄량이 순임의 모습이 남아 있어서 나는 혼자 웃었다. 순임은 정임이가 왔다는 기쁜 소식을 한 시각이라도 빨리 아버지께 전하고 싶었던 것이다. +"아버지, 주무시우? 정임이가 왔어요. 정임이가 왔습니다." +하고 부르는 소리가 밖에서도 들렸다. +나도 방에 들어서고, 정임도 뒤따라 들어서고, 노파는 부엌으로 물건을 두러 들어갔다. +방은 절벽같이 어두웠다. +"순임아, 불을 좀 켜려무나." +하고 최석의 얼굴을 찾느라고 눈을 크게 뜨고 고개를 숙이며, +"자나? 정임이가 왔네." +하고 불렀다. +정임도 곁에 와서 선다. +최석은 대답이 없었다. +순임이가 촛불을 켜자 최석의 얼굴이 환하게 보였다. +"여보게, 여봐. 자나?" +하고 나는 무서운 예감을 가지면서 최석의 어깨를 흔들었다. +그것이 무엇인지 모르지마는 최석은 시체라 하는 것을 나는 내 손을 통해서 깨달았다. +나는 깜짝 놀라서 이불을 벗기고 최석의 팔을 잡아 맥을 짚어 보았다. 거기는 맥이 없었다. +나는 최석의 자리옷 가슴을 헤치고 귀를 가슴에 대었다. 그 살은 얼음과 같이 차고 그 가슴은 고요하였다. 심장은 뛰기를 그친 것이었다. +나는 최석의 가슴에서 귀를 떼고 일어서면서, +"네 아버지는 돌아가셨다. 네 손으로 눈이나 감겨 드려라." +하였다. 내 눈에서는 눈물이 흘렀다. +"선생님!" +하고 정임은 전연히 절제할 힘을 잃어버린 듯이 최석의 가슴에 엎어졌다. 그러고는 소리를 내어 울었다. 순임은, +"아버지, 아버지!" +하고 최석의 베개 곁에 이마를 대고 울었다. +아라사 노파도 울었다. +방 안에는 오직 울음 소리뿐이요, 말이 없었다. 최석은 벌써 이 슬픈 광경도 몰라보는 사람이었다. +최석이가 자기의 싸움을 이기고 죽었는지, 또는 끝까지 지다가 죽었는지 그것은 영원한 비밀이어서 알 도리가 없었다. 그러나 이것만은 확실하다 그의 의식이 마지막으로 끝나는 순간에 그의 의식기에 떠오르던 오직 하나가 정임이었으리라는 것만은. +지금 정임이가 그의 가슴에 엎어져 울지마는, 정임의 뜨거운 눈물이 그의 가슴을 적시건마는 최석의 가슴은 뛸 줄을 모른다. 이것이 죽음이란 것이다. +뒤에 경찰의가 와서 검사한 결과에 의하면, 최석은 폐렴으로 앓던 결과로 심장마비를 일으킨 것이라고 하였다. +나는 최석의 장례를 끝내고 순임과 정임을 데리고 오려 하였으나 정임은 듣지 아니하고 노파와 같이 바이칼 촌으로 가 버렸다. +그런 뒤로는 정임에게서는 일체 음신이 없다. 때때로 노파에게서 편지가 오는데 정임은 최석이가 있던 방에 가만히 있다고만 하였다. +서투른 영어가 뜻을 충분히 발표하지 못하는 것이었다. +나는 정임에게 안심하고 병을 치료하라는 편지도 하고 돈이 필요하거든 청구하라는 편지도 하나 영 답장이 없다. +만일 정임이가 죽었다는 기별이 오면 나는 한 번 더 시베리아에 가서 둘을 가지런히 묻고 `두 별 무덤'이라는 비를 세워 줄 생각이다. 그러나 나는 정임이가 조선으로 오기를 바란다. +여러분은 최석과 정임에게 대한 이 기록을 믿고 그 두 사람에게 대한 오해를 풀라. +EOT; +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Address.php new file mode 100644 index 00000000..f8967ffe --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Address.php @@ -0,0 +1,209 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function citySuffix() + { + return static::randomElement(static::$citySuffix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public static function streetSuffix() + { + return static::randomElement(static::$streetSuffix); + } + + public static function street() + { + return static::randomElement(static::$street); + } + + /** + * Lithuania municipality + * + * @see https://en.wikipedia.org/wiki/Municipality + * + * @return string + */ + public function municipality() + { + return static::randomElement(static::$municipality); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Company.php new file mode 100644 index 00000000..89370b3d --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Company.php @@ -0,0 +1,15 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + /** + * Return male last name + * + * @return string + * + * @example 'Vasiliauskas' + */ + public function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + /** + * Return female last name + * + * @return string + * + * @example 'Žukauskaitė' + */ + public function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + /** + * Return driver license number + * + * @return string + * + * @example 12345678 + */ + public function driverLicence() + { + return $this->bothify('########'); + } + + /** + * Return passport number + * + * @return string + * + * @example 12345678 + */ + public function passportNumber() + { + return $this->bothify('########'); + } + + /** + * National Personal Identity number (asmens kodas) + * + * @see https://en.wikipedia.org/wiki/National_identification_number#Lithuania + * @see https://lt.wikipedia.org/wiki/Asmens_kodas + * + * @param string $gender [male|female] + * @param \DateTime $birthdate + * @param string $randomNumber three integers + * + * @return string on format XXXXXXXXXXX + */ + public function personalIdentityNumber($gender = 'male', \DateTime $birthdate = null, $randomNumber = '') + { + if (!$birthdate) { + $birthdate = \Faker\Provider\DateTime::dateTimeThisCentury(); + } + + $genderNumber = ($gender == 'male') ? 1 : 0; + $firstNumber = (int) floor($birthdate->format('Y') / 100) * 2 - 34 - $genderNumber; + + $datePart = $birthdate->format('ymd'); + $randomDigits = (string) (!$randomNumber || strlen($randomNumber) < 3) ? static::numerify('###') : substr($randomNumber, 0, 3); + $partOfPerosnalCode = $firstNumber . $datePart . $randomDigits; + + $sum = self::calculateSum($partOfPerosnalCode, 1); + $liekana = $sum % 11; + + if ($liekana !== 10) { + $lastNumber = $liekana; + + return $firstNumber . $datePart . $randomDigits . $lastNumber; + } + + $sum = self::calculateSum($partOfPerosnalCode, 2); + $liekana = $sum % 11; + + $lastNumber = ($liekana !== 10) ? $liekana : 0; + + return $firstNumber . $datePart . $randomDigits . $lastNumber; + } + + /** + * Calculate the sum of personal code + * + * @see https://en.wikipedia.org/wiki/National_identification_number#Lithuania + * @see https://lt.wikipedia.org/wiki/Asmens_kodas + * + * @param string $numbers + * @param int $time [1|2] + * + * @return int + */ + private static function calculateSum($numbers, $time = 1) + { + if ($time == 1) { + $multipliers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1]; + } else { + $multipliers = [3, 4, 5, 6, 7, 8, 9, 1, 2, 3]; + } + + $sum = 0; + + for ($i = 1; $i <= 10; ++$i) { + $sum += ((int) $numbers[$i - 1]) * $multipliers[$i - 1]; + } + + return (int) $sum; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/PhoneNumber.php new file mode 100644 index 00000000..05e32d31 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/PhoneNumber.php @@ -0,0 +1,17 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/lv_LV/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/lv_LV/Color.php new file mode 100644 index 00000000..04c895fb --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/lv_LV/Color.php @@ -0,0 +1,19 @@ +format('dmy'); + $randomDigits = (string) static::numerify('####'); + + $checksum = Luhn::computeCheckDigit($datePart . $randomDigits); + + return $datePart . '-' . $randomDigits . $checksum; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/lv_LV/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/lv_LV/PhoneNumber.php new file mode 100644 index 00000000..2cfdcb5a --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/lv_LV/PhoneNumber.php @@ -0,0 +1,15 @@ + static::latitude(42.43, 42.45), + 'longitude' => static::longitude(19.16, 19.27), + ]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/me_ME/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/me_ME/Company.php new file mode 100644 index 00000000..2483c20f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/me_ME/Company.php @@ -0,0 +1,49 @@ +generator->parse(static::$idNumberFormat)); + } + + /** + * @return string + * + * @example 'Ф' + */ + public function alphabet() + { + return static::randomElement(static::$alphabet); + } + + /** + * @return string + * + * @example 'Э' + */ + public function namePrefix() + { + return static::randomElement(static::$namePrefix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/mn_MN/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/mn_MN/PhoneNumber.php new file mode 100644 index 00000000..b6706f3f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/mn_MN/PhoneNumber.php @@ -0,0 +1,13 @@ + Townships + * @see https://en.wikipedia.org/wiki/Template:Johor > Townships + * @see https://en.wikipedia.org/wiki/Template:Kedah > Townships + * @see https://en.wikipedia.org/wiki/Template:Kelantan > Townships + * @see https://en.wikipedia.org/wiki/Template:Melaka > Townships + * @see https://en.wikipedia.org/wiki/Template:Negeri_Sembilan > Townships + * @see https://en.wikipedia.org/wiki/Template:Perak > Townships + * @see https://en.wikipedia.org/wiki/Template:Penang > Townships + * @see https://en.wikipedia.org/wiki/Template:Selangor > Townships + * @see https://en.wikipedia.org/wiki/Template:Terengganu > Townships + */ + protected static $townshipPrefix = [ + 'Alam', 'Apartment', 'Ara', + 'Bandar', 'Bandar', 'Bandar', 'Bandar', 'Bandar', 'Bandar', + 'Bandar Bukit', 'Bandar Seri', 'Bandar Sri', 'Bandar Baru', 'Batu', 'Bukit', + 'Desa', 'Damansara', + 'Kampung', 'Kampung Baru', 'Kampung Baru', 'Kondominium', 'Kota', + 'Laman', 'Lembah', + 'Medan', + 'Pandan', 'Pangsapuri', 'Petaling', 'Puncak', + 'Seri', 'Sri', + 'Taman', 'Taman', 'Taman', 'Taman', 'Taman', 'Taman', + 'Taman Desa', + ]; + protected static $townshipSuffix = [ + 'Aman', 'Amanjaya', 'Anggerik', 'Angkasa', 'Antarabangsa', 'Awan', + 'Bahagia', 'Bangsar', 'Baru', 'Belakong', 'Bendahara', 'Bestari', 'Bintang', 'Brickfields', + 'Casa', 'Changkat', 'Country Heights', + 'Damansara', 'Damai', 'Dato Harun', 'Delima', 'Duta', + 'Flora', + 'Gembira', 'Genting', + 'Harmoni', 'Hartamas', + 'Impian', 'Indah', 'Intan', + 'Jasa', 'Jaya', + 'Keramat', 'Kerinchi', 'Kiara', 'Kinrara', 'Kuchai', + 'Laksamana', + 'Mahkota', 'Maluri', 'Manggis', 'Maxwell', 'Medan', 'Melawati', 'Menjalara', 'Meru', 'Mulia', 'Mutiara', + 'Pahlawan', 'Perdana', 'Pertama', 'Permai', 'Pelangi', 'Petaling', 'Pinang', 'Puchong', 'Puteri', 'Putra', + 'Rahman', 'Rahmat', 'Raya', 'Razak', 'Ria', + 'Saujana', 'Segambut', 'Selamat', 'Selatan', 'Semarak', 'Sentosa', 'Seputeh', 'Setapak', 'Setia Jaya', 'Sinar', 'Sungai Besi', 'Sungai Buaya', 'Sungai Long', 'Suria', + 'Tasik Puteri', 'Tengah', 'Timur', 'Tinggi', 'Tropika', 'Tun Hussein Onn', 'Tun Perak', 'Tunku', + 'Ulu', 'Utama', 'Utara', + 'Wangi', + ]; + + /** + * @see https://en.wikipedia.org/wiki/Template:Greater_Kuala_Lumpur + * @see https://en.wikipedia.org/wiki/Template:Johor + * @see https://en.wikipedia.org/wiki/Template:Kedah + * @see https://en.wikipedia.org/wiki/Template:Kelantan + * @see https://en.wikipedia.org/wiki/Template:Labuan + * @see https://en.wikipedia.org/wiki/Template:Melaka + * @see https://en.wikipedia.org/wiki/Template:Negeri_Sembilan + * @see https://en.wikipedia.org/wiki/Template:Pahang + * @see https://en.wikipedia.org/wiki/Template:Perak + * @see https://en.wikipedia.org/wiki/Template:Perlis + * @see https://en.wikipedia.org/wiki/Template:Penang + * @see https://en.wikipedia.org/wiki/Template:Sabah + * @see https://en.wikipedia.org/wiki/Template:Sarawak + * @see https://en.wikipedia.org/wiki/Template:Selangor + * @see https://en.wikipedia.org/wiki/Template:Terengganu + */ + protected static $towns = [ + 'johor' => [ + 'Ayer Hitam', + 'Batu Pahat', 'Bukit Gambir', 'Bukit Kepong', 'Bukit Naning', + 'Desaru', + 'Endau', + 'Gelang Patah', 'Gemas Baharu', + 'Iskandar Puteri', + 'Jementah', 'Johor Lama', 'Johor Bahru', + 'Kempas', 'Kluang', 'Kota Iskandar', 'Kota Tinggi', 'Kukup', 'Kulai', + 'Labis ', 'Larkin', 'Layang-Layang', + 'Mersing', 'Muar', + 'Pagoh', 'Paloh', 'Parit Jawa', 'Pasir Gudang', 'Pekan Nanas', 'Permas Jaya', 'Pontian Kechil', + 'Renggam', + 'Segamat', 'Senai', 'Simpang Renggam', 'Skudai', 'Sri Gading', + 'Tangkak', 'Tebrau', + 'Ulu Tiram', + 'Yong Peng', + ], + 'kedah' => [ + 'Alor Setar', + 'Baling', 'Bukit Kayu Hitam', + 'Changlun', + 'Durian Burung', + 'Gurun', + 'Jitra', + 'Kepala Batas', 'Kuah', 'Kuala Kedah', 'Kuala Ketil', 'Kulim', + 'Langgar', 'Lunas', + 'Merbok', + 'Padang Serai', 'Pendang', + 'Serdang', 'Sintok', 'Sungai Petani', + 'Tawar, Baling', + 'Yan', + ], + 'kelantan' => [ + 'Bachok', 'Bunut Payong', + 'Dabong', + 'Gua Musang', + 'Jeli', + 'Ketereh', 'Kota Bharu', 'Kuala Krai', + 'Lojing', + 'Machang', + 'Pasir Mas', 'Pasir Puteh', + 'Rantau Panjang', + 'Salor', + 'Tok Bali', + 'Wakaf Bharu', 'Wakaf Che Yeh', + ], + 'kl' => [ + 'Ampang', + 'Bandar Tasik Selatan', 'Bandar Tun Razak', 'Bangsar', 'Batu', 'Brickfields', 'Bukit Bintang', 'Bukit Jalil', 'Bukit Tunku', + 'Cheras', 'Chow Kit', + 'Damansara Town Centre', 'Dang Wangi', 'Desa Petaling', 'Desa Tun Hussein Onn', + 'Jinjang', + 'Kampung Baru', 'Kampung Kasipillay', 'Kampung Pandan', 'Kampung Sungai Penchala', 'Kepong', 'KLCC', 'Kuchai Lama', + 'Lake Gardens', 'Lembah Pantai', + 'Medan Tuanku', 'Mid Valley City', 'Mont Kiara', + 'Pantai Dalam', 'Pudu', + 'Salak South', 'Segambut', 'Semarak', 'Sentul', 'Setapak', 'Setiawangsa', 'Seputeh', 'Sri Hartamas', 'Sri Petaling', 'Sungai Besi', + 'Taman Desa', 'Taman Melawati', 'Taman OUG', 'Taman Tun Dr Ismail', 'Taman U-Thant', 'Taman Wahyu', 'Titiwangsa', 'Tun Razak Exchange', + 'Wangsa Maju', + ], + 'labuan' => [ + 'Batu Manikar', + 'Kiamsam', + 'Layang-Layang', + 'Rancha-Rancha', + ], + 'melaka' => [ + 'Alor Gajah', + 'Bandaraya Melaka', 'Batu Berendam', 'Bukit Beruang', 'Bukit Katil', + 'Cheng', + 'Durian Tunggal', + 'Hang Tuah Jaya', + 'Jasin', + 'Klebang', + 'Lubuk China', + 'Masjid Tanah', + 'Naning', + 'Pekan Asahan', + 'Ramuan China', + 'Simpang Ampat', + 'Tanjung Bidara', 'Telok Mas', + 'Umbai', + ], + 'nsembilan' => [ + 'Ayer Kuning', 'Ampangan', + 'Bahau', 'Batang Benar', + 'Chembong', + 'Dangi', + 'Gemas', + 'Juasseh', + 'Kuala Pilah', + 'Labu', 'Lenggeng', 'Linggi', + 'Mantin', + 'Nilai', + 'Pajam', 'Pedas', 'Pengkalan Kempas', 'Port Dickson', + 'Rantau', 'Rompin', + 'Senawang', 'Seremban', 'Sungai Gadut', + 'Tampin', 'Tiroi', + ], + 'pahang' => [ + 'Bandar Tun Razak', 'Bentong', 'Brinchang', 'Bukit Fraser', 'Bukit Tinggi', + 'Chendor', + 'Gambang', 'Genting Highlands', 'Genting Sempah', + 'Jerantut', + 'Karak', 'Kemayan', 'Kota Shahbandar', 'Kuala Lipis', 'Kuala Pahang', 'Kuala Rompin', 'Kuantan', + 'Lanchang', 'Lubuk Paku', + 'Maran', 'Mengkuang', 'Mentakab', + 'Nenasi', + 'Panching', + 'Pekan', 'Penor', + 'Raub', + 'Sebertak', 'Sungai Lembing', + 'Tanah Rata', 'Tanjung Sepat', 'Tasik Chini', 'Temerloh', 'Teriang', 'Tringkap', + ], + 'penang' => [ + 'Air Itam', + 'Balik Pulau', 'Batu Ferringhi', 'Batu Kawan', 'Bayan Lepas', 'Bukit Mertajam', 'Butterworth', + 'Gelugor', 'George Town', + 'Jelutong', + 'Kepala Batas', + 'Nibong Tebal', + 'Permatang Pauh', 'Pulau Tikus', + 'Simpang Ampat', + 'Tanjung Bungah', 'Tanjung Tokong', + ], + 'perak' => [ + 'Ayer Tawar', + 'Bagan Serai', 'Batu Gajah', 'Behrang', 'Bidor', 'Bukit Gantang', 'Bukit Merah', + 'Changkat Jering', 'Chemor', 'Chenderiang', + 'Damar Laut', + 'Gerik', 'Gopeng', 'Gua Tempurung', + 'Hutan Melintang', + 'Ipoh', + 'Jelapang', + 'Kamunting', 'Kampar', 'Kuala Kangsar', + 'Lekir', 'Lenggong', 'Lumut', + 'Malim Nawar', 'Manong', 'Menglembu', + 'Pantai Remis', 'Parit', 'Parit Buntar', 'Pasir Salak', 'Proton City', + 'Simpang Pulai', 'Sitiawan', 'Slim River', 'Sungai Siput', 'Sungkai', + 'Taiping', 'Tambun', 'Tanjung Malim', 'Tanjung Rambutan', 'Tapah', 'Teluk Intan', + 'Ulu Bernam', + ], + 'perlis' => [ + 'Arau', + 'Beseri', + 'Chuping', + 'Kaki Bukit', 'Kangar', 'Kuala Perlis', + 'Mata Ayer', + 'Padang Besar', + 'Sanglang', 'Simpang Empat', + 'Wang Kelian', + ], + 'putrajaya' => [ + 'Precinct 1', 'Precinct 4', 'Precinct 5', + 'Precinct 6', 'Precinct 8', 'Precinct 10', + 'Precinct 11', 'Precinct 12', 'Precinct 13', + 'Precinct 16', 'Precinct 18', 'Precinct 19', + ], + 'sabah' => [ + 'Beaufort', 'Bingkor', + 'Donggongon', + 'Inanam', + 'Kinabatangan', 'Kota Belud', 'Kota Kinabalu', 'Kuala Penyu', 'Kimanis', 'Kundasang', + 'Lahad Datu', 'Likas', 'Lok Kawi', + 'Manggatal', + 'Nabawan', + 'Papar', 'Pitas', + 'Ranau', + 'Sandakan', 'Sapulut', 'Semporna', 'Sepanggar', + 'Tambunan', 'Tanjung Aru', 'Tawau', 'Tenom', 'Tuaran', + 'Weston', + ], + 'sarawak' => [ + 'Asajaya', + 'Ba\'kelalan', 'Bario', 'Batu Kawa', 'Batu Niah', 'Betong', 'Bintulu', + 'Dalat', 'Daro', + 'Engkilili', + 'Julau', + 'Kapit', 'Kota Samarahan', 'Kuching', + 'Lawas', 'Limbang', 'Lubok Antu', + 'Marudi', 'Matu', 'Miri', + 'Oya', + 'Pakan', + 'Sadong Jaya', 'Sematan', 'Sibu', 'Siburan', 'Song', 'Sri Aman', 'Sungai Tujoh', + 'Tanjung Kidurong', 'Tanjung Manis', 'Tatau', + ], + 'selangor' => [ + 'Ampang', 'Assam Jawa', + 'Balakong', 'Bandar Baru Bangi', 'Bandar Baru Selayang', 'Bandar Sunway', 'Bangi', 'Banting', 'Batang Kali', 'Batu Caves', 'Bestari Jaya', 'Bukit Lanjan', + 'Cheras', 'Cyberjaya', + 'Damansara', 'Dengkil', + 'Ijok', + 'Jenjarom', + 'Kajang', 'Kelana Jaya', 'Klang', 'Kuala Kubu Bharu', 'Kuala Selangor', 'Kuang', + 'Lagong', + 'Morib', + 'Pandamaran', 'Paya Jaras', 'Petaling Jaya', 'Port Klang', 'Puchong', + 'Rasa', 'Rawang', + 'Salak Tinggi', 'Sekinchan', 'Selayang', 'Semenyih', 'Sepang', 'Serendah', 'Seri Kembangan', 'Shah Alam', 'Subang', 'Subang Jaya', 'Sungai Buloh', + 'Tanjung Karang', 'Tanjung Sepat', + 'Ulu Klang', 'Ulu Yam', + ], + 'terengganu' => [ + 'Ajil', + 'Bandar Ketengah Jaya', 'Bandar Permaisuri', 'Bukit Besi', 'Bukit Payong', + 'Chukai', + 'Jerteh', + 'Kampung Raja', 'Kerteh', 'Kijal', 'Kuala Besut', 'Kuala Berang', 'Kuala Dungun', 'Kuala Terengganu', + 'Marang', 'Merchang', + 'Pasir Raja', + 'Rantau Abang', + 'Teluk Kalung', + 'Wakaf Tapai', + ], + ]; + + /** + * @see https://en.wikipedia.org/wiki/States_and_federal_territories_of_Malaysia + */ + protected static $states = [ + 'johor' => [ + 'Johor Darul Ta\'zim', + 'Johor', + ], + 'kedah' => [ + 'Kedah Darul Aman', + 'Kedah', + ], + 'kelantan' => [ + 'Kelantan Darul Naim', + 'Kelantan', + ], + 'kl' => [ + 'KL', + 'Kuala Lumpur', + 'WP Kuala Lumpur', + ], + 'labuan' => [ + 'Labuan', + ], + 'melaka' => [ + 'Malacca', + 'Melaka', + ], + 'nsembilan' => [ + 'Negeri Sembilan Darul Khusus', + 'Negeri Sembilan', + ], + 'pahang' => [ + 'Pahang Darul Makmur', + 'Pahang', + ], + 'penang' => [ + 'Penang', + 'Pulau Pinang', + ], + 'perak' => [ + 'Perak Darul Ridzuan', + 'Perak', + ], + 'perlis' => [ + 'Perlis Indera Kayangan', + 'Perlis', + ], + 'putrajaya' => [ + 'Putrajaya', + ], + 'sabah' => [ + 'Sabah', + ], + 'sarawak' => [ + 'Sarawak', + ], + 'selangor' => [ + 'Selangor Darul Ehsan', + 'Selangor', + ], + 'terengganu' => [ + 'Terengganu Darul Iman', + 'Terengganu', + ], + ]; + + /** + * @see https://ms.wikipedia.org/wiki/Senarai_negara_berdaulat + */ + protected static $country = [ + 'Abkhazia', 'Afghanistan', 'Afrika Selatan', 'Republik Afrika Tengah', 'Akrotiri dan Dhekelia', 'Albania', 'Algeria', 'Amerika Syarikat', 'Andorra', 'Angola', 'Antigua dan Barbuda', 'Arab Saudi', 'Argentina', 'Armenia', 'Australia', 'Austria', 'Azerbaijan', + 'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belanda', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bhutan', 'Bolivia', 'Bonaire', 'Bosnia dan Herzegovina', 'Botswana', 'Brazil', 'Brunei Darussalam', 'Bulgaria', 'Burkina Faso', 'Burundi', + 'Cameroon', 'Chad', 'Chile', 'Republik Rakyat China', 'Republik China di Taiwan', 'Colombia', 'Comoros', 'Republik Demokratik Congo', 'Republik Congo', 'Kepulauan Cook', 'Costa Rica', 'Côte d\'Ivoire (Ivory Coast)', 'Croatia', 'Cuba', 'Curaçao', 'Cyprus', 'Republik Turki Cyprus Utara', 'Republik Czech', + 'Denmark', 'Djibouti', 'Dominika', 'Republik Dominika', + 'Ecuador', 'El Salvador', 'Emiriah Arab Bersatu', 'Eritrea', 'Estonia', + 'Kepulauan Faroe', 'Fiji', 'Filipina', 'Finland', + 'Gabon', 'Gambia', 'Georgia', 'Ghana', 'Grenada', 'Greece (Yunani)', 'Guatemala', 'Guinea', 'Guinea-Bissau', 'Guinea Khatulistiwa', 'Guiana Perancis', 'Guyana', + 'Habsyah (Etiopia)', 'Haiti', 'Honduras', 'Hungary', + 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Israel', 'Itali', + 'Jamaika', 'Jepun', 'Jerman', 'Jordan', + 'Kanada', 'Kazakhstan', 'Kemboja', 'Kenya', 'Kiribati', 'Korea Selatan', 'Korea Utara', 'Kosovo', 'Kuwait', 'Kyrgyzstan', + 'Laos', 'Latvia', 'Lesotho', 'Liberia', 'Libya', 'Liechtenstein', 'Lithuania', 'Lubnan', 'Luxembourg', + 'Macedonia', 'Madagaskar', 'Maghribi', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Kepulauan Marshall', 'Mauritania', 'Mauritius', 'Mesir', 'Mexico', 'Persekutuan Micronesia', 'Moldova', 'Monaco', 'Montenegro', 'Mongolia', 'Mozambique', 'Myanmar', + 'Namibia', 'Nauru', 'Nepal', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 'Niue', 'Norway', + 'Oman', 'Ossetia Selatan', + 'Pakistan', 'Palau', 'Palestin', 'Panama', 'Papua New Guinea', 'Paraguay', 'Perancis', 'Peru', 'Poland', 'Portugal', + 'Qatar', + 'Romania', 'Russia', 'Rwanda', + 'Sahara Barat', 'Saint Kitts dan Nevis', 'Saint Lucia', 'Saint Vincent dan Grenadines', 'Samoa', 'San Marino', 'São Tomé dan Príncipe', 'Scotland', 'Senegal', 'Sepanyol', 'Serbia', 'Seychelles', 'Sierra Leone', 'Singapura', 'Slovakia', 'Slovenia', 'Kepulauan Solomon', 'Somalia', 'Somaliland', 'Sri Lanka', 'Sudan', 'Sudan Selatan', 'Suriname', 'Swaziland', 'Sweden', 'Switzerland', 'Syria', + 'Tajikistan', 'Tanjung Verde', 'Tanzania', 'Thailand', 'Timor Leste', 'Togo', 'Tonga', 'Transnistria', 'Trinidad dan Tobago', 'Tunisia', 'Turki', 'Turkmenistan', 'Tuvalu', + 'Uganda', 'Ukraine', 'United Kingdom', 'Uruguay', 'Uzbekistan', + 'Vanuatu', 'Kota Vatican', 'Venezuela', 'Vietnam', + 'Yaman', + 'Zambia', 'Zimbabwe', + ]; + + /** + * Return a building prefix + * + * @example 'No.' + * + * @return string + */ + public static function buildingPrefix() + { + return static::randomElement(static::$buildingPrefix); + } + + /** + * Return a building number + * + * @example '123' + * + * @return string + */ + public static function buildingNumber() + { + return static::toUpper(static::lexify(static::numerify(static::randomElement(static::$buildingNumber)))); + } + + /** + * Return a street prefix + * + * @example 'Jalan' + */ + public function streetPrefix() + { + $format = static::randomElement(static::$streetPrefix); + + return $this->generator->parse($format); + } + + /** + * Return a complete streename + * + * @example 'Jalan Utama 7' + * + * @return string + */ + public function streetName() + { + $format = static::toUpper(static::lexify(static::numerify(static::randomElement(static::$streetNameFormats)))); + + return $this->generator->parse($format); + } + + /** + * Return a randown township + * + * @example Taman Bahagia + * + * @return string + */ + public function township() + { + $format = static::toUpper(static::lexify(static::numerify(static::randomElement(static::$townshipFormats)))); + + return $this->generator->parse($format); + } + + /** + * Return a township prefix abbreviation + * + * @example 'USJ' + * + * @return string + */ + public function townshipPrefixAbbr() + { + return static::randomElement(static::$townshipPrefixAbbr); + } + + /** + * Return a township prefix + * + * @example 'Taman' + * + * @return string + */ + public function townshipPrefix() + { + return static::randomElement(static::$townshipPrefix); + } + + /** + * Return a township suffix + * + * @example 'Bahagia' + */ + public function townshipSuffix() + { + return static::randomElement(static::$townshipSuffix); + } + + /** + * Return a postcode based on state + * + * @example '55100' + * + * @see https://en.wikipedia.org/wiki/Postal_codes_in_Malaysia#States + * + * @param string|null $state 'state' or null + * + * @return string + */ + public static function postcode($state = null) + { + $format = [ + 'perlis' => [ // (01000 - 02800) + '0' . self::numberBetween(1000, 2800), + ], + 'kedah' => [ // (05000 - 09810) + '0' . self::numberBetween(5000, 9810), + ], + 'penang' => [ // (10000 - 14400) + self::numberBetween(10000, 14400), + ], + 'kelantan' => [ // (15000 - 18500) + self::numberBetween(15000, 18500), + ], + 'terengganu' => [ // (20000 - 24300) + self::numberBetween(20000, 24300), + ], + 'pahang' => [ // (25000 - 28800 | 39000 - 39200 | 49000, 69000) + self::numberBetween(25000, 28800), + self::numberBetween(39000, 39200), + self::numberBetween(49000, 69000), + ], + 'perak' => [ // (30000 - 36810) + self::numberBetween(30000, 36810), + ], + 'selangor' => [ // (40000 - 48300 | 63000 - 68100) + self::numberBetween(40000, 48300), + self::numberBetween(63000, 68100), + ], + 'kl' => [ // (50000 - 60000) + self::numberBetween(50000, 60000), + ], + 'putrajaya' => [ // (62000 - 62988) + self::numberBetween(62000, 62988), + ], + 'nsembilan' => [ // (70000 - 73509) + self::numberBetween(70000, 73509), + ], + 'melaka' => [ // (75000 - 78309) + self::numberBetween(75000, 78309), + ], + 'johor' => [ // (79000 - 86900) + self::numberBetween(79000, 86900), + ], + 'labuan' => [ // (87000 - 87033) + self::numberBetween(87000, 87033), + ], + 'sabah' => [ // (88000 - 91309) + self::numberBetween(88000, 91309), + ], + 'sarawak' => [ // (93000 - 98859) + self::numberBetween(93000, 98859), + ], + ]; + + $postcode = null === $state ? static::randomElement($format) : $format[$state]; + + return (string) static::randomElement($postcode); + } + + /** + * Return the complete town address with matching postcode and state + * + * @example 55100 Bukit Bintang, Kuala Lumpur + * + * @return string + */ + public function townState() + { + $state = static::randomElement(array_keys(static::$states)); + $postcode = static::postcode($state); + $town = static::randomElement(static::$towns[$state]); + $state = static::randomElement(static::$states[$state]); + + return $postcode . ' ' . $town . ', ' . $state; + } + + /** + * Return a random city (town) + * + * @example 'Ampang' + * + * @return string + */ + public function city() + { + $state = static::randomElement(array_keys(static::$towns)); + + return static::randomElement(static::$towns[$state]); + } + + /** + * Return a random state + * + * @example 'Johor' + * + * @return string + */ + public function state() + { + $state = static::randomElement(array_keys(static::$states)); + + return static::randomElement(static::$states[$state]); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Company.php new file mode 100644 index 00000000..4dc8b2cb --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Company.php @@ -0,0 +1,105 @@ +generator->parse($formats); + } + + /** + * Return Peninsular prefix alphabet + * + * @example 'W' + * + * @return string + */ + public static function peninsularPrefix() + { + return static::randomElement(static::$peninsularPrefix); + } + + /** + * Return Sarawak state prefix alphabet + * + * @example 'QA' + * + * @return string + */ + public static function sarawakPrefix() + { + return static::randomElement(static::$sarawakPrefix); + } + + /** + * Return Sabah state prefix alphabet + * + * @example 'SA' + * + * @return string + */ + public static function sabahPrefix() + { + return static::randomElement(static::$sabahPrefix); + } + + /** + * Return specialty licence plate prefix + * + * @example 'G1M' + * + * @return string + */ + public static function specialPrefix() + { + return static::randomElement(static::$specialPrefix); + } + + /** + * Return a valid license plate alphabet + * + * @example 'A' + * + * @return string + */ + public static function validAlphabet() + { + return static::randomElement(static::$validAlphabets); + } + + /** + * Return a valid number sequence between 1 and 9999 + * + * @example '1234' + * + * @return int + */ + public static function numberSequence() + { + return self::numberBetween(1, 9999); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Payment.php b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Payment.php new file mode 100644 index 00000000..b64c2bbd --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Payment.php @@ -0,0 +1,244 @@ +generator->parse($formats); + } + + /** + * Return a Malaysian Bank account number + * + * @example '1234567890123456' + * + * @return string + */ + public function bankAccountNumber() + { + $formats = static::randomElement(static::$bankAccountNumberFormats); + + return static::numerify($formats); + } + + /** + * Return a Malaysian Local Bank + * + * @example 'Public Bank' + * + * @return string + */ + public static function localBank() + { + return static::randomElement(static::$localBanks); + } + + /** + * Return a Malaysian Foreign Bank + * + * @example 'Citibank Berhad' + * + * @return string + */ + public static function foreignBank() + { + return static::randomElement(static::$foreignBanks); + } + + /** + * Return a Malaysian Government Bank + * + * @example 'Bank Simpanan Nasional' + * + * @return string + */ + public static function governmentBank() + { + return static::randomElement(static::$governmentBanks); + } + + /** + * Return a Malaysian insurance company + * + * @example 'AIA Malaysia' + * + * @return string + */ + public static function insurance() + { + return static::randomElement(static::$insuranceCompanies); + } + + /** + * Return a Malaysian Bank SWIFT Code + * + * @example 'MBBEMYKLXXX' + * + * @return string + */ + public static function swiftCode() + { + return static::toUpper(static::lexify(static::randomElement(static::$swiftCodes))); + } + + /** + * Return the Malaysian currency symbol + * + * @example 'RM' + * + * @return string + */ + public static function currencySymbol() + { + return static::randomElement(static::$currencySymbol); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Person.php new file mode 100644 index 00000000..1cd011bf --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Person.php @@ -0,0 +1,811 @@ +generator->parse(static::randomElement($formats)); + } + + /** + * Return a Malaysian I.C. No. + * + * @example '890123-45-6789' + * + * @see https://en.wikipedia.org/wiki/Malaysian_identity_card#Structure_of_the_National_Registration_Identity_Card_Number_(NRIC) + * + * @param string|null $gender 'male', 'female' or null for any + * @param bool|string|null $hyphen true, false, or any separator characters + * + * @return string + */ + public static function myKadNumber($gender = null, $hyphen = false) + { + // year of birth + $yy = self::numberBetween(0, 99); + + // month of birth + $mm = DateTime::month(); + + // day of birth + $dd = DateTime::dayOfMonth(); + + // place of birth (1-59 except 17-20) + while (in_array($pb = self::numberBetween(1, 59), [17, 18, 19, 20], false)) { + } + + // random number + $nnn = self::numberBetween(0, 999); + + // gender digit. Odd = MALE, Even = FEMALE + $g = self::numberBetween(0, 9); + //Credit: https://gist.github.com/mauris/3629548 + if ($gender === static::GENDER_MALE) { + $g = $g | 1; + } elseif ($gender === static::GENDER_FEMALE) { + $g = $g & ~1; + } + + // formatting with hyphen + if ($hyphen === true) { + $hyphen = '-'; + } elseif ($hyphen === false) { + $hyphen = ''; + } + + return sprintf('%02d%02d%02d%s%02d%s%03d%01d', $yy, $mm, $dd, $hyphen, $pb, $hyphen, $nnn, $g); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/PhoneNumber.php new file mode 100644 index 00000000..7cce02fa --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/PhoneNumber.php @@ -0,0 +1,217 @@ +generator->parse($format)); + } + + return static::numerify($this->generator->parse($format)); + } + + /** + * Return prefix digits for 011 numbers + * + * @example '10' + * + * @return string + */ + public static function zeroOneOnePrefix() + { + return static::numerify(static::randomElement(static::$zeroOneOnePrefix)); + } + + /** + * Return prefix digits for 014 numbers + * + * @example '2' + * + * @return string + */ + public static function zeroOneFourPrefix() + { + return static::numerify(static::randomElement(static::$zeroOneFourPrefix)); + } + + /** + * Return prefix digits for 015 numbers + * + * @example '1' + * + * @return string + */ + public static function zeroOneFivePrefix() + { + return static::numerify(static::randomElement(static::$zeroOneFivePrefix)); + } + + /** + * Return a Malaysian Fixed Line Phone Number. + * + * @example '+603-4567-8912' + * + * @param bool $countryCodePrefix true, false + * @param bool $formatting true, false + * + * @return string + */ + public function fixedLineNumber($countryCodePrefix = true, $formatting = true) + { + if ($formatting) { + $format = static::randomElement(static::$fixedLineNumberFormatsWithFormatting); + } else { + $format = static::randomElement(static::$fixedLineNumberFormats); + } + + if ($countryCodePrefix) { + return static::countryCodePrefix($formatting) . static::numerify($this->generator->parse($format)); + } + + return static::numerify($this->generator->parse($format)); + } + + /** + * Return a Malaysian VoIP Phone Number. + * + * @example '+6015-678-9234' + * + * @param bool $countryCodePrefix true, false + * @param bool $formatting true, false + * + * @return string + */ + public function voipNumber($countryCodePrefix = true, $formatting = true) + { + if ($formatting) { + $format = static::randomElement(static::$voipNumberWithFormatting); + } else { + $format = static::randomElement(static::$voipNumber); + } + + if ($countryCodePrefix) { + return static::countryCodePrefix($formatting) . static::numerify($this->generator->parse($format)); + } + + return static::numerify($this->generator->parse($format)); + } + + /** + * Return a Malaysian Country Code Prefix. + * + * @example '+6' + * + * @param bool $formatting true, false + * + * @return string + */ + public static function countryCodePrefix($formatting = true) + { + if ($formatting) { + return static::randomElement(static::$plusSymbol) . static::randomElement(static::$countryCodePrefix); + } + + return static::randomElement(static::$countryCodePrefix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/nb_NO/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/nb_NO/Address.php new file mode 100644 index 00000000..cbc39d7b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/nb_NO/Address.php @@ -0,0 +1,197 @@ +format('dmy'); + + /** + * @todo These number should be random based on birth year + * + * @see http://no.wikipedia.org/wiki/F%C3%B8dselsnummer + */ + $randomDigits = (string) static::numerify('##'); + + switch ($gender) { + case static::GENDER_MALE: + $genderDigit = static::randomElement([1, 3, 5, 7, 9]); + + break; + + case static::GENDER_FEMALE: + $genderDigit = static::randomElement([0, 2, 4, 6, 8]); + + break; + + default: + $genderDigit = (string) static::numerify('#'); + } + + $digits = $datePart . $randomDigits . $genderDigit; + + /** + * @todo Calculate modulo 11 of $digits + * + * @see http://no.wikipedia.org/wiki/F%C3%B8dselsnummer + */ + $checksum = (string) static::numerify('##'); + + return $digits . $checksum; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/nb_NO/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/nb_NO/PhoneNumber.php new file mode 100644 index 00000000..4767db48 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/nb_NO/PhoneNumber.php @@ -0,0 +1,41 @@ +generator->parse($format)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ne_NP/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/ne_NP/Address.php new file mode 100644 index 00000000..59b31de4 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ne_NP/Address.php @@ -0,0 +1,131 @@ +format('ymd')); + $help = $date->format('Y') >= 2000 ? 2 : null; + + $check = (int) ($help . $dob . $middle); + $rest = sprintf('%02d', 97 - ($check % 97)); + + return $dob . $middle . $rest; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/nl_BE/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/nl_BE/PhoneNumber.php new file mode 100644 index 00000000..9e4a3917 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/nl_BE/PhoneNumber.php @@ -0,0 +1,20 @@ +generator->lastName(); + + break; + } + + if (Miscellaneous::boolean()) { + return $companyName . ' ' . static::randomElement(static::$companySuffix); + } + + return $companyName; + } + + /** + * Belasting Toegevoegde Waarde (BTW) = VAT + * + * @example 'NL123456789B01' + * + * @see https://www.belastingdienst.nl/wps/wcm/connect/bldcontentnl/belastingdienst/zakelijk/btw/administratie_bijhouden/btw_nummers_controleren/uw_btw_nummer + * + * @return string VAT Number + */ + public static function vat() + { + return sprintf('%s%d%s%d', 'NL', self::randomNumber(9, true), 'B', self::randomNumber(2, true)); + } + + /** + * Alias dutch vat number format + * + * @return string + */ + public static function btw() + { + return self::vat(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/nl_NL/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/nl_NL/Internet.php new file mode 100644 index 00000000..bf30e795 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/nl_NL/Internet.php @@ -0,0 +1,9 @@ + 9) { + if ($nr[1] > 0) { + $nr[0] = 8; + --$nr[1]; + } else { + $nr[0] = 1; + ++$nr[1]; + } + } + + return implode('', array_reverse($nr)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/nl_NL/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/nl_NL/PhoneNumber.php new file mode 100644 index 00000000..5d4163a0 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/nl_NL/PhoneNumber.php @@ -0,0 +1,39 @@ + 'D', + 'kujawsko-pomorskie' => 'C', + 'lubelskie' => 'L', + 'lubuskie' => 'F', + 'łódzkie' => 'E', + 'małopolskie' => 'K', + 'mazowieckie' => 'W', + 'opolskie' => 'O', + 'podkarpackie' => 'R', + 'podlaskie' => 'B', + 'pomorskie' => 'G', + 'śląskie' => 'S', + 'świętokrzyskie' => 'T', + 'warmińsko-mazurskie' => 'N', + 'wielkopolskie' => 'P', + 'zachodniopomorskie' => 'Z', + ]; + + /** + * @var array list of special vehicle registration number prefixes. + */ + protected static $specials = [ + 'army' => 'U', + 'services' => 'H', + ]; + + /** + * @var array list of Polish counties and respective vehicle registration number prefixes. + */ + protected static $counties = [ + 'D' => [ + 'Jelenia Góra' => ['J'], + 'Legnica' => ['L'], + 'Wałbrzych' => ['B'], + 'Wrocław' => ['W', 'X'], + 'bolesławiecki' => ['BL'], + 'dzierżoniowski' => ['DZ'], + 'głogowski' => ['GL'], + 'górowski' => ['GR'], + 'jaworski' => ['JA'], + 'jeleniogórski' => ['JE'], + 'kamiennogórski' => ['KA'], + 'kłodzki' => ['KL'], + 'legnicki' => ['LE'], + 'lubański' => ['LB'], + 'lubiński' => ['LU'], + 'lwówecki' => ['LW'], + 'milicki' => ['MI'], + 'oleśnicki' => ['OL'], + 'oławski' => ['OA'], + 'polkowicki' => ['PL'], + 'strzeliński' => ['ST'], + 'średzki' => ['SR'], + 'świdnicki' => ['SW'], + 'trzebnicki' => ['TR'], + 'wałbrzyski' => ['BA'], + 'wołowski' => ['WL'], + 'wrocławski' => ['WR'], + 'ząbkowicki' => ['ZA'], + 'zgorzelecki' => ['ZG'], + 'złotoryjski' => ['ZL'], + ], + 'C' => [ + 'Bydgoszcz' => ['B'], + 'Grudziądz' => ['G'], + 'Toruń' => ['T'], + 'Włocławek' => ['W'], + 'aleksandrowski' => ['AL'], + 'brodnicki' => ['BR'], + 'bydgoski' => ['BY'], + 'chełmiński' => ['CH'], + 'golubsko-dobrzyński' => ['GD'], + 'grudziądzki' => ['GR'], + 'inowrocławski' => ['IN'], + 'lipnowski' => ['LI'], + 'mogileński' => ['MG'], + 'nakielski' => ['NA'], + 'radziejowski' => ['RA'], + 'rypiński' => ['RY'], + 'sępoleński' => ['SE'], + 'świecki' => ['SW'], + 'toruński' => ['TR'], + 'tucholski' => ['TU'], + 'wąbrzeski' => ['WA'], + 'włocławski' => ['WL'], + 'żniński' => ['ZN'], + ], + 'L' => [ + 'Biała Podlaska' => ['B'], + 'Chełm' => ['C'], + 'Lublin' => ['U'], + 'Zamość' => ['Z'], + 'bialski' => ['BI'], + 'biłgorajski' => ['BL'], + 'chełmski' => ['CH'], + 'hrubieszowski' => ['HR'], + 'janowski' => ['JA'], + 'krasnostawski' => ['KS'], + 'kraśnicki' => ['KR'], + 'lubartowski' => ['LB'], + 'lubelski' => ['UB'], + 'łęczyński' => ['LE'], + 'łukowski' => ['LU'], + 'opolski' => ['OP'], + 'parczewski' => ['PA'], + 'puławski' => ['PU'], + 'radzyński' => ['RA'], + 'rycki' => ['RY'], + 'świdnicki' => ['SW'], + 'tomaszowski' => ['TM'], + 'włodawski' => ['WL'], + 'zamojski' => ['ZA'], + ], + 'F' => [ + 'Gorzów Wielkopolski' => ['G'], + 'Zielona Góra' => ['Z'], + 'gorzowski' => ['GW'], + 'krośnieński' => ['KR'], + 'międzyrzecki' => ['MI'], + 'nowosolski' => ['NW'], + 'słubicki' => ['SL'], + 'strzelecko-drezdenecki' => ['SD'], + 'sulęciński' => ['SU'], + 'świebodziński' => ['SW'], + 'wschowski' => ['WS'], + 'zielonogórski' => ['ZI'], + 'żagański' => ['ZG'], + 'żarski' => ['ZA'], + ], + 'E' => [ + 'Łódź' => ['L'], + 'Piotrków Trybunalski' => ['P'], + 'Skierniewice' => ['S'], + 'brzeziński' => ['BR'], + 'bełchatowski' => ['BE'], + 'kutnowski' => ['KU'], + 'łaski' => ['LA'], + 'łęczycki' => ['LE'], + 'łowicki' => ['LC'], + 'łódzki wschodni' => ['LW'], + 'opoczyński' => ['OP'], + 'pabianicki' => ['PA'], + 'pajęczański' => ['PJ'], + 'piotrkowski' => ['PI'], + 'poddębicki' => ['PD'], + 'radomszczański' => ['RA'], + 'rawski' => ['RW'], + 'sieradzki' => ['SI'], + 'skierniewicki' => ['SK'], + 'tomaszowski' => ['TM'], + 'wieluński' => ['WI'], + 'wieruszowski' => ['WE'], + 'zduńskowolski' => ['ZD'], + 'zgierski' => ['ZG'], + ], + 'K' => [ + 'Kraków' => ['R'], + 'Nowy Sącz' => ['N'], + 'Tarnów' => ['T'], + 'bocheński' => ['BA', 'BC'], + 'brzeski' => ['BR'], + 'chrzanowski' => ['CH'], + 'dąbrowski' => ['DA'], + 'gorlicki' => ['GR'], + 'krakowski' => ['RA'], + 'limanowski' => ['LI'], + 'miechowski' => ['MI'], + 'myślenicki' => ['MY'], + 'nowosądecki' => ['NS'], + 'nowotarski' => ['NT'], + 'olkuski' => ['OL'], + 'oświęcimski' => ['OS'], + 'proszowicki' => ['PR'], + 'suski' => ['SU'], + 'tarnowski' => ['TA'], + 'tatrzański' => ['TT'], + 'wadowicki' => ['WA'], + 'wielicki' => ['WI'], + ], + 'W' => [ + 'Ostrołęka' => ['O'], + 'Płock' => ['P'], + 'Radom' => ['R'], + 'Siedlce' => ['S'], + 'białobrzeski' => ['BR'], + 'ciechanowski' => ['CI'], + 'garwoliński' => ['G'], + 'gostyniński' => ['GS'], + 'grodziski' => ['GM'], + 'grójecki' => ['GR'], + 'kozienicki' => ['KZ'], + 'legionowski' => ['L'], + 'lipski' => ['LI'], + 'łosicki' => ['LS'], + 'makowski' => ['MA'], + 'miński' => ['M'], + 'mławski' => ['ML'], + 'nowodworski' => ['ND'], + 'ostrołęcki' => ['OS'], + 'ostrowski' => ['OR'], + 'otwocki' => ['OT'], + 'piaseczyński' => ['PA', 'PI'], + 'płocki' => ['PL'], + 'płoński' => ['PN'], + 'pruszkowski' => ['PP', 'PR', 'PS'], + 'przasnyski' => ['PZ'], + 'przysuski' => ['PY'], + 'pułtuski' => ['PU'], + 'radomski' => ['RA'], + 'siedlecki' => ['SI'], + 'sierpecki' => ['SE'], + 'sochaczewski' => ['SC'], + 'sokołowski' => ['SK'], + 'szydłowiecki' => ['SZ'], + 'warszawski' => ['A', 'B', 'D', 'E', 'F', 'H', 'I', 'J', 'K', 'N', 'T', 'U', 'W', 'X', 'Y'], + 'warszawski zachodni' => ['Z'], + 'węgrowski' => ['WE'], + 'wołomiński' => ['WL', 'V'], + 'wyszkowski' => ['WY'], + 'zwoleński' => ['ZW'], + 'żuromiński' => ['ZU'], + 'żyrardowski' => ['ZY'], + ], + 'O' => [ + 'Opole' => ['P'], + 'brzeski' => ['B'], + 'głubczycki' => ['GL'], + 'kędzierzyńsko-kozielski' => ['K'], + 'kluczborski' => ['KL'], + 'krapkowicki' => ['KR'], + 'namysłowski' => ['NA'], + 'nyski' => ['NY'], + 'oleski' => ['OL'], + 'opolski' => ['PO'], + 'prudnicki' => ['PR'], + 'strzelecki' => ['ST'], + ], + 'R' => [ + 'Krosno' => ['K'], + 'Przemyśl' => ['P'], + 'Rzeszów' => ['Z'], + 'Tarnobrzeg' => ['T'], + 'bieszczadzki' => ['BI'], + 'brzozowski' => ['BR'], + 'dębicki' => ['DE'], + 'jarosławski' => ['JA'], + 'jasielski' => ['JS'], + 'kolbuszowski' => ['KL'], + 'krośnieński' => ['KR'], + 'leski' => ['LS'], + 'leżajski' => ['LE'], + 'lubaczowski' => ['LU'], + 'łańcucki' => ['LA'], + 'mielecki' => ['MI'], + 'niżański' => ['NI'], + 'przemyski' => ['PR'], + 'przeworski' => ['PZ'], + 'ropczycko-sędziszowski' => ['RS'], + 'rzeszowski' => ['ZE'], + 'sanocki' => ['SA'], + 'stalowowolski' => ['ST'], + 'strzyżowski' => ['SR'], + 'tarnobrzeski' => ['TA'], + ], + 'B' => [ + 'Białystok' => ['I'], + 'Łomża' => ['L'], + 'Suwałki' => ['S'], + 'augustowski' => ['AU'], + 'białostocki' => ['IA'], + 'bielski' => ['BI'], + 'grajewski' => ['GR'], + 'hajnowski' => ['HA'], + 'kolneński' => ['KL'], + 'łomżyński' => ['LM'], + 'moniecki' => ['MN'], + 'sejneński' => ['SE'], + 'siemiatycki' => ['SI'], + 'sokólski' => ['SK'], + 'suwalski' => ['SU'], + 'wysokomazowiecki' => ['WM'], + 'zambrowski' => ['ZA'], + ], + 'G' => [ + 'Gdańsk' => ['D'], + 'Gdynia' => ['A'], + 'Słupsk' => ['S'], + 'Sopot' => ['SP'], + 'bytowski' => ['BY'], + 'chojnicki' => ['CH'], + 'człuchowski' => ['CZ'], + 'gdański' => ['DA'], + 'kartuski' => ['KY', 'KA'], + 'kościerski' => ['KS'], + 'kwidzyński' => ['KW'], + 'lęborski' => ['LE'], + 'malborski' => ['MB'], + 'nowodworski' => ['ND'], + 'pucki' => ['PU'], + 'słupski' => ['SL'], + 'starogardzki' => ['ST'], + 'sztumski' => ['SZ'], + 'tczewski' => ['TC'], + 'wejherowski' => ['WE', 'WO'], + ], + 'S' => [ + 'Bielsko-Biała' => ['B'], + 'Bytom' => ['Y'], + 'Chorzów' => ['H'], + 'Częstochowa' => ['C'], + 'Dąbrowa Górnicza' => ['D'], + 'Gliwice' => ['G'], + 'Jastrzębie-Zdrój' => ['JZ'], + 'Jaworzno' => ['J'], + 'Katowice' => ['K'], + 'Mysłowice' => ['M'], + 'Piekary Śląskie' => ['PI'], + 'Ruda Śląska,' => ['L', 'RS'], + 'Rybnik' => ['R'], + 'Siemianowice Śląskie' => ['I'], + 'Sosnowiec' => ['O'], + 'Świętochłowice' => ['W'], + 'Tychy' => ['T'], + 'Zabrze' => ['Z'], + 'Żory' => ['ZO'], + 'będziński' => ['BE'], + 'bielski' => ['BI'], + 'cieszyński' => ['CN', 'CI'], + 'częstochowski' => ['CZ'], + 'gliwicki' => ['GL'], + 'kłobucki' => ['KL'], + 'lubliniecki' => ['LU'], + 'mikołowski' => ['MI'], + 'myszkowski' => ['MY'], + 'pszczyński' => ['PS'], + 'raciborski' => ['RC'], + 'rybnicki' => ['RB'], + 'tarnogórski' => ['TA'], + 'bieruńsko - lędziński' => ['BL'], + 'wodzisławski' => ['WD', 'WZ'], + 'zawierciański' => ['ZA'], + 'żywiecki' => ['ZY'], + ], + 'T' => [ + 'Kielce' => ['K'], + 'buski' => ['BU'], + 'jędrzejowski' => ['JE'], + 'kazimierski' => ['KA'], + 'kielecki' => ['KI'], + 'konecki' => ['KN'], + 'opatowski' => ['OP'], + 'ostrowiecki' => ['OS'], + 'pińczowski' => ['PI'], + 'sandomierski' => ['SA'], + 'skarżyski' => ['SK'], + 'starachowicki' => ['ST'], + 'staszowski' => ['SZ'], + 'włoszczowski' => ['LW'], + ], + 'N' => [ + 'Elbląg' => ['E'], + 'Olsztyn' => ['O'], + 'bartoszycki' => ['BA'], + 'braniewski' => ['BR'], + 'działdowski' => ['DZ'], + 'elbląski' => ['EB'], + 'ełcki' => ['EL'], + 'giżycki' => ['GI'], + 'iławski' => ['IL'], + 'kętrzyński' => ['KE'], + 'lidzbarski' => ['LI'], + 'mrągowski' => ['MR'], + 'nidzicki' => ['NI'], + 'nowomiejski' => ['NM'], + 'olecki' => ['OE'], + 'gołdapski' => ['GO'], + 'olsztyński' => ['OL'], + 'ostródzki' => ['OS'], + 'piski' => ['PI'], + 'szczycieński' => ['SZ'], + 'węgorzewski' => ['WE'], + ], + 'P' => [ + 'Kalisz' => ['A', 'K'], + 'Konin' => ['KO', 'N'], + 'Leszno' => ['L'], + 'Poznań' => ['O', 'Y'], + 'chodzieski' => ['CH'], + 'czarnkowsko-trzcianecki' => ['CT'], + 'gnieźnieński' => ['GN'], + 'gostyński' => ['GS'], + 'grodziski' => ['GO'], + 'jarociński' => ['JA'], + 'kaliski' => ['KA'], + 'kępiński' => ['KE'], + 'kolski' => ['KL'], + 'koniński' => ['KN'], + 'kościański' => ['KS'], + 'krotoszyński' => ['KR'], + 'leszczyński' => ['LE'], + 'międzychodzki' => ['MI'], + 'nowotomyski' => ['NT'], + 'obornicki' => ['OB'], + 'ostrowski' => ['OS'], + 'ostrzeszowski' => ['OT'], + 'pilski' => ['P'], + 'pleszewski' => ['PL'], + 'poznański' => ['OZ', 'Z'], + 'rawicki' => ['RA'], + 'słupecki' => ['SL'], + 'szamotulski' => ['SZ'], + 'średzki' => ['SR'], + 'śremski' => ['SE'], + 'turecki' => ['TU'], + 'wągrowiecki' => ['WA'], + 'wolsztyński' => ['WL'], + 'wrzesiński' => ['WR'], + 'złotowski' => ['ZL'], + ], + 'Z' => [ + 'Koszalin' => ['K'], + 'Szczecin' => ['S', 'Z'], + 'Świnoujście' => ['SW'], + 'białogardzki' => ['BI'], + 'choszczeński' => ['CH'], + 'drawski' => ['DR'], + 'goleniowski' => ['GL'], + 'gryficki' => ['GY'], + 'gryfiński' => ['GR'], + 'kamieński' => ['KA'], + 'kołobrzeski' => ['KL'], + 'koszaliński' => ['KO'], + 'łobeski' => ['LO'], + 'myśliborski' => ['MY'], + 'policki' => ['PL'], + 'pyrzycki' => ['PY'], + 'sławieński' => ['SL'], + 'stargardzki' => ['ST'], + 'szczecinecki' => ['SZ'], + 'świdwiński' => ['SD'], + 'wałecki' => ['WA'], + ], + 'U' => [ + 'Siły Zbrojne Rzeczypospolitej Polskiej' => ['A', 'B', 'C', 'D', 'E', 'G', 'I', 'J', 'K', 'L'], + ], + 'H' => [ + 'Centralne Biuro Antykorupcyjne' => ['A'], + 'Służba Ochrony Państwa' => ['BA', 'BB', 'BE', 'BF', 'BG'], + 'Służba Celno-Skarbowa' => ['CA', 'CB', 'CC', 'CD', 'CE', 'CF', 'CG', 'CH', 'CJ', 'CK', 'CL', 'CM', 'CN', 'CO', 'CP', 'CR'], + 'Agencja Bezpieczeństwa Wewnętrznego' => ['K'], + 'Agencja Wywiadu' => ['K'], + 'Służba Kontrwywiadu Wojskowego' => ['M'], + 'Służba Wywiadu Wojskowego' => ['M'], + 'Policja' => ['PA', 'PB', 'PC', 'PD', 'PE', 'PF', 'PG', 'PH', 'PJ', 'PK', 'PL', 'PL', 'PL', 'PL', 'PL', 'PM', 'PN', 'PP', 'PS', 'PT', 'PU', 'PW', 'PZ'], + 'Straż Graniczna' => ['WA', 'WK'], + ], + ]; + + /** + * @var array list of regex expressions matching Polish license plate suffixess when county code is 1 character long. + */ + protected static $plateSuffixesGroup1 = [ + '\d{5}', + '\d{4}[A-PR-Z]', + '\d{3}[A-PR-Z]{2}', + '[1-9][A-PR-Z]\d{3}', + '[1-9][A-PR-Z]{2}\d{2}', + ]; + + /** + * @var array list of regex expressions matching Polish license plate suffixess when county code is 2 characters long. + */ + protected static $plateSuffixesGroup2 = [ + '[A-PR-Z]\d{3}', + '\d{2}[A-PR-Z]{2}', + '[1-9][A-PR-Z]\d{2}', + '\d{2}[A-PR-Z][1-9]', + '[1-9][A-PR-Z]{2}[1-9]', + '[A-PR-Z]{2}\d{2}', + '\d{5}', + '\d{4}[A-PR-Z]', + '\d{3}[A-PR-Z]{2}', + '[A-PR-Z]\d{2}[A-PR-Z]', + '[A-PR-Z][1-9][A-PR-Z]{2}', + ]; + + /** + * Generates random license plate. + * + * @param bool $special whether special license plates should be included + * @param array|null $voivodeships list of voivodeships license plate should be generated from + * @param array|null $counties list of counties license plate should be generated from + */ + public static function licensePlate( + bool $special = false, + ?array $voivodeships = null, + ?array $counties = null + ): string { + $voivodeshipsAvailable = static::$voivodeships + ($special ? static::$specials : []); + $voivodeshipCode = static::selectRandomArea($voivodeshipsAvailable, $voivodeships); + + $countiesAvailable = static::$counties[$voivodeshipCode]; + $countySelected = self::selectRandomArea($countiesAvailable, $counties); + + $countyCode = static::randomElement($countySelected); + + $suffix = static::regexify(static::randomElement(strlen($countyCode) === 1 ? static::$plateSuffixesGroup1 : static::$plateSuffixesGroup2)); + + return "{$voivodeshipCode}{$countyCode} {$suffix}"; + } + + /** + * Selects random area from the list of available and requested. + */ + protected static function selectRandomArea(array $available, ?array $requested) + { + $requested = array_intersect(array_keys($available), $requested ?? []); + + if (empty($requested)) { + $requested = array_keys($available); + } + + return $available[static::randomElement($requested)]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Payment.php b/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Payment.php new file mode 100644 index 00000000..f2a60307 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Payment.php @@ -0,0 +1,120 @@ + 'Narodowy Bank Polski', + '102' => 'Powszechna Kasa Oszczędności Bank Polski Spółka Akcyjna', + '103' => 'Bank Handlowy w Warszawie Spółka Akcyjna', + '105' => 'ING Bank Śląski Spółka Akcyjna', + '106' => 'Bank BPH Spółka Akcyjna', + '109' => 'Santander Bank Polska Spółka Akcyjna', + '113' => 'Bank Gospodarstwa Krajowego', + '114' => 'mBank Spółka Akcyjna', + '116' => 'Bank Millennium Spółka Akcyjna', + '122' => 'Bank Handlowo-Kredytowy Spółka Akcyjna w Katowicach w likwidacji', + '124' => 'Bank Polska Kasa Opieki Spółka Akcyjna', + '132' => 'Bank Pocztowy Spółka Akcyjna', + '154' => 'Bank Ochrony Środowiska Spółka Akcyjna', + '158' => 'Mercedes-Benz Bank Polska Spółka Akcyjna', + '161' => 'SGB-Bank Spółka Akcyjna', + '168' => 'PLUS BANK Spółka Akcyjna', + '184' => 'Société Générale Spółka Akcyjna Oddział w Polsce', + '187' => 'Nest Bank Spółka Akcyjna', + '189' => 'Pekao Bank Hipoteczny Spółka Akcyjna', + '191' => 'Deutsche Bank Polska Spółka Akcyjna', + '193' => 'BANK POLSKIEJ SPÓŁDZIELCZOŚCI SPÓŁKA AKCYJNA', + '194' => 'Credit Agricole Bank Polska Spółka Akcyjna', + '195' => 'Idea Bank Spółka Akcyjna', + '203' => 'BNP Paribas Bank Polska Spółka Akcyjna', + '212' => 'Santander Consumer Bank Spółka Akcyjna', + '215' => 'mBank Hipoteczny Spółka Akcyjna', + '216' => 'Toyota Bank Polska Spółka Akcyjna', + '219' => 'DNB Bank Polska Spółka Akcyjna', + '224' => 'Banque PSA Finance Spółka Akcyjna Oddział w Polsce', + '225' => 'Svenska Handelsbanken AB Spółka Akcyjna Oddział w Polsce', + '235' => 'BNP Paribas S.A. Oddział w Polsce ', + '236' => 'Danske Bank A/S Spółka Akcyjna Oddział w Polsce', + '237' => 'Skandinaviska Enskilda Banken AB (Spółka Akcyjna) - Oddział w Polsce', + '239' => 'CAIXABANK, S.A. (SPÓŁKA AKCYJNA) ODDZIAŁ W POLSCE', + '241' => 'Elavon Financial Services Designated Activity Company (Spółka z O.O. o Wyznaczonym Przedmiocie Działalności) Oddział w Polsce', + '243' => 'BNP Paribas Securities Services Spółka Komandytowo - Akcyjna Oddział w Polsce', + '247' => 'HAITONG BANK, S.A. Spółka Akcyjna Oddział w Polsce', + '248' => 'Getin Noble Bank Spółka Akcyjna', + '249' => 'Alior Bank Spółka Akcyjna', + '251' => 'Aareal Bank Aktiengesellschaft (Spółka Akcyjna) - Oddział w Polsce', + '254' => 'Citibank Europe plc (Publiczna Spółka Akcyjna) Oddział w Polsce', + '255' => 'Ikano Bank AB (publ) Spółka Akcyjna Oddział w Polsce', + '256' => 'Nordea Bank Abp Spółka Akcyjna Oddział w Polsce', + '258' => 'J.P. Morgan Europe Limited Spółka z ograniczoną odpowiedzialnością Oddział w Polsce', + '260' => 'Bank of China (Luxembourg) S.A. Spółka Akcyjna Oddział w Polsce', + '262' => 'Industrial and Commercial Bank of China (Europe) S.A. (Spółka Akcyjna) Oddział w Polsce', + '264' => 'RCI Banque Spółka Akcyjna Oddział w Polsce', + '265' => 'EUROCLEAR Bank SA/NV (Spółka Akcyjna) - Oddział w Polsce', + '266' => 'Intesa Sanpaolo S.p.A. Spółka Akcyjna Oddział w Polsce', + '267' => 'Western Union International Bank GmbH, Sp. z o.o. Oddział w Polsce', + '269' => 'PKO Bank Hipoteczny Spółka Akcyjna', + '270' => 'TF BANK AB (Spółka z ograniczoną odpowiedzialnością) Oddział w Polsce', + '271' => 'FCE Bank Spółka Akcyjna Oddział w Polsce', + '272' => 'AS Inbank Spółka Akcyjna - Oddział w Polsce', + '273' => 'China Construction Bank (Europe) S.A. (Spółka Akcyjna) Oddział w Polsce', + '274' => 'MUFG Bank (Europe) N.V. S.A. Oddział w Polsce', + '275' => 'John Deere Bank S.A. Spółka Akcyjna Oddział w Polsce ', + '277' => 'Volkswagen Bank GmbH Spółka z ograniczoną odpowiedzialnością Oddział w Polsce', + '278' => 'ING Bank Hipoteczny Spółka Akcyjna', + '279' => 'Raiffeisen Bank International AG (Spółka Akcyjna) Oddział w Polsce', + '280' => 'HSBC France (Spółka Akcyjna) Oddział w Polsce', + '281' => 'Goldman Sachs Bank Europe SE Spółka Europejska Oddział w Polsce', + '283' => 'J.P. Morgan AG (Spółka Akcyjna) Oddział w Polsce', + '284' => 'UBS Europe SE (Spółka Europejska) Oddział w Polsce', + '285' => 'Banca Farmafactoring S.p.A. Spółka Akcyjna Oddział w Polsce', + '286' => 'FCA Bank S.p.A. Spółka Akcyjna Oddział w Polsce', + '287' => 'Bank Nowy BFG Spółka Akcyjna', + '288' => 'ALLFUNDS BANK S.A.U. (SPÓŁKA AKCYJNA) ODDZIAŁ W POLSCE', + ]; + + /** + * @example 'Euro Bank SA' + */ + public static function bank() + { + return static::randomElement(static::$banks); + } + + /** + * International Bank Account Number (IBAN) + * + * @see http://en.wikipedia.org/wiki/International_Bank_Account_Number + * + * @param string $prefix for generating bank account number of a specific bank + * @param string $countryCode ISO 3166-1 alpha-2 country code + * @param int $length total length without country code and 2 check digits + * + * @return string + */ + public static function bankAccountNumber($prefix = '', $countryCode = 'PL', $length = null) + { + return static::iban($countryCode, $prefix, $length); + } + + protected static function addBankCodeChecksum($iban, $countryCode = 'PL') + { + if ($countryCode != 'PL' || strlen($iban) <= 8) { + return $iban; + } + $checksum = 0; + $weights = [7, 1, 3, 9, 7, 1, 3]; + + for ($i = 0; $i < 7; ++$i) { + $checksum += $weights[$i] * (int) $iban[$i]; + } + $checksum = $checksum % 10; + + return substr($iban, 0, 7) . $checksum . substr($iban, 8); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Person.php new file mode 100644 index 00000000..6d7312db --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Person.php @@ -0,0 +1,243 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + public function title($gender = null) + { + return static::randomElement(static::$title); + } + + /** + * replaced by specific unisex Polish title + */ + public static function titleMale() + { + return static::randomElement(static::$title); + } + + /** + * replaced by specific unisex Polish title + */ + public static function titleFemale() + { + return static::randomElement(static::$title); + } + + /** + * PESEL - Universal Electronic System for Registration of the Population + * + * @see http://en.wikipedia.org/wiki/PESEL + * + * @param DateTime $birthdate + * @param string $sex M for male or F for female + * + * @return string 11 digit number, like 44051401358 + */ + public static function pesel($birthdate = null, $sex = null) + { + if ($birthdate === null) { + $birthdate = \Faker\Provider\DateTime::dateTimeThisCentury(); + } + + $weights = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3]; + $length = count($weights); + + $fullYear = (int) $birthdate->format('Y'); + $year = (int) $birthdate->format('y'); + $month = $birthdate->format('m') + (((int) ($fullYear / 100) - 14) % 5) * 20; + $day = $birthdate->format('d'); + + $result = [(int) ($year / 10), $year % 10, (int) ($month / 10), $month % 10, (int) ($day / 10), $day % 10]; + + for ($i = 6; $i < $length; ++$i) { + $result[$i] = static::randomDigit(); + } + + $result[$length - 1] |= 1; + + if ($sex == 'F') { + $result[$length - 1] -= 1; + } + + $checksum = 0; + + for ($i = 0; $i < $length; ++$i) { + $checksum += $weights[$i] * $result[$i]; + } + $checksum = (10 - ($checksum % 10)) % 10; + $result[] = $checksum; + + return implode('', $result); + } + + /** + * National Identity Card number + * + * @see http://en.wikipedia.org/wiki/Polish_National_Identity_Card + * + * @return string 3 letters and 6 digits, like ABA300000 + */ + public static function personalIdentityNumber() + { + $range = str_split('ABCDEFGHIJKLMNPRSTUVWXYZ'); + $low = ['A', static::randomElement($range), static::randomElement($range)]; + $high = [static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit()]; + $weights = [7, 3, 1, 7, 3, 1, 7, 3]; + $checksum = 0; + + for ($i = 0, $size = count($low); $i < $size; ++$i) { + $checksum += $weights[$i] * (ord($low[$i]) - 55); + } + + for ($i = 0, $size = count($high); $i < $size; ++$i) { + $checksum += $weights[$i + 3] * $high[$i]; + } + $checksum %= 10; + + return implode('', $low) . $checksum . implode('', $high); + } + + /** + * Taxpayer Identification Number (NIP in Polish) + * + * @see http://en.wikipedia.org/wiki/PESEL#Other_identifiers + * @see http://pl.wikipedia.org/wiki/NIP + * + * @return string 10 digit number + */ + public static function taxpayerIdentificationNumber() + { + $weights = [6, 5, 7, 2, 3, 4, 5, 6, 7]; + $result = []; + + do { + $result = [ + static::randomDigitNotNull(), static::randomDigitNotNull(), static::randomDigitNotNull(), + static::randomDigit(), static::randomDigit(), static::randomDigit(), + static::randomDigit(), static::randomDigit(), static::randomDigit(), + ]; + $checksum = 0; + + for ($i = 0, $size = count($result); $i < $size; ++$i) { + $checksum += $weights[$i] * $result[$i]; + } + $checksum %= 11; + } while ($checksum == 10); + $result[] = $checksum; + + return implode('', $result); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/PhoneNumber.php new file mode 100644 index 00000000..d421539b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/PhoneNumber.php @@ -0,0 +1,18 @@ + + + Prof. Hart will answer or forward your message. + + We would prefer to send you information by email. + + + **The Legal Small Print** + + + (Three Pages) + + ***START**THE SMALL PRINT!**FOR PUBLIC DOMAIN EBOOKS**START*** + Why is this "Small Print!" statement here? You know: lawyers. + They tell us you might sue us if there is something wrong with + your copy of this eBook, even if you got it for free from + someone other than us, and even if what's wrong is not our + fault. So, among other things, this "Small Print!" statement + disclaims most of our liability to you. It also tells you how + you may distribute copies of this eBook if you want to. + + *BEFORE!* YOU USE OR READ THIS EBOOK + By using or reading any part of this PROJECT GUTENBERG-tm + eBook, you indicate that you understand, agree to and accept + this "Small Print!" statement. If you do not, you can receive + a refund of the money (if any) you paid for this eBook by + sending a request within 30 days of receiving it to the person + you got it from. If you received this eBook on a physical + medium (such as a disk), you must return it with your request. + + ABOUT PROJECT GUTENBERG-TM EBOOKS + This PROJECT GUTENBERG-tm eBook, like most PROJECT GUTENBERG-tm eBooks, + is a "public domain" work distributed by Professor Michael S. Hart + through the Project Gutenberg Association (the "Project"). + Among other things, this means that no one owns a United States copyright + on or for this work, so the Project (and you!) can copy and + distribute it in the United States without permission and + without paying copyright royalties. Special rules, set forth + below, apply if you wish to copy and distribute this eBook + under the "PROJECT GUTENBERG" trademark. + + Please do not use the "PROJECT GUTENBERG" trademark to market + any commercial products without permission. + + To create these eBooks, the Project expends considerable + efforts to identify, transcribe and proofread public domain + works. Despite these efforts, the Project's eBooks and any + medium they may be on may contain "Defects". Among other + things, Defects may take the form of incomplete, inaccurate or + corrupt data, transcription errors, a copyright or other + intellectual property infringement, a defective or damaged + disk or other eBook medium, a computer virus, or computer + codes that damage or cannot be read by your equipment. + + LIMITED WARRANTY; DISCLAIMER OF DAMAGES + But for the "Right of Replacement or Refund" described below, + [1] Michael Hart and the Foundation (and any other party you may + receive this eBook from as a PROJECT GUTENBERG-tm eBook) disclaims + all liability to you for damages, costs and expenses, including + legal fees, and [2] YOU HAVE NO REMEDIES FOR NEGLIGENCE OR + UNDER STRICT LIABILITY, OR FOR BREACH OF WARRANTY OR CONTRACT, + INCLUDING BUT NOT LIMITED TO INDIRECT, CONSEQUENTIAL, PUNITIVE + OR INCIDENTAL DAMAGES, EVEN IF YOU GIVE NOTICE OF THE + POSSIBILITY OF SUCH DAMAGES. + + If you discover a Defect in this eBook within 90 days of + receiving it, you can receive a refund of the money (if any) + you paid for it by sending an explanatory note within that + time to the person you received it from. If you received it + on a physical medium, you must return it with your note, and + such person may choose to alternatively give you a replacement + copy. If you received it electronically, such person may + choose to alternatively give you a second opportunity to + receive it electronically. + + THIS EBOOK IS OTHERWISE PROVIDED TO YOU "AS-IS". NO OTHER + WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, ARE MADE TO YOU AS + TO THE EBOOK OR ANY MEDIUM IT MAY BE ON, INCLUDING BUT NOT + LIMITED TO WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A + PARTICULAR PURPOSE. + + Some states do not allow disclaimers of implied warranties or + the exclusion or limitation of consequential damages, so the + above disclaimers and exclusions may not apply to you, and you + may have other legal rights. + + INDEMNITY + You will indemnify and hold Michael Hart, the Foundation, + and its trustees and agents, and any volunteers associated + with the production and distribution of Project Gutenberg-tm + texts harmless, from all liability, cost and expense, including + legal fees, that arise directly or indirectly from any of the + following that you do or cause: [1] distribution of this eBook, + [2] alteration, modification, or addition to the eBook, + or [3] any Defect. + + DISTRIBUTION UNDER "PROJECT GUTENBERG-tm" + You may distribute copies of this eBook electronically, or by + disk, book or any other medium if you either delete this + "Small Print!" and all other references to Project Gutenberg, + or: + + [1] Only give exact copies of it. Among other things, this + requires that you do not remove, alter or modify the + eBook or this "small print!" statement. You may however, + if you wish, distribute this eBook in machine readable + binary, compressed, mark-up, or proprietary form, + including any form resulting from conversion by word + processing or hypertext software, but only so long as + *EITHER*: + + [*] The eBook, when displayed, is clearly readable, and + does *not* contain characters other than those + intended by the author of the work, although tilde + (~), asterisk (*) and underline (_) characters may + be used to convey punctuation intended by the + author, and additional characters may be used to + indicate hypertext links; OR + + [*] The eBook may be readily converted by the reader at + no expense into plain ASCII, EBCDIC or equivalent + form by the program that displays the eBook (as is + the case, for instance, with most word processors); + OR + + [*] You provide, or agree to also provide on request at + no additional cost, fee or expense, a copy of the + eBook in its original plain ASCII form (or in EBCDIC + or other equivalent proprietary form). + + [2] Honor the eBook refund and replacement provisions of this + "Small Print!" statement. + + [3] Pay a trademark license fee to the Foundation of 20% of the + gross profits you derive calculated using the method you + already use to calculate your applicable taxes. If you + don't derive profits, no royalty is due. Royalties are + payable to "Project Gutenberg Literary Archive Foundation" + the 60 days following each date you prepare (or were + legally required to prepare) your annual (or equivalent + periodic) tax return. Please contact us beforehand to + let us know your plans and to work out the details. + + WHAT IF YOU *WANT* TO SEND MONEY EVEN IF YOU DON'T HAVE TO? + Project Gutenberg is dedicated to increasing the number of + public domain and licensed works that can be freely distributed + in machine readable form. + + The Project gratefully accepts contributions of money, time, + public domain materials, or royalty free copyright licenses. + Money should be paid to the: + "Project Gutenberg Literary Archive Foundation." + + If you are interested in contributing scanning equipment or + software or other items, please contact Michael Hart at: + hart@pobox.com + + [Portions of this eBook's header and trailer may be reprinted only + when distributed free of all fees. Copyright (C) 2001, 2002 by + Michael S. Hart. Project Gutenberg is a TradeMark and may not be + used in any sales of Project Gutenberg eBooks or other materials be + they hardware or software or any other related product without + express permission.] + + *END THE SMALL PRINT! FOR PUBLIC DOMAIN EBOOKS*Ver.02/11/02*END* + + */ +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Address.php new file mode 100644 index 00000000..10bdd571 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Address.php @@ -0,0 +1,154 @@ +generator->numerify('########0001'); + $n .= check_digit($n); + $n .= check_digit($n); + + return $formatted ? vsprintf('%d%d.%d%d%d.%d%d%d/%d%d%d%d-%d%d', str_split($n)) : $n; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Internet.php new file mode 100644 index 00000000..fc68ae66 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Internet.php @@ -0,0 +1,9 @@ + [ + '4##############', + ], + 'MasterCard' => [ + '5##############', + ], + 'American Express' => [ + '34############', + '37############', + ], + 'Discover Card' => [ + '6011###########', + '622############', + '64#############', + '65#############', + ], + 'Diners' => [ + '301############', + '301##########', + '305############', + '305##########', + '36#############', + '36###########', + '38#############', + '38###########', + ], + 'Elo' => [ + '636368#########', + '438935#########', + '504175#########', + '451416#########', + '636297#########', + '5067###########', + '4576###########', + '4011###########', + ], + 'Hipercard' => [ + '38#############', + '60#############', + ], + 'Aura' => [ + '50#############', + ], + ]; + + /** + * International Bank Account Number (IBAN) + * + * @see http://en.wikipedia.org/wiki/International_Bank_Account_Number + * + * @param string $prefix for generating bank account number of a specific bank + * @param string $countryCode ISO 3166-1 alpha-2 country code + * @param int $length total length without country code and 2 check digits + * + * @return string + */ + public static function bankAccountNumber($prefix = '', $countryCode = 'BR', $length = null) + { + return static::iban($countryCode, $prefix, $length); + } + + /** + * @see list of Brazilians banks (2018-02-15), source: https://pt.wikipedia.org/wiki/Lista_de_bancos_do_Brasil + */ + protected static $banks = [ + 'BADESUL Desenvolvimento S.A. – Agência de Fomento/RS', + 'Banco Central do Brasil', + 'Banco da Amazônia', + 'Banco de Brasília', + 'Banco de Desenvolvimento de Minas Gerais', + 'Banco de Desenvolvimento do Espírito Santo', + 'Banco de Desenvolvimento do Paraná', + 'Banco do Brasil', + 'Banco do Estado de Sergipe Banese Estadual', + 'Banco do Estado do Espírito Santo Banestes', + 'Banco do Estado do Pará', + 'Banco do Estado do Rio Grande do Sul', + 'Banco do Nordeste do Brasil', + 'Banco Nacional de Desenvolvimento Econômico e Social', + 'Banco Regional de Desenvolvimento do Extremo Sul', + 'Caixa Econômica Federal', + 'Banco ABN Amro S.A.', + 'Banco Alfa', + 'Banco Banif', + 'Banco BBM', + 'Banco BMG', + 'Banco Bonsucesso', + 'Banco BTG Pactual', + 'Banco Cacique', + 'Banco Caixa Geral - Brasil', + 'Banco Citibank', + 'Banco Credibel', + 'Banco Credit Suisse', + 'Góis Monteiro & Co', + 'Banco Fator', + 'Banco Fibra', + 'Agibank', + 'Banco Guanabara', + 'Banco Industrial do Brasil', + 'Banco Industrial e Comercial', + 'Banco Indusval', + 'Banco Inter', + 'Banco Itaú BBA', + 'Banco ItaúBank', + 'Banco Itaucred Financiamentos', + 'Banco Mercantil do Brasil', + 'Banco Modal Modal', + 'Banco Morada', + 'Banco Pan', + 'Banco Paulista', + 'Banco Pine', + 'Banco Renner', + 'Banco Ribeirão Preto', + 'Banco Safra', + 'Banco Santander', + 'Banco Sofisa', + 'Banco Topázio', + 'Banco Votorantim', + 'Bradesco Bradesco', + 'Itaú Unibanco', + 'Banco Original', + 'Banco Neon', + 'Nu Pagamentos S.A', + 'XP Investimentos Corretora de Câmbio Títulos e Valores Mobiliários S.A', + ]; + + /** + * @example 'Banco Neon' + */ + public static function bank() + { + return static::randomElement(static::$banks); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Person.php new file mode 100644 index 00000000..6331e7ba --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Person.php @@ -0,0 +1,159 @@ +generator->numerify('#########'); + $n .= check_digit($n); + $n .= check_digit($n); + + return $formatted ? vsprintf('%d%d%d.%d%d%d.%d%d%d-%d%d', str_split($n)) : $n; + } + + /** + * A random RG number, following Sao Paulo state's rules. + * + * @see http://pt.wikipedia.org/wiki/C%C3%A9dula_de_identidade + * + * @param bool $formatted If the number should have dots/dashes or not. + * + * @return string + */ + public function rg($formatted = true) + { + $n = $this->generator->numerify('########'); + $n .= check_digit($n); + + return $formatted ? vsprintf('%d%d.%d%d%d.%d%d%d-%s', str_split($n)) : $n; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/PhoneNumber.php new file mode 100644 index 00000000..6717def5 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/PhoneNumber.php @@ -0,0 +1,150 @@ + '']); + } + + return $number; + } + + /** + * Generates an 9-digit landline number without formatting characters. + * + * @param bool $formatted [def: true] If it should return a formatted number or not. + * + * @return string + */ + public static function landline($formatted = true) + { + $number = static::numerify(static::randomElement(static::$landlineFormats)); + + if (!$formatted) { + $number = strtr($number, ['-' => '']); + } + + return $number; + } + + /** + * Randomizes between cellphone and landline numbers. + * + * @param bool $formatted [def: true] If it should return a formatted number or not. + */ + public static function phone($formatted = true) + { + $options = static::randomElement([ + ['cellphone', false], + ['cellphone', true], + ['landline', null], + ]); + + return call_user_func("static::{$options[0]}", $formatted, $options[1]); + } + + /** + * Generates a complete phone number. + * + * @param string $type [def: landline] One of "landline" or "cellphone". Defaults to "landline" on invalid values. + * @param bool $formatted [def: true] If the number should be formatted or not. + * + * @return string + */ + protected static function anyPhoneNumber($type, $formatted = true) + { + $area = static::areaCode(); + $number = ($type == 'cellphone') ? + static::cellphone($formatted) : + static::landline($formatted); + + return $formatted ? "($area) $number" : $area . $number; + } + + /** + * Concatenates {@link areaCode} and {@link cellphone} into a national cellphone number. + * + * @param bool $formatted [def: true] If it should return a formatted number or not. + * + * @return string + */ + public static function cellphoneNumber($formatted = true) + { + return static::anyPhoneNumber('cellphone', $formatted); + } + + /** + * Concatenates {@link areaCode} and {@link landline} into a national landline number. + * + * @param bool $formatted [def: true] If it should return a formatted number or not. + * + * @return string + */ + public static function landlineNumber($formatted = true) + { + return static::anyPhoneNumber('landline', $formatted); + } + + /** + * Randomizes between complete cellphone and landline numbers. + */ + public function phoneNumber() + { + $method = static::randomElement(['cellphoneNumber', 'landlineNumber']); + + return call_user_func("static::$method", true); + } + + /** + * Randomizes between complete cellphone and landline numbers, cleared from formatting symbols. + */ + public static function phoneNumberCleared() + { + $method = static::randomElement(['cellphoneNumber', 'landlineNumber']); + + return call_user_func("static::$method", false); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Text.php new file mode 100644 index 00000000..d177c872 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Text.php @@ -0,0 +1,3427 @@ += 12; + $verifier = 0; + + for ($i = 1; $i <= $length; ++$i) { + if (!$second_algorithm) { + $multiplier = $i + 1; + } else { + $multiplier = ($i >= 9) ? $i - 7 : $i + 1; + } + $verifier += $numbers[$length - $i] * $multiplier; + } + + $verifier = 11 - ($verifier % 11); + + if ($verifier >= 10) { + $verifier = 0; + } + + return $verifier; +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_PT/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_PT/Address.php new file mode 100644 index 00000000..0d3f8508 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_PT/Address.php @@ -0,0 +1,130 @@ + 0; --$i) { + $numbers[$i] = substr($number, $i - 1, 1); + $partial[$i] = $numbers[$i] * $factor; + $sum += $partial[$i]; + + if ($factor == $base) { + $factor = 1; + } + ++$factor; + } + $res = $sum % 11; + + if ($res == 0 || $res == 1) { + $digit = 0; + } else { + $digit = 11 - $res; + } + + return $digit; + } + + /** + * @see http://nomesportugueses.blogspot.pt/2012/01/lista-dos-cem-nomes-mais-usados-em.html + */ + protected static $firstNameMale = [ + 'Rodrigo', 'João', 'Martim', 'Afonso', 'Tomás', 'Gonçalo', 'Francisco', 'Tiago', + 'Diogo', 'Guilherme', 'Pedro', 'Miguel', 'Rafael', 'Gabriel', 'Santiago', 'Dinis', + 'David', 'Duarte', 'José', 'Simão', 'Daniel', 'Lucas', 'Gustavo', 'André', 'Denis', + 'Salvador', 'António', 'Vasco', 'Henrique', 'Lourenço', 'Manuel', 'Eduardo', 'Bernardo', + 'Leandro', 'Luís', 'Diego', 'Leonardo', 'Alexandre', 'Rúben', 'Mateus', 'Ricardo', + 'Vicente', 'Filipe', 'Bruno', 'Nuno', 'Carlos', 'Rui', 'Hugo', 'Samuel', 'Álvaro', + 'Matias', 'Fábio', 'Ivo', 'Paulo', 'Jorge', 'Xavier', 'Marco', 'Isaac', 'Raúl', 'Benjamim', + 'Renato', 'Artur', 'Mário', 'Frederico', 'Cristiano', 'Ivan', 'Sérgio', 'Micael', + 'Vítor', 'Edgar', 'Kevin', 'Joaquim', 'Igor', 'Ângelo', 'Enzo', 'Valentim', 'Flávio', + 'Joel', 'Fernando', 'Sebastião', 'Tomé', 'César', 'Cláudio', 'Nelson', 'Lisandro', 'Jaime', + 'Gil', 'Mauro', 'Sandro', 'Hélder', 'Matheus', 'William', 'Gaspar', 'Márcio', + 'Martinho', 'Emanuel', 'Marcos', 'Telmo', 'Davi', 'Wilson', + ]; + + protected static $firstNameFemale = [ + 'Maria', 'Leonor', 'Matilde', 'Mariana', 'Ana', 'Beatriz', 'Inês', 'Lara', 'Carolina', 'Margarida', + 'Joana', 'Sofia', 'Diana', 'Francisca', 'Laura', 'Sara', 'Madalena', 'Rita', 'Mafalda', 'Catarina', + 'Luana', 'Marta', 'Íris', 'Alice', 'Bianca', 'Constança', 'Gabriela', 'Eva', 'Clara', 'Bruna', 'Daniela', + 'Iara', 'Filipa', 'Vitória', 'Ariana', 'Letícia', 'Bárbara', 'Camila', 'Rafaela', 'Carlota', 'Yara', + 'Núria', 'Raquel', 'Ema', 'Helena', 'Benedita', 'Érica', 'Isabel', 'Nicole', 'Lia', 'Alícia', 'Mara', + 'Jéssica', 'Soraia', 'Júlia', 'Luna', 'Victória', 'Luísa', 'Teresa', 'Miriam', 'Adriana', 'Melissa', + 'Andreia', 'Juliana', 'Alexandra', 'Yasmin', 'Tatiana', 'Leticia', 'Luciana', 'Eduarda', 'Cláudia', + 'Débora', 'Fabiana', 'Renata', 'Kyara', 'Kelly', 'Irina', 'Mélanie', 'Nádia', 'Cristiana', 'Liliana', + 'Patrícia', 'Vera', 'Doriana', 'Ângela', 'Mia', 'Erica', 'Mónica', 'Isabela', 'Salomé', 'Cátia', + 'Verónica', 'Violeta', 'Lorena', 'Érika', 'Vanessa', 'Iris', 'Anna', 'Viviane', 'Rebeca', 'Neuza', + ]; + + protected static $lastName = [ + 'Abreu', 'Almeida', 'Alves', 'Amaral', 'Amorim', 'Andrade', 'Anjos', 'Antunes', 'Araújo', 'Assunção', + 'Azevedo', 'Baptista', 'Barbosa', 'Barros', 'Batista', 'Borges', 'Branco', 'Brito', 'Campos', 'Cardoso', + 'Carneiro', 'Carvalho', 'Castro', 'Coelho', 'Correia', 'Costa', 'Cruz', 'Cunha', 'Domingues', 'Esteves', + 'Faria', 'Fernandes', 'Ferreira', 'Figueiredo', 'Fonseca', 'Freitas', 'Garcia', 'Gaspar', 'Gomes', + 'Gonçalves', 'Guerreiro', 'Henriques', 'Jesus', 'Leal', 'Leite', 'Lima', 'Lopes', 'Loureiro', 'Lourenço', + 'Macedo', 'Machado', 'Magalhães', 'Maia', 'Marques', 'Martins', 'Matias', 'Matos', 'Melo', 'Mendes', + 'Miranda', 'Monteiro', 'Morais', 'Moreira', 'Mota', 'Moura', 'Nascimento', 'Neto', 'Neves', 'Nogueira', + 'Nunes', 'Oliveira', 'Pacheco', 'Paiva', 'Pereira', 'Pinheiro', 'Pinho', 'Pinto', 'Pires', 'Ramos', + 'Reis', 'Ribeiro', 'Rocha', 'Rodrigues', 'Santos', 'Silva', 'Simões', 'Soares', 'Sousa', + 'Sá', 'Tavares', 'Teixeira', 'Torres', 'Valente', 'Vaz', 'Vicente', 'Vieira', + ]; +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_PT/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_PT/PhoneNumber.php new file mode 100644 index 00000000..948ba94d --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_PT/PhoneNumber.php @@ -0,0 +1,50 @@ + '01', 'AR' => '02', 'AG' => '03', 'B' => '40', 'BC' => '04', 'BH' => '05', + 'BN' => '06', 'BT' => '07', 'BV' => '08', 'BR' => '09', 'BZ' => '10', 'CS' => '11', + 'CL' => '51', 'CJ' => '12', 'CT' => '13', 'CV' => '14', 'DB' => '15', 'DJ' => '16', + 'GL' => '17', 'GR' => '52', 'GJ' => '18', 'HR' => '19', 'HD' => '20', 'IL' => '21', + 'IS' => '22', 'IF' => '23', 'MM' => '24', 'MH' => '25', 'MS' => '26', 'NT' => '27', + 'OT' => '28', 'PH' => '29', 'SM' => '30', 'SJ' => '31', 'SB' => '32', 'SV' => '33', + 'TR' => '34', 'TM' => '35', 'TL' => '36', 'VS' => '37', 'VL' => '38', 'VN' => '39', + + 'B1' => '41', 'B2' => '42', 'B3' => '43', 'B4' => '44', 'B5' => '45', 'B6' => '46', + ]; + + /** + * Personal Numerical Code (CNP) + * + * @see http://ro.wikipedia.org/wiki/Cod_numeric_personal + * + * @example 1111111111118 + * + * @param string|null $gender Person::GENDER_MALE or Person::GENDER_FEMALE + * @param string|null $dateOfBirth (1800-2099) 'Y-m-d', 'Y-m', 'Y' I.E. '1981-06-16', '2085-03', '1900' + * @param string|null $county county code where the CNP was issued + * @param bool|null $isResident flag if the person resides in Romania + * + * @return string 13 digits CNP code + */ + public function cnp($gender = null, $dateOfBirth = null, $county = null, $isResident = true) + { + $genders = [Person::GENDER_MALE, Person::GENDER_FEMALE]; + + if (empty($gender)) { + $gender = static::randomElement($genders); + } elseif (!in_array($gender, $genders, false)) { + throw new \InvalidArgumentException("Gender must be '{Person::GENDER_MALE}' or '{Person::GENDER_FEMALE}'"); + } + + $date = $this->getDateOfBirth($dateOfBirth); + + if (null === $county) { + $countyCode = static::randomElement(array_values(static::$cnpCountyCodes)); + } elseif (!array_key_exists($county, static::$cnpCountyCodes)) { + throw new \InvalidArgumentException("Invalid county code '{$county}' received"); + } else { + $countyCode = static::$cnpCountyCodes[$county]; + } + + $cnp = (string) $this->getGenderDigit($date, $gender, $isResident) + . $date->format('ymd') + . $countyCode + . static::numerify('##%') + ; + + $checksum = $this->getChecksumDigit($cnp); + + return $cnp . $checksum; + } + + /** + * @param string|null $dateOfBirth + * + * @return \DateTime + */ + protected function getDateOfBirth($dateOfBirth) + { + if (empty($dateOfBirth)) { + $dateOfBirthParts = [self::numberBetween(1800, 2099)]; + } else { + $dateOfBirthParts = explode('-', $dateOfBirth); + } + $baseDate = \Faker\Provider\DateTime::dateTimeBetween("first day of January {$dateOfBirthParts[0]}", "last day of December {$dateOfBirthParts[0]}"); + + switch (count($dateOfBirthParts)) { + case 1: + $dateOfBirthParts[] = $baseDate->format('m'); + //don't break, we need the day also + // no break + case 2: + $dateOfBirthParts[] = $baseDate->format('d'); + //don't break, next line will + // no break + case 3: + break; + + default: + throw new \InvalidArgumentException("Invalid date of birth - must be null or in the 'Y-m-d', 'Y-m', 'Y' format"); + } + + if ($dateOfBirthParts[0] < 1800 || $dateOfBirthParts[0] > 2099) { + throw new \InvalidArgumentException("Invalid date of birth - year must be between 1800 and 2099, '{$dateOfBirthParts[0]}' received"); + } + + $dateOfBirthFinal = implode('-', $dateOfBirthParts); + $date = \DateTime::createFromFormat('Y-m-d', $dateOfBirthFinal); + //a full (invalid) date might have been supplied, check if it converts + if ($date->format('Y-m-d') !== $dateOfBirthFinal) { + throw new \InvalidArgumentException("Invalid date of birth - '{$date->format('Y-m-d')}' generated based on '{$dateOfBirth}' received"); + } + + return $date; + } + + /** + * https://ro.wikipedia.org/wiki/Cod_numeric_personal#S + * + * @param bool $isResident + * @param string $gender + * + * @return int + */ + protected static function getGenderDigit(\DateTime $dateOfBirth, $gender, $isResident) + { + if (!$isResident) { + return 9; + } + + if ($dateOfBirth->format('Y') < 1900) { + if ($gender == Person::GENDER_MALE) { + return 3; + } + + return 4; + } + + if ($dateOfBirth->format('Y') < 2000) { + if ($gender == Person::GENDER_MALE) { + return 1; + } + + return 2; + } + + if ($gender == Person::GENDER_MALE) { + return 5; + } + + return 6; + } + + /** + * Calculates a checksum for the Personal Numerical Code (CNP). + * + * @param string $value 12 digit CNP + * + * @return int checksum digit + */ + protected function getChecksumDigit($value) + { + $checkNumber = 279146358279; + + $checksum = 0; + + foreach (range(0, 11) as $digit) { + $checksum += (int) substr($value, $digit, 1) * (int) substr($checkNumber, $digit, 1); + } + $checksum = $checksum % 11; + + return $checksum == 10 ? 1 : $checksum; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ro_RO/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/ro_RO/PhoneNumber.php new file mode 100644 index 00000000..01c58591 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ro_RO/PhoneNumber.php @@ -0,0 +1,62 @@ + [ + '021#######', // Bucharest + '023#######', + '024#######', + '025#######', + '026#######', + '027#######', // non-geographic + '031#######', // Bucharest + '033#######', + '034#######', + '035#######', + '036#######', + '037#######', // non-geographic + ], + 'mobile' => [ + '07########', + ], + ]; + + protected static $specialFormats = [ + 'toll-free' => [ + '0800######', + '0801######', // shared-cost numbers + '0802######', // personal numbering + '0806######', // virtual cards + '0807######', // pre-paid cards + '0870######', // internet dial-up + ], + 'premium-rate' => [ + '0900######', + '0903######', // financial information + '0906######', // adult entertainment + ], + ]; + + /** + * @see http://en.wikipedia.org/wiki/Telephone_numbers_in_Romania#Last_years + */ + public function phoneNumber() + { + $type = static::randomElement(array_keys(static::$normalFormats)); + + return static::numerify(static::randomElement(static::$normalFormats[$type])); + } + + public static function tollFreePhoneNumber() + { + return static::numerify(static::randomElement(static::$specialFormats['toll-free'])); + } + + public static function premiumRatePhoneNumber() + { + return static::numerify(static::randomElement(static::$specialFormats['premium-rate'])); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ro_RO/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/ro_RO/Text.php new file mode 100644 index 00000000..1e40597c --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ro_RO/Text.php @@ -0,0 +1,155 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Color.php new file mode 100644 index 00000000..d31d1208 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Color.php @@ -0,0 +1,23 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefixes); + } + + public static function companyNameElement() + { + return static::randomElement(static::$companyElements); + } + + public static function companyNameSuffix() + { + return static::randomElement(static::$companyNameSuffixes); + } + + /** + * Generates a Russian Taxpayer Personal Identification Number + * + * @param string $area_code + * + * @return string + * + * @deprecated use {@link \Faker\Provider\ru_RU\Company::inn10()} instead + * @see \Faker\Provider\ru_RU\Company::inn10() + */ + public static function inn($area_code = '') + { + return self::inn10($area_code); + } + + /** + * Generates a Russian Taxpayer Personal Identification Number + * + * @param string $area_code + * + * @return string + */ + public static function inn10($area_code = '') + { + if ($area_code === '' || (int) $area_code === 0) { + //Simple generation code for areas in Russian without check for valid + $area_code = self::numberBetween(1, 91); + } else { + $area_code = (int) $area_code; + } + $area_code = str_pad($area_code, 2, '0', STR_PAD_LEFT); + $inn_base = $area_code . static::numerify('#######'); + + return $inn_base . self::inn10Checksum($inn_base); + } + + public static function kpp($inn = '') + { + if ($inn === '' || strlen($inn) < 4) { + $inn = self::inn10(); + } + + return substr($inn, 0, 4) . '01001'; + } + + /** + * Generates INN Checksum + * + * @see https://ru.wikipedia.org/wiki/%D0%98%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BD%D0%BE%D0%BC%D0%B5%D1%80_%D0%BD%D0%B0%D0%BB%D0%BE%D0%B3%D0%BE%D0%BF%D0%BB%D0%B0%D1%82%D0%B5%D0%BB%D1%8C%D1%89%D0%B8%D0%BA%D0%B0 + * + * @param string $inn + * + * @return string Checksum (one digit) + */ + public static function inn10Checksum($inn) + { + $multipliers = [2, 4, 10, 3, 5, 9, 4, 6, 8]; + $sum = 0; + + for ($i = 0; $i < 9; ++$i) { + $sum += (int) $inn[$i] * $multipliers[$i]; + } + + return (string) (($sum % 11) % 10); + } + + /** + * Checks whether an INN has a valid checksum + * + * @param string $inn + * + * @return bool + */ + public static function inn10IsValid($inn) + { + return strlen($inn) === 10 && self::inn10Checksum($inn) === $inn[9]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Internet.php new file mode 100644 index 00000000..195ef5f4 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Internet.php @@ -0,0 +1,9 @@ +.*<' | \ + * sed -r 's/—//' | sed -r 's/[\<\>]//g' | sed -r "s/(^|$)/'/g" | sed -r 's/$/,/' | sed -r 's/\&(laquo|raquo);/"/g' | \ + * sed -r 's/\s+/ /g'" + */ + protected static $banks = [ + 'Новый Промышленный Банк', + 'Новый Символ', + 'Нокссбанк', + 'Ноосфера', + 'Нордеа Банк', + 'Нота-Банк', + 'НС Банк', + 'НСТ-Банк', + 'Нэклис-Банк', + 'Образование', + 'Объединенный Банк Промышленных Инвестиций', + 'Объединенный Банк Республики', + 'Объединенный Капитал', + 'Объединенный Кредитный Банк', + 'Объединенный Кредитный Банк Московский филиал', + 'Объединенный Национальный Банк', + 'Объединенный Резервный Банк', + 'Океан Банк', + 'ОЛМА-Банк', + 'Онего', + 'Оней Банк', + 'ОПМ-Банк', + 'Оргбанк', + 'Оренбург', + 'ОТП Банк', + 'ОФК Банк', + 'Охабанк', + 'Первобанк', + 'Первомайский', + 'Первоуральскбанк', + 'Первый Дортрансбанк', + 'Первый Инвестиционный банк', + 'Первый Клиентский Банк', + 'Первый Чешско-Российский Банк', + 'Пересвет', + 'Пермь', + 'Петербургский Социальный Коммерческий Банк', + 'Петрокоммерц', + 'ПИР Банк', + 'Платина', + 'Плато-Банк', + 'Плюс Банк', + 'Пойдем!', + 'Почтобанк', + 'Прайм Финанс', + 'Преодоление', + 'Приморье', + 'Примсоцбанк', + 'Примтеркомбанк', + 'Прио-Внешторгбанк', + 'Приобье', + 'Приполярный', + 'Приско Капитал Банк', + 'Пробизнесбанк', + 'Проинвестбанк', + 'Прокоммерцбанк', + 'Проминвестбанк', + 'Промрегионбанк', + 'Промсвязьбанк', + 'Промсвязьинвестбанк', + 'Промсельхозбанк', + 'Промтрансбанк', + 'Промышленно-Финансовое Сотрудничество', + 'Промэнергобанк', + 'Профессионал Банк', + 'Профит Банк', + 'Прохладный', + 'Пульс Столицы', + 'Радиотехбанк', + 'Развитие', + 'Развитие-Столица', + 'Райффайзенбанк', + 'Расчетно-Кредитный Банк', + 'Расчетный Дом', + 'РБА', + 'Региональный Банк Развития', + 'Региональный Банк Сбережений', + 'Региональный Коммерческий Банк', + 'Региональный Кредит', + 'Регионфинансбанк', + 'Регнум', + 'Резерв', + 'Ренессанс', + 'Ренессанс Кредит', + 'Рента-Банк', + 'РЕСО Кредит', + 'Республиканский Кредитный Альянс', + 'Ресурс-Траст', + 'Риабанк', + 'Риал-Кредит', + 'Ринвестбанк', + 'Ринвестбанк Московский офис', + 'РИТ-Банк', + 'РН Банк', + 'Росавтобанк', + 'Росбанк', + 'Росбизнесбанк', + 'Росгосстрах Банк', + 'Росдорбанк', + 'РосЕвроБанк', + 'РосинтерБанк', + 'Роспромбанк', + 'Россельхозбанк', + 'Российская Финансовая Корпорация', + 'Российский Капитал', + 'Российский Кредит', + 'Российский Национальный Коммерческий Банк', + 'Россита-Банк', + 'Россия', + 'Рост Банк', + 'Ростфинанс', + 'Росэксимбанк', + 'Росэнергобанк', + 'Роял Кредит Банк', + 'РСКБ', + 'РТС-Банк', + 'РУБанк', + 'Рублев', + 'Руна-Банк', + 'Рунэтбанк', + 'Рускобанк', + 'Руснарбанк', + 'Русский Банк Сбережений', + 'Русский Ипотечный Банк', + 'Русский Международный Банк', + 'Русский Национальный Банк', + 'Русский Стандарт', + 'Русский Торговый Банк', + 'Русский Трастовый Банк', + 'Русский Финансовый Альянс', + 'Русский Элитарный Банк', + 'Русславбанк', + 'Руссобанк', + 'Русстройбанк', + 'Русфинанс Банк', + 'Русь', + 'РусьРегионБанк', + 'Русьуниверсалбанк', + 'РусЮгбанк', + 'РФИ Банк', + 'Саммит Банк', + 'Санкт-Петербургский Банк Инвестиций', + 'Саратов', + 'Саровбизнесбанк', + 'Сбербанк России', + 'Связной Банк', + 'Связь-Банк', + 'СДМ-Банк', + 'Севастопольский Морской банк', + 'Северный Кредит', + 'Северный Народный Банк', + 'Северо-Восточный Альянс', + 'Северо-Западный 1 Альянс Банк', + 'Северстройбанк', + 'Севзапинвестпромбанк', + 'Сельмашбанк', + 'Сервис-Резерв', + 'Сетелем Банк', + 'СИАБ', + 'Сибирский Банк Реконструкции и Развития', + 'Сибнефтебанк', + 'Сибсоцбанк', + 'Сибэс', + 'Сибэс Московский офис', + 'Синергия', + 'Синко-Банк', + 'Система', + 'Сити Инвест Банк', + 'Ситибанк', + 'СКА-Банк', + 'СКБ-Банк', + 'Славия', + 'Славянбанк', + 'Славянский Кредит', + 'Смартбанк', + 'СМБ-Банк', + 'Смолевич', + 'СМП Банк', + 'Снежинский', + 'Собинбанк', + 'Соверен Банк', + 'Советский', + 'Совкомбанк', + 'Современные Стандарты Бизнеса', + 'Содружество', + 'Соколовский', + 'Солид Банк', + 'Солидарность (Москва)', + 'Солидарность (Самара)', + 'Социнвестбанк', + 'Социнвестбанк Московский филиал', + 'Социум-Банк', + 'Союз', + 'Союзный', + 'Спецстройбанк', + 'Спиритбанк', + 'Спурт Банк', + 'Спутник', + 'Ставропольпромстройбанк', + 'Сталь Банк', + 'Стандарт-Кредит', + 'Стар Альянс', + 'СтарБанк', + 'Старооскольский Агропромбанк', + 'Старый Кремль', + 'Стелла-Банк', + 'Столичный Кредит', + 'Стратегия', + 'Строительно-Коммерческий Банк', + 'Стройлесбанк', + 'Сумитомо Мицуи', + 'Сургутнефтегазбанк', + 'СЭБ Банк', + 'Таатта', + 'Таврический', + 'Таганрогбанк', + 'Тагилбанк', + 'Тайдон', + 'Тайм Банк', + 'Тальменка-Банк', + 'Тальменка-Банк Московский филиал', + 'Тамбовкредитпромбанк', + 'Татагропромбанк', + 'Татсоцбанк', + 'Татфондбанк', + 'Таурус Банк', + 'ТверьУниверсалБанк', + 'Тексбанк', + 'Темпбанк', + 'Тендер-Банк', + 'Терра', + 'Тетраполис', + 'Тимер Банк', + 'Тинькофф Банк', + 'Тихоокеанский Внешторгбанк', + 'Тойота Банк', + 'Тольяттихимбанк', + 'Томскпромстройбанк', + 'Торгово-Промышленный Банк Китая', + 'Торговый Городской Банк', + 'Торжокуниверсалбанк', + 'Транскапиталбанк', + 'Транснациональный Банк', + 'Транспортный', + 'Трансстройбанк', + 'Траст Капитал Банк', + 'Тройка-Д Банк', + 'Тульский Промышленник', + 'Тульский Промышленник Московский офис', + 'Тульский Расчетный Центр', + 'Турбобанк', + 'Тусар', + 'ТЭМБР-Банк', + 'ТЭСТ', + 'Углеметбанк', + 'Уздан', + 'Унифин', + 'Унифондбанк', + 'Уралкапиталбанк', + 'Уралприватбанк', + 'Уралпромбанк', + 'Уралсиб', + 'Уралтрансбанк', + 'Уралфинанс', + 'Уральский Банк Реконструкции и Развития', + 'Уральский Межрегиональный Банк', + 'Уральский Финансовый Дом', + 'Ури Банк', + 'Уссури', + 'ФДБ', + 'ФИА-Банк', + 'Финам Банк', + 'Финанс Бизнес Банк', + 'Финансово-Промышленный Капитал', + 'Финансовый Капитал', + 'Финансовый Стандарт', + 'Финарс Банк', + 'Финпромбанк (ФПБ Банк)', + 'Финтрастбанк', + 'ФК Открытие (бывш. НОМОС-Банк)', + 'Флора-Москва', + 'Фольксваген Банк Рус', + 'Фондсервисбанк', + 'Фора-Банк', + 'Форбанк', + 'Форус Банк', + 'Форштадт', + 'Фьючер', + 'Хакасский Муниципальный Банк', + 'Ханты-Мансийский банк Открытие', + 'Химик', + 'Хлынов', + 'Хованский', + 'Холдинвестбанк', + 'Холмск', + 'Хоум Кредит Банк', + 'Центр-инвест', + 'Центрально-Азиатский', + 'Центрально-Европейский Банк', + 'Центркомбанк', + 'ЦентроКредит', + 'Церих', + 'Чайна Констракшн', + 'Чайнасельхозбанк', + 'Челиндбанк', + 'Челябинвестбанк', + 'Черноморский банк развития и реконструкции', + 'Чувашкредитпромбанк', + 'Эйч-Эс-Би-Си Банк (HSBC)', + 'Эко-Инвест', + 'Экономбанк', + 'Экономикс-Банк', + 'Экси-Банк', + 'Эксперт Банк', + 'Экспобанк', + 'Экспресс-Волга', + 'Экспресс-Кредит', + 'Эл Банк', + 'Элита', + 'Эльбин', + 'Энергобанк', + 'Энергомашбанк', + 'Энерготрансбанк', + 'Эно', + 'Энтузиастбанк', + 'Эргобанк', + 'Ю Би Эс Банк', + 'ЮГ-Инвестбанк', + 'Югра', + 'Южный Региональный Банк', + 'ЮМК', + 'Юниаструм Банк', + 'ЮниКредит Банк', + 'Юнистрим', + 'Япы Креди Банк Москва', + 'ЯР-Банк', + 'Яринтербанк', + 'Ярославич', + 'K2 Банк', + 'АББ', + 'Абсолют Банк', + 'Авангард', + 'Аверс', + 'Автоградбанк', + 'АвтоКредитБанк', + 'Автоторгбанк', + 'Агроинкомбанк', + 'Агропромкредит', + 'Агророс', + 'Агросоюз', + 'Адамон Банк', + 'Адамон Банк Московский филиал', + 'Аделантбанк', + 'Адмиралтейский', + 'Азиатско-Тихоокеанский Банк', + 'Азимут', + 'Азия Банк', + 'Азия-Инвест Банк', + 'Ай-Си-Ай-Си-Ай Банк (ICICI)', + 'Айви Банк', + 'АйМаниБанк', + 'Ак Барс', + 'Акибанк', + 'Аккобанк', + 'Акрополь', + 'Аксонбанк', + 'Актив Банк', + 'АктивКапитал Банк', + 'АктивКапитал Банк Московский филиал', + 'АктивКапитал Банк Санкт-Петербургский филиал', + 'Акцент', + 'Акцепт', + 'Акция', + 'Алданзолотобанк', + 'Александровский', + 'Алеф-Банк', + 'Алжан', + 'Алмазэргиэнбанк', + 'АлтайБизнес-Банк', + 'Алтайкапиталбанк', + 'Алтынбанк', + 'Альба Альянс', + 'Альта-Банк', + 'Альтернатива', + 'Альфа-Банк', + 'АМБ Банк', + 'Америкэн Экспресс Банк', + 'Анелик РУ', + 'Анкор Банк', + 'Анталбанк', + 'Апабанк', + 'Аресбанк', + 'Арзамас', + 'Арксбанк', + 'Арсенал', + 'Аспект', + 'Ассоциация', + 'БайкалБанк', + 'БайкалИнвестБанк', + 'Байкалкредобанк', + 'Балаково-Банк', + 'Балтийский Банк', + 'Балтика', + 'Балтинвестбанк', + 'Банк "Акцент" Московский филиал', + 'Банк "МБА-Москва"', + 'Банк "Санкт-Петербург"', + 'Банк АВБ', + 'Банк БКФ', + 'Банк БФА', + 'Банк БЦК-Москва', + 'Банк Город', + 'Банк Жилищного Финансирования', + 'Банк Инноваций и Развития', + 'Банк Интеза', + 'Банк ИТБ', + 'Банк Казани', + 'Банк Китая (Элос)', + 'Банк Кредит Свисс', + 'Банк МБФИ', + 'Банк Москвы', + 'Банк на Красных Воротах', + 'Банк Оранжевый (бывш. Промсервисбанк)', + 'Банк оф Токио-Мицубиси', + 'Банк Премьер Кредит', + 'Банк ПСА Финанс Рус', + 'Банк Развития Технологий', + 'Банк Расчетов и Сбережений', + 'Банк Раунд', + 'Банк РСИ', + 'Банк Сберегательно-кредитного сервиса', + 'Банк СГБ', + 'Банк Торгового Финансирования', + 'Банк Финсервис', + 'Банк Экономический Союз', + 'Банкирский Дом', + 'Банкхаус Эрбе', + 'Башкомснаббанк', + 'Башпромбанк', + 'ББР Банк', + 'Белгородсоцбанк', + 'Бенифит-Банк', + 'Берейт', + 'Бест Эффортс Банк', + 'Бизнес для Бизнеса', + 'Бинбанк', + 'БИНБАНК кредитные карты', + 'Бинбанк Мурманск', + 'БКС Инвестиционный Банк', + 'БМВ Банк', + 'БНП Париба Банк', + 'Богородский', + 'Богородский Муниципальный Банк', + 'Братский АНКБ', + 'БСТ-Банк', + 'Булгар Банк', + 'Бум-Банк', + 'Бумеранг', + 'БФГ-Кредит', + 'БыстроБанк', + 'Вакобанк', + 'Вега-Банк', + 'Век', + 'Великие Луки Банк', + 'Венец', + 'Верхневолжский', + 'Верхневолжский Крымский филиал', + 'Верхневолжский Московский филиал', + 'Верхневолжский Невский филиал', + 'Верхневолжский Таврический филиал', + 'Верхневолжский Ярославский филиал', + 'Веста', + 'Вестинтербанк', + 'Взаимодействие', + 'Викинг', + 'Витабанк', + 'Витязь', + 'Вкабанк', + 'Владбизнесбанк', + 'Владпромбанк', + 'Внешпромбанк', + 'Внешфинбанк', + 'Внешэкономбанк', + 'Военно-Промышленный Банк', + 'Возрождение', + 'Вокбанк', + 'Вологдабанк', + 'Вологжанин', + 'Воронеж', + 'Восточно-Европейский Трастовый Банк', + 'Восточный Экспресс Банк', + 'ВостСибтранскомбанк', + 'ВРБ Москва', + 'Всероссийский Банк Развития Регионов', + 'ВТБ', + 'ВТБ 24', + 'ВУЗ-Банк', + 'Выборг-Банк', + 'Выборг-Банк Московский филиал', + 'Вэлтон Банк', + 'Вятич', + 'Вятка-Банк', + 'Гагаринский', + 'Газбанк', + 'Газнефтьбанк', + 'Газпромбанк', + 'Газстройбанк', + 'Газтрансбанк', + 'Газэнергобанк', + 'Ганзакомбанк', + 'Гарант-Инвест', + 'Гаранти Банк Москва', + 'Геленджик-Банк', + 'Генбанк', + 'Геобанк', + 'Гефест', + 'Глобус', + 'Глобэкс', + 'Голдман Сакс Банк', + 'Горбанк', + 'ГПБ-Ипотека', + 'Гранд Инвест Банк', + 'Гринкомбанк', + 'Гринфилдбанк', + 'Грис-Банк', + 'Гута-Банк', + 'Далена', + 'Далетбанк', + 'Далта-Банк', + 'Дальневосточный Банк', + 'Данске Банк', + 'Девон-Кредит', + 'ДельтаКредит', + 'Денизбанк Москва', + 'Держава', + 'Дж. П. Морган Банк', + 'Джаст Банк', + 'Джей энд Ти Банк', + 'Дил-Банк', + 'Динамичные Системы', + 'Дойче Банк', + 'Долинск', + 'Дом-Банк', + 'Дон-Тексбанк', + 'Донкомбанк', + 'Донхлеббанк', + 'Дорис Банк', + 'Дружба', + 'ЕАТП Банк', + 'Евразийский Банк', + 'Евроазиатский Инвестиционный Банк', + 'ЕвроАксис Банк', + 'Евроальянс', + 'Еврокапитал-Альянс', + 'Еврокоммерц', + 'Еврокредит', + 'Евромет', + 'Европейский Стандарт', + 'Европлан Банк', + 'ЕвроситиБанк', + 'Еврофинанс Моснарбанк', + 'Единственный', + 'Единый Строительный Банк', + 'Екатеринбург', + 'Екатерининский', + 'Енисей', + 'Енисейский Объединенный Банк', + 'Ермак', + 'Живаго-Банк', + 'Жилкредит', + 'Жилстройбанк', + 'Запсибкомбанк', + 'Заречье', + 'Заубер Банк', + 'Земкомбанк', + 'Земский Банк', + 'Зенит', + 'Зенит Сочи', + 'Зернобанк', + 'Зираат Банк', + 'Златкомбанк', + 'И.Д.Е.А. Банк', + 'Иваново', + 'Идеалбанк', + 'Ижкомбанк', + 'ИК Банк', + 'Икано Банк', + 'Инбанк', + 'Инвест-Экобанк', + 'Инвестиционный Банк Кубани', + 'Инвестиционный Республиканский Банк', + 'Инвестиционный Союз', + 'Инвесткапиталбанк', + 'Инвестсоцбанк', + 'Инвестторгбанк', + 'ИНГ Банк', + 'Индустриальный Сберегательный Банк', + 'Инкаробанк', + 'Интерактивный Банк', + 'Интеркоммерц Банк', + 'Интеркоопбанк', + 'Интеркредит', + 'Интернациональный Торговый Банк', + 'Интерпрогрессбанк', + 'Интерпромбанк', + 'Интехбанк', + 'Информпрогресс', + 'Ипозембанк', + 'ИпоТек Банк', + 'Иронбанк', + 'ИРС', + 'Итуруп', + 'Ишбанк', + 'Йошкар-Ола', + 'Калуга', + 'Камский Горизонт', + 'Камский Коммерческий Банк', + 'Камчаткомагропромбанк', + 'Канский', + 'Капитал', + 'Капиталбанк', + 'Кедр', + 'Кемсоцинбанк', + 'Кетовский Коммерческий Банк', + 'Киви Банк', + 'Классик Эконом Банк', + 'Клиентский', + 'Кольцо Урала', + 'Коммерцбанк (Евразия)', + 'Коммерческий Банк Развития', + 'Коммерческий Индо Банк', + 'Консервативный Коммерческий Банк', + 'Констанс-Банк', + 'Континенталь', + 'Конфидэнс Банк', + 'Кор', + 'Кореа Эксчендж Банк Рус', + 'Королевский Банк Шотландии', + 'Космос', + 'Костромаселькомбанк', + 'Кошелев-Банк', + 'Крайинвестбанк', + 'Кранбанк', + 'Креди Агриколь КИБ', + 'Кредит Европа Банк', + 'Кредит Урал Банк', + 'Кредит Экспресс', + 'Кредит-Москва', + 'Кредитинвест', + 'Кредо Финанс', + 'Кредпромбанк', + 'Кремлевский', + 'Крокус-Банк', + 'Крона-Банк', + 'Кросна-Банк', + 'Кроссинвестбанк', + 'Крыловский', + 'КС Банк', + 'Кубанский Универсальный Банк', + 'Кубань Кредит', + 'Кубаньторгбанк', + 'Кузбассхимбанк', + 'Кузнецкбизнесбанк', + 'Кузнецкий', + 'Кузнецкий Мост', + 'Курган', + 'Курскпромбанк', + 'Лада-Кредит', + 'Лайтбанк', + 'Ланта-Банк', + 'Левобережный', + 'Легион', + 'Леноблбанк', + 'Лесбанк', + 'Лето Банк', + 'Липецккомбанк', + 'Логос', + 'Локо-Банк', + 'Лэнд-Банк', + 'М2М Прайвет Банк', + 'Майкопбанк', + 'Майский', + 'МАК-Банк', + 'Максима', + 'Максимум', + 'МАСТ-Банк', + 'Мастер-Капитал', + 'МВС Банк', + 'МДМ Банк', + 'Мегаполис', + 'Международный Акционерный Банк', + 'Международный Банк Развития', + 'Международный Банк Санкт-Петербурга (МБСП)', + 'Международный Коммерческий Банк', + 'Международный Расчетный Банк', + 'Международный Строительный Банк', + 'Международный Финансовый Клуб', + 'Межотраслевая Банковская Корпорация', + 'Межрегиональный Банк Реконструкции', + 'Межрегиональный Клиринговый Банк', + 'Межрегиональный Почтовый Банк', + 'Межрегиональный промышленно-строительный банк', + 'Межрегионбанк', + 'Межтопэнергобанк', + 'Межтрастбанк', + 'Мерседес-Бенц Банк Рус', + 'Металлинвестбанк', + 'Металлург', + 'Меткомбанк (Каменск-Уральский)', + 'Меткомбанк (Череповец)', + 'Метробанк', + 'Метрополь', + 'Мидзухо Банк', + 'Мико-Банк', + 'Милбанк', + 'Миллениум Банк', + 'Мир Бизнес Банк', + 'Мираф-Банк', + 'Мираф-Банк Московский филиал', + 'Миръ', + 'Михайловский ПЖСБ', + 'Морган Стэнли Банк', + 'Морской Банк', + 'Мосводоканалбанк', + 'Москва', + 'Москва-Сити', + 'Московский Вексельный Банк', + 'Московский Индустриальный Банк', + 'Московский Коммерческий Банк', + 'Московский Кредитный Банк', + 'Московский Национальный Инвестиционный Банк', + 'Московский Нефтехимический Банк', + 'Московский Областной Банк', + 'Московско-Парижский Банк', + 'Московское Ипотечное Агентство', + 'Москоммерцбанк', + 'Мосстройэкономбанк (М Банк)', + 'Мострансбанк', + 'Мосуралбанк', + 'МС Банк Рус', + 'МСП Банк', + 'МТИ-Банк', + 'МТС Банк', + 'Муниципальный Камчатпрофитбанк', + 'Мурманский Социальный Коммерческий Банк', + 'МФБанк', + 'Н-Банк', + 'Нальчик', + 'Наратбанк', + 'Народный Банк', + 'Народный Банк Республики Тыва', + 'Народный Доверительный Банк', + 'Народный Земельно-Промышленный Банк', + 'Народный Инвестиционный Банк', + 'Натиксис Банк', + 'Нацинвестпромбанк', + 'Национальная Факторинговая Компания', + 'Национальный Банк "Траст"', + 'Национальный Банк Взаимного Кредита', + 'Национальный Банк Сбережений', + 'Национальный Залоговый Банк', + 'Национальный Клиринговый Банк', + 'Национальный Клиринговый Центр', + 'Национальный Корпоративный Банк', + 'Национальный Резервный Банк', + 'Национальный Стандарт', + 'Наш Дом', + 'НБД-Банк', + 'НБК-Банк', + 'Невастройинвест', + 'Невский Банк', + 'Нейва', + 'Нерюнгрибанк', + 'Нефтепромбанк', + 'Нефтяной Альянс', + 'Нижневолжский Коммерческий Банк', + 'Нико-Банк', + 'НК Банк', + 'НоваховКапиталБанк', + 'Новация', + 'Новикомбанк', + 'Новобанк', + 'Новое Время', + 'Новокиб', + 'Новопокровский', + 'Новый Век', + 'Новый Кредитный Союз', + 'Новый Московский Банк', + ]; + + /** + * @example 'Новый Московский Банк' + */ + public static function bank() + { + return static::randomElement(static::$banks); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Person.php new file mode 100644 index 00000000..95ec8069 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Person.php @@ -0,0 +1,180 @@ +middleNameMale(); + } + + if ($gender === static::GENDER_FEMALE) { + return $this->middleNameFemale(); + } + + return $this->middleName(static::randomElement([ + static::GENDER_MALE, + static::GENDER_FEMALE, + ])); + } + + /** + * Return last name for the specified gender. + * + * @param string|null $gender A gender of the last name should be generated + * for. If the argument is skipped a random gender will be used. + * + * @return string Last name + */ + public function lastName($gender = null) + { + $lastName = static::randomElement(static::$lastName); + + if (static::GENDER_FEMALE === $gender) { + return $lastName . 'а'; + } + + if (static::GENDER_MALE === $gender) { + return $lastName; + } + + return $lastName . static::randomElement(static::$lastNameSuffix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/PhoneNumber.php new file mode 100644 index 00000000..06f63373 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/PhoneNumber.php @@ -0,0 +1,14 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + /** + * @example 'PhD' + */ + public static function suffix() + { + return static::randomElement(static::$suffix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/sk_SK/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/sk_SK/PhoneNumber.php new file mode 100644 index 00000000..bd195e4f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/sk_SK/PhoneNumber.php @@ -0,0 +1,15 @@ +format('ymd'); + $randomDigits = $this->getBirthNumber($gender); + + $checksum = Luhn::computeCheckDigit($datePart . $randomDigits); + + return $datePart . '-' . $randomDigits . $checksum; + } + + /** + * @param string $gender Person::GENDER_MALE || Person::GENDER_FEMALE + * + * @return string of three digits + */ + protected function getBirthNumber($gender = null) + { + if ($gender && $gender === static::GENDER_MALE) { + return (string) static::numerify('##') . static::randomElement([1, 3, 5, 7, 9]); + } + + $zeroCheck = static function ($callback) { + do { + $randomDigits = $callback(); + } while ($randomDigits === '000'); + + return $randomDigits; + }; + + if ($gender && $gender === static::GENDER_FEMALE) { + return $zeroCheck(static function () { + return (string) static::numerify('##') . static::randomElement([0, 2, 4, 6, 8]); + }); + } + + return $zeroCheck(static function () { + return (string) static::numerify('###'); + }); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/sv_SE/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/sv_SE/PhoneNumber.php new file mode 100644 index 00000000..01cf15d9 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/sv_SE/PhoneNumber.php @@ -0,0 +1,37 @@ +format('a') === 'am' ? 'öö' : 'ös'; + } + + public static function dayOfWeek($max = 'now') + { + $map = [ + 'Sunday' => 'Pazar', + 'Monday' => 'Pazartesi', + 'Tuesday' => 'Salı', + 'Wednesday' => 'Çarşamba', + 'Thursday' => 'Perşembe', + 'Friday' => 'Cuma', + 'Saturday' => 'Cumartesi', + ]; + $week = static::dateTime($max)->format('l'); + + return $map[$week] ?? $week; + } + + public static function monthName($max = 'now') + { + $map = [ + 'January' => 'Ocak', + 'February' => 'Şubat', + 'March' => 'Mart', + 'April' => 'Nisan', + 'May' => 'Mayıs', + 'June' => 'Haziran', + 'July' => 'Temmuz', + 'August' => 'Ağustos', + 'September' => 'Eylül', + 'October' => 'Ekim', + 'November' => 'Kasım', + 'December' => 'Aralık', + ]; + $month = static::dateTime($max)->format('F'); + + return $map[$month] ?? $month; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/tr_TR/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/tr_TR/Internet.php new file mode 100644 index 00000000..9d821119 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/tr_TR/Internet.php @@ -0,0 +1,9 @@ + $digit) { + if ($index % 2 === 0) { + $evenSum += $digit; + } else { + $oddSum += $digit; + } + } + + $tenthDigit = (7 * $evenSum - $oddSum) % 10; + $eleventhDigit = ($evenSum + $oddSum + $tenthDigit) % 10; + + return $tenthDigit . $eleventhDigit; + } + + /** + * Checks whether a TCNo has a valid checksum + * + * @param string $tcNo + * + * @return bool + */ + public static function tcNoIsValid($tcNo) + { + return self::tcNoChecksum(substr($tcNo, 0, -2)) === substr($tcNo, -2, 2); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/tr_TR/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/tr_TR/PhoneNumber.php new file mode 100644 index 00000000..be35cb56 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/tr_TR/PhoneNumber.php @@ -0,0 +1,33 @@ +generator->parse($format); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/Color.php new file mode 100644 index 00000000..502161ce --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/Color.php @@ -0,0 +1,23 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefix); + } + + public static function companyName() + { + return static::randomElement(static::$companyName); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/Internet.php new file mode 100644 index 00000000..61193547 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/Internet.php @@ -0,0 +1,9 @@ +middleNameMale(); + } + + if ($gender === static::GENDER_FEMALE) { + return $this->middleNameFemale(); + } + + return $this->middleName(static::randomElement([ + static::GENDER_MALE, + static::GENDER_FEMALE, + ])); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/PhoneNumber.php new file mode 100644 index 00000000..15b443f3 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/PhoneNumber.php @@ -0,0 +1,72 @@ +generator->parse($format)); + } + + public function hamletPrefix() + { + return static::randomElement(static::$hamletPrefix); + } + + public function wardName() + { + $format = static::randomElement(static::$wardNameFormats); + + return static::bothify($this->generator->parse($format)); + } + + public function wardPrefix() + { + return static::randomElement(static::$wardPrefix); + } + + public function districtName() + { + $format = static::randomElement(static::$districtNameFormats); + + return static::bothify($this->generator->parse($format)); + } + + public function districtPrefix() + { + return static::randomElement(static::$districtPrefix); + } + + /** + * @example 'Hà Nội' + */ + public function city() + { + return static::randomElement(static::$city); + } + + /** + * @example 'Bắc Giang' + */ + public static function province() + { + return static::randomElement(static::$province); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/vi_VN/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/vi_VN/Color.php new file mode 100644 index 00000000..df788550 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/vi_VN/Color.php @@ -0,0 +1,36 @@ +generator->parse(static::randomElement(static::$middleNameFormat)); + } + + public static function middleNameMale() + { + return static::randomElement(static::$middleNameMale); + } + + public static function middleNameFemale() + { + return static::randomElement(static::$middleNameFemale); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/vi_VN/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/vi_VN/PhoneNumber.php new file mode 100644 index 00000000..a6f47f15 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/vi_VN/PhoneNumber.php @@ -0,0 +1,61 @@ + [ + '0[a] ### ####', + '(0[a]) ### ####', + '0[a]-###-####', + '(0[a])###-####', + '84-[a]-###-####', + '(84)([a])###-####', + '+84-[a]-###-####', + ], + '8' => [ + '0[a] #### ####', + '(0[a]) #### ####', + '0[a]-####-####', + '(0[a])####-####', + '84-[a]-####-####', + '(84)([a])####-####', + '+84-[a]-####-####', + ], + ]; + + public function phoneNumber() + { + $areaCode = static::randomElement(static::$areaCodes); + $areaCodeLength = strlen($areaCode); + $digits = 7; + + if ($areaCodeLength < 2) { + $digits = 8; + } + + return static::numerify(str_replace('[a]', $areaCode, static::randomElement(static::$formats[$digits]))); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Address.php new file mode 100644 index 00000000..d67e1497 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Address.php @@ -0,0 +1,148 @@ +city() . static::area(); + } + + public static function postcode() + { + $prefix = str_pad(self::numberBetween(1, 85), 2, 0, STR_PAD_LEFT); + $suffix = '00'; + + return $prefix . self::numberBetween(10, 88) . $suffix; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Color.php new file mode 100644 index 00000000..254fd071 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Color.php @@ -0,0 +1,66 @@ +format('a') === 'am' ? '上午' : '下午'; + } + + public static function dayOfWeek($max = 'now') + { + $map = [ + 'Sunday' => '星期日', + 'Monday' => '星期一', + 'Tuesday' => '星期二', + 'Wednesday' => '星期三', + 'Thursday' => '星期四', + 'Friday' => '星期五', + 'Saturday' => '星期六', + ]; + $week = static::dateTime($max)->format('l'); + + return $map[$week] ?? $week; + } + + public static function monthName($max = 'now') + { + $map = [ + 'January' => '一月', + 'February' => '二月', + 'March' => '三月', + 'April' => '四月', + 'May' => '五月', + 'June' => '六月', + 'July' => '七月', + 'August' => '八月', + 'September' => '九月', + 'October' => '十月', + 'November' => '十一月', + 'December' => '十二月', + ]; + $month = static::dateTime($max)->format('F'); + + return $map[$month] ?? $month; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Internet.php new file mode 100644 index 00000000..e1a87964 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Internet.php @@ -0,0 +1,24 @@ + [ + '板橋區', '三重區', '中和區', '永和區', + '新莊區', '新店區', '樹林區', '鶯歌區', + '三峽區', '淡水區', '汐止區', '瑞芳區', + '土城區', '蘆洲區', '五股區', '泰山區', + '林口區', '深坑區', '石碇區', '坪林區', + '三芝區', '石門區', '八里區', '平溪區', + '雙溪區', '貢寮區', '金山區', '萬里區', + '烏來區', + ], + '宜蘭縣' => [ + '宜蘭市', '羅東鎮', '蘇澳鎮', '頭城鎮', '礁溪鄉', + '壯圍鄉', '員山鄉', '冬山鄉', '五結鄉', '三星鄉', + '大同鄉', '南澳鄉', + ], + '桃園市' => [ + '桃園區', '中壢區', '大溪區', '楊梅區', '蘆竹區', + '大園區', '龜山區', '八德區', '龍潭區', '平鎮區', + '新屋區', '觀音區', '復興區', + ], + '新竹縣' => [ + '竹北市', '竹東鎮', '新埔鎮', '關西鎮', '湖口鄉', + '新豐鄉', '芎林鄉', '橫山鄉', '北埔鄉', '寶山鄉', + '峨眉鄉', '尖石鄉', '五峰鄉', + ], + '苗栗縣' => [ + '苗栗市', '苑裡鎮', '通霄鎮', '竹南鎮', '頭份鎮', + '後龍鎮', '卓蘭鎮', '大湖鄉', '公館鄉', '銅鑼鄉', + '南庄鄉', '頭屋鄉', '三義鄉', '西湖鄉', '造橋鄉', + '三灣鄉', '獅潭鄉', '泰安鄉', + ], + '臺中市' => [ + '豐原區', '東勢區', '大甲區', '清水區', '沙鹿區', + '梧棲區', '后里區', '神岡區', '潭子區', '大雅區', + '新社區', '石岡區', '外埔區', '大安區', '烏日區', + '大肚區', '龍井區', '霧峰區', '太平區', '大里區', + '和平區', '中區', '東區', '南區', '西區', '北區', + '西屯區', '南屯區', '北屯區', + ], + '彰化縣' => [ + '彰化市', '鹿港鎮', '和美鎮', '線西鄉', '伸港鄉', + '福興鄉', '秀水鄉', '花壇鄉', '芬園鄉', '員林鎮', + '溪湖鎮', '田中鎮', '大村鄉', '埔鹽鄉', '埔心鄉', + '永靖鄉', '社頭鄉', '二水鄉', '北斗鎮', '二林鎮', + '田尾鄉', '埤頭鄉', '芳苑鄉', '大城鄉', '竹塘鄉', + '溪州鄉', + ], + '南投縣' => [ + '南投市', '埔里鎮', '草屯鎮', '竹山鎮', '集集鎮', + '名間鄉', '鹿谷鄉', '中寮鄉', '魚池鄉', '國姓鄉', + '水里鄉', '信義鄉', '仁愛鄉', + ], + '雲林縣' => [ + '斗六市', '斗南鎮', '虎尾鎮', '西螺鎮', '土庫鎮', + '北港鎮', '古坑鄉', '大埤鄉', '莿桐鄉', '林內鄉', + '二崙鄉', '崙背鄉', '麥寮鄉', '東勢鄉', '褒忠鄉', + '臺西鄉', '元長鄉', '四湖鄉', '口湖鄉', '水林鄉', + ], + '嘉義縣' => [ + '太保市', '朴子市', '布袋鎮', '大林鎮', '民雄鄉', + '溪口鄉', '新港鄉', '六腳鄉', '東石鄉', '義竹鄉', + '鹿草鄉', '水上鄉', '中埔鄉', '竹崎鄉', '梅山鄉', + '番路鄉', '大埔鄉', '阿里山鄉', + ], + '臺南市' => [ + '新營區', '鹽水區', '白河區', '柳營區', '後壁區', + '東山區', '麻豆區', '下營區', '六甲區', '官田區', + '大內區', '佳里區', '學甲區', '西港區', '七股區', + '將軍區', '北門區', '新化區', '善化區', '新市區', + '安定區', '山上區', '玉井區', '楠西區', '南化區', + '左鎮區', '仁德區', '歸仁區', '關廟區', '龍崎區', + '永康區', '東區', '南區', '西區', '北區', '中區', + '安南區', '安平區', + ], + '高雄市' => [ + '鳳山區', '林園區', '大寮區', '大樹區', '大社區', + '仁武區', '鳥松區', '岡山區', '橋頭區', '燕巢區', + '田寮區', '阿蓮區', '路竹區', '湖內區', '茄萣區', + '永安區', '彌陀區', '梓官區', '旗山區', '美濃區', + '六龜區', '甲仙區', '杉林區', '內門區', '茂林區', + '桃源區', '三民區', '鹽埕區', '鼓山區', '左營區', + '楠梓區', '三民區', '新興區', '前金區', '苓雅區', + '前鎮區', '旗津區', '小港區', + ], + '屏東縣' => [ + '屏東市', '潮州鎮', '東港鎮', '恆春鎮', '萬丹鄉', + '長治鄉', '麟洛鄉', '九如鄉', '里港鄉', '鹽埔鄉', + '高樹鄉', '萬巒鄉', '內埔鄉', '竹田鄉', '新埤鄉', + '枋寮鄉', '新園鄉', '崁頂鄉', '林邊鄉', '南州鄉', + '佳冬鄉', '琉球鄉', '車城鄉', '滿州鄉', '枋山鄉', + '三地門鄉', '霧臺鄉', '瑪家鄉', '泰武鄉', '來義鄉', + '春日鄉', '獅子鄉', '牡丹鄉', + ], + '臺東縣' => [ + '臺東市', '成功鎮', '關山鎮', '卑南鄉', '鹿野鄉', + '池上鄉', '東河鄉', '長濱鄉', '太麻里鄉', '大武鄉', + '綠島鄉', '海端鄉', '延平鄉', '金峰鄉', '達仁鄉', + '蘭嶼鄉', + ], + '花蓮縣' => [ + '花蓮市', '鳳林鎮', '玉里鎮', '新城鄉', '吉安鄉', + '壽豐鄉', '光復鄉', '豐濱鄉', '瑞穗鄉', '富里鄉', + '秀林鄉', '萬榮鄉', '卓溪鄉', + ], + '澎湖縣' => [ + '馬公市', '湖西鄉', '白沙鄉', '西嶼鄉', '望安鄉', + '七美鄉', + ], + '基隆市' => [ + '中正區', '七堵區', '暖暖區', '仁愛區', '中山區', + '安樂區', '信義區', + ], + '新竹市' => [ + '東區', '北區', '香山區', + ], + '嘉義市' => [ + '東區', '西區', + ], + '臺北市' => [ + '松山區', '信義區', '大安區', '中山區', '中正區', + '大同區', '萬華區', '文山區', '南港區', '內湖區', + '士林區', '北投區', + ], + '連江縣' => [ + '南竿鄉', '北竿鄉', '莒光鄉', '東引鄉', + ], + '金門縣' => [ + '金城鎮', '金沙鎮', '金湖鎮', '金寧鄉', '烈嶼鄉', '烏坵鄉', + ], + ]; + + /** + * @see http://terms.naer.edu.tw/download/287/ + */ + protected static $country = [ + '不丹', '中非', '丹麥', '伊朗', '冰島', '剛果', + '加彭', '北韓', '南非', '卡達', '印尼', '印度', + '古巴', '哥德', '埃及', '多哥', '寮國', '尼日', + '巴曼', '巴林', '巴紐', '巴西', '希臘', '帛琉', + '德國', '挪威', '捷克', '教廷', '斐濟', '日本', + '智利', '東加', '查德', '汶萊', '法國', '波蘭', + '波赫', '泰國', '海地', '瑞典', '瑞士', '祕魯', + '秘魯', '約旦', '紐埃', '緬甸', '美國', '聖尼', + '聖普', '肯亞', '芬蘭', '英國', '荷蘭', '葉門', + '蘇丹', '諾魯', '貝南', '越南', '迦彭', + '迦納', '阿曼', '阿聯', '韓國', '馬利', + '以色列', '以色利', '伊拉克', '俄羅斯', + '利比亞', '加拿大', '匈牙利', '南極洲', + '南蘇丹', '厄瓜多', '吉布地', '吐瓦魯', + '哈撒克', '哈薩克', '喀麥隆', '喬治亞', + '土庫曼', '土耳其', '塔吉克', '塞席爾', + '墨西哥', '大西洋', '奧地利', '孟加拉', + '安哥拉', '安地卡', '安道爾', '尚比亞', + '尼伯爾', '尼泊爾', '巴哈馬', '巴拉圭', + '巴拿馬', '巴貝多', '幾內亞', '愛爾蘭', + '所在國', '摩洛哥', '摩納哥', '敍利亞', + '敘利亞', '新加坡', '東帝汶', '柬埔寨', + '比利時', '波扎那', '波札那', '烏克蘭', + '烏干達', '烏拉圭', '牙買加', '獅子山', + '甘比亞', '盧安達', '盧森堡', '科威特', + '科索夫', '科索沃', '立陶宛', '紐西蘭', + '維德角', '義大利', '聖文森', '艾塞亞', + '菲律賓', '萬那杜', '葡萄牙', '蒲隆地', + '蓋亞納', '薩摩亞', '蘇利南', '西班牙', + '貝里斯', '賴索托', '辛巴威', '阿富汗', + '阿根廷', '馬其頓', '馬拉威', '馬爾他', + '黎巴嫩', '亞塞拜然', '亞美尼亞', '保加利亞', + '南斯拉夫', '厄利垂亞', '史瓦濟蘭', '吉爾吉斯', + '吉里巴斯', '哥倫比亞', '坦尚尼亞', '塞內加爾', + '塞内加爾', '塞爾維亞', '多明尼加', '多米尼克', + '奈及利亞', '委內瑞拉', '宏都拉斯', '尼加拉瓜', + '巴基斯坦', '庫克群島', '愛沙尼亞', '拉脫維亞', + '摩爾多瓦', '摩里西斯', '斯洛伐克', '斯里蘭卡', + '格瑞那達', '模里西斯', '波多黎各', '澳大利亞', + '烏茲別克', '玻利維亞', '瓜地馬拉', '白俄羅斯', + '突尼西亞', '納米比亞', '索馬利亞', '索馬尼亞', + '羅馬尼亞', '聖露西亞', '聖馬利諾', '莫三比克', + '莫三鼻克', '葛摩聯盟', '薩爾瓦多', '衣索比亞', + '西薩摩亞', '象牙海岸', '賴比瑞亞', '賽普勒斯', + '馬來西亞', '馬爾地夫', '克羅埃西亞', + '列支敦斯登', '哥斯大黎加', '布吉納法索', + '布吉那法索', '幾內亞比索', '幾內亞比紹', + '斯洛維尼亞', '索羅門群島', '茅利塔尼亞', + '蒙特內哥羅', '赤道幾內亞', '阿爾及利亞', + '阿爾及尼亞', '阿爾巴尼亞', '馬紹爾群島', + '馬達加斯加', '密克羅尼西亞', '沙烏地阿拉伯', + '千里達及托巴哥', + ]; + + protected static $postcode = ['###-##', '###']; + + public function street() + { + return static::randomElement(static::$street); + } + + public static function randomChineseNumber() + { + $digits = [ + '', '一', '二', '三', '四', '五', '六', '七', '八', '九', + ]; + + return $digits[static::randomDigitNotNull()]; + } + + public static function randomNumber2() + { + return static::randomNumber(2) + 1; + } + + public static function randomNumber3() + { + return static::randomNumber(3) + 1; + } + + public static function localLatitude() + { + return static::randomFloat(6, 22, 25); + } + + public static function localLongitude() + { + return static::randomFloat(6, 120, 122); + } + + public function city() + { + $county = static::randomElement(array_keys(static::$city)); + $city = static::randomElement(static::$city[$county]); + + return $county . $city; + } + + public function state() + { + return '臺灣省'; + } + + public static function stateAbbr() + { + return '臺'; + } + + public static function cityPrefix() + { + return ''; + } + + public static function citySuffix() + { + return ''; + } + + public static function secondaryAddress() + { + return (static::randomNumber(2) + 1) . static::randomElement(static::$secondaryAddressSuffix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/Color.php new file mode 100644 index 00000000..19fa6d87 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/Color.php @@ -0,0 +1,66 @@ +generator->parse($format); + } + + public static function companyModifier() + { + return static::randomElement(static::$companyModifier); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefix); + } + + public function catchPhrase() + { + return static::randomElement(static::$catchPhrase); + } + + public function bs() + { + $result = ''; + + foreach (static::$bsWords as &$word) { + $result .= static::randomElement($word); + } + + return $result; + } + + /** + * return standard VAT / Tax ID / Uniform Serial Number + * + * @example 28263822 + * + * @return int + */ + public function VAT() + { + return static::randomNumber(8, true); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/DateTime.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/DateTime.php new file mode 100644 index 00000000..102a716c --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/DateTime.php @@ -0,0 +1,48 @@ +format('a') === 'am' ? '上午' : '下午'; + } + + public static function dayOfWeek($max = 'now') + { + $map = [ + 'Sunday' => '星期日', + 'Monday' => '星期一', + 'Tuesday' => '星期二', + 'Wednesday' => '星期三', + 'Thursday' => '星期四', + 'Friday' => '星期五', + 'Saturday' => '星期六', + ]; + $week = static::dateTime($max)->format('l'); + + return $map[$week] ?? $week; + } + + public static function monthName($max = 'now') + { + $map = [ + 'January' => '一月', + 'February' => '二月', + 'March' => '三月', + 'April' => '四月', + 'May' => '五月', + 'June' => '六月', + 'July' => '七月', + 'August' => '八月', + 'September' => '九月', + 'October' => '十月', + 'November' => '十一月', + 'December' => '十二月', + ]; + $month = static::dateTime($max)->format('F'); + + return $map[$month] ?? $month; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/Internet.php new file mode 100644 index 00000000..c3fb5fff --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/Internet.php @@ -0,0 +1,28 @@ + 10, + 'B' => 11, + 'C' => 12, + 'D' => 13, + 'E' => 14, + 'F' => 15, + 'G' => 16, + 'H' => 17, + 'I' => 34, + 'J' => 18, + 'K' => 19, + 'M' => 21, + 'N' => 22, + 'O' => 35, + 'P' => 23, + 'Q' => 24, + 'T' => 27, + 'U' => 28, + 'V' => 29, + 'W' => 32, + 'X' => 30, + 'Z' => 33, + ]; + + /** + * @see https://zh.wikipedia.org/wiki/%E4%B8%AD%E8%8F%AF%E6%B0%91%E5%9C%8B%E5%9C%8B%E6%B0%91%E8%BA%AB%E5%88%86%E8%AD%89 + */ + public static $idDigitValidator = [1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1]; + + protected static $maleNameFormats = [ + '{{lastName}}{{firstNameMale}}', + ]; + + protected static $femaleNameFormats = [ + '{{lastName}}{{firstNameFemale}}', + ]; + + protected static $titleMale = ['先生', '博士', '教授']; + protected static $titleFemale = ['小姐', '太太', '博士', '教授']; + + /** + * @see http://zh.wikipedia.org/wiki/%E7%99%BE%E5%AE%B6%E5%A7%93 + */ + protected static $lastName = [ + '趙', '錢', '孫', '李', '周', '吳', '鄭', '王', '馮', + '陳', '褚', '衛', '蔣', '沈', '韓', '楊', '朱', '秦', + '尤', '許', '何', '呂', '施', '張', '孔', '曹', '嚴', + '華', '金', '魏', '陶', '姜', '戚', '謝', '鄒', '喻', + '柏', '水', '竇', '章', '雲', '蘇', '潘', '葛', + '奚', '范', '彭', '郎', '魯', '韋', '昌', '馬', + '苗', '鳳', '花', '方', '俞', '任', '袁', '柳', + '酆', '鮑', '史', '唐', '費', '廉', '岑', '薛', + '雷', '賀', '倪', '湯', '滕', '殷', '羅', '畢', + '郝', '鄔', '安', '常', '樂', '于', '時', '傅', + '皮', '卞', '齊', '康', '伍', '余', '元', '卜', + '顧', '孟', '平', '黃', '和', '穆', '蕭', '尹', + '姚', '邵', '湛', '汪', '祁', '毛', '禹', '狄', + '米', '貝', '明', '臧', '計', '伏', '成', '戴', + '談', '宋', '茅', '龐', '熊', '紀', '舒', '屈', + '項', '祝', '董', '梁', '杜', '阮', '藍', '閔', + '席', '季', '麻', '強', '賈', '路', '婁', '危', + '江', '童', '顏', '郭', '梅', '盛', '林', '刁', + '鍾', '徐', '丘', '駱', '高', '夏', '蔡', '田', + '樊', '胡', '凌', '霍', '虞', '萬', '支', '柯', + '昝', '管', '盧', '莫', '經', '房', '裘', '繆', + '干', '解', '應', '宗', '丁', '宣', '賁', '鄧', + '郁', '單', '杭', '洪', '包', '諸', '左', '石', + '崔', '吉', '鈕', '龔', '程', '嵇', '邢', '滑', + '裴', '陸', '榮', '翁', '荀', '羊', '於', '惠', + '甄', '麴', '家', '封', '芮', '羿', '儲', '靳', + '汲', '邴', '糜', '松', '井', '段', '富', '巫', + '烏', '焦', '巴', '弓', '牧', '隗', '山', '谷', + '車', '侯', '宓', '蓬', '全', '郗', '班', '仰', + '秋', '仲', '伊', '宮', '甯', '仇', '欒', '暴', + '甘', '鈄', '厲', '戎', '祖', '武', '符', '劉', + '景', '詹', '束', '龍', '葉', '幸', '司', '韶', + '郜', '黎', '薊', '薄', '印', '宿', '白', '懷', + '蒲', '邰', '從', '鄂', '索', '咸', '籍', '賴', + '卓', '藺', '屠', '蒙', '池', '喬', '陰', '鬱', + '胥', '能', '蒼', '雙', '聞', '莘', '黨', '翟', + '譚', '貢', '勞', '逄', '姬', '申', '扶', '堵', + '冉', '宰', '酈', '雍', '郤', '璩', '桑', '桂', + '濮', '牛', '壽', '通', '邊', '扈', '燕', '冀', + '郟', '浦', '尚', '農', '溫', '別', '莊', '晏', + '柴', '瞿', '閻', '充', '慕', '連', '茹', '習', + '宦', '艾', '魚', '容', '向', '古', '易', '慎', + '戈', '廖', '庾', '終', '暨', '居', '衡', '步', + '都', '耿', '滿', '弘', '匡', '國', '文', '寇', + '廣', '祿', '闕', '東', '歐', '殳', '沃', '利', + '蔚', '越', '夔', '隆', '師', '鞏', '厙', '聶', + '晁', '勾', '敖', '融', '冷', '訾', '辛', '闞', + '那', '簡', '饒', '空', '曾', '毋', '沙', '乜', + '養', '鞠', '須', '豐', '巢', '關', '蒯', '相', + '查', '后', '荊', '紅', '游', '竺', '權', '逯', + '蓋', '益', '桓', '公', '万俟', '司馬', '上官', + '歐陽', '夏侯', '諸葛', '聞人', '東方', '赫連', + '皇甫', '尉遲', '公羊', '澹臺', '公冶', '宗政', + '濮陽', '淳于', '單于', '太叔', '申屠', '公孫', + '仲孫', '軒轅', '令狐', '鍾離', '宇文', '長孫', + '慕容', '鮮于', '閭丘', '司徒', '司空', '亓官', + '司寇', '仉', '督', '子車', '顓孫', '端木', '巫馬', + '公西', '漆雕', '樂正', '壤駟', '公良', '拓跋', + '夾谷', '宰父', '穀梁', '晉', '楚', '閆', '法', + '汝', '鄢', '涂', '欽', '段干', '百里', '東郭', + '南門', '呼延', '歸', '海', '羊舌', '微生', '岳', + '帥', '緱', '亢', '況', '後', '有', '琴', '梁丘', + '左丘', '東門', '西門', '商', '牟', '佘', '佴', + '伯', '賞', '南宮', '墨', '哈', '譙', '笪', '年', + '愛', '陽', '佟', '第五', '言', '福', + ]; + + /** + * @see http://technology.chtsai.org/namefreq/ + */ + protected static $characterMale = [ + '佳', '俊', '信', '偉', '傑', '冠', '君', '哲', + '嘉', '威', '宇', '安', '宏', '宗', '宜', '家', + '庭', '廷', '建', '彥', '心', '志', '思', '承', + '文', '柏', '樺', '瑋', '穎', '美', '翰', '華', + '詩', '豪', '賢', '軒', '銘', '霖', + ]; + + protected static $characterFemale = [ + '伶', '佩', '佳', '依', '儀', '冠', '君', '嘉', + '如', '娟', '婉', '婷', '安', '宜', '家', '庭', + '心', '思', '怡', '惠', '慧', '文', '欣', '涵', + '淑', '玲', '珊', '琪', '琬', '瑜', '穎', '筑', + '筱', '美', '芬', '芳', '華', '萍', '萱', '蓉', + '詩', '貞', '郁', '鈺', '雅', '雯', '靜', '馨', + ]; + + public static function randomName($pool, $n) + { + $name = ''; + + for ($i = 0; $i < $n; ++$i) { + $name .= static::randomElement($pool); + } + + return $name; + } + + public static function firstNameMale() + { + return static::randomName(static::$characterMale, self::numberBetween(1, 2)); + } + + public static function firstNameFemale() + { + return static::randomName(static::$characterFemale, self::numberBetween(1, 2)); + } + + public static function suffix() + { + return ''; + } + + /** + * @param string $gender Person::GENDER_MALE || Person::GENDER_FEMALE + * + * @see https://en.wikipedia.org/wiki/National_Identification_Card_(Republic_of_China) + * + * @return string Length 10 alphanumeric characters, begins with 1 latin character (birthplace), + * 1 number (gender) and then 8 numbers (the last one is check digit). + */ + public function personalIdentityNumber($gender = null) + { + $birthPlace = self::randomKey(self::$idBirthplaceCode); + $birthPlaceCode = self::$idBirthplaceCode[$birthPlace]; + + $gender = ($gender != null) ? $gender : self::randomElement([self::GENDER_FEMALE, self::GENDER_MALE]); + $genderCode = ($gender === self::GENDER_MALE) ? 1 : 2; + + $randomNumberCode = self::randomNumber(7, true); + + $codes = str_split($birthPlaceCode . $genderCode . $randomNumberCode); + $total = 0; + + foreach ($codes as $key => $code) { + $total += $code * self::$idDigitValidator[$key]; + } + + $checkSumDigit = 10 - ($total % 10); + + if ($checkSumDigit == 10) { + $checkSumDigit = 0; + } + + return $birthPlace . $genderCode . $randomNumberCode . $checkSumDigit; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/PhoneNumber.php new file mode 100644 index 00000000..db9ac327 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/PhoneNumber.php @@ -0,0 +1,19 @@ + 251: + $temp .= $chars[++$i]; + // no break + case $ord > 247: + $temp .= $chars[++$i]; + // no break + case $ord > 239: + $temp .= $chars[++$i]; + // no break + case $ord > 223: + $temp .= $chars[++$i]; + // no break + case $ord > 191: + $temp .= $chars[++$i]; + } + + $encoding[] = $temp; + } + + return $encoding; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/UniqueGenerator.php b/vendor/fakerphp/faker/src/Faker/UniqueGenerator.php new file mode 100644 index 00000000..fef167b6 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/UniqueGenerator.php @@ -0,0 +1,87 @@ + ['0123' => null], + * 'city' => ['London' => null, 'Tokyo' => null], + * ] + * + * @var array> + */ + protected $uniques = []; + + /** + * @param Extension|Generator $generator + * @param int $maxRetries + * @param array> $uniques + */ + public function __construct($generator, $maxRetries = 10000, &$uniques = []) + { + $this->generator = $generator; + $this->maxRetries = $maxRetries; + $this->uniques = &$uniques; + } + + public function ext(string $id) + { + return new self($this->generator->ext($id), $this->maxRetries, $this->uniques); + } + + /** + * Catch and proxy all generator calls but return only unique values + * + * @param string $attribute + * + * @deprecated Use a method instead. + */ + public function __get($attribute) + { + trigger_deprecation('fakerphp/faker', '1.14', 'Accessing property "%s" is deprecated, use "%s()" instead.', $attribute, $attribute); + + return $this->__call($attribute, []); + } + + /** + * Catch and proxy all generator calls with arguments but return only unique values + * + * @param string $name + * @param array $arguments + */ + public function __call($name, $arguments) + { + if (!isset($this->uniques[$name])) { + $this->uniques[$name] = []; + } + $i = 0; + + do { + $res = call_user_func_array([$this->generator, $name], $arguments); + ++$i; + + if ($i > $this->maxRetries) { + throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a unique value', $this->maxRetries)); + } + } while (array_key_exists(serialize($res), $this->uniques[$name])); + $this->uniques[$name][serialize($res)] = null; + + return $res; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ValidGenerator.php b/vendor/fakerphp/faker/src/Faker/ValidGenerator.php new file mode 100644 index 00000000..bf409456 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ValidGenerator.php @@ -0,0 +1,78 @@ +valid() + * + * @mixin Generator + */ +class ValidGenerator +{ + protected $generator; + protected $validator; + protected $maxRetries; + + /** + * @param Extension|Generator $generator + * @param callable|null $validator + * @param int $maxRetries + */ + public function __construct($generator, $validator = null, $maxRetries = 10000) + { + if (null === $validator) { + $validator = static function () { + return true; + }; + } elseif (!is_callable($validator)) { + throw new \InvalidArgumentException('valid() only accepts callables as first argument'); + } + $this->generator = $generator; + $this->validator = $validator; + $this->maxRetries = $maxRetries; + } + + public function ext(string $id) + { + return new self($this->generator->ext($id), $this->validator, $this->maxRetries); + } + + /** + * Catch and proxy all generator calls but return only valid values + * + * @param string $attribute + * + * @deprecated Use a method instead. + */ + public function __get($attribute) + { + trigger_deprecation('fakerphp/faker', '1.14', 'Accessing property "%s" is deprecated, use "%s()" instead.', $attribute, $attribute); + + return $this->__call($attribute, []); + } + + /** + * Catch and proxy all generator calls with arguments but return only valid values + * + * @param string $name + * @param array $arguments + */ + public function __call($name, $arguments) + { + $i = 0; + + do { + $res = call_user_func_array([$this->generator, $name], $arguments); + ++$i; + + if ($i > $this->maxRetries) { + throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a valid value', $this->maxRetries)); + } + } while (!call_user_func($this->validator, $res)); + + return $res; + } +} diff --git a/vendor/fakerphp/faker/src/autoload.php b/vendor/fakerphp/faker/src/autoload.php new file mode 100644 index 00000000..a4dfa9ec --- /dev/null +++ b/vendor/fakerphp/faker/src/autoload.php @@ -0,0 +1,29 @@ + "http://example.org", + "aud" => "http://example.com", + "iat" => 1356999524, + "nbf" => 1357000000 +); + +/** + * IMPORTANT: + * You must specify supported algorithms for your application. See + * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40 + * for a list of spec-compliant algorithms. + */ +$jwt = JWT::encode($payload, $key, 'HS256'); +$decoded = JWT::decode($jwt, new Key($key, 'HS256')); + +print_r($decoded); + +/* + NOTE: This will now be an object instead of an associative array. To get + an associative array, you will need to cast it as such: +*/ + +$decoded_array = (array) $decoded; + +/** + * You can add a leeway to account for when there is a clock skew times between + * the signing and verifying servers. It is recommended that this leeway should + * not be bigger than a few minutes. + * + * Source: http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#nbfDef + */ +JWT::$leeway = 60; // $leeway in seconds +$decoded = JWT::decode($jwt, new Key($key, 'HS256')); +``` +Example with RS256 (openssl) +---------------------------- +```php +use Firebase\JWT\JWT; +use Firebase\JWT\Key; + +$privateKey = << "example.org", + "aud" => "example.com", + "iat" => 1356999524, + "nbf" => 1357000000 +); + +$jwt = JWT::encode($payload, $privateKey, 'RS256'); +echo "Encode:\n" . print_r($jwt, true) . "\n"; + +$decoded = JWT::decode($jwt, new Key($publicKey, 'RS256')); + +/* + NOTE: This will now be an object instead of an associative array. To get + an associative array, you will need to cast it as such: +*/ + +$decoded_array = (array) $decoded; +echo "Decode:\n" . print_r($decoded_array, true) . "\n"; +``` + +Example with a passphrase +------------------------- + +```php +use Firebase\JWT\JWT; +use Firebase\JWT\Key; + +// Your passphrase +$passphrase = '[YOUR_PASSPHRASE]'; + +// Your private key file with passphrase +// Can be generated with "ssh-keygen -t rsa -m pem" +$privateKeyFile = '/path/to/key-with-passphrase.pem'; + +// Create a private key of type "resource" +$privateKey = openssl_pkey_get_private( + file_get_contents($privateKeyFile), + $passphrase +); + +$payload = array( + "iss" => "example.org", + "aud" => "example.com", + "iat" => 1356999524, + "nbf" => 1357000000 +); + +$jwt = JWT::encode($payload, $privateKey, 'RS256'); +echo "Encode:\n" . print_r($jwt, true) . "\n"; + +// Get public key from the private key, or pull from from a file. +$publicKey = openssl_pkey_get_details($privateKey)['key']; + +$decoded = JWT::decode($jwt, new Key($publicKey, 'RS256')); +echo "Decode:\n" . print_r((array) $decoded, true) . "\n"; +``` + +Example with EdDSA (libsodium and Ed25519 signature) +---------------------------- +```php +use Firebase\JWT\JWT; +use Firebase\JWT\Key; + +// Public and private keys are expected to be Base64 encoded. The last +// non-empty line is used so that keys can be generated with +// sodium_crypto_sign_keypair(). The secret keys generated by other tools may +// need to be adjusted to match the input expected by libsodium. + +$keyPair = sodium_crypto_sign_keypair(); + +$privateKey = base64_encode(sodium_crypto_sign_secretkey($keyPair)); + +$publicKey = base64_encode(sodium_crypto_sign_publickey($keyPair)); + +$payload = array( + "iss" => "example.org", + "aud" => "example.com", + "iat" => 1356999524, + "nbf" => 1357000000 +); + +$jwt = JWT::encode($payload, $privateKey, 'EdDSA'); +echo "Encode:\n" . print_r($jwt, true) . "\n"; + +$decoded = JWT::decode($jwt, new Key($publicKey, 'EdDSA')); +echo "Decode:\n" . print_r((array) $decoded, true) . "\n"; +```` + +Using JWKs +---------- + +```php +use Firebase\JWT\JWK; +use Firebase\JWT\JWT; + +// Set of keys. The "keys" key is required. For example, the JSON response to +// this endpoint: https://www.gstatic.com/iap/verify/public_key-jwk +$jwks = ['keys' => []]; + +// JWK::parseKeySet($jwks) returns an associative array of **kid** to private +// key. Pass this as the second parameter to JWT::decode. +// NOTE: The deprecated $supportedAlgorithm must be supplied when parsing from JWK. +JWT::decode($payload, JWK::parseKeySet($jwks), $supportedAlgorithm); +``` + +Changelog +--------- + +#### 5.0.0 / 2017-06-26 +- Support RS384 and RS512. + See [#117](https://github.com/firebase/php-jwt/pull/117). Thanks [@joostfaassen](https://github.com/joostfaassen)! +- Add an example for RS256 openssl. + See [#125](https://github.com/firebase/php-jwt/pull/125). Thanks [@akeeman](https://github.com/akeeman)! +- Detect invalid Base64 encoding in signature. + See [#162](https://github.com/firebase/php-jwt/pull/162). Thanks [@psignoret](https://github.com/psignoret)! +- Update `JWT::verify` to handle OpenSSL errors. + See [#159](https://github.com/firebase/php-jwt/pull/159). Thanks [@bshaffer](https://github.com/bshaffer)! +- Add `array` type hinting to `decode` method + See [#101](https://github.com/firebase/php-jwt/pull/101). Thanks [@hywak](https://github.com/hywak)! +- Add all JSON error types. + See [#110](https://github.com/firebase/php-jwt/pull/110). Thanks [@gbalduzzi](https://github.com/gbalduzzi)! +- Bugfix 'kid' not in given key list. + See [#129](https://github.com/firebase/php-jwt/pull/129). Thanks [@stampycode](https://github.com/stampycode)! +- Miscellaneous cleanup, documentation and test fixes. + See [#107](https://github.com/firebase/php-jwt/pull/107), [#115](https://github.com/firebase/php-jwt/pull/115), + [#160](https://github.com/firebase/php-jwt/pull/160), [#161](https://github.com/firebase/php-jwt/pull/161), and + [#165](https://github.com/firebase/php-jwt/pull/165). Thanks [@akeeman](https://github.com/akeeman), + [@chinedufn](https://github.com/chinedufn), and [@bshaffer](https://github.com/bshaffer)! + +#### 4.0.0 / 2016-07-17 +- Add support for late static binding. See [#88](https://github.com/firebase/php-jwt/pull/88) for details. Thanks to [@chappy84](https://github.com/chappy84)! +- Use static `$timestamp` instead of `time()` to improve unit testing. See [#93](https://github.com/firebase/php-jwt/pull/93) for details. Thanks to [@josephmcdermott](https://github.com/josephmcdermott)! +- Fixes to exceptions classes. See [#81](https://github.com/firebase/php-jwt/pull/81) for details. Thanks to [@Maks3w](https://github.com/Maks3w)! +- Fixes to PHPDoc. See [#76](https://github.com/firebase/php-jwt/pull/76) for details. Thanks to [@akeeman](https://github.com/akeeman)! + +#### 3.0.0 / 2015-07-22 +- Minimum PHP version updated from `5.2.0` to `5.3.0`. +- Add `\Firebase\JWT` namespace. See +[#59](https://github.com/firebase/php-jwt/pull/59) for details. Thanks to +[@Dashron](https://github.com/Dashron)! +- Require a non-empty key to decode and verify a JWT. See +[#60](https://github.com/firebase/php-jwt/pull/60) for details. Thanks to +[@sjones608](https://github.com/sjones608)! +- Cleaner documentation blocks in the code. See +[#62](https://github.com/firebase/php-jwt/pull/62) for details. Thanks to +[@johanderuijter](https://github.com/johanderuijter)! + +#### 2.2.0 / 2015-06-22 +- Add support for adding custom, optional JWT headers to `JWT::encode()`. See +[#53](https://github.com/firebase/php-jwt/pull/53/files) for details. Thanks to +[@mcocaro](https://github.com/mcocaro)! + +#### 2.1.0 / 2015-05-20 +- Add support for adding a leeway to `JWT:decode()` that accounts for clock skew +between signing and verifying entities. Thanks to [@lcabral](https://github.com/lcabral)! +- Add support for passing an object implementing the `ArrayAccess` interface for +`$keys` argument in `JWT::decode()`. Thanks to [@aztech-dev](https://github.com/aztech-dev)! + +#### 2.0.0 / 2015-04-01 +- **Note**: It is strongly recommended that you update to > v2.0.0 to address + known security vulnerabilities in prior versions when both symmetric and + asymmetric keys are used together. +- Update signature for `JWT::decode(...)` to require an array of supported + algorithms to use when verifying token signatures. + + +Tests +----- +Run the tests using phpunit: + +```bash +$ pear install PHPUnit +$ phpunit --configuration phpunit.xml.dist +PHPUnit 3.7.10 by Sebastian Bergmann. +..... +Time: 0 seconds, Memory: 2.50Mb +OK (5 tests, 5 assertions) +``` + +New Lines in private keys +----- + +If your private key contains `\n` characters, be sure to wrap it in double quotes `""` +and not single quotes `''` in order to properly interpret the escaped characters. + +License +------- +[3-Clause BSD](http://opensource.org/licenses/BSD-3-Clause). diff --git a/vendor/firebase/php-jwt/composer.json b/vendor/firebase/php-jwt/composer.json new file mode 100644 index 00000000..6146e2dc --- /dev/null +++ b/vendor/firebase/php-jwt/composer.json @@ -0,0 +1,36 @@ +{ + "name": "firebase/php-jwt", + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "php", + "jwt" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "license": "BSD-3-Clause", + "require": { + "php": ">=5.3.0" + }, + "suggest": { + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + }, + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "require-dev": { + "phpunit/phpunit": ">=4.8 <=9" + } +} diff --git a/vendor/firebase/php-jwt/src/BeforeValidException.php b/vendor/firebase/php-jwt/src/BeforeValidException.php new file mode 100644 index 00000000..c147852b --- /dev/null +++ b/vendor/firebase/php-jwt/src/BeforeValidException.php @@ -0,0 +1,7 @@ + + * @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD + * @link https://github.com/firebase/php-jwt + */ +class JWK +{ + /** + * Parse a set of JWK keys + * + * @param array $jwks The JSON Web Key Set as an associative array + * + * @return array An associative array that represents the set of keys + * + * @throws InvalidArgumentException Provided JWK Set is empty + * @throws UnexpectedValueException Provided JWK Set was invalid + * @throws DomainException OpenSSL failure + * + * @uses parseKey + */ + public static function parseKeySet(array $jwks) + { + $keys = array(); + + if (!isset($jwks['keys'])) { + throw new UnexpectedValueException('"keys" member must exist in the JWK Set'); + } + if (empty($jwks['keys'])) { + throw new InvalidArgumentException('JWK Set did not contain any keys'); + } + + foreach ($jwks['keys'] as $k => $v) { + $kid = isset($v['kid']) ? $v['kid'] : $k; + if ($key = self::parseKey($v)) { + $keys[$kid] = $key; + } + } + + if (0 === \count($keys)) { + throw new UnexpectedValueException('No supported algorithms found in JWK Set'); + } + + return $keys; + } + + /** + * Parse a JWK key + * + * @param array $jwk An individual JWK + * + * @return resource|array An associative array that represents the key + * + * @throws InvalidArgumentException Provided JWK is empty + * @throws UnexpectedValueException Provided JWK was invalid + * @throws DomainException OpenSSL failure + * + * @uses createPemFromModulusAndExponent + */ + public static function parseKey(array $jwk) + { + if (empty($jwk)) { + throw new InvalidArgumentException('JWK must not be empty'); + } + if (!isset($jwk['kty'])) { + throw new UnexpectedValueException('JWK must contain a "kty" parameter'); + } + + switch ($jwk['kty']) { + case 'RSA': + if (!empty($jwk['d'])) { + throw new UnexpectedValueException('RSA private keys are not supported'); + } + if (!isset($jwk['n']) || !isset($jwk['e'])) { + throw new UnexpectedValueException('RSA keys must contain values for both "n" and "e"'); + } + + $pem = self::createPemFromModulusAndExponent($jwk['n'], $jwk['e']); + $publicKey = \openssl_pkey_get_public($pem); + if (false === $publicKey) { + throw new DomainException( + 'OpenSSL error: ' . \openssl_error_string() + ); + } + return $publicKey; + default: + // Currently only RSA is supported + break; + } + } + + /** + * Create a public key represented in PEM format from RSA modulus and exponent information + * + * @param string $n The RSA modulus encoded in Base64 + * @param string $e The RSA exponent encoded in Base64 + * + * @return string The RSA public key represented in PEM format + * + * @uses encodeLength + */ + private static function createPemFromModulusAndExponent($n, $e) + { + $modulus = JWT::urlsafeB64Decode($n); + $publicExponent = JWT::urlsafeB64Decode($e); + + $components = array( + 'modulus' => \pack('Ca*a*', 2, self::encodeLength(\strlen($modulus)), $modulus), + 'publicExponent' => \pack('Ca*a*', 2, self::encodeLength(\strlen($publicExponent)), $publicExponent) + ); + + $rsaPublicKey = \pack( + 'Ca*a*a*', + 48, + self::encodeLength(\strlen($components['modulus']) + \strlen($components['publicExponent'])), + $components['modulus'], + $components['publicExponent'] + ); + + // sequence(oid(1.2.840.113549.1.1.1), null)) = rsaEncryption. + $rsaOID = \pack('H*', '300d06092a864886f70d0101010500'); // hex version of MA0GCSqGSIb3DQEBAQUA + $rsaPublicKey = \chr(0) . $rsaPublicKey; + $rsaPublicKey = \chr(3) . self::encodeLength(\strlen($rsaPublicKey)) . $rsaPublicKey; + + $rsaPublicKey = \pack( + 'Ca*a*', + 48, + self::encodeLength(\strlen($rsaOID . $rsaPublicKey)), + $rsaOID . $rsaPublicKey + ); + + $rsaPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" . + \chunk_split(\base64_encode($rsaPublicKey), 64) . + '-----END PUBLIC KEY-----'; + + return $rsaPublicKey; + } + + /** + * DER-encode the length + * + * DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4. See + * {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 paragraph 8.1.3} for more information. + * + * @param int $length + * @return string + */ + private static function encodeLength($length) + { + if ($length <= 0x7F) { + return \chr($length); + } + + $temp = \ltrim(\pack('N', $length), \chr(0)); + + return \pack('Ca*', 0x80 | \strlen($temp), $temp); + } +} diff --git a/vendor/firebase/php-jwt/src/JWT.php b/vendor/firebase/php-jwt/src/JWT.php new file mode 100644 index 00000000..ec1641bc --- /dev/null +++ b/vendor/firebase/php-jwt/src/JWT.php @@ -0,0 +1,611 @@ + + * @author Anant Narayanan + * @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD + * @link https://github.com/firebase/php-jwt + */ +class JWT +{ + const ASN1_INTEGER = 0x02; + const ASN1_SEQUENCE = 0x10; + const ASN1_BIT_STRING = 0x03; + + /** + * When checking nbf, iat or expiration times, + * we want to provide some extra leeway time to + * account for clock skew. + */ + public static $leeway = 0; + + /** + * Allow the current timestamp to be specified. + * Useful for fixing a value within unit testing. + * + * Will default to PHP time() value if null. + */ + public static $timestamp = null; + + public static $supported_algs = array( + 'ES384' => array('openssl', 'SHA384'), + 'ES256' => array('openssl', 'SHA256'), + 'HS256' => array('hash_hmac', 'SHA256'), + 'HS384' => array('hash_hmac', 'SHA384'), + 'HS512' => array('hash_hmac', 'SHA512'), + 'RS256' => array('openssl', 'SHA256'), + 'RS384' => array('openssl', 'SHA384'), + 'RS512' => array('openssl', 'SHA512'), + 'EdDSA' => array('sodium_crypto', 'EdDSA'), + ); + + /** + * Decodes a JWT string into a PHP object. + * + * @param string $jwt The JWT + * @param Key|array|mixed $keyOrKeyArray The Key or array of Key objects. + * If the algorithm used is asymmetric, this is the public key + * Each Key object contains an algorithm and matching key. + * Supported algorithms are 'ES384','ES256', 'HS256', 'HS384', + * 'HS512', 'RS256', 'RS384', and 'RS512' + * @param array $allowed_algs [DEPRECATED] List of supported verification algorithms. Only + * should be used for backwards compatibility. + * + * @return object The JWT's payload as a PHP object + * + * @throws InvalidArgumentException Provided JWT was empty + * @throws UnexpectedValueException Provided JWT was invalid + * @throws SignatureInvalidException Provided JWT was invalid because the signature verification failed + * @throws BeforeValidException Provided JWT is trying to be used before it's eligible as defined by 'nbf' + * @throws BeforeValidException Provided JWT is trying to be used before it's been created as defined by 'iat' + * @throws ExpiredException Provided JWT has since expired, as defined by the 'exp' claim + * + * @uses jsonDecode + * @uses urlsafeB64Decode + */ + public static function decode($jwt, $keyOrKeyArray, array $allowed_algs = array()) + { + $timestamp = \is_null(static::$timestamp) ? \time() : static::$timestamp; + + if (empty($keyOrKeyArray)) { + throw new InvalidArgumentException('Key may not be empty'); + } + $tks = \explode('.', $jwt); + if (\count($tks) != 3) { + throw new UnexpectedValueException('Wrong number of segments'); + } + list($headb64, $bodyb64, $cryptob64) = $tks; + if (null === ($header = static::jsonDecode(static::urlsafeB64Decode($headb64)))) { + throw new UnexpectedValueException('Invalid header encoding'); + } + if (null === $payload = static::jsonDecode(static::urlsafeB64Decode($bodyb64))) { + throw new UnexpectedValueException('Invalid claims encoding'); + } + if (false === ($sig = static::urlsafeB64Decode($cryptob64))) { + throw new UnexpectedValueException('Invalid signature encoding'); + } + if (empty($header->alg)) { + throw new UnexpectedValueException('Empty algorithm'); + } + if (empty(static::$supported_algs[$header->alg])) { + throw new UnexpectedValueException('Algorithm not supported'); + } + + list($keyMaterial, $algorithm) = self::getKeyMaterialAndAlgorithm( + $keyOrKeyArray, + empty($header->kid) ? null : $header->kid + ); + + if (empty($algorithm)) { + // Use deprecated "allowed_algs" to determine if the algorithm is supported. + // This opens up the possibility of an attack in some implementations. + // @see https://github.com/firebase/php-jwt/issues/351 + if (!\in_array($header->alg, $allowed_algs)) { + throw new UnexpectedValueException('Algorithm not allowed'); + } + } else { + // Check the algorithm + if (!self::constantTimeEquals($algorithm, $header->alg)) { + // See issue #351 + throw new UnexpectedValueException('Incorrect key for this algorithm'); + } + } + if ($header->alg === 'ES256' || $header->alg === 'ES384') { + // OpenSSL expects an ASN.1 DER sequence for ES256/ES384 signatures + $sig = self::signatureToDER($sig); + } + + if (!static::verify("$headb64.$bodyb64", $sig, $keyMaterial, $header->alg)) { + throw new SignatureInvalidException('Signature verification failed'); + } + + // Check the nbf if it is defined. This is the time that the + // token can actually be used. If it's not yet that time, abort. + if (isset($payload->nbf) && $payload->nbf > ($timestamp + static::$leeway)) { + throw new BeforeValidException( + 'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->nbf) + ); + } + + // Check that this token has been created before 'now'. This prevents + // using tokens that have been created for later use (and haven't + // correctly used the nbf claim). + if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) { + throw new BeforeValidException( + 'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->iat) + ); + } + + // Check if this token has expired. + if (isset($payload->exp) && ($timestamp - static::$leeway) >= $payload->exp) { + throw new ExpiredException('Expired token'); + } + + return $payload; + } + + /** + * Converts and signs a PHP object or array into a JWT string. + * + * @param object|array $payload PHP object or array + * @param string|resource $key The secret key. + * If the algorithm used is asymmetric, this is the private key + * @param string $alg The signing algorithm. + * Supported algorithms are 'ES384','ES256', 'HS256', 'HS384', + * 'HS512', 'RS256', 'RS384', and 'RS512' + * @param mixed $keyId + * @param array $head An array with header elements to attach + * + * @return string A signed JWT + * + * @uses jsonEncode + * @uses urlsafeB64Encode + */ + public static function encode($payload, $key, $alg = 'HS256', $keyId = null, $head = null) + { + $header = array('typ' => 'JWT', 'alg' => $alg); + if ($keyId !== null) { + $header['kid'] = $keyId; + } + if (isset($head) && \is_array($head)) { + $header = \array_merge($head, $header); + } + $segments = array(); + $segments[] = static::urlsafeB64Encode(static::jsonEncode($header)); + $segments[] = static::urlsafeB64Encode(static::jsonEncode($payload)); + $signing_input = \implode('.', $segments); + + $signature = static::sign($signing_input, $key, $alg); + $segments[] = static::urlsafeB64Encode($signature); + + return \implode('.', $segments); + } + + /** + * Sign a string with a given key and algorithm. + * + * @param string $msg The message to sign + * @param string|resource $key The secret key + * @param string $alg The signing algorithm. + * Supported algorithms are 'ES384','ES256', 'HS256', 'HS384', + * 'HS512', 'RS256', 'RS384', and 'RS512' + * + * @return string An encrypted message + * + * @throws DomainException Unsupported algorithm or bad key was specified + */ + public static function sign($msg, $key, $alg = 'HS256') + { + if (empty(static::$supported_algs[$alg])) { + throw new DomainException('Algorithm not supported'); + } + list($function, $algorithm) = static::$supported_algs[$alg]; + switch ($function) { + case 'hash_hmac': + return \hash_hmac($algorithm, $msg, $key, true); + case 'openssl': + $signature = ''; + $success = \openssl_sign($msg, $signature, $key, $algorithm); + if (!$success) { + throw new DomainException("OpenSSL unable to sign data"); + } + if ($alg === 'ES256') { + $signature = self::signatureFromDER($signature, 256); + } elseif ($alg === 'ES384') { + $signature = self::signatureFromDER($signature, 384); + } + return $signature; + case 'sodium_crypto': + if (!function_exists('sodium_crypto_sign_detached')) { + throw new DomainException('libsodium is not available'); + } + try { + // The last non-empty line is used as the key. + $lines = array_filter(explode("\n", $key)); + $key = base64_decode(end($lines)); + return sodium_crypto_sign_detached($msg, $key); + } catch (Exception $e) { + throw new DomainException($e->getMessage(), 0, $e); + } + } + } + + /** + * Verify a signature with the message, key and method. Not all methods + * are symmetric, so we must have a separate verify and sign method. + * + * @param string $msg The original message (header and body) + * @param string $signature The original signature + * @param string|resource $key For HS*, a string key works. for RS*, must be a resource of an openssl public key + * @param string $alg The algorithm + * + * @return bool + * + * @throws DomainException Invalid Algorithm, bad key, or OpenSSL failure + */ + private static function verify($msg, $signature, $key, $alg) + { + if (empty(static::$supported_algs[$alg])) { + throw new DomainException('Algorithm not supported'); + } + + list($function, $algorithm) = static::$supported_algs[$alg]; + switch ($function) { + case 'openssl': + $success = \openssl_verify($msg, $signature, $key, $algorithm); + if ($success === 1) { + return true; + } elseif ($success === 0) { + return false; + } + // returns 1 on success, 0 on failure, -1 on error. + throw new DomainException( + 'OpenSSL error: ' . \openssl_error_string() + ); + case 'sodium_crypto': + if (!function_exists('sodium_crypto_sign_verify_detached')) { + throw new DomainException('libsodium is not available'); + } + try { + // The last non-empty line is used as the key. + $lines = array_filter(explode("\n", $key)); + $key = base64_decode(end($lines)); + return sodium_crypto_sign_verify_detached($signature, $msg, $key); + } catch (Exception $e) { + throw new DomainException($e->getMessage(), 0, $e); + } + case 'hash_hmac': + default: + $hash = \hash_hmac($algorithm, $msg, $key, true); + return self::constantTimeEquals($signature, $hash); + } + } + + /** + * Decode a JSON string into a PHP object. + * + * @param string $input JSON string + * + * @return object Object representation of JSON string + * + * @throws DomainException Provided string was invalid JSON + */ + public static function jsonDecode($input) + { + if (\version_compare(PHP_VERSION, '5.4.0', '>=') && !(\defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) { + /** In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you + * to specify that large ints (like Steam Transaction IDs) should be treated as + * strings, rather than the PHP default behaviour of converting them to floats. + */ + $obj = \json_decode($input, false, 512, JSON_BIGINT_AS_STRING); + } else { + /** Not all servers will support that, however, so for older versions we must + * manually detect large ints in the JSON string and quote them (thus converting + *them to strings) before decoding, hence the preg_replace() call. + */ + $max_int_length = \strlen((string) PHP_INT_MAX) - 1; + $json_without_bigints = \preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input); + $obj = \json_decode($json_without_bigints); + } + + if ($errno = \json_last_error()) { + static::handleJsonError($errno); + } elseif ($obj === null && $input !== 'null') { + throw new DomainException('Null result with non-null input'); + } + return $obj; + } + + /** + * Encode a PHP object into a JSON string. + * + * @param object|array $input A PHP object or array + * + * @return string JSON representation of the PHP object or array + * + * @throws DomainException Provided object could not be encoded to valid JSON + */ + public static function jsonEncode($input) + { + $json = \json_encode($input); + if ($errno = \json_last_error()) { + static::handleJsonError($errno); + } elseif ($json === 'null' && $input !== null) { + throw new DomainException('Null result with non-null input'); + } + return $json; + } + + /** + * Decode a string with URL-safe Base64. + * + * @param string $input A Base64 encoded string + * + * @return string A decoded string + */ + public static function urlsafeB64Decode($input) + { + $remainder = \strlen($input) % 4; + if ($remainder) { + $padlen = 4 - $remainder; + $input .= \str_repeat('=', $padlen); + } + return \base64_decode(\strtr($input, '-_', '+/')); + } + + /** + * Encode a string with URL-safe Base64. + * + * @param string $input The string you want encoded + * + * @return string The base64 encode of what you passed in + */ + public static function urlsafeB64Encode($input) + { + return \str_replace('=', '', \strtr(\base64_encode($input), '+/', '-_')); + } + + + /** + * Determine if an algorithm has been provided for each Key + * + * @param Key|array|mixed $keyOrKeyArray + * @param string|null $kid + * + * @throws UnexpectedValueException + * + * @return array containing the keyMaterial and algorithm + */ + private static function getKeyMaterialAndAlgorithm($keyOrKeyArray, $kid = null) + { + if ( + is_string($keyOrKeyArray) + || is_resource($keyOrKeyArray) + || $keyOrKeyArray instanceof OpenSSLAsymmetricKey + ) { + return array($keyOrKeyArray, null); + } + + if ($keyOrKeyArray instanceof Key) { + return array($keyOrKeyArray->getKeyMaterial(), $keyOrKeyArray->getAlgorithm()); + } + + if (is_array($keyOrKeyArray) || $keyOrKeyArray instanceof ArrayAccess) { + if (!isset($kid)) { + throw new UnexpectedValueException('"kid" empty, unable to lookup correct key'); + } + if (!isset($keyOrKeyArray[$kid])) { + throw new UnexpectedValueException('"kid" invalid, unable to lookup correct key'); + } + + $key = $keyOrKeyArray[$kid]; + + if ($key instanceof Key) { + return array($key->getKeyMaterial(), $key->getAlgorithm()); + } + + return array($key, null); + } + + throw new UnexpectedValueException( + '$keyOrKeyArray must be a string|resource key, an array of string|resource keys, ' + . 'an instance of Firebase\JWT\Key key or an array of Firebase\JWT\Key keys' + ); + } + + /** + * @param string $left + * @param string $right + * @return bool + */ + public static function constantTimeEquals($left, $right) + { + if (\function_exists('hash_equals')) { + return \hash_equals($left, $right); + } + $len = \min(static::safeStrlen($left), static::safeStrlen($right)); + + $status = 0; + for ($i = 0; $i < $len; $i++) { + $status |= (\ord($left[$i]) ^ \ord($right[$i])); + } + $status |= (static::safeStrlen($left) ^ static::safeStrlen($right)); + + return ($status === 0); + } + + /** + * Helper method to create a JSON error. + * + * @param int $errno An error number from json_last_error() + * + * @return void + */ + private static function handleJsonError($errno) + { + $messages = array( + JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', + JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON', + JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', + JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON', + JSON_ERROR_UTF8 => 'Malformed UTF-8 characters' //PHP >= 5.3.3 + ); + throw new DomainException( + isset($messages[$errno]) + ? $messages[$errno] + : 'Unknown JSON error: ' . $errno + ); + } + + /** + * Get the number of bytes in cryptographic strings. + * + * @param string $str + * + * @return int + */ + private static function safeStrlen($str) + { + if (\function_exists('mb_strlen')) { + return \mb_strlen($str, '8bit'); + } + return \strlen($str); + } + + /** + * Convert an ECDSA signature to an ASN.1 DER sequence + * + * @param string $sig The ECDSA signature to convert + * @return string The encoded DER object + */ + private static function signatureToDER($sig) + { + // Separate the signature into r-value and s-value + list($r, $s) = \str_split($sig, (int) (\strlen($sig) / 2)); + + // Trim leading zeros + $r = \ltrim($r, "\x00"); + $s = \ltrim($s, "\x00"); + + // Convert r-value and s-value from unsigned big-endian integers to + // signed two's complement + if (\ord($r[0]) > 0x7f) { + $r = "\x00" . $r; + } + if (\ord($s[0]) > 0x7f) { + $s = "\x00" . $s; + } + + return self::encodeDER( + self::ASN1_SEQUENCE, + self::encodeDER(self::ASN1_INTEGER, $r) . + self::encodeDER(self::ASN1_INTEGER, $s) + ); + } + + /** + * Encodes a value into a DER object. + * + * @param int $type DER tag + * @param string $value the value to encode + * @return string the encoded object + */ + private static function encodeDER($type, $value) + { + $tag_header = 0; + if ($type === self::ASN1_SEQUENCE) { + $tag_header |= 0x20; + } + + // Type + $der = \chr($tag_header | $type); + + // Length + $der .= \chr(\strlen($value)); + + return $der . $value; + } + + /** + * Encodes signature from a DER object. + * + * @param string $der binary signature in DER format + * @param int $keySize the number of bits in the key + * @return string the signature + */ + private static function signatureFromDER($der, $keySize) + { + // OpenSSL returns the ECDSA signatures as a binary ASN.1 DER SEQUENCE + list($offset, $_) = self::readDER($der); + list($offset, $r) = self::readDER($der, $offset); + list($offset, $s) = self::readDER($der, $offset); + + // Convert r-value and s-value from signed two's compliment to unsigned + // big-endian integers + $r = \ltrim($r, "\x00"); + $s = \ltrim($s, "\x00"); + + // Pad out r and s so that they are $keySize bits long + $r = \str_pad($r, $keySize / 8, "\x00", STR_PAD_LEFT); + $s = \str_pad($s, $keySize / 8, "\x00", STR_PAD_LEFT); + + return $r . $s; + } + + /** + * Reads binary DER-encoded data and decodes into a single object + * + * @param string $der the binary data in DER format + * @param int $offset the offset of the data stream containing the object + * to decode + * @return array [$offset, $data] the new offset and the decoded object + */ + private static function readDER($der, $offset = 0) + { + $pos = $offset; + $size = \strlen($der); + $constructed = (\ord($der[$pos]) >> 5) & 0x01; + $type = \ord($der[$pos++]) & 0x1f; + + // Length + $len = \ord($der[$pos++]); + if ($len & 0x80) { + $n = $len & 0x1f; + $len = 0; + while ($n-- && $pos < $size) { + $len = ($len << 8) | \ord($der[$pos++]); + } + } + + // Value + if ($type == self::ASN1_BIT_STRING) { + $pos++; // Skip the first contents octet (padding indicator) + $data = \substr($der, $pos, $len - 1); + $pos += $len - 1; + } elseif (!$constructed) { + $data = \substr($der, $pos, $len); + $pos += $len; + } else { + $data = null; + } + + return array($pos, $data); + } +} diff --git a/vendor/firebase/php-jwt/src/Key.php b/vendor/firebase/php-jwt/src/Key.php new file mode 100644 index 00000000..f1ede6f2 --- /dev/null +++ b/vendor/firebase/php-jwt/src/Key.php @@ -0,0 +1,59 @@ +keyMaterial = $keyMaterial; + $this->algorithm = $algorithm; + } + + /** + * Return the algorithm valid for this key + * + * @return string + */ + public function getAlgorithm() + { + return $this->algorithm; + } + + /** + * @return string|resource|OpenSSLAsymmetricKey + */ + public function getKeyMaterial() + { + return $this->keyMaterial; + } +} diff --git a/vendor/firebase/php-jwt/src/SignatureInvalidException.php b/vendor/firebase/php-jwt/src/SignatureInvalidException.php new file mode 100644 index 00000000..d35dee9f --- /dev/null +++ b/vendor/firebase/php-jwt/src/SignatureInvalidException.php @@ -0,0 +1,7 @@ +setRules([ + '@PSR2' => true, + 'concat_space' => ['spacing' => 'one'], + 'no_unused_imports' => true, + 'ordered_imports' => true, + 'new_with_braces' => true, + 'method_argument_space' => false, + 'whitespace_after_comma_in_array' => true, + 'method_argument_space' => [ + 'keep_multiple_spaces_after_comma' => true, // for wordpress constants + 'on_multiline' => 'ignore', // consider removing this someday + ], + 'return_type_declaration' => [ + 'space_before' => 'none' + ], + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->in(__DIR__) + ) +; diff --git a/vendor/google/auth/CHANGELOG.md b/vendor/google/auth/CHANGELOG.md new file mode 100644 index 00000000..556b1870 --- /dev/null +++ b/vendor/google/auth/CHANGELOG.md @@ -0,0 +1,211 @@ +## 1.18.0 (08/24/2021) + + * [feat]: Add support for guzzlehttp/psr7 v2 (#357) + +## 1.17.0 (08/17/2021) + + * [fix]: consistently use useSelfSignedJwt method in ServiceAccountJwtAccessCredentials (#351) + * [feat]: add loading and executing of default client cert source (#353) + * [feat]: add support for proxy-authorization header (#347) + +## 1.16.0 (06/22/2021) + + * [feat]: allow ServiceAccountJwtAccessCredentials to sign scopes (#341) + * [feat]: allow psr/cache:2.0 (#344) + +## 1.15.2 (06/21/2021) + + * [fix]: ensure cached tokens are used for GCECredentials::signBlob (#340) + * [fix]: adds check for getClientName (#336) + +## 1.15.1 (04/21/2021) + + * [fix]: update minimum phpseclib for vulnerability fix (#331) + +## 1.15.0 (02/05/2021) + + * [feat]: support for PHP 8.0: updated dependencies and tests (#318, #319) + +## 1.14.3 (10/16/2020) + + * [fix]: add expires_at to GCECredentials (#314) + +## 1.14.2 (10/14/2020) + +* [fix]: Better FetchAuthTokenCache and getLastReceivedToken (#311) + +## 1.14.1 (10/05/2020) + +* [fix]: variable typo (#310) + +## 1.14.0 (10/02/2020) + +* [feat]: Add support for default scopes (#306) + +## 1.13.0 (9/18/2020) + +* [feat]: Add service account identity support to GCECredentials (#304) + +## 1.12.0 (8/31/2020) + +* [feat]: Add QuotaProject option to getMiddleware (#296) +* [feat]: Add caching for calls to GCECredentials::onGce (#301) +* [feat]: Add updateMetadata function to token cache (#298) +* [fix]: Use quota_project_id instead of quota_project (#299) + +## 1.11.1 (7/27/2020) + +* [fix]: catch ConnectException in GCE check (#294) +* [docs]: Adds [reference docs](https://googleapis.github.io/google-auth-library-php/master) + +## 1.11.0 (7/22/2020) + +* [feat]: Check cache expiration (#291) +* [fix]: OAuth2 cache key when audience is set (#291) + +## 1.10.0 (7/8/2020) + +* [feat]: Add support for Guzzle 7 (#256) +* [fix]: Remove SDK warning (#283) +* [chore]: Switch to github pages deploy action (#284) + +## 1.9.0 (5/14/2020) + +* [feat] Add quotaProject param for extensible client options support (#277) +* [feat] Add signingKeyId param for jwt signing (#270) +* [docs] Misc documentation improvements (#268, #278, #273) +* [chore] Switch from Travis to Github Actions (#273) + +## 1.8.0 (3/26/2020) + +* [feat] Add option to throw exception in AccessToken::verify(). (#265) +* [feat] Add support for x-goog-user-project. (#254) +* [feat] Add option to specify issuer in AccessToken::verify(). (#267) +* [feat] Add getProjectId to credentials types where project IDs can be determined. (#230) + +## 1.7.1 (02/12/2020) + +* [fix] Invalid character in iap cert cache key (#263) +* [fix] Typo in exception for package name (#262) + +## 1.7.0 (02/11/2020) + +* [feat] Add ID token to auth token methods. (#248) +* [feat] Add support for ES256 in `AccessToken::verify`. (#255) +* [fix] Let namespace match the file structure. (#258) +* [fix] Construct RuntimeException. (#257) +* [tests] Update tests for PHP 7.4 compatibility. (#253) +* [chore] Add a couple more things to `.gitattributes`. (#252) + +## 1.6.1 (10/29/2019) + +* [fix] Handle DST correctly for cache item expirations. (#246) + +## 1.6.0 (10/01/2019) + +* [feat] Add utility for verifying and revoking access tokens. (#243) +* [docs] Fix README console terminology. (#242) +* [feat] Support custom scopes with GCECredentials. (#239) +* [fix] Fix phpseclib existence check. (#237) + +## 1.5.2 (07/22/2019) + +* [fix] Move loadItems call out of `SysVCacheItemPool` constructor. (#229) +* [fix] Add `Metadata-Flavor` header to initial GCE metadata call. (#232) + +## 1.5.1 (04/16/2019) + +* [fix] Moved `getClientName()` from `Google\Auth\FetchAuthTokenInterface` + to `Google\Auth\SignBlobInterface`, and removed `getClientName()` from + `InsecureCredentials` and `UserRefreshCredentials`. (#223) + +## 1.5.0 (04/15/2019) + +### Changes + + * Add support for signing strings with a Credentials instance. (#221) + * [Docs] Describe the arrays returned by fetchAuthToken. (#216) + * [Testing] Fix failing tests (#217) + * Update GitHub issue templates (#214, #213) + +## 1.4.0 (09/17/2018) + +### Changes + + * Add support for insecure credentials (#208) + +## 1.3.3 (08/27/2018) + +### Changes + + * Add retry and increase timeout for GCE credentials (#195) + * [Docs] Fix spelling (#204) + * Update token url (#206) + +## 1.3.2 (07/23/2018) + +### Changes + + * Only emits a warning for gcloud credentials (#202) + +## 1.3.1 (07/19/2018) + +### Changes + + * Added a warning for 3 legged OAuth credentials (#199) + * [Code cleanup] Removed useless else after return (#193) + +## 1.3.0 (06/04/2018) + +### Changes + + * Fixes usage of deprecated env var for GAE Flex (#189) + * fix - guzzlehttp/psr7 dependency version definition (#190) + * Added SystemV shared memory based CacheItemPool (#191) + +## 1.2.1 (24/01/2018) + +### Changes + + * Fixes array merging bug in Guzzle5HttpHandler (#186) + * Fixes constructor argument bug in Subscriber & Middleware (#184) + +## 1.2.0 (6/12/2017) + +### Changes + + * Adds async method to HTTP handlers (#176) + * Misc bug fixes and improvements (#177, #175, #178) + +## 1.1.0 (10/10/2017) + +### Changes + + * Supports additional claims in JWT tokens (#171) + * Adds makeHttpClient for creating authorized Guzzle clients (#162) + * Misc bug fixes/improvements (#168, #161, #167, #170, #143) + +## 1.0.1 (31/07/2017) + +### Changes + +* Adds support for Firebase 5.0 (#159) + +## 1.0.0 (12/06/2017) + +### Changes + +* Adds hashing and shortening to enforce max key length ([@bshaffer]) +* Fix for better PSR-6 compliance - verifies a hit before getting the cache item ([@bshaffer]) +* README fixes ([@bshaffer]) +* Change authorization header key to lowercase ([@stanley-cheung]) + +## 0.4.0 (23/04/2015) + +### Changes + +* Export callback function to update auth metadata ([@stanley-cheung][]) +* Adds an implementation of User Refresh Token auth ([@stanley-cheung][]) + +[@bshaffer]: https://github.com/bshaffer +[@stanley-cheung]: https://github.com/stanley-cheung diff --git a/vendor/google/auth/CODE_OF_CONDUCT.md b/vendor/google/auth/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..46b2a08e --- /dev/null +++ b/vendor/google/auth/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/vendor/google/auth/COPYING b/vendor/google/auth/COPYING new file mode 100644 index 00000000..b5d5055a --- /dev/null +++ b/vendor/google/auth/COPYING @@ -0,0 +1,202 @@ + + 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 2015 Google Inc. + + 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/google/auth/LICENSE b/vendor/google/auth/LICENSE new file mode 100644 index 00000000..a148ba56 --- /dev/null +++ b/vendor/google/auth/LICENSE @@ -0,0 +1,203 @@ +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/google/auth/README.md b/vendor/google/auth/README.md new file mode 100644 index 00000000..3b1dc21e --- /dev/null +++ b/vendor/google/auth/README.md @@ -0,0 +1,312 @@ +# Google Auth Library for PHP + +
+
Homepage
http://www.github.com/google/google-auth-library-php
+
Reference Docs
https://googleapis.github.io/google-auth-library-php/master/
+
Authors
+
Tim Emiola
+
Stanley Cheung
+
Brent Shaffer
+
Copyright
Copyright © 2015 Google, Inc.
+
License
Apache 2.0
+
+ +## Description + +This is Google's officially supported PHP client library for using OAuth 2.0 +authorization and authentication with Google APIs. + +### Installing via Composer + +The recommended way to install the google auth library 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: + +```bash +composer.phar require google/auth +``` + +## Application Default Credentials + +This library provides an implementation of +[application default credentials][application default credentials] for PHP. + +The Application Default Credentials provide a simple way to get authorization +credentials for use in calling Google APIs. + +They are best suited for cases when the call needs to have the same identity +and authorization level for the application independent of the user. This is +the recommended approach to authorize calls to Cloud APIs, particularly when +you're building an application that uses Google Compute Engine. + +#### Download your Service Account Credentials JSON file + +To use `Application Default Credentials`, You first need to download a set of +JSON credentials for your project. Go to **APIs & Services** > **Credentials** in +the [Google Developers Console][developer console] and select +**Service account** from the **Add credentials** dropdown. + +> This file is your *only copy* of these credentials. It should never be +> committed with your source code, and should be stored securely. + +Once downloaded, store the path to this file in the +`GOOGLE_APPLICATION_CREDENTIALS` environment variable. + +```php +putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/credentials.json'); +``` + +> PHP's `putenv` function is just one way to set an environment variable. +> Consider using `.htaccess` or apache configuration files as well. + +#### Enable the API you want to use + +Before making your API call, you must be sure the API you're calling has been +enabled. Go to **APIs & Auth** > **APIs** in the +[Google Developers Console][developer console] and enable the APIs you'd like to +call. For the example below, you must enable the `Drive API`. + +#### Call the APIs + +As long as you update the environment variable below to point to *your* JSON +credentials file, the following code should output a list of your Drive files. + +```php +use Google\Auth\ApplicationDefaultCredentials; +use GuzzleHttp\Client; +use GuzzleHttp\HandlerStack; + +// specify the path to your application credentials +putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/credentials.json'); + +// define the scopes for your API call +$scopes = ['https://www.googleapis.com/auth/drive.readonly']; + +// create middleware +$middleware = ApplicationDefaultCredentials::getMiddleware($scopes); +$stack = HandlerStack::create(); +$stack->push($middleware); + +// create the HTTP client +$client = new Client([ + 'handler' => $stack, + 'base_uri' => 'https://www.googleapis.com', + 'auth' => 'google_auth' // authorize all requests +]); + +// make the request +$response = $client->get('drive/v2/files'); + +// show the result! +print_r((string) $response->getBody()); +``` + +##### Guzzle 5 Compatibility + +If you are using [Guzzle 5][Guzzle 5], replace the `create middleware` and +`create the HTTP Client` steps with the following: + +```php +// create the HTTP client +$client = new Client([ + 'base_url' => 'https://www.googleapis.com', + 'auth' => 'google_auth' // authorize all requests +]); + +// create subscriber +$subscriber = ApplicationDefaultCredentials::getSubscriber($scopes); +$client->getEmitter()->attach($subscriber); +``` + +#### Call using an ID Token +If your application is running behind Cloud Run, or using Cloud Identity-Aware +Proxy (IAP), you will need to fetch an ID token to access your application. For +this, use the static method `getIdTokenMiddleware` on +`ApplicationDefaultCredentials`. + +```php +use Google\Auth\ApplicationDefaultCredentials; +use GuzzleHttp\Client; +use GuzzleHttp\HandlerStack; + +// specify the path to your application credentials +putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/credentials.json'); + +// Provide the ID token audience. This can be a Client ID associated with an IAP application, +// Or the URL associated with a CloudRun App +// $targetAudience = 'IAP_CLIENT_ID.apps.googleusercontent.com'; +// $targetAudience = 'https://service-1234-uc.a.run.app'; +$targetAudience = 'YOUR_ID_TOKEN_AUDIENCE'; + +// create middleware +$middleware = ApplicationDefaultCredentials::getIdTokenMiddleware($targetAudience); +$stack = HandlerStack::create(); +$stack->push($middleware); + +// create the HTTP client +$client = new Client([ + 'handler' => $stack, + 'auth' => 'google_auth', + // Cloud Run, IAP, or custom resource URL + 'base_uri' => 'https://YOUR_PROTECTED_RESOURCE', +]); + +// make the request +$response = $client->get('/'); + +// show the result! +print_r((string) $response->getBody()); +``` + +For invoking Cloud Run services, your service account will need the +[`Cloud Run Invoker`](https://cloud.google.com/run/docs/authenticating/service-to-service) +IAM permission. + +For invoking Cloud Identity-Aware Proxy, you will need to pass the Client ID +used when you set up your protected resource as the target audience. See how to +[secure your IAP app with signed headers](https://cloud.google.com/iap/docs/signed-headers-howto). + +#### Call using a specific JSON key +If you want to use a specific JSON key instead of using `GOOGLE_APPLICATION_CREDENTIALS` environment variable, you can + do this: + +```php +use Google\Auth\CredentialsLoader; +use Google\Auth\Middleware\AuthTokenMiddleware; +use GuzzleHttp\Client; +use GuzzleHttp\HandlerStack; + +// Define the Google Application Credentials array +$jsonKey = ['key' => 'value']; + +// define the scopes for your API call +$scopes = ['https://www.googleapis.com/auth/drive.readonly']; + +// Load credentials +$creds = CredentialsLoader::makeCredentials($scopes, $jsonKey); + +// optional caching +// $creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache); + +// create middleware +$middleware = new AuthTokenMiddleware($creds); +$stack = HandlerStack::create(); +$stack->push($middleware); + +// create the HTTP client +$client = new Client([ + 'handler' => $stack, + 'base_uri' => 'https://www.googleapis.com', + 'auth' => 'google_auth' // authorize all requests +]); + +// make the request +$response = $client->get('drive/v2/files'); + +// show the result! +print_r((string) $response->getBody()); + +``` + +#### Call using Proxy-Authorization Header +If your application is behind a proxy such as [Google Cloud IAP][iap-proxy-header], +and your application occupies the `Authorization` request header, +you can include the ID token in a `Proxy-Authorization: Bearer` +header instead. If a valid ID token is found in a `Proxy-Authorization` header, +IAP authorizes the request with it. After authorizing the request, IAP passes +the Authorization header to your application without processing the content. +For this, use the static method `getProxyIdTokenMiddleware` on +`ApplicationDefaultCredentials`. + +```php +use Google\Auth\ApplicationDefaultCredentials; +use GuzzleHttp\Client; +use GuzzleHttp\HandlerStack; + +// specify the path to your application credentials +putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/credentials.json'); + +// Provide the ID token audience. This can be a Client ID associated with an IAP application +// $targetAudience = 'IAP_CLIENT_ID.apps.googleusercontent.com'; +$targetAudience = 'YOUR_ID_TOKEN_AUDIENCE'; + +// create middleware +$middleware = ApplicationDefaultCredentials::getProxyIdTokenMiddleware($targetAudience); +$stack = HandlerStack::create(); +$stack->push($middleware); + +// create the HTTP client +$client = new Client([ + 'handler' => $stack, + 'auth' => ['username', 'pass'], // auth option handled by your application + 'proxy_auth' => 'google_auth', +]); + +// make the request +$response = $client->get('/'); + +// show the result! +print_r((string) $response->getBody()); +``` + +[iap-proxy-header]: https://cloud.google.com/iap/docs/authentication-howto#authenticating_from_proxy-authorization_header + +#### Verifying JWTs + +If you are [using Google ID tokens to authenticate users][google-id-tokens], use +the `Google\Auth\AccessToken` class to verify the ID token: + +```php +use Google\Auth\AccessToken; + +$auth = new AccessToken(); +$auth->verify($idToken); +``` + +If your app is running behind [Google Identity-Aware Proxy][iap-id-tokens] +(IAP), you can verify the ID token coming from the IAP server by pointing to the +appropriate certificate URL for IAP. This is because IAP signs the ID +tokens with a different key than the Google Identity service: + +```php +use Google\Auth\AccessToken; + +$auth = new AccessToken(); +$auth->verify($idToken, [ + 'certsLocation' => AccessToken::IAP_CERT_URL +]); +``` + +[google-id-tokens]: https://developers.google.com/identity/sign-in/web/backend-auth +[iap-id-tokens]: https://cloud.google.com/iap/docs/signed-headers-howto + +## License + +This library is licensed under Apache 2.0. Full license text is +available in [COPYING][copying]. + +## Contributing + +See [CONTRIBUTING][contributing]. + +## Support + +Please +[report bugs at the project on Github](https://github.com/google/google-auth-library-php/issues). Don't +hesitate to +[ask questions](http://stackoverflow.com/questions/tagged/google-auth-library-php) +about the client or APIs on [StackOverflow](http://stackoverflow.com). + +[google-apis-php-client]: https://github.com/google/google-api-php-client +[application default credentials]: https://developers.google.com/accounts/docs/application-default-credentials +[contributing]: https://github.com/google/google-auth-library-php/tree/master/.github/CONTRIBUTING.md +[copying]: https://github.com/google/google-auth-library-php/tree/master/COPYING +[Guzzle]: https://github.com/guzzle/guzzle +[Guzzle 5]: http://docs.guzzlephp.org/en/5.3 +[developer console]: https://console.developers.google.com diff --git a/vendor/google/auth/SECURITY.md b/vendor/google/auth/SECURITY.md new file mode 100644 index 00000000..8b58ae9c --- /dev/null +++ b/vendor/google/auth/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/vendor/google/auth/autoload.php b/vendor/google/auth/autoload.php new file mode 100644 index 00000000..1e13827f --- /dev/null +++ b/vendor/google/auth/autoload.php @@ -0,0 +1,34 @@ + 3) { + // Maximum class file path depth in this project is 3. + $classPath = array_slice($classPath, 0, 3); + } + $filePath = dirname(__FILE__) . '/src/' . implode('/', $classPath) . '.php'; + if (file_exists($filePath)) { + require_once $filePath; + } +} + +spl_autoload_register('oauth2client_php_autoload'); diff --git a/vendor/google/auth/composer.json b/vendor/google/auth/composer.json new file mode 100644 index 00000000..28b36a47 --- /dev/null +++ b/vendor/google/auth/composer.json @@ -0,0 +1,39 @@ +{ + "name": "google/auth", + "type": "library", + "description": "Google Auth Library for PHP", + "keywords": ["google", "oauth2", "authentication"], + "homepage": "http://github.com/google/google-auth-library-php", + "license": "Apache-2.0", + "support": { + "docs": "https://googleapis.github.io/google-auth-library-php/master/" + }, + "require": { + "php": ">=5.4", + "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0", + "guzzlehttp/guzzle": "^5.3.1|^6.2.1|^7.0", + "guzzlehttp/psr7": "^1.7|^2.0", + "psr/http-message": "^1.0", + "psr/cache": "^1.0|^2.0" + }, + "require-dev": { + "guzzlehttp/promises": "0.1.1|^1.3", + "phpunit/phpunit": "^4.8.36|^5.7", + "sebastian/comparator": ">=1.2.3", + "phpseclib/phpseclib": "^2.0.31", + "kelvinmo/simplejwt": "^0.2.5|^0.5.1" + }, + "suggest": { + "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." + }, + "autoload": { + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Google\\Auth\\Tests\\": "tests" + } + } +} diff --git a/vendor/google/auth/renovate.json b/vendor/google/auth/renovate.json new file mode 100644 index 00000000..5fcce112 --- /dev/null +++ b/vendor/google/auth/renovate.json @@ -0,0 +1,6 @@ +{ + "extends": [ + "config:base", + ":preserveSemverRanges" + ] +} diff --git a/vendor/google/auth/src/AccessToken.php b/vendor/google/auth/src/AccessToken.php new file mode 100644 index 00000000..1ab9b151 --- /dev/null +++ b/vendor/google/auth/src/AccessToken.php @@ -0,0 +1,479 @@ +httpHandler = $httpHandler + ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + $this->cache = $cache ?: new MemoryCacheItemPool(); + } + + /** + * Verifies an id token and returns the authenticated apiLoginTicket. + * Throws an exception if the id token is not valid. + * The audience parameter can be used to control which id tokens are + * accepted. By default, the id token must have been issued to this OAuth2 client. + * + * @param string $token The JSON Web Token to be verified. + * @param array $options [optional] Configuration options. + * @param string $options.audience The indended recipient of the token. + * @param string $options.issuer The intended issuer of the token. + * @param string $options.cacheKey The cache key of the cached certs. Defaults to + * the sha1 of $certsLocation if provided, otherwise is set to + * "federated_signon_certs_v3". + * @param string $options.certsLocation The location (remote or local) from which + * to retrieve certificates, if not cached. This value should only be + * provided in limited circumstances in which you are sure of the + * behavior. + * @param bool $options.throwException Whether the function should throw an + * exception if the verification fails. This is useful for + * determining the reason verification failed. + * @return array|bool the token payload, if successful, or false if not. + * @throws InvalidArgumentException If certs could not be retrieved from a local file. + * @throws InvalidArgumentException If received certs are in an invalid format. + * @throws InvalidArgumentException If the cert alg is not supported. + * @throws RuntimeException If certs could not be retrieved from a remote location. + * @throws UnexpectedValueException If the token issuer does not match. + * @throws UnexpectedValueException If the token audience does not match. + */ + public function verify($token, array $options = []) + { + $audience = isset($options['audience']) + ? $options['audience'] + : null; + $issuer = isset($options['issuer']) + ? $options['issuer'] + : null; + $certsLocation = isset($options['certsLocation']) + ? $options['certsLocation'] + : self::FEDERATED_SIGNON_CERT_URL; + $cacheKey = isset($options['cacheKey']) + ? $options['cacheKey'] + : $this->getCacheKeyFromCertLocation($certsLocation); + $throwException = isset($options['throwException']) + ? $options['throwException'] + : false; // for backwards compatibility + + // Check signature against each available cert. + $certs = $this->getCerts($certsLocation, $cacheKey, $options); + $alg = $this->determineAlg($certs); + if (!in_array($alg, ['RS256', 'ES256'])) { + throw new InvalidArgumentException( + 'unrecognized "alg" in certs, expected ES256 or RS256' + ); + } + try { + if ($alg == 'RS256') { + return $this->verifyRs256($token, $certs, $audience, $issuer); + } + return $this->verifyEs256($token, $certs, $audience, $issuer); + } catch (ExpiredException $e) { // firebase/php-jwt 3+ + } catch (\ExpiredException $e) { // firebase/php-jwt 2 + } catch (SignatureInvalidException $e) { // firebase/php-jwt 3+ + } catch (\SignatureInvalidException $e) { // firebase/php-jwt 2 + } catch (InvalidTokenException $e) { // simplejwt + } catch (DomainException $e) { + } catch (InvalidArgumentException $e) { + } catch (UnexpectedValueException $e) { + } + + if ($throwException) { + throw $e; + } + + return false; + } + + /** + * Identifies the expected algorithm to verify by looking at the "alg" key + * of the provided certs. + * + * @param array $certs Certificate array according to the JWK spec (see + * https://tools.ietf.org/html/rfc7517). + * @return string The expected algorithm, such as "ES256" or "RS256". + */ + private function determineAlg(array $certs) + { + $alg = null; + foreach ($certs as $cert) { + if (empty($cert['alg'])) { + throw new InvalidArgumentException( + 'certs expects "alg" to be set' + ); + } + $alg = $alg ?: $cert['alg']; + + if ($alg != $cert['alg']) { + throw new InvalidArgumentException( + 'More than one alg detected in certs' + ); + } + } + return $alg; + } + + /** + * Verifies an ES256-signed JWT. + * + * @param string $token The JSON Web Token to be verified. + * @param array $certs Certificate array according to the JWK spec (see + * https://tools.ietf.org/html/rfc7517). + * @param string|null $audience If set, returns false if the provided + * audience does not match the "aud" claim on the JWT. + * @param string|null $issuer If set, returns false if the provided + * issuer does not match the "iss" claim on the JWT. + * @return array|bool the token payload, if successful, or false if not. + */ + private function verifyEs256($token, array $certs, $audience = null, $issuer = null) + { + $this->checkSimpleJwt(); + + $jwkset = new KeySet(); + foreach ($certs as $cert) { + $jwkset->add(KeyFactory::create($cert, 'php')); + } + + // Validate the signature using the key set and ES256 algorithm. + $jwt = $this->callSimpleJwtDecode([$token, $jwkset, 'ES256']); + $payload = $jwt->getClaims(); + + if (isset($payload['aud'])) { + if ($audience && $payload['aud'] != $audience) { + throw new UnexpectedValueException('Audience does not match'); + } + } + + // @see https://cloud.google.com/iap/docs/signed-headers-howto#verifying_the_jwt_payload + $issuer = $issuer ?: self::IAP_ISSUER; + if (!isset($payload['iss']) || $payload['iss'] !== $issuer) { + throw new UnexpectedValueException('Issuer does not match'); + } + + return $payload; + } + + /** + * Verifies an RS256-signed JWT. + * + * @param string $token The JSON Web Token to be verified. + * @param array $certs Certificate array according to the JWK spec (see + * https://tools.ietf.org/html/rfc7517). + * @param string|null $audience If set, returns false if the provided + * audience does not match the "aud" claim on the JWT. + * @param string|null $issuer If set, returns false if the provided + * issuer does not match the "iss" claim on the JWT. + * @return array|bool the token payload, if successful, or false if not. + */ + private function verifyRs256($token, array $certs, $audience = null, $issuer = null) + { + $this->checkAndInitializePhpsec(); + $keys = []; + foreach ($certs as $cert) { + if (empty($cert['kid'])) { + throw new InvalidArgumentException( + 'certs expects "kid" to be set' + ); + } + if (empty($cert['n']) || empty($cert['e'])) { + throw new InvalidArgumentException( + 'RSA certs expects "n" and "e" to be set' + ); + } + $rsa = new RSA(); + $rsa->loadKey([ + 'n' => new BigInteger($this->callJwtStatic('urlsafeB64Decode', [ + $cert['n'], + ]), 256), + 'e' => new BigInteger($this->callJwtStatic('urlsafeB64Decode', [ + $cert['e'] + ]), 256), + ]); + + // create an array of key IDs to certs for the JWT library + $keys[$cert['kid']] = $rsa->getPublicKey(); + } + + $payload = $this->callJwtStatic('decode', [ + $token, + $keys, + ['RS256'] + ]); + + if (property_exists($payload, 'aud')) { + if ($audience && $payload->aud != $audience) { + throw new UnexpectedValueException('Audience does not match'); + } + } + + // support HTTP and HTTPS issuers + // @see https://developers.google.com/identity/sign-in/web/backend-auth + $issuers = $issuer ? [$issuer] : [self::OAUTH2_ISSUER, self::OAUTH2_ISSUER_HTTPS]; + if (!isset($payload->iss) || !in_array($payload->iss, $issuers)) { + throw new UnexpectedValueException('Issuer does not match'); + } + + return (array) $payload; + } + + /** + * Revoke an OAuth2 access token or refresh token. This method will revoke the current access + * token, if a token isn't provided. + * + * @param string|array $token The token (access token or a refresh token) that should be revoked. + * @param array $options [optional] Configuration options. + * @return bool Returns True if the revocation was successful, otherwise False. + */ + public function revoke($token, array $options = []) + { + if (is_array($token)) { + if (isset($token['refresh_token'])) { + $token = $token['refresh_token']; + } else { + $token = $token['access_token']; + } + } + + $body = Utils::streamFor(http_build_query(['token' => $token])); + $request = new Request('POST', self::OAUTH2_REVOKE_URI, [ + 'Cache-Control' => 'no-store', + 'Content-Type' => 'application/x-www-form-urlencoded', + ], $body); + + $httpHandler = $this->httpHandler; + + $response = $httpHandler($request, $options); + + return $response->getStatusCode() == 200; + } + + /** + * Gets federated sign-on certificates to use for verifying identity tokens. + * Returns certs as array structure, where keys are key ids, and values + * are PEM encoded certificates. + * + * @param string $location The location from which to retrieve certs. + * @param string $cacheKey The key under which to cache the retrieved certs. + * @param array $options [optional] Configuration options. + * @return array + * @throws InvalidArgumentException If received certs are in an invalid format. + */ + private function getCerts($location, $cacheKey, array $options = []) + { + $cacheItem = $this->cache->getItem($cacheKey); + $certs = $cacheItem ? $cacheItem->get() : null; + + $gotNewCerts = false; + if (!$certs) { + $certs = $this->retrieveCertsFromLocation($location, $options); + + $gotNewCerts = true; + } + + if (!isset($certs['keys'])) { + if ($location !== self::IAP_CERT_URL) { + throw new InvalidArgumentException( + 'federated sign-on certs expects "keys" to be set' + ); + } + throw new InvalidArgumentException( + 'certs expects "keys" to be set' + ); + } + + // Push caching off until after verifying certs are in a valid format. + // Don't want to cache bad data. + if ($gotNewCerts) { + $cacheItem->expiresAt(new DateTime('+1 hour')); + $cacheItem->set($certs); + $this->cache->save($cacheItem); + } + + return $certs['keys']; + } + + /** + * Retrieve and cache a certificates file. + * + * @param $url string location + * @param array $options [optional] Configuration options. + * @return array certificates + * @throws InvalidArgumentException If certs could not be retrieved from a local file. + * @throws RuntimeException If certs could not be retrieved from a remote location. + */ + private function retrieveCertsFromLocation($url, array $options = []) + { + // If we're retrieving a local file, just grab it. + if (strpos($url, 'http') !== 0) { + if (!file_exists($url)) { + throw new InvalidArgumentException(sprintf( + 'Failed to retrieve verification certificates from path: %s.', + $url + )); + } + + return json_decode(file_get_contents($url), true); + } + + $httpHandler = $this->httpHandler; + $response = $httpHandler(new Request('GET', $url), $options); + + if ($response->getStatusCode() == 200) { + return json_decode((string) $response->getBody(), true); + } + + throw new RuntimeException(sprintf( + 'Failed to retrieve verification certificates: "%s".', + $response->getBody()->getContents() + ), $response->getStatusCode()); + } + + private function checkAndInitializePhpsec() + { + // @codeCoverageIgnoreStart + if (!class_exists('phpseclib\Crypt\RSA')) { + throw new RuntimeException('Please require phpseclib/phpseclib v2 to use this utility.'); + } + // @codeCoverageIgnoreEnd + + $this->setPhpsecConstants(); + } + + private function checkSimpleJwt() + { + // @codeCoverageIgnoreStart + if (!class_exists('SimpleJWT\JWT')) { + throw new RuntimeException('Please require kelvinmo/simplejwt ^0.2 to use this utility.'); + } + // @codeCoverageIgnoreEnd + } + + /** + * phpseclib calls "phpinfo" by default, which requires special + * whitelisting in the AppEngine VM environment. This function + * sets constants to bypass the need for phpseclib to check phpinfo + * + * @see phpseclib/Math/BigInteger + * @see https://github.com/GoogleCloudPlatform/getting-started-php/issues/85 + * @codeCoverageIgnore + */ + private function setPhpsecConstants() + { + if (filter_var(getenv('GAE_VM'), FILTER_VALIDATE_BOOLEAN)) { + if (!defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) { + define('MATH_BIGINTEGER_OPENSSL_ENABLED', true); + } + if (!defined('CRYPT_RSA_MODE')) { + define('CRYPT_RSA_MODE', RSA::MODE_OPENSSL); + } + } + } + + /** + * Provide a hook to mock calls to the JWT static methods. + * + * @param string $method + * @param array $args + * @return mixed + */ + protected function callJwtStatic($method, array $args = []) + { + $class = class_exists('Firebase\JWT\JWT') + ? 'Firebase\JWT\JWT' + : 'JWT'; + return call_user_func_array([$class, $method], $args); + } + + /** + * Provide a hook to mock calls to the JWT static methods. + * + * @param array $args + * @return mixed + */ + protected function callSimpleJwtDecode(array $args = []) + { + return call_user_func_array(['SimpleJWT\JWT', 'decode'], $args); + } + + /** + * Generate a cache key based on the cert location using sha1 with the + * exception of using "federated_signon_certs_v3" to preserve BC. + * + * @param string $certsLocation + * @return string + */ + private function getCacheKeyFromCertLocation($certsLocation) + { + $key = $certsLocation === self::FEDERATED_SIGNON_CERT_URL + ? 'federated_signon_certs_v3' + : sha1($certsLocation); + + return 'google_auth_certs_cache|' . $key; + } +} diff --git a/vendor/google/auth/src/ApplicationDefaultCredentials.php b/vendor/google/auth/src/ApplicationDefaultCredentials.php new file mode 100644 index 00000000..af67f182 --- /dev/null +++ b/vendor/google/auth/src/ApplicationDefaultCredentials.php @@ -0,0 +1,332 @@ +push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'auth' => 'google_auth' // authorize all requests + * ]); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + * ``` + */ +class ApplicationDefaultCredentials +{ + /** + * Obtains an AuthTokenSubscriber that uses the default FetchAuthTokenInterface + * implementation to use in this environment. + * + * If supplied, $scope is used to in creating the credentials instance if + * this does not fallback to the compute engine defaults. + * + * @param string|array scope the scope of the access request, expressed + * either as an Array or as a space-delimited String. + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be + * provided if you have one already available for use. + * @return AuthTokenSubscriber + * @throws DomainException if no implementation can be obtained. + */ + public static function getSubscriber( + $scope = null, + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null + ) { + $creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache); + + return new AuthTokenSubscriber($creds, $httpHandler); + } + + /** + * Obtains an AuthTokenMiddleware that uses the default FetchAuthTokenInterface + * implementation to use in this environment. + * + * If supplied, $scope is used to in creating the credentials instance if + * this does not fallback to the compute engine defaults. + * + * @param string|array scope the scope of the access request, expressed + * either as an Array or as a space-delimited String. + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be + * provided if you have one already available for use. + * @param string $quotaProject specifies a project to bill for access + * charges associated with the request. + * @return AuthTokenMiddleware + * @throws DomainException if no implementation can be obtained. + */ + public static function getMiddleware( + $scope = null, + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null, + $quotaProject = null + ) { + $creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache, $quotaProject); + + return new AuthTokenMiddleware($creds, $httpHandler); + } + + /** + * Obtains the default FetchAuthTokenInterface implementation to use + * in this environment. + * + * @param string|array $scope the scope of the access request, expressed + * either as an Array or as a space-delimited String. + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be + * provided if you have one already available for use. + * @param string $quotaProject specifies a project to bill for access + * charges associated with the request. + * @param string|array $defaultScope The default scope to use if no + * user-defined scopes exist, expressed either as an Array or as a + * space-delimited string. + * + * @return CredentialsLoader + * @throws DomainException if no implementation can be obtained. + */ + public static function getCredentials( + $scope = null, + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null, + $quotaProject = null, + $defaultScope = null + ) { + $creds = null; + $jsonKey = CredentialsLoader::fromEnv() + ?: CredentialsLoader::fromWellKnownFile(); + $anyScope = $scope ?: $defaultScope; + + if (!$httpHandler) { + if (!($client = HttpClientCache::getHttpClient())) { + $client = new Client(); + HttpClientCache::setHttpClient($client); + } + + $httpHandler = HttpHandlerFactory::build($client); + } + + if (!is_null($jsonKey)) { + if ($quotaProject) { + $jsonKey['quota_project_id'] = $quotaProject; + } + $creds = CredentialsLoader::makeCredentials( + $scope, + $jsonKey, + $defaultScope + ); + } elseif (AppIdentityCredentials::onAppEngine() && !GCECredentials::onAppEngineFlexible()) { + $creds = new AppIdentityCredentials($anyScope); + } elseif (self::onGce($httpHandler, $cacheConfig, $cache)) { + $creds = new GCECredentials(null, $anyScope, null, $quotaProject); + } + + if (is_null($creds)) { + throw new DomainException(self::notFound()); + } + if (!is_null($cache)) { + $creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache); + } + return $creds; + } + + /** + * Obtains an AuthTokenMiddleware which will fetch an ID token to use in the + * Authorization header. The middleware is configured with the default + * FetchAuthTokenInterface implementation to use in this environment. + * + * If supplied, $targetAudience is used to set the "aud" on the resulting + * ID token. + * + * @param string $targetAudience The audience for the ID token. + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be + * provided if you have one already available for use. + * @return AuthTokenMiddleware + * @throws DomainException if no implementation can be obtained. + */ + public static function getIdTokenMiddleware( + $targetAudience, + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null + ) { + $creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache); + + return new AuthTokenMiddleware($creds, $httpHandler); + } + + /** + * Obtains an ProxyAuthTokenMiddleware which will fetch an ID token to use in the + * Authorization header. The middleware is configured with the default + * FetchAuthTokenInterface implementation to use in this environment. + * + * If supplied, $targetAudience is used to set the "aud" on the resulting + * ID token. + * + * @param string $targetAudience The audience for the ID token. + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be + * provided if you have one already available for use. + * @return ProxyAuthTokenMiddleware + * @throws DomainException if no implementation can be obtained. + */ + public static function getProxyIdTokenMiddleware( + $targetAudience, + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null + ) { + $creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache); + + return new ProxyAuthTokenMiddleware($creds, $httpHandler); + } + + /** + * Obtains the default FetchAuthTokenInterface implementation to use + * in this environment, configured with a $targetAudience for fetching an ID + * token. + * + * @param string $targetAudience The audience for the ID token. + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be + * provided if you have one already available for use. + * @return CredentialsLoader + * @throws DomainException if no implementation can be obtained. + * @throws InvalidArgumentException if JSON "type" key is invalid + */ + public static function getIdTokenCredentials( + $targetAudience, + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null + ) { + $creds = null; + $jsonKey = CredentialsLoader::fromEnv() + ?: CredentialsLoader::fromWellKnownFile(); + + if (!$httpHandler) { + if (!($client = HttpClientCache::getHttpClient())) { + $client = new Client(); + HttpClientCache::setHttpClient($client); + } + + $httpHandler = HttpHandlerFactory::build($client); + } + + if (!is_null($jsonKey)) { + if (!array_key_exists('type', $jsonKey)) { + throw new \InvalidArgumentException('json key is missing the type field'); + } + + if ($jsonKey['type'] == 'authorized_user') { + throw new InvalidArgumentException('ID tokens are not supported for end user credentials'); + } + + if ($jsonKey['type'] != 'service_account') { + throw new InvalidArgumentException('invalid value in the type field'); + } + + $creds = new ServiceAccountCredentials(null, $jsonKey, null, $targetAudience); + } elseif (self::onGce($httpHandler, $cacheConfig, $cache)) { + $creds = new GCECredentials(null, null, $targetAudience); + } + + if (is_null($creds)) { + throw new DomainException(self::notFound()); + } + if (!is_null($cache)) { + $creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache); + } + return $creds; + } + + private static function notFound() + { + $msg = 'Could not load the default credentials. Browse to '; + $msg .= 'https://developers.google.com'; + $msg .= '/accounts/docs/application-default-credentials'; + $msg .= ' for more information'; + + return $msg; + } + + private static function onGce( + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null + ) { + $gceCacheConfig = []; + foreach (['lifetime', 'prefix'] as $key) { + if (isset($cacheConfig['gce_' . $key])) { + $gceCacheConfig[$key] = $cacheConfig['gce_' . $key]; + } + } + + return (new GCECache($gceCacheConfig, $cache))->onGce($httpHandler); + } +} diff --git a/vendor/google/auth/src/Cache/InvalidArgumentException.php b/vendor/google/auth/src/Cache/InvalidArgumentException.php new file mode 100644 index 00000000..331e5611 --- /dev/null +++ b/vendor/google/auth/src/Cache/InvalidArgumentException.php @@ -0,0 +1,24 @@ +key = $key; + } + + /** + * {@inheritdoc} + */ + public function getKey() + { + return $this->key; + } + + /** + * {@inheritdoc} + */ + public function get() + { + return $this->isHit() ? $this->value : null; + } + + /** + * {@inheritdoc} + */ + public function isHit() + { + if (!$this->isHit) { + return false; + } + + if ($this->expiration === null) { + return true; + } + + return $this->currentTime()->getTimestamp() < $this->expiration->getTimestamp(); + } + + /** + * {@inheritdoc} + */ + public function set($value) + { + $this->isHit = true; + $this->value = $value; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function expiresAt($expiration) + { + if ($this->isValidExpiration($expiration)) { + $this->expiration = $expiration; + + return $this; + } + + $implementationMessage = interface_exists('DateTimeInterface') + ? 'implement interface DateTimeInterface' + : 'be an instance of DateTime'; + + $error = sprintf( + 'Argument 1 passed to %s::expiresAt() must %s, %s given', + get_class($this), + $implementationMessage, + gettype($expiration) + ); + + $this->handleError($error); + } + + /** + * {@inheritdoc} + */ + public function expiresAfter($time) + { + if (is_int($time)) { + $this->expiration = $this->currentTime()->add(new \DateInterval("PT{$time}S")); + } elseif ($time instanceof \DateInterval) { + $this->expiration = $this->currentTime()->add($time); + } elseif ($time === null) { + $this->expiration = $time; + } else { + $message = 'Argument 1 passed to %s::expiresAfter() must be an ' . + 'instance of DateInterval or of the type integer, %s given'; + $error = sprintf($message, get_class($this), gettype($time)); + + $this->handleError($error); + } + + return $this; + } + + /** + * Handles an error. + * + * @param string $error + * @throws \TypeError + */ + private function handleError($error) + { + if (class_exists('TypeError')) { + throw new \TypeError($error); + } + + trigger_error($error, E_USER_ERROR); + } + + /** + * Determines if an expiration is valid based on the rules defined by PSR6. + * + * @param mixed $expiration + * @return bool + */ + private function isValidExpiration($expiration) + { + if ($expiration === null) { + return true; + } + + // We test for two types here due to the fact the DateTimeInterface + // was not introduced until PHP 5.5. Checking for the DateTime type as + // well allows us to support 5.4. + if ($expiration instanceof \DateTimeInterface) { + return true; + } + + if ($expiration instanceof \DateTime) { + return true; + } + + return false; + } + + protected function currentTime() + { + return new \DateTime('now', new \DateTimeZone('UTC')); + } +} diff --git a/vendor/google/auth/src/Cache/MemoryCacheItemPool.php b/vendor/google/auth/src/Cache/MemoryCacheItemPool.php new file mode 100644 index 00000000..0af29304 --- /dev/null +++ b/vendor/google/auth/src/Cache/MemoryCacheItemPool.php @@ -0,0 +1,154 @@ +getItems([$key])); + } + + /** + * {@inheritdoc} + */ + public function getItems(array $keys = []) + { + $items = []; + + foreach ($keys as $key) { + $items[$key] = $this->hasItem($key) ? clone $this->items[$key] : new Item($key); + } + + return $items; + } + + /** + * {@inheritdoc} + */ + public function hasItem($key) + { + $this->isValidKey($key); + + return isset($this->items[$key]) && $this->items[$key]->isHit(); + } + + /** + * {@inheritdoc} + */ + public function clear() + { + $this->items = []; + $this->deferredItems = []; + + return true; + } + + /** + * {@inheritdoc} + */ + public function deleteItem($key) + { + return $this->deleteItems([$key]); + } + + /** + * {@inheritdoc} + */ + public function deleteItems(array $keys) + { + array_walk($keys, [$this, 'isValidKey']); + + foreach ($keys as $key) { + unset($this->items[$key]); + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function save(CacheItemInterface $item) + { + $this->items[$item->getKey()] = $item; + + return true; + } + + /** + * {@inheritdoc} + */ + public function saveDeferred(CacheItemInterface $item) + { + $this->deferredItems[$item->getKey()] = $item; + + return true; + } + + /** + * {@inheritdoc} + */ + public function commit() + { + foreach ($this->deferredItems as $item) { + $this->save($item); + } + + $this->deferredItems = []; + + return true; + } + + /** + * Determines if the provided key is valid. + * + * @param string $key + * @return bool + * @throws InvalidArgumentException + */ + private function isValidKey($key) + { + $invalidCharacters = '{}()/\\\\@:'; + + if (!is_string($key) || preg_match("#[$invalidCharacters]#", $key)) { + throw new InvalidArgumentException('The provided key is not valid: ' . var_export($key, true)); + } + + return true; + } +} diff --git a/vendor/google/auth/src/Cache/SysVCacheItemPool.php b/vendor/google/auth/src/Cache/SysVCacheItemPool.php new file mode 100644 index 00000000..1834cf1b --- /dev/null +++ b/vendor/google/auth/src/Cache/SysVCacheItemPool.php @@ -0,0 +1,241 @@ +options = $options + [ + 'variableKey' => self::VAR_KEY, + 'proj' => self::DEFAULT_PROJ, + 'memsize' => self::DEFAULT_MEMSIZE, + 'perm' => self::DEFAULT_PERM + ]; + $this->items = []; + $this->deferredItems = []; + $this->sysvKey = ftok(__FILE__, $this->options['proj']); + } + + public function getItem($key) + { + $this->loadItems(); + return current($this->getItems([$key])); + } + + /** + * {@inheritdoc} + */ + public function getItems(array $keys = []) + { + $this->loadItems(); + $items = []; + foreach ($keys as $key) { + $items[$key] = $this->hasItem($key) ? + clone $this->items[$key] : + new Item($key); + } + return $items; + } + + /** + * {@inheritdoc} + */ + public function hasItem($key) + { + $this->loadItems(); + return isset($this->items[$key]) && $this->items[$key]->isHit(); + } + + /** + * {@inheritdoc} + */ + public function clear() + { + $this->items = []; + $this->deferredItems = []; + return $this->saveCurrentItems(); + } + + /** + * {@inheritdoc} + */ + public function deleteItem($key) + { + return $this->deleteItems([$key]); + } + + /** + * {@inheritdoc} + */ + public function deleteItems(array $keys) + { + if (!$this->hasLoadedItems) { + $this->loadItems(); + } + + foreach ($keys as $key) { + unset($this->items[$key]); + } + return $this->saveCurrentItems(); + } + + /** + * {@inheritdoc} + */ + public function save(CacheItemInterface $item) + { + if (!$this->hasLoadedItems) { + $this->loadItems(); + } + + $this->items[$item->getKey()] = $item; + return $this->saveCurrentItems(); + } + + /** + * {@inheritdoc} + */ + public function saveDeferred(CacheItemInterface $item) + { + $this->deferredItems[$item->getKey()] = $item; + return true; + } + + /** + * {@inheritdoc} + */ + public function commit() + { + foreach ($this->deferredItems as $item) { + if ($this->save($item) === false) { + return false; + } + } + $this->deferredItems = []; + return true; + } + + /** + * Save the current items. + * + * @return bool true when success, false upon failure + */ + private function saveCurrentItems() + { + $shmid = shm_attach( + $this->sysvKey, + $this->options['memsize'], + $this->options['perm'] + ); + if ($shmid !== false) { + $ret = shm_put_var( + $shmid, + $this->options['variableKey'], + $this->items + ); + shm_detach($shmid); + return $ret; + } + return false; + } + + /** + * Load the items from the shared memory. + * + * @return bool true when success, false upon failure + */ + private function loadItems() + { + $shmid = shm_attach( + $this->sysvKey, + $this->options['memsize'], + $this->options['perm'] + ); + if ($shmid !== false) { + $data = @shm_get_var($shmid, $this->options['variableKey']); + if (!empty($data)) { + $this->items = $data; + } else { + $this->items = []; + } + shm_detach($shmid); + $this->hasLoadedItems = true; + return true; + } + return false; + } +} diff --git a/vendor/google/auth/src/CacheTrait.php b/vendor/google/auth/src/CacheTrait.php new file mode 100644 index 00000000..217ce8e2 --- /dev/null +++ b/vendor/google/auth/src/CacheTrait.php @@ -0,0 +1,83 @@ +cache)) { + return; + } + + $key = $this->getFullCacheKey($k); + if (is_null($key)) { + return; + } + + $cacheItem = $this->cache->getItem($key); + if ($cacheItem->isHit()) { + return $cacheItem->get(); + } + } + + /** + * Saves the value in the cache when that is available. + */ + private function setCachedValue($k, $v) + { + if (is_null($this->cache)) { + return; + } + + $key = $this->getFullCacheKey($k); + if (is_null($key)) { + return; + } + + $cacheItem = $this->cache->getItem($key); + $cacheItem->set($v); + $cacheItem->expiresAfter($this->cacheConfig['lifetime']); + return $this->cache->save($cacheItem); + } + + private function getFullCacheKey($key) + { + if (is_null($key)) { + return; + } + + $key = $this->cacheConfig['prefix'] . $key; + + // ensure we do not have illegal characters + $key = preg_replace('|[^a-zA-Z0-9_\.!]|', '', $key); + + // Hash keys if they exceed $maxKeyLength (defaults to 64) + if ($this->maxKeyLength && strlen($key) > $this->maxKeyLength) { + $key = substr(hash('sha256', $key), 0, $this->maxKeyLength); + } + + return $key; + } +} diff --git a/vendor/google/auth/src/Credentials/AppIdentityCredentials.php b/vendor/google/auth/src/Credentials/AppIdentityCredentials.php new file mode 100644 index 00000000..829344d0 --- /dev/null +++ b/vendor/google/auth/src/Credentials/AppIdentityCredentials.php @@ -0,0 +1,230 @@ +push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/books/v1', + * 'auth' => 'google_auth' + * ]); + * + * $res = $client->get('volumes?q=Henry+David+Thoreau&country=US'); + * ``` + */ +class AppIdentityCredentials extends CredentialsLoader implements + SignBlobInterface, + ProjectIdProviderInterface +{ + /** + * Result of fetchAuthToken. + * + * @var array + */ + protected $lastReceivedToken; + + /** + * Array of OAuth2 scopes to be requested. + * + * @var array + */ + private $scope; + + /** + * @var string + */ + private $clientName; + + /** + * @param array $scope One or more scopes. + */ + public function __construct($scope = array()) + { + $this->scope = $scope; + } + + /** + * Determines if this an App Engine instance, by accessing the + * SERVER_SOFTWARE environment variable (prod) or the APPENGINE_RUNTIME + * environment variable (dev). + * + * @return bool true if this an App Engine Instance, false otherwise + */ + public static function onAppEngine() + { + $appEngineProduction = isset($_SERVER['SERVER_SOFTWARE']) && + 0 === strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine'); + if ($appEngineProduction) { + return true; + } + $appEngineDevAppServer = isset($_SERVER['APPENGINE_RUNTIME']) && + $_SERVER['APPENGINE_RUNTIME'] == 'php'; + if ($appEngineDevAppServer) { + return true; + } + return false; + } + + /** + * Implements FetchAuthTokenInterface#fetchAuthToken. + * + * Fetches the auth tokens using the AppIdentityService if available. + * As the AppIdentityService uses protobufs to fetch the access token, + * the GuzzleHttp\ClientInterface instance passed in will not be used. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return array A set of auth related metadata, containing the following + * keys: + * - access_token (string) + * - expiration_time (string) + */ + public function fetchAuthToken(callable $httpHandler = null) + { + try { + $this->checkAppEngineContext(); + } catch (\Exception $e) { + return []; + } + + // AppIdentityService expects an array when multiple scopes are supplied + $scope = is_array($this->scope) ? $this->scope : explode(' ', $this->scope); + + $token = AppIdentityService::getAccessToken($scope); + $this->lastReceivedToken = $token; + + return $token; + } + + /** + * Sign a string using AppIdentityService. + * + * @param string $stringToSign The string to sign. + * @param bool $forceOpenSsl [optional] Does not apply to this credentials + * type. + * @return string The signature, base64-encoded. + * @throws \Exception If AppEngine SDK or mock is not available. + */ + public function signBlob($stringToSign, $forceOpenSsl = false) + { + $this->checkAppEngineContext(); + + return base64_encode(AppIdentityService::signForApp($stringToSign)['signature']); + } + + /** + * Get the project ID from AppIdentityService. + * + * Returns null if AppIdentityService is unavailable. + * + * @param callable $httpHandler Not used by this type. + * @return string|null + */ + public function getProjectId(callable $httpHander = null) + { + try { + $this->checkAppEngineContext(); + } catch (\Exception $e) { + return null; + } + + return AppIdentityService::getApplicationId(); + } + + /** + * Get the client name from AppIdentityService. + * + * Subsequent calls to this method will return a cached value. + * + * @param callable $httpHandler Not used in this implementation. + * @return string + * @throws \Exception If AppEngine SDK or mock is not available. + */ + public function getClientName(callable $httpHandler = null) + { + $this->checkAppEngineContext(); + + if (!$this->clientName) { + $this->clientName = AppIdentityService::getServiceAccountName(); + } + + return $this->clientName; + } + + /** + * @return array|null + */ + public function getLastReceivedToken() + { + if ($this->lastReceivedToken) { + return [ + 'access_token' => $this->lastReceivedToken['access_token'], + 'expires_at' => $this->lastReceivedToken['expiration_time'], + ]; + } + + return null; + } + + /** + * Caching is handled by the underlying AppIdentityService, return empty string + * to prevent caching. + * + * @return string + */ + public function getCacheKey() + { + return ''; + } + + private function checkAppEngineContext() + { + if (!self::onAppEngine() || !class_exists('google\appengine\api\app_identity\AppIdentityService')) { + throw new \Exception( + 'This class must be run in App Engine, or you must include the AppIdentityService ' + . 'mock class defined in tests/mocks/AppIdentityService.php' + ); + } + } +} diff --git a/vendor/google/auth/src/Credentials/GCECredentials.php b/vendor/google/auth/src/Credentials/GCECredentials.php new file mode 100644 index 00000000..c97e5d80 --- /dev/null +++ b/vendor/google/auth/src/Credentials/GCECredentials.php @@ -0,0 +1,547 @@ +push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'auth' => 'google_auth' + * ]); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + */ +class GCECredentials extends CredentialsLoader implements + SignBlobInterface, + ProjectIdProviderInterface, + GetQuotaProjectInterface +{ + // phpcs:disable + const cacheKey = 'GOOGLE_AUTH_PHP_GCE'; + // phpcs:enable + + /** + * The metadata IP address on appengine instances. + * + * The IP is used instead of the domain 'metadata' to avoid slow responses + * when not on Compute Engine. + */ + const METADATA_IP = '169.254.169.254'; + + /** + * The metadata path of the default token. + */ + const TOKEN_URI_PATH = 'v1/instance/service-accounts/default/token'; + + /** + * The metadata path of the default id token. + */ + const ID_TOKEN_URI_PATH = 'v1/instance/service-accounts/default/identity'; + + /** + * The metadata path of the client ID. + */ + const CLIENT_ID_URI_PATH = 'v1/instance/service-accounts/default/email'; + + /** + * The metadata path of the project ID. + */ + const PROJECT_ID_URI_PATH = 'v1/project/project-id'; + + /** + * The header whose presence indicates GCE presence. + */ + const FLAVOR_HEADER = 'Metadata-Flavor'; + + /** + * Note: the explicit `timeout` and `tries` below is a workaround. The underlying + * issue is that resolving an unknown host on some networks will take + * 20-30 seconds; making this timeout short fixes the issue, but + * could lead to false negatives in the event that we are on GCE, but + * the metadata resolution was particularly slow. The latter case is + * "unlikely" since the expected 4-nines time is about 0.5 seconds. + * This allows us to limit the total ping maximum timeout to 1.5 seconds + * for developer desktop scenarios. + */ + const MAX_COMPUTE_PING_TRIES = 3; + const COMPUTE_PING_CONNECTION_TIMEOUT_S = 0.5; + + /** + * Flag used to ensure that the onGCE test is only done once;. + * + * @var bool + */ + private $hasCheckedOnGce = false; + + /** + * Flag that stores the value of the onGCE check. + * + * @var bool + */ + private $isOnGce = false; + + /** + * Result of fetchAuthToken. + */ + protected $lastReceivedToken; + + /** + * @var string|null + */ + private $clientName; + + /** + * @var string|null + */ + private $projectId; + + /** + * @var Iam|null + */ + private $iam; + + /** + * @var string + */ + private $tokenUri; + + /** + * @var string + */ + private $targetAudience; + + /** + * @var string|null + */ + private $quotaProject; + + /** + * @var string|null + */ + private $serviceAccountIdentity; + + /** + * @param Iam $iam [optional] An IAM instance. + * @param string|array $scope [optional] the scope of the access request, + * expressed either as an array or as a space-delimited string. + * @param string $targetAudience [optional] The audience for the ID token. + * @param string $quotaProject [optional] Specifies a project to bill for access + * charges associated with the request. + * @param string $serviceAccountIdentity [optional] Specify a service + * account identity name to use instead of "default". + */ + public function __construct( + Iam $iam = null, + $scope = null, + $targetAudience = null, + $quotaProject = null, + $serviceAccountIdentity = null + ) { + $this->iam = $iam; + + if ($scope && $targetAudience) { + throw new InvalidArgumentException( + 'Scope and targetAudience cannot both be supplied' + ); + } + + $tokenUri = self::getTokenUri($serviceAccountIdentity); + if ($scope) { + if (is_string($scope)) { + $scope = explode(' ', $scope); + } + + $scope = implode(',', $scope); + + $tokenUri = $tokenUri . '?scopes=' . $scope; + } elseif ($targetAudience) { + $tokenUri = self::getIdTokenUri($serviceAccountIdentity); + $tokenUri = $tokenUri . '?audience=' . $targetAudience; + $this->targetAudience = $targetAudience; + } + + $this->tokenUri = $tokenUri; + $this->quotaProject = $quotaProject; + $this->serviceAccountIdentity = $serviceAccountIdentity; + } + + /** + * The full uri for accessing the default token. + * + * @param string $serviceAccountIdentity [optional] Specify a service + * account identity name to use instead of "default". + * @return string + */ + public static function getTokenUri($serviceAccountIdentity = null) + { + $base = 'http://' . self::METADATA_IP . '/computeMetadata/'; + $base .= self::TOKEN_URI_PATH; + + if ($serviceAccountIdentity) { + return str_replace( + '/default/', + '/' . $serviceAccountIdentity . '/', + $base + ); + } + return $base; + } + + /** + * The full uri for accessing the default service account. + * + * @param string $serviceAccountIdentity [optional] Specify a service + * account identity name to use instead of "default". + * @return string + */ + public static function getClientNameUri($serviceAccountIdentity = null) + { + $base = 'http://' . self::METADATA_IP . '/computeMetadata/'; + $base .= self::CLIENT_ID_URI_PATH; + + if ($serviceAccountIdentity) { + return str_replace( + '/default/', + '/' . $serviceAccountIdentity . '/', + $base + ); + } + + return $base; + } + + /** + * The full uri for accesesing the default identity token. + * + * @param string $serviceAccountIdentity [optional] Specify a service + * account identity name to use instead of "default". + * @return string + */ + private static function getIdTokenUri($serviceAccountIdentity = null) + { + $base = 'http://' . self::METADATA_IP . '/computeMetadata/'; + $base .= self::ID_TOKEN_URI_PATH; + + if ($serviceAccountIdentity) { + return str_replace( + '/default/', + '/' . $serviceAccountIdentity . '/', + $base + ); + } + + return $base; + } + + /** + * The full uri for accessing the default project ID. + * + * @return string + */ + private static function getProjectIdUri() + { + $base = 'http://' . self::METADATA_IP . '/computeMetadata/'; + + return $base . self::PROJECT_ID_URI_PATH; + } + + /** + * Determines if this an App Engine Flexible instance, by accessing the + * GAE_INSTANCE environment variable. + * + * @return bool true if this an App Engine Flexible Instance, false otherwise + */ + public static function onAppEngineFlexible() + { + return substr(getenv('GAE_INSTANCE'), 0, 4) === 'aef-'; + } + + /** + * Determines if this a GCE instance, by accessing the expected metadata + * host. + * If $httpHandler is not specified a the default HttpHandler is used. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return bool True if this a GCEInstance, false otherwise + */ + public static function onGce(callable $httpHandler = null) + { + $httpHandler = $httpHandler + ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + + $checkUri = 'http://' . self::METADATA_IP; + for ($i = 1; $i <= self::MAX_COMPUTE_PING_TRIES; $i++) { + try { + // Comment from: oauth2client/client.py + // + // Note: the explicit `timeout` below is a workaround. The underlying + // issue is that resolving an unknown host on some networks will take + // 20-30 seconds; making this timeout short fixes the issue, but + // could lead to false negatives in the event that we are on GCE, but + // the metadata resolution was particularly slow. The latter case is + // "unlikely". + $resp = $httpHandler( + new Request( + 'GET', + $checkUri, + [self::FLAVOR_HEADER => 'Google'] + ), + ['timeout' => self::COMPUTE_PING_CONNECTION_TIMEOUT_S] + ); + + return $resp->getHeaderLine(self::FLAVOR_HEADER) == 'Google'; + } catch (ClientException $e) { + } catch (ServerException $e) { + } catch (RequestException $e) { + } catch (ConnectException $e) { + } + } + return false; + } + + /** + * Implements FetchAuthTokenInterface#fetchAuthToken. + * + * Fetches the auth tokens from the GCE metadata host if it is available. + * If $httpHandler is not specified a the default HttpHandler is used. + * + * @param callable $httpHandler callback which delivers psr7 request + * + * @return array A set of auth related metadata, based on the token type. + * + * Access tokens have the following keys: + * - access_token (string) + * - expires_in (int) + * - token_type (string) + * ID tokens have the following keys: + * - id_token (string) + * + * @throws \Exception + */ + public function fetchAuthToken(callable $httpHandler = null) + { + $httpHandler = $httpHandler + ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + + if (!$this->hasCheckedOnGce) { + $this->isOnGce = self::onGce($httpHandler); + $this->hasCheckedOnGce = true; + } + if (!$this->isOnGce) { + return array(); // return an empty array with no access token + } + + $response = $this->getFromMetadata($httpHandler, $this->tokenUri); + + if ($this->targetAudience) { + return ['id_token' => $response]; + } + + if (null === $json = json_decode($response, true)) { + throw new \Exception('Invalid JSON response'); + } + + $json['expires_at'] = time() + $json['expires_in']; + + // store this so we can retrieve it later + $this->lastReceivedToken = $json; + + return $json; + } + + /** + * @return string + */ + public function getCacheKey() + { + return self::cacheKey; + } + + /** + * @return array|null + */ + public function getLastReceivedToken() + { + if ($this->lastReceivedToken) { + return [ + 'access_token' => $this->lastReceivedToken['access_token'], + 'expires_at' => $this->lastReceivedToken['expires_at'], + ]; + } + + return null; + } + + /** + * Get the client name from GCE metadata. + * + * Subsequent calls will return a cached value. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return string + */ + public function getClientName(callable $httpHandler = null) + { + if ($this->clientName) { + return $this->clientName; + } + + $httpHandler = $httpHandler + ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + + if (!$this->hasCheckedOnGce) { + $this->isOnGce = self::onGce($httpHandler); + $this->hasCheckedOnGce = true; + } + + if (!$this->isOnGce) { + return ''; + } + + $this->clientName = $this->getFromMetadata( + $httpHandler, + self::getClientNameUri($this->serviceAccountIdentity) + ); + + return $this->clientName; + } + + /** + * Sign a string using the default service account private key. + * + * This implementation uses IAM's signBlob API. + * + * @see https://cloud.google.com/iam/credentials/reference/rest/v1/projects.serviceAccounts/signBlob SignBlob + * + * @param string $stringToSign The string to sign. + * @param bool $forceOpenSsl [optional] Does not apply to this credentials + * type. + * @param string $accessToken The access token to use to sign the blob. If + * provided, saves a call to the metadata server for a new access + * token. **Defaults to** `null`. + * @return string + */ + public function signBlob($stringToSign, $forceOpenSsl = false, $accessToken = null) + { + $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + + // Providing a signer is useful for testing, but it's undocumented + // because it's not something a user would generally need to do. + $signer = $this->iam ?: new Iam($httpHandler); + + $email = $this->getClientName($httpHandler); + + if (is_null($accessToken)) { + $previousToken = $this->getLastReceivedToken(); + $accessToken = $previousToken + ? $previousToken['access_token'] + : $this->fetchAuthToken($httpHandler)['access_token']; + } + + return $signer->signBlob($email, $accessToken, $stringToSign); + } + + /** + * Fetch the default Project ID from compute engine. + * + * Returns null if called outside GCE. + * + * @param callable $httpHandler Callback which delivers psr7 request + * @return string|null + */ + public function getProjectId(callable $httpHandler = null) + { + if ($this->projectId) { + return $this->projectId; + } + + $httpHandler = $httpHandler + ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + + if (!$this->hasCheckedOnGce) { + $this->isOnGce = self::onGce($httpHandler); + $this->hasCheckedOnGce = true; + } + + if (!$this->isOnGce) { + return null; + } + + $this->projectId = $this->getFromMetadata($httpHandler, self::getProjectIdUri()); + return $this->projectId; + } + + /** + * Fetch the value of a GCE metadata server URI. + * + * @param callable $httpHandler An HTTP Handler to deliver PSR7 requests. + * @param string $uri The metadata URI. + * @return string + */ + private function getFromMetadata(callable $httpHandler, $uri) + { + $resp = $httpHandler( + new Request( + 'GET', + $uri, + [self::FLAVOR_HEADER => 'Google'] + ) + ); + + return (string) $resp->getBody(); + } + + /** + * Get the quota project used for this API request + * + * @return string|null + */ + public function getQuotaProject() + { + return $this->quotaProject; + } +} diff --git a/vendor/google/auth/src/Credentials/IAMCredentials.php b/vendor/google/auth/src/Credentials/IAMCredentials.php new file mode 100644 index 00000000..5f055d84 --- /dev/null +++ b/vendor/google/auth/src/Credentials/IAMCredentials.php @@ -0,0 +1,91 @@ +selector = $selector; + $this->token = $token; + } + + /** + * export a callback function which updates runtime metadata. + * + * @return array updateMetadata function + */ + public function getUpdateMetadataFunc() + { + return array($this, 'updateMetadata'); + } + + /** + * Updates metadata with the appropriate header metadata. + * + * @param array $metadata metadata hashmap + * @param string $unusedAuthUri optional auth uri + * @param callable $httpHandler callback which delivers psr7 request + * Note: this param is unused here, only included here for + * consistency with other credentials class + * + * @return array updated metadata hashmap + */ + public function updateMetadata( + $metadata, + $unusedAuthUri = null, + callable $httpHandler = null + ) { + $metadata_copy = $metadata; + $metadata_copy[self::SELECTOR_KEY] = $this->selector; + $metadata_copy[self::TOKEN_KEY] = $this->token; + + return $metadata_copy; + } +} diff --git a/vendor/google/auth/src/Credentials/InsecureCredentials.php b/vendor/google/auth/src/Credentials/InsecureCredentials.php new file mode 100644 index 00000000..dae894fa --- /dev/null +++ b/vendor/google/auth/src/Credentials/InsecureCredentials.php @@ -0,0 +1,70 @@ + '' + ]; + + /** + * Fetches the auth token. In this case it returns an empty string. + * + * @param callable $httpHandler + * @return array A set of auth related metadata, containing the following + * keys: + * - access_token (string) + */ + public function fetchAuthToken(callable $httpHandler = null) + { + return $this->token; + } + + /** + * Returns the cache key. In this case it returns a null value, disabling + * caching. + * + * @return string|null + */ + public function getCacheKey() + { + return null; + } + + /** + * Fetches the last received token. In this case, it returns the same empty string + * auth token. + * + * @return array + */ + public function getLastReceivedToken() + { + return $this->token; + } +} diff --git a/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php b/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php new file mode 100644 index 00000000..da972497 --- /dev/null +++ b/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php @@ -0,0 +1,338 @@ +push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'auth' => 'google_auth' // authorize all requests + * ]); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + */ +class ServiceAccountCredentials extends CredentialsLoader implements + GetQuotaProjectInterface, + SignBlobInterface, + ProjectIdProviderInterface +{ + use ServiceAccountSignerTrait; + + /** + * The OAuth2 instance used to conduct authorization. + * + * @var OAuth2 + */ + protected $auth; + + /** + * The quota project associated with the JSON credentials + * + * @var string + */ + protected $quotaProject; + + /* + * @var string|null + */ + protected $projectId; + + /* + * @var array|null + */ + private $lastReceivedJwtAccessToken; + + /* + * @var bool + */ + private $useJwtAccessWithScope = false; + + /* + * @var ServiceAccountJwtAccessCredentials|null + */ + private $jwtAccessCredentials; + + /** + * Create a new ServiceAccountCredentials. + * + * @param string|array $scope the scope of the access request, expressed + * either as an Array or as a space-delimited String. + * @param string|array $jsonKey JSON credential file path or JSON credentials + * as an associative array + * @param string $sub an email address account to impersonate, in situations when + * the service account has been delegated domain wide access. + * @param string $targetAudience The audience for the ID token. + */ + public function __construct( + $scope, + $jsonKey, + $sub = null, + $targetAudience = null + ) { + if (is_string($jsonKey)) { + if (!file_exists($jsonKey)) { + throw new \InvalidArgumentException('file does not exist'); + } + $jsonKeyStream = file_get_contents($jsonKey); + if (!$jsonKey = json_decode($jsonKeyStream, true)) { + throw new \LogicException('invalid json for auth config'); + } + } + if (!array_key_exists('client_email', $jsonKey)) { + throw new \InvalidArgumentException( + 'json key is missing the client_email field' + ); + } + if (!array_key_exists('private_key', $jsonKey)) { + throw new \InvalidArgumentException( + 'json key is missing the private_key field' + ); + } + if (array_key_exists('quota_project_id', $jsonKey)) { + $this->quotaProject = (string) $jsonKey['quota_project_id']; + } + if ($scope && $targetAudience) { + throw new InvalidArgumentException( + 'Scope and targetAudience cannot both be supplied' + ); + } + $additionalClaims = []; + if ($targetAudience) { + $additionalClaims = ['target_audience' => $targetAudience]; + } + $this->auth = new OAuth2([ + 'audience' => self::TOKEN_CREDENTIAL_URI, + 'issuer' => $jsonKey['client_email'], + 'scope' => $scope, + 'signingAlgorithm' => 'RS256', + 'signingKey' => $jsonKey['private_key'], + 'sub' => $sub, + 'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI, + 'additionalClaims' => $additionalClaims, + ]); + + $this->projectId = isset($jsonKey['project_id']) + ? $jsonKey['project_id'] + : null; + } + + /** + * When called, the ServiceAccountCredentials will use an instance of + * ServiceAccountJwtAccessCredentials to fetch (self-sign) an access token + * even when only scopes are supplied. Otherwise, + * ServiceAccountJwtAccessCredentials is only called when no scopes and an + * authUrl (audience) is suppled. + */ + public function useJwtAccessWithScope() + { + $this->useJwtAccessWithScope = true; + } + + /** + * @param callable $httpHandler + * + * @return array A set of auth related metadata, containing the following + * keys: + * - access_token (string) + * - expires_in (int) + * - token_type (string) + */ + public function fetchAuthToken(callable $httpHandler = null) + { + if ($this->useSelfSignedJwt()) { + $jwtCreds = $this->createJwtAccessCredentials(); + + $accessToken = $jwtCreds->fetchAuthToken($httpHandler); + + if ($lastReceivedToken = $jwtCreds->getLastReceivedToken()) { + // Keep self-signed JWTs in memory as the last received token + $this->lastReceivedJwtAccessToken = $lastReceivedToken; + } + + return $accessToken; + } + return $this->auth->fetchAuthToken($httpHandler); + } + + /** + * @return string + */ + public function getCacheKey() + { + $key = $this->auth->getIssuer() . ':' . $this->auth->getCacheKey(); + if ($sub = $this->auth->getSub()) { + $key .= ':' . $sub; + } + + return $key; + } + + /** + * @return array + */ + public function getLastReceivedToken() + { + // If self-signed JWTs are being used, fetch the last received token + // from memory. Else, fetch it from OAuth2 + return $this->useSelfSignedJwt() + ? $this->lastReceivedJwtAccessToken + : $this->auth->getLastReceivedToken(); + } + + /** + * Get the project ID from the service account keyfile. + * + * Returns null if the project ID does not exist in the keyfile. + * + * @param callable $httpHandler Not used by this credentials type. + * @return string|null + */ + public function getProjectId(callable $httpHandler = null) + { + return $this->projectId; + } + + /** + * Updates metadata with the authorization token. + * + * @param array $metadata metadata hashmap + * @param string $authUri optional auth uri + * @param callable $httpHandler callback which delivers psr7 request + * @return array updated metadata hashmap + */ + public function updateMetadata( + $metadata, + $authUri = null, + callable $httpHandler = null + ) { + // scope exists. use oauth implementation + if (!$this->useSelfSignedJwt()) { + return parent::updateMetadata($metadata, $authUri, $httpHandler); + } + + $jwtCreds = $this->createJwtAccessCredentials(); + if ($this->auth->getScope()) { + // Prefer user-provided "scope" to "audience" + $updatedMetadata = $jwtCreds->updateMetadata($metadata, null, $httpHandler); + } else { + $updatedMetadata = $jwtCreds->updateMetadata($metadata, $authUri, $httpHandler); + } + + if ($lastReceivedToken = $jwtCreds->getLastReceivedToken()) { + // Keep self-signed JWTs in memory as the last received token + $this->lastReceivedJwtAccessToken = $lastReceivedToken; + } + + return $updatedMetadata; + } + + private function createJwtAccessCredentials() + { + if (!$this->jwtAccessCredentials) { + // Create credentials for self-signing a JWT (JwtAccess) + $credJson = array( + 'private_key' => $this->auth->getSigningKey(), + 'client_email' => $this->auth->getIssuer(), + ); + $this->jwtAccessCredentials = new ServiceAccountJwtAccessCredentials( + $credJson, + $this->auth->getScope() + ); + } + + return $this->jwtAccessCredentials; + } + + /** + * @param string $sub an email address account to impersonate, in situations when + * the service account has been delegated domain wide access. + */ + public function setSub($sub) + { + $this->auth->setSub($sub); + } + + /** + * Get the client name from the keyfile. + * + * In this case, it returns the keyfile's client_email key. + * + * @param callable $httpHandler Not used by this credentials type. + * @return string + */ + public function getClientName(callable $httpHandler = null) + { + return $this->auth->getIssuer(); + } + + /** + * Get the quota project used for this API request + * + * @return string|null + */ + public function getQuotaProject() + { + return $this->quotaProject; + } + + private function useSelfSignedJwt() + { + // If claims are set, this call is for "id_tokens" + if ($this->auth->getAdditionalClaims()) { + return false; + } + + // When true, ServiceAccountCredentials will always use JwtAccess for access tokens + if ($this->useJwtAccessWithScope) { + return true; + } + return is_null($this->auth->getScope()); + } +} diff --git a/vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php b/vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php new file mode 100644 index 00000000..6f5c28a8 --- /dev/null +++ b/vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php @@ -0,0 +1,205 @@ +quotaProject = (string) $jsonKey['quota_project_id']; + } + $this->auth = new OAuth2([ + 'issuer' => $jsonKey['client_email'], + 'sub' => $jsonKey['client_email'], + 'signingAlgorithm' => 'RS256', + 'signingKey' => $jsonKey['private_key'], + 'scope' => $scope, + ]); + + $this->projectId = isset($jsonKey['project_id']) + ? $jsonKey['project_id'] + : null; + } + + /** + * Updates metadata with the authorization token. + * + * @param array $metadata metadata hashmap + * @param string $authUri optional auth uri + * @param callable $httpHandler callback which delivers psr7 request + * @return array updated metadata hashmap + */ + public function updateMetadata( + $metadata, + $authUri = null, + callable $httpHandler = null + ) { + $scope = $this->auth->getScope(); + if (empty($authUri) && empty($scope)) { + return $metadata; + } + + $this->auth->setAudience($authUri); + + return parent::updateMetadata($metadata, $authUri, $httpHandler); + } + + /** + * Implements FetchAuthTokenInterface#fetchAuthToken. + * + * @param callable $httpHandler + * + * @return array|void A set of auth related metadata, containing the + * following keys: + * - access_token (string) + */ + public function fetchAuthToken(callable $httpHandler = null) + { + $audience = $this->auth->getAudience(); + $scope = $this->auth->getScope(); + if (empty($audience) && empty($scope)) { + return null; + } + + if (!empty($audience) && !empty($scope)) { + throw new \UnexpectedValueException( + 'Cannot sign both audience and scope in JwtAccess' + ); + } + + $access_token = $this->auth->toJwt(); + + // Set the self-signed access token in OAuth2 for getLastReceivedToken + $this->auth->setAccessToken($access_token); + + return array('access_token' => $access_token); + } + + /** + * @return string + */ + public function getCacheKey() + { + return $this->auth->getCacheKey(); + } + + /** + * @return array + */ + public function getLastReceivedToken() + { + return $this->auth->getLastReceivedToken(); + } + + /** + * Get the project ID from the service account keyfile. + * + * Returns null if the project ID does not exist in the keyfile. + * + * @param callable $httpHandler Not used by this credentials type. + * @return string|null + */ + public function getProjectId(callable $httpHandler = null) + { + return $this->projectId; + } + + /** + * Get the client name from the keyfile. + * + * In this case, it returns the keyfile's client_email key. + * + * @param callable $httpHandler Not used by this credentials type. + * @return string + */ + public function getClientName(callable $httpHandler = null) + { + return $this->auth->getIssuer(); + } + + /** + * Get the quota project used for this API request + * + * @return string|null + */ + public function getQuotaProject() + { + return $this->quotaProject; + } +} diff --git a/vendor/google/auth/src/Credentials/UserRefreshCredentials.php b/vendor/google/auth/src/Credentials/UserRefreshCredentials.php new file mode 100644 index 00000000..b17ce5fc --- /dev/null +++ b/vendor/google/auth/src/Credentials/UserRefreshCredentials.php @@ -0,0 +1,138 @@ +auth = new OAuth2([ + 'clientId' => $jsonKey['client_id'], + 'clientSecret' => $jsonKey['client_secret'], + 'refresh_token' => $jsonKey['refresh_token'], + 'scope' => $scope, + 'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI, + ]); + if (array_key_exists('quota_project_id', $jsonKey)) { + $this->quotaProject = (string) $jsonKey['quota_project_id']; + } + } + + /** + * @param callable $httpHandler + * + * @return array A set of auth related metadata, containing the following + * keys: + * - access_token (string) + * - expires_in (int) + * - scope (string) + * - token_type (string) + * - id_token (string) + */ + public function fetchAuthToken(callable $httpHandler = null) + { + return $this->auth->fetchAuthToken($httpHandler); + } + + /** + * @return string + */ + public function getCacheKey() + { + return $this->auth->getClientId() . ':' . $this->auth->getCacheKey(); + } + + /** + * @return array + */ + public function getLastReceivedToken() + { + return $this->auth->getLastReceivedToken(); + } + + /** + * Get the quota project used for this API request + * + * @return string|null + */ + public function getQuotaProject() + { + return $this->quotaProject; + } +} diff --git a/vendor/google/auth/src/CredentialsLoader.php b/vendor/google/auth/src/CredentialsLoader.php new file mode 100644 index 00000000..c0c3c72b --- /dev/null +++ b/vendor/google/auth/src/CredentialsLoader.php @@ -0,0 +1,315 @@ +setDefaultOption('auth', 'google_auth'); + $subscriber = new Subscriber\AuthTokenSubscriber( + $fetcher, + $httpHandler, + $tokenCallback + ); + $client->getEmitter()->attach($subscriber); + return $client; + } + + $middleware = new Middleware\AuthTokenMiddleware( + $fetcher, + $httpHandler, + $tokenCallback + ); + $stack = \GuzzleHttp\HandlerStack::create(); + $stack->push($middleware); + + return new \GuzzleHttp\Client([ + 'handler' => $stack, + 'auth' => 'google_auth', + ] + $httpClientOptions); + } + + /** + * Create a new instance of InsecureCredentials. + * + * @return InsecureCredentials + */ + public static function makeInsecureCredentials() + { + return new InsecureCredentials(); + } + + /** + * export a callback function which updates runtime metadata. + * + * @return array updateMetadata function + * @deprecated + */ + public function getUpdateMetadataFunc() + { + return array($this, 'updateMetadata'); + } + + /** + * Updates metadata with the authorization token. + * + * @param array $metadata metadata hashmap + * @param string $authUri optional auth uri + * @param callable $httpHandler callback which delivers psr7 request + * @return array updated metadata hashmap + */ + public function updateMetadata( + $metadata, + $authUri = null, + callable $httpHandler = null + ) { + if (isset($metadata[self::AUTH_METADATA_KEY])) { + // Auth metadata has already been set + return $metadata; + } + $result = $this->fetchAuthToken($httpHandler); + if (!isset($result['access_token'])) { + return $metadata; + } + $metadata_copy = $metadata; + $metadata_copy[self::AUTH_METADATA_KEY] = array('Bearer ' . $result['access_token']); + + return $metadata_copy; + } + + /** + * Gets a callable which returns the default device certification. + * + * @throws UnexpectedValueException + * @return callable|null + */ + public static function getDefaultClientCertSource() + { + if (!$clientCertSourceJson = self::loadDefaultClientCertSourceFile()) { + return null; + } + $clientCertSourceCmd = $clientCertSourceJson['cert_provider_command']; + + return function () use ($clientCertSourceCmd) { + $cmd = array_map('escapeshellarg', $clientCertSourceCmd); + exec(implode(' ', $cmd), $output, $returnVar); + + if (0 === $returnVar) { + return implode(PHP_EOL, $output); + } + throw new RuntimeException( + '"cert_provider_command" failed with a nonzero exit code' + ); + }; + } + + /** + * Determines whether or not the default device certificate should be loaded. + * + * @return bool + */ + public static function shouldLoadClientCertSource() + { + return filter_var(getenv(self::MTLS_CERT_ENV_VAR), FILTER_VALIDATE_BOOLEAN); + } + + private static function loadDefaultClientCertSourceFile() + { + $rootEnv = self::isOnWindows() ? 'APPDATA' : 'HOME'; + $path = sprintf('%s/%s', getenv($rootEnv), self::MTLS_WELL_KNOWN_PATH); + if (!file_exists($path)) { + return null; + } + $jsonKey = file_get_contents($path); + $clientCertSourceJson = json_decode($jsonKey, true); + if (!$clientCertSourceJson) { + throw new UnexpectedValueException('Invalid client cert source JSON'); + } + if (!isset($clientCertSourceJson['cert_provider_command'])) { + throw new UnexpectedValueException( + 'cert source requires "cert_provider_command"' + ); + } + if (!is_array($clientCertSourceJson['cert_provider_command'])) { + throw new UnexpectedValueException( + 'cert source expects "cert_provider_command" to be an array' + ); + } + return $clientCertSourceJson; + } +} diff --git a/vendor/google/auth/src/FetchAuthTokenCache.php b/vendor/google/auth/src/FetchAuthTokenCache.php new file mode 100644 index 00000000..7b025843 --- /dev/null +++ b/vendor/google/auth/src/FetchAuthTokenCache.php @@ -0,0 +1,278 @@ +fetcher = $fetcher; + $this->cache = $cache; + $this->cacheConfig = array_merge([ + 'lifetime' => 1500, + 'prefix' => '', + ], (array) $cacheConfig); + } + + /** + * Implements FetchAuthTokenInterface#fetchAuthToken. + * + * Checks the cache for a valid auth token and fetches the auth tokens + * from the supplied fetcher. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return array the response + * @throws \Exception + */ + public function fetchAuthToken(callable $httpHandler = null) + { + if ($cached = $this->fetchAuthTokenFromCache()) { + return $cached; + } + + $auth_token = $this->fetcher->fetchAuthToken($httpHandler); + + $this->saveAuthTokenInCache($auth_token); + + return $auth_token; + } + + /** + * @return string + */ + public function getCacheKey() + { + return $this->getFullCacheKey($this->fetcher->getCacheKey()); + } + + /** + * @return array|null + */ + public function getLastReceivedToken() + { + return $this->fetcher->getLastReceivedToken(); + } + + /** + * Get the client name from the fetcher. + * + * @param callable $httpHandler An HTTP handler to deliver PSR7 requests. + * @return string + */ + public function getClientName(callable $httpHandler = null) + { + if (!$this->fetcher instanceof SignBlobInterface) { + throw new \RuntimeException( + 'Credentials fetcher does not implement ' . + 'Google\Auth\SignBlobInterface' + ); + } + + return $this->fetcher->getClientName($httpHandler); + } + + /** + * Sign a blob using the fetcher. + * + * @param string $stringToSign The string to sign. + * @param bool $forceOpenSsl Require use of OpenSSL for local signing. Does + * not apply to signing done using external services. **Defaults to** + * `false`. + * @return string The resulting signature. + * @throws \RuntimeException If the fetcher does not implement + * `Google\Auth\SignBlobInterface`. + */ + public function signBlob($stringToSign, $forceOpenSsl = false) + { + if (!$this->fetcher instanceof SignBlobInterface) { + throw new \RuntimeException( + 'Credentials fetcher does not implement ' . + 'Google\Auth\SignBlobInterface' + ); + } + + // Pass the access token from cache to GCECredentials for signing a blob. + // This saves a call to the metadata server when a cached token exists. + if ($this->fetcher instanceof Credentials\GCECredentials) { + $cached = $this->fetchAuthTokenFromCache(); + $accessToken = isset($cached['access_token']) ? $cached['access_token'] : null; + return $this->fetcher->signBlob($stringToSign, $forceOpenSsl, $accessToken); + } + + return $this->fetcher->signBlob($stringToSign, $forceOpenSsl); + } + + /** + * Get the quota project used for this API request from the credentials + * fetcher. + * + * @return string|null + */ + public function getQuotaProject() + { + if ($this->fetcher instanceof GetQuotaProjectInterface) { + return $this->fetcher->getQuotaProject(); + } + } + + /* + * Get the Project ID from the fetcher. + * + * @param callable $httpHandler Callback which delivers psr7 request + * @return string|null + * @throws \RuntimeException If the fetcher does not implement + * `Google\Auth\ProvidesProjectIdInterface`. + */ + public function getProjectId(callable $httpHandler = null) + { + if (!$this->fetcher instanceof ProjectIdProviderInterface) { + throw new \RuntimeException( + 'Credentials fetcher does not implement ' . + 'Google\Auth\ProvidesProjectIdInterface' + ); + } + + return $this->fetcher->getProjectId($httpHandler); + } + + /** + * Updates metadata with the authorization token. + * + * @param array $metadata metadata hashmap + * @param string $authUri optional auth uri + * @param callable $httpHandler callback which delivers psr7 request + * @return array updated metadata hashmap + * @throws \RuntimeException If the fetcher does not implement + * `Google\Auth\UpdateMetadataInterface`. + */ + public function updateMetadata( + $metadata, + $authUri = null, + callable $httpHandler = null + ) { + if (!$this->fetcher instanceof UpdateMetadataInterface) { + throw new \RuntimeException( + 'Credentials fetcher does not implement ' . + 'Google\Auth\UpdateMetadataInterface' + ); + } + + $cached = $this->fetchAuthTokenFromCache($authUri); + if ($cached) { + // Set the access token in the `Authorization` metadata header so + // the downstream call to updateMetadata know they don't need to + // fetch another token. + if (isset($cached['access_token'])) { + $metadata[self::AUTH_METADATA_KEY] = [ + 'Bearer ' . $cached['access_token'] + ]; + } + } + + $newMetadata = $this->fetcher->updateMetadata( + $metadata, + $authUri, + $httpHandler + ); + + if (!$cached && $token = $this->fetcher->getLastReceivedToken()) { + $this->saveAuthTokenInCache($token, $authUri); + } + + return $newMetadata; + } + + private function fetchAuthTokenFromCache($authUri = null) + { + // Use the cached value if its available. + // + // TODO: correct caching; update the call to setCachedValue to set the expiry + // to the value returned with the auth token. + // + // TODO: correct caching; enable the cache to be cleared. + + // if $authUri is set, use it as the cache key + $cacheKey = $authUri + ? $this->getFullCacheKey($authUri) + : $this->fetcher->getCacheKey(); + + $cached = $this->getCachedValue($cacheKey); + if (is_array($cached)) { + if (empty($cached['expires_at'])) { + // If there is no expiration data, assume token is not expired. + // (for JwtAccess and ID tokens) + return $cached; + } + if (time() < $cached['expires_at']) { + // access token is not expired + return $cached; + } + } + + return null; + } + + private function saveAuthTokenInCache($authToken, $authUri = null) + { + if (isset($authToken['access_token']) || + isset($authToken['id_token'])) { + // if $authUri is set, use it as the cache key + $cacheKey = $authUri + ? $this->getFullCacheKey($authUri) + : $this->fetcher->getCacheKey(); + + $this->setCachedValue($cacheKey, $authToken); + } + } +} diff --git a/vendor/google/auth/src/FetchAuthTokenInterface.php b/vendor/google/auth/src/FetchAuthTokenInterface.php new file mode 100644 index 00000000..4bf4d27f --- /dev/null +++ b/vendor/google/auth/src/FetchAuthTokenInterface.php @@ -0,0 +1,54 @@ +cache = $cache; + $this->cacheConfig = array_merge([ + 'lifetime' => 1500, + 'prefix' => '', + ], (array) $cacheConfig); + } + + /** + * Caches the result of onGce so the metadata server is not called multiple + * times. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return bool True if this a GCEInstance, false otherwise + */ + public function onGce(callable $httpHandler = null) + { + if (is_null($this->cache)) { + return GCECredentials::onGce($httpHandler); + } + + $cacheKey = self::GCE_CACHE_KEY; + $onGce = $this->getCachedValue($cacheKey); + + if (is_null($onGce)) { + $onGce = GCECredentials::onGce($httpHandler); + $this->setCachedValue($cacheKey, $onGce); + } + + return $onGce; + } +} diff --git a/vendor/google/auth/src/GetQuotaProjectInterface.php b/vendor/google/auth/src/GetQuotaProjectInterface.php new file mode 100644 index 00000000..517f062e --- /dev/null +++ b/vendor/google/auth/src/GetQuotaProjectInterface.php @@ -0,0 +1,33 @@ +client = $client; + } + + /** + * Accepts a PSR-7 Request and an array of options and returns a PSR-7 response. + * + * @param RequestInterface $request + * @param array $options + * @return ResponseInterface + */ + public function __invoke(RequestInterface $request, array $options = []) + { + $response = $this->client->send( + $this->createGuzzle5Request($request, $options) + ); + + return $this->createPsr7Response($response); + } + + /** + * Accepts a PSR-7 request and an array of options and returns a PromiseInterface + * + * @param RequestInterface $request + * @param array $options + * @return Promise + */ + public function async(RequestInterface $request, array $options = []) + { + if (!class_exists('GuzzleHttp\Promise\Promise')) { + throw new Exception('Install guzzlehttp/promises to use async with Guzzle 5'); + } + + $futureResponse = $this->client->send( + $this->createGuzzle5Request( + $request, + ['future' => true] + $options + ) + ); + + $promise = new Promise( + function () use ($futureResponse) { + try { + $futureResponse->wait(); + } catch (Exception $e) { + // The promise is already delivered when the exception is + // thrown, so don't rethrow it. + } + }, + [$futureResponse, 'cancel'] + ); + + $futureResponse->then([$promise, 'resolve'], [$promise, 'reject']); + + return $promise->then( + function (Guzzle5ResponseInterface $response) { + // Adapt the Guzzle 5 Response to a PSR-7 Response. + return $this->createPsr7Response($response); + }, + function (Exception $e) { + return new RejectedPromise($e); + } + ); + } + + private function createGuzzle5Request(RequestInterface $request, array $options) + { + return $this->client->createRequest( + $request->getMethod(), + $request->getUri(), + array_merge_recursive([ + 'headers' => $request->getHeaders(), + 'body' => $request->getBody(), + ], $options) + ); + } + + private function createPsr7Response(Guzzle5ResponseInterface $response) + { + return new Response( + $response->getStatusCode(), + $response->getHeaders() ?: [], + $response->getBody(), + $response->getProtocolVersion(), + $response->getReasonPhrase() + ); + } +} diff --git a/vendor/google/auth/src/HttpHandler/Guzzle6HttpHandler.php b/vendor/google/auth/src/HttpHandler/Guzzle6HttpHandler.php new file mode 100644 index 00000000..aaa7b438 --- /dev/null +++ b/vendor/google/auth/src/HttpHandler/Guzzle6HttpHandler.php @@ -0,0 +1,62 @@ +client = $client; + } + + /** + * Accepts a PSR-7 request and an array of options and returns a PSR-7 response. + * + * @param RequestInterface $request + * @param array $options + * @return ResponseInterface + */ + public function __invoke(RequestInterface $request, array $options = []) + { + return $this->client->send($request, $options); + } + + /** + * Accepts a PSR-7 request and an array of options and returns a PromiseInterface + * + * @param RequestInterface $request + * @param array $options + * + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function async(RequestInterface $request, array $options = []) + { + return $this->client->sendAsync($request, $options); + } +} diff --git a/vendor/google/auth/src/HttpHandler/Guzzle7HttpHandler.php b/vendor/google/auth/src/HttpHandler/Guzzle7HttpHandler.php new file mode 100644 index 00000000..e84f6603 --- /dev/null +++ b/vendor/google/auth/src/HttpHandler/Guzzle7HttpHandler.php @@ -0,0 +1,21 @@ +httpHandler = $httpHandler + ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + } + + /** + * Sign a string using the IAM signBlob API. + * + * Note that signing using IAM requires your service account to have the + * `iam.serviceAccounts.signBlob` permission, part of the "Service Account + * Token Creator" IAM role. + * + * @param string $email The service account email. + * @param string $accessToken An access token from the service account. + * @param string $stringToSign The string to be signed. + * @param array $delegates [optional] A list of service account emails to + * add to the delegate chain. If omitted, the value of `$email` will + * be used. + * @return string The signed string, base64-encoded. + */ + public function signBlob($email, $accessToken, $stringToSign, array $delegates = []) + { + $httpHandler = $this->httpHandler; + $name = sprintf(self::SERVICE_ACCOUNT_NAME, $email); + $uri = self::IAM_API_ROOT . '/' . sprintf(self::SIGN_BLOB_PATH, $name); + + if ($delegates) { + foreach ($delegates as &$delegate) { + $delegate = sprintf(self::SERVICE_ACCOUNT_NAME, $delegate); + } + } else { + $delegates = [$name]; + } + + $body = [ + 'delegates' => $delegates, + 'payload' => base64_encode($stringToSign), + ]; + + $headers = [ + 'Authorization' => 'Bearer ' . $accessToken + ]; + + $request = new Psr7\Request( + 'POST', + $uri, + $headers, + Utils::streamFor(json_encode($body)) + ); + + $res = $httpHandler($request); + $body = json_decode((string) $res->getBody(), true); + + return $body['signedBlob']; + } +} diff --git a/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php b/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php new file mode 100644 index 00000000..02bb1744 --- /dev/null +++ b/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php @@ -0,0 +1,148 @@ +' + */ +class AuthTokenMiddleware +{ + /** + * @var callback + */ + private $httpHandler; + + /** + * @var FetchAuthTokenInterface + */ + private $fetcher; + + /** + * @var callable + */ + private $tokenCallback; + + /** + * Creates a new AuthTokenMiddleware. + * + * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token + * @param callable $httpHandler (optional) callback which delivers psr7 request + * @param callable $tokenCallback (optional) function to be called when a new token is fetched. + */ + public function __construct( + FetchAuthTokenInterface $fetcher, + callable $httpHandler = null, + callable $tokenCallback = null + ) { + $this->fetcher = $fetcher; + $this->httpHandler = $httpHandler; + $this->tokenCallback = $tokenCallback; + } + + /** + * Updates the request with an Authorization header when auth is 'google_auth'. + * + * use Google\Auth\Middleware\AuthTokenMiddleware; + * use Google\Auth\OAuth2; + * use GuzzleHttp\Client; + * use GuzzleHttp\HandlerStack; + * + * $config = [...]; + * $oauth2 = new OAuth2($config) + * $middleware = new AuthTokenMiddleware($oauth2); + * $stack = HandlerStack::create(); + * $stack->push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'auth' => 'google_auth' // authorize all requests + * ]); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + * + * @param callable $handler + * @return \Closure + */ + public function __invoke(callable $handler) + { + return function (RequestInterface $request, array $options) use ($handler) { + // Requests using "auth"="google_auth" will be authorized. + if (!isset($options['auth']) || $options['auth'] !== 'google_auth') { + return $handler($request, $options); + } + + $request = $request->withHeader('authorization', 'Bearer ' . $this->fetchToken()); + + if ($quotaProject = $this->getQuotaProject()) { + $request = $request->withHeader( + GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER, + $quotaProject + ); + } + + return $handler($request, $options); + }; + } + + /** + * Call fetcher to fetch the token. + * + * @return string + */ + private function fetchToken() + { + $auth_tokens = $this->fetcher->fetchAuthToken($this->httpHandler); + + if (array_key_exists('access_token', $auth_tokens)) { + // notify the callback if applicable + if ($this->tokenCallback) { + call_user_func( + $this->tokenCallback, + $this->fetcher->getCacheKey(), + $auth_tokens['access_token'] + ); + } + + return $auth_tokens['access_token']; + } + + if (array_key_exists('id_token', $auth_tokens)) { + return $auth_tokens['id_token']; + } + } + + private function getQuotaProject() + { + if ($this->fetcher instanceof GetQuotaProjectInterface) { + return $this->fetcher->getQuotaProject(); + } + } +} diff --git a/vendor/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php b/vendor/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php new file mode 100644 index 00000000..a1e81c4e --- /dev/null +++ b/vendor/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php @@ -0,0 +1,148 @@ +' + */ +class ProxyAuthTokenMiddleware +{ + /** + * @var callback + */ + private $httpHandler; + + /** + * @var FetchAuthTokenInterface + */ + private $fetcher; + + /** + * @var callable + */ + private $tokenCallback; + + /** + * Creates a new ProxyAuthTokenMiddleware. + * + * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token + * @param callable $httpHandler (optional) callback which delivers psr7 request + * @param callable $tokenCallback (optional) function to be called when a new token is fetched. + */ + public function __construct( + FetchAuthTokenInterface $fetcher, + callable $httpHandler = null, + callable $tokenCallback = null + ) { + $this->fetcher = $fetcher; + $this->httpHandler = $httpHandler; + $this->tokenCallback = $tokenCallback; + } + + /** + * Updates the request with an Authorization header when auth is 'google_auth'. + * + * use Google\Auth\Middleware\ProxyAuthTokenMiddleware; + * use Google\Auth\OAuth2; + * use GuzzleHttp\Client; + * use GuzzleHttp\HandlerStack; + * + * $config = [...]; + * $oauth2 = new OAuth2($config) + * $middleware = new ProxyAuthTokenMiddleware($oauth2); + * $stack = HandlerStack::create(); + * $stack->push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'proxy_auth' => 'google_auth' // authorize all requests + * ]); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + * + * @param callable $handler + * @return \Closure + */ + public function __invoke(callable $handler) + { + return function (RequestInterface $request, array $options) use ($handler) { + // Requests using "proxy_auth"="google_auth" will be authorized. + if (!isset($options['proxy_auth']) || $options['proxy_auth'] !== 'google_auth') { + return $handler($request, $options); + } + + $request = $request->withHeader('proxy-authorization', 'Bearer ' . $this->fetchToken()); + + if ($quotaProject = $this->getQuotaProject()) { + $request = $request->withHeader( + GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER, + $quotaProject + ); + } + + return $handler($request, $options); + }; + } + + /** + * Call fetcher to fetch the token. + * + * @return string + */ + private function fetchToken() + { + $auth_tokens = $this->fetcher->fetchAuthToken($this->httpHandler); + + if (array_key_exists('access_token', $auth_tokens)) { + // notify the callback if applicable + if ($this->tokenCallback) { + call_user_func( + $this->tokenCallback, + $this->fetcher->getCacheKey(), + $auth_tokens['access_token'] + ); + } + + return $auth_tokens['access_token']; + } + + if (array_key_exists('id_token', $auth_tokens)) { + return $auth_tokens['id_token']; + } + } + + private function getQuotaProject() + { + if ($this->fetcher instanceof GetQuotaProjectInterface) { + return $this->fetcher->getQuotaProject(); + } + } +} diff --git a/vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php b/vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php new file mode 100644 index 00000000..ecbb6596 --- /dev/null +++ b/vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php @@ -0,0 +1,175 @@ +' + */ +class ScopedAccessTokenMiddleware +{ + use CacheTrait; + + const DEFAULT_CACHE_LIFETIME = 1500; + + /** + * @var CacheItemPoolInterface + */ + private $cache; + + /** + * @var array configuration + */ + private $cacheConfig; + + /** + * @var callable + */ + private $tokenFunc; + + /** + * @var array|string + */ + private $scopes; + + /** + * Creates a new ScopedAccessTokenMiddleware. + * + * @param callable $tokenFunc a token generator function + * @param array|string $scopes the token authentication scopes + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache an implementation of CacheItemPoolInterface + */ + public function __construct( + callable $tokenFunc, + $scopes, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null + ) { + $this->tokenFunc = $tokenFunc; + if (!(is_string($scopes) || is_array($scopes))) { + throw new \InvalidArgumentException( + 'wants scope should be string or array' + ); + } + $this->scopes = $scopes; + + if (!is_null($cache)) { + $this->cache = $cache; + $this->cacheConfig = array_merge([ + 'lifetime' => self::DEFAULT_CACHE_LIFETIME, + 'prefix' => '', + ], $cacheConfig); + } + } + + /** + * Updates the request with an Authorization header when auth is 'scoped'. + * + * E.g this could be used to authenticate using the AppEngine + * AppIdentityService. + * + * use google\appengine\api\app_identity\AppIdentityService; + * use Google\Auth\Middleware\ScopedAccessTokenMiddleware; + * use GuzzleHttp\Client; + * use GuzzleHttp\HandlerStack; + * + * $scope = 'https://www.googleapis.com/auth/taskqueue' + * $middleware = new ScopedAccessTokenMiddleware( + * 'AppIdentityService::getAccessToken', + * $scope, + * [ 'prefix' => 'Google\Auth\ScopedAccessToken::' ], + * $cache = new Memcache() + * ); + * $stack = HandlerStack::create(); + * $stack->push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'auth' => 'scoped' // authorize all requests + * ]); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + * + * @param callable $handler + * @return \Closure + */ + public function __invoke(callable $handler) + { + return function (RequestInterface $request, array $options) use ($handler) { + // Requests using "auth"="scoped" will be authorized. + if (!isset($options['auth']) || $options['auth'] !== 'scoped') { + return $handler($request, $options); + } + + $request = $request->withHeader('authorization', 'Bearer ' . $this->fetchToken()); + + return $handler($request, $options); + }; + } + + /** + * @return string + */ + private function getCacheKey() + { + $key = null; + + if (is_string($this->scopes)) { + $key .= $this->scopes; + } elseif (is_array($this->scopes)) { + $key .= implode(':', $this->scopes); + } + + return $key; + } + + /** + * Determine if token is available in the cache, if not call tokenFunc to + * fetch it. + * + * @return string + */ + private function fetchToken() + { + $cacheKey = $this->getCacheKey(); + $cached = $this->getCachedValue($cacheKey); + + if (!empty($cached)) { + return $cached; + } + + $token = call_user_func($this->tokenFunc, $this->scopes); + $this->setCachedValue($cacheKey, $token); + + return $token; + } +} diff --git a/vendor/google/auth/src/Middleware/SimpleMiddleware.php b/vendor/google/auth/src/Middleware/SimpleMiddleware.php new file mode 100644 index 00000000..bc913c1b --- /dev/null +++ b/vendor/google/auth/src/Middleware/SimpleMiddleware.php @@ -0,0 +1,92 @@ +config = array_merge(['key' => null], $config); + } + + /** + * Updates the request query with the developer key if auth is set to simple. + * + * use Google\Auth\Middleware\SimpleMiddleware; + * use GuzzleHttp\Client; + * use GuzzleHttp\HandlerStack; + * + * $my_key = 'is not the same as yours'; + * $middleware = new SimpleMiddleware(['key' => $my_key]); + * $stack = HandlerStack::create(); + * $stack->push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/discovery/v1/', + * 'auth' => 'simple' + * ]); + * + * $res = $client->get('drive/v2/rest'); + * + * @param callable $handler + * @return \Closure + */ + public function __invoke(callable $handler) + { + return function (RequestInterface $request, array $options) use ($handler) { + // Requests using "auth"="scoped" will be authorized. + if (!isset($options['auth']) || $options['auth'] !== 'simple') { + return $handler($request, $options); + } + + $query = Query::parse($request->getUri()->getQuery()); + $params = array_merge($query, $this->config); + $uri = $request->getUri()->withQuery(Query::build($params)); + $request = $request->withUri($uri); + + return $handler($request, $options); + }; + } +} diff --git a/vendor/google/auth/src/OAuth2.php b/vendor/google/auth/src/OAuth2.php new file mode 100644 index 00000000..9c7c659e --- /dev/null +++ b/vendor/google/auth/src/OAuth2.php @@ -0,0 +1,1435 @@ + self::DEFAULT_EXPIRY_SECONDS, + 'extensionParams' => [], + 'authorizationUri' => null, + 'redirectUri' => null, + 'tokenCredentialUri' => null, + 'state' => null, + 'username' => null, + 'password' => null, + 'clientId' => null, + 'clientSecret' => null, + 'issuer' => null, + 'sub' => null, + 'audience' => null, + 'signingKey' => null, + 'signingKeyId' => null, + 'signingAlgorithm' => null, + 'scope' => null, + 'additionalClaims' => [], + ], $config); + + $this->setAuthorizationUri($opts['authorizationUri']); + $this->setRedirectUri($opts['redirectUri']); + $this->setTokenCredentialUri($opts['tokenCredentialUri']); + $this->setState($opts['state']); + $this->setUsername($opts['username']); + $this->setPassword($opts['password']); + $this->setClientId($opts['clientId']); + $this->setClientSecret($opts['clientSecret']); + $this->setIssuer($opts['issuer']); + $this->setSub($opts['sub']); + $this->setExpiry($opts['expiry']); + $this->setAudience($opts['audience']); + $this->setSigningKey($opts['signingKey']); + $this->setSigningKeyId($opts['signingKeyId']); + $this->setSigningAlgorithm($opts['signingAlgorithm']); + $this->setScope($opts['scope']); + $this->setExtensionParams($opts['extensionParams']); + $this->setAdditionalClaims($opts['additionalClaims']); + $this->updateToken($opts); + } + + /** + * Verifies the idToken if present. + * + * - if none is present, return null + * - if present, but invalid, raises DomainException. + * - otherwise returns the payload in the idtoken as a PHP object. + * + * The behavior of this method varies depending on the version of + * `firebase/php-jwt` you are using. In versions lower than 3.0.0, if + * `$publicKey` is null, the key is decoded without being verified. In + * newer versions, if a public key is not given, this method will throw an + * `\InvalidArgumentException`. + * + * @param string $publicKey The public key to use to authenticate the token + * @param array $allowed_algs List of supported verification algorithms + * @throws \DomainException if the token is missing an audience. + * @throws \DomainException if the audience does not match the one set in + * the OAuth2 class instance. + * @throws \UnexpectedValueException If the token is invalid + * @throws SignatureInvalidException If the signature is invalid. + * @throws BeforeValidException If the token is not yet valid. + * @throws ExpiredException If the token has expired. + * @return null|object + */ + public function verifyIdToken($publicKey = null, $allowed_algs = array()) + { + $idToken = $this->getIdToken(); + if (is_null($idToken)) { + return null; + } + + $resp = $this->jwtDecode($idToken, $publicKey, $allowed_algs); + if (!property_exists($resp, 'aud')) { + throw new \DomainException('No audience found the id token'); + } + if ($resp->aud != $this->getAudience()) { + throw new \DomainException('Wrong audience present in the id token'); + } + + return $resp; + } + + /** + * Obtains the encoded jwt from the instance data. + * + * @param array $config array optional configuration parameters + * @return string + */ + public function toJwt(array $config = []) + { + if (is_null($this->getSigningKey())) { + throw new \DomainException('No signing key available'); + } + if (is_null($this->getSigningAlgorithm())) { + throw new \DomainException('No signing algorithm specified'); + } + $now = time(); + + $opts = array_merge([ + 'skew' => self::DEFAULT_SKEW_SECONDS, + ], $config); + + $assertion = [ + 'iss' => $this->getIssuer(), + 'exp' => ($now + $this->getExpiry()), + 'iat' => ($now - $opts['skew']), + ]; + foreach ($assertion as $k => $v) { + if (is_null($v)) { + throw new \DomainException($k . ' should not be null'); + } + } + if (!(is_null($this->getAudience()))) { + $assertion['aud'] = $this->getAudience(); + } + + if (!(is_null($this->getScope()))) { + $assertion['scope'] = $this->getScope(); + } + + if (empty($assertion['scope']) && empty($assertion['aud'])) { + throw new \DomainException('one of scope or aud should not be null'); + } + + if (!(is_null($this->getSub()))) { + $assertion['sub'] = $this->getSub(); + } + $assertion += $this->getAdditionalClaims(); + + return $this->jwtEncode( + $assertion, + $this->getSigningKey(), + $this->getSigningAlgorithm(), + $this->getSigningKeyId() + ); + } + + /** + * Generates a request for token credentials. + * + * @return RequestInterface the authorization Url. + */ + public function generateCredentialsRequest() + { + $uri = $this->getTokenCredentialUri(); + if (is_null($uri)) { + throw new \DomainException('No token credential URI was set.'); + } + + $grantType = $this->getGrantType(); + $params = array('grant_type' => $grantType); + switch ($grantType) { + case 'authorization_code': + $params['code'] = $this->getCode(); + $params['redirect_uri'] = $this->getRedirectUri(); + $this->addClientCredentials($params); + break; + case 'password': + $params['username'] = $this->getUsername(); + $params['password'] = $this->getPassword(); + $this->addClientCredentials($params); + break; + case 'refresh_token': + $params['refresh_token'] = $this->getRefreshToken(); + $this->addClientCredentials($params); + break; + case self::JWT_URN: + $params['assertion'] = $this->toJwt(); + break; + default: + if (!is_null($this->getRedirectUri())) { + # Grant type was supposed to be 'authorization_code', as there + # is a redirect URI. + throw new \DomainException('Missing authorization code'); + } + unset($params['grant_type']); + if (!is_null($grantType)) { + $params['grant_type'] = $grantType; + } + $params = array_merge($params, $this->getExtensionParams()); + } + + $headers = [ + 'Cache-Control' => 'no-store', + 'Content-Type' => 'application/x-www-form-urlencoded', + ]; + + return new Request( + 'POST', + $uri, + $headers, + Query::build($params) + ); + } + + /** + * Fetches the auth tokens based on the current state. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return array the response + */ + public function fetchAuthToken(callable $httpHandler = null) + { + if (is_null($httpHandler)) { + $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + } + + $response = $httpHandler($this->generateCredentialsRequest()); + $credentials = $this->parseTokenResponse($response); + $this->updateToken($credentials); + + return $credentials; + } + + /** + * Obtains a key that can used to cache the results of #fetchAuthToken. + * + * The key is derived from the scopes. + * + * @return string a key that may be used to cache the auth token. + */ + public function getCacheKey() + { + if (is_array($this->scope)) { + return implode(':', $this->scope); + } + + if ($this->audience) { + return $this->audience; + } + + // If scope has not set, return null to indicate no caching. + return null; + } + + /** + * Parses the fetched tokens. + * + * @param ResponseInterface $resp the response. + * @return array the tokens parsed from the response body. + * @throws \Exception + */ + public function parseTokenResponse(ResponseInterface $resp) + { + $body = (string)$resp->getBody(); + if ($resp->hasHeader('Content-Type') && + $resp->getHeaderLine('Content-Type') == 'application/x-www-form-urlencoded' + ) { + $res = array(); + parse_str($body, $res); + + return $res; + } + + // Assume it's JSON; if it's not throw an exception + if (null === $res = json_decode($body, true)) { + throw new \Exception('Invalid JSON response'); + } + + return $res; + } + + /** + * Updates an OAuth 2.0 client. + * + * Example: + * ``` + * $oauth->updateToken([ + * 'refresh_token' => 'n4E9O119d', + * 'access_token' => 'FJQbwq9', + * 'expires_in' => 3600 + * ]); + * ``` + * + * @param array $config + * The configuration parameters related to the token. + * + * - refresh_token + * The refresh token associated with the access token + * to be refreshed. + * + * - access_token + * The current access token for this client. + * + * - id_token + * The current ID token for this client. + * + * - expires_in + * The time in seconds until access token expiration. + * + * - expires_at + * The time as an integer number of seconds since the Epoch + * + * - issued_at + * The timestamp that the token was issued at. + */ + public function updateToken(array $config) + { + $opts = array_merge([ + 'extensionParams' => [], + 'access_token' => null, + 'id_token' => null, + 'expires_in' => null, + 'expires_at' => null, + 'issued_at' => null, + ], $config); + + $this->setExpiresAt($opts['expires_at']); + $this->setExpiresIn($opts['expires_in']); + // By default, the token is issued at `Time.now` when `expiresIn` is set, + // but this can be used to supply a more precise time. + if (!is_null($opts['issued_at'])) { + $this->setIssuedAt($opts['issued_at']); + } + + $this->setAccessToken($opts['access_token']); + $this->setIdToken($opts['id_token']); + // The refresh token should only be updated if a value is explicitly + // passed in, as some access token responses do not include a refresh + // token. + if (array_key_exists('refresh_token', $opts)) { + $this->setRefreshToken($opts['refresh_token']); + } + } + + /** + * Builds the authorization Uri that the user should be redirected to. + * + * @param array $config configuration options that customize the return url + * @return UriInterface the authorization Url. + * @throws InvalidArgumentException + */ + public function buildFullAuthorizationUri(array $config = []) + { + if (is_null($this->getAuthorizationUri())) { + throw new InvalidArgumentException( + 'requires an authorizationUri to have been set' + ); + } + + $params = array_merge([ + 'response_type' => 'code', + 'access_type' => 'offline', + 'client_id' => $this->clientId, + 'redirect_uri' => $this->redirectUri, + 'state' => $this->state, + 'scope' => $this->getScope(), + ], $config); + + // Validate the auth_params + if (is_null($params['client_id'])) { + throw new InvalidArgumentException( + 'missing the required client identifier' + ); + } + if (is_null($params['redirect_uri'])) { + throw new InvalidArgumentException('missing the required redirect URI'); + } + if (!empty($params['prompt']) && !empty($params['approval_prompt'])) { + throw new InvalidArgumentException( + 'prompt and approval_prompt are mutually exclusive' + ); + } + + // Construct the uri object; return it if it is valid. + $result = clone $this->authorizationUri; + $existingParams = Query::parse($result->getQuery()); + + $result = $result->withQuery( + Query::build(array_merge($existingParams, $params)) + ); + + if ($result->getScheme() != 'https') { + throw new InvalidArgumentException( + 'Authorization endpoint must be protected by TLS' + ); + } + + return $result; + } + + /** + * Sets the authorization server's HTTP endpoint capable of authenticating + * the end-user and obtaining authorization. + * + * @param string $uri + */ + public function setAuthorizationUri($uri) + { + $this->authorizationUri = $this->coerceUri($uri); + } + + /** + * Gets the authorization server's HTTP endpoint capable of authenticating + * the end-user and obtaining authorization. + * + * @return UriInterface + */ + public function getAuthorizationUri() + { + return $this->authorizationUri; + } + + /** + * Gets the authorization server's HTTP endpoint capable of issuing tokens + * and refreshing expired tokens. + * + * @return string + */ + public function getTokenCredentialUri() + { + return $this->tokenCredentialUri; + } + + /** + * Sets the authorization server's HTTP endpoint capable of issuing tokens + * and refreshing expired tokens. + * + * @param string $uri + */ + public function setTokenCredentialUri($uri) + { + $this->tokenCredentialUri = $this->coerceUri($uri); + } + + /** + * Gets the redirection URI used in the initial request. + * + * @return string + */ + public function getRedirectUri() + { + return $this->redirectUri; + } + + /** + * Sets the redirection URI used in the initial request. + * + * @param string $uri + */ + public function setRedirectUri($uri) + { + if (is_null($uri)) { + $this->redirectUri = null; + + return; + } + // redirect URI must be absolute + if (!$this->isAbsoluteUri($uri)) { + // "postmessage" is a reserved URI string in Google-land + // @see https://developers.google.com/identity/sign-in/web/server-side-flow + if ('postmessage' !== (string)$uri) { + throw new InvalidArgumentException( + 'Redirect URI must be absolute' + ); + } + } + $this->redirectUri = (string)$uri; + } + + /** + * Gets the scope of the access requests as a space-delimited String. + * + * @return string + */ + public function getScope() + { + if (is_null($this->scope)) { + return $this->scope; + } + + return implode(' ', $this->scope); + } + + /** + * Sets the scope of the access request, expressed either as an Array or as + * a space-delimited String. + * + * @param string|array $scope + * @throws InvalidArgumentException + */ + public function setScope($scope) + { + if (is_null($scope)) { + $this->scope = null; + } elseif (is_string($scope)) { + $this->scope = explode(' ', $scope); + } elseif (is_array($scope)) { + foreach ($scope as $s) { + $pos = strpos($s, ' '); + if ($pos !== false) { + throw new InvalidArgumentException( + 'array scope values should not contain spaces' + ); + } + } + $this->scope = $scope; + } else { + throw new InvalidArgumentException( + 'scopes should be a string or array of strings' + ); + } + } + + /** + * Gets the current grant type. + * + * @return string + */ + public function getGrantType() + { + if (!is_null($this->grantType)) { + return $this->grantType; + } + + // Returns the inferred grant type, based on the current object instance + // state. + if (!is_null($this->code)) { + return 'authorization_code'; + } + + if (!is_null($this->refreshToken)) { + return 'refresh_token'; + } + + if (!is_null($this->username) && !is_null($this->password)) { + return 'password'; + } + + if (!is_null($this->issuer) && !is_null($this->signingKey)) { + return self::JWT_URN; + } + + return null; + } + + /** + * Sets the current grant type. + * + * @param $grantType + * @throws InvalidArgumentException + */ + public function setGrantType($grantType) + { + if (in_array($grantType, self::$knownGrantTypes)) { + $this->grantType = $grantType; + } else { + // validate URI + if (!$this->isAbsoluteUri($grantType)) { + throw new InvalidArgumentException( + 'invalid grant type' + ); + } + $this->grantType = (string)$grantType; + } + } + + /** + * Gets an arbitrary string designed to allow the client to maintain state. + * + * @return string + */ + public function getState() + { + return $this->state; + } + + /** + * Sets an arbitrary string designed to allow the client to maintain state. + * + * @param string $state + */ + public function setState($state) + { + $this->state = $state; + } + + /** + * Gets the authorization code issued to this client. + */ + public function getCode() + { + return $this->code; + } + + /** + * Sets the authorization code issued to this client. + * + * @param string $code + */ + public function setCode($code) + { + $this->code = $code; + } + + /** + * Gets the resource owner's username. + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the resource owner's username. + * + * @param string $username + */ + public function setUsername($username) + { + $this->username = $username; + } + + /** + * Gets the resource owner's password. + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the resource owner's password. + * + * @param $password + */ + public function setPassword($password) + { + $this->password = $password; + } + + /** + * Sets a unique identifier issued to the client to identify itself to the + * authorization server. + */ + public function getClientId() + { + return $this->clientId; + } + + /** + * Sets a unique identifier issued to the client to identify itself to the + * authorization server. + * + * @param $clientId + */ + public function setClientId($clientId) + { + $this->clientId = $clientId; + } + + /** + * Gets a shared symmetric secret issued by the authorization server, which + * is used to authenticate the client. + */ + public function getClientSecret() + { + return $this->clientSecret; + } + + /** + * Sets a shared symmetric secret issued by the authorization server, which + * is used to authenticate the client. + * + * @param $clientSecret + */ + public function setClientSecret($clientSecret) + { + $this->clientSecret = $clientSecret; + } + + /** + * Gets the Issuer ID when using assertion profile. + */ + public function getIssuer() + { + return $this->issuer; + } + + /** + * Sets the Issuer ID when using assertion profile. + * + * @param string $issuer + */ + public function setIssuer($issuer) + { + $this->issuer = $issuer; + } + + /** + * Gets the target sub when issuing assertions. + */ + public function getSub() + { + return $this->sub; + } + + /** + * Sets the target sub when issuing assertions. + * + * @param string $sub + */ + public function setSub($sub) + { + $this->sub = $sub; + } + + /** + * Gets the target audience when issuing assertions. + */ + public function getAudience() + { + return $this->audience; + } + + /** + * Sets the target audience when issuing assertions. + * + * @param string $audience + */ + public function setAudience($audience) + { + $this->audience = $audience; + } + + /** + * Gets the signing key when using an assertion profile. + */ + public function getSigningKey() + { + return $this->signingKey; + } + + /** + * Sets the signing key when using an assertion profile. + * + * @param string $signingKey + */ + public function setSigningKey($signingKey) + { + $this->signingKey = $signingKey; + } + + /** + * Gets the signing key id when using an assertion profile. + * + * @return string + */ + public function getSigningKeyId() + { + return $this->signingKeyId; + } + + /** + * Sets the signing key id when using an assertion profile. + * + * @param string $signingKeyId + */ + public function setSigningKeyId($signingKeyId) + { + $this->signingKeyId = $signingKeyId; + } + + /** + * Gets the signing algorithm when using an assertion profile. + * + * @return string + */ + public function getSigningAlgorithm() + { + return $this->signingAlgorithm; + } + + /** + * Sets the signing algorithm when using an assertion profile. + * + * @param string $signingAlgorithm + */ + public function setSigningAlgorithm($signingAlgorithm) + { + if (is_null($signingAlgorithm)) { + $this->signingAlgorithm = null; + } elseif (!in_array($signingAlgorithm, self::$knownSigningAlgorithms)) { + throw new InvalidArgumentException('unknown signing algorithm'); + } else { + $this->signingAlgorithm = $signingAlgorithm; + } + } + + /** + * Gets the set of parameters used by extension when using an extension + * grant type. + */ + public function getExtensionParams() + { + return $this->extensionParams; + } + + /** + * Sets the set of parameters used by extension when using an extension + * grant type. + * + * @param $extensionParams + */ + public function setExtensionParams($extensionParams) + { + $this->extensionParams = $extensionParams; + } + + /** + * Gets the number of seconds assertions are valid for. + */ + public function getExpiry() + { + return $this->expiry; + } + + /** + * Sets the number of seconds assertions are valid for. + * + * @param int $expiry + */ + public function setExpiry($expiry) + { + $this->expiry = $expiry; + } + + /** + * Gets the lifetime of the access token in seconds. + */ + public function getExpiresIn() + { + return $this->expiresIn; + } + + /** + * Sets the lifetime of the access token in seconds. + * + * @param int $expiresIn + */ + public function setExpiresIn($expiresIn) + { + if (is_null($expiresIn)) { + $this->expiresIn = null; + $this->issuedAt = null; + } else { + $this->issuedAt = time(); + $this->expiresIn = (int)$expiresIn; + } + } + + /** + * Gets the time the current access token expires at. + * + * @return int + */ + public function getExpiresAt() + { + if (!is_null($this->expiresAt)) { + return $this->expiresAt; + } + + if (!is_null($this->issuedAt) && !is_null($this->expiresIn)) { + return $this->issuedAt + $this->expiresIn; + } + + return null; + } + + /** + * Returns true if the acccess token has expired. + * + * @return bool + */ + public function isExpired() + { + $expiration = $this->getExpiresAt(); + $now = time(); + + return !is_null($expiration) && $now >= $expiration; + } + + /** + * Sets the time the current access token expires at. + * + * @param int $expiresAt + */ + public function setExpiresAt($expiresAt) + { + $this->expiresAt = $expiresAt; + } + + /** + * Gets the time the current access token was issued at. + */ + public function getIssuedAt() + { + return $this->issuedAt; + } + + /** + * Sets the time the current access token was issued at. + * + * @param int $issuedAt + */ + public function setIssuedAt($issuedAt) + { + $this->issuedAt = $issuedAt; + } + + /** + * Gets the current access token. + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets the current access token. + * + * @param string $accessToken + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + } + + /** + * Gets the current ID token. + */ + public function getIdToken() + { + return $this->idToken; + } + + /** + * Sets the current ID token. + * + * @param $idToken + */ + public function setIdToken($idToken) + { + $this->idToken = $idToken; + } + + /** + * Gets the refresh token associated with the current access token. + */ + public function getRefreshToken() + { + return $this->refreshToken; + } + + /** + * Sets the refresh token associated with the current access token. + * + * @param $refreshToken + */ + public function setRefreshToken($refreshToken) + { + $this->refreshToken = $refreshToken; + } + + /** + * Sets additional claims to be included in the JWT token + * + * @param array $additionalClaims + */ + public function setAdditionalClaims(array $additionalClaims) + { + $this->additionalClaims = $additionalClaims; + } + + /** + * Gets the additional claims to be included in the JWT token. + * + * @return array + */ + public function getAdditionalClaims() + { + return $this->additionalClaims; + } + + /** + * The expiration of the last received token. + * + * @return array|null + */ + public function getLastReceivedToken() + { + if ($token = $this->getAccessToken()) { + // the bare necessity of an auth token + $authToken = [ + 'access_token' => $token, + 'expires_at' => $this->getExpiresAt(), + ]; + } elseif ($idToken = $this->getIdToken()) { + $authToken = [ + 'id_token' => $idToken, + 'expires_at' => $this->getExpiresAt(), + ]; + } else { + return null; + } + + if ($expiresIn = $this->getExpiresIn()) { + $authToken['expires_in'] = $expiresIn; + } + if ($issuedAt = $this->getIssuedAt()) { + $authToken['issued_at'] = $issuedAt; + } + if ($refreshToken = $this->getRefreshToken()) { + $authToken['refresh_token'] = $refreshToken; + } + + return $authToken; + } + + /** + * Get the client ID. + * + * Alias of {@see Google\Auth\OAuth2::getClientId()}. + * + * @param callable $httpHandler + * @return string + * @access private + */ + public function getClientName(callable $httpHandler = null) + { + return $this->getClientId(); + } + + /** + * @todo handle uri as array + * + * @param string $uri + * @return null|UriInterface + */ + private function coerceUri($uri) + { + if (is_null($uri)) { + return; + } + + return Utils::uriFor($uri); + } + + /** + * @param string $idToken + * @param string|array|null $publicKey + * @param array $allowedAlgs + * @return object + */ + private function jwtDecode($idToken, $publicKey, $allowedAlgs) + { + if (class_exists('Firebase\JWT\JWT')) { + return \Firebase\JWT\JWT::decode($idToken, $publicKey, $allowedAlgs); + } + + return \JWT::decode($idToken, $publicKey, $allowedAlgs); + } + + private function jwtEncode($assertion, $signingKey, $signingAlgorithm, $signingKeyId = null) + { + if (class_exists('Firebase\JWT\JWT')) { + return \Firebase\JWT\JWT::encode( + $assertion, + $signingKey, + $signingAlgorithm, + $signingKeyId + ); + } + + return \JWT::encode($assertion, $signingKey, $signingAlgorithm, $signingKeyId); + } + + /** + * Determines if the URI is absolute based on its scheme and host or path + * (RFC 3986). + * + * @param string $uri + * @return bool + */ + private function isAbsoluteUri($uri) + { + $uri = $this->coerceUri($uri); + + return $uri->getScheme() && ($uri->getHost() || $uri->getPath()); + } + + /** + * @param array $params + * @return array + */ + private function addClientCredentials(&$params) + { + $clientId = $this->getClientId(); + $clientSecret = $this->getClientSecret(); + + if ($clientId && $clientSecret) { + $params['client_id'] = $clientId; + $params['client_secret'] = $clientSecret; + } + + return $params; + } +} diff --git a/vendor/google/auth/src/ProjectIdProviderInterface.php b/vendor/google/auth/src/ProjectIdProviderInterface.php new file mode 100644 index 00000000..0a41f783 --- /dev/null +++ b/vendor/google/auth/src/ProjectIdProviderInterface.php @@ -0,0 +1,32 @@ +auth->getSigningKey(); + + $signedString = ''; + if (class_exists('\\phpseclib\\Crypt\\RSA') && !$forceOpenssl) { + $rsa = new RSA(); + $rsa->loadKey($privateKey); + $rsa->setSignatureMode(RSA::SIGNATURE_PKCS1); + $rsa->setHash('sha256'); + + $signedString = $rsa->sign($stringToSign); + } elseif (extension_loaded('openssl')) { + openssl_sign($stringToSign, $signedString, $privateKey, 'sha256WithRSAEncryption'); + } else { + // @codeCoverageIgnoreStart + throw new \RuntimeException('OpenSSL is not installed.'); + } + // @codeCoverageIgnoreEnd + + return base64_encode($signedString); + } +} diff --git a/vendor/google/auth/src/SignBlobInterface.php b/vendor/google/auth/src/SignBlobInterface.php new file mode 100644 index 00000000..5f2c9441 --- /dev/null +++ b/vendor/google/auth/src/SignBlobInterface.php @@ -0,0 +1,44 @@ +' + */ +class AuthTokenSubscriber implements SubscriberInterface +{ + /** + * @var callable + */ + private $httpHandler; + + /** + * @var FetchAuthTokenInterface + */ + private $fetcher; + + /** + * @var callable + */ + private $tokenCallback; + + /** + * Creates a new AuthTokenSubscriber. + * + * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token + * @param callable $httpHandler (optional) http client to fetch the token. + * @param callable $tokenCallback (optional) function to be called when a new token is fetched. + */ + public function __construct( + FetchAuthTokenInterface $fetcher, + callable $httpHandler = null, + callable $tokenCallback = null + ) { + $this->fetcher = $fetcher; + $this->httpHandler = $httpHandler; + $this->tokenCallback = $tokenCallback; + } + + /** + * @return array + */ + public function getEvents() + { + return ['before' => ['onBefore', RequestEvents::SIGN_REQUEST]]; + } + + /** + * Updates the request with an Authorization header when auth is 'fetched_auth_token'. + * + * Example: + * ``` + * use GuzzleHttp\Client; + * use Google\Auth\OAuth2; + * use Google\Auth\Subscriber\AuthTokenSubscriber; + * + * $config = [...]; + * $oauth2 = new OAuth2($config) + * $subscriber = new AuthTokenSubscriber($oauth2); + * + * $client = new Client([ + * 'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'defaults' => ['auth' => 'google_auth'] + * ]); + * $client->getEmitter()->attach($subscriber); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + * ``` + * + * @param BeforeEvent $event + */ + public function onBefore(BeforeEvent $event) + { + // Requests using "auth"="google_auth" will be authorized. + $request = $event->getRequest(); + if ($request->getConfig()['auth'] != 'google_auth') { + return; + } + + // Fetch the auth token. + $auth_tokens = $this->fetcher->fetchAuthToken($this->httpHandler); + if (array_key_exists('access_token', $auth_tokens)) { + $request->setHeader('authorization', 'Bearer ' . $auth_tokens['access_token']); + + // notify the callback if applicable + if ($this->tokenCallback) { + call_user_func($this->tokenCallback, $this->fetcher->getCacheKey(), $auth_tokens['access_token']); + } + } + + if ($quotaProject = $this->getQuotaProject()) { + $request->setHeader( + GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER, + $quotaProject + ); + } + } + + private function getQuotaProject() + { + if ($this->fetcher instanceof GetQuotaProjectInterface) { + return $this->fetcher->getQuotaProject(); + } + } +} diff --git a/vendor/google/auth/src/Subscriber/ScopedAccessTokenSubscriber.php b/vendor/google/auth/src/Subscriber/ScopedAccessTokenSubscriber.php new file mode 100644 index 00000000..a52dccef --- /dev/null +++ b/vendor/google/auth/src/Subscriber/ScopedAccessTokenSubscriber.php @@ -0,0 +1,180 @@ +' + */ +class ScopedAccessTokenSubscriber implements SubscriberInterface +{ + use CacheTrait; + + const DEFAULT_CACHE_LIFETIME = 1500; + + /** + * @var CacheItemPoolInterface + */ + private $cache; + + /** + * @var callable The access token generator function + */ + private $tokenFunc; + + /** + * @var array|string The scopes used to generate the token + */ + private $scopes; + + /** + * @var array + */ + private $cacheConfig; + + /** + * Creates a new ScopedAccessTokenSubscriber. + * + * @param callable $tokenFunc a token generator function + * @param array|string $scopes the token authentication scopes + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache an implementation of CacheItemPoolInterface + */ + public function __construct( + callable $tokenFunc, + $scopes, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null + ) { + $this->tokenFunc = $tokenFunc; + if (!(is_string($scopes) || is_array($scopes))) { + throw new \InvalidArgumentException( + 'wants scope should be string or array' + ); + } + $this->scopes = $scopes; + + if (!is_null($cache)) { + $this->cache = $cache; + $this->cacheConfig = array_merge([ + 'lifetime' => self::DEFAULT_CACHE_LIFETIME, + 'prefix' => '', + ], $cacheConfig); + } + } + + /** + * @return array + */ + public function getEvents() + { + return ['before' => ['onBefore', RequestEvents::SIGN_REQUEST]]; + } + + /** + * Updates the request with an Authorization header when auth is 'scoped'. + * + * E.g this could be used to authenticate using the AppEngine AppIdentityService. + * + * Example: + * ``` + * use google\appengine\api\app_identity\AppIdentityService; + * use Google\Auth\Subscriber\ScopedAccessTokenSubscriber; + * use GuzzleHttp\Client; + * + * $scope = 'https://www.googleapis.com/auth/taskqueue' + * $subscriber = new ScopedAccessToken( + * 'AppIdentityService::getAccessToken', + * $scope, + * ['prefix' => 'Google\Auth\ScopedAccessToken::'], + * $cache = new Memcache() + * ); + * + * $client = new Client([ + * 'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'defaults' => ['auth' => 'scoped'] + * ]); + * $client->getEmitter()->attach($subscriber); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + * ``` + * + * @param BeforeEvent $event + */ + public function onBefore(BeforeEvent $event) + { + // Requests using "auth"="scoped" will be authorized. + $request = $event->getRequest(); + if ($request->getConfig()['auth'] != 'scoped') { + return; + } + $auth_header = 'Bearer ' . $this->fetchToken(); + $request->setHeader('authorization', $auth_header); + } + + /** + * @return string + */ + private function getCacheKey() + { + $key = null; + + if (is_string($this->scopes)) { + $key .= $this->scopes; + } elseif (is_array($this->scopes)) { + $key .= implode(':', $this->scopes); + } + + return $key; + } + + /** + * Determine if token is available in the cache, if not call tokenFunc to + * fetch it. + * + * @return string + */ + private function fetchToken() + { + $cacheKey = $this->getCacheKey(); + $cached = $this->getCachedValue($cacheKey); + + if (!empty($cached)) { + return $cached; + } + + $token = call_user_func($this->tokenFunc, $this->scopes); + $this->setCachedValue($cacheKey, $token); + + return $token; + } +} diff --git a/vendor/google/auth/src/Subscriber/SimpleSubscriber.php b/vendor/google/auth/src/Subscriber/SimpleSubscriber.php new file mode 100644 index 00000000..a881eb19 --- /dev/null +++ b/vendor/google/auth/src/Subscriber/SimpleSubscriber.php @@ -0,0 +1,93 @@ +config = array_merge([], $config); + } + + /** + * @return array + */ + public function getEvents() + { + return ['before' => ['onBefore', RequestEvents::SIGN_REQUEST]]; + } + + /** + * Updates the request query with the developer key if auth is set to simple. + * + * Example: + * ``` + * use Google\Auth\Subscriber\SimpleSubscriber; + * use GuzzleHttp\Client; + * + * $my_key = 'is not the same as yours'; + * $subscriber = new SimpleSubscriber(['key' => $my_key]); + * + * $client = new Client([ + * 'base_url' => 'https://www.googleapis.com/discovery/v1/', + * 'defaults' => ['auth' => 'simple'] + * ]); + * $client->getEmitter()->attach($subscriber); + * + * $res = $client->get('drive/v2/rest'); + * ``` + * + * @param BeforeEvent $event + */ + public function onBefore(BeforeEvent $event) + { + // Requests using "auth"="simple" with the developer key. + $request = $event->getRequest(); + if ($request->getConfig()['auth'] != 'simple') { + return; + } + $request->getQuery()->overwriteWith($this->config); + } +} diff --git a/vendor/google/auth/src/UpdateMetadataInterface.php b/vendor/google/auth/src/UpdateMetadataInterface.php new file mode 100644 index 00000000..d28b75c5 --- /dev/null +++ b/vendor/google/auth/src/UpdateMetadataInterface.php @@ -0,0 +1,41 @@ +run(); + } else { + $idNum = (int) $argv[2]; + $job = $daemon->job($idNum); + $job->run(); + } +} elseif ($argv[1] === 'retry') { + $retry = new Retry(); + $retry->retryAll(); +} else { + showUsageAndDie(); +} diff --git a/vendor/google/cloud-core/composer.json b/vendor/google/cloud-core/composer.json new file mode 100644 index 00000000..8fac5b0b --- /dev/null +++ b/vendor/google/cloud-core/composer.json @@ -0,0 +1,50 @@ +{ + "name": "google/cloud-core", + "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", + "license": "Apache-2.0", + "minimum-stability": "stable", + "require": { + "php": ">=5.5", + "rize/uri-template": "~0.3", + "google/auth": "^1.18", + "guzzlehttp/guzzle": "^5.3|^6.0|^7.0", + "guzzlehttp/promises": "^1.3", + "guzzlehttp/psr7": "^1.7|^2.0", + "monolog/monolog": "^1.1|^2.0", + "psr/http-message": "1.0.*" + }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0", + "squizlabs/php_codesniffer": "2.*", + "phpdocumentor/reflection": "^3.0", + "erusev/parsedown": "^1.6", + "google/gax": "^1.9", + "opis/closure": "^3", + "google/common-protos": "^1.0||^2.0" + }, + "suggest": { + "opis/closure": "May be used to serialize closures to process jobs in the batch daemon. Please require version ^3.", + "symfony/lock": "Required for the Spanner cached based session pool. Please require the following commit: 3.3.x-dev#1ba6ac9" + }, + "extra": { + "component": { + "id": "cloud-core", + "target": "googleapis/google-cloud-php-core.git", + "path": "Core", + "entry": "src/ServiceBuilder.php" + } + }, + "bin": [ + "bin/google-cloud-batch" + ], + "autoload": { + "psr-4": { + "Google\\Cloud\\Core\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Google\\Cloud\\Core\\Tests\\": "tests" + } + } +} diff --git a/vendor/google/cloud-core/perf-bootstrap.php b/vendor/google/cloud-core/perf-bootstrap.php new file mode 100644 index 00000000..9a4f8eb8 --- /dev/null +++ b/vendor/google/cloud-core/perf-bootstrap.php @@ -0,0 +1,5 @@ + null + ]; + + /** + * Fetches the auth token. In this case it returns a null value. + * + * @param callable $httpHandler + * @return array + */ + public function fetchAuthToken(callable $httpHandler = null) + { + return $this->token; + } + + /** + * Returns the cache key. In this case it returns a null value, disabling + * caching. + * + * @return string|null + */ + public function getCacheKey() + { + return null; + } + + /** + * Fetches the last received token. In this case, it returns the same null + * auth token. + * + * @return array + */ + public function getLastReceivedToken() + { + return $this->token; + } + + /** + * This method has no effect for AnonymousCredentials. + * + * @param array $metadata metadata hashmap + * @param string $authUri optional auth uri + * @param callable $httpHandler callback which delivers psr7 request + * @return array updated metadata hashmap + */ + public function updateMetadata( + $metadata, + $authUri = null, + callable $httpHandler = null + ) { + return $metadata; + } + + /** + * This method always returns null for AnonymousCredentials. + * + * @return string|null + */ + public function getQuotaProject() + { + return null; + } +} diff --git a/vendor/google/cloud-core/src/ArrayTrait.php b/vendor/google/cloud-core/src/ArrayTrait.php new file mode 100644 index 00000000..86549332 --- /dev/null +++ b/vendor/google/cloud-core/src/ArrayTrait.php @@ -0,0 +1,128 @@ +pluck($key, $arr, false); + } + } + + return $values; + } + + /** + * Determine whether given array is associative. + * If $arr is empty, then $onEmpty will be returned + * $onEmpty defaults to true to maintain compatibility + * with the current usage. + * + * @param array $arr + * @param bool $onEmpty + * @return bool + */ + private function isAssoc(array $arr, $onEmpty = true) + { + if (empty($arr)) { + return $onEmpty; + } + + return array_keys($arr) !== range(0, count($arr) - 1); + } + + /** + * Just like array_filter(), but preserves falsey values except null. + * + * @param array $arr + * @return array + */ + private function arrayFilterRemoveNull(array $arr) + { + return array_filter($arr, function ($element) { + return !is_null($element); + }); + } + + /** + * A method, similar to PHP's `array_merge_recursive`, with two differences. + * + * 1. Keys in $array2 take precedence over keys in $array1. + * 2. Non-array keys found in both inputs are not transformed into an array + * and appended. Rather, the value in $array2 is used. + * + * @param array $array1 + * @param array $array2 + * @return array + */ + private function arrayMergeRecursive(array $array1, array $array2) + { + foreach ($array2 as $key => $value) { + if (array_key_exists($key, $array1) && is_array($array1[$key]) && is_array($value)) { + $array1[$key] = ($this->isAssoc($array1[$key]) && $this->isAssoc($value)) + ? $this->arrayMergeRecursive($array1[$key], $value) + : array_merge($array1[$key], $value); + } else { + $array1[$key] = $value; + } + } + + return $array1; + } +} diff --git a/vendor/google/cloud-core/src/Batch/BatchDaemon.php b/vendor/google/cloud-core/src/Batch/BatchDaemon.php new file mode 100644 index 00000000..d92fd3c9 --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/BatchDaemon.php @@ -0,0 +1,162 @@ +isSysvIPCLoaded()) { + throw new \RuntimeException('SystemV IPC extensions are missing.'); + } + $this->runner = new BatchRunner( + new SysvConfigStorage(), + new SysvProcessor() + ); + $this->shutdown = false; + // Just share the usual descriptors. + $this->descriptorSpec = [ + 0 => ['file', 'php://stdin', 'r'], + 1 => ['file', 'php://stdout', 'w'], + 2 => ['file', 'php://stderr', 'w'] + ]; + + $this->command = sprintf('exec php -d auto_prepend_file="" %s daemon', $entrypoint); + $this->initFailureFile(); + } + + /** + * A loop for the parent. + * + * @return void + */ + public function run() + { + $this->setupSignalHandlers(); + + $procs = []; + while (true) { + $jobs = $this->runner->getJobs(); + foreach ($jobs as $job) { + if (! array_key_exists($job->identifier(), $procs)) { + $procs[$job->identifier()] = []; + } + while (count($procs[$job->identifier()]) > $job->numWorkers()) { + // Stopping an excessive child. + echo 'Stopping an excessive child.' . PHP_EOL; + $proc = array_pop($procs[$job->identifier()]); + $status = proc_get_status($proc); + // Keep sending SIGTERM until the child exits. + while ($status['running'] === true) { + @proc_terminate($proc); + usleep(50000); + $status = proc_get_status($proc); + } + @proc_close($proc); + } + for ($i = 0; $i < $job->numWorkers(); $i++) { + $needStart = false; + if (array_key_exists($i, $procs[$job->identifier()])) { + $status = proc_get_status($procs[$job->identifier()][$i]); + if ($status['running'] !== true) { + $needStart = true; + } + } else { + $needStart = true; + } + if ($needStart) { + echo 'Starting a child.' . PHP_EOL; + $procs[$job->identifier()][$i] = proc_open( + sprintf('%s %d', $this->command, $job->id()), + $this->descriptorSpec, + $pipes + ); + } + } + } + usleep(1000000); // Reload the config after 1 second + pcntl_signal_dispatch(); + if ($this->shutdown) { + echo 'Shutting down, waiting for the children' . PHP_EOL; + foreach ($procs as $k => $v) { + foreach ($v as $proc) { + $status = proc_get_status($proc); + // Keep sending SIGTERM until the child exits. + while ($status['running'] === true) { + @proc_terminate($proc); + usleep(50000); + $status = proc_get_status($proc); + } + @proc_close($proc); + } + } + echo 'BatchDaemon exiting' . PHP_EOL; + exit; + } + // Reload the config + $this->runner->loadConfig(); + gc_collect_cycles(); + } + } + + /** + * Fetch the child job by id. + * + * @param int $idNum The id of the job to find + * @return JobInterface + */ + public function job($idNum) + { + return $this->runner->getJobFromIdNum($idNum); + } +} diff --git a/vendor/google/cloud-core/src/Batch/BatchDaemonTrait.php b/vendor/google/cloud-core/src/Batch/BatchDaemonTrait.php new file mode 100644 index 00000000..30592c33 --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/BatchDaemonTrait.php @@ -0,0 +1,44 @@ + self::DEFAULT_BATCH_SIZE, + 'callPeriod' => self::DEFAULT_CALL_PERIOD, + 'bootstrapFile' => null, + 'numWorkers' => self::DEFAULT_WORKERS + ]; + $this->identifier = $identifier; + $this->func = $func; + $this->id = $idNum; + $this->batchSize = $options['batchSize']; + $this->callPeriod = $options['callPeriod']; + $this->bootstrapFile = $options['bootstrapFile']; + $this->numWorkers = $options['numWorkers']; + $this->initFailureFile(); + } + + /** + * Run the job. + */ + public function run() + { + $this->setupSignalHandlers(); + + $sysvKey = $this->getSysvKey($this->id); + $q = msg_get_queue($sysvKey); + $items = []; + $lastInvoked = microtime(true); + + if (!is_null($this->bootstrapFile)) { + require_once($this->bootstrapFile); + } + + while (true) { + // Fire SIGALRM after 1 second to unblock the blocking call. + pcntl_alarm(1); + if (msg_receive( + $q, + 0, + $type, + 8192, + $message, + true, + 0, // blocking mode + $errorcode + )) { + if ($type === self::$typeDirect) { + $items[] = $message; + } elseif ($type === self::$typeFile) { + $items[] = unserialize(file_get_contents($message)); + @unlink($message); + } + } + pcntl_signal_dispatch(); + // It runs the job when + // 1. Number of items reaches the batchSize. + // 2-a. Count is >0 and the current time is larger than lastInvoked + period. + // 2-b. Count is >0 and the shutdown flag is true. + if ((count($items) >= $this->batchSize) + || (count($items) > 0 + && (microtime(true) > $lastInvoked + $this->callPeriod + || $this->shutdown))) { + printf( + 'Running the job with %d items' . PHP_EOL, + count($items) + ); + $this->flush($items); + $items = []; + $lastInvoked = microtime(true); + } + gc_collect_cycles(); + if ($this->shutdown) { + return; + } + } + } + + /** + * Finish any pending activity for this job. + * + * @param array $items + * @return bool + */ + public function flush(array $items = []) + { + if (! $this->callFunc($items)) { + $this->handleFailure($this->id, $items); + return false; + } + return true; + } + + /** + * Finish any pending activity for this job. + * + * @access private + * @internal + * + * @param array $items + * @return bool + */ + public function callFunc(array $items = []) + { + return call_user_func_array($this->func, [$items]); + } + + /** + * Returns the period in seconds from the last execution to force + * executing the job. + * + * @return float + */ + public function getCallPeriod() + { + return $this->callPeriod; + } + + /** + * Returns the batch size. + * + * @return int + */ + public function getBatchSize() + { + return $this->batchSize; + } +} diff --git a/vendor/google/cloud-core/src/Batch/BatchRunner.php b/vendor/google/cloud-core/src/Batch/BatchRunner.php new file mode 100644 index 00000000..b2b55983 --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/BatchRunner.php @@ -0,0 +1,212 @@ +isSysvIPCLoaded() && $this->isDaemonRunning()) { + $configStorage = new SysvConfigStorage(); + $processor = new SysvProcessor(); + } else { + $configStorage = InMemoryConfigStorage::getInstance(); + $processor = $configStorage; + } + } + $this->configStorage = $configStorage; + $this->processor = $processor; + $this->loadConfig(); + } + + /** + * Register a job for batch execution. + * + * @param string $identifier Unique identifier of the job. + * @param callable $func Any Callable except for Closure. The callable + * should accept an array of items as the first argument. + * @param array $options [optional] { + * Configuration options. + * + * @type int $batchSize The size of the batch. + * @type float $callPeriod The period in seconds from the last execution + * to force executing the job. + * @type int $numWorkers The number of child processes. It only takes + * effect with the {@see \Google\Cloud\Core\Batch\BatchDaemon}. + * @type string $bootstrapFile A file to load before executing the + * job. It's needed for registering global functions. + * } + * @return bool true on success, false on failure + * @throws \InvalidArgumentException When receiving a Closure. + */ + public function registerJob($identifier, $func, array $options = []) + { + if ($func instanceof \Closure) { + throw new \InvalidArgumentException('Closure is not allowed'); + } + // Always work on the latest data + $result = $this->configStorage->lock(); + if ($result === false) { + return false; + } + $this->config = $this->configStorage->load(); + $this->config->registerJob( + $identifier, + function ($id) use ($identifier, $func, $options) { + return new BatchJob($identifier, $func, $id, $options); + } + ); + + try { + $result = $this->configStorage->save($this->config); + } finally { + $this->configStorage->unlock(); + } + return $result; + } + + /** + * Submit an item. + * + * @param string $identifier Unique identifier of the job. + * @param mixed $item It needs to be serializable. + * + * @return void + * @throws \RuntimeException + */ + public function submitItem($identifier, $item) + { + $job = $this->getJobFromId($identifier); + if ($job === null) { + throw new \RuntimeException( + "The identifier does not exist: $identifier" + ); + } + $idNum = $job->id(); + $this->processor->submit($item, $idNum); + } + + /** + * Get the job with the given identifier. + * + * @param string $identifier Unique identifier of the job. + * + * @return BatchJob|null + */ + public function getJobFromId($identifier) + { + return $this->config->getJobFromId($identifier); + } + + /** + * Get the job with the given numeric id. + * + * @param int $idNum A numeric id of the job. + * + * @return BatchJob|null + */ + public function getJobFromIdNum($idNum) + { + return $this->config->getJobFromIdNum($idNum); + } + + /** + * Get all the jobs. + * + * @return BatchJob[] + */ + public function getJobs() + { + return $this->config->getJobs(); + } + + /** + * Load the config from the storage. + * + * @return bool true on success + * @throws \RuntimeException when it fails to load the config. + */ + public function loadConfig() + { + $result = $this->configStorage->lock(); + if ($result === false) { + throw new \RuntimeException('Failed to lock the configStorage'); + } + try { + $result = $this->configStorage->load(); + } catch (\RuntimeException $e) { + $this->configStorage->clear(); + throw $e; + } finally { + $this->configStorage->unlock(); + } + + $this->config = $result; + return true; + } + + /** + * Gets the item processor. + * + * @return ProcessItemInterface + */ + public function getProcessor() + { + return $this->processor; + } +} diff --git a/vendor/google/cloud-core/src/Batch/BatchTrait.php b/vendor/google/cloud-core/src/Batch/BatchTrait.php new file mode 100644 index 00000000..21f49a2c --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/BatchTrait.php @@ -0,0 +1,209 @@ +batchRunner + ->getJobFromId($this->identifier) + ->id(); + + return $this->batchRunner + ->getProcessor() + ->flush($id); + } + + /** + * Deliver a list of items in a batch call. + * + * @param array $items + * @return bool + * @access private + */ + public function send(array $items) + { + $start = microtime(true); + try { + call_user_func_array($this->getCallback(), [$items]); + } catch (\Exception $e) { + if ($this->debugOutput) { + fwrite( + $this->debugOutputResource, + $e->getMessage() . PHP_EOL . PHP_EOL + . $e->getTraceAsString() . PHP_EOL + ); + } + + return false; + } + $end = microtime(true); + if ($this->debugOutput) { + fwrite( + $this->debugOutputResource, + sprintf( + '%f seconds for %s: %d items' . PHP_EOL, + $end - $start, + $this->batchMethod, + count($items) + ) + ); + fwrite( + $this->debugOutputResource, + sprintf( + 'memory used: %d' . PHP_EOL, + memory_get_usage() + ) + ); + } + + return true; + } + + /** + * Returns an array representation of a callback which will be used to write + * batch items. + * + * @return array + */ + protected abstract function getCallback(); + + /** + * @param array $options [optional] { + * Configuration options. + * + * @type resource $debugOutputResource A resource to output debug output + * to. **Defaults to** `php://stderr`. + * @type bool $debugOutput Whether or not to output debug information. + * Please note that unless a debug output resource is configured + * this setting will only apply to CLI based applications. + * **Defaults to** `false`. + * @type array $batchOptions A set of options for a BatchJob. + * {@see \Google\Cloud\Core\Batch\BatchJob::__construct()} for + * more details. + * **Defaults to** ['batchSize' => 1000, + * 'callPeriod' => 2.0, + * 'numWorkers' => 2]. + * @type array $clientConfig A config used to construct the client upon + * which requests will be made. + * @type BatchRunner $batchRunner A BatchRunner object. Mainly used for + * the tests to inject a mock. **Defaults to** a newly created + * BatchRunner. + * @type string $identifier An identifier for the batch job. This + * value must be unique across all job configs. + * @type string $batchMethod The name of the batch method used to + * deliver items. + * @type ClosureSerializerInterface $closureSerializer An implementation + * responsible for serializing closures used in the + * `$clientConfig`. This is especially important when using the + * batch daemon. **Defaults to** + * {@see Google\Cloud\Core\Batch\OpisClosureSerializer} if the + * `opis/closure` library is installed. + * } + * @throws \InvalidArgumentException + */ + private function setCommonBatchProperties(array $options = []) + { + if (!isset($options['identifier'])) { + throw new \InvalidArgumentException( + 'A valid identifier is required in order to register a job.' + ); + } + + if (!isset($options['batchMethod'])) { + throw new \InvalidArgumentException( + 'A batchMethod is required.' + ); + } + + $this->setSerializableClientOptions($options); + $this->batchMethod = $options['batchMethod']; + $this->identifier = $options['identifier']; + $this->debugOutputResource = isset($options['debugOutputResource']) + ? $options['debugOutputResource'] + : fopen('php://stderr', 'w'); + $this->debugOutput = isset($options['debugOutput']) + ? $options['debugOutput'] + : false; + $batchOptions = isset($options['batchOptions']) + ? $options['batchOptions'] + : []; + $this->batchOptions = $batchOptions + [ + 'batchSize' => 1000, + 'callPeriod' => 2.0, + 'numWorkers' => 2 + ]; + $this->batchRunner = isset($options['batchRunner']) + ? $options['batchRunner'] + : new BatchRunner(); + $this->batchRunner->registerJob( + $this->identifier, + [$this, 'send'], + $this->batchOptions + ); + } +} diff --git a/vendor/google/cloud-core/src/Batch/ClosureSerializerInterface.php b/vendor/google/cloud-core/src/Batch/ClosureSerializerInterface.php new file mode 100644 index 00000000..f33a3551 --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/ClosureSerializerInterface.php @@ -0,0 +1,43 @@ +baseDir = getenv('GOOGLE_CLOUD_BATCH_DAEMON_FAILURE_DIR'); + + if ('false' === $this->baseDir) { + // setting the file to the string "false" will prevent logging of failed items + return; + } + + if ($this->baseDir === false) { + $this->baseDir = sprintf( + '%s/batch-daemon-failure', + sys_get_temp_dir() + ); + } + + if (!is_dir($this->baseDir) && !@mkdir($this->baseDir, 0700, true) && !is_dir($this->baseDir)) { + throw new \RuntimeException( + sprintf( + 'Could not create a directory: %s', + $this->baseDir + ) + ); + } + + // Use getmypid for simplicity. + $this->failureFile = sprintf( + '%s/failed-items-%d', + $this->baseDir, + getmypid() + ); + } + + /** + * Save the items to the failureFile. We silently abandon the items upon + * failures in this method because there's nothing we can do. + * + * @param int $idNum A numeric id for the job. + * @param array $items Items to save. + */ + public function handleFailure($idNum, array $items) + { + if (!$this->failureFile) { + $this->initFailureFile(); + } + + if ($this->failureFile) { + $fp = @fopen($this->failureFile, 'a'); + @fwrite($fp, serialize([$idNum => $items]) . PHP_EOL); + @fclose($fp); + } + } + + /** + * Get all the filenames for the failure files. + * + * @return array Filenames for all the failure files. + */ + private function getFailedFiles() + { + $pattern = sprintf('%s/failed-items-*', $this->baseDir); + return glob($pattern) ?: []; + } +} diff --git a/vendor/google/cloud-core/src/Batch/InMemoryConfigStorage.php b/vendor/google/cloud-core/src/Batch/InMemoryConfigStorage.php new file mode 100644 index 00000000..941208c3 --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/InMemoryConfigStorage.php @@ -0,0 +1,220 @@ +config = new JobConfig(); + $this->created = microtime(true); + $this->initFailureFile(); + $this->hasShutdownHookRegistered = false; + } + + /** + * Just return true + * + * @return bool + */ + public function lock() + { + return true; + } + + /** + * Just return true + * + * @return bool + */ + public function unlock() + { + return true; + } + + /** + * Save the given JobConfig. + * + * @param JobConfig $config A JobConfig to save. + * @return bool + */ + public function save(JobConfig $config) + { + $this->config = $config; + return true; + } + + /** + * Load a JobConfig from the storage. + * + * @return JobConfig + * @throws \RuntimeException when failed to load the JobConfig. + */ + public function load() + { + return $this->config; + } + + /** + * Clear the JobConfig from storage. + */ + public function clear() + { + $this->config = new JobConfig(); + } + + /** + * Hold the items in memory and run the job in the same process when it + * meets the condition. + * + * We want to delay registering the shutdown function. The error + * reporter also registers a shutdown function and the order matters. + * {@see Google\ErrorReporting\Bootstrap::init()} + * {@see http://php.net/manual/en/function.register-shutdown-function.php} + * + * @param mixed $item An item to submit. + * @param int $idNum A numeric id for the job. + * @return void + */ + public function submit($item, $idNum) + { + if (!$this->hasShutdownHookRegistered) { + register_shutdown_function([$this, 'shutdown']); + $this->hasShutdownHookRegistered = true; + } + if (!array_key_exists($idNum, $this->items)) { + $this->items[$idNum] = []; + $this->lastInvoked[$idNum] = $this->created; + } + $this->items[$idNum][] = $item; + $job = $this->config->getJobFromIdNum($idNum); + $batchSize = $job->getBatchSize(); + $period = $job->getCallPeriod(); + if ((count($this->items[$idNum]) >= $batchSize) + || (count($this->items[$idNum]) !== 0 + && microtime(true) > $this->lastInvoked[$idNum] + $period)) { + $this->flush($idNum); + $this->items[$idNum] = []; + $this->lastInvoked[$idNum] = microtime(true); + } + } + + /** + * Run the job with the given id. + * + * @param int $idNum A numeric id for the job. + * @return bool + */ + public function flush($idNum) + { + if (isset($this->items[$idNum])) { + $job = $this->config->getJobFromIdNum($idNum); + + if (!$job->flush($this->items[$idNum])) { + $this->handleFailure($idNum, $this->items[$idNum]); + } + + $this->items[$idNum] = []; + $this->lastInvoked[$idNum] = microtime(true); + } + + return true; + } + + /** + * Run the job for remainder items. + */ + public function shutdown() + { + foreach ($this->items as $idNum => $items) { + if (count($items) !== 0) { + $this->flush($idNum); + } + } + } +} diff --git a/vendor/google/cloud-core/src/Batch/InterruptTrait.php b/vendor/google/cloud-core/src/Batch/InterruptTrait.php new file mode 100644 index 00000000..ecc16349 --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/InterruptTrait.php @@ -0,0 +1,60 @@ +shutdown = true; + break; + } + } +} diff --git a/vendor/google/cloud-core/src/Batch/JobConfig.php b/vendor/google/cloud-core/src/Batch/JobConfig.php new file mode 100644 index 00000000..3a3a83db --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/JobConfig.php @@ -0,0 +1,107 @@ +identifierToId) + ? $this->jobs[$identifier] + : null; + } + + /** + * Get the job with the given numeric id. + * + * @param int $idNum A numeric id of the job. + * + * @return JobInterface|null + */ + public function getJobFromIdNum($idNum) + { + return array_key_exists($idNum, $this->idToIdentifier) + ? $this->jobs[$this->idToIdentifier[$idNum]] + : null; + } + + /** + * Register a job for executing in batch. + * + * @param string $identifier Unique identifier of the job. + * @param callable $callback Callback that accepts the job $idNum + * and returns a JobInterface instance. + * @return void + */ + public function registerJob($identifier, $callback) + { + if (array_key_exists($identifier, $this->identifierToId)) { + $idNum = $this->identifierToId[$identifier]; + } else { + $idNum = count($this->identifierToId) + 1; + $this->idToIdentifier[$idNum] = $identifier; + } + $this->jobs[$identifier] = call_user_func( + $callback, + $idNum + ); + $this->identifierToId[$identifier] = $idNum; + } + + /** + * Get all the jobs indexed by the job's identifier. + * + * @return array Associative array of JobInterface instances keyed by a + * string identifier. + */ + public function getJobs() + { + return $this->jobs; + } +} diff --git a/vendor/google/cloud-core/src/Batch/JobInterface.php b/vendor/google/cloud-core/src/Batch/JobInterface.php new file mode 100644 index 00000000..4475aee8 --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/JobInterface.php @@ -0,0 +1,57 @@ +identifier; + } + + /** + * Return the job id + * + * @return int + */ + public function id() + { + return $this->id; + } + + /** + * Returns the number of workers for this job. **Defaults to* 1. + * + * @return int + */ + public function numWorkers() + { + return $this->numWorkers; + } + + /** + * Returns the optional file required to run this job. + * + * @return string|null + */ + public function bootstrapFile() + { + return $this->bootstrapFile; + } + + /** + * Runs the job loop. This is expected to be a blocking call. + */ + abstract public function run(); + + /** + * Finish any pending activity for this job. + * + * @param array $items + * @return bool + */ + public function flush(array $items = []) + { + return false; + } +} diff --git a/vendor/google/cloud-core/src/Batch/OpisClosureSerializer.php b/vendor/google/cloud-core/src/Batch/OpisClosureSerializer.php new file mode 100644 index 00000000..ce0e0757 --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/OpisClosureSerializer.php @@ -0,0 +1,56 @@ +runner = $runner ?: new BatchRunner(); + $this->initFailureFile(); + } + + /** + * Retry all the failed items. + */ + public function retryAll() + { + foreach ($this->getFailedFiles() as $file) { + // Rename the file first + $tmpFile = dirname($file) . '/retrying-' . basename($file); + rename($file, $tmpFile); + + $fp = @fopen($tmpFile, 'r'); + if ($fp === false) { + fwrite( + STDERR, + sprintf('Could not open the file: %s' . PHP_EOL, $tmpFile) + ); + continue; + } + while ($line = fgets($fp)) { + $a = unserialize($line); + $idNum = key($a); + $job = $this->runner->getJobFromIdNum($idNum); + if (! $job->callFunc($a[$idNum])) { + $this->handleFailure($idNum, $a[$idNum]); + } + } + @fclose($fp); + @unlink($tmpFile); + } + } +} diff --git a/vendor/google/cloud-core/src/Batch/SerializableClientTrait.php b/vendor/google/cloud-core/src/Batch/SerializableClientTrait.php new file mode 100644 index 00000000..54bedf0f --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/SerializableClientTrait.php @@ -0,0 +1,106 @@ + null, + 'clientConfig' => [] + ]; + $this->closureSerializer = isset($options['closureSerializer']) + ? $options['closureSerializer'] + : $this->getDefaultClosureSerializer(); + $this->setWrappedClientConfig($options); + } + + /** + * @param array $options + */ + private function setWrappedClientConfig(array $options) + { + $config = isset($options['clientConfig']) + ? $options['clientConfig'] + : []; + + if ($config && $this->closureSerializer) { + $this->closureSerializer->wrapClosures($config); + } + + $this->clientConfig = $config; + } + + /** + * @return array + */ + private function getUnwrappedClientConfig() + { + if ($this->clientConfig && $this->closureSerializer) { + $this->closureSerializer->unwrapClosures($this->clientConfig); + } + + return $this->clientConfig; + } + + /** + * @return ClosureSerializerInterface|null + */ + private function getDefaultClosureSerializer() + { + if (class_exists(SerializableClosure::class)) { + return new OpisClosureSerializer(); + } + } +} diff --git a/vendor/google/cloud-core/src/Batch/SimpleJob.php b/vendor/google/cloud-core/src/Batch/SimpleJob.php new file mode 100644 index 00000000..3f928058 --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/SimpleJob.php @@ -0,0 +1,76 @@ +identifier = $identifier; + $this->func = $func; + $this->id = $id; + + $options += [ + 'bootstrapFile' => null, + 'numWorkers' => 1 + ]; + $this->numWorkers = $options['numWorkers']; + $this->bootstrapFile = $options['bootstrapFile']; + } + + /** + * Runs the job loop. This is expected to be a blocking call. + */ + public function run() + { + if ($this->bootstrapFile) { + require_once $this->bootstrapFile; + } + call_user_func($this->func); + } +} diff --git a/vendor/google/cloud-core/src/Batch/SimpleJobTrait.php b/vendor/google/cloud-core/src/Batch/SimpleJobTrait.php new file mode 100644 index 00000000..196e38fa --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/SimpleJobTrait.php @@ -0,0 +1,105 @@ + null, + ]; + + $this->setSerializableClientOptions($options); + $identifier = $options['identifier']; + $configStorage = $options['configStorage'] ?: $this->defaultConfigStorage(); + + $result = $configStorage->lock(); + if ($result === false) { + return false; + } + $config = $configStorage->load(); + $config->registerJob( + $identifier, + function ($id) use ($identifier, $options) { + return new SimpleJob($identifier, [$this, 'run'], $id, $options); + } + ); + try { + $result = $configStorage->save($config); + } finally { + $configStorage->unlock(); + } + return $result; + } + + private function defaultConfigStorage() + { + if ($this->isSysvIPCLoaded() && $this->isDaemonRunning()) { + return new SysvConfigStorage(); + } else { + return InMemoryConfigStorage::getInstance(); + } + } +} diff --git a/vendor/google/cloud-core/src/Batch/SysvConfigStorage.php b/vendor/google/cloud-core/src/Batch/SysvConfigStorage.php new file mode 100644 index 00000000..aec4d4dd --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/SysvConfigStorage.php @@ -0,0 +1,171 @@ +shmSize = intval(getenv('GOOGLE_CLOUD_BATCH_SHM_SIZE')); + if ($this->shmSize === 0) { + $this->shmSize = self::DEFAULT_SHM_SIZE; + } + $this->perm = octdec(getenv('GOOGLE_CLOUD_BATCH_PERM')); + if ($this->perm === 0) { + $this->perm = self::DEFAULT_PERM; + } + $this->project = getenv('GOOGLE_CLOUD_BATCH_PROJECT'); + if ($this->project === false) { + $this->project = self::DEFAULT_PROJECT; + } + $this->sysvKey = ftok(__FILE__, $this->project); + $this->semid = sem_get($this->sysvKey, 1, $this->perm, 1); + } + + /** + * Acquire a lock. + * + * @return bool + */ + public function lock() + { + return sem_acquire($this->semid); + } + + /** + * Release a lock. + * + * @return bool + */ + public function unlock() + { + return sem_release($this->semid); + } + + /** + * Save the given JobConfig. + * + * @param JobConfig $config A JobConfig to save. + * @return bool + * @throws \RuntimeException when failed to attach to the shared memory or serialization fails + */ + public function save(JobConfig $config) + { + $shmid = shm_attach($this->sysvKey, $this->shmSize, $this->perm); + if ($shmid === false) { + throw new \RuntimeException( + 'Failed to attach to the shared memory' + ); + } + + // If the variable write fails, clear the memory and re-raise the exception + try { + $result = shm_put_var($shmid, self::VAR_KEY, $config); + } catch (\Exception $e) { + $this->clear(); + throw new \RuntimeException($e->getMessage()); + } finally { + shm_detach($shmid); + } + return $result; + } + + /** + * Load a JobConfig from the storage. + * + * @return JobConfig + * @throws \RuntimeException when failed to attach to the shared memory or deserialization fails + */ + public function load() + { + $shmid = shm_attach($this->sysvKey, $this->shmSize, $this->perm); + if ($shmid === false) { + throw new \RuntimeException( + 'Failed to attach to the shared memory' + ); + } + if (! shm_has_var($shmid, self::VAR_KEY)) { + $result = new JobConfig(); + } else { + $result = shm_get_var($shmid, self::VAR_KEY); + } + shm_detach($shmid); + + if ($result === false) { + throw new \RuntimeException( + 'Failed to deserialize data from shared memory' + ); + } + return $result; + } + + /** + * Clear the JobConfig from storage. + */ + public function clear() + { + $shmid = shm_attach($this->sysvKey, $this->shmSize, $this->perm); + shm_remove_var($shmid, self::VAR_KEY); + } + + /** + * Serialize the object + */ + public function __serialize() + { + $vars = get_object_vars($this); + // As of PHP 8.0, "semid" is the unserializable object "SysvSemaphore" + // @see https://github.com/googleapis/google-cloud-php/issues/3749 + unset($vars['semid']); + return $vars; + } +} diff --git a/vendor/google/cloud-core/src/Batch/SysvProcessor.php b/vendor/google/cloud-core/src/Batch/SysvProcessor.php new file mode 100644 index 00000000..1b7cb09f --- /dev/null +++ b/vendor/google/cloud-core/src/Batch/SysvProcessor.php @@ -0,0 +1,94 @@ +sysvQs)) { + $this->sysvQs[$idNum] = + msg_get_queue($this->getSysvKey($idNum)); + } + $result = @msg_send( + $this->sysvQs[$idNum], + self::$typeDirect, + $item, + true, + false + ); + if ($result === false) { + // Try to put the content in a temp file and send the filename. + $tempFile = tempnam(sys_get_temp_dir(), 'Item'); + $result = file_put_contents($tempFile, serialize($item)); + if ($result === false) { + throw new \RuntimeException( + "Failed to write to $tempFile while submiting the item" + ); + } + $result = @msg_send( + $this->sysvQs[$idNum], + self::$typeFile, + $tempFile, + true, + false + ); + if ($result === false) { + @unlink($tempFile); + throw new QueueOverflowException(); + } + } + } + + /** + * Run the job with the given id. This has no effect and simply always + * returns false when using the batch daemon. + * + * @param int $idNum A numeric id of the job. + * @return bool + */ + public function flush($idNum) + { + return false; + } +} diff --git a/vendor/google/cloud-core/src/Blob.php b/vendor/google/cloud-core/src/Blob.php new file mode 100644 index 00000000..3824f7e8 --- /dev/null +++ b/vendor/google/cloud-core/src/Blob.php @@ -0,0 +1,83 @@ +value = Utils::streamFor($value); + } + + /** + * Get the blob contents as a stream + * + * Example: + * ``` + * $value = $blob->get(); + * ``` + * + * @return StreamInterface + */ + public function get() + { + return $this->value; + } + + /** + * Cast the blob to a string + * + * @access private + * @return string + */ + public function __toString() + { + return (string) $this->value; + } +} diff --git a/vendor/google/cloud-core/src/CallTrait.php b/vendor/google/cloud-core/src/CallTrait.php new file mode 100644 index 00000000..dd7485f5 --- /dev/null +++ b/vendor/google/cloud-core/src/CallTrait.php @@ -0,0 +1,40 @@ +info()[$name])) { + trigger_error(sprintf( + 'Call to undefined method %s::%s', + __CLASS__, + $name + ), E_USER_ERROR); + } + + return $this->info()[$name]; + } +} diff --git a/vendor/google/cloud-core/src/ClientTrait.php b/vendor/google/cloud-core/src/ClientTrait.php new file mode 100644 index 00000000..a55c3ab0 --- /dev/null +++ b/vendor/google/cloud-core/src/ClientTrait.php @@ -0,0 +1,271 @@ +isGrpcLoaded(); + $defaultTransport = $isGrpcExtensionLoaded ? 'grpc' : 'rest'; + $transport = isset($config['transport']) + ? strtolower($config['transport']) + : $defaultTransport; + + if ($transport === 'grpc') { + if (!$isGrpcExtensionLoaded) { + throw new GoogleException( + 'gRPC support has been requested but required dependencies ' . + 'have not been found. ' . $this->getGrpcInstallationMessage() + ); + } + } + + return $transport; + } + + /** + * Throw an exception if the gRPC extension is not loaded. + * + * @throws GoogleException + */ + private function requireGrpc() + { + if (!$this->isGrpcLoaded()) { + throw new GoogleException( + 'The requested client requires the gRPC extension. ' . + $this->getGrpcInstallationMessage() + ); + } + } + + /** + * @return string + */ + private function getGrpcInstallationMessage() + { + return 'Please see https://cloud.google.com/php/grpc for installation ' . + 'instructions.'; + } + + /** + * Fetch and validate the keyfile and set the project ID. + * + * @param array $config + * @return array + */ + private function configureAuthentication(array $config) + { + $config['keyFile'] = $this->getKeyFile($config); + $this->projectId = $this->detectProjectId($config); + + return $config; + } + + /** + * Get a keyfile if it exists. + * + * Process: + * 1. If $config['keyFile'] is set, use that. + * 2. If $config['keyFilePath'] is set, load the file and use that. + * 3. If GOOGLE_APPLICATION_CREDENTIALS environment variable is set, load + * from that location and use that. + * 4. If OS-specific well-known-file is set, load from that location and use + * that. + * + * @param array $config + * @return array|null Key data + * @throws GoogleException + */ + private function getKeyFile(array $config = []) + { + $config += [ + 'keyFile' => null, + 'keyFilePath' => null, + ]; + + if ($config['keyFile']) { + return $config['keyFile']; + } + + if ($config['keyFilePath']) { + if (!file_exists($config['keyFilePath'])) { + throw new GoogleException(sprintf( + 'Given keyfile path %s does not exist', + $config['keyFilePath'] + )); + } + + try { + $keyFileData = $this->jsonDecode(file_get_contents($config['keyFilePath']), true); + } catch (\InvalidArgumentException $ex) { + throw new GoogleException(sprintf( + 'Given keyfile at path %s was invalid', + $config['keyFilePath'] + )); + } + + return $keyFileData; + } + + return CredentialsLoader::fromEnv() + ?: CredentialsLoader::fromWellKnownFile(); + } + + /** + * Detect and return a project ID. + * + * Process: + * 1. If $config['projectId'] is set, use that. + * 2. If an emulator is enabled, return a dummy value. + * 3. If $config['keyFile'] is set, attempt to retrieve a project ID from + * that. + * 4. Check `GOOGLE_CLOUD_PROJECT` environment variable. + * 5. Check `GCLOUD_PROJECT` environment variable. + * 6. If code is running on compute engine, try to get the project ID from + * the metadata store. + * 7. Throw exception. + * + * @param array $config + * @return string + * @throws GoogleException + */ + private function detectProjectId(array $config) + { + $config += [ + 'httpHandler' => null, + 'projectId' => null, + 'projectIdRequired' => false, + 'hasEmulator' => false, + 'preferNumericProjectId' => false, + 'suppressKeyFileNotice' => false + ]; + + if ($config['projectId']) { + return $config['projectId']; + } + + if ($config['hasEmulator']) { + return 'emulator-project'; + } + + if (isset($config['keyFile'])) { + if (isset($config['keyFile']['project_id'])) { + return $config['keyFile']['project_id']; + } + + if ($config['suppressKeyFileNotice'] !== true) { + $serviceAccountUri = 'https://cloud.google.com/iam/docs/' . + 'creating-managing-service-account-keys#creating_service_account_keys'; + + trigger_error( + sprintf( + 'A keyfile was given, but it does not contain a project ' . + 'ID. This can indicate an old and obsolete keyfile, ' . + 'in which case you should create a new one. To suppress ' . + 'this message, set `suppressKeyFileNotice` to `true` in your client configuration. ' . + 'To learn more about generating new keys, see this URL: %s', + $serviceAccountUri + ), + E_USER_NOTICE + ); + } + } + + if (getenv('GOOGLE_CLOUD_PROJECT')) { + return getenv('GOOGLE_CLOUD_PROJECT'); + } + + if (getenv('GCLOUD_PROJECT')) { + return getenv('GCLOUD_PROJECT'); + } + + if ($this->onGce($config['httpHandler'])) { + $metadata = $this->getMetaData(); + $projectId = $config['preferNumericProjectId'] + ? $metadata->getNumericProjectId() + : $metadata->getProjectId(); + if ($projectId) { + return $projectId; + } + } + + if ($config['projectIdRequired']) { + throw new GoogleException( + 'No project ID was provided, ' . + 'and we were unable to detect a default project ID.' + ); + } + } + + /** + * Abstract the GCECredentials call so we can mock it in the unit tests! + * + * @codeCoverageIgnore + * @return bool + */ + protected function onGce($httpHandler) + { + return GCECredentials::onGce($httpHandler); + } + + /** + * Abstract the Metadata instantiation for unit testing + * + * @codeCoverageIgnore + * @return Metadata + */ + protected function getMetaData() + { + return new Metadata; + } + + /** + * Abstract the checking of the grpc extension for unit testing. + * + * @codeCoverageIgnore + * @return bool + */ + protected function isGrpcLoaded() + { + return extension_loaded('grpc'); + } +} diff --git a/vendor/google/cloud-core/src/Compute/Metadata.php b/vendor/google/cloud-core/src/Compute/Metadata.php new file mode 100644 index 00000000..0f34adb5 --- /dev/null +++ b/vendor/google/cloud-core/src/Compute/Metadata.php @@ -0,0 +1,165 @@ +getProjectId(); + * ``` + * + * ``` + * // It is easy to get any metadata from a project. + * $val = $metadata->getProjectMetadata($key); + * ``` + */ +class Metadata +{ + /** + * @var ReaderInterface The metadata reader. + */ + private $reader; + + /** + * @var string The project id. + */ + private $projectId; + + /** + * @var int The numeric project id. + */ + private $numericProjectId; + + /** + * @param ReaderInterface $reader [optional] A metadata reader implementation. + */ + public function __construct(ReaderInterface $reader = null) + { + $this->reader = $reader ?: new HttpHandlerReader(); + } + + /** + * Replace the default reader implementation + * + * @deprecated If a custom reader implementation is desired, provide it at + * construction. + * @param ReaderInterface $reader The reader implementation + */ + public function setReader(ReaderInterface $reader) + { + $this->reader = $reader; + } + + /** + * Fetch a metadata item by its path + * + * Example: + * ``` + * $projectId = $metadata->get('project/project-id'); + * ``` + * + * @param string $path The path of the item to retrieve. + */ + public function get($path) + { + return $this->reader->read($path); + } + + /** + * Detect and return the project ID + * + * Example: + * ``` + * $projectId = $metadata->getProjectId(); + * ``` + * + * @return string + */ + public function getProjectId() + { + if (!isset($this->projectId)) { + $this->projectId = $this->get('project/project-id'); + } + + return $this->projectId; + } + + /** + * Detect and return the numeric project ID + * + * Example: + * ``` + * $projectId = $metadata->getNumericProjectId(); + * ``` + * + * @return string + */ + public function getNumericProjectId() + { + if (!isset($this->numericProjectId)) { + $this->numericProjectId = $this->get('project/numeric-project-id'); + } + + return $this->numericProjectId; + } + + /** + * Fetch an item from the project metadata + * + * Example: + * ``` + * $foo = $metadata->getProjectMetadata('foo'); + * ``` + * + * @param string $key The metadata key + * @return string + */ + public function getProjectMetadata($key) + { + $path = 'project/attributes/'.$key; + return $this->get($path); + } + + /** + * Fetch an item from the instance metadata + * + * Example: + * ``` + * $foo = $metadata->getInstanceMetadata('foo'); + * ``` + * + * @param string $key The instance metadata key + * @return string + */ + public function getInstanceMetadata($key) + { + $path = 'instance/attributes/'.$key; + return $this->get($path); + } +} diff --git a/vendor/google/cloud-core/src/Compute/Metadata/Readers/HttpHandlerReader.php b/vendor/google/cloud-core/src/Compute/Metadata/Readers/HttpHandlerReader.php new file mode 100644 index 00000000..d1d7b153 --- /dev/null +++ b/vendor/google/cloud-core/src/Compute/Metadata/Readers/HttpHandlerReader.php @@ -0,0 +1,68 @@ +httpHandler = $httpHandler + ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + } + + /** + * Read the metadata for a given path. + * + * @param string $path The metadata path, relative to `/computeMetadata/v1/`. + * @return string + */ + public function read($path) + { + $url = sprintf( + 'http://%s/computeMetadata/v1/%s', + GCECredentials::METADATA_IP, + $path + ); + + $request = new Request('GET', $url, [ + GCECredentials::FLAVOR_HEADER => 'Google' + ]); + + $handler = $this->httpHandler; + $res = $handler($request); + + return (string) $res->getBody(); + } +} diff --git a/vendor/google/cloud-core/src/Compute/Metadata/Readers/ReaderInterface.php b/vendor/google/cloud-core/src/Compute/Metadata/Readers/ReaderInterface.php new file mode 100644 index 00000000..4f5f6f50 --- /dev/null +++ b/vendor/google/cloud-core/src/Compute/Metadata/Readers/ReaderInterface.php @@ -0,0 +1,29 @@ + [ + 'method' => 'GET', + 'header' => GCECredentials::FLAVOR_HEADER . ': Google' + ], + ]; + $this->context = $this->createStreamContext($options); + } + + /** + * Read the metadata for a given path. + * + * @param string $path The metadata path, relative to `/computeMetadata/v1/`. + * @return string + */ + public function read($path) + { + $url = sprintf( + 'http://%s/computeMetadata/v1/%s', + GCECredentials::METADATA_IP, + $path + ); + + return $this->getMetadata($url); + } + + /** + * Abstracted for testing. + * + * @param array $options + * @return resource + * @codeCoverageIgnore + */ + protected function createStreamContext(array $options) + { + return stream_context_create($options); + } + + /** + * Abstracted for testing. + * + * @param string $url + * @return string + * @codeCoverageIgnore + */ + protected function getMetadata($url) + { + return file_get_contents($url, false, $this->context); + } +} diff --git a/vendor/google/cloud-core/src/ConcurrencyControlTrait.php b/vendor/google/cloud-core/src/ConcurrencyControlTrait.php new file mode 100644 index 00000000..aca1f9e7 --- /dev/null +++ b/vendor/google/cloud-core/src/ConcurrencyControlTrait.php @@ -0,0 +1,48 @@ +connection)) { + $props['connection'] = get_class($this->connection); + } + + if (isset($props['__excludeFromDebug'])) { + $exclude = $props['__excludeFromDebug']; + unset($props['__excludeFromDebug']); + + foreach ($exclude as $e) { + unset($props[$e]); + } + } + + return $props; + } +} diff --git a/vendor/google/cloud-core/src/Duration.php b/vendor/google/cloud-core/src/Duration.php new file mode 100644 index 00000000..13064136 --- /dev/null +++ b/vendor/google/cloud-core/src/Duration.php @@ -0,0 +1,104 @@ +seconds = $seconds; + $this->nanos = $nanos; + } + + /** + * Get the duration + * + * Example: + * ``` + * $res = $duration->get(); + * ``` + * + * @return array + */ + public function get() + { + return [ + 'seconds' => $this->seconds, + 'nanos' => $this->nanos + ]; + } + + /** + * Format the value as a string. + * + * Example: + * ``` + * echo $duration->formatAsString(); + * ``` + * + * @return string + */ + public function formatAsString() + { + return json_encode($this->get()); + } + + /** + * Format the value as a string. + * + * @return string + * @access private + */ + public function __toString() + { + return $this->formatAsString(); + } +} diff --git a/vendor/google/cloud-core/src/EmulatorTrait.php b/vendor/google/cloud-core/src/EmulatorTrait.php new file mode 100644 index 00000000..cde02169 --- /dev/null +++ b/vendor/google/cloud-core/src/EmulatorTrait.php @@ -0,0 +1,86 @@ + $emulatorHost, + 'transportConfig' => [ + 'grpc' => [ + 'stubOpts' => [ + 'credentials' => \Grpc\ChannelCredentials::createInsecure() + ] + ] + ] + ]; + } + /** + * Retrieve a valid base uri for a service emulator. + * + * @param string $emulatorHost + * @return string + */ + private function emulatorBaseUri($emulatorHost) + { + $emulatorUriComponents = parse_url($emulatorHost); + $emulatorUriComponents = array_merge(['scheme' => 'http', 'port' => ''], $emulatorUriComponents); + $baseUri = "{$emulatorUriComponents['scheme']}://{$emulatorUriComponents['host']}"; + $baseUri .= $emulatorUriComponents['port'] ? ":{$emulatorUriComponents['port']}/" : '/'; + + return $baseUri; + } + + /** + * When emulators are enabled, use them as the service host. + * + * This method is deprecated and will be removed in a future major release. + * + * @param string $baseUri + * @param string $emulatorHost [optional] + * @return string + * + * @deprecated + * @access private + */ + public function getEmulatorBaseUri($baseUri, $emulatorHost = null) + { + if ($emulatorHost) { + $baseUri = $this->emulatorBaseUri($emulatorHost); + } + + return $baseUri; + } +} diff --git a/vendor/google/cloud-core/src/Exception/AbortedException.php b/vendor/google/cloud-core/src/Exception/AbortedException.php new file mode 100644 index 00000000..208c4303 --- /dev/null +++ b/vendor/google/cloud-core/src/Exception/AbortedException.php @@ -0,0 +1,45 @@ +metadata, function ($metadataItem) { + return array_key_exists('retryDelay', $metadataItem); + }); + + if (count($metadata) === 0) { + return ['seconds' => 0, 'nanos' => 0]; + } + + return $metadata[0]['retryDelay'] + [ + 'seconds' => 0, + 'nanos' => 0 + ]; + } +} diff --git a/vendor/google/cloud-core/src/Exception/BadRequestException.php b/vendor/google/cloud-core/src/Exception/BadRequestException.php new file mode 100644 index 00000000..52fcc88a --- /dev/null +++ b/vendor/google/cloud-core/src/Exception/BadRequestException.php @@ -0,0 +1,27 @@ +message = $message; + } +} diff --git a/vendor/google/cloud-core/src/Exception/ServerException.php b/vendor/google/cloud-core/src/Exception/ServerException.php new file mode 100644 index 00000000..89388b52 --- /dev/null +++ b/vendor/google/cloud-core/src/Exception/ServerException.php @@ -0,0 +1,27 @@ +serviceException = $serviceException; + $this->metadata = $metadata; + + parent::__construct($message, $code); + } + + /** + * If $serviceException is set, return true. + * + * @return bool + */ + public function hasServiceException() + { + return (bool) $this->serviceException; + } + + /** + * Return the service exception object. + * + * @return Exception + */ + public function getServiceException() + { + return $this->serviceException; + } + + /** + * Get exception metadata. + */ + public function getMetadata() + { + return $this->metadata; + } +} diff --git a/vendor/google/cloud-core/src/ExponentialBackoff.php b/vendor/google/cloud-core/src/ExponentialBackoff.php new file mode 100644 index 00000000..0f924d5f --- /dev/null +++ b/vendor/google/cloud-core/src/ExponentialBackoff.php @@ -0,0 +1,136 @@ +retries = $retries !== null ? (int) $retries : 3; + $this->retryFunction = $retryFunction; + // @todo revisit this approach + // @codeCoverageIgnoreStart + $this->delayFunction = static function ($delay) { + usleep($delay); + }; + // @codeCoverageIgnoreEnd + } + + /** + * Executes the retry process. + * + * @param callable $function + * @param array $arguments [optional] + * @return mixed + * @throws \Exception The last exception caught while retrying. + */ + public function execute(callable $function, array $arguments = []) + { + $delayFunction = $this->delayFunction; + $calcDelayFunction = $this->calcDelayFunction ?: [$this, 'calculateDelay']; + $retryAttempt = 0; + $exception = null; + + while (true) { + try { + return call_user_func_array($function, $arguments); + } catch (\Exception $exception) { + if ($this->retryFunction) { + if (!call_user_func($this->retryFunction, $exception, $retryAttempt)) { + throw $exception; + } + } + + if ($retryAttempt >= $this->retries) { + break; + } + + $delayFunction($calcDelayFunction($retryAttempt)); + $retryAttempt++; + } + } + + throw $exception; + } + + /** + * If not set, defaults to using `usleep`. + * + * @param callable $delayFunction + * @return void + */ + public function setDelayFunction(callable $delayFunction) + { + $this->delayFunction = $delayFunction; + } + + /** + * If not set, defaults to using + * {@see Google\Cloud\Core\ExponentialBackoff::calculateDelay()}. + * + * @param callable $calcDelayFunction + * @return void + */ + public function setCalcDelayFunction(callable $calcDelayFunction) + { + $this->calcDelayFunction = $calcDelayFunction; + } + + /** + * Calculates exponential delay. + * + * @param int $attempt The attempt number used to calculate the delay. + * @return int + */ + public static function calculateDelay($attempt) + { + return min( + mt_rand(0, 1000000) + (pow(2, $attempt) * 1000000), + self::MAX_DELAY_MICROSECONDS + ); + } +} diff --git a/vendor/google/cloud-core/src/GeoPoint.php b/vendor/google/cloud-core/src/GeoPoint.php new file mode 100644 index 00000000..649dfdeb --- /dev/null +++ b/vendor/google/cloud-core/src/GeoPoint.php @@ -0,0 +1,207 @@ +latitude = $this->validateValue($latitude, 'latitude', $allowNull); + $this->longitude = $this->validateValue($longitude, 'longitude', $allowNull); + } + + /** + * Get the latitude + * + * Example: + * ``` + * $latitude = $point->latitude(); + * ``` + * + * @return float|null + */ + public function latitude() + { + $this->checkContext('latitude', func_get_args()); + return $this->latitude; + } + + /** + * Set the latitude + * + * Non-numeric values will result in an exception + * + * Example: + * ``` + * $point->setLatitude(42.279594); + * ``` + * + * @param int|float $latitude The new latitude + * @return GeoPoint + * @throws InvalidArgumentException + */ + public function setLatitude($latitude) + { + $this->latitude = $this->validateValue($latitude, 'latitude'); + + return $this; + } + + /** + * Get the longitude + * + * Example: + * ``` + * $longitude = $point->longitude(); + * ``` + * + * @return float|null + */ + public function longitude() + { + $this->checkContext('longitude', func_get_args()); + return $this->longitude; + } + + /** + * Set the longitude + * + * Non-numeric values will result in an exception. + * + * Example: + * ``` + * $point->setLongitude(-83.732124); + * ``` + * + * @param float|int $longitude The new longitude value + * @return GeoPoint + * @throws InvalidArgumentException + */ + public function setLongitude($longitude) + { + $this->longitude = $this->validateValue($longitude, 'longitude'); + + return $this; + } + + /** + * Return a GeoPoint + * + * Example: + * ``` + * $point = $point->point(); + * ``` + * + * @return array [LatLng](https://cloud.google.com/datastore/reference/rest/Shared.Types/LatLng) + */ + public function point() + { + return [ + 'latitude' => $this->latitude, + 'longitude' => $this->longitude + ]; + } + + /** + * Let people know if they accidentally use the getter in setter context. + * + * @param string $method the method name + * @param array $args The method arguments + * @throws InvalidArgumentException + * @return void + */ + private function checkContext($method, array $args) + { + if (count($args) > 0) { + throw new InvalidArgumentException(sprintf( + 'Calling method %s with arguments is unsupported.', + $method + )); + } + } + + /** + * Check a given value's validity as a coordinate. + * + * Numeric values will be cast to type `float`. All other values will raise + * an exception with the exception of `null`, if `$allowNull` is set to true. + * + * @param mixed $value The coordinate value. + * @param string $type The coordinate type for error reporting. + * @param bool $allowNull [optional] Whether null values should be allowed. + * **Defaults to** `false`. + * @return float|null + */ + private function validateValue($value, $type, $allowNull = false) + { + if (!is_numeric($value) && (!$allowNull || ($allowNull && $value !== null))) { + throw new InvalidArgumentException(sprintf( + 'Given %s must be a numeric value.', + $type + )); + } + + return $allowNull && $value === null + ? $value + : (float) $value; + } +} diff --git a/vendor/google/cloud-core/src/GrpcRequestWrapper.php b/vendor/google/cloud-core/src/GrpcRequestWrapper.php new file mode 100644 index 00000000..dbd8bdcf --- /dev/null +++ b/vendor/google/cloud-core/src/GrpcRequestWrapper.php @@ -0,0 +1,259 @@ + RetryInfo::class, + 'google.rpc.badrequest-bin' => BadRequest::class + ]; + + /** + * @param array $config [optional] { + * Configuration options. Please see + * {@see Google\Cloud\Core\RequestWrapperTrait::setCommonDefaults()} for + * the other available options. + * + * @type callable $authHttpHandler A handler used to deliver Psr7 + * requests specifically for authentication. + * @type Serializer $serializer A serializer used to encode responses. + * @type array $grpcOptions gRPC specific configuration options passed + * off to the ApiCore library. + * } + */ + public function __construct(array $config = []) + { + $this->setCommonDefaults($config); + + $config += [ + 'authHttpHandler' => null, + 'serializer' => new Serializer, + 'grpcOptions' => [] + ]; + + $this->authHttpHandler = $config['authHttpHandler'] ?: HttpHandlerFactory::build(); + $this->serializer = $config['serializer']; + $this->grpcOptions = $config['grpcOptions']; + } + + /** + * Deliver the request. + * + * @param callable $request The request to execute. + * @param array $args The arguments for the request. + * @param array $options [optional] { + * Request options. + * + * @type float $requestTimeout Seconds to wait before timing out the + * request. **Defaults to** `60`. + * @type int $retries Number of retries for a failed request. + * **Defaults to** `3`. + * @type array $grpcOptions gRPC specific configuration options. + * } + * @return array + */ + public function send(callable $request, array $args, array $options = []) + { + $retries = isset($options['retries']) ? $options['retries'] : $this->retries; + $grpcOptions = isset($options['grpcOptions']) ? $options['grpcOptions'] : $this->grpcOptions; + $timeout = isset($options['requestTimeout']) ? $options['requestTimeout'] : $this->requestTimeout; + $backoff = new ExponentialBackoff($retries, function (\Exception $ex) { + $statusCode = $ex->getCode(); + + return in_array($statusCode, $this->grpcRetryCodes); + }); + + if (!isset($grpcOptions['retrySettings'])) { + $retrySettings = [ + 'retriesEnabled' => false + ]; + if ($timeout) { + $retrySettings['noRetriesRpcTimeoutMillis'] = $timeout * 1000; + } + $grpcOptions['retrySettings'] = $retrySettings; + } + + $optionalArgs = &$args[count($args) - 1]; + $optionalArgs += $grpcOptions; + + try { + return $this->handleResponse($backoff->execute($request, $args)); + } catch (\Exception $ex) { + if ($ex instanceof ApiException) { + throw $this->convertToGoogleException($ex); + } + + throw $ex; + } + } + + /** + * Serializes a gRPC response. + * + * @param mixed $response + * @return \Generator|OperationResponse|array|null + */ + private function handleResponse($response) + { + if ($response instanceof PagedListResponse) { + $response = $response->getPage()->getResponseObject(); + } + + if ($response instanceof Message) { + return $this->serializer->encodeMessage($response); + } + + if ($response instanceof OperationResponse) { + return $response; + } + + if ($response instanceof ServerStream) { + return $this->handleStream($response); + } + + return null; + } + + /** + * Handles a streaming response. + * + * @param ServerStream $response + * @return \Generator|array|null + */ + private function handleStream($response) + { + try { + foreach ($response->readAll() as $count => $result) { + $res = $this->serializer->encodeMessage($result); + yield $res; + } + } catch (\Exception $ex) { + throw $this->convertToGoogleException($ex); + } + } + + /** + * Convert a ApiCore exception to a Google Exception. + * + * @param \Exception $ex + * @return Exception\ServiceException + */ + private function convertToGoogleException($ex) + { + switch ($ex->getCode()) { + case Code::INVALID_ARGUMENT: + $exception = Exception\BadRequestException::class; + break; + + case Code::NOT_FOUND: + case Code::UNIMPLEMENTED: + $exception = Exception\NotFoundException::class; + break; + + case Code::ALREADY_EXISTS: + $exception = Exception\ConflictException::class; + break; + + case Code::FAILED_PRECONDITION: + $exception = Exception\FailedPreconditionException::class; + break; + + case Code::UNKNOWN: + $exception = Exception\ServerException::class; + break; + + case Code::INTERNAL: + $exception = Exception\ServerException::class; + break; + + case Code::ABORTED: + $exception = Exception\AbortedException::class; + break; + + case Code::DEADLINE_EXCEEDED: + $exception = Exception\DeadlineExceededException::class; + break; + + default: + $exception = Exception\ServiceException::class; + break; + } + + $metadata = []; + if ($ex->getMetadata()) { + foreach ($ex->getMetadata() as $type => $binaryValue) { + if (!isset($this->metadataTypes[$type])) { + continue; + } + $metadataElement = new $this->metadataTypes[$type]; + $metadataElement->mergeFromString($binaryValue[0]); + $metadata[] = $this->serializer->encodeMessage($metadataElement); + } + } + + return new $exception($ex->getMessage(), $ex->getCode(), $ex, $metadata); + } +} diff --git a/vendor/google/cloud-core/src/GrpcTrait.php b/vendor/google/cloud-core/src/GrpcTrait.php new file mode 100644 index 00000000..c411d0f9 --- /dev/null +++ b/vendor/google/cloud-core/src/GrpcTrait.php @@ -0,0 +1,314 @@ +requestWrapper = $requestWrapper; + } + + /** + * Get the GrpcRequestWrapper. + * + * @return GrpcRequestWrapper|null + */ + public function requestWrapper() + { + return $this->requestWrapper; + } + + /** + * Delivers a request. + * + * @param callable $request + * @param array $args + * @param bool $whitelisted + * @return \Generator|array + */ + public function send(callable $request, array $args, $whitelisted = false) + { + $requestOptions = $this->pluckArray([ + 'grpcOptions', + 'retries', + 'requestTimeout' + ], $args[count($args) - 1]); + + try { + return $this->requestWrapper->send($request, $args, $requestOptions); + } catch (NotFoundException $e) { + if ($whitelisted) { + throw $this->modifyWhitelistedError($e); + } + + throw $e; + } + } + + /** + * Gets the default configuration for generated clients. + * + * @param string $version + * @param callable|null $authHttpHandler + * @return array + */ + private function getGaxConfig($version, callable $authHttpHandler = null) + { + $config = [ + 'libName' => 'gccl', + 'libVersion' => $version, + 'transport' => 'grpc' + ]; + + // GAX v0.32.0 introduced the CredentialsWrapper class and a different + // way to configure credentials. If the class exists, use this new method + // otherwise default to legacy usage. + if (class_exists(CredentialsWrapper::class)) { + $config['credentials'] = new CredentialsWrapper( + $this->requestWrapper->getCredentialsFetcher(), + $authHttpHandler + ); + } else { + $config += [ + 'credentialsLoader' => $this->requestWrapper->getCredentialsFetcher(), + 'authHttpHandler' => $authHttpHandler, + 'enableCaching' => false + ]; + } + + return $config; + } + + /** + * Format a struct for the API. + * + * @param array $fields + * @return array + */ + private function formatStructForApi(array $fields) + { + $fFields = []; + + foreach ($fields as $key => $value) { + $fFields[$key] = $this->formatValueForApi($value); + } + + return ['fields' => $fFields]; + } + + private function unpackStructFromApi(array $struct) + { + $vals = []; + foreach ($struct['fields'] as $key => $val) { + $vals[$key] = $this->unpackValue($val); + } + return $vals; + } + + private function unpackValue($value) + { + if (count($value) > 1) { + throw new \RuntimeException("Unexpected fields in struct: $value"); + } + + foreach ($value as $setField => $setValue) { + switch ($setField) { + case 'listValue': + $valueList = []; + foreach ($setValue['values'] as $innerValue) { + $valueList[] = $this->unpackValue($innerValue); + } + return $valueList; + case 'structValue': + return $this->unpackStructFromApi($value['structValue']); + default: + return $setValue; + } + } + } + + private function flattenStruct(array $struct) + { + return $struct['fields']; + } + + private function flattenValue(array $value) + { + if (count($value) > 1) { + throw new \RuntimeException("Unexpected fields in struct: $value"); + } + + if (isset($value['nullValue'])) { + return null; + } + + return array_pop($value); + } + + private function flattenListValue(array $value) + { + return $value['values']; + } + + /** + * Format a list for the API. + * + * @param array $list + * @return array + */ + private function formatListForApi(array $list) + { + $values = []; + + foreach ($list as $value) { + $values[] = $this->formatValueForApi($value); + } + + return ['values' => $values]; + } + + /** + * Format a value for the API. + * + * @param array $value + * @return array + */ + private function formatValueForApi($value) + { + $type = gettype($value); + + switch ($type) { + case 'string': + return ['string_value' => $value]; + case 'double': + case 'integer': + return ['number_value' => $value]; + case 'boolean': + return ['bool_value' => $value]; + case 'NULL': + return ['null_value' => NullValue::NULL_VALUE]; + case 'array': + if (!empty($value) && $this->isAssoc($value)) { + return ['struct_value' => $this->formatStructForApi($value)]; + } + + return ['list_value' => $this->formatListForApi($value)]; + } + } + + /** + * Format a gRPC timestamp to match the format returned by the REST API. + * + * @param array $timestamp + * @return string + */ + private function formatTimestampFromApi(array $timestamp) + { + $timestamp += [ + 'seconds' => 0, + 'nanos' => 0 + ]; + + $dt = $this->createDateTimeFromSeconds($timestamp['seconds']); + + return $this->formatTimeAsString($dt, $timestamp['nanos']); + } + + /** + * Format a timestamp for the API with nanosecond precision. + * + * @param string $value + * @return array + */ + private function formatTimestampForApi($value) + { + list ($dt, $nanos) = $this->parseTimeString($value); + + return [ + 'seconds' => (int) $dt->format('U'), + 'nanos' => (int) $nanos + ]; + } + + /** + * Format a duration for the API. + * + * @param string|Duration $value + * @return array + */ + private function formatDurationForApi($value) + { + if (is_string($value)) { + $d = explode('.', trim($value, 's')); + if (count($d) < 2) { + $seconds = $d[0]; + $nanos = 0; + } else { + $seconds = (int) $d[0]; + $nanos = $this->convertFractionToNanoSeconds($d[1]); + } + } elseif ($value instanceof Duration) { + $d = $value->get(); + $seconds = $d['seconds']; + $nanos = $d['nanos']; + } + + return [ + 'seconds' => $seconds, + 'nanos' => $nanos + ]; + } + + /** + * Construct a gapic client. Allows for tests to intercept. + * + * @param string $gapicName + * @param array $config + * @return mixed + */ + protected function constructGapic($gapicName, array $config) + { + return new $gapicName($config); + } +} diff --git a/vendor/google/cloud-core/src/Iam/Iam.php b/vendor/google/cloud-core/src/Iam/Iam.php new file mode 100644 index 00000000..b83e747d --- /dev/null +++ b/vendor/google/cloud-core/src/Iam/Iam.php @@ -0,0 +1,211 @@ +topic('my-new-topic'); + * + * $iam = $topic->iam(); + * ``` + */ +class Iam +{ + /** + * @var IamConnectionInterface + */ + private $connection; + + /** + * @var string + */ + private $resource; + + /** + * @var array + */ + private $policy; + + /** + * @var array + */ + private $args; + + /** + * @var array + */ + private $options; + + /** + * @param IamConnectionInterface $connection + * @param string $resource + * @param array $options [optional] { + * Configuration Options + * + * @type string|null $parent The parent request parameter for the policy. + * If set, policy data will be sent as `request.{$parent}`. + * Otherwise, policy will be sent in request root. **Defaults to** + * `policy`. + * @type array $args Arbitrary data to be sent with the request. + * } + * @access private + */ + public function __construct(IamConnectionInterface $connection, $resource, array $options = []) + { + $options += [ + 'parent' => 'policy', + 'args' => [] + ]; + + $this->connection = $connection; + $this->resource = $resource; + $this->options = $options; + } + + /** + * Get the existing IAM policy for this resource. + * + * If a policy has already been retrieved from the API, it will be returned. + * To fetch a fresh copy of the policy, use + * {@see Google\Cloud\Core\Iam\Iam::reload()}. + * + * Example: + * ``` + * $policy = $iam->policy(); + * ``` + * + * @param array $options Configuration Options + * @param int $options['requestedPolicyVersion'] Specify the policy version to + * request from the server. Please see + * [policy versioning](https://cloud.google.com/iam/docs/policies#versions) + * for more information. + * @return array An array of policy data + */ + public function policy(array $options = []) + { + if (!$this->policy) { + $this->reload($options); + } + + return $this->policy; + } + + /** + * Set the IAM policy for this resource. + * + * Bindings with invalid roles, or non-existent members will raise a server + * error. + * + * Example: + * ``` + * $oldPolicy = $iam->policy(); + * $oldPolicy['bindings'][0]['members'] = 'user:test@example.com'; + * + * $policy = $iam->setPolicy($oldPolicy); + * ``` + * + * @param array|PolicyBuilder $policy The new policy, as an array or an + * instance of {@see Google\Cloud\Core\Iam\PolicyBuilder}. + * @param array $options Configuration Options + * @return array An array of policy data + * @throws \InvalidArgumentException If the given policy is not an array or PolicyBuilder. + */ + public function setPolicy($policy, array $options = []) + { + if ($policy instanceof PolicyBuilder) { + $policy = $policy->result(); + } + + if (!is_array($policy)) { + throw new \InvalidArgumentException('Given policy data must be an array or an instance of PolicyBuilder.'); + } + + $request = []; + if ($this->options['parent']) { + $parent = $this->options['parent']; + $request[$parent] = $policy; + } else { + $request = $policy; + } + + return $this->policy = $this->connection->setPolicy([ + 'resource' => $this->resource + ] + $request + $options + $this->options['args']); + } + + /** + * Test if the current user has the given permissions on this resource. + * + * Invalid permissions will raise a BadRequestException. + * + * Example: + * ``` + * $allowedPermissions = $iam->testPermissions([ + * 'pubsub.topics.publish', + * 'pubsub.topics.attachSubscription' + * ]); + * ``` + * + * @param array $permissions A list of permissions to test + * @param array $options Configuration Options + * @return array A subset of $permissions, with only those allowed included. + */ + public function testPermissions(array $permissions, array $options = []) + { + $res = $this->connection->testPermissions([ + 'permissions' => $permissions, + 'resource' => $this->resource + ] + $options + $this->options['args']); + + return (isset($res['permissions'])) ? $res['permissions'] : []; + } + + /** + * Refresh the IAM policy for this resource. + * + * Example: + * ``` + * $policy = $iam->reload(); + * ``` + * + * @param array $options Configuration Options + * @return array An array of policy data + */ + public function reload(array $options = []) + { + return $this->policy = $this->connection->getPolicy([ + 'resource' => $this->resource + ] + $options + $this->options['args']); + } +} diff --git a/vendor/google/cloud-core/src/Iam/IamConnectionInterface.php b/vendor/google/cloud-core/src/Iam/IamConnectionInterface.php new file mode 100644 index 00000000..6b15166a --- /dev/null +++ b/vendor/google/cloud-core/src/Iam/IamConnectionInterface.php @@ -0,0 +1,47 @@ +addBinding('roles/admin', [ 'user:admin@domain.com' ]); + * $result = $builder->result(); + * ``` + */ +class PolicyBuilder +{ + /** + * @var array + */ + private $bindings; + + /** + * @var string + */ + private $etag; + + /** + * @var int + */ + private $version; + + /** + * Create a PolicyBuilder. + * + * To use conditions in the bindings, the version of the policy must be set + * to 3. + * + * @see https://cloud.google.com/iam/docs/policies#versions Policy versioning + * @see https://cloud-dot-devsite.googleplex.com/storage/docs/access-control/using-iam-permissions#conditions-iam + * Using Cloud IAM Conditions on buckets + * + * Example: + * ``` + * $policy = [ + * 'etag' => 'AgIc==', + * 'version' => 3, + * 'bindings' => [ + * [ + * 'role' => 'roles/admin', + * 'members' => [ + * 'user:admin@domain.com', + * 'user2:admin@domain.com' + * ], + * 'condition' => [ + * 'title' => 'match-prefix', + * 'description' => 'Applies to objects matching a prefix', + * 'expression' => + * 'resource.name.startsWith("projects/_/buckets/bucket-name/objects/prefix-a-")' + * ] + * ] + * ], + * ]; + * + * $builder = new PolicyBuilder($policy); + * ``` + * + * @param array $policy A policy array + * @throws InvalidArgumentException + */ + public function __construct(array $policy = []) + { + if (isset($policy['bindings'])) { + $this->setBindings($policy['bindings']); + } elseif (!empty($policy)) { + throw new InvalidArgumentException('Invalid Policy'); + } + + if (isset($policy['etag'])) { + $this->setEtag($policy['etag']); + } + + if (isset($policy['version'])) { + $this->setVersion($policy['version']); + } + } + + /** + * Override all stored bindings on the policy. + * + * Example: + * ``` + * $builder->setBindings([ + * [ + * 'role' => 'roles/admin', + * 'members' => [ + * 'user:admin@domain.com' + * ], + * 'condition' => [ + * 'expression' => + * 'request.time < timestamp("2020-07-01T00:00:00.000Z")' + * ] + * ] + * ]); + * ``` + * + * @param array $bindings [optional] An array of bindings + * @return PolicyBuilder + * @throws InvalidArgumentException + */ + public function setBindings(array $bindings = []) + { + $this->bindings = $bindings; + return $this; + } + + /** + * Add a new binding to the policy. + * + * This method will fail with an InvalidOpereationException if it is + * called on a Policy with a version greater than 1 as that indicates + * a more complicated policy than this method is prepared to handle. + * Changes to such policies must be made manually by the setBindings() + * method. + * + * + * Example: + * ``` + * $builder->addBinding('roles/admin', [ 'user:admin@domain.com' ]); + * ``` + * + * @param string $role A valid role for the service + * @param array $members An array of members to assign to the binding + * @return PolicyBuilder + * @throws InvalidArgumentException + * @throws BadMethodCallException if the policy's version is greater than 1. + * @deprecated + */ + public function addBinding($role, array $members) + { + $this->validatePolicyVersion(); + + $this->bindings[] = [ + 'role' => $role, + 'members' => $members + ]; + + return $this; + } + + /** + * Remove a binding from the policy. + * + * This method will fail with a BadMethodCallException if it is + * called on a Policy with a version greater than 1 as that indicates + * a more complicated policy than this method is prepared to handle. + * Changes to such policies must be made manually by the setBindings() + * method. + * + * Example: + * ``` + * $builder->setBindings([ + * [ + * 'role' => 'roles/admin', + * 'members' => [ + * 'user:admin@domain.com', + * 'user2:admin@domain.com' + * ] + * ] + * ]); + * $builder->removeBinding('roles/admin', [ 'user:admin@domain.com' ]); + * ``` + * + * @param string $role A valid role for the service + * @param array $members An array of members to remove from the role + * @return PolicyBuilder + * @throws InvalidArgumentException + * @throws BadMethodCallException if the policy's version is greater than 1. + * @deprecated + */ + public function removeBinding($role, array $members) + { + $this->validatePolicyVersion(); + + $bindings = $this->bindings; + foreach ((array) $bindings as $i => $binding) { + if ($binding['role'] == $role) { + $newMembers = array_diff($binding['members'], $members); + if (count($newMembers) != count($binding['members']) - count($members)) { + throw new InvalidArgumentException('One or more role-members were not found.'); + } + if (empty($newMembers)) { + unset($bindings[$i]); + $bindings = array_values($bindings); + } else { + $binding['members'] = array_values($newMembers); + $bindings[$i] = $binding; + } + $this->bindings = $bindings; + + return $this; + } + } + + throw new InvalidArgumentException('The role was not found.'); + } + + /** + * Update the etag on the policy. + * + * Example: + * ``` + * $builder->setEtag($oldPolicy['etag']); + * ``` + * + * @param string $etag used for optimistic concurrency control as a way to help prevent simultaneous updates of a + * policy from overwriting each other. It is strongly suggested that updates to existing policies make use + * of the etag to avoid race conditions. + * @return PolicyBuilder + */ + public function setEtag($etag) + { + $this->etag = $etag; + + return $this; + } + + /** + * Update the version of the policy. + * + * Example: + * ``` + * $builder->setVersion(1); + * ``` + * + * @param int $version Version of the Policy. **Defaults to** `0`. + * @return PolicyBuilder + */ + public function setVersion($version) + { + $this->version = $version; + + return $this; + } + + /** + * Create a policy array with data in the correct format. + * + * Example: + * ``` + * $policy = $builder->result(); + * ``` + * + * @return array An array of policy data + */ + public function result() + { + return array_filter([ + 'etag' => $this->etag, + 'bindings' => $this->bindings, + 'version' => $this->version + ]); + } + + private function validatePolicyVersion() + { + if (isset($this->version) && $this->version > 1) { + throw new BadMethodCallException("Helper methods cannot be " . + "invoked on policies with version {$this->version}."); + } + + $this->validateConditions(); + } + + private function validateConditions() + { + if (!$this->bindings) { + return; + } + + foreach ($this->bindings as $binding) { + if (isset($binding['condition'])) { + throw new BadMethodCallException("Helper methods cannot " . + "be invoked on policies containing conditions."); + } + } + } +} diff --git a/vendor/google/cloud-core/src/Int64.php b/vendor/google/cloud-core/src/Int64.php new file mode 100644 index 00000000..442dfead --- /dev/null +++ b/vendor/google/cloud-core/src/Int64.php @@ -0,0 +1,68 @@ +value = $value; + } + + /** + * Get the value. + * + * Example: + * ``` + * $value = $int64->get(); + * ``` + * + * @return string + */ + public function get() + { + return $this->value; + } + + /** + * Provides a convenient way to access the value. + * + * @access private + */ + public function __toString() + { + return $this->value; + } +} diff --git a/vendor/google/cloud-core/src/Iterator/ItemIterator.php b/vendor/google/cloud-core/src/Iterator/ItemIterator.php new file mode 100644 index 00000000..8c09be7d --- /dev/null +++ b/vendor/google/cloud-core/src/Iterator/ItemIterator.php @@ -0,0 +1,26 @@ +pageIterator = $pageIterator; + } + + /** + * Fetch the token used to get the next set of results. + * + * @return string|null + */ + public function nextResultToken() + { + return method_exists($this->pageIterator, 'nextResultToken') + ? $this->pageIterator->nextResultToken() + : null; + } + + /** + * Iterate over the results on a per page basis. + * + * @return \Iterator + */ + public function iterateByPage() + { + return $this->pageIterator; + } + + /** + * Rewind the iterator. + * + * @return null + */ + public function rewind() + { + $this->pageIndex = 0; + $this->position = 0; + $this->pageIterator->rewind(); + } + + /** + * Get the current item. + * + * @return mixed + */ + public function current() + { + $page = $this->pageIterator->current(); + + return isset($page[$this->pageIndex]) + ? $page[$this->pageIndex] + : null; + } + + /** + * Get the key current item's key. + * + * @return int + */ + public function key() + { + return $this->position; + } + + /** + * Advances to the next item. + * + * @return null + */ + public function next() + { + $this->pageIndex++; + $this->position++; + + if (count($this->pageIterator->current()) <= $this->pageIndex && $this->nextResultToken()) { + $this->pageIterator->next(); + $this->pageIndex = 0; + } + } + + /** + * Determines if the current position is valid. + * + * @return bool + */ + public function valid() + { + $page = $this->pageIterator->current(); + + if (isset($page[$this->pageIndex])) { + return true; + } + + // If there are no results, but a token for the next page + // exists let's continue paging until there are results. + while ($this->nextResultToken()) { + $this->pageIterator->next(); + $page = $this->pageIterator->current(); + + if (isset($page[$this->pageIndex])) { + return true; + } + } + + return false; + } +} diff --git a/vendor/google/cloud-core/src/Iterator/PageIterator.php b/vendor/google/cloud-core/src/Iterator/PageIterator.php new file mode 100644 index 00000000..53c97aec --- /dev/null +++ b/vendor/google/cloud-core/src/Iterator/PageIterator.php @@ -0,0 +1,26 @@ +resultMapper = $resultMapper; + $this->call = $call; + $this->config = $config + [ + 'itemsKey' => 'items', + 'nextResultTokenKey' => 'nextPageToken', + 'resultTokenKey' => 'pageToken', + 'firstPage' => null, + 'resultLimit' => 0, + 'setNextResultTokenCondition' => function () { + return true; + } + ]; + $this->callOptions = $callOptions; + $this->resultTokenPath = explode('.', $this->config['resultTokenKey']); + $this->nextResultTokenPath = explode('.', $this->config['nextResultTokenKey']); + $this->itemsPath = explode('.', $this->config['itemsKey']); + $this->initialResultToken = $this->nextResultToken(); + } + + /** + * Fetch the token used to get the next set of results. + * + * @return string|null + */ + public function nextResultToken() + { + return $this->get($this->resultTokenPath, $this->callOptions); + } + + /** + * Rewind the iterator. + * + * @return null + */ + public function rewind() + { + $this->itemCount = 0; + $this->position = 0; + + if ($this->config['firstPage']) { + list($this->page, $shouldContinue) = $this->mapResults($this->config['firstPage']); + $nextResultToken = $this->determineNextResultToken($this->page, $shouldContinue); + } else { + $this->page = null; + $nextResultToken = $this->initialResultToken; + } + + if ($nextResultToken) { + $this->set($this->resultTokenPath, $this->callOptions, $nextResultToken); + } + } + + /** + * Get the current page. + * + * @return array|null + */ + public function current() + { + if ($this->page === null) { + $this->page = $this->executeCall(); + } + + $page = $this->get($this->itemsPath, $this->page); + + if ($this->nextResultToken()) { + return $page ?: []; + } + + return $page; + } + + /** + * Get the key current page's key. + * + * @return int + */ + public function key() + { + return $this->position; + } + + /** + * Advances to the next page. + * + * @return null + */ + public function next() + { + $this->position++; + $this->page = $this->nextResultToken() + ? $this->executeCall() + : null; + } + + /** + * Determines if the current position is valid. + * + * @return bool + */ + public function valid() + { + if (!$this->page && $this->position) { + return false; + } + + return true; + } + + /** + * Executes the provided call to get a set of results. + * + * @return array + */ + private function executeCall() + { + $call = $this->call; + list($results, $shouldContinue) = $this->mapResults( + $call($this->callOptions) + ); + + $this->set( + $this->resultTokenPath, + $this->callOptions, + $this->determineNextResultToken($results, $shouldContinue) + ); + + return $results; + } + + /** + * @param array $results + * @return array + */ + private function mapResults(array $results) + { + $items = $this->get($this->itemsPath, $results); + $resultMapper = $this->resultMapper; + $shouldContinue = true; + + if ($items) { + foreach ($items as $key => $item) { + $items[$key] = $resultMapper($item); + $this->itemCount++; + + if ($this->config['resultLimit'] && $this->config['resultLimit'] <= $this->itemCount) { + $items = array_slice($items, 0, $key + 1); + $shouldContinue = false; + break; + } + } + + $this->set($this->itemsPath, $results, $items); + } + + return [$results, $shouldContinue]; + } + + /** + * @param array $results + * @param bool $shouldContinue + * @return null + */ + private function determineNextResultToken(array $results, $shouldContinue = true) + { + return $shouldContinue && $this->config['setNextResultTokenCondition']($results) + ? $this->get($this->nextResultTokenPath, $results) + : null; + } + + /** + * @param array $path + * @param array $array + * @return mixed + */ + private function get(array $path, array $array) + { + $result = $array; + + foreach ($path as $key) { + if (!isset($result[$key])) { + return null; + } + + $result = $result[$key]; + } + + return $result; + } + + /** + * @param array $path + * @param array $array + * @param mixed $value + * @return null + */ + private function set(array $path, array &$array, $value) + { + $temp = &$array; + + foreach ($path as $key) { + $temp = &$temp[$key]; + } + + $temp = $value; + } +} diff --git a/vendor/google/cloud-core/src/JsonTrait.php b/vendor/google/cloud-core/src/JsonTrait.php new file mode 100644 index 00000000..fba59311 --- /dev/null +++ b/vendor/google/cloud-core/src/JsonTrait.php @@ -0,0 +1,68 @@ + true + ]; + $this->exclusive = $options['exclusive']; + + $this->filePath = sprintf( + self::FILE_PATH_TEMPLATE, + sys_get_temp_dir(), + $fileName + ); + } + + /** + * Acquires a lock that will block until released. + * + * @param array $options [optional] { + * Configuration options. + * + * @type bool $blocking Whether the process should block while waiting + * to acquire the lock. **Defaults to** true. + * } + * @return bool + * @throws \RuntimeException If the lock fails to be acquired. + */ + public function acquire(array $options = []) + { + if ($this->handle) { + return true; + } + + $this->handle = $this->initializeHandle(); + + if (!flock($this->handle, $this->lockType($options))) { + fclose($this->handle); + $this->handle = null; + + throw new \RuntimeException('Failed to acquire lock.'); + } + + return true; + } + + /** + * Releases the lock. + * + * @throws \RuntimeException If the lock fails to release. + */ + public function release() + { + if ($this->handle) { + $released = flock($this->handle, LOCK_UN); + fclose($this->handle); + $this->handle = null; + + if (!$released) { + throw new \RuntimeException('Failed to release lock.'); + } + } + } + + /** + * Initializes the handle. + * + * @return resource + * @throws \RuntimeException If the lock file fails to open. + */ + private function initializeHandle() + { + $handle = @fopen($this->filePath, 'c'); + + if (!$handle) { + throw new \RuntimeException('Failed to open lock file.'); + } + + return $handle; + } + + private function lockType(array $options) + { + $options += [ + 'blocking' => true + ]; + $lockType = $this->exclusive ? LOCK_EX : LOCK_SH; + if (!$options['blocking']) { + $lockType |= LOCK_UN; + } + return $lockType; + } +} diff --git a/vendor/google/cloud-core/src/Lock/LockInterface.php b/vendor/google/cloud-core/src/Lock/LockInterface.php new file mode 100644 index 00000000..1039362c --- /dev/null +++ b/vendor/google/cloud-core/src/Lock/LockInterface.php @@ -0,0 +1,59 @@ +acquire($options)) { + try { + $result = $func(); + } catch (\Exception $ex) { + $exception = $ex; + } + $this->release(); + } + + if ($exception) { + throw $exception; + } + + return $result; + } +} diff --git a/vendor/google/cloud-core/src/Lock/SemaphoreLock.php b/vendor/google/cloud-core/src/Lock/SemaphoreLock.php new file mode 100644 index 00000000..f97d4b20 --- /dev/null +++ b/vendor/google/cloud-core/src/Lock/SemaphoreLock.php @@ -0,0 +1,130 @@ +isSysvIPCLoaded()) { + throw new \RuntimeException('SystemV IPC extensions are required.'); + } + + if (!is_int($key)) { + throw new \InvalidArgumentException('The provided key must be an integer.'); + } + + $this->key = $key; + } + + /** + * Acquires a lock that will block until released. + * + * @param array $options [optional] { + * Configuration options. + * + * @type bool $blocking Whether the process should block while waiting + * to acquire the lock. **Defaults to** true. + * } + * @return bool + * @throws \RuntimeException If the lock fails to be acquired. + */ + public function acquire(array $options = []) + { + $options += [ + 'blocking' => true + ]; + + if ($this->semaphoreId) { + return true; + } + + $this->semaphoreId = $this->initializeId(); + + if (!sem_acquire($this->semaphoreId, !$options['blocking'])) { + $this->semaphoreId = null; + + throw new \RuntimeException('Failed to acquire lock.'); + } + + return true; + } + + /** + * Releases the lock. + * + * @throws \RuntimeException If the lock fails to release. + */ + public function release() + { + if ($this->semaphoreId) { + $released = sem_release($this->semaphoreId); + $this->semaphoreId = null; + + if (!$released) { + throw new \RuntimeException('Failed to release lock.'); + } + } + } + + /** + * Initializes the semaphore ID. + * + * @return resource + * @throws \RuntimeException If semaphore ID fails to generate. + */ + private function initializeId() + { + $semaphoreId = sem_get($this->key); + + if (!$semaphoreId) { + throw new \RuntimeException('Failed to generate semaphore ID.'); + } + + return $semaphoreId; + } +} diff --git a/vendor/google/cloud-core/src/Lock/SymfonyLockAdapter.php b/vendor/google/cloud-core/src/Lock/SymfonyLockAdapter.php new file mode 100644 index 00000000..84972ee1 --- /dev/null +++ b/vendor/google/cloud-core/src/Lock/SymfonyLockAdapter.php @@ -0,0 +1,94 @@ +lock = $lock; + } + + /** + * Acquires a lock that will block until released. + * + * @param array $options [optional] { + * Configuration options. + * + * @type bool $blocking Whether the process should block while waiting + * to acquire the lock. **Defaults to** true. + * } + * @return bool + * @throws \RuntimeException If the lock fails to be acquired. + */ + public function acquire(array $options = []) + { + $options += [ + 'blocking' => true + ]; + + try { + return $this->lock->acquire($options['blocking']); + } catch (\Exception $ex) { + throw new \RuntimeException( + sprintf( + 'Acquiring the lock failed with the following message: %s', + $ex->getMessage() + ), + 0, + $ex + ); + } + } + + /** + * Releases the lock. + * + * @throws \RuntimeException + */ + public function release() + { + try { + $this->lock->release(); + } catch (\Exception $ex) { + throw new \RuntimeException( + sprintf( + 'Releasing the lock failed with the following message: %s', + $ex->getMessage() + ), + 0, + $ex + ); + } + } +} diff --git a/vendor/google/cloud-core/src/Logger/AppEngineFlexFormatter.php b/vendor/google/cloud-core/src/Logger/AppEngineFlexFormatter.php new file mode 100644 index 00000000..1f4b45c3 --- /dev/null +++ b/vendor/google/cloud-core/src/Logger/AppEngineFlexFormatter.php @@ -0,0 +1,51 @@ +formatPayload($record, parent::format($record)); + } +} diff --git a/vendor/google/cloud-core/src/Logger/AppEngineFlexFormatterV2.php b/vendor/google/cloud-core/src/Logger/AppEngineFlexFormatterV2.php new file mode 100644 index 00000000..90e5cd7f --- /dev/null +++ b/vendor/google/cloud-core/src/Logger/AppEngineFlexFormatterV2.php @@ -0,0 +1,51 @@ +formatPayload($record, parent::format($record)); + } +} diff --git a/vendor/google/cloud-core/src/Logger/AppEngineFlexHandler.php b/vendor/google/cloud-core/src/Logger/AppEngineFlexHandler.php new file mode 100644 index 00000000..d813c1e5 --- /dev/null +++ b/vendor/google/cloud-core/src/Logger/AppEngineFlexHandler.php @@ -0,0 +1,70 @@ + $message, + 'timestamp'=> ['seconds' => $sec, 'nanos' => $usec], + 'thread' => '', + 'severity' => $record['level_name'], + ]; + + if (isset($_SERVER['HTTP_X_CLOUD_TRACE_CONTEXT'])) { + $payload['traceId'] = explode( + '/', + $_SERVER['HTTP_X_CLOUD_TRACE_CONTEXT'] + )[0]; + } + + return "\n" . json_encode($payload); + } +} diff --git a/vendor/google/cloud-core/src/LongRunning/LROTrait.php b/vendor/google/cloud-core/src/LongRunning/LROTrait.php new file mode 100644 index 00000000..d345699e --- /dev/null +++ b/vendor/google/cloud-core/src/LongRunning/LROTrait.php @@ -0,0 +1,125 @@ +lroConnection = $lroConnection; + $this->lroCallables = $lroCallables; + $this->lroResource = $resource; + } + + /** + * Resume a Long Running Operation + * + * @param string $operationName The Long Running Operation name. + * @param array $info [optional] The operation data. + * @return LongRunningOperation + */ + public function resumeOperation($operationName, array $info = []) + { + return new LongRunningOperation( + $this->lroConnection, + $operationName, + $this->lroCallables, + $info + ); + } + + /** + * List long running operations. + * + * @param array $options [optional] { + * Configuration Options. + * + * @type string $name The name of the operation collection. + * @type string $filter The standard list filter. + * @type int $pageSize Maximum number of results to return per + * request. + * @type int $resultLimit Limit the number of results returned in total. + * **Defaults to** `0` (return all results). + * @type string $pageToken A previously-returned page token used to + * resume the loading of results from a specific point. + * } + * @return ItemIterator + */ + public function longRunningOperations(array $options = []) + { + if (is_null($this->lroResource)) { + throw new \BadMethodCallException('This service does list support listing operations.'); + } + + $resultLimit = $this->pluck('resultLimit', $options, false) ?: 0; + + $options['name'] = $this->lroResource .'/operations'; + + return new ItemIterator( + new PageIterator( + function (array $operation) { + return $this->resumeOperation($operation['name'], $operation); + }, + [$this->lroConnection, 'operations'], + $options, + [ + 'itemsKey' => 'operations', + 'resultLimit' => $resultLimit + ] + ) + ); + } +} diff --git a/vendor/google/cloud-core/src/LongRunning/LongRunningConnectionInterface.php b/vendor/google/cloud-core/src/LongRunning/LongRunningConnectionInterface.php new file mode 100644 index 00000000..9b35a5cc --- /dev/null +++ b/vendor/google/cloud-core/src/LongRunning/LongRunningConnectionInterface.php @@ -0,0 +1,46 @@ +connection = $connection; + $this->name = $name; + $this->callablesMap = $callablesMap; + $this->info = $info; + } + + /** + * Return the Operation name. + * + * Example: + * ``` + * $name = $operation->name(); + * ``` + * + * @return string + */ + public function name() + { + return $this->name; + } + + /** + * Check if the Operation is done. + * + * If the Operation state is not available, a service request may be executed + * by this method. + * + * Example: + * ``` + * if ($operation->done()) { + * echo "The operation is done!"; + * } + * ``` + * + * @param array $options [optional] Configuration options. + * @return bool + */ + public function done(array $options = []) + { + return (isset($this->info($options)['done'])) + ? $this->info['done'] + : false; + } + + /** + * Get the state of the Operation. + * + * Return value will be one of `LongRunningOperation::STATE_IN_PROGRESS`, + * `LongRunningOperation::STATE_SUCCESS` or + * `LongRunningOperation::STATE_ERROR`. + * + * If the Operation state is not available, a service request may be executed + * by this method. + * + * Example: + * ``` + * switch ($operation->state()) { + * case LongRunningOperation::STATE_IN_PROGRESS: + * echo "Operation is in progress"; + * break; + * + * case LongRunningOperation::STATE_SUCCESS: + * echo "Operation succeeded"; + * break; + * + * case LongRunningOperation::STATE_ERROR: + * echo "Operation failed"; + * break; + * } + * ``` + * + * @param array $options [optional] Configuration options. + * @return string + */ + public function state(array $options = []) + { + if (!$this->done($options)) { + return self::STATE_IN_PROGRESS; + } + + if ($this->done() && $this->result()) { + return self::STATE_SUCCESS; + } + + return self::STATE_ERROR; + } + + /** + * Get the Operation result. + * + * The return type of this method is dictated by the type of Operation. + * + * Returns null if the Operation is not yet complete, or if an error occurred. + * + * If the Operation state is not available, a service request may be executed + * by this method. + * + * Example: + * ``` + * $result = $operation->result(); + * ``` + * + * @param array $options [optional] Configuration options. + * @return mixed|null + */ + public function result(array $options = []) + { + $this->info($options); + return $this->result; + } + + /** + * Get the Operation error. + * + * Returns null if the Operation is not yet complete, or if no error occurred. + * + * If the Operation state is not available, a service request may be executed + * by this method. + * + * Example: + * ``` + * $error = $operation->error(); + * ``` + * + * @param array $options [optional] Configuration options. + * @return array|null + */ + public function error(array $options = []) + { + $this->info($options); + return $this->error; + } + + /** + * Get the Operation info. + * + * If the Operation state is not available, a service request may be executed + * by this method. + * + * Example: + * ``` + * $info = $operation->info(); + * ``` + * + * @codingStandardsIgnoreStart + * @param array $options [optional] Configuration options. + * @return array [google.longrunning.Operation](https://cloud.google.com/spanner/docs/reference/rpc/google.longrunning#google.longrunning.Operation) + * @codingStandardsIgnoreEnd + */ + public function info(array $options = []) + { + return $this->info ?: $this->reload($options); + } + + /** + * Reload the Operation to check its status. + * + * Example: + * ``` + * $result = $operation->reload(); + * ``` + * + * @codingStandardsIgnoreStart + * @param array $options [optional] Configuration Options. + * @return array [google.longrunning.Operation](https://cloud.google.com/spanner/docs/reference/rpc/google.longrunning#google.longrunning.Operation) + * @codingStandardsIgnoreEnd + */ + public function reload(array $options = []) + { + $res = $this->connection->get([ + 'name' => $this->name, + ] + $options); + + $this->result = null; + $this->error = null; + if (isset($res['done']) && $res['done']) { + $type = $res['metadata']['typeUrl']; + $this->result = $this->executeDoneCallback($type, $res['response']); + $this->error = (isset($res['error'])) + ? $res['error'] + : null; + } + + return $this->info = $res; + } + + /** + * Reload the operation until it is complete. + * + * The return type of this method is dictated by the type of Operation. If + * `$options.maxPollingDurationSeconds` is set, and the poll exceeds the + * limit, the return will be `null`. + * + * Example: + * ``` + * $result = $operation->pollUntilComplete(); + * ``` + * + * @param array $options { + * Configuration Options + * + * @type float $pollingIntervalSeconds The polling interval to use, in + * seconds. **Defaults to** `1.0`. + * @type float $maxPollingDurationSeconds The maximum amount of time to + * continue polling. **Defaults to** `0.0`. + * } + * @return mixed|null + */ + public function pollUntilComplete(array $options = []) + { + $options += [ + 'pollingIntervalSeconds' => $this::WAIT_INTERVAL, + 'maxPollingDurationSeconds' => 0.0, + ]; + + $pollingIntervalMicros = $options['pollingIntervalSeconds'] * 1000000; + $maxPollingDuration = $options['maxPollingDurationSeconds']; + $hasMaxPollingDuration = $maxPollingDuration > 0.0; + $endTime = microtime(true) + $maxPollingDuration; + + do { + usleep($pollingIntervalMicros); + $this->reload($options); + } while (!$this->done() && (!$hasMaxPollingDuration || microtime(true) < $endTime)); + + return $this->result; + } + + /** + * Cancel a Long Running Operation. + * + * Example: + * ``` + * $operation->cancel(); + * ``` + * + * @param array $options Configuration options. + * @return void + */ + public function cancel(array $options = []) + { + $this->connection->cancel([ + 'name' => $this->name + ]); + } + + /** + * Delete a Long Running Operation. + * + * Example: + * ``` + * $operation->delete(); + * ``` + * + * @param array $options Configuration Options. + * @return void + */ + public function delete(array $options = []) + { + $this->connection->delete([ + 'name' => $this->name + ]); + } + + /** + * When the Operation is complete, there may be a callback enqueued to + * handle the response. If so, execute it and return the result. + * + * @param string $type The response type. + * @param mixed $response The response data. + * @return mixed + */ + private function executeDoneCallback($type, $response) + { + if (is_null($response)) { + return null; + } + + $callables = array_filter($this->callablesMap, function ($callable) use ($type) { + return $callable['typeUrl'] === $type; + }); + + if (count($callables) === 0) { + return $response; + } + + $callable = current($callables); + $fn = $callable['callable']; + + return call_user_func($fn, $response); + } + + /** + * @access private + */ + public function __debugInfo() + { + return [ + 'connection' => get_class($this->connection), + 'name' => $this->name, + 'callablesMap' => array_keys($this->callablesMap), + 'info' => $this->info + ]; + } +} diff --git a/vendor/google/cloud-core/src/LongRunning/OperationResponseTrait.php b/vendor/google/cloud-core/src/LongRunning/OperationResponseTrait.php new file mode 100644 index 00000000..2c5cad0b --- /dev/null +++ b/vendor/google/cloud-core/src/LongRunning/OperationResponseTrait.php @@ -0,0 +1,156 @@ +getLastProtoResponse(); + if (is_null($response)) { + return null; + } + + $response = $serializer->encodeMessage($response); + + $result = null; + if ($operation->isDone() && isset($response['response']['typeUrl'])) { + $type = $response['response']['typeUrl']; + $result = $this->deserializeResult($operation, $type, $serializer, $lroMappers); + } + + $metaType = $response['metadata']['typeUrl']; + $metaResult = $this->deserializeMetadata($operation, $metaType, $serializer, $lroMappers); + /** @see LongRunningOperation#reload() */ + $metaResult += ['typeUrl' => $metaType]; + + $error = $operation->getError(); + if (!is_null($error)) { + $error = $serializer->encodeMessage($error); + } + + $response['response'] = $result; + $response['metadata'] = $metaResult; + $response['error'] = $error; + + return $response; + } + + /** + * Fetch an OperationResponse object from a gapic client. + * + * @param mixed $client A generated client with a `resumeOperation` method. + * @param string $name The Operation name. + * @param string|null $method The method name. + * @return OperationResponse + */ + private function getOperationByName($client, $name, $method = null) + { + return $client->resumeOperation($name, $method); + } + + /** + * Convert an operation response to an array + * + * @param OperationResponse|GaxOperationResponse $operation The operation to + * serialize. + * @param string $type The Operation type. The type should correspond to a + * member of $mappers.typeUrl. + * @param Serializer|GaxSerializer $serializer The gRPC serializer to use + * for the deserialization. + * @param array $mappers A list of mappers. + * @return array|null + */ + private function deserializeResult($operation, $type, $serializer, array $mappers) + { + $mappers = array_filter($mappers, function ($mapper) use ($type) { + return $mapper['typeUrl'] === $type; + }); + + if (count($mappers) === 0) { + throw new \RuntimeException(sprintf('No mapper exists for operation response type %s.', $type)); + } + + $mapper = current($mappers); + $message = $mapper['message']; + + $response = new $message(); + $anyResponse = $operation->getLastProtoResponse()->getResponse(); + if (is_null($anyResponse)) { + return null; + } + + $response->mergeFromString($anyResponse->getValue()); + + return $serializer->encodeMessage($response); + } + + /** + * Convert an operation metadata to an array + * + * @param OperationResponse|GaxOperationResponse $operation The operation to + * serialize. + * @param string $type The Operation type. The type should correspond to a + * member of $mappers.typeUrl. + * @param Serializer|GaxSerializer $serializer The gRPC serializer to use + * for the deserialization. + * @param array $mappers A list of mappers. + * @return array|null + */ + + private function deserializeMetadata($operation, $type, $serializer, array $mappers) + { + $mappers = array_filter($mappers, function ($mapper) use ($type) { + return $mapper['typeUrl'] === $type; + }); + if (count($mappers) === 0) { + throw new \RuntimeException(sprintf('No mapper exists for operation metadata type %s.', $type)); + } + + $mapper = current($mappers); + $message = $mapper['message']; + + $response = new $message(); + $anyResponse = $operation->getLastProtoResponse()->getMetadata(); + if (is_null($anyResponse)) { + return null; + } + + $response->mergeFromString($anyResponse->getValue()); + + return $serializer->encodeMessage($response); + } +} diff --git a/vendor/google/cloud-core/src/PhpArray.php b/vendor/google/cloud-core/src/PhpArray.php new file mode 100644 index 00000000..880bc438 --- /dev/null +++ b/vendor/google/cloud-core/src/PhpArray.php @@ -0,0 +1,238 @@ +customFilters = $customFilters; + $this->useCamelCase = $useCamelCase; + } + + /** + * Borrowed heavily from {@see DrSlump\Protobuf\Codec\PhpArray::encodeMessage()}. + * With this approach we are able to transform the response with minimal + * overhead. + */ + protected function encodeMessage(Protobuf\Message $message) + { + $descriptor = Protobuf::getRegistry()->getDescriptor($message); + $data = []; + + foreach ($descriptor->getFields() as $tag => $field) { + $empty = !$message->_has($tag); + if ($field->isRequired() && $empty) { + throw new \UnexpectedValueException( + sprintf( + 'Message %s\'s field tag %s(%s) is required but has no value', + get_class($message), + $tag, + $field->getName() + ) + ); + } + + if ($empty) { + continue; + } + + $key = $this->useTagNumber ? $field->getNumber() : $field->getName(); + $v = $message->_get($tag); + + if ($field->isRepeated()) { + // Make sure the value is an array of values + $v = is_array($v) ? $v : array($v); + $arr = []; + + foreach ($v as $k => $vv) { + // Skip nullified repeated values + if (null === $vv) { + continue; + } + + $filteredValue = $this->filterValue($vv, $field); + + if ($this->isKeyValueMessage($vv)) { + $arr[key($filteredValue)] = current($filteredValue); + } else { + $arr[$k] = $filteredValue; + } + + $v = $arr; + } + } else { + $v = $this->filterValue($v, $field); + } + + $key = ($this->useCamelCase) ? $this->toCamelCase($key) : $key; + + if (isset($this->customFilters[$key])) { + $v = call_user_func($this->customFilters[$key], $v); + } + + $data[$key] = $v; + } + + return $data; + } + + /** + * Borrowed heavily from {@see DrSlump\Protobuf\Codec\PhpArray::decodeMessage()}. + * The only addition here is converting camel case field names to snake case. + */ + protected function decodeMessage(Protobuf\Message $message, $data) + { + // Get message descriptor + $descriptor = Protobuf::getRegistry()->getDescriptor($message); + + foreach ($data as $key => $v) { + // Get the field by tag number or name + $field = $this->useTagNumber + ? $descriptor->getField($key) + : $descriptor->getFieldByName($this->toSnakeCase($key)); + + // Unknown field found + if (!$field) { + $unknown = new Protobuf\Codec\PhpArray\Unknown($key, gettype($v), $v); + $message->addUnknown($unknown); + continue; + } + + if ($field->isRepeated()) { + // Make sure the value is an array of values + $v = is_array($v) && is_int(key($v)) ? $v : array($v); + foreach ($v as $k => $vv) { + $v[$k] = $this->filterValue($vv, $field); + } + } else { + $v = $this->filterValue($v, $field); + } + + $message->_set($field->getNumber(), $v); + } + + return $message; + } + + protected function filterValue($value, Protobuf\Field $field) + { + if (trim($field->getReference(), '\\') === NullValue::class) { + return null; + } + + if ($value instanceof Protobuf\Message) { + if ($this->isKeyValueMessage($value)) { + $v = $value->getValue(); + + return [ + $value->getKey() => $v instanceof Protobuf\Message + ? $this->encodeMessage($v) + : $v + ]; + } + + if ($value instanceof Struct) { + $vals = []; + + foreach ($value->getFields() as $field) { + $val = $this->filterValue( + $field->getValue(), + $field->descriptor()->getFieldByName('value') + ); + $vals[$field->getKey()] = $val; + } + + return $vals; + } + + if ($value instanceof ListValue) { + $vals = []; + + foreach ($value->getValuesList() as $val) { + $fields = $val->descriptor()->getFields(); + + foreach ($fields as $field) { + $name = $field->getName(); + if ($val->$name !== null) { + $vals[] = $this->filterValue($val->$name, $field); + } + } + } + + return $vals; + } + + if ($value instanceof Value) { + $fields = $value->descriptor()->getFields(); + + foreach ($fields as $field) { + $name = $field->getName(); + if ($value->$name !== null) { + return $this->filterValue($value->$name, $field); + } + } + } + } + + return parent::filterValue($value, $field); + } + + private function toSnakeCase($key) + { + return strtolower(preg_replace(['/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/'], '$1_$2', $key)); + } + + private function toCamelCase($key) + { + return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $key)))); + } + + private function isKeyValueMessage($value) + { + return property_exists($value, 'key') && property_exists($value, 'value'); + } +} diff --git a/vendor/google/cloud-core/src/Report/EmptyMetadataProvider.php b/vendor/google/cloud-core/src/Report/EmptyMetadataProvider.php new file mode 100644 index 00000000..50c07e92 --- /dev/null +++ b/vendor/google/cloud-core/src/Report/EmptyMetadataProvider.php @@ -0,0 +1,72 @@ + + $this->getTraceValue($server)] + : []; + $this->data = + [ + 'resource' => [ + 'type' => 'gae_app', + 'labels' => [ + 'project_id' => $projectId, + 'version_id' => $versionId, + 'module_id' => $serviceId + ] + ], + 'projectId' => $projectId, + 'serviceId' => $serviceId, + 'versionId' => $versionId, + 'labels' => $labels + ]; + } + + /** + * Return an array representing MonitoredResource. + * {@see https://cloud.google.com/logging/docs/reference/v2/rest/v2/MonitoredResource} + * + * @return array + */ + public function monitoredResource() + { + return $this->data['resource']; + } + + /** + * Return the project id. + * @return string + */ + public function projectId() + { + return $this->data['projectId']; + } + + /** + * Return the service id. + * @return string + */ + public function serviceId() + { + return $this->data['serviceId']; + } + + /** + * Return the version id. + * @return string + */ + public function versionId() + { + return $this->data['versionId']; + } + + /** + * Return the labels. We need to evaluate $_SERVER for each request. + * @return array + */ + public function labels() + { + return $this->data['labels']; + } +} diff --git a/vendor/google/cloud-core/src/Report/GAEStandardMetadataProvider.php b/vendor/google/cloud-core/src/Report/GAEStandardMetadataProvider.php new file mode 100644 index 00000000..f1d44bc7 --- /dev/null +++ b/vendor/google/cloud-core/src/Report/GAEStandardMetadataProvider.php @@ -0,0 +1,37 @@ +data['monitoredResource'] = $monitoredResource; + $this->data['projectId'] = $projectId; + $this->data['serviceId'] = $serviceId; + $this->data['versionId'] = $versionId; + $this->data['labels'] = $labels; + } + + /** + * Return an array representing MonitoredResource. + * {@see https://cloud.google.com/logging/docs/reference/v2/rest/v2/MonitoredResource} + * + * @return array + */ + public function monitoredResource() + { + return $this->data['monitoredResource']; + } + + /** + * Return the project id. + * @return string + */ + public function projectId() + { + return $this->data['projectId']; + } + + /** + * Return the service id. + * @return string + */ + public function serviceId() + { + return $this->data['serviceId']; + } + + /** + * Return the version id. + * @return string + */ + public function versionId() + { + return $this->data['versionId']; + } + + /** + * Return the labels. + * @return array + */ + public function labels() + { + return $this->data['labels']; + } +} diff --git a/vendor/google/cloud-core/src/RequestBuilder.php b/vendor/google/cloud-core/src/RequestBuilder.php new file mode 100644 index 00000000..0f31f932 --- /dev/null +++ b/vendor/google/cloud-core/src/RequestBuilder.php @@ -0,0 +1,163 @@ +service = $this->loadServiceDefinition($servicePath); + $this->resourceRoot = $resourceRoot; + + // Append service definition base path if bare apiEndpoint domain is given. + if (isset($this->service['basePath'])) { + $uriParts = parse_url($baseUri) + ['path' => null]; + if (!$uriParts['path'] || $uriParts['path'] === '/') { + $uriParts['path'] = $this->service['basePath']; + + // Recreate the URI from its modified parts and ensure it ends in a single slash. + $this->baseUri = rtrim((string) Uri::fromParts($uriParts), '/') . '/'; + + return; + } + } + + $this->baseUri = rtrim($baseUri, '/') . '/'; + } + + /** + * Build the request. + * + * @param string $resource + * @param string $method + * @param array $options [optional] + * @return RequestInterface + * @todo complexity high, revisit + * @todo consider validating against the schemas + */ + public function build($resource, $method, array $options = []) + { + $root = $this->resourceRoot; + + array_push($root, 'resources'); + $root = array_merge($root, explode('.', $resource)); + array_push($root, 'methods', $method); + + $action = $this->service; + foreach ($root as $rootItem) { + if (!isset($action[$rootItem])) { + throw new \InvalidArgumentException('Provided path item ' . $rootItem . ' does not exist.'); + } + $action = $action[$rootItem]; + } + + $path = []; + $query = []; + $body = []; + + if (isset($action['parameters'])) { + foreach ($action['parameters'] as $parameter => $parameterOptions) { + if ($parameterOptions['location'] === 'path' && array_key_exists($parameter, $options)) { + $path[$parameter] = $options[$parameter]; + unset($options[$parameter]); + } + + if ($parameterOptions['location'] === 'query' && array_key_exists($parameter, $options)) { + $query[$parameter] = $options[$parameter]; + } + } + } + + if (isset($this->service['parameters'])) { + foreach ($this->service['parameters'] as $parameter => $parameterOptions) { + if ($parameterOptions['location'] === 'query' && array_key_exists($parameter, $options)) { + $query[$parameter] = $options[$parameter]; + } + } + } + + if (isset($action['request'])) { + $schema = $action['request']['$ref']; + + foreach ($this->service['schemas'][$schema]['properties'] as $property => $propertyOptions) { + if (array_key_exists($property, $options)) { + $body[$property] = $options[$property]; + } + } + } + + $uri = $this->buildUriWithQuery( + $this->expandUri($this->baseUri . $action['path'], $path), + $query + ); + + return new Request( + $action['httpMethod'], + $uri, + ['Content-Type' => 'application/json'], + $body ? $this->jsonEncode($body) : null + ); + } + + /** + * @param string $servicePath + * @return array + */ + private function loadServiceDefinition($servicePath) + { + return $this->jsonDecode( + file_get_contents($servicePath, true), + true + ); + } +} diff --git a/vendor/google/cloud-core/src/RequestWrapper.php b/vendor/google/cloud-core/src/RequestWrapper.php new file mode 100644 index 00000000..b699525c --- /dev/null +++ b/vendor/google/cloud-core/src/RequestWrapper.php @@ -0,0 +1,447 @@ +`. + * @type callable $authHttpHandler A handler used to deliver PSR-7 + * requests specifically for authentication. Function signature + * should match: + * `function (RequestInterface $request, array $options = []) : ResponseInterface`. + * @type callable $httpHandler A handler used to deliver PSR-7 requests. + * Function signature should match: + * `function (RequestInterface $request, array $options = []) : ResponseInterface`. + * @type array $restOptions HTTP client specific configuration options. + * @type bool $shouldSignRequest Whether to enable request signing. + * @type callable $restRetryFunction Sets the conditions for whether or + * not a request should attempt to retry. Function signature should + * match: `function (\Exception $ex) : bool`. + * @type callable $restDelayFunction Executes a delay, defaults to + * utilizing `usleep`. Function signature should match: + * `function (int $delay) : void`. + * @type callable $restCalcDelayFunction Sets the conditions for + * determining how long to wait between attempts to retry. Function + * signature should match: `function (int $attempt) : int`. + * } + */ + public function __construct(array $config = []) + { + $this->setCommonDefaults($config); + $config += [ + 'accessToken' => null, + 'asyncHttpHandler' => null, + 'authHttpHandler' => null, + 'httpHandler' => null, + 'restOptions' => [], + 'shouldSignRequest' => true, + 'componentVersion' => null, + 'restRetryFunction' => null, + 'restDelayFunction' => null, + 'restCalcDelayFunction' => null + ]; + + $this->componentVersion = $config['componentVersion']; + $this->accessToken = $config['accessToken']; + $this->restOptions = $config['restOptions']; + $this->shouldSignRequest = $config['shouldSignRequest']; + $this->retryFunction = $config['restRetryFunction'] ?: $this->getRetryFunction(); + $this->delayFunction = $config['restDelayFunction'] ?: function ($delay) { + usleep($delay); + }; + $this->calcDelayFunction = $config['restCalcDelayFunction']; + $this->httpHandler = $config['httpHandler'] ?: HttpHandlerFactory::build(); + $this->authHttpHandler = $config['authHttpHandler'] ?: $this->httpHandler; + $this->asyncHttpHandler = $config['asyncHttpHandler'] ?: $this->buildDefaultAsyncHandler(); + + if ($this->credentialsFetcher instanceof AnonymousCredentials) { + $this->shouldSignRequest = false; + } + } + + /** + * Deliver the request. + * + * @param RequestInterface $request A PSR-7 request. + * @param array $options [optional] { + * Request options. + * + * @type float $requestTimeout Seconds to wait before timing out the + * request. **Defaults to** `0`. + * @type int $retries Number of retries for a failed request. + * **Defaults to** `3`. + * @type callable $restRetryFunction Sets the conditions for whether or + * not a request should attempt to retry. Function signature should + * match: `function (\Exception $ex) : bool`. + * @type callable $restDelayFunction Executes a delay, defaults to + * utilizing `usleep`. Function signature should match: + * `function (int $delay) : void`. + * @type callable $restCalcDelayFunction Sets the conditions for + * determining how long to wait between attempts to retry. Function + * signature should match: `function (int $attempt) : int`. + * @type array $restOptions HTTP client specific configuration options. + * } + * @return ResponseInterface + */ + public function send(RequestInterface $request, array $options = []) + { + $retryOptions = $this->getRetryOptions($options); + $backoff = new ExponentialBackoff( + $retryOptions['retries'], + $retryOptions['retryFunction'] + ); + + if ($retryOptions['delayFunction']) { + $backoff->setDelayFunction($retryOptions['delayFunction']); + } + + if ($retryOptions['calcDelayFunction']) { + $backoff->setCalcDelayFunction($retryOptions['calcDelayFunction']); + } + + try { + return $backoff->execute($this->httpHandler, [ + $this->applyHeaders($request), + $this->getRequestOptions($options) + ]); + } catch (\Exception $ex) { + throw $this->convertToGoogleException($ex); + } + } + + /** + * Deliver the request asynchronously. + * + * @param RequestInterface $request A PSR-7 request. + * @param array $options [optional] { + * Request options. + * + * @type float $requestTimeout Seconds to wait before timing out the + * request. **Defaults to** `0`. + * @type int $retries Number of retries for a failed request. + * **Defaults to** `3`. + * @type callable $restRetryFunction Sets the conditions for whether or + * not a request should attempt to retry. Function signature should + * match: `function (\Exception $ex, int $retryAttempt) : bool`. + * @type callable $restDelayFunction Executes a delay, defaults to + * utilizing `usleep`. Function signature should match: + * `function (int $delay) : void`. + * @type callable $restCalcDelayFunction Sets the conditions for + * determining how long to wait between attempts to retry. Function + * signature should match: `function (int $attempt) : int`. + * @type array $restOptions HTTP client specific configuration options. + * } + * @return PromiseInterface + * @experimental The experimental flag means that while we believe this method + * or class is ready for use, it may change before release in backwards- + * incompatible ways. Please use with caution, and test thoroughly when + * upgrading. + */ + public function sendAsync(RequestInterface $request, array $options = []) + { + // Unfortunately, the current ExponentialBackoff implementation doesn't + // play nicely with promises. + $retryAttempt = 0; + $fn = function ($retryAttempt) use (&$fn, $request, $options) { + $asyncHttpHandler = $this->asyncHttpHandler; + $retryOptions = $this->getRetryOptions($options); + if (!$retryOptions['calcDelayFunction']) { + $retryOptions['calcDelayFunction'] = [ExponentialBackoff::class, 'calculateDelay']; + } + + return $asyncHttpHandler( + $this->applyHeaders($request), + $this->getRequestOptions($options) + )->then(null, function (\Exception $ex) use ($fn, $retryAttempt, $retryOptions) { + $shouldRetry = $retryOptions['retryFunction']($ex, $retryAttempt); + + if ($shouldRetry === false || $retryAttempt >= $retryOptions['retries']) { + throw $this->convertToGoogleException($ex); + } + + $delay = $retryOptions['calcDelayFunction']($retryAttempt); + $retryOptions['delayFunction']($delay); + $retryAttempt++; + + return $fn($retryAttempt); + }); + }; + + return $fn($retryAttempt); + } + + /** + * Applies headers to the request. + * + * @param RequestInterface $request A PSR-7 request. + * @return RequestInterface + */ + private function applyHeaders(RequestInterface $request) + { + $headers = [ + 'User-Agent' => 'gcloud-php/' . $this->componentVersion, + 'x-goog-api-client' => 'gl-php/' . PHP_VERSION . ' gccl/' . $this->componentVersion, + ]; + + if ($this->shouldSignRequest) { + $quotaProject = $this->quotaProject; + $token = null; + + if ($this->accessToken) { + $token = $this->accessToken; + } else { + $credentialsFetcher = $this->getCredentialsFetcher(); + $token = $this->fetchCredentials($credentialsFetcher)['access_token']; + + if ($credentialsFetcher instanceof GetQuotaProjectInterface) { + $quotaProject = $credentialsFetcher->getQuotaProject(); + } + } + + $headers['Authorization'] = 'Bearer ' . $token; + + if ($quotaProject) { + $headers['X-Goog-User-Project'] = [$quotaProject]; + } + } + + return Utils::modifyRequest($request, ['set_headers' => $headers]); + } + + /** + * Fetches credentials. + * + * @param FetchAuthTokenInterface $credentialsFetcher + * @return array + */ + private function fetchCredentials(FetchAuthTokenInterface $credentialsFetcher) + { + $backoff = new ExponentialBackoff($this->retries, $this->getRetryFunction()); + + try { + return $backoff->execute( + [$credentialsFetcher, 'fetchAuthToken'], + [$this->authHttpHandler] + ); + } catch (\Exception $ex) { + throw $this->convertToGoogleException($ex); + } + } + + /** + * Convert any exception to a Google Exception. + * + * @param \Exception $ex + * @return Exception\ServiceException + */ + private function convertToGoogleException(\Exception $ex) + { + switch ($ex->getCode()) { + case 400: + $exception = Exception\BadRequestException::class; + break; + + case 404: + $exception = Exception\NotFoundException::class; + break; + + case 409: + $exception = Exception\ConflictException::class; + break; + + case 412: + $exception = Exception\FailedPreconditionException::class; + break; + + case 500: + $exception = Exception\ServerException::class; + break; + + case 504: + $exception = Exception\DeadlineExceededException::class; + break; + + default: + $exception = Exception\ServiceException::class; + break; + } + + return new $exception($this->getExceptionMessage($ex), $ex->getCode(), $ex); + } + + /** + * Gets the exception message. + * + * @access private + * @param \Exception $ex + * @return string + */ + private function getExceptionMessage(\Exception $ex) + { + if ($ex instanceof RequestException && $ex->hasResponse()) { + return (string) $ex->getResponse()->getBody(); + } + + return $ex->getMessage(); + } + + /** + * Gets a set of request options. + * + * @param array $options + * @return array + */ + private function getRequestOptions(array $options) + { + $restOptions = isset($options['restOptions']) + ? $options['restOptions'] + : $this->restOptions; + $timeout = isset($options['requestTimeout']) + ? $options['requestTimeout'] + : $this->requestTimeout; + + if ($timeout && !array_key_exists('timeout', $restOptions)) { + $restOptions['timeout'] = $timeout; + } + + return $restOptions; + } + + /** + * Gets a set of retry options. + * + * @param array $options + * @return array + */ + private function getRetryOptions(array $options) + { + return [ + 'retries' => isset($options['retries']) + ? $options['retries'] + : $this->retries, + 'retryFunction' => isset($options['restRetryFunction']) + ? $options['restRetryFunction'] + : $this->retryFunction, + 'delayFunction' => isset($options['restDelayFunction']) + ? $options['restDelayFunction'] + : $this->delayFunction, + 'calcDelayFunction' => isset($options['restCalcDelayFunction']) + ? $options['restCalcDelayFunction'] + : $this->calcDelayFunction + ]; + } + + /** + * Builds the default async HTTP handler. + * + * @return callable + */ + private function buildDefaultAsyncHandler() + { + $isGuzzleHandler = $this->httpHandler instanceof Guzzle6HttpHandler + || $this->httpHandler instanceof Guzzle5HttpHandler; + + return $isGuzzleHandler + ? [$this->httpHandler, 'async'] + : [HttpHandlerFactory::build(), 'async']; + } +} diff --git a/vendor/google/cloud-core/src/RequestWrapperTrait.php b/vendor/google/cloud-core/src/RequestWrapperTrait.php new file mode 100644 index 00000000..887f26ee --- /dev/null +++ b/vendor/google/cloud-core/src/RequestWrapperTrait.php @@ -0,0 +1,210 @@ + new MemoryCacheItemPool(), + 'authCacheOptions' => [], + 'credentialsFetcher' => null, + 'keyFile' => null, + 'requestTimeout' => null, + 'retries' => 3, + 'scopes' => null, + 'quotaProject' => null + ]; + + if ($config['credentialsFetcher'] && !$config['credentialsFetcher'] instanceof FetchAuthTokenInterface) { + throw new \InvalidArgumentException('credentialsFetcher must implement FetchAuthTokenInterface.'); + } + + if (!$config['authCache'] instanceof CacheItemPoolInterface) { + throw new \InvalidArgumentException('authCache must implement CacheItemPoolInterface.'); + } + + $this->authCache = $config['authCache']; + $this->authCacheOptions = $config['authCacheOptions']; + $this->credentialsFetcher = $config['credentialsFetcher']; + $this->retries = $config['retries']; + $this->scopes = $config['scopes']; + $this->keyFile = $config['keyFile']; + $this->requestTimeout = $config['requestTimeout']; + $this->quotaProject = $config['quotaProject']; + } + + /** + * Get the Keyfile. + * + * @return array + */ + public function keyFile() + { + return $this->keyFile; + } + + /** + * Get the scopes + * + * @return array + */ + public function scopes() + { + return $this->scopes; + } + + /** + * Gets the credentials fetcher and sets up caching. Precedence is as + * follows: + * + * - A user supplied credentials fetcher instance. + * - Credentials created from a keyfile. + * - Application default credentials. + * - Anonymous credentials. + * + * @return FetchAuthTokenInterface + */ + public function getCredentialsFetcher() + { + $fetcher = null; + + if ($this->credentialsFetcher) { + $fetcher = $this->credentialsFetcher; + } elseif ($this->keyFile) { + if ($this->quotaProject) { + $this->keyFile['quota_project_id'] = $this->quotaProject; + } + + $fetcher = CredentialsLoader::makeCredentials($this->scopes, $this->keyFile); + } else { + try { + $fetcher = $this->getADC(); + } catch (\DomainException $ex) { + $fetcher = new AnonymousCredentials(); + } + } + + if ($fetcher instanceof FetchAuthTokenCache) { + // The fetcher has already been wrapped in a cache by `ApplicationDefaultCredentials`; + // no need to wrap it another time. + return $fetcher; + } else { + return new FetchAuthTokenCache( + $fetcher, + $this->authCacheOptions, + $this->authCache + ); + } + } + + /** + * Returns application default credentials. Abstracted out for unit testing. + * + * @return FetchAuthTokenInterface + * @throws \DomainException + */ + protected function getADC() + { + return ApplicationDefaultCredentials::getCredentials( + $this->scopes, + $this->authHttpHandler, + $this->authCacheOptions, + $this->authCache, + $this->quotaProject + ); + } +} diff --git a/vendor/google/cloud-core/src/RestTrait.php b/vendor/google/cloud-core/src/RestTrait.php new file mode 100644 index 00000000..ce8cac4a --- /dev/null +++ b/vendor/google/cloud-core/src/RestTrait.php @@ -0,0 +1,134 @@ +requestBuilder = $requestBuilder; + } + + /** + * Sets the request wrapper. + * + * @param RequestWrapper $requestWrapper Wrapper used to handle sending + * requests to the JSON API. + */ + public function setRequestWrapper(RequestWrapper $requestWrapper) + { + $this->requestWrapper = $requestWrapper; + } + + /** + * Get the RequestWrapper. + * + * @return RequestWrapper|null + */ + public function requestWrapper() + { + return $this->requestWrapper; + } + + /** + * Delivers a request built from the service definition. + * + * @param string $resource The resource type used for the request. + * @param string $method The method used for the request. + * @param array $options [optional] Options used to build out the request. + * @param array $whitelisted [optional] + * @return array + */ + public function send($resource, $method, array $options = [], $whitelisted = false) + { + $options += [ + 'prettyPrint' => false, + ]; + $requestOptions = $this->pluckArray([ + 'restOptions', + 'retries', + 'requestTimeout' + ], $options); + + try { + return json_decode( + $this->requestWrapper->send( + $this->requestBuilder->build($resource, $method, $options), + $requestOptions + )->getBody(), + true + ); + } catch (NotFoundException $e) { + if ($whitelisted) { + throw $this->modifyWhitelistedError($e); + } + + throw $e; + } + } + + /** + * Return a custom API endpoint in the proper format, or default if none provided. + * + * @param string $default + * @param array $config + * @return string + */ + private function getApiEndpoint($default, array $config) + { + $res = isset($config['apiEndpoint']) + ? $config['apiEndpoint'] + : $default; + + if (substr($res, -1) !== '/') { + $res = $res . '/'; + } + + if (strpos($res, '//') === false) { + $res = 'https://' . $res; + } + + return $res; + } +} diff --git a/vendor/google/cloud-core/src/Retry.php b/vendor/google/cloud-core/src/Retry.php new file mode 100644 index 00000000..1255ebce --- /dev/null +++ b/vendor/google/cloud-core/src/Retry.php @@ -0,0 +1,114 @@ + (int >= 0), 'nanos' => (int >= 0)] specifying how + * long an operation should pause before retrying. Should accept a + * single argument of type `\Exception`. + * @param callable $retryFunction [optional] returns bool for whether or not + * to retry. + */ + public function __construct( + $retries, + callable $delayFunction, + callable $retryFunction = null + ) { + $this->retries = $retries !== null ? (int) $retries : 3; + $this->delayFunction = $delayFunction; + $this->retryFunction = $retryFunction; + } + + /** + * Executes the retry process. + * + * @param callable $function + * @param array $arguments [optional] + * @return mixed + * @throws \Exception The last exception caught while retrying. + */ + public function execute(callable $function, array $arguments = []) + { + $delayFunction = $this->delayFunction; + $retryAttempt = 0; + + $continue = true; + do { + try { + $res = call_user_func_array($function, $arguments); + $continue = false; + return $res; + } catch (\Exception $exception) { + if ($this->retryFunction) { + if (!call_user_func($this->retryFunction, $exception, $retryAttempt)) { + throw $exception; + } + } + + if ($retryAttempt < $this->retries) { + $delay = $delayFunction($exception); + $delay += [ + 'seconds' => 0, + 'nanos' => 0 + ]; + + time_nanosleep($delay['seconds'], $delay['nanos']); + + $retryAttempt++; + } else { + $continue = false; + throw $exception; + } + } + } while ($continue); + } + + /** + * @param callable $delayFunction + * @return void + */ + public function setDelayFunction(callable $delayFunction) + { + $this->delayFunction = $delayFunction; + } +} diff --git a/vendor/google/cloud-core/src/RetryDeciderTrait.php b/vendor/google/cloud-core/src/RetryDeciderTrait.php new file mode 100644 index 00000000..d0d9fbde --- /dev/null +++ b/vendor/google/cloud-core/src/RetryDeciderTrait.php @@ -0,0 +1,111 @@ +httpRetryCodes; + $httpRetryMessages = $this->httpRetryMessages; + + return function (\Exception $ex) use ($httpRetryCodes, $httpRetryMessages, $shouldRetryMessages) { + $statusCode = $ex->getCode(); + + if (in_array($statusCode, $httpRetryCodes)) { + return true; + } + + if (!$shouldRetryMessages) { + return false; + } + + $message = ($ex instanceof RequestException && $ex->hasResponse()) + ? (string) $ex->getResponse()->getBody() + : $ex->getMessage(); + + try { + $message = $this->jsonDecode( + $message, + true + ); + } catch (\InvalidArgumentException $ex) { + return false; + } + + if (!isset($message['error']['errors'])) { + return false; + } + + foreach ($message['error']['errors'] as $error) { + if (in_array($error['reason'], $httpRetryMessages)) { + return true; + } + } + + return false; + }; + } + + /** + * @param array $codes + */ + private function setHttpRetryCodes(array $codes) + { + $this->httpRetryCodes = $codes; + } + + /** + * @param array $messages + */ + private function setHttpRetryMessages(array $messages) + { + $this->httpRetryMessages = $messages; + } +} diff --git a/vendor/google/cloud-core/src/ServiceBuilder.php b/vendor/google/cloud-core/src/ServiceBuilder.php new file mode 100644 index 00000000..94c645f6 --- /dev/null +++ b/vendor/google/cloud-core/src/ServiceBuilder.php @@ -0,0 +1,447 @@ + 'myAwesomeProject' + * ]); + * ``` + * + * @param array $config [optional] { + * Configuration options. + * + * @type string $projectId The project ID from the Google Developer's + * Console. + * @type CacheItemPoolInterface $authCache A cache for storing access + * tokens. **Defaults to** a simple in memory implementation. + * @type array $authCacheOptions Cache configuration options. + * @type callable $authHttpHandler A handler used to deliver Psr7 + * requests specifically for authentication. + * @type callable $httpHandler A handler used to deliver Psr7 requests. + * Only valid for requests sent over REST. + * @type array $keyFile The contents of the service account credentials + * .json file retrieved from the Google Developer's Console. + * Ex: `json_decode(file_get_contents($path), true)`. + * @type string $keyFilePath The full path to your service account + * credentials .json file retrieved from the Google Developers + * Console. + * @type int $retries Number of retries for a failed request. + * **Defaults to** `3`. + * @type array $scopes Scopes to be used for the request. + * } + */ + public function __construct(array $config = []) + { + $this->config = $this->resolveConfig($config); + } + + /** + * Google Cloud BigQuery allows you to create, manage, share and query + * data. Find more information at the + * [Google Cloud BigQuery Docs](https://cloud.google.com/bigquery/docs). + * + * Example: + * ``` + * $bigQuery = $cloud->bigQuery(); + * ``` + * + * @param array $config [optional] { + * Configuration options. See + * {@see Google\Cloud\Core\ServiceBuilder::__construct()} for the other available options. + * + * @type bool $returnInt64AsObject If true, 64 bit integers will be + * returned as a {@see Google\Cloud\Core\Int64} object for 32 bit + * platform compatibility. **Defaults to** false. + * @type string $location If provided, determines the default geographic + * location used when creating datasets and managing jobs. Please + * note: This is only required for jobs started outside of the US + * and EU regions. Also, if location metadata has already been + * fetched over the network it will take precedent over this + * setting. + * } + * @return BigQueryClient + */ + public function bigQuery(array $config = []) + { + return $this->createClient(BigQueryClient::class, 'bigquery', $config); + } + + /** + * Google Cloud Datastore is a highly-scalable NoSQL database for your + * applications. Find more information at the + * [Google Cloud Datastore docs](https://cloud.google.com/datastore/docs/). + * + * Example: + * ``` + * $datastore = $cloud->datastore(); + * ``` + * + * @param array $config [optional] { + * Configuration options. See + * {@see Google\Cloud\Core\ServiceBuilder::__construct()} for the other available options. + * + * @type bool $returnInt64AsObject If true, 64 bit integers will be + * returned as a {@see Google\Cloud\Core\Int64} object for 32 bit + * platform compatibility. **Defaults to** false. + * @return DatastoreClient + */ + public function datastore(array $config = []) + { + return $this->createClient(DatastoreClient::class, 'datastore', $config); + } + + /** + * Cloud Firestore is a flexible, scalable, realtime database for mobile, + * web, and server development. Find more information at the + * [Google Cloud firestore docs](https://cloud.google.com/firestore/docs/). + * + * Example: + * ``` + * $firestore = $cloud->firestore(); + * ``` + * + * @param array $config [optional] { + * Configuration options. See + * {@see Google\Cloud\Core\ServiceBuilder::__construct()} for the other available options. + * + * @type bool $returnInt64AsObject If true, 64 bit integers will be + * returned as a {@see Google\Cloud\Core\Int64} object for 32 bit + * platform compatibility. **Defaults to** false. + * @return FirestoreClient + */ + public function firestore(array $config = []) + { + return $this->createClient(FirestoreClient::class, 'firestore', $config); + } + + /** + * Google Stackdriver Logging allows you to store, search, analyze, monitor, + * and alert on log data and events from Google Cloud Platform and Amazon + * Web Services. Find more information at the + * [Google Stackdriver Logging docs](https://cloud.google.com/logging/docs/). + * + * Example: + * ``` + * $logging = $cloud->logging(); + * ``` + * + * @param array $config [optional] Configuration options. See + * {@see Google\Cloud\Core\ServiceBuilder::__construct()} for the available options. + * @return LoggingClient + */ + public function logging(array $config = []) + { + return $this->createClient(LoggingClient::class, 'logging', $config); + } + + /** + * Google Cloud Natural Language provides natural language understanding + * technologies to developers, including sentiment analysis, entity + * recognition, and syntax analysis. Currently only English, Spanish, + * and Japanese textual context are supported. Find more information at the + * [Google Cloud Natural Language docs](https://cloud.google.com/natural-language/docs/). + * + * Example: + * ``` + * $language = $cloud->language(); + * ``` + * + * @param array $config [optional] Configuration options. See + * {@see Google\Cloud\Core\ServiceBuilder::__construct()} for the available options. + * @return LanguageClient + */ + public function language(array $config = []) + { + return $this->createClient(LanguageClient::class, 'language', $config); + } + + /** + * Google Cloud Pub/Sub allows you to send and receive messages between + * independent applications. Find more information at the + * [Google Cloud Pub/Sub docs](https://cloud.google.com/pubsub/docs/). + * + * Example: + * ``` + * $pubsub = $cloud->pubsub(); + * ``` + * + * @param array $config [optional] { + * Configuration options. See + * {@see Google\Cloud\Core\ServiceBuilder::__construct()} for the other available options. + * + * @type string $transport The transport type used for requests. May be + * either `grpc` or `rest`. **Defaults to** `grpc` if gRPC support + * is detected on the system. + * @return PubSubClient + */ + public function pubsub(array $config = []) + { + return $this->createClient(PubSubClient::class, 'pubsub', $config); + } + + /** + * Google Cloud Spanner is a highly scalable, transactional, managed, NewSQL + * database service. Find more information at + * [Google Cloud Spanner API docs](https://cloud.google.com/spanner/). + * + * Example: + * ``` + * $spanner = $cloud->spanner(); + * ``` + * + * @param array $config [optional] { + * Configuration options. See + * {@see Google\Cloud\Core\ServiceBuilder::__construct()} for the other available options. + * + * @type bool $returnInt64AsObject If true, 64 bit integers will be + * returned as a {@see Google\Cloud\Core\Int64} object for 32 bit + * platform compatibility. **Defaults to** false. + * } + * @return SpannerClient + */ + public function spanner(array $config = []) + { + return $this->createClient(SpannerClient::class, 'spanner', $config); + } + + /** + * Google Cloud Speech enables easy integration of Google speech recognition + * technologies into developer applications. Send audio and receive a text + * transcription from the Cloud Speech API service. Find more information at + * the [Google Cloud Speech API docs](https://cloud.google.com/speech/docs/). + * + * Example: + * ``` + * $speech = $cloud->speech([ + * 'languageCode' => 'en-US' + * ]); + * ``` + * + * @param array $config [optional] { + * Configuration options. See + * {@see Google\Cloud\Core\ServiceBuilder::__construct()} for the other available options. + * + * @type string $languageCode The language of the content to + * be recognized. Only BCP-47 (e.g., `"en-US"`, `"es-ES"`) + * language codes are accepted. See + * [Language Support](https://cloud.google.com/speech/docs/languages) + * for a list of the currently supported language codes. + * @return SpeechClient + */ + public function speech(array $config = []) + { + return $this->createClient(SpeechClient::class, 'speech', $config); + } + + /** + * Google Cloud Storage allows you to store and retrieve data on Google's + * infrastructure. Find more information at the + * [Google Cloud Storage API docs](https://developers.google.com/storage). + * + * Example: + * ``` + * $storage = $cloud->storage(); + * ``` + * + * @param array $config [optional] Configuration options. See + * {@see Google\Cloud\Core\ServiceBuilder::__construct()} for the available options. + * @return StorageClient + */ + public function storage(array $config = []) + { + return $this->createClient(StorageClient::class, 'storage', $config); + } + + + /** + * Google Stackdriver Trace allows you to collect latency data from your applications + * and display it in the Google Cloud Platform Console. Find more information at + * [Stackdriver Trace API docs](https://cloud.google.com/trace/docs/). + * + * Example: + * ``` + * $trace = $cloud->trace(); + * ``` + * + * @param array $config [optional] Configuration options. See + * {@see Google\Cloud\Core\ServiceBuilder::__construct()} for the available options. + * @return TraceClient + */ + public function trace(array $config = []) + { + return $this->createClient(TraceClient::class, 'trace', $config); + } + + /** + * Google Cloud Vision allows you to understand the content of an image, + * classify images into categories, detect text, objects, faces and more. + * Find more information at the + * [Google Cloud Vision docs](https://cloud.google.com/vision/docs/). + * + * Example: + * ``` + * $vision = $cloud->vision(); + * ``` + * + * @param array $config [optional] Configuration options. See + * {@see Google\Cloud\Core\ServiceBuilder::__construct()} for the available options. + * @return VisionClient + */ + public function vision(array $config = []) + { + return $this->createClient(VisionClient::class, 'vision', $config); + } + + /** + * Google Cloud Translation provides the ability to dynamically translate + * text between thousands of language pairs and lets websites and programs + * integrate with translation service programmatically. + * + * The Google Cloud Translation API is available as a paid + * service. See the [Pricing](https://cloud.google.com/translation/v2/pricing) + * and [FAQ](https://cloud.google.com/translation/v2/faq) pages for details. + * Find more information at the the + * [Google Cloud Translation docs](https://cloud.google.com/translation/docs/). + * + * Please note that while the Google Cloud Translation API supports + * authentication via service account and application default credentials + * like other Cloud Platform APIs, it also supports authentication via a + * public API access key. If you wish to authenticate using an API key, + * follow the + * [before you begin](https://cloud.google.com/translation/v2/translating-text-with-rest#before-you-begin) + * instructions to learn how to generate a key. + * + * Example: + * ``` + * use Google\Cloud\Core\ServiceBuilder; + * + * $builder = new ServiceBuilder([ + * 'key' => 'YOUR_KEY' + * ]); + * + * $translate = $builder->translate(); + * ``` + * + * @param array $config [optional] { + * Configuration options. + * + * @type string $key A public API access key. + * @type string $target The target language to assign to the client. + * Defaults to `en` (English). + * @type callable $httpHandler A handler used to deliver Psr7 requests. + * Only valid for requests sent over REST. + * @type int $retries Number of retries for a failed request. + * **Defaults to** `3`. + * } + * @return TranslateClient + */ + public function translate(array $config = []) + { + return $this->createClient(TranslateClient::class, 'translate', $config); + } + + /** + * Create the client library, or error if not installed. + * + * @param string $class The class to create. + * @param string $packageName The name of the package + * @param array $config Configuration options. + */ + private function createClient($class, $packageName, array $config = []) + { + if (class_exists($class)) { + return new $class($this->resolveConfig($config + $this->config)); + } + throw new \Exception(sprintf( + 'The google/cloud-%s package is missing and must be installed.', + $packageName + )); + } + + /** + * Resolves configuration options. + * + * @param array $config + * @return array + */ + private function resolveConfig(array $config) + { + if (!isset($config['httpHandler'])) { + $config['httpHandler'] = HttpHandlerFactory::build(); + } + + if (!isset($config['asyncHttpHandler'])) { + $isGuzzleHandler = $config['httpHandler'] instanceof Guzzle6HttpHandler + || $config['httpHandler'] instanceof Guzzle5HttpHandler; + $config['asyncHttpHandler'] = $isGuzzleHandler + ? [$config['httpHandler'], 'async'] + : [HttpHandlerFactory::build(), 'async']; + } + + return array_merge($this->config, $config); + } +} diff --git a/vendor/google/cloud-core/src/SysvTrait.php b/vendor/google/cloud-core/src/SysvTrait.php new file mode 100644 index 00000000..decb4026 --- /dev/null +++ b/vendor/google/cloud-core/src/SysvTrait.php @@ -0,0 +1,63 @@ +value = $value; + $this->util = $util ?: new StringUtil(); + } + + /** + * @param mixed $argument + * @return bool|int + * + * @experimental + * @internal + */ + public function scoreArgument($argument) + { + return $this->compare($this->value, $argument) ? 11 : false; + } + + private function compare(array $value, array $argument) + { + array_multisort($value); + array_multisort($argument); + + return $value == $argument; + } + + /** + * @return bool + * + * @experimental + * @internal + */ + public function isLast() + { + return false; + } + + /** + * @return string + * + * @experimental + * @internal + */ + public function __toString() + { + if ($this->string) { + $string = $this->string .': (%s)'; + } else { + $string = 'same(%s)'; + } + + return sprintf($string, $this->util->stringify($this->value)); + } +} diff --git a/vendor/google/cloud-core/src/Testing/CheckForClassTrait.php b/vendor/google/cloud-core/src/Testing/CheckForClassTrait.php new file mode 100644 index 00000000..8b732690 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/CheckForClassTrait.php @@ -0,0 +1,45 @@ +markTestSkipped("Missing required class: $class"); + return; + } + } + } +} diff --git a/vendor/google/cloud-core/src/Testing/DatastoreOperationRefreshTrait.php b/vendor/google/cloud-core/src/Testing/DatastoreOperationRefreshTrait.php new file mode 100644 index 00000000..d3e65d35 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/DatastoreOperationRefreshTrait.php @@ -0,0 +1,69 @@ + null, + 'returnInt64AsObject' => false, + 'encode' => false + ]; + + $mapper = new EntityMapper( + $options['projectId'], + $options['encode'], + $options['returnInt64AsObject'] + ); + + $stub->___setProperty('operation', new Operation( + $connection, + $options['projectId'], + $options['returnInt64AsObject'], + $mapper + )); + + return $stub; + } +} diff --git a/vendor/google/cloud-core/src/Testing/DocBlockStripSpaces.php b/vendor/google/cloud-core/src/Testing/DocBlockStripSpaces.php new file mode 100644 index 00000000..a8f0a4e8 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/DocBlockStripSpaces.php @@ -0,0 +1,49 @@ +projectRootPath = $projectRootPath; + $this->fileTypes = $fileTypes; + $this->testPaths = $testPaths; + $this->excludes = $excludes; + + parent::__construct($iterator); + } + + /** + * Decides whether to include the file or exclude it. + * + * @return bool + * + * @experimental + * @internal + */ + public function accept() + { + /** @var \SplFileInfo */ + $file = parent::current(); + + $path = '/' . trim(str_replace($this->projectRootPath, '', realpath($file->getPathName())), '/'); + + if (!in_array($file->getExtension(), $this->fileTypes)) { + return false; + } + + foreach ($this->excludes as $exclude) { + if ($exclude instanceof RegexFileFilter) { + $pattern = $exclude->regex; + + if (preg_match($pattern, $path) === 1) { + return false; + } + + continue; + } + + if (strpos($exclude, '/') !== 0 && strpos($path, $exclude) !== false) { + return false; + } + + if (strpos($path, $exclude) === 0) { + return false; + } + } + + foreach ($this->testPaths as $testPath) { + if (strpos($path, $testPath) !== false) { + return false; + } + } + + return true; + } +} diff --git a/vendor/google/cloud-core/src/Testing/GcTestListener.php b/vendor/google/cloud-core/src/Testing/GcTestListener.php new file mode 100644 index 00000000..c351029b --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/GcTestListener.php @@ -0,0 +1,24 @@ +markTestSkipped('Must have the grpc extension installed to run this test.'); + } + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('gRPC is not supported on HHVM.'); + } + } + + /** + * @return bool True if grpc tests should be skipped, otherwise false + * + * @experimental + * @internal + */ + public function shouldSkipGrpcTests() + { + return !extension_loaded('grpc') || defined('HHVM_VERSION'); + } +} diff --git a/vendor/google/cloud-core/src/Testing/KeyPairGenerateTrait.php b/vendor/google/cloud-core/src/Testing/KeyPairGenerateTrait.php new file mode 100644 index 00000000..eb7a046a --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/KeyPairGenerateTrait.php @@ -0,0 +1,50 @@ +setSignatureMode(RSA::SIGNATURE_PKCS1); + $rsa->setHash('sha256'); + + $key = $rsa->createKey(); + usleep(500); + return [$key['privatekey'], $key['publickey']]; + } + + private function verifySignature($privateKey, $input, $signature) + { + $verify = $this->signString($privateKey, $input); + + return urlencode(base64_encode($verify)) === $signature; + } +} diff --git a/vendor/google/cloud-core/src/Testing/Lock/MockGlobals.php b/vendor/google/cloud-core/src/Testing/Lock/MockGlobals.php new file mode 100644 index 00000000..882e35d3 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/Lock/MockGlobals.php @@ -0,0 +1,64 @@ +regex = $regex; + } +} diff --git a/vendor/google/cloud-core/src/Testing/Snippet/Container.php b/vendor/google/cloud-core/src/Testing/Snippet/Container.php new file mode 100644 index 00000000..bfc0e914 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/Snippet/Container.php @@ -0,0 +1,42 @@ +scanner = $scanner; + } + + private function getSnippetExcludeList() + { + return static::$snippetExcludeList; + } + + /** + * Creates a list of all snippets which should be covered. + * + * @return Snippet[] + * + * @experimental + * @internal + */ + public function buildListToCover() + { + $files = $this->scanner->files(); + $classes = $this->scanner->classes($files, $this->getSnippetExcludeList()); + + $this->snippets = $this->scanner->snippets($classes); + + return $this->snippets; + } + + /** + * Mark a snippet as covered. + * + * @param string $identifier The identifier of the snippet being covered. + * @return void + * + * @experimental + * @internal + */ + public function cover($identifier) + { + $this->covered[] = $identifier; + } + + /** + * Return a list of all snippets not marked a covered. + * + * @return Snippet[] + * + * @experimental + * @internal + */ + public function uncovered() + { + return array_diff_key($this->snippets, array_flip($this->covered)); + } + + /** + * @param string|int $identifier + * @return Snippet|null + * + * @experimental + * @internal + */ + public function cache($identifier) + { + return (array_key_exists($identifier, $this->snippets)) + ? $this->snippets[$identifier] + : null; + } +} diff --git a/vendor/google/cloud-core/src/Testing/Snippet/Coverage/ExcludeFilter.php b/vendor/google/cloud-core/src/Testing/Snippet/Coverage/ExcludeFilter.php new file mode 100644 index 00000000..6ca0bce0 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/Snippet/Coverage/ExcludeFilter.php @@ -0,0 +1,58 @@ +excludeDirs = $excludeDirs; + } + + /** + * @return bool Determines whether to accept or exclude a path + */ + public function accept() + { + // Accept the current item if we can recurse into it + // or it is a value starting with "test" + foreach ($this->excludeDirs as $excludeDir) { + if (strpos($this->current(), $excludeDir) !== false) { + return false; + } + } + return true; + } +} diff --git a/vendor/google/cloud-core/src/Testing/Snippet/Coverage/ResultPrinter.php b/vendor/google/cloud-core/src/Testing/Snippet/Coverage/ResultPrinter.php new file mode 100644 index 00000000..122f9e5e --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/Snippet/Coverage/ResultPrinter.php @@ -0,0 +1,75 @@ +uncovered(); + Container::reset(); + + if (!empty($uncovered)) { + $this->writeWithColor('bg-red', sprintf("NOTICE: %s uncovered snippets!", count($uncovered))); + + if ($this->verbose) { + $i = 0; + foreach ($uncovered as $snippet) { + $fqn = $snippet->fqn(); + $type = (strpos($fqn, '::') !== false) + ? 'Method' + : 'Class'; + + $this->write("$i: $type example: {$snippet->fqn()}[{$snippet->index()}]"); + $this->writeNewLine(); + $this->write("Declared on or around {$snippet->file()}:{$snippet->line()}"); + $this->writeNewLine(); + $this->writeNewLine(); + + $i++; + } + } else { + $this->write("Run command with `--verbose` flag to see uncovered snippets."); + } + + if (extension_loaded('grpc')) { + exit(1); + } + } + } +} diff --git a/vendor/google/cloud-core/src/Testing/Snippet/Coverage/Scanner.php b/vendor/google/cloud-core/src/Testing/Snippet/Coverage/Scanner.php new file mode 100644 index 00000000..ada4249c --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/Snippet/Coverage/Scanner.php @@ -0,0 +1,164 @@ +parser = $parser; + if (is_string($basePath)) { + $basePath = [$basePath]; + } + $this->basePath = $basePath; + $this->exclude = $exclude; + } + + /** + * Retrieve a list of PHP files to scan. + * + * @return string[] + * + * @experimental + * @internal + */ + public function files() + { + $files = []; + + foreach ($this->basePath as $path) { + $directoryIterator = new \RecursiveDirectoryIterator($path); + $iterator = new \RecursiveIteratorIterator($directoryIterator); + $fileList = new FileListFilterIterator( + $path, + $iterator, + ['php'], + [ + '/tests/' + ], + $this->exclude + ); + + foreach ($fileList as $item) { + array_push($files, realPath($item->getPathName())); + } + } + + return $files; + } + + private function checkExclude($className, array $exclude) + { + foreach ($exclude as $pattern) { + if (preg_match($pattern, $className)) { + return true; + } + } + return false; + } + + /** + * Retrieve a list of classes in the given PHP files. + * + * @param array $files + * @param array $exclude + * @return string[] + * + * @experimental + * @internal + */ + public function classes(array $files, array $exclude = []) + { + $classes = []; + foreach ($files as $file) { + $f = new FileReflector($file); + $f->process(); + foreach ($f->getClasses() as $class) { + if ($this->checkExclude($class->getName(), $exclude)) { + continue; + } + $classes[] = $class->getName(); + } + } + return $classes; + } + + /** + * Get a list of all snippets from the given classes. + * + * @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[] + * + * @experimental + * @internal + * @throws \ReflectionException + */ + public function snippets(array $classes) + { + $snippets = []; + foreach ($classes as $class) { + try { + $snippets = array_merge( + $snippets, + $this->parser->allExamples(new \ReflectionClass($class)) + ); + } catch (\ReflectionException $e) { + throw new \RuntimeException(sprintf( + "Error in class %s: %s", + $class, + $e->getMessage() + )); + } + } + + return $snippets; + } +} diff --git a/vendor/google/cloud-core/src/Testing/Snippet/Coverage/ScannerInterface.php b/vendor/google/cloud-core/src/Testing/Snippet/Coverage/ScannerInterface.php new file mode 100644 index 00000000..8d3702d9 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/Snippet/Coverage/ScannerInterface.php @@ -0,0 +1,59 @@ +returnVal = $returnVal; + $this->output = $output; + } + + /** + * @return mixed + */ + public function returnVal() + { + return $this->returnVal; + } + + /** + * @return mixed + */ + public function output() + { + return $this->output; + } +} diff --git a/vendor/google/cloud-core/src/Testing/Snippet/Parser/Parser.php b/vendor/google/cloud-core/src/Testing/Snippet/Parser/Parser.php new file mode 100644 index 00000000..09ff8b45 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/Snippet/Parser/Parser.php @@ -0,0 +1,336 @@ +classExample(Parser::class); + * ``` + * + * @param string $class the name of the class + * @param int|string $index The index of the example to return. + * @return Snippet + * @throws Exception + */ + public function classExample($class, $index = 0) + { + $class = new ReflectionClass($class); + $examples = $this->examplesFromClass($class); + + $result = array_filter($examples, function ($example) use ($index) { + return ($example->index() == $index); + }); + + if (empty($result)) { + throw new \Exception(sprintf( + 'Given snippet index %d does not exist for class %s', + $index, + $class->getName() + )); + } + + return current($result); + } + + /** + * Get a snippet from a method. + * + * Example: + * ``` + * use Google\Cloud\Core\Testing\Snippet\Parser\Parser; + * + * $snippet = $parser->methodExample(Parser::class, 'methodExample'); + * ``` + * + * ``` + * use Google\Cloud\Core\Testing\Snippet\Parser\Parser; + * + * // Get the 2nd example (index=1) + * $snippet = $parser->methodExample(Parser::class, 'methodExample', 1); + * ``` + * + * @param string $class The name of the class. + * @param string $method The name of the method. + * @param int $index The 0-indexed example to return. + * @return Snippet + * @throws Exception + */ + public function methodExample($class, $method, $index = 0) + { + $examples = $this->examplesFromMethod($class, $method); + + $result = array_filter($examples, function ($example) use ($index) { + return ($example->index() === $index); + }); + + if (empty($result)) { + throw new \Exception(sprintf( + 'Given snippet index %d does not exist for method %s::%s', + $index, + $class, + $method + )); + } + + return current($result); + } + + /** + * Retrieve all examples from a class Doc Block. + * + * Example: + * ``` + * $examples = $parser->examplesFromClass($parser); + * ``` + * + * @param object|ReflectionClass $class An instance or reflector of the + * class to parse examples from. + * @return array + */ + public function examplesFromClass($class) + { + if (!($class instanceof ReflectionClass)) { + $class = new ReflectionClass($class); + } + + $doc = new DocBlock($class); + + $magic = []; + if ($doc->getTags()) { + $magicMethods = array_filter($doc->getTags(), function ($tag) { + return ($tag->getName() === 'method'); + }); + + $methods = $this->buildMagicMethods($magicMethods, $class->getName()); + + foreach ($methods as $method) { + $magicExamples = $this->examples( + $method['doc'], + $class->getName() .'::'. $method['name'], + $class->getFileName(), + $class->getStartLine() + ); + + foreach ($magicExamples as $ex) { + $magic[$ex->identifier()] = $ex; + } + } + } + + return $this->examples( + $doc, + $class->getName(), + $class->getFileName(), + $class->getStartLine(), + $magic + ); + } + + /** + * Retrieve all examples from a method's Doc Block. + * + * Example: + * ``` + * $examples = $parser->examplesFromMethod($parser, 'examplesFromMethod'); + * ``` + * + * @param object|string $class An instance of the class to parse examples, + * or the name of the class. + * @param string|ReflectionMethod $method The name of the method to parse + * examples from. + * @return array + */ + public function examplesFromMethod($class, $method) + { + if (!($method instanceof ReflectionMethod)) { + $method = new ReflectionMethod($class, $method); + } + + if (!$method->isPublic()) { + return []; + } + + $doc = new DocBlock($method); + + $parent = $method->getDeclaringClass(); + $class = $parent->getName(); + + return $this->examples( + $doc, + $class .'::'. $method->getName(), + $method->getFileName(), + $method->getStartLine() + ); + } + + /** + * Retrieve all examples from a class and its methods. + * + * Example: + * ``` + * $examples = $parser->allExamples($parser); + * ``` + * + * @param object|ReflectionClass $class An instance or reflector of the class to parse. + * @return array + */ + public function allExamples($class) + { + if (!($class instanceof ReflectionClass)) { + $class = new ReflectionClass($class); + } + + $snippets = $this->examplesFromClass($class); + + $methods = $class->getMethods(); + foreach ($methods as $method) { + if ($method->getDeclaringClass()->name !== $class->getName()) { + continue; + } + + $snippets = array_merge($snippets, $this->examplesFromMethod($class, $method)); + } + + return $snippets; + } + + /** + * Parse examples from a DocBlock object. + * + * @param DocBlock $docBlock The DocBlock to parse + * @param string $file The filename the docblock is in + * @param int $line The line where the tested method or class is declared. + * @return array + */ + public function examples(DocBlock $docBlock, $fullyQualifiedName, $file, $line, array $magicMethods = []) + { + $text = $docBlock->getText(); + $parts = []; + + if (strpos($text, 'Example:' . PHP_EOL . '```') !== false) { + $parts = explode('Example:' . PHP_EOL, $text); + } else { + return []; + } + + $converter = new Parsedown; + $document = new DOMDocument; + + $parsedText = $converter->text($parts[1]); + $document->loadHTML($parsedText); + + $examples = $document->getElementsByTagName('code'); + + $index = 0; + $res = []; + foreach ($examples as $example) { + $name = $this->extractSnippetName($example->textContent); + + $indexOrName = $name; + if (!$name) { + $indexOrName = $index; + } + + $identifier = $this->createIdentifier($fullyQualifiedName, $indexOrName); + $snippet = new Snippet($identifier, [ + 'content' => $example->textContent, + 'fqn' => $fullyQualifiedName, + 'index' => $indexOrName, + 'name' => $name, + 'file' => $file, + 'line' => $line + ]); + + $res[$identifier] = $snippet; + $index++; + } + + $res = array_merge($res, $magicMethods); + + return $res; + } + + /** + * Create identifier + * + * @param string $fqn + * @param int|string $indexOrName + * @return string + */ + public function createIdentifier($fqn, $indexOrName) + { + return sha1($fqn . $indexOrName); + } + + private function extractSnippetName($content) + { + $matches = []; + if (!preg_match(self::SNIPPET_NAME_REGEX, $content, $matches)) { + return null; + } + + return $matches[1]; + } + + private function buildMagicMethods($magicMethods, $className) + { + $res = []; + foreach ($magicMethods as $method) { + $description = $method->getDescription(); + + if (is_null($description)) { + continue; + } + + $doc = new DocBlockStripSpaces(substr($method->getDescription(), 1, -1)); + + $res[] = [ + 'name' => $method->getMethodName(), + 'doc' => $doc + ]; + } + + return $res; + } +} diff --git a/vendor/google/cloud-core/src/Testing/Snippet/Parser/Snippet.php b/vendor/google/cloud-core/src/Testing/Snippet/Parser/Snippet.php new file mode 100644 index 00000000..3499d75d --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/Snippet/Parser/Snippet.php @@ -0,0 +1,311 @@ +identifier = $identifier; + $this->config = $config + [ + 'content' => '', + 'fqn' => '', + 'index' => 0, + 'file' => '', + 'line' => 0, + 'name' => null + ]; + } + + /** + * A unique identifier for the snippet. + * + * This identifier is deterministic and will remain constant unless the + * snippet is modified or moved. + * + * @return string + */ + public function identifier() + { + return $this->identifier; + } + + /** + * The file in which the snippet is found. + * + * @return string + */ + public function file() + { + return $this->config['file']; + } + + /** + * The Snippet fully-qualified name. + * + * @return string + */ + public function fqn() + { + return $this->config['fqn']; + } + + /** + * The line number where the snippet's method or class is declared. + * + * Note that this is NOT the line number where the snippet is declared. It + * indicates the method or class which the snippet annotates. + * + * @return int + */ + public function line() + { + return $this->config['line']; + } + + /** + * The snippet content. + * + * @return string + */ + public function content() + { + return $this->config['content']; + } + + /** + * The Snippet Index + * + * @return int + */ + public function index() + { + return $this->config['index']; + } + + /** + * The snippet name + * + * @return string + */ + public function name() + { + return $this->config['name']; + } + + /** + * Eval the snippet and return the result. + * + * @return mixed + */ + public function invoke($returnVar = null) + { + $content = $this->config['content']; + + $return = ($returnVar) + ? sprintf('return %s;', $this->createReturnVar($returnVar)) + : ''; + + $use = []; + foreach ($this->use as $class) { + $use[] = 'use '. $class .';'; + } + + if (!empty($use)) { + $content = implode("\n", $use) . $content; + } + + $cb = function ($return) use ($content) { + extract($this->locals); + + try { + ob_start(); + $res = eval($content ."\n\n". $return); + $out = ob_get_clean(); + } catch (\Exception $e) { + ob_end_clean(); + throw $e; + } + + return new InvokeResult($res, $out); + }; + + return $cb($return); + } + + /** + * Add a local variable to make available in the snippet execution scope. + * + * @param string $name The variable name + * @param mixed $value The variable value + * @return void + */ + public function addLocal($name, $value) + { + $this->locals[$name] = $value; + } + + /** + * Add a `use` statement for a class. + * + * @param string $name The class name to import. + * @return void + */ + public function addUse($name) + { + $this->use[] = $name; + } + + /** + * Replace a line with new code. + * + * Hopefully this is obvious, but be careful using this, and only use it + * when no other feasible options present themselves. It's pretty easy to + * make your test useless when you're overwriting the thing you are trying + * to test. + * + * This is provided for cases when a snippet relies on a global, or on + * something else which can not be overridden or mocked. + * + * @param int $line The line number (0-indexed) to replace. + * @param string $content The PHP code to inject. + * @return void + */ + public function setLine($line, $content) + { + $snippet = explode("\n", $this->config['content']); + $snippet[$line] = $content; + + $this->config['content'] = implode("\n", $snippet); + } + + /** + * Inject new code after a given line. + * + * Hopefully this is obvious, but be careful using this, and only use it + * when no other feasible options present themselves. It's pretty easy to + * make your test useless when you're modifying the thing you are trying + * to test. + * + * This is provided for cases when a snippet relies on a global, or on + * something else which can not be overridden or mocked. + * + * @param int $line The line number (0-indexed) to write in after. + * @param string $content The PHP code to inject. + * @return void + */ + public function insertAfterLine($line, $content) + { + $snippet = explode("\n", $this->config['content']); + array_splice($snippet, $line+1, 0, $content); + + $this->config['content'] = implode("\n", $snippet); + } + + /** + * Replace a string in the snippet with a new one. + * + * Hopefully this is obvious, but be careful using this, and only use it + * when no other feasible options present themselves. It's pretty easy to + * make your test useless when you're modifying the thing you are trying + * to test. + * + * This is provided for cases when a snippet relies on a global, or on + * something else which can not be overridden or mocked. + * + * @param string $old The string to be replaced. + * @param string $new The new string to insert. + * @return void + */ + public function replace($old, $new) + { + $this->config['content'] = str_replace($old, $new, $this->config['content']); + } + + /** + * Find something with a regex and replace it. + * + * Hopefully this is obvious, but be careful using this, and only use it + * when no other feasible options present themselves. It's pretty easy to + * make your test useless when you're modifying the thing you are trying + * to test. + * + * This is provided for cases when a snippet relies on a global, or on + * something else which can not be overridden or mocked. + * + * @param string $pattern The regex pattern to search for. + * @param string $new The new string to insert. + * @return void + */ + public function regexReplace($pattern, $new) + { + $this->config['content'] = preg_replace($pattern, $new, $this->config['content']); + } + + /** + * Serialize to json + * + * @return array + */ + public function jsonSerialize() + { + return $this->config; + } + + private function createReturnVar($returnVar) + { + if (is_array($returnVar)) { + foreach ($returnVar as $index => $var) { + $returnVar[$index] = '$'.$var; + } + + return '['. implode(',', $returnVar) .']'; + } + + return '$'. $returnVar; + } +} diff --git a/vendor/google/cloud-core/src/Testing/Snippet/SnippetTestCase.php b/vendor/google/cloud-core/src/Testing/Snippet/SnippetTestCase.php new file mode 100644 index 00000000..ab94c19a --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/Snippet/SnippetTestCase.php @@ -0,0 +1,128 @@ +createIdentifier($class, $indexOrName); + + $snippet = self::$coverage->cache($identifier); + if (!$snippet) { + $snippet = self::$parser->classExample($class, $indexOrName); + } + + self::$coverage->cover($snippet->identifier()); + + return clone $snippet; + } + + /** + * Retrieve a snippet from a magic method docblock (i.e. `@method` tag + * nexted inside a class-level docblock). + * + * @param string $class The class name + * @param string $method The method name + * @param string|int $indexOrName The index of the snippet, or its name. + * @return Snippet + * + * @experimental + * @internal + */ + public static function snippetFromMagicMethod($class, $method, $indexOrName = 0) + { + $name = $class .'::'. $method; + $identifier = self::$parser->createIdentifier($name, $indexOrName); + + $snippet = self::$coverage->cache($identifier); + if (!$snippet) { + throw new \Exception('Magic Method '. $name .' was not found'); + } + + self::$coverage->cover($identifier); + + return clone $snippet; + } + + /** + * Retrieve a snippet from a method docblock. + * + * @param string $class The class name + * @param string $method The method name + * @param string|int $indexOrName The index of the snippet, or its name. + * @return Snippet + * + * @experimental + * @internal + */ + public static function snippetFromMethod($class, $method, $indexOrName = 0) + { + $name = $class .'::'. $method; + $identifier = self::$parser->createIdentifier($name, $indexOrName); + + $snippet = self::$coverage->cache($identifier); + if (!$snippet) { + $snippet = self::$parser->methodExample($class, $method, $indexOrName); + } + + self::$coverage->cover($identifier); + + return clone $snippet; + } +} diff --git a/vendor/google/cloud-core/src/Testing/Snippet/keyfile-stub.json b/vendor/google/cloud-core/src/Testing/Snippet/keyfile-stub.json new file mode 100644 index 00000000..e1c618b7 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/Snippet/keyfile-stub.json @@ -0,0 +1,12 @@ +{ + "type": "service_account", + "project_id": "my-awesome-project", + "private_key_id": "", + "private_key": "", + "client_email": "", + "client_id": "", + "auth_uri": "", + "token_uri": "", + "auth_provider_x509_cert_url": "", + "client_x509_cert_url": "" +} diff --git a/vendor/google/cloud-core/src/Testing/StubTrait.php b/vendor/google/cloud-core/src/Testing/StubTrait.php new file mode 100644 index 00000000..380793b4 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/StubTrait.php @@ -0,0 +1,85 @@ +___getPropertyReflector($prop); + + $property->setAccessible(true); + return $property->getValue($this); + } + + /** + * @param $prop + * @param $value + * + * @experimental + * @internal + */ + public function ___setProperty($prop, $value) + { + if (!in_array($prop, json_decode($this->___props))) { + throw new \RuntimeException(sprintf('Property %s cannot be overloaded', $prop)); + } + + $property = $this->___getPropertyReflector($prop); + + $property->setAccessible(true); + $property->setValue($this, $value); + } + + private function ___getPropertyReflector($property) + { + $trait = new \ReflectionClass($this); + $ref = $trait->getParentClass() ?: $trait; + + // wrap this in a loop that will iterate up a class hierarchy to try + // and find a private property. + $keepTrying = true; + do { + try { + $property = $ref->getProperty($property); + $keepTrying = false; + } catch (\ReflectionException $e) { + if ($ref->getParentClass()) { + $ref = $ref->getParentClass(); + } else { + throw new \BadMethodCallException($e->getMessage()); + } + } + } while ($keepTrying); + + return $property; + } +} diff --git a/vendor/google/cloud-core/src/Testing/System/DeletionQueue.php b/vendor/google/cloud-core/src/Testing/System/DeletionQueue.php new file mode 100644 index 00000000..a6384422 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/System/DeletionQueue.php @@ -0,0 +1,113 @@ +acceptAllInputs = $acceptAllInputs; + } + + /** + * Add an item to be cleaned up. + * + * @param mixed $toDelete Unless the class was created with + * `$acceptAllInputs = true`, either a callable with no arguments, or + * an object with a `delete` method. + * @return void + * + * @experimental + * @internal + */ + public function add($toDelete) + { + if (!$this->acceptAllInputs) { + if (!is_callable($toDelete) && !method_exists($toDelete, 'delete')) { + throw new \BadMethodCallException( + 'Deletion Queue requires a callable, or an object with a `delete` method.' + ); + } + + if (!is_callable($toDelete)) { + $toDelete = function () use ($toDelete) { + $toDelete->delete(); + }; + } + } + + $this->queue[] = $toDelete; + } + + /** + * Process all items in the deletion queue. + * + * @return void + * + * @experimental + * @internal + */ + public function process(callable $action = null) + { + if ($action) { + $action($this->queue); + } else { + $backoff = new ExponentialBackoff(8); + + foreach ($this->queue as $item) { + $backoff->execute(function () use ($item) { + try { + call_user_func($item); + } catch (NotFoundException $e) { + } catch (ApiException $apiException) { + if ($apiException->getStatus() !== 'NOT_FOUND') { + throw $apiException; + } + } + }); + } + } + } +} diff --git a/vendor/google/cloud-core/src/Testing/System/KeyManager.php b/vendor/google/cloud-core/src/Testing/System/KeyManager.php new file mode 100644 index 00000000..50ee4647 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/System/KeyManager.php @@ -0,0 +1,213 @@ +keyFile = $keyFile; + $this->serviceAccountEmail = $serviceAccountEmail + ?: $keyFile['client_email']; + $this->projectId = $projectId + ?: $keyFile['project_id']; + $this->setLocation($location ?: self::DEFAULT_LOCATION); + + $this->requestWrapper = new RequestWrapper([ + 'keyFile' => $this->keyFile, + 'scopes' => ['https://www.googleapis.com/auth/cloud-platform'] + ]); + } + + /** + * Set the service account email used for IAM management. + * + * @param string $serviceAccountEmail + */ + public function setServiceAccountEmail($serviceAccountEmail) + { + $this->serviceAccountEmail = $serviceAccountEmail; + } + + /** + * Set keyring location. + * + * Location name may be in upper or lower case. + * + * @param string $location + */ + public function setLocation($location) + { + $this->location = strtolower($location); + } + + /** + * Get the project data. + * + * @param string $projectId [optional] If not provided, uses ID given in + * constructor or keyfile. + * @return array + */ + public function getProject($projectId = null) + { + $projectId = $projectId ?: $this->projectId; + $uri = 'https://cloudresourcemanager.googleapis.com/v1/projects/%s'; + + $res = $this->requestWrapper->send( + new Request( + 'GET', + sprintf($uri, $projectId) + ) + ); + + return json_decode($res->getBody(), true); + } + + /** + * A helper to get KMS keys and set correct permissions. + * + * @param string $keyRingId + * @param string[] $keyIds + * @return array + */ + public function getKeyNames($keyRingId, array $keyIds) + { + $keyNames = []; + + $this->buildKeyRing($keyRingId); + + foreach ($keyIds as $keyId) { + $keyNames[] = $this->getCryptoKeyName( + $keyRingId, + $keyId + ); + } + + return $keyNames; + } + + /** + * @param string $keyRingId + */ + private function buildKeyRing($keyRingId) + { + try { + $this->requestWrapper->send( + new Request( + 'POST', + sprintf( + 'https://cloudkms.googleapis.com/v1/projects/%s/locations/%s/keyRings?keyRingId=%s', + $this->projectId, + $this->location, + $keyRingId + ) + ) + ); + } catch (ConflictException $ex) { + // If it already exists, great! + } + } + + /** + * @param string $keyRingId + * @param string $cryptoKeyId + * @return string + */ + private function getCryptoKeyName( + $keyRingId, + $cryptoKeyId + ) { + $name = null; + + try { + $uri = 'https://cloudkms.googleapis.com/v1/projects/%s/locations/%s/keyRings/%s/cryptoKeys?cryptoKeyId=%s'; + + $response = $this->requestWrapper->send( + new Request( + 'POST', + sprintf( + $uri, + $this->projectId, + $this->location, + $keyRingId, + $cryptoKeyId + ), + [], + json_encode(['purpose' => 'ENCRYPT_DECRYPT']) + ) + ); + + $name = json_decode((string) $response->getBody(), true)['name']; + } catch (ConflictException $ex) { + $name = sprintf( + 'projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s' , + $this->projectId, + $this->location, + $keyRingId, + $cryptoKeyId + ); + } + + $policy = [ + 'policy' => [ + 'bindings' => [ + [ + 'role' => 'roles/cloudkms.cryptoKeyEncrypterDecrypter', + 'members' => [ + "serviceAccount:" . $this->serviceAccountEmail + ] + ] + ] + ] + ]; + + $uri = 'https://cloudkms.googleapis.com/v1/projects/%s/locations/' . + '%s/keyRings/%s/cryptoKeys/%s:setIamPolicy'; + $this->requestWrapper->send( + new Request( + 'POST', + sprintf( + $uri, + $this->projectId, + $this->location, + $keyRingId, + $cryptoKeyId + ), + [], + json_encode($policy) + ) + ); + + return $name; + } +} diff --git a/vendor/google/cloud-core/src/Testing/System/SystemTestCase.php b/vendor/google/cloud-core/src/Testing/System/SystemTestCase.php new file mode 100644 index 00000000..d269c029 --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/System/SystemTestCase.php @@ -0,0 +1,284 @@ +process(); + } + + /** + * Create a random integer ID for test entities. + * + * @return int + * + * @experimental + * @internal + */ + public static function randId() + { + return rand(1, 9999999); + } + + /** + * Create a bucket and enqueue it for deletion. + * + * This method provides a means of creating a bucket with pre-configured + * flush+delete functionality. Use in place of `StorageClient::createBucket()`. + * + * When inserting objects into a bucket created with this method, you do NOT need + * to enqueue those objects for deletion or concern yourself with order of + * operations. + * + * @param StorageClient $client + * @param string $bucketName + * @param array $options + * @return Bucket + * + * @experimental + * @internal + */ + public static function createBucket(StorageClient $client, $bucketName, array $options = []) + { + $backoff = new ExponentialBackoff(8); + + $bucket = $backoff->execute(function () use ($client, $bucketName, $options) { + return $client->createBucket($bucketName, $options); + }); + + self::$deletionQueue->add(function () use ($bucket) { + foreach ($bucket->objects() as $object) { + $object->delete(); + } + + $bucket->delete(); + }); + + return $bucket; + } + + /** + * Create a dataset and enqueue it for deletion. + * + * This method provides a means of creating a dataset with pre-configured + * flush+delete functionality. Use in place of `BigQueryClient::createDataset()`. + * + * When inserting tables into a dataset created with this method, you do NOT need + * to enqueue those tables for deletion or concern yourself with order of + * operations. + * + * @param BigQueryClient $client + * @param string $datasetName + * @param array $options + * @return Dataset + * + * @experimental + * @internal + */ + public static function createDataset(BigQueryClient $client, $datasetName, array $options = []) + { + $dataset = $client->createDataset($datasetName, $options); + + self::$deletionQueue->add(function () use ($dataset) { + $dataset->delete(['deleteContents' => true]); + }); + + return $dataset; + } + + /** + * Create a topic and enqueue it for deletion. + * + * This method provides a means of creating a topic with pre-configured + * flush+delete functionality. Use in place of `PubSubClient::createTopic()`. + * + * When inserting subscriptions into a topic created with this method, you do NOT need + * to enqueue those subscriptions for deletion or concern yourself with order of + * operations. + * + * @param PubSubClient $client + * @param string $topicName + * @param array $options + * @return Topic + * + * @experimental + * @internal + */ + public static function createTopic(PubSubClient $client, $topicName, array $options = []) + { + $backoff = new ExponentialBackoff(8); + + $topic = $backoff->execute(function () use ($client, $topicName, $options) { + return $client->createTopic($topicName, $options); + }); + + self::$deletionQueue->add(function () use ($topic) { + foreach ($topic->subscriptions() as $subscription) { + $subscription->delete(); + } + + $topic->delete(); + }); + + return $topic; + } + + /** + * Set "using emulator" flag for single test case. + * + * Should be called in `setUpBeforeClass()` method. This will allow to + * skip tests that are not supported by emulator. + * + * Example: + * ``` + * self::setUsingEmulator(getenv('FOOBAR_EMULATOR_HOST')); + * ``` + * + * @param bool $enabled Whether emulator is detected. **Defaults to** `true`. + */ + public static function setUsingEmulator($enabled = true) + { + self::$emulatedClasses[get_called_class()] = (bool)$enabled; + } + + /** + * Set "using emulator" flag for test cases with specified fully-qualified name prefix. + * + * Should be called in `setUpBeforeClass()` method. This will allow to + * skip tests that are not supported by emulator. + * + * Example: + * ``` + * // Set flag for called class namespace. + * self::setUsingEmulatorForClassPrefix(getenv('FOOBAR_EMULATOR_HOST')); + * ``` + * + * ``` + * // Set flag for some other namespace. + * self::setUsingEmulatorForClassPrefix(getenv('FOOBAR_EMULATOR_HOST'), 'Foobar\\Tests\\System\\Admin\\'); + * ``` + * + * @param bool $enabled Whether emulator is detected. **Defaults to** `true`. + * @param string|null $prefix Fully-qualified class name prefix. **Defaults to** called class namespace. + */ + public static function setUsingEmulatorForClassPrefix($enabled = true, $prefix = null) + { + if (!isset($prefix)) { + $className = get_called_class(); + $prefix = substr($className, 0, strrpos($className, '\\') + 1); + } + self::$emulatedClassPrefixes[$prefix] = (bool)$enabled; + } + + /** + * Returns `true` when "using emulator" flag is set either for called class name or its + * fully-qualified name prefix or `false` otherwise. + * + * Example: + * ``` + * $transports = [['grpc']]; + * if (!self::isEmulatorUsed()) { + * $transports[] = ['rest']; + * } + * ``` + * + * @return bool + */ + public static function isEmulatorUsed() + { + $className = get_called_class(); + if (!isset(self::$emulatedClasses[$className])) { + $prefix = substr($className, 0, strrpos($className, '\\') + 1); + $isEmulated = false; + foreach (self::$emulatedClassPrefixes as $key => $flag) { + if (strpos($prefix, $key) === 0) { + $isEmulated = $flag; + break; + } + } + self::$emulatedClasses[$className] = $isEmulated; + } + return self::$emulatedClasses[$className]; + } + + /** + * Skips current test (when called from test method) or entire test case (when called from `setUpBeforeClass()`) + * if "using emulator" flag is set either for called class name or its fully-qualified name prefix. + * + * Example: + * ``` + * // Use default reason. + * self::skipIfEmulatorUsed(); + * ``` + * + * ``` + * // Use custom reason. + * self::skipIfEmulatorUsed('Administration functions are not supported by emulator.'); + * ``` + * + * @param string|null $reason Message explaining reason for skipping this test. + */ + public static function skipIfEmulatorUsed($reason = null) + { + if (self::isEmulatorUsed()) { + self::markTestSkipped($reason ?: 'This test is not supported by the emulator.'); + } + } +} diff --git a/vendor/google/cloud-core/src/Testing/TestHelpers.php b/vendor/google/cloud-core/src/Testing/TestHelpers.php new file mode 100644 index 00000000..1292d3bc --- /dev/null +++ b/vendor/google/cloud-core/src/Testing/TestHelpers.php @@ -0,0 +1,278 @@ +newInstanceArgs($args); + } + + /** + * Get a trait implementation. + * + * @param string $trait The fully-qualified name of the trait to implement. + * @return mixed + * + * @experimental + * @internal + */ + public static function impl($trait, array $props = []) + { + $properties = []; + foreach ($props as $prop) { + $properties[] = 'private $' . $prop . ';'; + } + + $tpl = 'class %s { + use %s; + use \Google\Cloud\Core\Testing\StubTrait; + private $___props = \'%s\'; + %s + public function call($fn, array $args = []) { return call_user_func_array([$this, $fn], $args); } + }'; + + $name = 'Trait' . sha1($trait . json_encode($props)); + + if (!class_exists($name)) { + eval(sprintf($tpl, $name, $trait, json_encode($props), implode("\n", $properties))); + } + + return new $name; + } + + /** + * Setup snippet tests support. + * + * @return void + * @experimental + * @internal + */ + public static function snippetBootstrap() + { + putenv('GOOGLE_APPLICATION_CREDENTIALS='. \Google\Cloud\Core\Testing\Snippet\Fixtures::KEYFILE_STUB_FIXTURE()); + + $parser = new Parser; + $scanner = new Scanner($parser, self::projectRoot(), [ + '/vendor/', + '/dev/', + new RegexFileFilter('/\w{0,}\/vendor\//'), + new RegexFileFilter('/\w{0,}\/V\d{1,}\//') + ]); + $coverage = new Coverage($scanner); + $coverage->buildListToCover(); + + Container::$coverage = $coverage; + Container::$parser = $parser; + } + + /** + * Setup performance tests support. + * + * @return void + * @experimental + * @internal + */ + public static function perfBootstrap() + { + $bootstraps = glob(self::projectRoot() .'/*/tests/Perf/bootstrap.php'); + foreach ($bootstraps as $bootstrap) { + require_once $bootstrap; + } + } + + /** + * Check that the required environment variable keyfile paths are set and exist. + * + * @param array|string $env The environment variable(s) required. + * @throws \RuntimeException + * @experimental + * @internal + */ + public static function requireKeyfile($env) + { + $env = is_array($env) ? $env : [$env]; + + foreach ($env as $var) { + if (!getenv($var)) { + throw new \RuntimeException(sprintf( + 'Please set the \'%s\' env var to run the tests', + $var + )); + } + + $path = getenv($var); + if (!file_exists($path)) { + throw new \RuntimeException(sprintf( + 'The path \`%s\` specified in environment variable `%s` does not exist.', + $path, + $var + )); + } + } + } + + /** + * Setup stuff needed for the system test runner. + * + * This method can only be called once per run. Subsequent calls will thrown \RuntimeException. + * + * @internal + * @experimental + */ + public static function systemBootstrap() + { + static $started = false; + + if ($started) { + throw new \RuntimeException('system tests cannot be bootstrapped more than once.'); + } + + SystemTestCase::setupQueue(); + + $bootstraps = glob(self::projectRoot() .'/*/tests/System/bootstrap.php'); + foreach ($bootstraps as $bootstrap) { + require_once $bootstrap; + } + + // This should always be last. + self::systemTestShutdown(function () { + SystemTestCase::processQueue(); + }); + + $started = true; + } + + /** + * Setup stuff needed for the generated system tests. + * @internal + * @experimental + */ + public static function generatedSystemTestBootstrap() + { + // For generated system tests, we need to set GOOGLE_APPLICATION_CREDENTIALS + // and PROJECT_ID to appropriate values + $keyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH'); + putenv("GOOGLE_APPLICATION_CREDENTIALS=$keyFilePath"); + $keyFileData = json_decode(file_get_contents($keyFilePath), true); + putenv('PROJECT_ID=' . $keyFileData['project_id']); + + } + + /** + * Add cleanup function for system tests. + * + * Calls to this method enqueue a PHP shutdown function, scoped to the parent + * PID. + * + * @param callable $shutdown The shutdown function. + * @return void + * @experimental + * @internal + */ + public static function systemTestShutdown(callable $shutdown) + { + $pid = getmypid(); + register_shutdown_function(function () use ($pid, $shutdown) { + // Skip flushing deletion queue if exiting a forked process. + if ($pid !== getmypid()) { + return; + } + + $shutdown(); + }); + } + + /** + * Get the value of a private property. + * + * @param mixed $class The class + * @param string $property The property name. + * @return mixed + */ + public static function getPrivateProperty($class, $property) + { + $className = get_class($class); + $c = \Closure::bind(function ($class) use ($property) { + return $class->$property; + }, null, $className); + + return $c($class); + } + + /** + * Determine the path of the project root based on where the composer + * autoloader is located. + * + * @return string + * @experimental + * @internal + */ + private static function projectRoot() + { + static $projectRoot; + + if (!$projectRoot) { + $ref = new \ReflectionClass(\Composer\Autoload\ClassLoader::class); + $projectRoot = dirname(dirname(dirname($ref->getFileName()))); + } + + return $projectRoot; + } +} diff --git a/vendor/google/cloud-core/src/TimeTrait.php b/vendor/google/cloud-core/src/TimeTrait.php new file mode 100644 index 00000000..bd0b25d6 --- /dev/null +++ b/vendor/google/cloud-core/src/TimeTrait.php @@ -0,0 +1,145 @@ + 6) { + $timestamp = str_replace('.'. $subSeconds, '.' . substr($subSeconds, 0, 6), $timestamp); + } + + $dt = new \DateTimeImmutable($timestamp); + + $nanos = $this->convertFractionToNanoSeconds($subSeconds); + + return [$dt, $nanos]; + } + + /** + * Create a DateTimeImmutable instance from a UNIX timestamp (i.e. seconds since epoch). + * + * @param int $seconds The unix timestamp. + * @return \DateTimeImmutable + */ + private function createDateTimeFromSeconds($seconds) + { + return \DateTimeImmutable::createFromFormat( + 'U', + (string) $seconds, + new \DateTimeZone('UTC') + ); + } + + /** + * Create a Timestamp string in an API-compatible format. + * + * @param \DateTimeInterface $dateTime The date time object. + * @param int|null $ns The number of nanoseconds. If null, subseconds from + * $dateTime will be used instead. + * @return string + */ + private function formatTimeAsString(\DateTimeInterface $dateTime, $ns) + { + $dateTime = $dateTime->setTimeZone(new \DateTimeZone('UTC')); + if ($ns === null) { + return $dateTime->format(Timestamp::FORMAT); + } else { + return sprintf( + $dateTime->format(Timestamp::FORMAT_INTERPOLATE), + $this->convertNanoSecondsToFraction($ns) + ); + } + } + + /** + * Format a timestamp for the API with nanosecond precision. + * + * @param \DateTimeInterface $dateTime The date time object. + * @param int|null $ns The number of nanoseconds. If null, subseconds from + * $dateTime will be used instead. + * @return array + */ + private function formatTimeAsArray(\DateTimeInterface $dateTime, $ns) + { + if ($ns === null) { + $ns = $dateTime->format('u'); + } + return [ + 'seconds' => (int) $dateTime->format('U'), + 'nanos' => (int) $ns + ]; + } + + /** + * Convert subseconds, expressed as a decimal to nanoseconds. + * + * @param int|string $subseconds Provide value as a whole number (i.e. + * provide 0.1 as 1). + * @return int + */ + private function convertFractionToNanoSeconds($subseconds) + { + return (int) str_pad($subseconds, 9, '0', STR_PAD_RIGHT); + } + + /** + * Convert nanoseconds to subseconds. + * + * Note that result should be used as a fraction of one second, but is + * given as an integer. + * + * @param int|string $nanos + * @param bool $rpad Whether to right-pad to 6 or 9 digits. **Defaults to** + * `true`. + * @return string + */ + private function convertNanoSecondsToFraction($nanos, $rpad = true) + { + $nanos = (string) $nanos; + $res = str_pad($nanos, 9, '0', STR_PAD_LEFT); + if (substr($res, 6, 3) === '000') { + $res = substr($res, 0, 6); + } + + if (!$rpad) { + $res = rtrim($res, '0'); + } + + return $res; + } +} diff --git a/vendor/google/cloud-core/src/Timestamp.php b/vendor/google/cloud-core/src/Timestamp.php new file mode 100644 index 00000000..3d8d90b9 --- /dev/null +++ b/vendor/google/cloud-core/src/Timestamp.php @@ -0,0 +1,150 @@ +value = $value; + + $this->nanoSeconds = $nanoSeconds !== null + ? (int) $nanoSeconds + : null; + } + + /** + * Get the underlying `\DateTimeInterface` implementation. + * + * Please note that if you provided nanoseconds when creating the timestamp, + * they will not be included in this value. + * + * Example: + * ``` + * $dateTime = $timestamp->get(); + * ``` + * + * @return \DateTimeInterface + */ + public function get() + { + return $this->value; + } + + /** + * Return the number of nanoseconds. + * + * Example: + * ``` + * $nanos = $timestamp->nanoSeconds(); + * ``` + * + * @return int + */ + public function nanoSeconds() + { + return $this->nanoSeconds === null + ? (int) $this->value->format('u') * 1000 + : $this->nanoSeconds; + } + + /** + * Format the value as a string. + * + * Example: + * ``` + * $value = $timestamp->formatAsString(); + * ``` + * + * @return string + */ + public function formatAsString() + { + return $this->formatTimeAsString( + $this->value, + $this->nanoSeconds + ); + } + + /** + * Format the value as a string. + * + * @return string + * @access private + */ + public function __toString() + { + return $this->formatAsString(); + } + + /** + * Format a timestamp for the API with nanosecond precision. + * + * @return array + */ + public function formatForApi() + { + return $this->formatTimeAsArray($this->value, $this->nanoSeconds()); + } +} diff --git a/vendor/google/cloud-core/src/Upload/AbstractUploader.php b/vendor/google/cloud-core/src/Upload/AbstractUploader.php new file mode 100644 index 00000000..52a0587d --- /dev/null +++ b/vendor/google/cloud-core/src/Upload/AbstractUploader.php @@ -0,0 +1,118 @@ +requestWrapper = $requestWrapper; + $this->data = Utils::streamFor($data); + $this->uri = $uri; + $this->metadata = isset($options['metadata']) ? $options['metadata'] : []; + $this->chunkSize = isset($options['chunkSize']) ? $options['chunkSize'] : null; + $this->requestOptions = array_intersect_key($options, [ + 'restOptions' => null, + 'retries' => null, + 'requestTimeout' => null + ]); + + $this->contentType = isset($options['contentType']) + ? $options['contentType'] + : 'application/octet-stream'; + } + + /** + * @return array + */ + abstract public function upload(); +} diff --git a/vendor/google/cloud-core/src/Upload/MultipartUploader.php b/vendor/google/cloud-core/src/Upload/MultipartUploader.php new file mode 100644 index 00000000..3affaf71 --- /dev/null +++ b/vendor/google/cloud-core/src/Upload/MultipartUploader.php @@ -0,0 +1,108 @@ +jsonDecode( + $this->requestWrapper->send( + $this->prepareRequest(), + $this->requestOptions + )->getBody(), + true + ); + } + + /** + * Triggers the upload process asynchronously. + * + * @return PromiseInterface + * @experimental The experimental flag means that while we believe this method + * or class is ready for use, it may change before release in backwards- + * incompatible ways. Please use with caution, and test thoroughly when + * upgrading. + */ + public function uploadAsync() + { + return $this->requestWrapper->sendAsync( + $this->prepareRequest(), + $this->requestOptions + )->then(function (ResponseInterface $response) { + return $this->jsonDecode( + $response->getBody(), + true + ); + }); + } + + /** + * Prepares a multipart upload request. + * + * @return RequestInterface + */ + private function prepareRequest() + { + $multipartStream = new Psr7\MultipartStream([ + [ + 'name' => 'metadata', + 'headers' => ['Content-Type' => 'application/json; charset=UTF-8'], + 'contents' => $this->jsonEncode($this->metadata) + ], + [ + 'name' => 'data', + 'headers' => ['Content-Type' => $this->contentType], + 'contents' => $this->data + ] + ], 'boundary'); + + $headers = [ + 'Content-Type' => 'multipart/related; boundary=boundary', + ]; + + $size = $multipartStream->getSize(); + if ($size !== null) { + $headers['Content-Length'] = $size; + } + + return new Request( + 'POST', + $this->uri, + $headers, + $multipartStream + ); + } +} diff --git a/vendor/google/cloud-core/src/Upload/ResumableUploader.php b/vendor/google/cloud-core/src/Upload/ResumableUploader.php new file mode 100644 index 00000000..b47fbc2b --- /dev/null +++ b/vendor/google/cloud-core/src/Upload/ResumableUploader.php @@ -0,0 +1,287 @@ +uploadProgressCallback = $options['uploadProgressCallback']; + } elseif (isset($options['uploadProgressCallback'])) { + throw new \InvalidArgumentException('$options.uploadProgressCallback must be a callable.'); + } + } + + /** + * Gets the resume URI. + * + * @return string + */ + public function getResumeUri() + { + if (!$this->resumeUri) { + return $this->createResumeUri(); + } + + return $this->resumeUri; + } + + /** + * Resumes a download using the provided URI. + * + * @param string $resumeUri + * @return array + * @throws GoogleException + */ + public function resume($resumeUri) + { + if (!$this->data->isSeekable()) { + throw new GoogleException('Cannot resume upload on a stream which cannot be seeked.'); + } + + $this->resumeUri = $resumeUri; + $response = $this->getStatusResponse(); + + if ($response->getBody()->getSize() > 0) { + return $this->decodeResponse($response); + } + + $this->rangeStart = $this->getRangeStart($response->getHeaderLine('Range')); + + return $this->upload(); + } + + /** + * Triggers the upload process. + * + * Errors are of form [`google.rpc.Status`](https://cloud.google.com/apis/design/errors#error_model), + * and may be obtained via {@see Google\Cloud\Core\Exception\ServiceException::getMetadata()}. + * + * @return array + * @throws ServiceException + */ + public function upload() + { + $rangeStart = $this->rangeStart; + $response = null; + $resumeUri = $this->getResumeUri(); + $size = $this->data->getSize() ?: '*'; + + do { + $data = new LimitStream( + $this->data, + $this->chunkSize ?: - 1, + $rangeStart + ); + + $currStreamLimitSize = $data->getSize(); + + $rangeEnd = $rangeStart + ($currStreamLimitSize - 1); + + $headers = $this->headers + [ + 'Content-Length' => $currStreamLimitSize, + 'Content-Type' => $this->contentType, + 'Content-Range' => "bytes $rangeStart-$rangeEnd/$size", + ]; + + $request = new Request( + 'PUT', + $resumeUri, + $headers, + $data + ); + + try { + $response = $this->requestWrapper->send($request, $this->requestOptions); + } catch (GoogleException $ex) { + throw new ServiceException( + "Upload failed. Please use this URI to resume your upload: $this->resumeUri", + $ex->getCode(), + null, + json_decode($ex->getMessage(), true) ?: [] + ); + } + + if (is_callable($this->uploadProgressCallback)) { + call_user_func($this->uploadProgressCallback, $currStreamLimitSize); + } + + $rangeStart = $this->getRangeStart($response->getHeaderLine('Range')); + } while ($response->getStatusCode() === 308); + + return $this->decodeResponse($response); + } + + /** + * Currently only the MultiPartUploader supports async. + * + * Any calls to this will throw a generic Google Exception. + * + * @return PromiseInterface + * @throws GoogleException + * @experimental The experimental flag means that while we believe this method + * or class is ready for use, it may change before release in backwards- + * incompatible ways. Please use with caution, and test thoroughly when + * upgrading. + */ + public function uploadAsync() + { + throw new GoogleException('Currently only the MultiPartUploader supports async.'); + } + + /** + * Fetch and decode the response body + * + * @param ResponseInterface $response + * @return array + */ + protected function decodeResponse(ResponseInterface $response) + { + return $this->jsonDecode($response->getBody(), true); + } + + /** + * Creates the resume URI. + * + * @return string + */ + protected function createResumeUri() + { + $headers = $this->headers + [ + 'X-Upload-Content-Type' => $this->contentType, + 'X-Upload-Content-Length' => $this->data->getSize(), + 'Content-Type' => 'application/json' + ]; + + $body = $this->jsonEncode($this->metadata); + + $request = new Request( + 'POST', + $this->uri, + $headers, + $body + ); + + $response = $this->requestWrapper->send($request, $this->requestOptions); + + return $this->resumeUri = $response->getHeaderLine('Location'); + } + + /** + * Gets the status of the upload. + * + * @return ResponseInterface + */ + protected function getStatusResponse() + { + $request = new Request( + 'PUT', + $this->resumeUri, + ['Content-Range' => 'bytes */*'] + ); + + return $this->requestWrapper->send($request, $this->requestOptions); + } + + /** + * Gets the starting range for the upload. + * + * @param string $rangeHeader + * @return int|null + */ + protected function getRangeStart($rangeHeader) + { + if (!$rangeHeader) { + return null; + } + + return (int) explode('-', $rangeHeader)[1] + 1; + } +} diff --git a/vendor/google/cloud-core/src/Upload/SignedUrlUploader.php b/vendor/google/cloud-core/src/Upload/SignedUrlUploader.php new file mode 100644 index 00000000..4a7d8aa7 --- /dev/null +++ b/vendor/google/cloud-core/src/Upload/SignedUrlUploader.php @@ -0,0 +1,99 @@ +headers['Origin'] = $options['origin']; + unset($options['origin']); + } + + parent::__construct($requestWrapper, $data, $uri, $options); + } + + /** + * Creates the resume URI. + * + * @return string + */ + protected function createResumeUri() + { + $headers = $this->headers + [ + 'Content-Type' => $this->contentType, + 'Content-Length' => 0, + 'x-goog-resumable' => 'start' + ]; + + $request = new Request( + 'POST', + $this->uri, + $headers + ); + + $response = $this->requestWrapper->send($request, $this->requestOptions); + + return $this->resumeUri = $response->getHeaderLine('Location'); + } + + /** + * Decode the response body + * + * @param ResponseInterface $response + * @return string + */ + protected function decodeResponse(ResponseInterface $response) + { + return $response->getBody(); + } +} diff --git a/vendor/google/cloud-core/src/Upload/StreamableUploader.php b/vendor/google/cloud-core/src/Upload/StreamableUploader.php new file mode 100644 index 00000000..123b2b27 --- /dev/null +++ b/vendor/google/cloud-core/src/Upload/StreamableUploader.php @@ -0,0 +1,104 @@ +getResumeUri(); + + if ($writeSize) { + $rangeEnd = $this->rangeStart + $writeSize - 1; + $data = $this->data->read($writeSize); + } else { + $rangeEnd = '*'; + $data = $this->data->getContents(); + $writeSize = strlen($data); + } + + // do the streaming write + $headers = [ + 'Content-Length' => $writeSize, + 'Content-Type' => $this->contentType, + 'Content-Range' => "bytes {$this->rangeStart}-$rangeEnd/*" + ]; + + $request = new Request( + 'PUT', + $resumeUri, + $headers, + $data + ); + + try { + $response = $this->requestWrapper->send($request, $this->requestOptions); + } catch (ServiceException $ex) { + throw new GoogleException( + "Upload failed. Please use this URI to resume your upload: $resumeUri", + $ex->getCode(), + $ex + ); + } + + // reset the buffer with the remaining contents + $this->rangeStart += $writeSize; + + return json_decode($response->getBody(), true); + } + + /** + * Currently only the MultiPartUploader supports async. + * + * Any calls to this will throw a generic Google Exception. + * + * @return PromiseInterface + * @throws GoogleException + * @experimental The experimental flag means that while we believe this method + * or class is ready for use, it may change before release in backwards- + * incompatible ways. Please use with caution, and test thoroughly when + * upgrading. + */ + public function uploadAsync() + { + throw new GoogleException('Currently only the MultiPartUploader supports async.'); + } +} diff --git a/vendor/google/cloud-core/src/UriTrait.php b/vendor/google/cloud-core/src/UriTrait.php new file mode 100644 index 00000000..04237aad --- /dev/null +++ b/vendor/google/cloud-core/src/UriTrait.php @@ -0,0 +1,65 @@ +expand($uri, $variables); + } + + /** + * @param string $uri + * @param array $query + * @return UriInterface + */ + public function buildUriWithQuery($uri, array $query) + { + $query = array_filter($query, function ($v) { + return $v !== null; + }); + + // @todo fix this hack. when using build_query booleans are converted to + // 1 or 0 which the API does not accept. this casts bools to their + // string representation + foreach ($query as $k => &$v) { + if (is_bool($v)) { + $v = $v ? 'true' : 'false'; + } + } + + return Utils::uriFor($uri)->withQuery(Query::build($query)); + } +} diff --git a/vendor/google/cloud-core/src/ValidateTrait.php b/vendor/google/cloud-core/src/ValidateTrait.php new file mode 100644 index 00000000..f1582702 --- /dev/null +++ b/vendor/google/cloud-core/src/ValidateTrait.php @@ -0,0 +1,75 @@ + 0, + 'nanos' => 0 + ]; + + $dt = $this->createDateTimeFromSeconds($timestamp['seconds']); + $nanos = $timestamp['nanos']; + } else { + list ($dt, $nanos) = $this->parseTimeString($timestamp); + } + + return new $returnType($dt, $nanos); + } +} diff --git a/vendor/google/cloud-core/src/WhitelistTrait.php b/vendor/google/cloud-core/src/WhitelistTrait.php new file mode 100644 index 00000000..5e40e6be --- /dev/null +++ b/vendor/google/cloud-core/src/WhitelistTrait.php @@ -0,0 +1,39 @@ +setMessage('NOTE: Error may be due to Whitelist Restriction. ' . $e->getMessage()); + + return $e; + } +} diff --git a/vendor/google/cloud-core/system-bootstrap.php b/vendor/google/cloud-core/system-bootstrap.php new file mode 100644 index 00000000..e49b0c19 --- /dev/null +++ b/vendor/google/cloud-core/system-bootstrap.php @@ -0,0 +1,5 @@ +register(new MessageAwareArrayComparator()); +\SebastianBergmann\Comparator\Factory::getInstance()->register(new ProtobufMessageComparator()); +\SebastianBergmann\Comparator\Factory::getInstance()->register(new ProtobufGPBEmptyComparator()); + +PHPUnit_Framework_Error_Deprecated::$enabled = false; diff --git a/vendor/google/cloud-vision/.OwlBot.yaml b/vendor/google/cloud-vision/.OwlBot.yaml new file mode 100644 index 00000000..3a3929a4 --- /dev/null +++ b/vendor/google/cloud-vision/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/cloud/vision/v1/.*-php/(.*) + dest: /owl-bot-staging/Vision/V1/$1 +api-name: Vision diff --git a/vendor/google/cloud-vision/.gitattributes b/vendor/google/cloud-vision/.gitattributes new file mode 100644 index 00000000..d43b6086 --- /dev/null +++ b/vendor/google/cloud-vision/.gitattributes @@ -0,0 +1,3 @@ +/*.xml.dist export-ignore +/tests export-ignore +/.github export-ignore diff --git a/vendor/google/cloud-vision/.repo-metadata.json b/vendor/google/cloud-vision/.repo-metadata.json new file mode 100644 index 00000000..979a1b7c --- /dev/null +++ b/vendor/google/cloud-vision/.repo-metadata.json @@ -0,0 +1,6 @@ +{ + "distribution_name": "google/cloud-vision", + "release_level": "ga", + "client_documentation": "http://googleapis.github.io/google-cloud-php/#/docs/cloud-vision/latest", + "library_type": "GAPIC_COMBO" +} diff --git a/vendor/google/cloud-vision/CODE_OF_CONDUCT.md b/vendor/google/cloud-vision/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..c3727800 --- /dev/null +++ b/vendor/google/cloud-vision/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) \ No newline at end of file diff --git a/vendor/google/cloud-vision/CONTRIBUTING.md b/vendor/google/cloud-vision/CONTRIBUTING.md new file mode 100644 index 00000000..f8be6dae --- /dev/null +++ b/vendor/google/cloud-vision/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. We accept +and review pull requests against the main +[Google Cloud PHP](https://github.com/googleapis/google-cloud-php) +repository, which contains all of our client libraries. You will also need to +sign a Contributor License Agreement. For more details about how to contribute, +see the +[CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/master/CONTRIBUTING.md) +file in the main Google Cloud PHP repository. diff --git a/vendor/google/cloud-vision/LICENSE b/vendor/google/cloud-vision/LICENSE new file mode 100644 index 00000000..8f71f43f --- /dev/null +++ b/vendor/google/cloud-vision/LICENSE @@ -0,0 +1,202 @@ + 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/google/cloud-vision/README.md b/vendor/google/cloud-vision/README.md new file mode 100644 index 00000000..dcd07eb5 --- /dev/null +++ b/vendor/google/cloud-vision/README.md @@ -0,0 +1,70 @@ +# Google Cloud Vision for PHP + +> Idiomatic PHP client for [Cloud Vision](https://cloud.google.com/vision/). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-vision/v/stable)](https://packagist.org/packages/google/cloud-vision) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-vision.svg)](https://packagist.org/packages/google/cloud-vision) + +* [API documentation](http://googleapis.github.io/google-cloud-php/#/docs/cloud-vision/latest) + +**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. + +Allows developers to easily integrate vision detection features within applications, including image labeling, face and +landmark detection, optical character recognition (OCR), and tagging of explicit content. + +### Installation + +To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). + +Now to install just this component: + +```sh +$ composer require google/cloud-vision +``` + +Or to install the entire suite of components at once: + +```sh +$ composer require google/cloud +``` + +### Authentication + +Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/master/AUTHENTICATION.md) for more information +on authenticating your client. Once authenticated, you'll be ready to start making requests. + +### Sample + +```php +require 'vendor/autoload.php'; + +use Google\Cloud\Vision\V1\Feature\Type; +use Google\Cloud\Vision\V1\ImageAnnotatorClient; +use Google\Cloud\Vision\V1\Likelihood; + +$client = new ImageAnnotatorClient(); + +// Annotate an image, detecting faces. +$annotation = $client->annotateImage( + fopen('/data/photos/family_photo.jpg', 'r'), + [Type::FACE_DETECTION] +); + +// Determine if the detected faces have headwear. +foreach ($annotation->getFaceAnnotations() as $faceAnnotation) { + $likelihood = Likelihood::name($faceAnnotation->getHeadwearLikelihood()); + echo "Likelihood of headwear: $likelihood" . PHP_EOL; +} +``` + +### Version + +This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in +any minor or patch releases. We will address issues and requests with the highest priority. + +### Next Steps + +1. Understand the [official documentation](https://cloud.google.com/vision/docs/). +2. Take a look at [in-depth usage samples](https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/vision/). + diff --git a/vendor/google/cloud-vision/SECURITY.md b/vendor/google/cloud-vision/SECURITY.md new file mode 100644 index 00000000..8b58ae9c --- /dev/null +++ b/vendor/google/cloud-vision/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/vendor/google/cloud-vision/VERSION b/vendor/google/cloud-vision/VERSION new file mode 100644 index 00000000..94fe62c2 --- /dev/null +++ b/vendor/google/cloud-vision/VERSION @@ -0,0 +1 @@ +1.5.4 diff --git a/vendor/google/cloud-vision/composer.json b/vendor/google/cloud-vision/composer.json new file mode 100644 index 00000000..fe514ed7 --- /dev/null +++ b/vendor/google/cloud-vision/composer.json @@ -0,0 +1,41 @@ +{ + "name": "google/cloud-vision", + "description": "Cloud Vision Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "require": { + "google/cloud-core": "^1.43", + "google/gax": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0", + "squizlabs/php_codesniffer": "2.*", + "phpdocumentor/reflection": "^3.0", + "erusev/parsedown": "^1.6", + "google/cloud-storage": "^1.12" + }, + "suggest": { + "ext-grpc": "The gRPC extension enables use of the performant gRPC transport", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions.", + "google/cloud-storage": "Annotate images stored in Google Cloud Storage" + }, + "extra": { + "component": { + "id": "cloud-vision", + "target": "googleapis/google-cloud-php-vision.git", + "path": "Vision", + "entry": "src/VisionClient.php" + } + }, + "autoload": { + "psr-4": { + "Google\\Cloud\\Vision\\": "src", + "GPBMetadata\\Google\\Cloud\\Vision\\": "metadata" + } + }, + "autoload-dev": { + "psr-4": { + "Google\\Cloud\\Vision\\Tests\\": "tests" + } + } +} diff --git a/vendor/google/cloud-vision/metadata/V1/Geometry.php b/vendor/google/cloud-vision/metadata/V1/Geometry.php new file mode 100644 index 00000000..18e7c809 --- /dev/null +++ b/vendor/google/cloud-vision/metadata/V1/Geometry.php @@ -0,0 +1,41 @@ +internalAddGeneratedFile( + ' + +%google/cloud/vision/v1/geometry.protogoogle.cloud.vision.v1" +Vertex +x ( +y ("( +NormalizedVertex +x ( +y (" + BoundingPoly0 +vertices ( 2.google.cloud.vision.v1.VertexE +normalized_vertices ( 2(.google.cloud.vision.v1.NormalizedVertex"+ +Position +x ( +y ( +z (Bu +com.google.cloud.vision.v1B GeometryProtoPZinternalAddGeneratedFile( + ' + ++google/cloud/vision/v1/product_search.protogoogle.cloud.vision.v1%google/cloud/vision/v1/geometry.proto3google/cloud/vision/v1/product_search_service.protogoogle/protobuf/timestamp.protogoogle/api/annotations.proto" +ProductSearchParams; + bounding_poly ( 2$.google.cloud.vision.v1.BoundingPoly: + product_set ( B%A" + vision.googleapis.com/ProductSet +product_categories (  +filter ( " +ProductSearchResults. + +index_time ( 2.google.protobuf.TimestampD +results ( 23.google.cloud.vision.v1.ProductSearchResults.Result[ +product_grouped_results ( 2:.google.cloud.vision.v1.ProductSearchResults.GroupedResultX +Result0 +product ( 2.google.cloud.vision.v1.Product +score ( +image ( S +ObjectAnnotation +mid (  + language_code (  +name (  +score ( + GroupedResult; + bounding_poly ( 2$.google.cloud.vision.v1.BoundingPolyD +results ( 23.google.cloud.vision.v1.ProductSearchResults.ResultY +object_annotations ( 2=.google.cloud.vision.v1.ProductSearchResults.ObjectAnnotationBz +com.google.cloud.vision.v1BProductSearchProtoPZinternalAddGeneratedFile( + ' + +*google/cloud/vision/v1/web_detection.protogoogle.cloud.vision.v1" + WebDetectionD + web_entities ( 2..google.cloud.vision.v1.WebDetection.WebEntityK +full_matching_images ( 2-.google.cloud.vision.v1.WebDetection.WebImageN +partial_matching_images ( 2-.google.cloud.vision.v1.WebDetection.WebImageP +pages_with_matching_images ( 2,.google.cloud.vision.v1.WebDetection.WebPageN +visually_similar_images ( 2-.google.cloud.vision.v1.WebDetection.WebImageH +best_guess_labels ( 2-.google.cloud.vision.v1.WebDetection.WebLabelB + WebEntity + entity_id (  +score ( + description ( & +WebImage +url (  +score ( +WebPage +url (  +score ( + +page_title ( K +full_matching_images ( 2-.google.cloud.vision.v1.WebDetection.WebImageN +partial_matching_images ( 2-.google.cloud.vision.v1.WebDetection.WebImage0 +WebLabel +label (  + language_code ( By +com.google.cloud.vision.v1BWebDetectionProtoPZ", + r"'apiEndpoint' =>") +s.replace( + "**/Gapic/*GapicClient.php", + r"@type string \$serviceAddress\n\s+\*\s+The address", + r"""@type string $serviceAddress + * **Deprecated**. This option will be removed in a future major release. Please + * utilize the `$apiEndpoint` option instead. + * @type string $apiEndpoint + * The address""") +s.replace( + "**/Gapic/*GapicClient.php", + r"\$transportConfig, and any \$serviceAddress", + r"$transportConfig, and any `$apiEndpoint`") + +# V1 is GA, so remove @experimental tags +s.replace( + 'src/V1/**/*Client.php', + r'^(\s+\*\n)?\s+\*\s@experimental\n', + '') + +# Change the wording for the deprecation warning. +s.replace( + 'src/*/*_*.php', + r'will be removed in the next major release', + 'will be removed in a future release') + +### [START] protoc backwards compatibility fixes + +# roll back to private properties. +s.replace( + "src/**/V*/**/*.php", + r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$", + r"""Generated from protobuf field \1 + */ + private $""") + +# prevent proto messages from being marked final +s.replace( + "src/**/V*/**/*.php", + r"final class", + r"class") + +# Replace "Unwrapped" with "Value" for method names. +s.replace( + "src/**/V*/**/*.php", + r"public function ([s|g]\w{3,})Unwrapped", + r"public function \1Value" +) + +### [END] protoc backwards compatibility fixes + +# fix relative cloud.google.com links +s.replace( + "src/**/V*/**/*.php", + r"(.{0,})\]\((/.{0,})\)", + r"\1](https://cloud.google.com\2)" +) + +# format generated clients +subprocess.run([ + 'npx', + '-y', + '-p', + '@prettier/plugin-php@^0.16', + 'prettier', + '**/Gapic/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=80']) diff --git a/vendor/google/cloud-vision/src/Annotation.php b/vendor/google/cloud-vision/src/Annotation.php new file mode 100644 index 00000000..10f6aa47 --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation.php @@ -0,0 +1,406 @@ +image($imageResource, [ + * 'FACE_DETECTION' + * ]); + * + * $annotation = $vision->annotate($image); + * ``` + * + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class Annotation +{ + /** + * @var array + */ + private $info; + + /** + * @var Face[]|null + */ + private $faces; + + /** + * @var Entity[]|null + */ + private $landmarks; + + /** + * @var Entity[]|null + */ + private $logos; + + /** + * @var Entity[]|null + */ + private $labels; + + /** + * @var Entity[]|null + */ + private $text; + + /** + * @var Document|null + */ + private $fullText; + + /** + * @var SafeSearch|null + */ + private $safeSearch; + + /** + * @var ImageProperties|null + */ + private $imageProperties; + + /** + * @var CropHint[]|null + */ + private $cropHints; + + /** + * @var Web|null + */ + private $web; + + /** + * @var array|null + */ + private $error; + + /** + * Create an annotation result. + * + * This class represents a single image annotation response from Cloud Vision. If multiple images were tested at + * once, the result will be an array of Annotation instances. + * + * This class is not intended to be instantiated outside the Google Cloud Platform Client Library. + * + * @param array $info The annotation result + */ + public function __construct($info) + { + $this->info = $info; + + if (isset($info['faceAnnotations'])) { + $this->faces = []; + + foreach ($info['faceAnnotations'] as $face) { + $this->faces[] = new Face($face); + } + } + + if (isset($info['landmarkAnnotations'])) { + $this->landmarks = []; + + foreach ($info['landmarkAnnotations'] as $landmark) { + $this->landmarks[] = new Entity($landmark); + } + } + + if (isset($info['logoAnnotations'])) { + $this->logos = []; + + foreach ($info['logoAnnotations'] as $logo) { + $this->logos[] = new Entity($logo); + } + } + + if (isset($info['labelAnnotations'])) { + $this->labels = []; + + foreach ($info['labelAnnotations'] as $label) { + $this->labels[] = new Entity($label); + } + } + + if (isset($info['textAnnotations'])) { + $this->text = []; + + foreach ($info['textAnnotations'] as $text) { + $this->text[] = new Entity($text); + } + } + + if (isset($info['fullTextAnnotation'])) { + $this->fullText = new Document($info['fullTextAnnotation']); + } + + if (isset($info['safeSearchAnnotation'])) { + $this->safeSearch = new SafeSearch($info['safeSearchAnnotation']); + } + + if (isset($info['imagePropertiesAnnotation'])) { + $this->imageProperties = new ImageProperties($info['imagePropertiesAnnotation']); + } + + if (isset($info['cropHintsAnnotation']) && is_array($info['cropHintsAnnotation']['cropHints'])) { + $this->cropHints = []; + foreach ($info['cropHintsAnnotation']['cropHints'] as $hint) { + $this->cropHints[] = new CropHint($hint); + } + } + + if (isset($info['webDetection'])) { + $this->web = new Web($info['webDetection']); + } + + if (isset($info['error'])) { + $this->error = $info['error']; + } + + $class = get_class($this); + $err = "The class {$class} is no longer supported"; + @trigger_error($err, E_USER_DEPRECATED); + } + + /** + * Return raw annotation response array + * + * Example: + * ``` + * $info = $annotation->info(); + * ``` + * + * @codingStandardsIgnoreStart + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#annotateimageresponse AnnotateImageResponse + * @codingStandardsIgnoreEnd + * + * @return array|null + */ + public function info() + { + return $this->info; + } + + /** + * Return an array of faces + * + * Example: + * ``` + * $faces = $annotation->faces(); + * ``` + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#FaceAnnotation FaceAnnotation + * + * @return Face[]|null + */ + public function faces() + { + return $this->faces; + } + + /** + * Return an array of landmarks + * + * Example: + * ``` + * $landmarks = $annotation->landmarks(); + * ``` + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#EntityAnnotation EntityAnnotation + * + * @return Entity[]|null + */ + public function landmarks() + { + return $this->landmarks; + } + + /** + * Return an array of logos + * + * Example: + * ``` + * $logos = $annotation->logos(); + * ``` + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#EntityAnnotation EntityAnnotation + * + * @return Entity[]|null + */ + public function logos() + { + return $this->logos; + } + + /** + * Return an array of labels + * + * Example: + * ``` + * $labels = $annotation->labels(); + * ``` + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#EntityAnnotation EntityAnnotation + * + * @return Entity[]|null + */ + public function labels() + { + return $this->labels; + } + + /** + * Return an array containing all text found in the image + * + * Example: + * ``` + * $text = $annotation->text(); + * ``` + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#EntityAnnotation EntityAnnotation + * + * @return Entity[]|null + */ + public function text() + { + return $this->text; + } + + /** + * Return the full text annotation. + * + * Example: + * ``` + * $fullText = $annotation->fullText(); + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#fulltextannotation FullTextAnnotation + * + * @return Document|null + */ + public function fullText() + { + return $this->fullText; + } + + /** + * Get the result of a safe search detection + * + * Example: + * ``` + * $safeSearch = $annotation->safeSearch(); + * ``` + * + * @codingStandardsIgnoreStart + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#SafeSearchAnnotation SafeSearchAnnotation + * @codingStandardsIgnoreEnd + * + * @return SafeSearch|null + */ + public function safeSearch() + { + return $this->safeSearch; + } + + /** + * Fetch image properties + * + * Example: + * ``` + * $properties = $annotation->imageProperties(); + * ``` + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#ImageProperties ImageProperties + * + * @return ImageProperties|null + */ + public function imageProperties() + { + return $this->imageProperties; + } + + /** + * Fetch Crop Hints + * + * Example: + * ``` + * $hints = $annotation->cropHints(); + * ``` + * + * @codingStandardsIgnoreStart + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#CropHintsAnnotation CropHintsAnnotation + * @codingStandardsIgnoreEnd + * + * @return CropHint[]|null + */ + public function cropHints() + { + return $this->cropHints; + } + + /** + * Fetch the Web Annotatation. + * + * Example: + * ``` + * $web = $annotation->web(); + * ``` + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#WebDetection WebDetection + * + * @return Web|null + */ + public function web() + { + return $this->web; + } + + /** + * Get error information, if present + * + * Example: + * ``` + * $error = $annotation->error(); + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#status Status Format + * + * @return array|null + */ + public function error() + { + return $this->error; + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/AbstractFeature.php b/vendor/google/cloud-vision/src/Annotation/AbstractFeature.php new file mode 100644 index 00000000..4e79bc63 --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/AbstractFeature.php @@ -0,0 +1,47 @@ +info(); + * ``` + * + * @return array + * @access private + */ + public function info() + { + return $this->info; + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/CropHint.php b/vendor/google/cloud-vision/src/Annotation/CropHint.php new file mode 100644 index 00000000..161a7af1 --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/CropHint.php @@ -0,0 +1,90 @@ +image($imageResource, [ 'CROP_HINTS' ]); + * $annotation = $vision->annotate($image); + * + * $hints = $annotation->cropHints(); + * $hint = $hints[0]; + * ``` + * + * @method boundingPoly() { + * The bounding polygon of the recommended crop. + * + * Example: + * ``` + * $poly = $hint->boundingPoly(); + * ``` + * + * @return array [BoundingPoly](https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#boundingpoly) + * } + * @method confidence() { + * Confidence of this being a salient region. Range [0, 1]. + * + * Example: + * ``` + * $confidence = $hint->confidence(); + * ``` + * + * @return float + * } + * @method importanceFraction() { + * Fraction of importance of this salient region with respect to the + * original image. + * + * Example: + * ``` + * $importance = $hint->importanceFraction(); + * ``` + * + * @return float + * } + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#CropHint CropHint + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class CropHint extends AbstractFeature +{ + use CallTrait; + + /** + * @param array $info Crop Hint result + */ + public function __construct(array $info) + { + $this->info = $info; + + $class = get_class($this); + $err = "The class {$class} is no longer supported"; + @trigger_error($err, E_USER_DEPRECATED); + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/Document.php b/vendor/google/cloud-vision/src/Annotation/Document.php new file mode 100644 index 00000000..7090ab30 --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/Document.php @@ -0,0 +1,88 @@ +image($imageResource, [ 'DOCUMENT_TEXT_DETECTION' ]); + * $annotation = $vision->annotate($image); + * + * $document = $annotation->fullText(); + * ``` + * + * @method pages() { + * Get the document pages. + * + * Example: + * ``` + * $pages = $document->pages(); + * ``` + * + * @return array + * } + * @method text() { + * Get the document text. + * + * Example: + * ``` + * $text = $document->text(); + * ``` + * + * @return string + * } + * @method info() { + * Get the Document Text detection result. + * + * Example: + * ``` + * $info = $document->info(); + * ``` + * + * @return array + * } + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#TextAnnotation TextAnnotation + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class Document extends AbstractFeature +{ + use CallTrait; + + /** + * @param array $info Document Text Annotation response. + */ + public function __construct(array $info) + { + $this->info = $info; + + $class = get_class($this); + $err = "The class {$class} is no longer supported"; + @trigger_error($err, E_USER_DEPRECATED); + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/Entity.php b/vendor/google/cloud-vision/src/Annotation/Entity.php new file mode 100644 index 00000000..0e2eba8f --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/Entity.php @@ -0,0 +1,204 @@ +image($imageResource, [ 'text' ]); + * $annotation = $vision->annotate($image); + * + * $text = $annotation->text()[0]; + * ``` + * + * @method mid() { + * Opaque entity ID. + * + * Some IDs might be available in Knowledge Graph(KG). + * + * Example: + * ``` + * echo $text->mid(); + * ``` + * + * @see https://developers.google.com/knowledge-graph/ Knowledge Graph + * + * @return string + * } + * @method locale() { + * The language code for the locale in which the entity textual description + * (next field) is expressed. + * + * Example: + * ``` + * echo $text->locale(); + * ``` + * + * @return string + * } + * @method description() { + * Entity textual description, expressed in its locale language. + * + * Example: + * ``` + * echo $text->description(); + * ``` + * + * @return string + * } + * @method score() { + * Overall score of the result. + * + * Range [0, 1]. + * + * Example: + * ``` + * echo $text->score(); + * ``` + * + * @return float + * } + * @method confidence() { + * The accuracy of the entity detection in an image. + * + * For example, for an image containing 'Eiffel Tower,' this field + * represents the confidence that there is a tower in the query image. + * + * Range [0, 1]. + * + * Example: + * ``` + * echo $text->confidence(); + * ``` + * + * @return float + * } + * @method topicality() { + * The relevancy of the ICA (Image Content Annotation) label to the image. + * + * For example, the relevancy of 'tower' to an image containing + * 'Eiffel Tower' is likely higher than an image containing a distant + * towering building, though the confidence that there is a tower may be the + * same. + * + * Range [0, 1]. + * + * Example: + * ``` + * echo $text->topicality(); + * ``` + * + * @return float + * } + * @method boundingPoly() { + * Image region to which this entity belongs. + * + * Not filled currently for LABEL_DETECTION features. For TEXT_DETECTION + * (OCR), boundingPolys are produced for the entire text detected in an + * image region, followed by boundingPolys for each word within the detected + * text. + * + * Example: + * ``` + * print_r($text->boundingPoly()); + * ``` + * + * @return array + * } + * @method locations() { + * The location information for the detected entity. + * + * Multiple LocationInfo elements can be present since one location may + * indicate the location of the scene in the query image, and another the + * location of the place where the query image was taken. Location + * information is usually present for landmarks. + * + * Example: + * ``` + * print_r($text->locations()); + * ``` + * + * @return array + * } + * @method properties() { + * Some entities can have additional optional Property fields. For example a + * different kind of score or string that qualifies the entity. + * + * Example: + * ``` + * print_r($text->properties()); + * ``` + * + * @return array + * } + * @method info() { + * Get the raw annotation result + * + * Example: + * ``` + * $info = $text->info(); + * ``` + * + * @return array + * } + * + * @codingStandardsIgnoreStart + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#entityannotation EntityAnnotation + * @codingStandardsIgnoreEnd + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class Entity extends AbstractFeature +{ + use CallTrait; + + /** + * Create an entity annotation result. + * + * This class is created internally by {@see Google\Cloud\Vision\Annotation} and is used to represent various + * annotation feature results. + * + * This class should not be instantiated externally. + * + * Entities are returned by {@see Google\Cloud\Vision\Annotation::landmarks()}, + * {@see Google\Cloud\Vision\Annotation::logos()}, + * {@see Google\Cloud\Vision\Annotation::labels()} and + * {@see Google\Cloud\Vision\Annotation::text()}. + * + * @param array $info The entity annotation result + */ + public function __construct(array $info) + { + $this->info = $info; + + $class = get_class($this); + $err = "The class {$class} is no longer supported"; + @trigger_error($err, E_USER_DEPRECATED); + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/Face.php b/vendor/google/cloud-vision/src/Annotation/Face.php new file mode 100644 index 00000000..90e06367 --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/Face.php @@ -0,0 +1,402 @@ +image($imageResource, [ 'FACE_DETECTION' ]); + * $annotation = $vision->annotate($image); + * + * $faces = $annotation->faces(); + * $face = $faces[0]; + * ``` + * + * @method boundingPoly() { + * The bounding polygon around the face. + * + * Example: + * ``` + * print_R($face->boundingPoly()); + * ``` + * + * @return array + * } + * @method fdBoundingPoly() { + * Bounding polygon around the face. + * + * Tighter than `boundingPoly` and encloses only the skin part of the face. + * + * Example: + * ``` + * print_R($face->fdBoundingPoly()); + * ``` + * + * @return array + * } + * @method rollAngle() { + * Roll angle. + * + * Indicates the amount of clockwise/anti-clockwise rotation of the face. + * Range [-180,180] + * + * Example: + * ``` + * print_R($face->rollAngle()); + * ``` + * + * @return float + * } + * @method panAngle() { + * Yaw angle. + * + * Indicates the leftward/rightward angle that the face is pointing. Range + * [-180,180] + * + * Example: + * ``` + * print_R($face->panAngle()); + * ``` + * + * @return float + * } + * @method tiltAngle() { + * Pitch angle. + * + * Indicates the upwards/downwards angle that the face is pointing. Range + * [-180,180] + * + * Example: + * ``` + * print_R($face->tiltAngle()); + * ``` + * + * @return float + * } + * @method detectionConfidence() { + * The detection confidence. + * + * Range [0,1] + * + * Example: + * ``` + * print_R($face->detectionConfidence()); + * ``` + * + * @return float + * } + * @method landmarkingConfidence() { + * Face landmarking confidence. + * + * Range [0,1] + * + * Example: + * ``` + * print_R($face->landmarkingConfidence()); + * ``` + * + * @return float + * } + * @method joyLikelihood() { + * Joy likelihood. + * + * Example: + * ``` + * echo $face->joyLikelihood(); + * ``` + * + * @return string + * } + * @method sorrowLikelihood() { + * Sorrow likelihood. + * + * Example: + * ``` + * echo $face->sorrowLikelihood(); + * ``` + * + * @return string + * } + * @method angerLikelihood() { + * Anger likelihood. + * + * Example: + * ``` + * echo $face->angerLikelihood(); + * ``` + * + * @return string + * } + * @method surpriseLikelihood() { + * Surprise likelihood. + * + * Example: + * ``` + * echo $face->surpriseLikelihood(); + * ``` + * + * @return string + * } + * @method underExposedLikelihood() { + * Under exposure likelihood. + * + * Example: + * ``` + * echo $face->underExposedLikelihood(); + * ``` + * + * @return string + * } + * @method blurredLikelihood() { + * Blurred likelihood. + * + * Example: + * ``` + * echo $face->blurredLikelihood(); + * ``` + * + * @return string + * } + * @method headwearLikelihood() { + * Headwear likelihood. + * + * Example: + * ``` + * echo $face->headwearLikelihood(); + * ``` + * + * @return string + * } + * @method info() { + * Get the raw annotation result + * + * Example: + * ``` + * $info = $face->info(); + * ``` + * + * @return array + * } + * + * @codingStandardsIgnoreStart + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#faceannotation FaceAnnotation + * @codingStandardsIgnoreEnd + * + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class Face extends AbstractFeature +{ + use CallTrait; + use LikelihoodTrait; + + /** + * @var Landmarks + */ + private $landmarks; + + /** + * Create an Face result. + * + * This class is created internally by {@see Google\Cloud\Vision\Annotation}. + * See {@see Google\Cloud\Vision\Annotation::faces()} for full usage details. + * This class should not be instantiated outside the externally. + * + * @param array $info The face annotation result + */ + public function __construct(array $info) + { + $this->info = $info; + $this->landmarks = new Landmarks($info['landmarks']); + + $class = get_class($this); + $err = "The class {$class} is no longer supported"; + @trigger_error($err, E_USER_DEPRECATED); + } + + /** + * Returns an object detailing facial landmarks and their location. + * + * Example: + * ``` + * $leftEye = $face->landmarks()->leftEye(); + * ``` + * @return Landmarks + */ + public function landmarks() + { + return $this->landmarks; + } + + /** + * Check whether the face is joyful. + * + * Example: + * ``` + * if ($face->isJoyful()) { + * echo "Face is Joyful"; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `Face::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function isJoyful($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['joyLikelihood'], $strength); + } + + /** + * Check whether the face is sorrowful. + * + * Example: + * ``` + * if ($face->isSorrowful()) { + * echo "Face is Sorrowful"; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `Face::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function isSorrowful($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['sorrowLikelihood'], $strength); + } + + /** + * Check whether the face is angry. + * + * Example: + * ``` + * if ($face->isAngry()) { + * echo "Face is Angry"; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `Face::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function isAngry($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['angerLikelihood'], $strength); + } + + /** + * Check whether the face is surprised. + * + * Example: + * ``` + * if ($face->isSurprised()) { + * echo "Face is Surprised"; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `Face::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function isSurprised($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['surpriseLikelihood'], $strength); + } + + /** + * Check whether the face is under exposed. + * + * Example: + * ``` + * if ($face->isUnderExposed()) { + * echo "Face is Under Exposed"; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `Face::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function isUnderExposed($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['underExposedLikelihood'], $strength); + } + + /** + * Check whether the face is blurred. + * + * Example: + * ``` + * if ($face->isBlurred()) { + * echo "Face is Blurred"; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `Face::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function isBlurred($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['blurredLikelihood'], $strength); + } + + /** + * Check whether the person is wearing headwear. + * + * Example: + * ``` + * if ($face->hasHeadwear()) { + * echo "Face has Headwear"; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `Face::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function hasHeadwear($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['headwearLikelihood'], $strength); + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/Face/Landmarks.php b/vendor/google/cloud-vision/src/Annotation/Face/Landmarks.php new file mode 100644 index 00000000..d5e71f0d --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/Face/Landmarks.php @@ -0,0 +1,482 @@ +image($imageResource, ['FACE_DETECTION']); + * $annotation = $vision->annotate($image); + * + * $faces = $annotation->faces(); + * $firstFace = $faces[0]; + * + * $landmarks = $firstFace->landmarks(); + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#type_1 Face Landmark Types + * + * @method info() { + * Get the raw landmarks annotation result + * + * Example: + * ``` + * $info = $landmarks->info(); + * ``` + * + * @return array + * } + * + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class Landmarks extends AbstractFeature +{ + /** + * Create a landmarks results object. + * + * This class should not be instantiated directly. It is created internally + * by the Cloud Vision service wrapper to represent FACE_DETECTION annotation + * results and provide helpful convenience to users. + * + * @param array $info The face landmark results + */ + public function __construct(array $info) + { + $this->info = $info; + } + + /** + * Fetch the left eye position. + * + * Example: + * ``` + * $pos = $landmarks->leftEye(); + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function leftEye() + { + return $this->getLandmark('LEFT_EYE'); + } + + /** + * Fetch the left eye pupil position. + * + * Example: + * ``` + * $pos = $landmarks->leftEyePupil(); + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function leftEyePupil() + { + return $this->getLandmark('LEFT_EYE_PUPIL'); + } + + /** + * Fetch the left eye boundaries. + * + * This method returns an array with four keys: `left`, `right`, `top`, `bottom`. + * The value of each of these keys is of the normal Position format described + * in the Cloud Vision documentation. + * + * Example: + * ``` + * $positions = $landmarks->leftEyeBoundaries(); + * foreach ($positions as $name => $pos) { + * echo "Position Type: ". $name . PHP_EOL; + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * } + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function leftEyeBoundaries() + { + return [ + 'left' => $this->getLandmark('LEFT_EYE_LEFT_CORNER'), + 'top' => $this->getLandmark('LEFT_EYE_TOP_BOUNDARY'), + 'right' => $this->getLandmark('LEFT_EYE_RIGHT_CORNER'), + 'bottom' => $this->getLandmark('LEFT_EYE_BOTTOM_BOUNDARY') + ]; + } + + /** + * Fetch the left eyebrow position. + * + * This method returns an array with three keys: `left`, `right`, `upperMidpoint`. + * The value of each of these keys is of the normal Position format described + * in the Cloud Vision documentation. + * + * Example: + * ``` + * $positions = $landmarks->leftEyebrow(); + * foreach ($positions as $name => $pos) { + * echo "Position Type: ". $name . PHP_EOL; + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * } + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function leftEyebrow() + { + return [ + 'left' => $this->getLandmark('LEFT_OF_LEFT_EYEBROW'), + 'right' => $this->getLandmark('RIGHT_OF_LEFT_EYEBROW'), + 'upperMidpoint' => $this->getLandmark('LEFT_EYEBROW_UPPER_MIDPOINT') + ]; + } + + /** + * Fetch the right eye position. + * + * Example: + * ``` + * $pos = $landmarks->rightEye(); + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function rightEye() + { + return $this->getLandmark('RIGHT_EYE'); + } + + /** + * Fetch the right eye pupil position. + * + * Example: + * ``` + * $pos = $landmarks->rightEyePupil(); + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function rightEyePupil() + { + return $this->getLandmark('RIGHT_EYE_PUPIL'); + } + + /** + * Fetch the right eye boundaries. + * + * This method returns an array with four keys: `left`, `right`, `top`, `bottom`. + * The value of each of these keys is of the normal Position format described + * in the Cloud Vision documentation. + * + * Example: + * ``` + * $positions = $landmarks->rightEyeBoundaries(); + * foreach ($positions as $name => $pos) { + * echo "Position Type: ". $name . PHP_EOL; + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * } + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function rightEyeBoundaries() + { + return [ + 'left' => $this->getLandmark('RIGHT_EYE_LEFT_CORNER'), + 'top' => $this->getLandmark('RIGHT_EYE_TOP_BOUNDARY'), + 'right' => $this->getLandmark('RIGHT_EYE_RIGHT_CORNER'), + 'bottom' => $this->getLandmark('RIGHT_EYE_BOTTOM_BOUNDARY') + ]; + } + + /** + * Fetch the right eyebrow position. + * + * This method returns an array with three keys: `left`, `right`, `upperMidpoint`. + * The value of each of these keys is of the normal Position format described + * in the Cloud Vision documentation. + * + * Example: + * ``` + * $positions = $landmarks->rightEyebrow(); + * foreach ($positions as $name => $pos) { + * echo "Position Type: ". $name . PHP_EOL; + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * } + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function rightEyebrow() + { + return [ + 'left' => $this->getLandmark('LEFT_OF_RIGHT_EYEBROW'), + 'right' => $this->getLandmark('RIGHT_OF_RIGHT_EYEBROW'), + 'upperMidpoint' => $this->getLandmark('RIGHT_EYEBROW_UPPER_MIDPOINT') + ]; + } + + /** + * Get the position of the midpoint beteeen the eyes. + * + * Example: + * ``` + * $pos = $landmarks->midpointBetweenEyes(); + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function midpointBetweenEyes() + { + return $this->getLandmark('MIDPOINT_BETWEEN_EYES'); + } + + /** + * Get the position of the lips. + * + * This method returns an array with two keys: `upper` and `lower`. + * The value of each of these keys is of the normal Position format described + * in the Cloud Vision documentation. + * + * Example: + * ``` + * $positions = $landmarks->lips(); + * foreach ($positions as $name => $pos) { + * echo "Position Type: ". $name . PHP_EOL; + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * } + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function lips() + { + return [ + 'upper' => $this->getLandmark('UPPER_LIP'), + 'lower' => $this->getLandmark('LOWER_LIP') + ]; + } + + /** + * Get the position of the mouth. + * + * This method returns an array with three keys: `left`, `right`, `center`. + * The value of each of these keys is of the normal Position format described + * in the Cloud Vision documentation. + * + * Example: + * ``` + * $positions = $landmarks->mouth(); + * foreach ($positions as $name => $pos) { + * echo "Position Type: ". $name . PHP_EOL; + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * } + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function mouth() + { + return [ + 'left' => $this->getLandmark('MOUTH_LEFT'), + 'right' => $this->getLandmark('MOUTH_RIGHT'), + 'center' => $this->getLandmark('MOUTH_CENTER') + ]; + } + + /** + * Get the position of the nose. + * + * This method returns an array with four keys: `tip`, `bottomRight`, `bottomLeft`, `bottomCenter`. + * The value of each of these keys is of the normal Position format described + * in the Cloud Vision documentation. + * + * Example: + * ``` + * $positions = $landmarks->nose(); + * foreach ($positions as $name => $pos) { + * echo "Position Type: ". $name . PHP_EOL; + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * } + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function nose() + { + return [ + 'tip' => $this->getLandmark('NOSE_TIP'), + 'bottomRight' => $this->getLandmark('NOSE_BOTTOM_RIGHT'), + 'bottomLeft' => $this->getLandmark('NOSE_BOTTOM_LEFT'), + 'bottomCenter' => $this->getLandmark('NOSE_BOTTOM_CENTER') + ]; + } + + /** + * Get the position of the ears. + * + * This method returns an array with two keys: `left` and `right`. + * The value of each of these keys is of the normal Position format described + * in the Cloud Vision documentation. + * + * Example: + * ``` + * $positions = $landmarks->ears(); + * foreach ($positions as $name => $pos) { + * echo "Position Type: ". $name . PHP_EOL; + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * } + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @todo should this be earTragions? + * @return array + */ + public function ears() + { + return [ + 'left' => $this->getLandmark('LEFT_EAR_TRAGION'), + 'right' => $this->getLandmark('RIGHT_EAR_TRAGION') + ]; + } + + /** + * Get the position of the forehead glabella. + * + * Example: + * ``` + * $pos = $landmarks->forehead(); + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function forehead() + { + return $this->getLandmark('FOREHEAD_GLABELLA'); + } + + /** + * Get the position of the chin. + * + * This method returns an array with three keys: `left`, `right`, `gnathion`. + * The value of each of these keys is of the normal Position format described + * in the Cloud Vision documentation. + * + * Example: + * ``` + * $positions = $landmarks->chin(); + * foreach ($positions as $name => $pos) { + * echo "Position Type: ". $name . PHP_EOL; + * echo "x position: ". $pos['x'] . PHP_EOL; + * echo "y position: ". $pos['y'] . PHP_EOL; + * echo "z position: ". $pos['z'] . PHP_EOL; + * } + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#position Position + * + * @return array + */ + public function chin() + { + return [ + 'gnathion' => $this->getLandmark('CHIN_GNATHION'), + 'left' => $this->getLandmark('CHIN_LEFT_GONION'), + 'right' => $this->getLandmark('CHIN_RIGHT_GONION') + ]; + } + + private function getLandmark($type) + { + $result = array_filter($this->info, function ($landmark) use ($type) { + return $type === $landmark['type']; + }); + + return array_shift($result)['position']; + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/FeatureInterface.php b/vendor/google/cloud-vision/src/Annotation/FeatureInterface.php new file mode 100644 index 00000000..8e017e06 --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/FeatureInterface.php @@ -0,0 +1,35 @@ +image($imageResource, [ 'imageProperties' ]); + * $annotation = $vision->annotate($image); + * + * $imageProperties = $annotation->imageProperties(); + * ``` + * + * @method info() { + * Get the raw annotation result + * + * Example: + * ``` + * $info = $imageProperties->info(); + * ``` + * + * @return array + * } + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#ImageProperties ImageProperties + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class ImageProperties extends AbstractFeature +{ + /** + * Create an ImageProperties result. + * + * This class is created internally by {@see Google\Cloud\Vision\Annotation}. + * See {@see Google\Cloud\Vision\Annotation::imageProperties()} for full usage details. + * This class should not be instantiated outside the externally. + * + * @param array $info The imageProperties annotation result + */ + public function __construct(array $info) + { + $this->info = $info; + + $class = get_class($this); + $err = "The class {$class} is no longer supported"; + @trigger_error($err, E_USER_DEPRECATED); + } + + /** + * Get the dominant colors in the image + * + * Example: + * ``` + * $colors = $imageProperties->colors(); + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#colorinfo ColorInfo + * + * @return array + */ + public function colors() + { + return $this->info['dominantColors']['colors']; + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/LikelihoodTrait.php b/vendor/google/cloud-vision/src/Annotation/LikelihoodTrait.php new file mode 100644 index 00000000..e2dc6ada --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/LikelihoodTrait.php @@ -0,0 +1,65 @@ + [ + 'VERY_LIKELY' + ], + FeatureInterface::STRENGTH_MEDIUM => [ + 'VERY_LIKELY', + 'LIKELY' + ], + FeatureInterface::STRENGTH_LOW => [ + 'VERY_LIKELY', + 'LIKELY', + 'POSSIBLE' + ] + ]; + + /** + * @param string $value The value name + * @param string $strength The strength to test with + * @return bool + */ + private function likelihood($value, $strength) + { + if (!array_key_exists($strength, $this->likelihoodLevels)) { + throw new InvalidArgumentException(sprintf( + 'Given strength %s is not a valid value', + $strength + )); + } + + $levels = $this->likelihoodLevels[$strength]; + + return in_array($value, $levels); + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/SafeSearch.php b/vendor/google/cloud-vision/src/Annotation/SafeSearch.php new file mode 100644 index 00000000..7f13e9e9 --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/SafeSearch.php @@ -0,0 +1,231 @@ +image($imageResource, [ 'safeSearch' ]); + * $annotation = $vision->annotate($image); + * + * $safeSearch = $annotation->safeSearch(); + * ``` + * + * @method adult() { + * Represents the adult contents likelihood for the image. + * + * Example: + * ``` + * echo $safeSearch->adult(); + * ``` + * + * @return string + * } + * @method spoof() { + * Spoof likelihood. The likelihood that an obvious modification was made to + * the image's canonical version to make it appear funny or offensive. + * + * Example: + * ``` + * echo $safeSearch->spoof(); + * ``` + * + * @return string + * } + * @method medical() { + * Likelihood this is a medical image. + * + * Example: + * ``` + * echo $safeSearch->medical(); + * ``` + * + * @return string + * } + * @method violence() { + * Violence likelihood. + * + * Example: + * ``` + * echo $safeSearch->violence(); + * ``` + * + * @return string + * } + * @method racy() { + * Racy likelihood. + * + * Example: + * ``` + * echo $safeSearch->racy(); + * ``` + * + * @return string + * } + * @method info() { + * Get the raw annotation result + * + * Example: + * ``` + * $info = $safeSearch->info(); + * ``` + * + * @return array + * } + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#SafeSearchAnnotation SafeSearchAnnotation + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class SafeSearch extends AbstractFeature +{ + use CallTrait; + use LikelihoodTrait; + + /** + * Create a SafeSearch annotation result + * + * This class is instantiated internally and is used to represent the result of Cloud Vision's SafeSearch annotation + * feature. It should not be instantiated directly. For complete usage instructions, please refer to + * {@see Google\Cloud\Vision\Annotation::safeSearch()}. + * + * @param array $info The SafeSearch annotation result + */ + public function __construct(array $info) + { + $this->info = $info; + + $class = get_class($this); + $err = "The class {$class} is no longer supported"; + @trigger_error($err, E_USER_DEPRECATED); + } + + /** + * Check whether the image contains adult content. + * + * Example: + * ``` + * if ($safeSearch->isAdult()) { + * echo "Image contains adult content."; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `SafeSearch::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function isAdult($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['adult'], $strength); + } + + /** + * Check whether the image was modified to make it appear funny or offensive. + * + * Example: + * ``` + * if ($safeSearch->isSpoof()) { + * echo "Image contains spoofed content."; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `SafeSearch::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function isSpoof($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['spoof'], $strength); + } + + /** + * Check whether the image contains medical content + * + * Example: + * ``` + * if ($safeSearch->medical()) { + * echo "Image contains medical content."; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `SafeSearch::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function isMedical($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['medical'], $strength); + } + + /** + * Check whether the image contains violent content + * + * Example: + * ``` + * if ($safeSearch->isViolent()) { + * echo "Image contains violent content."; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `SafeSearch::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function isViolent($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['violence'], $strength); + } + + /** + * Check whether the image contains racy content + * + * Example: + * ``` + * if ($safeSearch->isRacy()) { + * echo "Image contains racy content."; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `SafeSearch::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function isRacy($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['racy'], $strength); + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/Web.php b/vendor/google/cloud-vision/src/Annotation/Web.php new file mode 100644 index 00000000..070d612f --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/Web.php @@ -0,0 +1,177 @@ +image($imageResource, [ 'WEB_DETECTION' ]); + * $annotation = $vision->annotate($image); + * + * $web = $annotation->web(); + * ``` + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#WebDetection WebDetection + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class Web extends AbstractFeature +{ + /** + * @var WebEntity[] + */ + private $entities; + + /** + * @var WebImage[]|null + */ + private $matchingImages; + + /** + * @var WebImage[]|null + */ + private $partialMatchingImages; + + /** + * @var WebPage[]|null + */ + private $pages; + + /** + * Create a Web result. + * + * @param array $info The annotation result + */ + public function __construct(array $info) + { + $this->info = $info; + + if (isset($info['webEntities'])) { + $this->entities = []; + + foreach ($info['webEntities'] as $entity) { + $this->entities[] = new WebEntity($entity); + } + } + + if (isset($info['fullMatchingImages'])) { + $this->matchingImages = []; + + foreach ($info['fullMatchingImages'] as $image) { + $this->matchingImages[] = new WebImage($image); + } + } + + if (isset($info['partialMatchingImages'])) { + $this->partialMatchingImages = []; + + foreach ($info['partialMatchingImages'] as $image) { + $this->partialMatchingImages[] = new WebImage($image); + } + } + + if (isset($info['pagesWithMatchingImages'])) { + $this->pages = []; + + foreach ($info['pagesWithMatchingImages'] as $page) { + $this->pages[] = new WebPage($page); + } + } + + $class = get_class($this); + $err = "The class {$class} is no longer supported"; + @trigger_error($err, E_USER_DEPRECATED); + } + + /** + * Entities deduced from similar images on the Internet. + * + * Example: + * ``` + * $entities = $web->entities(); + * ``` + * + * @return WebEntity[]|null + */ + public function entities() + { + return $this->entities; + } + + /** + * Fully matching images from the internet. + * + * Images are most likely near duplicates, and most often are a copy of the + * given query image with a size change. + * + * Example: + * ``` + * $images = $web->matchingImages(); + * ``` + * + * @return WebImage[]|null + */ + public function matchingImages() + { + return $this->matchingImages; + } + + /** + * Partial matching images from the Internet. + * + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its crops. + * + * Example: + * ``` + * $images = $web->partialMatchingImages(); + * ``` + * + * @return WebImage[]|null + */ + public function partialMatchingImages() + { + return $this->partialMatchingImages; + } + + /** + * Web pages containing the matching images from the Internet. + * + * Example: + * ``` + * $pages = $web->pages(); + * ``` + * + * @return WebPage[]|null + */ + public function pages() + { + return $this->pages; + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/Web/WebEntity.php b/vendor/google/cloud-vision/src/Annotation/Web/WebEntity.php new file mode 100644 index 00000000..c4cf9030 --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/Web/WebEntity.php @@ -0,0 +1,88 @@ +image($imageResource, ['WEB_DETECTION']); + * $annotation = $vision->annotate($image); + * + * $entities = $annotation->web()->entities(); + * $firstEntity = $entities[0]; + * ``` + * + * @method entityId() { + * The Entity ID + * + * Example: + * ``` + * $id = $entity->entityId(); + * ``` + * + * @return string + * } + * @method score() { + * Overall relevancy score for the image. + * + * Not normalized and not comparable across different image queries. + * + * Example: + * ``` + * $score = $entity->score(); + * ``` + * + * @return float + * } + * @method description() { + * Canonical description of the entity, in English. + * + * Example: + * ``` + * $description = $entity->description(); + * ``` + * + * @return string + * } + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#WebEntity WebEntity + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class WebEntity extends AbstractFeature +{ + use CallTrait; + + /** + * @param array $info WebEntity info + */ + public function __construct(array $info) + { + $this->info = $info; + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/Web/WebImage.php b/vendor/google/cloud-vision/src/Annotation/Web/WebImage.php new file mode 100644 index 00000000..92cc87b9 --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/Web/WebImage.php @@ -0,0 +1,78 @@ +image($imageResource, ['WEB_DETECTION']); + * $annotation = $vision->annotate($image); + * + * $matchingImages = $annotation->web()->matchingImages(); + * $firstImage = $matchingImages[0]; + * ``` + * + * @method url() { + * The result image URL + * + * Example: + * ``` + * $url = $image->url(); + * ``` + * + * @return string + * } + * @method score() { + * Overall relevancy score for the image. + * + * Not normalized and not comparable across different image queries. + * + * Example: + * ``` + * $score = $image->score(); + * ``` + * + * @return float + * } + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#WebImage WebImage + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class WebImage extends AbstractFeature +{ + use CallTrait; + + /** + * @param array $info The WebImage result + */ + public function __construct(array $info) + { + $this->info = $info; + } +} diff --git a/vendor/google/cloud-vision/src/Annotation/Web/WebPage.php b/vendor/google/cloud-vision/src/Annotation/Web/WebPage.php new file mode 100644 index 00000000..d4f4187e --- /dev/null +++ b/vendor/google/cloud-vision/src/Annotation/Web/WebPage.php @@ -0,0 +1,82 @@ +image($imageResource, ['WEB_DETECTION']); + * $annotation = $vision->annotate($image); + * + * $pages = $annotation->web()->pages(); + * $firstPage = $pages[0]; + * ``` + * + * @method url() { + * The result web page URL + * + * Example: + * ``` + * $url = $image->url(); + * ``` + * + * @return string + * } + * @method score() { + * Overall relevancy score for the image. + * + * Not normalized and not comparable across different image queries. + * + * Example: + * ``` + * $score = $image->score(); + * ``` + * + * @return float + * } + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#WebPage WebPage + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class WebPage extends AbstractFeature +{ + use CallTrait; + + /** + * @param array $info The WebPage result + */ + public function __construct(array $info) + { + $this->info = $info; + + $class = get_class($this); + $err = "The class {$class} is no longer supported"; + @trigger_error($err, E_USER_DEPRECATED); + } +} diff --git a/vendor/google/cloud-vision/src/Connection/ConnectionInterface.php b/vendor/google/cloud-vision/src/Connection/ConnectionInterface.php new file mode 100644 index 00000000..74655429 --- /dev/null +++ b/vendor/google/cloud-vision/src/Connection/ConnectionInterface.php @@ -0,0 +1,30 @@ + __DIR__ . '/ServiceDefinition/vision-v1.json', + 'componentVersion' => VisionClient::VERSION + ]; + + $this->setRequestWrapper(new RequestWrapper($config)); + $this->setRequestBuilder(new RequestBuilder( + $config['serviceDefinitionPath'], + $this->getApiEndpoint(self::BASE_URI, $config) + )); + + $class = get_class($this); + $err = "The class {$class} is no longer supported"; + @trigger_error($err, E_USER_DEPRECATED); + } + + /** + * @param array $args + */ + public function annotate(array $args) + { + return $this->send('images', 'annotate', $args); + } +} diff --git a/vendor/google/cloud-vision/src/Connection/ServiceDefinition/vision-v1.json b/vendor/google/cloud-vision/src/Connection/ServiceDefinition/vision-v1.json new file mode 100644 index 00000000..2bcdadac --- /dev/null +++ b/vendor/google/cloud-vision/src/Connection/ServiceDefinition/vision-v1.json @@ -0,0 +1,968 @@ +{ + "id": "vision:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + } + } + } + }, + "description": "Integrates Google Vision features, including image labeling, face, logo, and landmark detection, optical character recognition (OCR), and detection of explicit content, into applications.", + "protocol": "rest", + "title": "Google Cloud Vision API", + "resources": { + "images": { + "methods": { + "annotate": { + "id": "vision.images.annotate", + "response": { + "$ref": "BatchAnnotateImagesResponse" + }, + "parameterOrder": [], + "description": "Run image detection and annotation for a batch of images.", + "request": { + "$ref": "BatchAnnotateImagesRequest" + }, + "flatPath": "v1/images:annotate", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/images:annotate", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + } + }, + "schemas": { + "ImageSource": { + "description": "External image source (Google Cloud Storage image location).", + "type": "object", + "properties": { + "gcsImageUri": { + "description": "Google Cloud Storage image URI. It must be in the following form:\n`gs://bucket_name/object_name`. For more\ndetails, please see: https://cloud.google.com/storage/docs/reference-uris.\nNOTE: Cloud Storage object versioning is not supported!", + "type": "string" + }, + "ImageUri": { + "description": "Image URI which supports: 1) Google Cloud Storage image URI, which must be in the following form: `gs://bucket_name/object_name` (for details, see [Google Cloud Storage Request URIs](https://cloud.google.com/storage/docs/reference-uris)). NOTE: Cloud Storage object versioning is not supported. 2) Publicly accessible image HTTP/HTTPS URL. This is preferred over the legacy `gcs_image_uri` above. When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes precedence.", + "type": "string" + } + }, + "id": "ImageSource" + }, + "AnnotateImageRequest": { + "description": "Request for performing Google Cloud Vision API tasks over a user-provided\nimage, with user-requested features.", + "type": "object", + "properties": { + "image": { + "description": "The image to be processed.", + "$ref": "Image" + }, + "imageContext": { + "description": "Additional context that may accompany the image.", + "$ref": "ImageContext" + }, + "features": { + "description": "Requested features.", + "type": "array", + "items": { + "$ref": "Feature" + } + } + }, + "id": "AnnotateImageRequest" + }, + "AnnotateImageResponse": { + "description": "Response to an image annotation request.", + "type": "object", + "properties": { + "labelAnnotations": { + "description": "If present, label detection completed successfully.", + "type": "array", + "items": { + "$ref": "EntityAnnotation" + } + }, + "landmarkAnnotations": { + "description": "If present, landmark detection completed successfully.", + "type": "array", + "items": { + "$ref": "EntityAnnotation" + } + }, + "safeSearchAnnotation": { + "description": "If present, safe-search annotation completed successfully.", + "$ref": "SafeSearchAnnotation" + }, + "imagePropertiesAnnotation": { + "description": "If present, image properties were extracted successfully.", + "$ref": "ImageProperties" + }, + "textAnnotations": { + "description": "If present, text (OCR) detection completed successfully.", + "type": "array", + "items": { + "$ref": "EntityAnnotation" + } + }, + "logoAnnotations": { + "description": "If present, logo detection completed successfully.", + "type": "array", + "items": { + "$ref": "EntityAnnotation" + } + }, + "faceAnnotations": { + "description": "If present, face detection completed successfully.", + "type": "array", + "items": { + "$ref": "FaceAnnotation" + } + }, + "error": { + "description": "If set, represents the error message for the operation.\nNote that filled-in mage annotations are guaranteed to be\ncorrect, even when \u003ccode\u003eerror\u003c/code\u003e is non-empty.", + "$ref": "Status" + } + }, + "id": "AnnotateImageResponse" + }, + "LatLongRect": { + "description": "Rectangle determined by min and max LatLng pairs.", + "type": "object", + "properties": { + "maxLatLng": { + "description": "Max lat/long pair.", + "$ref": "LatLng" + }, + "minLatLng": { + "description": "Min lat/long pair.", + "$ref": "LatLng" + } + }, + "id": "LatLongRect" + }, + "Status": { + "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", + "type": "array", + "items": { + "additionalProperties": { + "description": "Properties of the object. Contains field @ype with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", + "type": "string" + } + }, + "id": "Status" + }, + "FaceAnnotation": { + "description": "A face annotation object contains the results of face detection.", + "type": "object", + "properties": { + "tiltAngle": { + "description": "Pitch angle. Indicates the upwards/downwards angle that the face is\npointing\nrelative to the image's horizontal plane. Range [-180,180].", + "type": "number", + "format": "float" + }, + "underExposedLikelihood": { + "description": "Under-exposed likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "The image very unlikely belongs to the vertical specified.", + "The image unlikely belongs to the vertical specified.", + "The image possibly belongs to the vertical specified.", + "The image likely belongs to the vertical specified.", + "The image very likely belongs to the vertical specified." + ], + "type": "string" + }, + "fdBoundingPoly": { + "description": "This bounding polygon is tighter than the previous\n\u003ccode\u003eboundingPoly\u003c/code\u003e, and\nencloses only the skin part of the face. Typically, it is used to\neliminate the face from any image analysis that detects the\n\"amount of skin\" visible in an image. It is not based on the\nlandmarker results, only on the initial face detection, hence\nthe \u003ccode\u003efd\u003c/code\u003e (face detection) prefix.", + "$ref": "BoundingPoly" + }, + "landmarkingConfidence": { + "description": "Face landmarking confidence. Range [0, 1].", + "type": "number", + "format": "float" + }, + "joyLikelihood": { + "description": "Joy likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "The image very unlikely belongs to the vertical specified.", + "The image unlikely belongs to the vertical specified.", + "The image possibly belongs to the vertical specified.", + "The image likely belongs to the vertical specified.", + "The image very likely belongs to the vertical specified." + ], + "type": "string" + }, + "detectionConfidence": { + "description": "Detection confidence. Range [0, 1].", + "type": "number", + "format": "float" + }, + "surpriseLikelihood": { + "description": "Surprise likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "The image very unlikely belongs to the vertical specified.", + "The image unlikely belongs to the vertical specified.", + "The image possibly belongs to the vertical specified.", + "The image likely belongs to the vertical specified.", + "The image very likely belongs to the vertical specified." + ], + "type": "string" + }, + "angerLikelihood": { + "description": "Anger likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "The image very unlikely belongs to the vertical specified.", + "The image unlikely belongs to the vertical specified.", + "The image possibly belongs to the vertical specified.", + "The image likely belongs to the vertical specified.", + "The image very likely belongs to the vertical specified." + ], + "type": "string" + }, + "headwearLikelihood": { + "description": "Headwear likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "The image very unlikely belongs to the vertical specified.", + "The image unlikely belongs to the vertical specified.", + "The image possibly belongs to the vertical specified.", + "The image likely belongs to the vertical specified.", + "The image very likely belongs to the vertical specified." + ], + "type": "string" + }, + "panAngle": { + "description": "Yaw angle. Indicates the leftward/rightward angle that the face is\npointing, relative to the vertical plane perpendicular to the image. Range\n[-180,180].", + "type": "number", + "format": "float" + }, + "boundingPoly": { + "description": "The bounding polygon around the face. The coordinates of the bounding box\nare in the original image's scale, as returned in ImageParams.\nThe bounding box is computed to \"frame\" the face in accordance with human\nexpectations. It is based on the landmarker results.\nNote that one or more x and/or y coordinates may not be generated in the\nBoundingPoly (the polygon will be unbounded) if only a partial face appears in\nthe image to be annotated.", + "$ref": "BoundingPoly" + }, + "landmarks": { + "description": "Detected face landmarks.", + "type": "array", + "items": { + "$ref": "Landmark" + } + }, + "blurredLikelihood": { + "description": "Blurred likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "The image very unlikely belongs to the vertical specified.", + "The image unlikely belongs to the vertical specified.", + "The image possibly belongs to the vertical specified.", + "The image likely belongs to the vertical specified.", + "The image very likely belongs to the vertical specified." + ], + "type": "string" + }, + "rollAngle": { + "description": "Roll angle. Indicates the amount of clockwise/anti-clockwise rotation of\nthe\nface relative to the image vertical, about the axis perpendicular to the\nface. Range [-180,180].", + "type": "number", + "format": "float" + }, + "sorrowLikelihood": { + "description": "Sorrow likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "The image very unlikely belongs to the vertical specified.", + "The image unlikely belongs to the vertical specified.", + "The image possibly belongs to the vertical specified.", + "The image likely belongs to the vertical specified.", + "The image very likely belongs to the vertical specified." + ], + "type": "string" + } + }, + "id": "FaceAnnotation" + }, + "Vertex": { + "description": "A vertex represents a 2D point in the image.\nNOTE: the vertex coordinates are in the same scale as the original image.", + "type": "object", + "properties": { + "y": { + "description": "Y coordinate.", + "type": "integer", + "format": "int32" + }, + "x": { + "description": "X coordinate.", + "type": "integer", + "format": "int32" + } + }, + "id": "Vertex" + }, + "ColorInfo": { + "description": "Color information consists of RGB channels, score and fraction of\nimage the color occupies in the image.", + "type": "object", + "properties": { + "pixelFraction": { + "description": "Stores the fraction of pixels the color occupies in the image.\nValue in range [0, 1].", + "type": "number", + "format": "float" + }, + "color": { + "description": "RGB components of the color.", + "$ref": "Color" + }, + "score": { + "description": "Image-specific score for this color. Value in range [0, 1].", + "type": "number", + "format": "float" + } + }, + "id": "ColorInfo" + }, + "BoundingPoly": { + "description": "A bounding polygon for the detected image annotation.", + "type": "object", + "properties": { + "vertices": { + "description": "The bounding polygon vertices.", + "type": "array", + "items": { + "$ref": "Vertex" + } + } + }, + "id": "BoundingPoly" + }, + "Landmark": { + "description": "A face-specific landmark (for example, a face feature).\nLandmark positions may fall outside the bounds of the image\nwhen the face is near one or more edges of the image.\nTherefore it is NOT guaranteed that 0 \u003c= x \u003c width or 0 \u003c= y \u003c height.", + "type": "object", + "properties": { + "position": { + "description": "Face landmark position.", + "$ref": "Position" + }, + "type": { + "description": "Face landmark type.", + "enum": [ + "UNKNOWN_LANDMARK", + "LEFT_EYE", + "RIGHT_EYE", + "LEFT_OF_LEFT_EYEBROW", + "RIGHT_OF_LEFT_EYEBROW", + "LEFT_OF_RIGHT_EYEBROW", + "RIGHT_OF_RIGHT_EYEBROW", + "MIDPOINT_BETWEEN_EYES", + "NOSE_TIP", + "UPPER_LIP", + "LOWER_LIP", + "MOUTH_LEFT", + "MOUTH_RIGHT", + "MOUTH_CENTER", + "NOSE_BOTTOM_RIGHT", + "NOSE_BOTTOM_LEFT", + "NOSE_BOTTOM_CENTER", + "LEFT_EYE_TOP_BOUNDARY", + "LEFT_EYE_RIGHT_CORNER", + "LEFT_EYE_BOTTOM_BOUNDARY", + "LEFT_EYE_LEFT_CORNER", + "RIGHT_EYE_TOP_BOUNDARY", + "RIGHT_EYE_RIGHT_CORNER", + "RIGHT_EYE_BOTTOM_BOUNDARY", + "RIGHT_EYE_LEFT_CORNER", + "LEFT_EYEBROW_UPPER_MIDPOINT", + "RIGHT_EYEBROW_UPPER_MIDPOINT", + "LEFT_EAR_TRAGION", + "RIGHT_EAR_TRAGION", + "LEFT_EYE_PUPIL", + "RIGHT_EYE_PUPIL", + "FOREHEAD_GLABELLA", + "CHIN_GNATHION", + "CHIN_LEFT_GONION", + "CHIN_RIGHT_GONION" + ], + "enumDescriptions": [ + "Unknown face landmark detected. Should not be filled.", + "Left eye.", + "Right eye.", + "Left of left eyebrow.", + "Right of left eyebrow.", + "Left of right eyebrow.", + "Right of right eyebrow.", + "Midpoint between eyes.", + "Nose tip.", + "Upper lip.", + "Lower lip.", + "Mouth left.", + "Mouth right.", + "Mouth center.", + "Nose, bottom right.", + "Nose, bottom left.", + "Nose, bottom center.", + "Left eye, top boundary.", + "Left eye, right corner.", + "Left eye, bottom boundary.", + "Left eye, left corner.", + "Right eye, top boundary.", + "Right eye, right corner.", + "Right eye, bottom boundary.", + "Right eye, left corner.", + "Left eyebrow, upper midpoint.", + "Right eyebrow, upper midpoint.", + "Left ear tragion.", + "Right ear tragion.", + "Left eye pupil.", + "Right eye pupil.", + "Forehead glabella.", + "Chin gnathion.", + "Chin left gonion.", + "Chin right gonion." + ], + "type": "string" + } + }, + "id": "Landmark" + }, + "ImageContext": { + "description": "Image context.", + "type": "object", + "properties": { + "latLongRect": { + "description": "Lat/long rectangle that specifies the location of the image.", + "$ref": "LatLongRect" + }, + "languageHints": { + "description": "List of languages to use for TEXT_DETECTION. In most cases, an empty value\nyields the best results since it enables automatic language detection. For\nlanguages based on the Latin alphabet, setting `language_hints` is not\nneeded. In rare cases, when the language of the text in the image is known,\nsetting a hint will help get better results (although it will be a\nsignificant hindrance if the hint is wrong). Text detection returns an\nerror if one or more of the specified languages is not one of the\n[supported\nlanguages](/translate/v2/translate-reference#supported_languages).", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "ImageContext" + }, + "BatchAnnotateImagesRequest": { + "description": "Multiple image annotation requests are batched into a single service call.", + "type": "object", + "properties": { + "requests": { + "description": "Individual image annotation requests for this batch.", + "type": "array", + "items": { + "$ref": "AnnotateImageRequest" + } + } + }, + "id": "BatchAnnotateImagesRequest" + }, + "EntityAnnotation": { + "description": "Set of detected entity features.", + "type": "object", + "properties": { + "mid": { + "description": "Opaque entity ID. Some IDs might be available in Knowledge Graph(KG).\nFor more details on KG please see:\nhttps://developers.google.com/knowledge-graph/", + "type": "string" + }, + "description": { + "description": "Entity textual description, expressed in its \u003ccode\u003elocale\u003c/code\u003e language.", + "type": "string" + }, + "topicality": { + "description": "The relevancy of the ICA (Image Content Annotation) label to the\nimage. For example, the relevancy of 'tower' to an image containing\n'Eiffel Tower' is likely higher than an image containing a distant towering\nbuilding, though the confidence that there is a tower may be the same.\nRange [0, 1].", + "type": "number", + "format": "float" + }, + "locale": { + "description": "The language code for the locale in which the entity textual\n\u003ccode\u003edescription\u003c/code\u003e (next field) is expressed.", + "type": "string" + }, + "properties": { + "description": "Some entities can have additional optional \u003ccode\u003eProperty\u003c/code\u003e fields.\nFor example a different kind of score or string that qualifies the entity.", + "type": "array", + "items": { + "$ref": "Property" + } + }, + "score": { + "description": "Overall score of the result. Range [0, 1].", + "type": "number", + "format": "float" + }, + "boundingPoly": { + "description": "Image region to which this entity belongs. Not filled currently\nfor `LABEL_DETECTION` features. For `TEXT_DETECTION` (OCR), `boundingPoly`s\nare produced for the entire text detected in an image region, followed by\n`boundingPoly`s for each word within the detected text.", + "$ref": "BoundingPoly" + }, + "locations": { + "description": "The location information for the detected entity. Multiple\n\u003ccode\u003eLocationInfo\u003c/code\u003e elements can be present since one location may\nindicate the location of the scene in the query image, and another the\nlocation of the place where the query image was taken. Location information\nis usually present for landmarks.", + "type": "array", + "items": { + "$ref": "LocationInfo" + } + }, + "confidence": { + "description": "The accuracy of the entity detection in an image.\nFor example, for an image containing 'Eiffel Tower,' this field represents\nthe confidence that there is a tower in the query image. Range [0, 1].", + "type": "number", + "format": "float" + } + }, + "id": "EntityAnnotation" + }, + "Property": { + "description": "Arbitrary name/value pair.", + "type": "object", + "properties": { + "value": { + "description": "Value of the property.", + "type": "string" + }, + "name": { + "description": "Name of the property.", + "type": "string" + } + }, + "id": "Property" + }, + "Color": { + "description": "Represents a color in the RGBA color space. This representation is designed\nfor simplicity of conversion to/from color representations in various\nlanguages over compactness; for example, the fields of this representation\ncan be trivially provided to the constructor of \"java.awt.Color\" in Java; it\ncan also be trivially provided to UIColor's \"+colorWithRed:green:blue:alpha\"\nmethod in iOS; and, with just a little work, it can be easily formatted into\na CSS \"rgba()\" string in JavaScript, as well. Here are some examples:\n\nExample (Java):\n\n import com.google.type.Color;\n\n // ...\n public static java.awt.Color fromProto(Color protocolor) {\n float alpha = protocolor.hasAlpha()\n ? protocolor.getAlpha().getValue()\n : 1.0;\n\n return new java.awt.Color(\n protocolor.getRed(),\n protocolor.getGreen(),\n protocolor.getBlue(),\n alpha);\n }\n\n public static Color toProto(java.awt.Color color) {\n float red = (float) color.getRed();\n float green = (float) color.getGreen();\n float blue = (float) color.getBlue();\n float denominator = 255.0;\n Color.Builder resultBuilder =\n Color\n .newBuilder()\n .setRed(red / denominator)\n .setGreen(green / denominator)\n .setBlue(blue / denominator);\n int alpha = color.getAlpha();\n if (alpha != 255) {\n result.setAlpha(\n FloatValue\n .newBuilder()\n .setValue(((float) alpha) / denominator)\n .build());\n }\n return resultBuilder.build();\n }\n // ...\n\nExample (iOS / Obj-C):\n\n // ...\n static UIColor* fromProto(Color* protocolor) {\n float red = [protocolor red];\n float green = [protocolor green];\n float blue = [protocolor blue];\n FloatValue* alpha_wrapper = [protocolor alpha];\n float alpha = 1.0;\n if (alpha_wrapper != nil) {\n alpha = [alpha_wrapper value];\n }\n return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];\n }\n\n static Color* toProto(UIColor* color) {\n CGFloat red, green, blue, alpha;\n if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {\n return nil;\n }\n Color* result = [Color alloc] init];\n [result setRed:red];\n [result setGreen:green];\n [result setBlue:blue];\n if (alpha \u003c= 0.9999) {\n [result setAlpha:floatWrapperWithValue(alpha)];\n }\n [result autorelease];\n return result;\n }\n // ...\n\n Example (JavaScript):\n\n // ...\n\n var protoToCssColor = function(rgb_color) {\n var redFrac = rgb_color.red || 0.0;\n var greenFrac = rgb_color.green || 0.0;\n var blueFrac = rgb_color.blue || 0.0;\n var red = Math.floor(redFrac * 255);\n var green = Math.floor(greenFrac * 255);\n var blue = Math.floor(blueFrac * 255);\n\n if (!('alpha' in rgb_color)) {\n return rgbToCssColor_(red, green, blue);\n }\n\n var alphaFrac = rgb_color.alpha.value || 0.0;\n var rgbParams = [red, green, blue].join(',');\n return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');\n };\n\n var rgbToCssColor_ = function(red, green, blue) {\n var rgbNumber = new Number((red \u003c\u003c 16) | (green \u003c\u003c 8) | blue);\n var hexString = rgbNumber.toString(16);\n var missingZeros = 6 - hexString.length;\n var resultBuilder = ['#'];\n for (var i = 0; i \u003c missingZeros; i++) {\n resultBuilder.push('0');\n }\n resultBuilder.push(hexString);\n return resultBuilder.join('');\n };\n\n // ...", + "type": "object", + "properties": { + "green": { + "description": "The amount of green in the color as a value in the interval [0, 1].", + "type": "number", + "format": "float" + }, + "blue": { + "description": "The amount of blue in the color as a value in the interval [0, 1].", + "type": "number", + "format": "float" + }, + "red": { + "description": "The amount of red in the color as a value in the interval [0, 1].", + "type": "number", + "format": "float" + }, + "alpha": { + "description": "The fraction of this color that should be applied to the pixel. That is,\nthe final pixel color is defined by the equation:\n\n pixel color = alpha * (this color) + (1.0 - alpha) * (background color)\n\nThis means that a value of 1.0 corresponds to a solid color, whereas\na value of 0.0 corresponds to a completely transparent color. This\nuses a wrapper message rather than a simple float scalar so that it is\npossible to distinguish between a default value and the value being unset.\nIf omitted, this color object is to be rendered as a solid color\n(as if the alpha value had been explicitly given with a value of 1.0).", + "type": "number", + "format": "float" + } + }, + "id": "Color" + }, + "LocationInfo": { + "description": "Detected entity location information.", + "type": "object", + "properties": { + "latLng": { + "description": "Lat - long location coordinates.", + "$ref": "LatLng" + } + }, + "id": "LocationInfo" + }, + "SafeSearchAnnotation": { + "description": "Set of features pertaining to the image, computed by various computer vision\nmethods over safe-search verticals (for example, adult, spoof, medical,\nviolence).", + "type": "object", + "properties": { + "medical": { + "description": "Likelihood this is a medical image.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "The image very unlikely belongs to the vertical specified.", + "The image unlikely belongs to the vertical specified.", + "The image possibly belongs to the vertical specified.", + "The image likely belongs to the vertical specified.", + "The image very likely belongs to the vertical specified." + ], + "type": "string" + }, + "spoof": { + "description": "Spoof likelihood. The likelihood that an obvious modification\nwas made to the image's canonical version to make it appear\nfunny or offensive.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "The image very unlikely belongs to the vertical specified.", + "The image unlikely belongs to the vertical specified.", + "The image possibly belongs to the vertical specified.", + "The image likely belongs to the vertical specified.", + "The image very likely belongs to the vertical specified." + ], + "type": "string" + }, + "violence": { + "description": "Violence likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "The image very unlikely belongs to the vertical specified.", + "The image unlikely belongs to the vertical specified.", + "The image possibly belongs to the vertical specified.", + "The image likely belongs to the vertical specified.", + "The image very likely belongs to the vertical specified." + ], + "type": "string" + }, + "adult": { + "description": "Represents the adult contents likelihood for the image.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "The image very unlikely belongs to the vertical specified.", + "The image unlikely belongs to the vertical specified.", + "The image possibly belongs to the vertical specified.", + "The image likely belongs to the vertical specified.", + "The image very likely belongs to the vertical specified." + ], + "type": "string" + } + }, + "id": "SafeSearchAnnotation" + }, + "Image": { + "description": "Client image to perform Google Cloud Vision API tasks over.", + "type": "object", + "properties": { + "source": { + "description": "Google Cloud Storage image location. If both 'content' and 'source'\nare filled for an image, 'content' takes precedence and it will be\nused for performing the image annotation request.", + "$ref": "ImageSource" + }, + "content": { + "description": "Image content, represented as a stream of bytes.\nNote: as with all `bytes` fields, protobuffers use a pure binary\nrepresentation, whereas JSON representations use base64.", + "type": "string", + "format": "byte" + } + }, + "id": "Image" + }, + "DominantColorsAnnotation": { + "description": "Set of dominant colors and their corresponding scores.", + "type": "object", + "properties": { + "colors": { + "description": "RGB color values, with their score and pixel fraction.", + "type": "array", + "items": { + "$ref": "ColorInfo" + } + } + }, + "id": "DominantColorsAnnotation" + }, + "Feature": { + "description": "The \u003cem\u003eFeature\u003c/em\u003e indicates what type of image detection task to perform.\nUsers describe the type of Google Cloud Vision API tasks to perform over\nimages by using \u003cem\u003eFeature\u003c/em\u003es. Features encode the Cloud Vision API\nvertical to operate on and the number of top-scoring results to return.", + "type": "object", + "properties": { + "type": { + "description": "The feature type.", + "enum": [ + "TYPE_UNSPECIFIED", + "FACE_DETECTION", + "LANDMARK_DETECTION", + "LOGO_DETECTION", + "LABEL_DETECTION", + "TEXT_DETECTION", + "DOCUMENT_TEXT_DETECTION", + "SAFE_SEARCH_DETECTION", + "IMAGE_PROPERTIES", + "CROP_HINTS", + "WEB_DETECTION" + ], + "enumDescriptions": [ + "Unspecified feature type.", + "Run face detection.", + "Run landmark detection.", + "Run logo detection.", + "Run label detection.", + "Run OCR.", + "Run dense text document OCR. Takes precedence when both DOCUMENT_TEXT_DETECTION and TEXT_DETECTION are present.", + "Run various computer vision models to compute image safe-search properties.", + "Compute a set of properties about the image (such as the image's dominant colors).", + "Run crop hints.", + "Run web annotation." + ], + "type": "string" + }, + "maxResults": { + "description": "Maximum number of results of this type.", + "type": "integer", + "format": "int32" + } + }, + "id": "Feature" + }, + "BatchAnnotateImagesResponse": { + "description": "Response to a batch image annotation request.", + "type": "object", + "properties": { + "responses": { + "description": "Individual responses to image annotation requests within the batch.", + "type": "array", + "items": { + "$ref": "AnnotateImageResponse" + } + } + }, + "id": "BatchAnnotateImagesResponse" + }, + "ImageProperties": { + "description": "Stores image properties (e.g. dominant colors).", + "type": "object", + "properties": { + "dominantColors": { + "description": "If present, dominant colors completed successfully.", + "$ref": "DominantColorsAnnotation" + } + }, + "id": "ImageProperties" + }, + "LatLng": { + "description": "An object representing a latitude/longitude pair. This is expressed as a pair\nof doubles representing degrees latitude and degrees longitude. Unless\nspecified otherwise, this must conform to the\n\u003ca href=\"http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf\"\u003eWGS84\nstandard\u003c/a\u003e. Values must be within normalized ranges.\n\nExample of normalization code in Python:\n\n def NormalizeLongitude(longitude):\n \"\"\"Wraps decimal degrees longitude to [-180.0, 180.0].\"\"\"\n q, r = divmod(longitude, 360.0)\n if r \u003e 180.0 or (r == 180.0 and q \u003c= -1.0):\n return r - 360.0\n return r\n\n def NormalizeLatLng(latitude, longitude):\n \"\"\"Wraps decimal degrees latitude and longitude to\n [-90.0, 90.0] and [-180.0, 180.0], respectively.\"\"\"\n r = latitude % 360.0\n if r \u003c= 90.0:\n return r, NormalizeLongitude(longitude)\n elif r \u003e= 270.0:\n return r - 360, NormalizeLongitude(longitude)\n else:\n return 180 - r, NormalizeLongitude(longitude + 180.0)\n\n assert 180.0 == NormalizeLongitude(180.0)\n assert -180.0 == NormalizeLongitude(-180.0)\n assert -179.0 == NormalizeLongitude(181.0)\n assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)\n assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)\n assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)\n assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)\n assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)\n assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)\n assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)\n assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)\n assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)\n assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)", + "type": "object", + "properties": { + "latitude": { + "description": "The latitude in degrees. It must be in the range [-90.0, +90.0].", + "type": "number", + "format": "double" + }, + "longitude": { + "description": "The longitude in degrees. It must be in the range [-180.0, +180.0].", + "type": "number", + "format": "double" + } + }, + "id": "LatLng" + }, + "Position": { + "description": "A 3D position in the image, used primarily for Face detection landmarks.\nA valid Position must have both x and y coordinates.\nThe position coordinates are in the same scale as the original image.", + "type": "object", + "properties": { + "y": { + "description": "Y coordinate.", + "type": "number", + "format": "float" + }, + "x": { + "description": "X coordinate.", + "type": "number", + "format": "float" + }, + "z": { + "description": "Z coordinate (or depth).", + "type": "number", + "format": "float" + } + }, + "id": "Position" + } + }, + "revision": "20160606", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "discoveryVersion": "v1", + "baseUrl": "https://vision.googleapis.com/", + "name": "vision", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/vision/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://vision.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/vendor/google/cloud-vision/src/Image.php b/vendor/google/cloud-vision/src/Image.php new file mode 100644 index 00000000..68c860d6 --- /dev/null +++ b/vendor/google/cloud-vision/src/Image.php @@ -0,0 +1,374 @@ +image($imageResource, [ + * 'FACE_DETECTION' + * ]); + * ``` + * + * ``` + * //[snippet=direct] + * // Images can be directly instantiated. + * use Google\Cloud\Vision\Image; + * + * $imageResource = fopen(__DIR__ . '/assets/family-photo.jpg', 'r'); + * $image = new Image($imageResource, [ + * 'FACE_DETECTION' + * ]); + * ``` + * + * ``` + * //[snippet=string] + * // Image data can be given as a string + * + * use Google\Cloud\Vision\Image; + * + * $imageData = file_get_contents(__DIR__ .'/assets/family-photo.jpg'); + * $image = new Image($imageData, [ + * 'FACE_DETECTION' + * ]); + * ``` + * + * ``` + * //[snippet=gcs] + * // Files stored in Google Cloud Storage can be used. + * use Google\Cloud\Storage\StorageClient; + * use Google\Cloud\Vision\Image; + * + * $storage = new StorageClient(); + * $file = $storage->bucket('my-test-bucket')->object('family-photo.jpg'); + * $image = new Image($file, [ + * 'FACE_DETECTION' + * ]); + * ``` + * + * ``` + * //[snippet=max] + * // This example sets a maximum results limit on one feature and provides some image context. + * + * use Google\Cloud\Vision\Image; + * + * $imageResource = fopen(__DIR__ . '/assets/family-photo.jpg', 'r'); + * $image = new Image($imageResource, [ + * 'FACE_DETECTION', + * 'LOGO_DETECTION' + * ], [ + * 'maxResults' => [ + * 'FACE_DETECTION' => 1 + * ], + * 'imageContext' => [ + * 'latLongRect' => [ + * 'minLatLng' => [ + * 'latitude' => '-45.0', + * 'longitude' => '-45.0' + * ], + * 'maxLatLng' => [ + * 'latitude' => '45.0', + * 'longitude' => '45.0' + * ] + * ] + * ] + * ]); + * ``` + * + * ``` + * //[snippet=shortcut] + * // The client library also offers shortcut names which can be used in place of the longer feature names. + * + * use Google\Cloud\Vision\Image; + * + * $imageResource = fopen(__DIR__ . '/assets/family-photo.jpg', 'r'); + * $image = new Image($imageResource, [ + * 'faces', // Corresponds to `FACE_DETECTION` + * 'landmarks', // Corresponds to `LANDMARK_DETECTION` + * 'logos', // Corresponds to `LOGO_DETECTION` + * 'labels', // Corresponds to `LABEL_DETECTION` + * 'text', // Corresponds to `TEXT_DETECTION`, + * 'document', // Corresponds to `DOCUMENT_TEXT_DETECTION` + * 'safeSearch', // Corresponds to `SAFE_SEARCH_DETECTION` + * 'imageProperties',// Corresponds to `IMAGE_PROPERTIES` + * 'crop', // Corresponds to `CROP_HINTS` + * 'web' // Corresponds to `WEB_DETECTION` + * ]); + * ``` + * + * @see https://cloud.google.com/vision/docs/best-practices Best Practices + * @see https://cloud.google.com/vision/docs/pricing Pricing + * + * @deprecated This class is no longer supported and will be removed in a future + * release. + */ +class Image +{ + const TYPE_BYTES = 'bytes'; + const TYPE_STRING = 'string'; + const TYPE_URI = 'uri'; + + /** + * @var mixed + */ + private $image; + + /** + * @var string + */ + private $type; + + /** + * @var array + */ + private $features; + + /** + * @var array + */ + private $options; + + /** + * A map of short names to identifiers recognized by Cloud Vision. + * + * @var array + */ + private $featureShortNames = [ + 'faces' => 'FACE_DETECTION', + 'landmarks' => 'LANDMARK_DETECTION', + 'logos' => 'LOGO_DETECTION', + 'labels' => 'LABEL_DETECTION', + 'text' => 'TEXT_DETECTION', + 'document' => 'DOCUMENT_TEXT_DETECTION', + 'safeSearch' => 'SAFE_SEARCH_DETECTION', + 'imageProperties' => 'IMAGE_PROPERTIES', + 'crop' => 'CROP_HINTS', + 'web' => 'WEB_DETECTION' + ]; + + /** + * A list of allowed url schemes. + * + * @var array + */ + private $urlSchemes = [ + 'http', + 'https', + 'gs' + ]; + + /** + * Create an image with all required configuration. + * + * @param resource|string|StorageObject $image An image to configure with + * the given settings. This parameter will accept a resource, a + * string of bytes, the URI of an image in a publicly-accessible + * web location, or an instance of {@see Google\Cloud\Storage\StorageObject}. + * @param array $features A list of cloud vision + * [features](https://cloud.google.com/vision/reference/rest/v1/images/annotate#type) + * to apply to the image. Google Cloud Platform Client Library provides a set of abbreviated + * names which can be used in the interest of brevity in place of + * the names offered by the cloud vision service. These names are + * `faces`, `landmarks`, `logos`, `labels`, `text`, `document`, + * `safeSearch`, `imageProperties`, `crop`, and `web`. + * @param array $options { + * Configuration Options + * + * @type array $maxResults A list of features and the maximum number of + * results to return. Keys should correspond to feature names + * given in the `$features` array, and values should be of type + * int. In all cases where `$maxResults` does not contain a value + * for a feature, all results will be returned. In cases where + * a `$maxResults` value is specified, the cloud vision service + * will return results up to the `$maxResults` value, or the full + * results, whichever is fewer. + * @type array $imageContext See + * [ImageContext](https://cloud.google.com/vision/reference/rest/v1/images/annotate#imagecontext) + * for full usage details. + * } + * @throws InvalidArgumentException + */ + public function __construct($image, array $features, array $options = []) + { + $this->options = $options + [ + 'imageContext' => [], + 'maxResults' => [] + ]; + + $this->features = $this->normalizeFeatures($features); + + $this->image = $image; + if (is_string($image) && in_array(parse_url($image, PHP_URL_SCHEME), $this->urlSchemes)) { + $this->type = self::TYPE_URI; + } elseif (is_string($image)) { + $this->type = self::TYPE_STRING; + } elseif ($image instanceof StorageObject) { + $this->type = self::TYPE_URI; + $this->image = $image->gcsUri(); + } elseif (is_resource($image)) { + $this->type = self::TYPE_BYTES; + $this->image = Utils::streamFor($image); + } else { + throw new InvalidArgumentException( + 'Given image is not valid. ' . + 'Image must be a string of bytes, a google storage object, a valid image URI, or a resource.' + ); + } + + $class = get_class($this); + $err = "The class {$class} is no longer supported"; + @trigger_error($err, E_USER_DEPRECATED); + } + + /** + * Return a formatted annotate image request. + * + * This method is used internally by {@see Google\Cloud\Vision\VisionClient} + * and is not generally intended for use outside of that context. + * + * Example: + * ``` + * use Google\Cloud\Vision\Image; + * + * $imageResource = fopen(__DIR__ . '/assets/family-photo.jpg', 'r'); + * $image = new Image($imageResource, [ + * 'FACE_DETECTION' + * ]); + * + * $requestObj = $image->requestObject(); + * ``` + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#annotateimagerequest AnnotateImageRequest + * + * @param bool $encode [optional] If set to true, image bytes will be base64-encoded + * (required for json/rest requests) + * @return array + */ + public function requestObject($encode = true) + { + return array_filter([ + 'image' => $this->imageObject($encode), + 'features' => $this->features, + 'imageContext' => $this->options['imageContext'] + ]); + } + + /** + * Create an image object. + * + * The structure of the returned array will vary depending on whether the + * given image is a storage object or not. + * + * @see https://cloud.google.com/vision/reference/rest/v1/images/annotate#image Image + * + * @param bool $encode If set to true, image bytes will be base64-encoded + * @return array [Image](https://cloud.google.com/vision/reference/rest/v1/images/annotate#image) + */ + private function imageObject($encode) + { + if ($this->type === self::TYPE_BYTES) { + $bytes = (string) $this->image; + + return [ + 'content' => ($encode) ? base64_encode($bytes) : $bytes + ]; + } + + if ($this->type === self::TYPE_STRING) { + $string = $this->image; + + return [ + 'content' => ($encode) ? base64_encode($string) : $string + ]; + } + + return [ + 'source' => [ + 'imageUri' => $this->image + ] + ]; + } + + /** + * Normalizes short feature names to identifiers compatible with the vision + * API and adds maxResults if specified. + * + * @param array $features + * @return array A list of type [Feature](https://cloud.google.com/vision/reference/rest/v1/images/annotate#feature) + */ + private function normalizeFeatures(array $features) + { + $result = []; + + foreach ($features as $key => $feature) { + $maxResults = $this->maxResult($feature); + + if (array_key_exists($feature, $this->featureShortNames)) { + $feature = $this->featureShortNames[$feature]; + } + + $result[] = array_filter([ + 'type' => $feature, + 'maxResults' => $maxResults + ]); + } + + return $result; + } + + /** + * Identify and return a maxResults value for a given feature, if maxResults + * is specified. + * + * @param string $feature + * @return mixed Int if set, null if not set. + */ + private function maxResult($feature) + { + return (isset($this->options['maxResults'][$feature])) + ? $this->options['maxResults'][$feature] + : null; + } +} diff --git a/vendor/google/cloud-vision/src/V1/AddProductToProductSetRequest.php b/vendor/google/cloud-vision/src/V1/AddProductToProductSetRequest.php new file mode 100644 index 00000000..d4333d17 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/AddProductToProductSetRequest.php @@ -0,0 +1,117 @@ +google.cloud.vision.v1.AddProductToProductSetRequest + */ +class AddProductToProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + /** + * Required. The resource name for the Product to be added to this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $product = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @type string $product + * Required. The resource name for the Product to be added to this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The resource name for the Product to be added to this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProduct() + { + return $this->product; + } + + /** + * Required. The resource name for the Product to be added to this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkString($var, True); + $this->product = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/AnnotateFileRequest.php b/vendor/google/cloud-vision/src/V1/AnnotateFileRequest.php new file mode 100644 index 00000000..2a939d8c --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/AnnotateFileRequest.php @@ -0,0 +1,225 @@ +google.cloud.vision.v1.AnnotateFileRequest + */ +class AnnotateFileRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Information about the input file. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + */ + private $input_config = null; + /** + * Required. Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + */ + private $features; + /** + * Additional context that may accompany the image(s) in the file. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + */ + private $image_context = null; + /** + * Pages of the file to perform image annotation. + * Pages starts from 1, we assume the first page of the file is page 1. + * At most 5 pages are supported per request. Pages can be negative. + * Page 1 means the first page. + * Page 2 means the second page. + * Page -1 means the last page. + * Page -2 means the second to the last page. + * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. + * If this field is empty, by default the service performs image annotation + * for the first 5 pages of the file. + * + * Generated from protobuf field repeated int32 pages = 4; + */ + private $pages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\InputConfig $input_config + * Required. Information about the input file. + * @type \Google\Cloud\Vision\V1\Feature[]|\Google\Protobuf\Internal\RepeatedField $features + * Required. Requested features. + * @type \Google\Cloud\Vision\V1\ImageContext $image_context + * Additional context that may accompany the image(s) in the file. + * @type int[]|\Google\Protobuf\Internal\RepeatedField $pages + * Pages of the file to perform image annotation. + * Pages starts from 1, we assume the first page of the file is page 1. + * At most 5 pages are supported per request. Pages can be negative. + * Page 1 means the first page. + * Page 2 means the second page. + * Page -1 means the last page. + * Page -2 means the second to the last page. + * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. + * If this field is empty, by default the service performs image annotation + * for the first 5 pages of the file. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Required. Information about the input file. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + * @return \Google\Cloud\Vision\V1\InputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * Required. Information about the input file. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + * @param \Google\Cloud\Vision\V1\InputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\InputConfig::class); + $this->input_config = $var; + + return $this; + } + + /** + * Required. Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFeatures() + { + return $this->features; + } + + /** + * Required. Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + * @param \Google\Cloud\Vision\V1\Feature[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFeatures($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Feature::class); + $this->features = $arr; + + return $this; + } + + /** + * Additional context that may accompany the image(s) in the file. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + * @return \Google\Cloud\Vision\V1\ImageContext|null + */ + public function getImageContext() + { + return $this->image_context; + } + + public function hasImageContext() + { + return isset($this->image_context); + } + + public function clearImageContext() + { + unset($this->image_context); + } + + /** + * Additional context that may accompany the image(s) in the file. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + * @param \Google\Cloud\Vision\V1\ImageContext $var + * @return $this + */ + public function setImageContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageContext::class); + $this->image_context = $var; + + return $this; + } + + /** + * Pages of the file to perform image annotation. + * Pages starts from 1, we assume the first page of the file is page 1. + * At most 5 pages are supported per request. Pages can be negative. + * Page 1 means the first page. + * Page 2 means the second page. + * Page -1 means the last page. + * Page -2 means the second to the last page. + * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. + * If this field is empty, by default the service performs image annotation + * for the first 5 pages of the file. + * + * Generated from protobuf field repeated int32 pages = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPages() + { + return $this->pages; + } + + /** + * Pages of the file to perform image annotation. + * Pages starts from 1, we assume the first page of the file is page 1. + * At most 5 pages are supported per request. Pages can be negative. + * Page 1 means the first page. + * Page 2 means the second page. + * Page -1 means the last page. + * Page -2 means the second to the last page. + * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. + * If this field is empty, by default the service performs image annotation + * for the first 5 pages of the file. + * + * Generated from protobuf field repeated int32 pages = 4; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->pages = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/AnnotateFileResponse.php b/vendor/google/cloud-vision/src/V1/AnnotateFileResponse.php new file mode 100644 index 00000000..da338fb1 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/AnnotateFileResponse.php @@ -0,0 +1,198 @@ +google.cloud.vision.v1.AnnotateFileResponse + */ +class AnnotateFileResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Information about the file for which this response is generated. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + */ + private $input_config = null; + /** + * Individual responses to images found within the file. This field will be + * empty if the `error` field is set. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageResponse responses = 2; + */ + private $responses; + /** + * This field gives the total number of pages in the file. + * + * Generated from protobuf field int32 total_pages = 3; + */ + private $total_pages = 0; + /** + * If set, represents the error message for the failed request. The + * `responses` field will not be set in this case. + * + * Generated from protobuf field .google.rpc.Status error = 4; + */ + private $error = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\InputConfig $input_config + * Information about the file for which this response is generated. + * @type \Google\Cloud\Vision\V1\AnnotateImageResponse[]|\Google\Protobuf\Internal\RepeatedField $responses + * Individual responses to images found within the file. This field will be + * empty if the `error` field is set. + * @type int $total_pages + * This field gives the total number of pages in the file. + * @type \Google\Rpc\Status $error + * If set, represents the error message for the failed request. The + * `responses` field will not be set in this case. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Information about the file for which this response is generated. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + * @return \Google\Cloud\Vision\V1\InputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * Information about the file for which this response is generated. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + * @param \Google\Cloud\Vision\V1\InputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\InputConfig::class); + $this->input_config = $var; + + return $this; + } + + /** + * Individual responses to images found within the file. This field will be + * empty if the `error` field is set. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageResponse responses = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResponses() + { + return $this->responses; + } + + /** + * Individual responses to images found within the file. This field will be + * empty if the `error` field is set. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageResponse responses = 2; + * @param \Google\Cloud\Vision\V1\AnnotateImageResponse[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResponses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AnnotateImageResponse::class); + $this->responses = $arr; + + return $this; + } + + /** + * This field gives the total number of pages in the file. + * + * Generated from protobuf field int32 total_pages = 3; + * @return int + */ + public function getTotalPages() + { + return $this->total_pages; + } + + /** + * This field gives the total number of pages in the file. + * + * Generated from protobuf field int32 total_pages = 3; + * @param int $var + * @return $this + */ + public function setTotalPages($var) + { + GPBUtil::checkInt32($var); + $this->total_pages = $var; + + return $this; + } + + /** + * If set, represents the error message for the failed request. The + * `responses` field will not be set in this case. + * + * Generated from protobuf field .google.rpc.Status error = 4; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * If set, represents the error message for the failed request. The + * `responses` field will not be set in this case. + * + * Generated from protobuf field .google.rpc.Status error = 4; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/AnnotateImageRequest.php b/vendor/google/cloud-vision/src/V1/AnnotateImageRequest.php new file mode 100644 index 00000000..e1ef29ef --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/AnnotateImageRequest.php @@ -0,0 +1,156 @@ +google.cloud.vision.v1.AnnotateImageRequest + */ +class AnnotateImageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The image to be processed. + * + * Generated from protobuf field .google.cloud.vision.v1.Image image = 1; + */ + private $image = null; + /** + * Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + */ + private $features; + /** + * Additional context that may accompany the image. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + */ + private $image_context = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Image $image + * The image to be processed. + * @type \Google\Cloud\Vision\V1\Feature[]|\Google\Protobuf\Internal\RepeatedField $features + * Requested features. + * @type \Google\Cloud\Vision\V1\ImageContext $image_context + * Additional context that may accompany the image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The image to be processed. + * + * Generated from protobuf field .google.cloud.vision.v1.Image image = 1; + * @return \Google\Cloud\Vision\V1\Image|null + */ + public function getImage() + { + return $this->image; + } + + public function hasImage() + { + return isset($this->image); + } + + public function clearImage() + { + unset($this->image); + } + + /** + * The image to be processed. + * + * Generated from protobuf field .google.cloud.vision.v1.Image image = 1; + * @param \Google\Cloud\Vision\V1\Image $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Image::class); + $this->image = $var; + + return $this; + } + + /** + * Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFeatures() + { + return $this->features; + } + + /** + * Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + * @param \Google\Cloud\Vision\V1\Feature[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFeatures($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Feature::class); + $this->features = $arr; + + return $this; + } + + /** + * Additional context that may accompany the image. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + * @return \Google\Cloud\Vision\V1\ImageContext|null + */ + public function getImageContext() + { + return $this->image_context; + } + + public function hasImageContext() + { + return isset($this->image_context); + } + + public function clearImageContext() + { + unset($this->image_context); + } + + /** + * Additional context that may accompany the image. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + * @param \Google\Cloud\Vision\V1\ImageContext $var + * @return $this + */ + public function setImageContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageContext::class); + $this->image_context = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/AnnotateImageResponse.php b/vendor/google/cloud-vision/src/V1/AnnotateImageResponse.php new file mode 100644 index 00000000..8b57d6b9 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/AnnotateImageResponse.php @@ -0,0 +1,617 @@ +google.cloud.vision.v1.AnnotateImageResponse + */ +class AnnotateImageResponse extends \Google\Protobuf\Internal\Message +{ + /** + * If present, face detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.FaceAnnotation face_annotations = 1; + */ + private $face_annotations; + /** + * If present, landmark detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation landmark_annotations = 2; + */ + private $landmark_annotations; + /** + * If present, logo detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation logo_annotations = 3; + */ + private $logo_annotations; + /** + * If present, label detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation label_annotations = 4; + */ + private $label_annotations; + /** + * If present, localized object detection has completed successfully. + * This will be sorted descending by confidence score. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.LocalizedObjectAnnotation localized_object_annotations = 22; + */ + private $localized_object_annotations; + /** + * If present, text (OCR) detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation text_annotations = 5; + */ + private $text_annotations; + /** + * If present, text (OCR) detection or document (OCR) text detection has + * completed successfully. + * This annotation provides the structural hierarchy for the OCR detected + * text. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation full_text_annotation = 12; + */ + private $full_text_annotation = null; + /** + * If present, safe-search annotation has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.SafeSearchAnnotation safe_search_annotation = 6; + */ + private $safe_search_annotation = null; + /** + * If present, image properties were extracted successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageProperties image_properties_annotation = 8; + */ + private $image_properties_annotation = null; + /** + * If present, crop hints have completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.CropHintsAnnotation crop_hints_annotation = 11; + */ + private $crop_hints_annotation = null; + /** + * If present, web detection has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.WebDetection web_detection = 13; + */ + private $web_detection = null; + /** + * If present, product search has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchResults product_search_results = 14; + */ + private $product_search_results = null; + /** + * If set, represents the error message for the operation. + * Note that filled-in image annotations are guaranteed to be + * correct, even when `error` is set. + * + * Generated from protobuf field .google.rpc.Status error = 9; + */ + private $error = null; + /** + * If present, contextual information is needed to understand where this image + * comes from. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageAnnotationContext context = 21; + */ + private $context = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\FaceAnnotation[]|\Google\Protobuf\Internal\RepeatedField $face_annotations + * If present, face detection has completed successfully. + * @type \Google\Cloud\Vision\V1\EntityAnnotation[]|\Google\Protobuf\Internal\RepeatedField $landmark_annotations + * If present, landmark detection has completed successfully. + * @type \Google\Cloud\Vision\V1\EntityAnnotation[]|\Google\Protobuf\Internal\RepeatedField $logo_annotations + * If present, logo detection has completed successfully. + * @type \Google\Cloud\Vision\V1\EntityAnnotation[]|\Google\Protobuf\Internal\RepeatedField $label_annotations + * If present, label detection has completed successfully. + * @type \Google\Cloud\Vision\V1\LocalizedObjectAnnotation[]|\Google\Protobuf\Internal\RepeatedField $localized_object_annotations + * If present, localized object detection has completed successfully. + * This will be sorted descending by confidence score. + * @type \Google\Cloud\Vision\V1\EntityAnnotation[]|\Google\Protobuf\Internal\RepeatedField $text_annotations + * If present, text (OCR) detection has completed successfully. + * @type \Google\Cloud\Vision\V1\TextAnnotation $full_text_annotation + * If present, text (OCR) detection or document (OCR) text detection has + * completed successfully. + * This annotation provides the structural hierarchy for the OCR detected + * text. + * @type \Google\Cloud\Vision\V1\SafeSearchAnnotation $safe_search_annotation + * If present, safe-search annotation has completed successfully. + * @type \Google\Cloud\Vision\V1\ImageProperties $image_properties_annotation + * If present, image properties were extracted successfully. + * @type \Google\Cloud\Vision\V1\CropHintsAnnotation $crop_hints_annotation + * If present, crop hints have completed successfully. + * @type \Google\Cloud\Vision\V1\WebDetection $web_detection + * If present, web detection has completed successfully. + * @type \Google\Cloud\Vision\V1\ProductSearchResults $product_search_results + * If present, product search has completed successfully. + * @type \Google\Rpc\Status $error + * If set, represents the error message for the operation. + * Note that filled-in image annotations are guaranteed to be + * correct, even when `error` is set. + * @type \Google\Cloud\Vision\V1\ImageAnnotationContext $context + * If present, contextual information is needed to understand where this image + * comes from. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * If present, face detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.FaceAnnotation face_annotations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFaceAnnotations() + { + return $this->face_annotations; + } + + /** + * If present, face detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.FaceAnnotation face_annotations = 1; + * @param \Google\Cloud\Vision\V1\FaceAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFaceAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\FaceAnnotation::class); + $this->face_annotations = $arr; + + return $this; + } + + /** + * If present, landmark detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation landmark_annotations = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLandmarkAnnotations() + { + return $this->landmark_annotations; + } + + /** + * If present, landmark detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation landmark_annotations = 2; + * @param \Google\Cloud\Vision\V1\EntityAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLandmarkAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class); + $this->landmark_annotations = $arr; + + return $this; + } + + /** + * If present, logo detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation logo_annotations = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLogoAnnotations() + { + return $this->logo_annotations; + } + + /** + * If present, logo detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation logo_annotations = 3; + * @param \Google\Cloud\Vision\V1\EntityAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLogoAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class); + $this->logo_annotations = $arr; + + return $this; + } + + /** + * If present, label detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation label_annotations = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLabelAnnotations() + { + return $this->label_annotations; + } + + /** + * If present, label detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation label_annotations = 4; + * @param \Google\Cloud\Vision\V1\EntityAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLabelAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class); + $this->label_annotations = $arr; + + return $this; + } + + /** + * If present, localized object detection has completed successfully. + * This will be sorted descending by confidence score. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.LocalizedObjectAnnotation localized_object_annotations = 22; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLocalizedObjectAnnotations() + { + return $this->localized_object_annotations; + } + + /** + * If present, localized object detection has completed successfully. + * This will be sorted descending by confidence score. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.LocalizedObjectAnnotation localized_object_annotations = 22; + * @param \Google\Cloud\Vision\V1\LocalizedObjectAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLocalizedObjectAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\LocalizedObjectAnnotation::class); + $this->localized_object_annotations = $arr; + + return $this; + } + + /** + * If present, text (OCR) detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation text_annotations = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTextAnnotations() + { + return $this->text_annotations; + } + + /** + * If present, text (OCR) detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation text_annotations = 5; + * @param \Google\Cloud\Vision\V1\EntityAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTextAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class); + $this->text_annotations = $arr; + + return $this; + } + + /** + * If present, text (OCR) detection or document (OCR) text detection has + * completed successfully. + * This annotation provides the structural hierarchy for the OCR detected + * text. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation full_text_annotation = 12; + * @return \Google\Cloud\Vision\V1\TextAnnotation|null + */ + public function getFullTextAnnotation() + { + return $this->full_text_annotation; + } + + public function hasFullTextAnnotation() + { + return isset($this->full_text_annotation); + } + + public function clearFullTextAnnotation() + { + unset($this->full_text_annotation); + } + + /** + * If present, text (OCR) detection or document (OCR) text detection has + * completed successfully. + * This annotation provides the structural hierarchy for the OCR detected + * text. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation full_text_annotation = 12; + * @param \Google\Cloud\Vision\V1\TextAnnotation $var + * @return $this + */ + public function setFullTextAnnotation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation::class); + $this->full_text_annotation = $var; + + return $this; + } + + /** + * If present, safe-search annotation has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.SafeSearchAnnotation safe_search_annotation = 6; + * @return \Google\Cloud\Vision\V1\SafeSearchAnnotation|null + */ + public function getSafeSearchAnnotation() + { + return $this->safe_search_annotation; + } + + public function hasSafeSearchAnnotation() + { + return isset($this->safe_search_annotation); + } + + public function clearSafeSearchAnnotation() + { + unset($this->safe_search_annotation); + } + + /** + * If present, safe-search annotation has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.SafeSearchAnnotation safe_search_annotation = 6; + * @param \Google\Cloud\Vision\V1\SafeSearchAnnotation $var + * @return $this + */ + public function setSafeSearchAnnotation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\SafeSearchAnnotation::class); + $this->safe_search_annotation = $var; + + return $this; + } + + /** + * If present, image properties were extracted successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageProperties image_properties_annotation = 8; + * @return \Google\Cloud\Vision\V1\ImageProperties|null + */ + public function getImagePropertiesAnnotation() + { + return $this->image_properties_annotation; + } + + public function hasImagePropertiesAnnotation() + { + return isset($this->image_properties_annotation); + } + + public function clearImagePropertiesAnnotation() + { + unset($this->image_properties_annotation); + } + + /** + * If present, image properties were extracted successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageProperties image_properties_annotation = 8; + * @param \Google\Cloud\Vision\V1\ImageProperties $var + * @return $this + */ + public function setImagePropertiesAnnotation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageProperties::class); + $this->image_properties_annotation = $var; + + return $this; + } + + /** + * If present, crop hints have completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.CropHintsAnnotation crop_hints_annotation = 11; + * @return \Google\Cloud\Vision\V1\CropHintsAnnotation|null + */ + public function getCropHintsAnnotation() + { + return $this->crop_hints_annotation; + } + + public function hasCropHintsAnnotation() + { + return isset($this->crop_hints_annotation); + } + + public function clearCropHintsAnnotation() + { + unset($this->crop_hints_annotation); + } + + /** + * If present, crop hints have completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.CropHintsAnnotation crop_hints_annotation = 11; + * @param \Google\Cloud\Vision\V1\CropHintsAnnotation $var + * @return $this + */ + public function setCropHintsAnnotation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\CropHintsAnnotation::class); + $this->crop_hints_annotation = $var; + + return $this; + } + + /** + * If present, web detection has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.WebDetection web_detection = 13; + * @return \Google\Cloud\Vision\V1\WebDetection|null + */ + public function getWebDetection() + { + return $this->web_detection; + } + + public function hasWebDetection() + { + return isset($this->web_detection); + } + + public function clearWebDetection() + { + unset($this->web_detection); + } + + /** + * If present, web detection has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.WebDetection web_detection = 13; + * @param \Google\Cloud\Vision\V1\WebDetection $var + * @return $this + */ + public function setWebDetection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\WebDetection::class); + $this->web_detection = $var; + + return $this; + } + + /** + * If present, product search has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchResults product_search_results = 14; + * @return \Google\Cloud\Vision\V1\ProductSearchResults|null + */ + public function getProductSearchResults() + { + return $this->product_search_results; + } + + public function hasProductSearchResults() + { + return isset($this->product_search_results); + } + + public function clearProductSearchResults() + { + unset($this->product_search_results); + } + + /** + * If present, product search has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchResults product_search_results = 14; + * @param \Google\Cloud\Vision\V1\ProductSearchResults $var + * @return $this + */ + public function setProductSearchResults($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSearchResults::class); + $this->product_search_results = $var; + + return $this; + } + + /** + * If set, represents the error message for the operation. + * Note that filled-in image annotations are guaranteed to be + * correct, even when `error` is set. + * + * Generated from protobuf field .google.rpc.Status error = 9; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * If set, represents the error message for the operation. + * Note that filled-in image annotations are guaranteed to be + * correct, even when `error` is set. + * + * Generated from protobuf field .google.rpc.Status error = 9; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * If present, contextual information is needed to understand where this image + * comes from. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageAnnotationContext context = 21; + * @return \Google\Cloud\Vision\V1\ImageAnnotationContext|null + */ + public function getContext() + { + return $this->context; + } + + public function hasContext() + { + return isset($this->context); + } + + public function clearContext() + { + unset($this->context); + } + + /** + * If present, contextual information is needed to understand where this image + * comes from. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageAnnotationContext context = 21; + * @param \Google\Cloud\Vision\V1\ImageAnnotationContext $var + * @return $this + */ + public function setContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageAnnotationContext::class); + $this->context = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/AsyncAnnotateFileRequest.php b/vendor/google/cloud-vision/src/V1/AsyncAnnotateFileRequest.php new file mode 100644 index 00000000..ab9d0b31 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/AsyncAnnotateFileRequest.php @@ -0,0 +1,199 @@ +google.cloud.vision.v1.AsyncAnnotateFileRequest + */ +class AsyncAnnotateFileRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Information about the input file. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + */ + private $input_config = null; + /** + * Required. Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + */ + private $features; + /** + * Additional context that may accompany the image(s) in the file. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + */ + private $image_context = null; + /** + * Required. The desired output location and metadata (e.g. format). + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 4; + */ + private $output_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\InputConfig $input_config + * Required. Information about the input file. + * @type \Google\Cloud\Vision\V1\Feature[]|\Google\Protobuf\Internal\RepeatedField $features + * Required. Requested features. + * @type \Google\Cloud\Vision\V1\ImageContext $image_context + * Additional context that may accompany the image(s) in the file. + * @type \Google\Cloud\Vision\V1\OutputConfig $output_config + * Required. The desired output location and metadata (e.g. format). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Required. Information about the input file. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + * @return \Google\Cloud\Vision\V1\InputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * Required. Information about the input file. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + * @param \Google\Cloud\Vision\V1\InputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\InputConfig::class); + $this->input_config = $var; + + return $this; + } + + /** + * Required. Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFeatures() + { + return $this->features; + } + + /** + * Required. Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + * @param \Google\Cloud\Vision\V1\Feature[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFeatures($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Feature::class); + $this->features = $arr; + + return $this; + } + + /** + * Additional context that may accompany the image(s) in the file. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + * @return \Google\Cloud\Vision\V1\ImageContext|null + */ + public function getImageContext() + { + return $this->image_context; + } + + public function hasImageContext() + { + return isset($this->image_context); + } + + public function clearImageContext() + { + unset($this->image_context); + } + + /** + * Additional context that may accompany the image(s) in the file. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + * @param \Google\Cloud\Vision\V1\ImageContext $var + * @return $this + */ + public function setImageContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageContext::class); + $this->image_context = $var; + + return $this; + } + + /** + * Required. The desired output location and metadata (e.g. format). + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 4; + * @return \Google\Cloud\Vision\V1\OutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * Required. The desired output location and metadata (e.g. format). + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 4; + * @param \Google\Cloud\Vision\V1\OutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\OutputConfig::class); + $this->output_config = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/AsyncAnnotateFileResponse.php b/vendor/google/cloud-vision/src/V1/AsyncAnnotateFileResponse.php new file mode 100644 index 00000000..3bb1a759 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/AsyncAnnotateFileResponse.php @@ -0,0 +1,77 @@ +google.cloud.vision.v1.AsyncAnnotateFileResponse + */ +class AsyncAnnotateFileResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The output location and metadata from AsyncAnnotateFileRequest. + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 1; + */ + private $output_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\OutputConfig $output_config + * The output location and metadata from AsyncAnnotateFileRequest. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The output location and metadata from AsyncAnnotateFileRequest. + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 1; + * @return \Google\Cloud\Vision\V1\OutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * The output location and metadata from AsyncAnnotateFileRequest. + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 1; + * @param \Google\Cloud\Vision\V1\OutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\OutputConfig::class); + $this->output_config = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/AsyncBatchAnnotateFilesRequest.php b/vendor/google/cloud-vision/src/V1/AsyncBatchAnnotateFilesRequest.php new file mode 100644 index 00000000..96a3c6e5 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/AsyncBatchAnnotateFilesRequest.php @@ -0,0 +1,130 @@ +google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + */ +class AsyncBatchAnnotateFilesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Individual async file annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AsyncAnnotateFileRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $requests; + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + */ + private $parent = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\AsyncAnnotateFileRequest[]|\Google\Protobuf\Internal\RepeatedField $requests + * Required. Individual async file annotation requests for this batch. + * @type string $parent + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Required. Individual async file annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AsyncAnnotateFileRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequests() + { + return $this->requests; + } + + /** + * Required. Individual async file annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AsyncAnnotateFileRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\AsyncAnnotateFileRequest[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AsyncAnnotateFileRequest::class); + $this->requests = $arr; + + return $this; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/AsyncBatchAnnotateFilesResponse.php b/vendor/google/cloud-vision/src/V1/AsyncBatchAnnotateFilesResponse.php new file mode 100644 index 00000000..a784c6cb --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/AsyncBatchAnnotateFilesResponse.php @@ -0,0 +1,71 @@ +google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse + */ +class AsyncBatchAnnotateFilesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of file annotation responses, one for each request in + * AsyncBatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AsyncAnnotateFileResponse responses = 1; + */ + private $responses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\AsyncAnnotateFileResponse[]|\Google\Protobuf\Internal\RepeatedField $responses + * The list of file annotation responses, one for each request in + * AsyncBatchAnnotateFilesRequest. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The list of file annotation responses, one for each request in + * AsyncBatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AsyncAnnotateFileResponse responses = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResponses() + { + return $this->responses; + } + + /** + * The list of file annotation responses, one for each request in + * AsyncBatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AsyncAnnotateFileResponse responses = 1; + * @param \Google\Cloud\Vision\V1\AsyncAnnotateFileResponse[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResponses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AsyncAnnotateFileResponse::class); + $this->responses = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/AsyncBatchAnnotateImagesRequest.php b/vendor/google/cloud-vision/src/V1/AsyncBatchAnnotateImagesRequest.php new file mode 100644 index 00000000..eff5befc --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/AsyncBatchAnnotateImagesRequest.php @@ -0,0 +1,173 @@ +google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + */ +class AsyncBatchAnnotateImagesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Individual image annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $requests; + /** + * Required. The desired output location and metadata (e.g. format). + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $output_config = null; + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + */ + private $parent = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\AnnotateImageRequest[]|\Google\Protobuf\Internal\RepeatedField $requests + * Required. Individual image annotation requests for this batch. + * @type \Google\Cloud\Vision\V1\OutputConfig $output_config + * Required. The desired output location and metadata (e.g. format). + * @type string $parent + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Required. Individual image annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequests() + { + return $this->requests; + } + + /** + * Required. Individual image annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\AnnotateImageRequest[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AnnotateImageRequest::class); + $this->requests = $arr; + + return $this; + } + + /** + * Required. The desired output location and metadata (e.g. format). + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\OutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * Required. The desired output location and metadata (e.g. format). + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\OutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\OutputConfig::class); + $this->output_config = $var; + + return $this; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/AsyncBatchAnnotateImagesResponse.php b/vendor/google/cloud-vision/src/V1/AsyncBatchAnnotateImagesResponse.php new file mode 100644 index 00000000..81b52ea7 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/AsyncBatchAnnotateImagesResponse.php @@ -0,0 +1,77 @@ +google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse + */ +class AsyncBatchAnnotateImagesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The output location and metadata from AsyncBatchAnnotateImagesRequest. + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 1; + */ + private $output_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\OutputConfig $output_config + * The output location and metadata from AsyncBatchAnnotateImagesRequest. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The output location and metadata from AsyncBatchAnnotateImagesRequest. + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 1; + * @return \Google\Cloud\Vision\V1\OutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * The output location and metadata from AsyncBatchAnnotateImagesRequest. + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 1; + * @param \Google\Cloud\Vision\V1\OutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\OutputConfig::class); + $this->output_config = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/BatchAnnotateFilesRequest.php b/vendor/google/cloud-vision/src/V1/BatchAnnotateFilesRequest.php new file mode 100644 index 00000000..d495abdd --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/BatchAnnotateFilesRequest.php @@ -0,0 +1,133 @@ +google.cloud.vision.v1.BatchAnnotateFilesRequest + */ +class BatchAnnotateFilesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The list of file annotation requests. Right now we support only + * one AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateFileRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $requests; + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 3; + */ + private $parent = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\AnnotateFileRequest[]|\Google\Protobuf\Internal\RepeatedField $requests + * Required. The list of file annotation requests. Right now we support only + * one AnnotateFileRequest in BatchAnnotateFilesRequest. + * @type string $parent + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Required. The list of file annotation requests. Right now we support only + * one AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateFileRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequests() + { + return $this->requests; + } + + /** + * Required. The list of file annotation requests. Right now we support only + * one AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateFileRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\AnnotateFileRequest[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AnnotateFileRequest::class); + $this->requests = $arr; + + return $this; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 3; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 3; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/BatchAnnotateFilesResponse.php b/vendor/google/cloud-vision/src/V1/BatchAnnotateFilesResponse.php new file mode 100644 index 00000000..7908433c --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/BatchAnnotateFilesResponse.php @@ -0,0 +1,71 @@ +google.cloud.vision.v1.BatchAnnotateFilesResponse + */ +class BatchAnnotateFilesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of file annotation responses, each response corresponding to each + * AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateFileResponse responses = 1; + */ + private $responses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\AnnotateFileResponse[]|\Google\Protobuf\Internal\RepeatedField $responses + * The list of file annotation responses, each response corresponding to each + * AnnotateFileRequest in BatchAnnotateFilesRequest. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The list of file annotation responses, each response corresponding to each + * AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateFileResponse responses = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResponses() + { + return $this->responses; + } + + /** + * The list of file annotation responses, each response corresponding to each + * AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateFileResponse responses = 1; + * @param \Google\Cloud\Vision\V1\AnnotateFileResponse[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResponses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AnnotateFileResponse::class); + $this->responses = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/BatchAnnotateImagesRequest.php b/vendor/google/cloud-vision/src/V1/BatchAnnotateImagesRequest.php new file mode 100644 index 00000000..daa37ecb --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/BatchAnnotateImagesRequest.php @@ -0,0 +1,129 @@ +google.cloud.vision.v1.BatchAnnotateImagesRequest + */ +class BatchAnnotateImagesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Individual image annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $requests; + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + */ + private $parent = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\AnnotateImageRequest[]|\Google\Protobuf\Internal\RepeatedField $requests + * Required. Individual image annotation requests for this batch. + * @type string $parent + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Required. Individual image annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequests() + { + return $this->requests; + } + + /** + * Required. Individual image annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\AnnotateImageRequest[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AnnotateImageRequest::class); + $this->requests = $arr; + + return $this; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/BatchAnnotateImagesResponse.php b/vendor/google/cloud-vision/src/V1/BatchAnnotateImagesResponse.php new file mode 100644 index 00000000..c279c471 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/BatchAnnotateImagesResponse.php @@ -0,0 +1,67 @@ +google.cloud.vision.v1.BatchAnnotateImagesResponse + */ +class BatchAnnotateImagesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Individual responses to image annotation requests within the batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageResponse responses = 1; + */ + private $responses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\AnnotateImageResponse[]|\Google\Protobuf\Internal\RepeatedField $responses + * Individual responses to image annotation requests within the batch. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Individual responses to image annotation requests within the batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageResponse responses = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResponses() + { + return $this->responses; + } + + /** + * Individual responses to image annotation requests within the batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageResponse responses = 1; + * @param \Google\Cloud\Vision\V1\AnnotateImageResponse[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResponses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AnnotateImageResponse::class); + $this->responses = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/BatchOperationMetadata.php b/vendor/google/cloud-vision/src/V1/BatchOperationMetadata.php new file mode 100644 index 00000000..3c19be55 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/BatchOperationMetadata.php @@ -0,0 +1,161 @@ +google.cloud.vision.v1.BatchOperationMetadata + */ +class BatchOperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.BatchOperationMetadata.State state = 1; + */ + private $state = 0; + /** + * The time when the batch request was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + */ + private $submit_time = null; + /** + * The time when the batch request is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + */ + private $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The current state of the batch operation. + * @type \Google\Protobuf\Timestamp $submit_time + * The time when the batch request was submitted to the server. + * @type \Google\Protobuf\Timestamp $end_time + * The time when the batch request is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.BatchOperationMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.BatchOperationMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\BatchOperationMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * The time when the batch request was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * The time when the batch request was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + + /** + * The time when the batch request is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time when the batch request is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/BatchOperationMetadata/State.php b/vendor/google/cloud-vision/src/V1/BatchOperationMetadata/State.php new file mode 100644 index 00000000..cba5eccd --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/BatchOperationMetadata/State.php @@ -0,0 +1,81 @@ +google.cloud.vision.v1.BatchOperationMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is actively being processed. + * + * Generated from protobuf enum PROCESSING = 1; + */ + const PROCESSING = 1; + /** + * The request is done and at least one item has been successfully + * processed. + * + * Generated from protobuf enum SUCCESSFUL = 2; + */ + const SUCCESSFUL = 2; + /** + * The request is done and no item has been successfully processed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The request is done after the longrunning.Operations.CancelOperation has + * been called by the user. Any records that were processed before the + * cancel command are output as specified in the request. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PROCESSING => 'PROCESSING', + self::SUCCESSFUL => 'SUCCESSFUL', + self::FAILED => 'FAILED', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Vision\V1\BatchOperationMetadata_State::class); + diff --git a/vendor/google/cloud-vision/src/V1/BatchOperationMetadata_State.php b/vendor/google/cloud-vision/src/V1/BatchOperationMetadata_State.php new file mode 100644 index 00000000..39f46499 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/BatchOperationMetadata_State.php @@ -0,0 +1,16 @@ +google.cloud.vision.v1.Block + */ +class Block extends \Google\Protobuf\Internal\Message +{ + /** + * Additional information detected for the block. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + */ + private $property = null; + /** + * The bounding box for the block. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + */ + private $bounding_box = null; + /** + * List of paragraphs in this block (if this blocks is of type text). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Paragraph paragraphs = 3; + */ + private $paragraphs; + /** + * Detected block type (text, image etc) for this block. + * + * Generated from protobuf field .google.cloud.vision.v1.Block.BlockType block_type = 4; + */ + private $block_type = 0; + /** + * Confidence of the OCR results on the block. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5; + */ + private $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $property + * Additional information detected for the block. + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_box + * The bounding box for the block. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * @type \Google\Cloud\Vision\V1\Paragraph[]|\Google\Protobuf\Internal\RepeatedField $paragraphs + * List of paragraphs in this block (if this blocks is of type text). + * @type int $block_type + * Detected block type (text, image etc) for this block. + * @type float $confidence + * Confidence of the OCR results on the block. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * Additional information detected for the block. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @return \Google\Cloud\Vision\V1\TextAnnotation\TextProperty|null + */ + public function getProperty() + { + return $this->property; + } + + public function hasProperty() + { + return isset($this->property); + } + + public function clearProperty() + { + unset($this->property); + } + + /** + * Additional information detected for the block. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @param \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $var + * @return $this + */ + public function setProperty($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation\TextProperty::class); + $this->property = $var; + + return $this; + } + + /** + * The bounding box for the block. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingBox() + { + return $this->bounding_box; + } + + public function hasBoundingBox() + { + return isset($this->bounding_box); + } + + public function clearBoundingBox() + { + unset($this->bounding_box); + } + + /** + * The bounding box for the block. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingBox($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_box = $var; + + return $this; + } + + /** + * List of paragraphs in this block (if this blocks is of type text). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Paragraph paragraphs = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParagraphs() + { + return $this->paragraphs; + } + + /** + * List of paragraphs in this block (if this blocks is of type text). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Paragraph paragraphs = 3; + * @param \Google\Cloud\Vision\V1\Paragraph[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParagraphs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Paragraph::class); + $this->paragraphs = $arr; + + return $this; + } + + /** + * Detected block type (text, image etc) for this block. + * + * Generated from protobuf field .google.cloud.vision.v1.Block.BlockType block_type = 4; + * @return int + */ + public function getBlockType() + { + return $this->block_type; + } + + /** + * Detected block type (text, image etc) for this block. + * + * Generated from protobuf field .google.cloud.vision.v1.Block.BlockType block_type = 4; + * @param int $var + * @return $this + */ + public function setBlockType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Block\BlockType::class); + $this->block_type = $var; + + return $this; + } + + /** + * Confidence of the OCR results on the block. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of the OCR results on the block. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/Block/BlockType.php b/vendor/google/cloud-vision/src/V1/Block/BlockType.php new file mode 100644 index 00000000..eefde919 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Block/BlockType.php @@ -0,0 +1,85 @@ +google.cloud.vision.v1.Block.BlockType + */ +class BlockType +{ + /** + * Unknown block type. + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * Regular text block. + * + * Generated from protobuf enum TEXT = 1; + */ + const TEXT = 1; + /** + * Table block. + * + * Generated from protobuf enum TABLE = 2; + */ + const TABLE = 2; + /** + * Image block. + * + * Generated from protobuf enum PICTURE = 3; + */ + const PICTURE = 3; + /** + * Horizontal/vertical line box. + * + * Generated from protobuf enum RULER = 4; + */ + const RULER = 4; + /** + * Barcode block. + * + * Generated from protobuf enum BARCODE = 5; + */ + const BARCODE = 5; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::TEXT => 'TEXT', + self::TABLE => 'TABLE', + self::PICTURE => 'PICTURE', + self::RULER => 'RULER', + self::BARCODE => 'BARCODE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BlockType::class, \Google\Cloud\Vision\V1\Block_BlockType::class); + diff --git a/vendor/google/cloud-vision/src/V1/Block_BlockType.php b/vendor/google/cloud-vision/src/V1/Block_BlockType.php new file mode 100644 index 00000000..321ec9c0 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Block_BlockType.php @@ -0,0 +1,16 @@ +google.cloud.vision.v1.BoundingPoly + */ +class BoundingPoly extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon vertices. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Vertex vertices = 1; + */ + private $vertices; + /** + * The bounding polygon normalized vertices. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.NormalizedVertex normalized_vertices = 2; + */ + private $normalized_vertices; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Vertex[]|\Google\Protobuf\Internal\RepeatedField $vertices + * The bounding polygon vertices. + * @type \Google\Cloud\Vision\V1\NormalizedVertex[]|\Google\Protobuf\Internal\RepeatedField $normalized_vertices + * The bounding polygon normalized vertices. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\Geometry::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon vertices. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Vertex vertices = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVertices() + { + return $this->vertices; + } + + /** + * The bounding polygon vertices. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Vertex vertices = 1; + * @param \Google\Cloud\Vision\V1\Vertex[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVertices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Vertex::class); + $this->vertices = $arr; + + return $this; + } + + /** + * The bounding polygon normalized vertices. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.NormalizedVertex normalized_vertices = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNormalizedVertices() + { + return $this->normalized_vertices; + } + + /** + * The bounding polygon normalized vertices. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.NormalizedVertex normalized_vertices = 2; + * @param \Google\Cloud\Vision\V1\NormalizedVertex[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNormalizedVertices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\NormalizedVertex::class); + $this->normalized_vertices = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ColorInfo.php b/vendor/google/cloud-vision/src/V1/ColorInfo.php new file mode 100644 index 00000000..3f8db4b9 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ColorInfo.php @@ -0,0 +1,150 @@ +google.cloud.vision.v1.ColorInfo + */ +class ColorInfo extends \Google\Protobuf\Internal\Message +{ + /** + * RGB components of the color. + * + * Generated from protobuf field .google.type.Color color = 1; + */ + private $color = null; + /** + * Image-specific score for this color. Value in range [0, 1]. + * + * Generated from protobuf field float score = 2; + */ + private $score = 0.0; + /** + * The fraction of pixels the color occupies in the image. + * Value in range [0, 1]. + * + * Generated from protobuf field float pixel_fraction = 3; + */ + private $pixel_fraction = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Type\Color $color + * RGB components of the color. + * @type float $score + * Image-specific score for this color. Value in range [0, 1]. + * @type float $pixel_fraction + * The fraction of pixels the color occupies in the image. + * Value in range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * RGB components of the color. + * + * Generated from protobuf field .google.type.Color color = 1; + * @return \Google\Type\Color|null + */ + public function getColor() + { + return $this->color; + } + + public function hasColor() + { + return isset($this->color); + } + + public function clearColor() + { + unset($this->color); + } + + /** + * RGB components of the color. + * + * Generated from protobuf field .google.type.Color color = 1; + * @param \Google\Type\Color $var + * @return $this + */ + public function setColor($var) + { + GPBUtil::checkMessage($var, \Google\Type\Color::class); + $this->color = $var; + + return $this; + } + + /** + * Image-specific score for this color. Value in range [0, 1]. + * + * Generated from protobuf field float score = 2; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Image-specific score for this color. Value in range [0, 1]. + * + * Generated from protobuf field float score = 2; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * The fraction of pixels the color occupies in the image. + * Value in range [0, 1]. + * + * Generated from protobuf field float pixel_fraction = 3; + * @return float + */ + public function getPixelFraction() + { + return $this->pixel_fraction; + } + + /** + * The fraction of pixels the color occupies in the image. + * Value in range [0, 1]. + * + * Generated from protobuf field float pixel_fraction = 3; + * @param float $var + * @return $this + */ + public function setPixelFraction($var) + { + GPBUtil::checkFloat($var); + $this->pixel_fraction = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/CreateProductRequest.php b/vendor/google/cloud-vision/src/V1/CreateProductRequest.php new file mode 100644 index 00000000..a6105a57 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/CreateProductRequest.php @@ -0,0 +1,165 @@ +google.cloud.vision.v1.CreateProductRequest + */ +class CreateProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project in which the Product should be created. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * Required. The product to create. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $product = null; + /** + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * Generated from protobuf field string product_id = 3; + */ + private $product_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project in which the Product should be created. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * @type \Google\Cloud\Vision\V1\Product $product + * Required. The product to create. + * @type string $product_id + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project in which the Product should be created. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project in which the Product should be created. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The product to create. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\Product|null + */ + public function getProduct() + { + return $this->product; + } + + public function hasProduct() + { + return isset($this->product); + } + + public function clearProduct() + { + unset($this->product); + } + + /** + * Required. The product to create. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\Product $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Product::class); + $this->product = $var; + + return $this; + } + + /** + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * Generated from protobuf field string product_id = 3; + * @return string + */ + public function getProductId() + { + return $this->product_id; + } + + /** + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * Generated from protobuf field string product_id = 3; + * @param string $var + * @return $this + */ + public function setProductId($var) + { + GPBUtil::checkString($var, True); + $this->product_id = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/CreateProductSetRequest.php b/vendor/google/cloud-vision/src/V1/CreateProductSetRequest.php new file mode 100644 index 00000000..b7878ac8 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/CreateProductSetRequest.php @@ -0,0 +1,161 @@ +google.cloud.vision.v1.CreateProductSetRequest + */ +class CreateProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project in which the ProductSet should be created. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * Required. The ProductSet to create. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $product_set = null; + /** + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * Generated from protobuf field string product_set_id = 3; + */ + private $product_set_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project in which the ProductSet should be created. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @type \Google\Cloud\Vision\V1\ProductSet $product_set + * Required. The ProductSet to create. + * @type string $product_set_id + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project in which the ProductSet should be created. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project in which the ProductSet should be created. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The ProductSet to create. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\ProductSet|null + */ + public function getProductSet() + { + return $this->product_set; + } + + public function hasProductSet() + { + return isset($this->product_set); + } + + public function clearProductSet() + { + unset($this->product_set); + } + + /** + * Required. The ProductSet to create. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\ProductSet $var + * @return $this + */ + public function setProductSet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSet::class); + $this->product_set = $var; + + return $this; + } + + /** + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * Generated from protobuf field string product_set_id = 3; + * @return string + */ + public function getProductSetId() + { + return $this->product_set_id; + } + + /** + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * Generated from protobuf field string product_set_id = 3; + * @param string $var + * @return $this + */ + public function setProductSetId($var) + { + GPBUtil::checkString($var, True); + $this->product_set_id = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/CreateReferenceImageRequest.php b/vendor/google/cloud-vision/src/V1/CreateReferenceImageRequest.php new file mode 100644 index 00000000..35e737c8 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/CreateReferenceImageRequest.php @@ -0,0 +1,169 @@ +google.cloud.vision.v1.CreateReferenceImageRequest + */ +class CreateReferenceImageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the product in which to create the reference image. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * Required. The reference image to create. + * If an image ID is specified, it is ignored. + * + * Generated from protobuf field .google.cloud.vision.v1.ReferenceImage reference_image = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $reference_image = null; + /** + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * + * Generated from protobuf field string reference_image_id = 3; + */ + private $reference_image_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource name of the product in which to create the reference image. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @type \Google\Cloud\Vision\V1\ReferenceImage $reference_image + * Required. The reference image to create. + * If an image ID is specified, it is ignored. + * @type string $reference_image_id + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the product in which to create the reference image. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource name of the product in which to create the reference image. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The reference image to create. + * If an image ID is specified, it is ignored. + * + * Generated from protobuf field .google.cloud.vision.v1.ReferenceImage reference_image = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\ReferenceImage|null + */ + public function getReferenceImage() + { + return $this->reference_image; + } + + public function hasReferenceImage() + { + return isset($this->reference_image); + } + + public function clearReferenceImage() + { + unset($this->reference_image); + } + + /** + * Required. The reference image to create. + * If an image ID is specified, it is ignored. + * + * Generated from protobuf field .google.cloud.vision.v1.ReferenceImage reference_image = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\ReferenceImage $var + * @return $this + */ + public function setReferenceImage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ReferenceImage::class); + $this->reference_image = $var; + + return $this; + } + + /** + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * + * Generated from protobuf field string reference_image_id = 3; + * @return string + */ + public function getReferenceImageId() + { + return $this->reference_image_id; + } + + /** + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * + * Generated from protobuf field string reference_image_id = 3; + * @param string $var + * @return $this + */ + public function setReferenceImageId($var) + { + GPBUtil::checkString($var, True); + $this->reference_image_id = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/CropHint.php b/vendor/google/cloud-vision/src/V1/CropHint.php new file mode 100644 index 00000000..f1e0a8d0 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/CropHint.php @@ -0,0 +1,153 @@ +google.cloud.vision.v1.CropHint + */ +class CropHint extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon for the crop region. The coordinates of the bounding + * box are in the original image's scale. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + */ + private $bounding_poly = null; + /** + * Confidence of this being a salient region. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + */ + private $confidence = 0.0; + /** + * Fraction of importance of this salient region with respect to the original + * image. + * + * Generated from protobuf field float importance_fraction = 3; + */ + private $importance_fraction = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * The bounding polygon for the crop region. The coordinates of the bounding + * box are in the original image's scale. + * @type float $confidence + * Confidence of this being a salient region. Range [0, 1]. + * @type float $importance_fraction + * Fraction of importance of this salient region with respect to the original + * image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon for the crop region. The coordinates of the bounding + * box are in the original image's scale. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * The bounding polygon for the crop region. The coordinates of the bounding + * box are in the original image's scale. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * Confidence of this being a salient region. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of this being a salient region. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + + /** + * Fraction of importance of this salient region with respect to the original + * image. + * + * Generated from protobuf field float importance_fraction = 3; + * @return float + */ + public function getImportanceFraction() + { + return $this->importance_fraction; + } + + /** + * Fraction of importance of this salient region with respect to the original + * image. + * + * Generated from protobuf field float importance_fraction = 3; + * @param float $var + * @return $this + */ + public function setImportanceFraction($var) + { + GPBUtil::checkFloat($var); + $this->importance_fraction = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/CropHintsAnnotation.php b/vendor/google/cloud-vision/src/V1/CropHintsAnnotation.php new file mode 100644 index 00000000..35c25589 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/CropHintsAnnotation.php @@ -0,0 +1,67 @@ +google.cloud.vision.v1.CropHintsAnnotation + */ +class CropHintsAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Crop hint results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.CropHint crop_hints = 1; + */ + private $crop_hints; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\CropHint[]|\Google\Protobuf\Internal\RepeatedField $crop_hints + * Crop hint results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Crop hint results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.CropHint crop_hints = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCropHints() + { + return $this->crop_hints; + } + + /** + * Crop hint results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.CropHint crop_hints = 1; + * @param \Google\Cloud\Vision\V1\CropHint[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCropHints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\CropHint::class); + $this->crop_hints = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/CropHintsParams.php b/vendor/google/cloud-vision/src/V1/CropHintsParams.php new file mode 100644 index 00000000..2cbf4d0e --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/CropHintsParams.php @@ -0,0 +1,87 @@ +google.cloud.vision.v1.CropHintsParams + */ +class CropHintsParams extends \Google\Protobuf\Internal\Message +{ + /** + * Aspect ratios in floats, representing the ratio of the width to the height + * of the image. For example, if the desired aspect ratio is 4/3, the + * corresponding float value should be 1.33333. If not specified, the + * best possible crop is returned. The number of provided aspect ratios is + * limited to a maximum of 16; any aspect ratios provided after the 16th are + * ignored. + * + * Generated from protobuf field repeated float aspect_ratios = 1; + */ + private $aspect_ratios; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float[]|\Google\Protobuf\Internal\RepeatedField $aspect_ratios + * Aspect ratios in floats, representing the ratio of the width to the height + * of the image. For example, if the desired aspect ratio is 4/3, the + * corresponding float value should be 1.33333. If not specified, the + * best possible crop is returned. The number of provided aspect ratios is + * limited to a maximum of 16; any aspect ratios provided after the 16th are + * ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Aspect ratios in floats, representing the ratio of the width to the height + * of the image. For example, if the desired aspect ratio is 4/3, the + * corresponding float value should be 1.33333. If not specified, the + * best possible crop is returned. The number of provided aspect ratios is + * limited to a maximum of 16; any aspect ratios provided after the 16th are + * ignored. + * + * Generated from protobuf field repeated float aspect_ratios = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAspectRatios() + { + return $this->aspect_ratios; + } + + /** + * Aspect ratios in floats, representing the ratio of the width to the height + * of the image. For example, if the desired aspect ratio is 4/3, the + * corresponding float value should be 1.33333. If not specified, the + * best possible crop is returned. The number of provided aspect ratios is + * limited to a maximum of 16; any aspect ratios provided after the 16th are + * ignored. + * + * Generated from protobuf field repeated float aspect_ratios = 1; + * @param float[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAspectRatios($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::FLOAT); + $this->aspect_ratios = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/DeleteProductRequest.php b/vendor/google/cloud-vision/src/V1/DeleteProductRequest.php new file mode 100644 index 00000000..1c6cb0e0 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/DeleteProductRequest.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.DeleteProductRequest + */ +class DeleteProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of product to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of product to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of product to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of product to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/DeleteProductSetRequest.php b/vendor/google/cloud-vision/src/V1/DeleteProductSetRequest.php new file mode 100644 index 00000000..d811b9cb --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/DeleteProductSetRequest.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.DeleteProductSetRequest + */ +class DeleteProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the ProductSet to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the ProductSet to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the ProductSet to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the ProductSet to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/DeleteReferenceImageRequest.php b/vendor/google/cloud-vision/src/V1/DeleteReferenceImageRequest.php new file mode 100644 index 00000000..db129660 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/DeleteReferenceImageRequest.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.DeleteReferenceImageRequest + */ +class DeleteReferenceImageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the reference image to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the reference image to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the reference image to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the reference image to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/DominantColorsAnnotation.php b/vendor/google/cloud-vision/src/V1/DominantColorsAnnotation.php new file mode 100644 index 00000000..f76f67a2 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/DominantColorsAnnotation.php @@ -0,0 +1,67 @@ +google.cloud.vision.v1.DominantColorsAnnotation + */ +class DominantColorsAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * RGB color values with their score and pixel fraction. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ColorInfo colors = 1; + */ + private $colors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ColorInfo[]|\Google\Protobuf\Internal\RepeatedField $colors + * RGB color values with their score and pixel fraction. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * RGB color values with their score and pixel fraction. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ColorInfo colors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getColors() + { + return $this->colors; + } + + /** + * RGB color values with their score and pixel fraction. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ColorInfo colors = 1; + * @param \Google\Cloud\Vision\V1\ColorInfo[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setColors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ColorInfo::class); + $this->colors = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/EntityAnnotation.php b/vendor/google/cloud-vision/src/V1/EntityAnnotation.php new file mode 100644 index 00000000..055fc73c --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/EntityAnnotation.php @@ -0,0 +1,422 @@ +google.cloud.vision.v1.EntityAnnotation + */ +class EntityAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * + * Generated from protobuf field string mid = 1; + */ + private $mid = ''; + /** + * The language code for the locale in which the entity textual + * `description` is expressed. + * + * Generated from protobuf field string locale = 2; + */ + private $locale = ''; + /** + * Entity textual description, expressed in its `locale` language. + * + * Generated from protobuf field string description = 3; + */ + private $description = ''; + /** + * Overall score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + */ + private $score = 0.0; + /** + * **Deprecated. Use `score` instead.** + * The accuracy of the entity detection in an image. + * For example, for an image in which the "Eiffel Tower" entity is detected, + * this field represents the confidence that there is a tower in the query + * image. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5 [deprecated = true]; + * @deprecated + */ + protected $confidence = 0.0; + /** + * The relevancy of the ICA (Image Content Annotation) label to the + * image. For example, the relevancy of "tower" is likely higher to an image + * containing the detected "Eiffel Tower" than to an image containing a + * detected distant towering building, even though the confidence that + * there is a tower in each image may be the same. Range [0, 1]. + * + * Generated from protobuf field float topicality = 6; + */ + private $topicality = 0.0; + /** + * Image region to which this entity belongs. Not produced + * for `LABEL_DETECTION` features. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 7; + */ + private $bounding_poly = null; + /** + * The location information for the detected entity. Multiple + * `LocationInfo` elements can be present because one location may + * indicate the location of the scene in the image, and another location + * may indicate the location of the place where the image was taken. + * Location information is usually present for landmarks. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.LocationInfo locations = 8; + */ + private $locations; + /** + * Some entities may have optional user-supplied `Property` (name/value) + * fields, such a score or string that qualifies the entity. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Property properties = 9; + */ + private $properties; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mid + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * @type string $locale + * The language code for the locale in which the entity textual + * `description` is expressed. + * @type string $description + * Entity textual description, expressed in its `locale` language. + * @type float $score + * Overall score of the result. Range [0, 1]. + * @type float $confidence + * **Deprecated. Use `score` instead.** + * The accuracy of the entity detection in an image. + * For example, for an image in which the "Eiffel Tower" entity is detected, + * this field represents the confidence that there is a tower in the query + * image. Range [0, 1]. + * @type float $topicality + * The relevancy of the ICA (Image Content Annotation) label to the + * image. For example, the relevancy of "tower" is likely higher to an image + * containing the detected "Eiffel Tower" than to an image containing a + * detected distant towering building, even though the confidence that + * there is a tower in each image may be the same. Range [0, 1]. + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * Image region to which this entity belongs. Not produced + * for `LABEL_DETECTION` features. + * @type \Google\Cloud\Vision\V1\LocationInfo[]|\Google\Protobuf\Internal\RepeatedField $locations + * The location information for the detected entity. Multiple + * `LocationInfo` elements can be present because one location may + * indicate the location of the scene in the image, and another location + * may indicate the location of the place where the image was taken. + * Location information is usually present for landmarks. + * @type \Google\Cloud\Vision\V1\Property[]|\Google\Protobuf\Internal\RepeatedField $properties + * Some entities may have optional user-supplied `Property` (name/value) + * fields, such a score or string that qualifies the entity. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * + * Generated from protobuf field string mid = 1; + * @return string + */ + public function getMid() + { + return $this->mid; + } + + /** + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * + * Generated from protobuf field string mid = 1; + * @param string $var + * @return $this + */ + public function setMid($var) + { + GPBUtil::checkString($var, True); + $this->mid = $var; + + return $this; + } + + /** + * The language code for the locale in which the entity textual + * `description` is expressed. + * + * Generated from protobuf field string locale = 2; + * @return string + */ + public function getLocale() + { + return $this->locale; + } + + /** + * The language code for the locale in which the entity textual + * `description` is expressed. + * + * Generated from protobuf field string locale = 2; + * @param string $var + * @return $this + */ + public function setLocale($var) + { + GPBUtil::checkString($var, True); + $this->locale = $var; + + return $this; + } + + /** + * Entity textual description, expressed in its `locale` language. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Entity textual description, expressed in its `locale` language. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Overall score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Overall score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * **Deprecated. Use `score` instead.** + * The accuracy of the entity detection in an image. + * For example, for an image in which the "Eiffel Tower" entity is detected, + * this field represents the confidence that there is a tower in the query + * image. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5 [deprecated = true]; + * @return float + * @deprecated + */ + public function getConfidence() + { + @trigger_error('confidence is deprecated.', E_USER_DEPRECATED); + return $this->confidence; + } + + /** + * **Deprecated. Use `score` instead.** + * The accuracy of the entity detection in an image. + * For example, for an image in which the "Eiffel Tower" entity is detected, + * this field represents the confidence that there is a tower in the query + * image. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setConfidence($var) + { + @trigger_error('confidence is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + + /** + * The relevancy of the ICA (Image Content Annotation) label to the + * image. For example, the relevancy of "tower" is likely higher to an image + * containing the detected "Eiffel Tower" than to an image containing a + * detected distant towering building, even though the confidence that + * there is a tower in each image may be the same. Range [0, 1]. + * + * Generated from protobuf field float topicality = 6; + * @return float + */ + public function getTopicality() + { + return $this->topicality; + } + + /** + * The relevancy of the ICA (Image Content Annotation) label to the + * image. For example, the relevancy of "tower" is likely higher to an image + * containing the detected "Eiffel Tower" than to an image containing a + * detected distant towering building, even though the confidence that + * there is a tower in each image may be the same. Range [0, 1]. + * + * Generated from protobuf field float topicality = 6; + * @param float $var + * @return $this + */ + public function setTopicality($var) + { + GPBUtil::checkFloat($var); + $this->topicality = $var; + + return $this; + } + + /** + * Image region to which this entity belongs. Not produced + * for `LABEL_DETECTION` features. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 7; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * Image region to which this entity belongs. Not produced + * for `LABEL_DETECTION` features. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 7; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * The location information for the detected entity. Multiple + * `LocationInfo` elements can be present because one location may + * indicate the location of the scene in the image, and another location + * may indicate the location of the place where the image was taken. + * Location information is usually present for landmarks. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.LocationInfo locations = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLocations() + { + return $this->locations; + } + + /** + * The location information for the detected entity. Multiple + * `LocationInfo` elements can be present because one location may + * indicate the location of the scene in the image, and another location + * may indicate the location of the place where the image was taken. + * Location information is usually present for landmarks. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.LocationInfo locations = 8; + * @param \Google\Cloud\Vision\V1\LocationInfo[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLocations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\LocationInfo::class); + $this->locations = $arr; + + return $this; + } + + /** + * Some entities may have optional user-supplied `Property` (name/value) + * fields, such a score or string that qualifies the entity. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Property properties = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProperties() + { + return $this->properties; + } + + /** + * Some entities may have optional user-supplied `Property` (name/value) + * fields, such a score or string that qualifies the entity. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Property properties = 9; + * @param \Google\Cloud\Vision\V1\Property[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProperties($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Property::class); + $this->properties = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/FaceAnnotation.php b/vendor/google/cloud-vision/src/V1/FaceAnnotation.php new file mode 100644 index 00000000..1bce595d --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/FaceAnnotation.php @@ -0,0 +1,627 @@ +google.cloud.vision.v1.FaceAnnotation + */ +class FaceAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon around the face. The coordinates of the bounding box + * are in the original image's scale. + * The bounding box is computed to "frame" the face in accordance with human + * expectations. It is based on the landmarker results. + * Note that one or more x and/or y coordinates may not be generated in the + * `BoundingPoly` (the polygon will be unbounded) if only a partial face + * appears in the image to be annotated. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + */ + private $bounding_poly = null; + /** + * The `fd_bounding_poly` bounding polygon is tighter than the + * `boundingPoly`, and encloses only the skin part of the face. Typically, it + * is used to eliminate the face from any image analysis that detects the + * "amount of skin" visible in an image. It is not based on the + * landmarker results, only on the initial face detection, hence + * the fd (face detection) prefix. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly fd_bounding_poly = 2; + */ + private $fd_bounding_poly = null; + /** + * Detected face landmarks. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.FaceAnnotation.Landmark landmarks = 3; + */ + private $landmarks; + /** + * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation + * of the face relative to the image vertical about the axis perpendicular to + * the face. Range [-180,180]. + * + * Generated from protobuf field float roll_angle = 4; + */ + private $roll_angle = 0.0; + /** + * Yaw angle, which indicates the leftward/rightward angle that the face is + * pointing relative to the vertical plane perpendicular to the image. Range + * [-180,180]. + * + * Generated from protobuf field float pan_angle = 5; + */ + private $pan_angle = 0.0; + /** + * Pitch angle, which indicates the upwards/downwards angle that the face is + * pointing relative to the image's horizontal plane. Range [-180,180]. + * + * Generated from protobuf field float tilt_angle = 6; + */ + private $tilt_angle = 0.0; + /** + * Detection confidence. Range [0, 1]. + * + * Generated from protobuf field float detection_confidence = 7; + */ + private $detection_confidence = 0.0; + /** + * Face landmarking confidence. Range [0, 1]. + * + * Generated from protobuf field float landmarking_confidence = 8; + */ + private $landmarking_confidence = 0.0; + /** + * Joy likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood joy_likelihood = 9; + */ + private $joy_likelihood = 0; + /** + * Sorrow likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood sorrow_likelihood = 10; + */ + private $sorrow_likelihood = 0; + /** + * Anger likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood anger_likelihood = 11; + */ + private $anger_likelihood = 0; + /** + * Surprise likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood surprise_likelihood = 12; + */ + private $surprise_likelihood = 0; + /** + * Under-exposed likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood under_exposed_likelihood = 13; + */ + private $under_exposed_likelihood = 0; + /** + * Blurred likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood blurred_likelihood = 14; + */ + private $blurred_likelihood = 0; + /** + * Headwear likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood headwear_likelihood = 15; + */ + private $headwear_likelihood = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * The bounding polygon around the face. The coordinates of the bounding box + * are in the original image's scale. + * The bounding box is computed to "frame" the face in accordance with human + * expectations. It is based on the landmarker results. + * Note that one or more x and/or y coordinates may not be generated in the + * `BoundingPoly` (the polygon will be unbounded) if only a partial face + * appears in the image to be annotated. + * @type \Google\Cloud\Vision\V1\BoundingPoly $fd_bounding_poly + * The `fd_bounding_poly` bounding polygon is tighter than the + * `boundingPoly`, and encloses only the skin part of the face. Typically, it + * is used to eliminate the face from any image analysis that detects the + * "amount of skin" visible in an image. It is not based on the + * landmarker results, only on the initial face detection, hence + * the fd (face detection) prefix. + * @type \Google\Cloud\Vision\V1\FaceAnnotation\Landmark[]|\Google\Protobuf\Internal\RepeatedField $landmarks + * Detected face landmarks. + * @type float $roll_angle + * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation + * of the face relative to the image vertical about the axis perpendicular to + * the face. Range [-180,180]. + * @type float $pan_angle + * Yaw angle, which indicates the leftward/rightward angle that the face is + * pointing relative to the vertical plane perpendicular to the image. Range + * [-180,180]. + * @type float $tilt_angle + * Pitch angle, which indicates the upwards/downwards angle that the face is + * pointing relative to the image's horizontal plane. Range [-180,180]. + * @type float $detection_confidence + * Detection confidence. Range [0, 1]. + * @type float $landmarking_confidence + * Face landmarking confidence. Range [0, 1]. + * @type int $joy_likelihood + * Joy likelihood. + * @type int $sorrow_likelihood + * Sorrow likelihood. + * @type int $anger_likelihood + * Anger likelihood. + * @type int $surprise_likelihood + * Surprise likelihood. + * @type int $under_exposed_likelihood + * Under-exposed likelihood. + * @type int $blurred_likelihood + * Blurred likelihood. + * @type int $headwear_likelihood + * Headwear likelihood. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon around the face. The coordinates of the bounding box + * are in the original image's scale. + * The bounding box is computed to "frame" the face in accordance with human + * expectations. It is based on the landmarker results. + * Note that one or more x and/or y coordinates may not be generated in the + * `BoundingPoly` (the polygon will be unbounded) if only a partial face + * appears in the image to be annotated. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * The bounding polygon around the face. The coordinates of the bounding box + * are in the original image's scale. + * The bounding box is computed to "frame" the face in accordance with human + * expectations. It is based on the landmarker results. + * Note that one or more x and/or y coordinates may not be generated in the + * `BoundingPoly` (the polygon will be unbounded) if only a partial face + * appears in the image to be annotated. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * The `fd_bounding_poly` bounding polygon is tighter than the + * `boundingPoly`, and encloses only the skin part of the face. Typically, it + * is used to eliminate the face from any image analysis that detects the + * "amount of skin" visible in an image. It is not based on the + * landmarker results, only on the initial face detection, hence + * the fd (face detection) prefix. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly fd_bounding_poly = 2; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getFdBoundingPoly() + { + return $this->fd_bounding_poly; + } + + public function hasFdBoundingPoly() + { + return isset($this->fd_bounding_poly); + } + + public function clearFdBoundingPoly() + { + unset($this->fd_bounding_poly); + } + + /** + * The `fd_bounding_poly` bounding polygon is tighter than the + * `boundingPoly`, and encloses only the skin part of the face. Typically, it + * is used to eliminate the face from any image analysis that detects the + * "amount of skin" visible in an image. It is not based on the + * landmarker results, only on the initial face detection, hence + * the fd (face detection) prefix. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly fd_bounding_poly = 2; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setFdBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->fd_bounding_poly = $var; + + return $this; + } + + /** + * Detected face landmarks. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.FaceAnnotation.Landmark landmarks = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLandmarks() + { + return $this->landmarks; + } + + /** + * Detected face landmarks. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.FaceAnnotation.Landmark landmarks = 3; + * @param \Google\Cloud\Vision\V1\FaceAnnotation\Landmark[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLandmarks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\FaceAnnotation\Landmark::class); + $this->landmarks = $arr; + + return $this; + } + + /** + * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation + * of the face relative to the image vertical about the axis perpendicular to + * the face. Range [-180,180]. + * + * Generated from protobuf field float roll_angle = 4; + * @return float + */ + public function getRollAngle() + { + return $this->roll_angle; + } + + /** + * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation + * of the face relative to the image vertical about the axis perpendicular to + * the face. Range [-180,180]. + * + * Generated from protobuf field float roll_angle = 4; + * @param float $var + * @return $this + */ + public function setRollAngle($var) + { + GPBUtil::checkFloat($var); + $this->roll_angle = $var; + + return $this; + } + + /** + * Yaw angle, which indicates the leftward/rightward angle that the face is + * pointing relative to the vertical plane perpendicular to the image. Range + * [-180,180]. + * + * Generated from protobuf field float pan_angle = 5; + * @return float + */ + public function getPanAngle() + { + return $this->pan_angle; + } + + /** + * Yaw angle, which indicates the leftward/rightward angle that the face is + * pointing relative to the vertical plane perpendicular to the image. Range + * [-180,180]. + * + * Generated from protobuf field float pan_angle = 5; + * @param float $var + * @return $this + */ + public function setPanAngle($var) + { + GPBUtil::checkFloat($var); + $this->pan_angle = $var; + + return $this; + } + + /** + * Pitch angle, which indicates the upwards/downwards angle that the face is + * pointing relative to the image's horizontal plane. Range [-180,180]. + * + * Generated from protobuf field float tilt_angle = 6; + * @return float + */ + public function getTiltAngle() + { + return $this->tilt_angle; + } + + /** + * Pitch angle, which indicates the upwards/downwards angle that the face is + * pointing relative to the image's horizontal plane. Range [-180,180]. + * + * Generated from protobuf field float tilt_angle = 6; + * @param float $var + * @return $this + */ + public function setTiltAngle($var) + { + GPBUtil::checkFloat($var); + $this->tilt_angle = $var; + + return $this; + } + + /** + * Detection confidence. Range [0, 1]. + * + * Generated from protobuf field float detection_confidence = 7; + * @return float + */ + public function getDetectionConfidence() + { + return $this->detection_confidence; + } + + /** + * Detection confidence. Range [0, 1]. + * + * Generated from protobuf field float detection_confidence = 7; + * @param float $var + * @return $this + */ + public function setDetectionConfidence($var) + { + GPBUtil::checkFloat($var); + $this->detection_confidence = $var; + + return $this; + } + + /** + * Face landmarking confidence. Range [0, 1]. + * + * Generated from protobuf field float landmarking_confidence = 8; + * @return float + */ + public function getLandmarkingConfidence() + { + return $this->landmarking_confidence; + } + + /** + * Face landmarking confidence. Range [0, 1]. + * + * Generated from protobuf field float landmarking_confidence = 8; + * @param float $var + * @return $this + */ + public function setLandmarkingConfidence($var) + { + GPBUtil::checkFloat($var); + $this->landmarking_confidence = $var; + + return $this; + } + + /** + * Joy likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood joy_likelihood = 9; + * @return int + */ + public function getJoyLikelihood() + { + return $this->joy_likelihood; + } + + /** + * Joy likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood joy_likelihood = 9; + * @param int $var + * @return $this + */ + public function setJoyLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->joy_likelihood = $var; + + return $this; + } + + /** + * Sorrow likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood sorrow_likelihood = 10; + * @return int + */ + public function getSorrowLikelihood() + { + return $this->sorrow_likelihood; + } + + /** + * Sorrow likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood sorrow_likelihood = 10; + * @param int $var + * @return $this + */ + public function setSorrowLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->sorrow_likelihood = $var; + + return $this; + } + + /** + * Anger likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood anger_likelihood = 11; + * @return int + */ + public function getAngerLikelihood() + { + return $this->anger_likelihood; + } + + /** + * Anger likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood anger_likelihood = 11; + * @param int $var + * @return $this + */ + public function setAngerLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->anger_likelihood = $var; + + return $this; + } + + /** + * Surprise likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood surprise_likelihood = 12; + * @return int + */ + public function getSurpriseLikelihood() + { + return $this->surprise_likelihood; + } + + /** + * Surprise likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood surprise_likelihood = 12; + * @param int $var + * @return $this + */ + public function setSurpriseLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->surprise_likelihood = $var; + + return $this; + } + + /** + * Under-exposed likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood under_exposed_likelihood = 13; + * @return int + */ + public function getUnderExposedLikelihood() + { + return $this->under_exposed_likelihood; + } + + /** + * Under-exposed likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood under_exposed_likelihood = 13; + * @param int $var + * @return $this + */ + public function setUnderExposedLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->under_exposed_likelihood = $var; + + return $this; + } + + /** + * Blurred likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood blurred_likelihood = 14; + * @return int + */ + public function getBlurredLikelihood() + { + return $this->blurred_likelihood; + } + + /** + * Blurred likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood blurred_likelihood = 14; + * @param int $var + * @return $this + */ + public function setBlurredLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->blurred_likelihood = $var; + + return $this; + } + + /** + * Headwear likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood headwear_likelihood = 15; + * @return int + */ + public function getHeadwearLikelihood() + { + return $this->headwear_likelihood; + } + + /** + * Headwear likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood headwear_likelihood = 15; + * @param int $var + * @return $this + */ + public function setHeadwearLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->headwear_likelihood = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/FaceAnnotation/Landmark.php b/vendor/google/cloud-vision/src/V1/FaceAnnotation/Landmark.php new file mode 100644 index 00000000..725a74c8 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/FaceAnnotation/Landmark.php @@ -0,0 +1,114 @@ +google.cloud.vision.v1.FaceAnnotation.Landmark + */ +class Landmark extends \Google\Protobuf\Internal\Message +{ + /** + * Face landmark type. + * + * Generated from protobuf field .google.cloud.vision.v1.FaceAnnotation.Landmark.Type type = 3; + */ + private $type = 0; + /** + * Face landmark position. + * + * Generated from protobuf field .google.cloud.vision.v1.Position position = 4; + */ + private $position = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Face landmark type. + * @type \Google\Cloud\Vision\V1\Position $position + * Face landmark position. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Face landmark type. + * + * Generated from protobuf field .google.cloud.vision.v1.FaceAnnotation.Landmark.Type type = 3; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Face landmark type. + * + * Generated from protobuf field .google.cloud.vision.v1.FaceAnnotation.Landmark.Type type = 3; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\FaceAnnotation\Landmark\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Face landmark position. + * + * Generated from protobuf field .google.cloud.vision.v1.Position position = 4; + * @return \Google\Cloud\Vision\V1\Position|null + */ + public function getPosition() + { + return $this->position; + } + + public function hasPosition() + { + return isset($this->position); + } + + public function clearPosition() + { + unset($this->position); + } + + /** + * Face landmark position. + * + * Generated from protobuf field .google.cloud.vision.v1.Position position = 4; + * @param \Google\Cloud\Vision\V1\Position $var + * @return $this + */ + public function setPosition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Position::class); + $this->position = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Landmark::class, \Google\Cloud\Vision\V1\FaceAnnotation_Landmark::class); + diff --git a/vendor/google/cloud-vision/src/V1/FaceAnnotation/Landmark/Type.php b/vendor/google/cloud-vision/src/V1/FaceAnnotation/Landmark/Type.php new file mode 100644 index 00000000..7aabc19d --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/FaceAnnotation/Landmark/Type.php @@ -0,0 +1,305 @@ +google.cloud.vision.v1.FaceAnnotation.Landmark.Type + */ +class Type +{ + /** + * Unknown face landmark detected. Should not be filled. + * + * Generated from protobuf enum UNKNOWN_LANDMARK = 0; + */ + const UNKNOWN_LANDMARK = 0; + /** + * Left eye. + * + * Generated from protobuf enum LEFT_EYE = 1; + */ + const LEFT_EYE = 1; + /** + * Right eye. + * + * Generated from protobuf enum RIGHT_EYE = 2; + */ + const RIGHT_EYE = 2; + /** + * Left of left eyebrow. + * + * Generated from protobuf enum LEFT_OF_LEFT_EYEBROW = 3; + */ + const LEFT_OF_LEFT_EYEBROW = 3; + /** + * Right of left eyebrow. + * + * Generated from protobuf enum RIGHT_OF_LEFT_EYEBROW = 4; + */ + const RIGHT_OF_LEFT_EYEBROW = 4; + /** + * Left of right eyebrow. + * + * Generated from protobuf enum LEFT_OF_RIGHT_EYEBROW = 5; + */ + const LEFT_OF_RIGHT_EYEBROW = 5; + /** + * Right of right eyebrow. + * + * Generated from protobuf enum RIGHT_OF_RIGHT_EYEBROW = 6; + */ + const RIGHT_OF_RIGHT_EYEBROW = 6; + /** + * Midpoint between eyes. + * + * Generated from protobuf enum MIDPOINT_BETWEEN_EYES = 7; + */ + const MIDPOINT_BETWEEN_EYES = 7; + /** + * Nose tip. + * + * Generated from protobuf enum NOSE_TIP = 8; + */ + const NOSE_TIP = 8; + /** + * Upper lip. + * + * Generated from protobuf enum UPPER_LIP = 9; + */ + const UPPER_LIP = 9; + /** + * Lower lip. + * + * Generated from protobuf enum LOWER_LIP = 10; + */ + const LOWER_LIP = 10; + /** + * Mouth left. + * + * Generated from protobuf enum MOUTH_LEFT = 11; + */ + const MOUTH_LEFT = 11; + /** + * Mouth right. + * + * Generated from protobuf enum MOUTH_RIGHT = 12; + */ + const MOUTH_RIGHT = 12; + /** + * Mouth center. + * + * Generated from protobuf enum MOUTH_CENTER = 13; + */ + const MOUTH_CENTER = 13; + /** + * Nose, bottom right. + * + * Generated from protobuf enum NOSE_BOTTOM_RIGHT = 14; + */ + const NOSE_BOTTOM_RIGHT = 14; + /** + * Nose, bottom left. + * + * Generated from protobuf enum NOSE_BOTTOM_LEFT = 15; + */ + const NOSE_BOTTOM_LEFT = 15; + /** + * Nose, bottom center. + * + * Generated from protobuf enum NOSE_BOTTOM_CENTER = 16; + */ + const NOSE_BOTTOM_CENTER = 16; + /** + * Left eye, top boundary. + * + * Generated from protobuf enum LEFT_EYE_TOP_BOUNDARY = 17; + */ + const LEFT_EYE_TOP_BOUNDARY = 17; + /** + * Left eye, right corner. + * + * Generated from protobuf enum LEFT_EYE_RIGHT_CORNER = 18; + */ + const LEFT_EYE_RIGHT_CORNER = 18; + /** + * Left eye, bottom boundary. + * + * Generated from protobuf enum LEFT_EYE_BOTTOM_BOUNDARY = 19; + */ + const LEFT_EYE_BOTTOM_BOUNDARY = 19; + /** + * Left eye, left corner. + * + * Generated from protobuf enum LEFT_EYE_LEFT_CORNER = 20; + */ + const LEFT_EYE_LEFT_CORNER = 20; + /** + * Right eye, top boundary. + * + * Generated from protobuf enum RIGHT_EYE_TOP_BOUNDARY = 21; + */ + const RIGHT_EYE_TOP_BOUNDARY = 21; + /** + * Right eye, right corner. + * + * Generated from protobuf enum RIGHT_EYE_RIGHT_CORNER = 22; + */ + const RIGHT_EYE_RIGHT_CORNER = 22; + /** + * Right eye, bottom boundary. + * + * Generated from protobuf enum RIGHT_EYE_BOTTOM_BOUNDARY = 23; + */ + const RIGHT_EYE_BOTTOM_BOUNDARY = 23; + /** + * Right eye, left corner. + * + * Generated from protobuf enum RIGHT_EYE_LEFT_CORNER = 24; + */ + const RIGHT_EYE_LEFT_CORNER = 24; + /** + * Left eyebrow, upper midpoint. + * + * Generated from protobuf enum LEFT_EYEBROW_UPPER_MIDPOINT = 25; + */ + const LEFT_EYEBROW_UPPER_MIDPOINT = 25; + /** + * Right eyebrow, upper midpoint. + * + * Generated from protobuf enum RIGHT_EYEBROW_UPPER_MIDPOINT = 26; + */ + const RIGHT_EYEBROW_UPPER_MIDPOINT = 26; + /** + * Left ear tragion. + * + * Generated from protobuf enum LEFT_EAR_TRAGION = 27; + */ + const LEFT_EAR_TRAGION = 27; + /** + * Right ear tragion. + * + * Generated from protobuf enum RIGHT_EAR_TRAGION = 28; + */ + const RIGHT_EAR_TRAGION = 28; + /** + * Left eye pupil. + * + * Generated from protobuf enum LEFT_EYE_PUPIL = 29; + */ + const LEFT_EYE_PUPIL = 29; + /** + * Right eye pupil. + * + * Generated from protobuf enum RIGHT_EYE_PUPIL = 30; + */ + const RIGHT_EYE_PUPIL = 30; + /** + * Forehead glabella. + * + * Generated from protobuf enum FOREHEAD_GLABELLA = 31; + */ + const FOREHEAD_GLABELLA = 31; + /** + * Chin gnathion. + * + * Generated from protobuf enum CHIN_GNATHION = 32; + */ + const CHIN_GNATHION = 32; + /** + * Chin left gonion. + * + * Generated from protobuf enum CHIN_LEFT_GONION = 33; + */ + const CHIN_LEFT_GONION = 33; + /** + * Chin right gonion. + * + * Generated from protobuf enum CHIN_RIGHT_GONION = 34; + */ + const CHIN_RIGHT_GONION = 34; + /** + * Left cheek center. + * + * Generated from protobuf enum LEFT_CHEEK_CENTER = 35; + */ + const LEFT_CHEEK_CENTER = 35; + /** + * Right cheek center. + * + * Generated from protobuf enum RIGHT_CHEEK_CENTER = 36; + */ + const RIGHT_CHEEK_CENTER = 36; + + private static $valueToName = [ + self::UNKNOWN_LANDMARK => 'UNKNOWN_LANDMARK', + self::LEFT_EYE => 'LEFT_EYE', + self::RIGHT_EYE => 'RIGHT_EYE', + self::LEFT_OF_LEFT_EYEBROW => 'LEFT_OF_LEFT_EYEBROW', + self::RIGHT_OF_LEFT_EYEBROW => 'RIGHT_OF_LEFT_EYEBROW', + self::LEFT_OF_RIGHT_EYEBROW => 'LEFT_OF_RIGHT_EYEBROW', + self::RIGHT_OF_RIGHT_EYEBROW => 'RIGHT_OF_RIGHT_EYEBROW', + self::MIDPOINT_BETWEEN_EYES => 'MIDPOINT_BETWEEN_EYES', + self::NOSE_TIP => 'NOSE_TIP', + self::UPPER_LIP => 'UPPER_LIP', + self::LOWER_LIP => 'LOWER_LIP', + self::MOUTH_LEFT => 'MOUTH_LEFT', + self::MOUTH_RIGHT => 'MOUTH_RIGHT', + self::MOUTH_CENTER => 'MOUTH_CENTER', + self::NOSE_BOTTOM_RIGHT => 'NOSE_BOTTOM_RIGHT', + self::NOSE_BOTTOM_LEFT => 'NOSE_BOTTOM_LEFT', + self::NOSE_BOTTOM_CENTER => 'NOSE_BOTTOM_CENTER', + self::LEFT_EYE_TOP_BOUNDARY => 'LEFT_EYE_TOP_BOUNDARY', + self::LEFT_EYE_RIGHT_CORNER => 'LEFT_EYE_RIGHT_CORNER', + self::LEFT_EYE_BOTTOM_BOUNDARY => 'LEFT_EYE_BOTTOM_BOUNDARY', + self::LEFT_EYE_LEFT_CORNER => 'LEFT_EYE_LEFT_CORNER', + self::RIGHT_EYE_TOP_BOUNDARY => 'RIGHT_EYE_TOP_BOUNDARY', + self::RIGHT_EYE_RIGHT_CORNER => 'RIGHT_EYE_RIGHT_CORNER', + self::RIGHT_EYE_BOTTOM_BOUNDARY => 'RIGHT_EYE_BOTTOM_BOUNDARY', + self::RIGHT_EYE_LEFT_CORNER => 'RIGHT_EYE_LEFT_CORNER', + self::LEFT_EYEBROW_UPPER_MIDPOINT => 'LEFT_EYEBROW_UPPER_MIDPOINT', + self::RIGHT_EYEBROW_UPPER_MIDPOINT => 'RIGHT_EYEBROW_UPPER_MIDPOINT', + self::LEFT_EAR_TRAGION => 'LEFT_EAR_TRAGION', + self::RIGHT_EAR_TRAGION => 'RIGHT_EAR_TRAGION', + self::LEFT_EYE_PUPIL => 'LEFT_EYE_PUPIL', + self::RIGHT_EYE_PUPIL => 'RIGHT_EYE_PUPIL', + self::FOREHEAD_GLABELLA => 'FOREHEAD_GLABELLA', + self::CHIN_GNATHION => 'CHIN_GNATHION', + self::CHIN_LEFT_GONION => 'CHIN_LEFT_GONION', + self::CHIN_RIGHT_GONION => 'CHIN_RIGHT_GONION', + self::LEFT_CHEEK_CENTER => 'LEFT_CHEEK_CENTER', + self::RIGHT_CHEEK_CENTER => 'RIGHT_CHEEK_CENTER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Vision\V1\FaceAnnotation_Landmark_Type::class); + diff --git a/vendor/google/cloud-vision/src/V1/FaceAnnotation_Landmark.php b/vendor/google/cloud-vision/src/V1/FaceAnnotation_Landmark.php new file mode 100644 index 00000000..cad544c6 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/FaceAnnotation_Landmark.php @@ -0,0 +1,16 @@ +google.cloud.vision.v1.Feature + */ +class Feature extends \Google\Protobuf\Internal\Message +{ + /** + * The feature type. + * + * Generated from protobuf field .google.cloud.vision.v1.Feature.Type type = 1; + */ + private $type = 0; + /** + * Maximum number of results of this type. Does not apply to + * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. + * + * Generated from protobuf field int32 max_results = 2; + */ + private $max_results = 0; + /** + * Model to use for the feature. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 3; + */ + private $model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * The feature type. + * @type int $max_results + * Maximum number of results of this type. Does not apply to + * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. + * @type string $model + * Model to use for the feature. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The feature type. + * + * Generated from protobuf field .google.cloud.vision.v1.Feature.Type type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The feature type. + * + * Generated from protobuf field .google.cloud.vision.v1.Feature.Type type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Feature\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Maximum number of results of this type. Does not apply to + * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. + * + * Generated from protobuf field int32 max_results = 2; + * @return int + */ + public function getMaxResults() + { + return $this->max_results; + } + + /** + * Maximum number of results of this type. Does not apply to + * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. + * + * Generated from protobuf field int32 max_results = 2; + * @param int $var + * @return $this + */ + public function setMaxResults($var) + { + GPBUtil::checkInt32($var); + $this->max_results = $var; + + return $this; + } + + /** + * Model to use for the feature. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 3; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Model to use for the feature. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 3; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/Feature/Type.php b/vendor/google/cloud-vision/src/V1/Feature/Type.php new file mode 100644 index 00000000..d905c732 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Feature/Type.php @@ -0,0 +1,139 @@ +google.cloud.vision.v1.Feature.Type + */ +class Type +{ + /** + * Unspecified feature type. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Run face detection. + * + * Generated from protobuf enum FACE_DETECTION = 1; + */ + const FACE_DETECTION = 1; + /** + * Run landmark detection. + * + * Generated from protobuf enum LANDMARK_DETECTION = 2; + */ + const LANDMARK_DETECTION = 2; + /** + * Run logo detection. + * + * Generated from protobuf enum LOGO_DETECTION = 3; + */ + const LOGO_DETECTION = 3; + /** + * Run label detection. + * + * Generated from protobuf enum LABEL_DETECTION = 4; + */ + const LABEL_DETECTION = 4; + /** + * Run text detection / optical character recognition (OCR). Text detection + * is optimized for areas of text within a larger image; if the image is + * a document, use `DOCUMENT_TEXT_DETECTION` instead. + * + * Generated from protobuf enum TEXT_DETECTION = 5; + */ + const TEXT_DETECTION = 5; + /** + * Run dense text document OCR. Takes precedence when both + * `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present. + * + * Generated from protobuf enum DOCUMENT_TEXT_DETECTION = 11; + */ + const DOCUMENT_TEXT_DETECTION = 11; + /** + * Run Safe Search to detect potentially unsafe + * or undesirable content. + * + * Generated from protobuf enum SAFE_SEARCH_DETECTION = 6; + */ + const SAFE_SEARCH_DETECTION = 6; + /** + * Compute a set of image properties, such as the + * image's dominant colors. + * + * Generated from protobuf enum IMAGE_PROPERTIES = 7; + */ + const IMAGE_PROPERTIES = 7; + /** + * Run crop hints. + * + * Generated from protobuf enum CROP_HINTS = 9; + */ + const CROP_HINTS = 9; + /** + * Run web detection. + * + * Generated from protobuf enum WEB_DETECTION = 10; + */ + const WEB_DETECTION = 10; + /** + * Run Product Search. + * + * Generated from protobuf enum PRODUCT_SEARCH = 12; + */ + const PRODUCT_SEARCH = 12; + /** + * Run localizer for object detection. + * + * Generated from protobuf enum OBJECT_LOCALIZATION = 19; + */ + const OBJECT_LOCALIZATION = 19; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::FACE_DETECTION => 'FACE_DETECTION', + self::LANDMARK_DETECTION => 'LANDMARK_DETECTION', + self::LOGO_DETECTION => 'LOGO_DETECTION', + self::LABEL_DETECTION => 'LABEL_DETECTION', + self::TEXT_DETECTION => 'TEXT_DETECTION', + self::DOCUMENT_TEXT_DETECTION => 'DOCUMENT_TEXT_DETECTION', + self::SAFE_SEARCH_DETECTION => 'SAFE_SEARCH_DETECTION', + self::IMAGE_PROPERTIES => 'IMAGE_PROPERTIES', + self::CROP_HINTS => 'CROP_HINTS', + self::WEB_DETECTION => 'WEB_DETECTION', + self::PRODUCT_SEARCH => 'PRODUCT_SEARCH', + self::OBJECT_LOCALIZATION => 'OBJECT_LOCALIZATION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Vision\V1\Feature_Type::class); + diff --git a/vendor/google/cloud-vision/src/V1/Feature_Type.php b/vendor/google/cloud-vision/src/V1/Feature_Type.php new file mode 100644 index 00000000..771addc5 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Feature_Type.php @@ -0,0 +1,16 @@ +asyncBatchAnnotateFiles($requests); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $imageAnnotatorClient->asyncBatchAnnotateFiles($requests); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $imageAnnotatorClient->resumeOperation($operationName, 'asyncBatchAnnotateFiles'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $imageAnnotatorClient->close(); + * } + * ``` + */ +class ImageAnnotatorGapicClient +{ + use GapicClientTrait; + + /** + * The name of the service. + */ + const SERVICE_NAME = 'google.cloud.vision.v1.ImageAnnotator'; + + /** + * The default address of the service. + */ + const SERVICE_ADDRESS = 'vision.googleapis.com'; + + /** + * The default port of the service. + */ + const DEFAULT_SERVICE_PORT = 443; + + /** + * The name of the code generator, to be included in the agent header. + */ + const CODEGEN_NAME = 'gapic'; + + /** + * The default scopes required by the service. + */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-vision', + ]; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => + self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => + __DIR__ . '/../resources/image_annotator_client_config.json', + 'descriptorsConfigPath' => + __DIR__ . '/../resources/image_annotator_descriptor_config.php', + 'gcpApiConfigPath' => + __DIR__ . '/../resources/image_annotator_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => + __DIR__ . + '/../resources/image_annotator_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; + $operation = new OperationResponse( + $operationName, + $this->getOperationsClient(), + $options + ); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $serviceAddress + * **Deprecated**. This option will be removed in a future major release. Please + * utilize the `$apiEndpoint` option instead. + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'vision.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $serviceAddress setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Run asynchronous image detection and annotation for a list of generic + * files, such as PDF files, which may contain multiple pages and multiple + * images per page. Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). + * + * Sample code: + * ``` + * $imageAnnotatorClient = new ImageAnnotatorClient(); + * try { + * $requests = []; + * $operationResponse = $imageAnnotatorClient->asyncBatchAnnotateFiles($requests); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $imageAnnotatorClient->asyncBatchAnnotateFiles($requests); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $imageAnnotatorClient->resumeOperation($operationName, 'asyncBatchAnnotateFiles'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $imageAnnotatorClient->close(); + * } + * ``` + * + * @param AsyncAnnotateFileRequest[] $requests Required. Individual async file annotation requests for this batch. + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * Optional. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no parent is specified, a region will be chosen automatically. + * + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * + * Example: `projects/project-A/locations/eu`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function asyncBatchAnnotateFiles($requests, array $optionalArgs = []) + { + $request = new AsyncBatchAnnotateFilesRequest(); + $requestParamHeaders = []; + $request->setRequests($requests); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'AsyncBatchAnnotateFiles', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Run asynchronous image detection and annotation for a list of images. + * + * Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results). + * + * This service will write image annotation outputs to json files in customer + * GCS bucket, each json file containing BatchAnnotateImagesResponse proto. + * + * Sample code: + * ``` + * $imageAnnotatorClient = new ImageAnnotatorClient(); + * try { + * $requests = []; + * $outputConfig = new OutputConfig(); + * $operationResponse = $imageAnnotatorClient->asyncBatchAnnotateImages($requests, $outputConfig); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $imageAnnotatorClient->asyncBatchAnnotateImages($requests, $outputConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $imageAnnotatorClient->resumeOperation($operationName, 'asyncBatchAnnotateImages'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $imageAnnotatorClient->close(); + * } + * ``` + * + * @param AnnotateImageRequest[] $requests Required. Individual image annotation requests for this batch. + * @param OutputConfig $outputConfig Required. The desired output location and metadata (e.g. format). + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * Optional. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no parent is specified, a region will be chosen automatically. + * + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * + * Example: `projects/project-A/locations/eu`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function asyncBatchAnnotateImages( + $requests, + $outputConfig, + array $optionalArgs = [] + ) { + $request = new AsyncBatchAnnotateImagesRequest(); + $requestParamHeaders = []; + $request->setRequests($requests); + $request->setOutputConfig($outputConfig); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'AsyncBatchAnnotateImages', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Service that performs image detection and annotation for a batch of files. + * Now only "application/pdf", "image/tiff" and "image/gif" are supported. + * + * This service will extract at most 5 (customers can specify which 5 in + * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each + * file provided and perform detection and annotation for each image + * extracted. + * + * Sample code: + * ``` + * $imageAnnotatorClient = new ImageAnnotatorClient(); + * try { + * $requests = []; + * $response = $imageAnnotatorClient->batchAnnotateFiles($requests); + * } finally { + * $imageAnnotatorClient->close(); + * } + * ``` + * + * @param AnnotateFileRequest[] $requests Required. The list of file annotation requests. Right now we support only + * one AnnotateFileRequest in BatchAnnotateFilesRequest. + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * Optional. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no parent is specified, a region will be chosen automatically. + * + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * + * Example: `projects/project-A/locations/eu`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\BatchAnnotateFilesResponse + * + * @throws ApiException if the remote call fails + */ + public function batchAnnotateFiles($requests, array $optionalArgs = []) + { + $request = new BatchAnnotateFilesRequest(); + $requestParamHeaders = []; + $request->setRequests($requests); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'BatchAnnotateFiles', + BatchAnnotateFilesResponse::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Run image detection and annotation for a batch of images. + * + * Sample code: + * ``` + * $imageAnnotatorClient = new ImageAnnotatorClient(); + * try { + * $requests = []; + * $response = $imageAnnotatorClient->batchAnnotateImages($requests); + * } finally { + * $imageAnnotatorClient->close(); + * } + * ``` + * + * @param AnnotateImageRequest[] $requests Required. Individual image annotation requests for this batch. + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * Optional. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no parent is specified, a region will be chosen automatically. + * + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * + * Example: `projects/project-A/locations/eu`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\BatchAnnotateImagesResponse + * + * @throws ApiException if the remote call fails + */ + public function batchAnnotateImages($requests, array $optionalArgs = []) + { + $request = new BatchAnnotateImagesRequest(); + $requestParamHeaders = []; + $request->setRequests($requests); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'BatchAnnotateImages', + BatchAnnotateImagesResponse::class, + $optionalArgs, + $request + )->wait(); + } +} diff --git a/vendor/google/cloud-vision/src/V1/Gapic/ProductSearchGapicClient.php b/vendor/google/cloud-vision/src/V1/Gapic/ProductSearchGapicClient.php new file mode 100644 index 00000000..0e7ef711 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Gapic/ProductSearchGapicClient.php @@ -0,0 +1,1841 @@ +productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $formattedProduct = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $productSearchClient->addProductToProductSet($formattedName, $formattedProduct); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class ProductSearchGapicClient +{ + use GapicClientTrait; + + /** + * The name of the service. + */ + const SERVICE_NAME = 'google.cloud.vision.v1.ProductSearch'; + + /** + * The default address of the service. + */ + const SERVICE_ADDRESS = 'vision.googleapis.com'; + + /** + * The default port of the service. + */ + const DEFAULT_SERVICE_PORT = 443; + + /** + * The name of the code generator, to be included in the agent header. + */ + const CODEGEN_NAME = 'gapic'; + + /** + * The default scopes required by the service. + */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-vision', + ]; + + private static $locationNameTemplate; + + private static $productNameTemplate; + + private static $productSetNameTemplate; + + private static $referenceImageNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => + self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => + __DIR__ . '/../resources/product_search_client_config.json', + 'descriptorsConfigPath' => + __DIR__ . '/../resources/product_search_descriptor_config.php', + 'gcpApiConfigPath' => + __DIR__ . '/../resources/product_search_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => + __DIR__ . + '/../resources/product_search_rest_client_config.php', + ], + ], + ]; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}' + ); + } + + return self::$locationNameTemplate; + } + + private static function getProductNameTemplate() + { + if (self::$productNameTemplate == null) { + self::$productNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/products/{product}' + ); + } + + return self::$productNameTemplate; + } + + private static function getProductSetNameTemplate() + { + if (self::$productSetNameTemplate == null) { + self::$productSetNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/productSets/{product_set}' + ); + } + + return self::$productSetNameTemplate; + } + + private static function getReferenceImageNameTemplate() + { + if (self::$referenceImageNameTemplate == null) { + self::$referenceImageNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' + ); + } + + return self::$referenceImageNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'location' => self::getLocationNameTemplate(), + 'product' => self::getProductNameTemplate(), + 'productSet' => self::getProductSetNameTemplate(), + 'referenceImage' => self::getReferenceImageNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a product + * resource. + * + * @param string $project + * @param string $location + * @param string $product + * + * @return string The formatted product resource. + */ + public static function productName($project, $location, $product) + { + return self::getProductNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'product' => $product, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a product_set + * resource. + * + * @param string $project + * @param string $location + * @param string $productSet + * + * @return string The formatted product_set resource. + */ + public static function productSetName($project, $location, $productSet) + { + return self::getProductSetNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'product_set' => $productSet, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * reference_image resource. + * + * @param string $project + * @param string $location + * @param string $product + * @param string $referenceImage + * + * @return string The formatted reference_image resource. + */ + public static function referenceImageName( + $project, + $location, + $product, + $referenceImage + ) { + return self::getReferenceImageNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'product' => $product, + 'reference_image' => $referenceImage, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - location: projects/{project}/locations/{location} + * - product: projects/{project}/locations/{location}/products/{product} + * - productSet: projects/{project}/locations/{location}/productSets/{product_set} + * - referenceImage: projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException( + "Template name $template does not exist" + ); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException( + "Input did not match any known format. Input: $formattedName" + ); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; + $operation = new OperationResponse( + $operationName, + $this->getOperationsClient(), + $options + ); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $serviceAddress + * **Deprecated**. This option will be removed in a future major release. Please + * utilize the `$apiEndpoint` option instead. + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'vision.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $serviceAddress setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Adds a Product to the specified ProductSet. If the Product is already + * present, no change is made. + * + * One Product can be added to at most 100 ProductSets. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $formattedProduct = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $productSearchClient->addProductToProductSet($formattedName, $formattedProduct); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param string $product Required. The resource name for the Product to be added to this ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function addProductToProductSet( + $name, + $product, + array $optionalArgs = [] + ) { + $request = new AddProductToProductSetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setProduct($product); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'AddProductToProductSet', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Creates and returns a new product resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if description is longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is missing or invalid. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * $product = new Product(); + * $response = $productSearchClient->createProduct($formattedParent, $product); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. The project in which the Product should be created. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * @param Product $product Required. The product to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $productId + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\Product + * + * @throws ApiException if the remote call fails + */ + public function createProduct($parent, $product, array $optionalArgs = []) + { + $request = new CreateProductRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setProduct($product); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['productId'])) { + $request->setProductId($optionalArgs['productId']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'CreateProduct', + Product::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Creates and returns a new ProductSet resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing, or is longer than + * 4096 characters. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * $productSet = new ProductSet(); + * $response = $productSearchClient->createProductSet($formattedParent, $productSet); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. The project in which the ProductSet should be created. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param ProductSet $productSet Required. The ProductSet to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $productSetId + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\ProductSet + * + * @throws ApiException if the remote call fails + */ + public function createProductSet( + $parent, + $productSet, + array $optionalArgs = [] + ) { + $request = new CreateProductSetRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setProductSet($productSet); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['productSetId'])) { + $request->setProductSetId($optionalArgs['productSetId']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'CreateProductSet', + ProductSet::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Creates and returns a new ReferenceImage resource. + * + * The `bounding_poly` field is optional. If `bounding_poly` is not specified, + * the system will try to detect regions of interest in the image that are + * compatible with the product_category on the parent product. If it is + * specified, detection is ALWAYS skipped. The system converts polygons into + * non-rotated rectangles. + * + * Note that the pipeline will resize the image if the image resolution is too + * large to process (above 50MP). + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if the product does not exist. + * * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing + * compatible with the parent product's product_category is detected. + * * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $referenceImage = new ReferenceImage(); + * $response = $productSearchClient->createReferenceImage($formattedParent, $referenceImage); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. Resource name of the product in which to create the reference image. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param ReferenceImage $referenceImage Required. The reference image to create. + * If an image ID is specified, it is ignored. + * @param array $optionalArgs { + * Optional. + * + * @type string $referenceImageId + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\ReferenceImage + * + * @throws ApiException if the remote call fails + */ + public function createReferenceImage( + $parent, + $referenceImage, + array $optionalArgs = [] + ) { + $request = new CreateReferenceImageRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setReferenceImage($referenceImage); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['referenceImageId'])) { + $request->setReferenceImageId($optionalArgs['referenceImageId']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'CreateReferenceImage', + ReferenceImage::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Permanently deletes a product and its reference images. + * + * Metadata of the product and all its images will be deleted right away, but + * search queries against ProductSets containing the product may still work + * until all related caches are refreshed. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $productSearchClient->deleteProduct($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of product to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteProduct($name, array $optionalArgs = []) + { + $request = new DeleteProductRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'DeleteProduct', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Permanently deletes a ProductSet. Products and ReferenceImages in the + * ProductSet are not deleted. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $productSearchClient->deleteProductSet($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the ProductSet to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteProductSet($name, array $optionalArgs = []) + { + $request = new DeleteProductSetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'DeleteProductSet', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Permanently deletes a reference image. + * + * The image metadata will be deleted right away, but search queries + * against ProductSets containing the image may still work until all related + * caches are refreshed. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); + * $productSearchClient->deleteReferenceImage($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the reference image to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteReferenceImage($name, array $optionalArgs = []) + { + $request = new DeleteReferenceImageRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'DeleteReferenceImage', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets information associated with a Product. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $response = $productSearchClient->getProduct($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the Product to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\Product + * + * @throws ApiException if the remote call fails + */ + public function getProduct($name, array $optionalArgs = []) + { + $request = new GetProductRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GetProduct', + Product::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets information associated with a ProductSet. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $response = $productSearchClient->getProductSet($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the ProductSet to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\ProductSet + * + * @throws ApiException if the remote call fails + */ + public function getProductSet($name, array $optionalArgs = []) + { + $request = new GetProductSetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GetProductSet', + ProductSet::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets information associated with a ReferenceImage. + * + * Possible errors: + * + * * Returns NOT_FOUND if the specified image does not exist. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); + * $response = $productSearchClient->getReferenceImage($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the ReferenceImage to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\ReferenceImage + * + * @throws ApiException if the remote call fails + */ + public function getReferenceImage($name, array $optionalArgs = []) + { + $request = new GetReferenceImageRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GetReferenceImage', + ReferenceImage::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Asynchronous API that imports a list of reference images to specified + * product sets based on a list of image information. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the + * progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * `Operation.response` contains `ImportProductSetsResponse`. (results) + * + * The input source of this method is a csv file on Google Cloud Storage. + * For the format of the csv file please see + * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * $inputConfig = new ImportProductSetsInputConfig(); + * $operationResponse = $productSearchClient->importProductSets($formattedParent, $inputConfig); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $productSearchClient->importProductSets($formattedParent, $inputConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $productSearchClient->resumeOperation($operationName, 'importProductSets'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. The project in which the ProductSets should be imported. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param ImportProductSetsInputConfig $inputConfig Required. The input content for the list of requests. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function importProductSets( + $parent, + $inputConfig, + array $optionalArgs = [] + ) { + $request = new ImportProductSetsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInputConfig($inputConfig); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'ImportProductSets', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Lists ProductSets in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less + * than 1. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $productSearchClient->listProductSets($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $productSearchClient->listProductSets($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. The project from which ProductSets should be listed. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listProductSets($parent, array $optionalArgs = []) + { + $request = new ListProductSetsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( + 'ListProductSets', + $optionalArgs, + ListProductSetsResponse::class, + $request + ); + } + + /** + * Lists products in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $productSearchClient->listProducts($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $productSearchClient->listProducts($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. The project OR ProductSet from which Products should be listed. + * + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listProducts($parent, array $optionalArgs = []) + { + $request = new ListProductsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( + 'ListProducts', + $optionalArgs, + ListProductsResponse::class, + $request + ); + } + + /** + * Lists the Products in a ProductSet, in an unspecified order. If the + * ProductSet does not exist, the products field of the response will be + * empty. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * // Iterate over pages of elements + * $pagedResponse = $productSearchClient->listProductsInProductSet($formattedName); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $productSearchClient->listProductsInProductSet($formattedName); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. The ProductSet resource for which to retrieve Products. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listProductsInProductSet($name, array $optionalArgs = []) + { + $request = new ListProductsInProductSetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( + 'ListProductsInProductSet', + $optionalArgs, + ListProductsInProductSetResponse::class, + $request + ); + } + + /** + * Lists reference images. + * + * Possible errors: + * + * * Returns NOT_FOUND if the parent product does not exist. + * * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less + * than 1. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * // Iterate over pages of elements + * $pagedResponse = $productSearchClient->listReferenceImages($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $productSearchClient->listReferenceImages($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. Resource name of the product containing the reference images. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listReferenceImages($parent, array $optionalArgs = []) + { + $request = new ListReferenceImagesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( + 'ListReferenceImages', + $optionalArgs, + ListReferenceImagesResponse::class, + $request + ); + } + + /** + * Asynchronous API to delete all Products in a ProductSet or all Products + * that are in no ProductSet. + * + * If a Product is a member of the specified ProductSet in addition to other + * ProductSets, the Product will still be deleted. + * + * It is recommended to not delete the specified ProductSet until after this + * operation has completed. It is also recommended to not add any of the + * Products involved in the batch delete to a new ProductSet while this + * operation is running because those Products may still end up deleted. + * + * It's not possible to undo the PurgeProducts operation. Therefore, it is + * recommended to keep the csv files used in ImportProductSets (if that was + * how you originally built the Product Set) before starting PurgeProducts, in + * case you need to re-import the data after deletion. + * + * If the plan is to purge all of the Products from a ProductSet and then + * re-use the empty ProductSet to re-import new Products into the empty + * ProductSet, you must wait until the PurgeProducts operation has finished + * for that ProductSet. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the + * progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * $operationResponse = $productSearchClient->purgeProducts($formattedParent); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $productSearchClient->purgeProducts($formattedParent); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $productSearchClient->resumeOperation($operationName, 'purgeProducts'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location in which the Products should be deleted. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param array $optionalArgs { + * Optional. + * + * @type ProductSetPurgeConfig $productSetPurgeConfig + * Specify which ProductSet contains the Products to be deleted. + * @type bool $deleteOrphanProducts + * If delete_orphan_products is true, all Products that are not in any + * ProductSet will be deleted. + * @type bool $force + * The default value is false. Override this value to true to actually perform + * the purge. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function purgeProducts($parent, array $optionalArgs = []) + { + $request = new PurgeProductsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['productSetPurgeConfig'])) { + $request->setProductSetPurgeConfig( + $optionalArgs['productSetPurgeConfig'] + ); + } + + if (isset($optionalArgs['deleteOrphanProducts'])) { + $request->setDeleteOrphanProducts( + $optionalArgs['deleteOrphanProducts'] + ); + } + + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'PurgeProducts', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Removes a Product from the specified ProductSet. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $formattedProduct = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $productSearchClient->removeProductFromProductSet($formattedName, $formattedProduct); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param string $product Required. The resource name for the Product to be removed from this ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function removeProductFromProductSet( + $name, + $product, + array $optionalArgs = [] + ) { + $request = new RemoveProductFromProductSetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setProduct($product); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'RemoveProductFromProductSet', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Makes changes to a Product resource. + * Only the `display_name`, `description`, and `labels` fields can be updated + * right now. + * + * If labels are updated, the change will not be reflected in queries until + * the next index time. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is + * missing from the request or longer than 4096 characters. + * * Returns INVALID_ARGUMENT if description is present in update_mask but is + * longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is present in update_mask. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $product = new Product(); + * $response = $productSearchClient->updateProduct($product); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param Product $product Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\Product + * + * @throws ApiException if the remote call fails + */ + public function updateProduct($product, array $optionalArgs = []) + { + $request = new UpdateProductRequest(); + $requestParamHeaders = []; + $request->setProduct($product); + $requestParamHeaders['product.name'] = $product->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'UpdateProduct', + Product::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Makes changes to a ProductSet resource. + * Only display_name can be updated currently. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but + * missing from the request or longer than 4096 characters. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $productSet = new ProductSet(); + * $response = $productSearchClient->updateProductSet($productSet); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param ProductSet $productSet Required. The ProductSet resource which replaces the one on the server. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\ProductSet + * + * @throws ApiException if the remote call fails + */ + public function updateProductSet($productSet, array $optionalArgs = []) + { + $request = new UpdateProductSetRequest(); + $requestParamHeaders = []; + $request->setProductSet($productSet); + $requestParamHeaders['product_set.name'] = $productSet->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'UpdateProductSet', + ProductSet::class, + $optionalArgs, + $request + )->wait(); + } +} diff --git a/vendor/google/cloud-vision/src/V1/GcsDestination.php b/vendor/google/cloud-vision/src/V1/GcsDestination.php new file mode 100644 index 00000000..ea60023f --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/GcsDestination.php @@ -0,0 +1,135 @@ +google.cloud.vision.v1.GcsDestination + */ +class GcsDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Google Cloud Storage URI prefix where the results will be stored. Results + * will be in JSON format and preceded by its corresponding input URI prefix. + * This field can either represent a gcs file prefix or gcs directory. In + * either case, the uri should be unique because in order to get all of the + * output files, you will need to do a wildcard gcs search on the uri prefix + * you provide. + * Examples: + * * File Prefix: gs://bucket-name/here/filenameprefix The output files + * will be created in gs://bucket-name/here/ and the names of the + * output files will begin with "filenameprefix". + * * Directory Prefix: gs://bucket-name/some/location/ The output files + * will be created in gs://bucket-name/some/location/ and the names of the + * output files could be anything because there was no filename prefix + * specified. + * If multiple outputs, each response is still AnnotateFileResponse, each of + * which contains some subset of the full list of AnnotateImageResponse. + * Multiple outputs can happen if, for example, the output JSON is too large + * and overflows into multiple sharded files. + * + * Generated from protobuf field string uri = 1; + */ + private $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Google Cloud Storage URI prefix where the results will be stored. Results + * will be in JSON format and preceded by its corresponding input URI prefix. + * This field can either represent a gcs file prefix or gcs directory. In + * either case, the uri should be unique because in order to get all of the + * output files, you will need to do a wildcard gcs search on the uri prefix + * you provide. + * Examples: + * * File Prefix: gs://bucket-name/here/filenameprefix The output files + * will be created in gs://bucket-name/here/ and the names of the + * output files will begin with "filenameprefix". + * * Directory Prefix: gs://bucket-name/some/location/ The output files + * will be created in gs://bucket-name/some/location/ and the names of the + * output files could be anything because there was no filename prefix + * specified. + * If multiple outputs, each response is still AnnotateFileResponse, each of + * which contains some subset of the full list of AnnotateImageResponse. + * Multiple outputs can happen if, for example, the output JSON is too large + * and overflows into multiple sharded files. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud Storage URI prefix where the results will be stored. Results + * will be in JSON format and preceded by its corresponding input URI prefix. + * This field can either represent a gcs file prefix or gcs directory. In + * either case, the uri should be unique because in order to get all of the + * output files, you will need to do a wildcard gcs search on the uri prefix + * you provide. + * Examples: + * * File Prefix: gs://bucket-name/here/filenameprefix The output files + * will be created in gs://bucket-name/here/ and the names of the + * output files will begin with "filenameprefix". + * * Directory Prefix: gs://bucket-name/some/location/ The output files + * will be created in gs://bucket-name/some/location/ and the names of the + * output files could be anything because there was no filename prefix + * specified. + * If multiple outputs, each response is still AnnotateFileResponse, each of + * which contains some subset of the full list of AnnotateImageResponse. + * Multiple outputs can happen if, for example, the output JSON is too large + * and overflows into multiple sharded files. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Google Cloud Storage URI prefix where the results will be stored. Results + * will be in JSON format and preceded by its corresponding input URI prefix. + * This field can either represent a gcs file prefix or gcs directory. In + * either case, the uri should be unique because in order to get all of the + * output files, you will need to do a wildcard gcs search on the uri prefix + * you provide. + * Examples: + * * File Prefix: gs://bucket-name/here/filenameprefix The output files + * will be created in gs://bucket-name/here/ and the names of the + * output files will begin with "filenameprefix". + * * Directory Prefix: gs://bucket-name/some/location/ The output files + * will be created in gs://bucket-name/some/location/ and the names of the + * output files could be anything because there was no filename prefix + * specified. + * If multiple outputs, each response is still AnnotateFileResponse, each of + * which contains some subset of the full list of AnnotateImageResponse. + * Multiple outputs can happen if, for example, the output JSON is too large + * and overflows into multiple sharded files. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/GcsSource.php b/vendor/google/cloud-vision/src/V1/GcsSource.php new file mode 100644 index 00000000..1eb1af8f --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/GcsSource.php @@ -0,0 +1,71 @@ +google.cloud.vision.v1.GcsSource + */ +class GcsSource extends \Google\Protobuf\Internal\Message +{ + /** + * Google Cloud Storage URI for the input file. This must only be a + * Google Cloud Storage object. Wildcards are not currently supported. + * + * Generated from protobuf field string uri = 1; + */ + private $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Google Cloud Storage URI for the input file. This must only be a + * Google Cloud Storage object. Wildcards are not currently supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud Storage URI for the input file. This must only be a + * Google Cloud Storage object. Wildcards are not currently supported. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Google Cloud Storage URI for the input file. This must only be a + * Google Cloud Storage object. Wildcards are not currently supported. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/GetProductRequest.php b/vendor/google/cloud-vision/src/V1/GetProductRequest.php new file mode 100644 index 00000000..470e3154 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/GetProductRequest.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.GetProductRequest + */ +class GetProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the Product to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the Product to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the Product to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the Product to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/GetProductSetRequest.php b/vendor/google/cloud-vision/src/V1/GetProductSetRequest.php new file mode 100644 index 00000000..5f2e334a --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/GetProductSetRequest.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.GetProductSetRequest + */ +class GetProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the ProductSet to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the ProductSet to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the ProductSet to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the ProductSet to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/GetReferenceImageRequest.php b/vendor/google/cloud-vision/src/V1/GetReferenceImageRequest.php new file mode 100644 index 00000000..dbe3f122 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/GetReferenceImageRequest.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.GetReferenceImageRequest + */ +class GetReferenceImageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the ReferenceImage to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the ReferenceImage to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the ReferenceImage to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the ReferenceImage to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/Image.php b/vendor/google/cloud-vision/src/V1/Image.php new file mode 100644 index 00000000..f85626a1 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Image.php @@ -0,0 +1,135 @@ +google.cloud.vision.v1.Image + */ +class Image extends \Google\Protobuf\Internal\Message +{ + /** + * Image content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateImages requests. It does + * not work for AsyncBatchAnnotateImages requests. + * + * Generated from protobuf field bytes content = 1; + */ + private $content = ''; + /** + * Google Cloud Storage image location, or publicly-accessible image + * URL. If both `content` and `source` are provided for an image, `content` + * takes precedence and is used to perform the image annotation request. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageSource source = 2; + */ + private $source = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * Image content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateImages requests. It does + * not work for AsyncBatchAnnotateImages requests. + * @type \Google\Cloud\Vision\V1\ImageSource $source + * Google Cloud Storage image location, or publicly-accessible image + * URL. If both `content` and `source` are provided for an image, `content` + * takes precedence and is used to perform the image annotation request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Image content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateImages requests. It does + * not work for AsyncBatchAnnotateImages requests. + * + * Generated from protobuf field bytes content = 1; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Image content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateImages requests. It does + * not work for AsyncBatchAnnotateImages requests. + * + * Generated from protobuf field bytes content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->content = $var; + + return $this; + } + + /** + * Google Cloud Storage image location, or publicly-accessible image + * URL. If both `content` and `source` are provided for an image, `content` + * takes precedence and is used to perform the image annotation request. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageSource source = 2; + * @return \Google\Cloud\Vision\V1\ImageSource|null + */ + public function getSource() + { + return $this->source; + } + + public function hasSource() + { + return isset($this->source); + } + + public function clearSource() + { + unset($this->source); + } + + /** + * Google Cloud Storage image location, or publicly-accessible image + * URL. If both `content` and `source` are provided for an image, `content` + * takes precedence and is used to perform the image annotation request. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageSource source = 2; + * @param \Google\Cloud\Vision\V1\ImageSource $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageSource::class); + $this->source = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ImageAnnotationContext.php b/vendor/google/cloud-vision/src/V1/ImageAnnotationContext.php new file mode 100644 index 00000000..4f8c2438 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ImageAnnotationContext.php @@ -0,0 +1,106 @@ +google.cloud.vision.v1.ImageAnnotationContext + */ +class ImageAnnotationContext extends \Google\Protobuf\Internal\Message +{ + /** + * The URI of the file used to produce the image. + * + * Generated from protobuf field string uri = 1; + */ + private $uri = ''; + /** + * If the file was a PDF or TIFF, this field gives the page number within + * the file used to produce the image. + * + * Generated from protobuf field int32 page_number = 2; + */ + private $page_number = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * The URI of the file used to produce the image. + * @type int $page_number + * If the file was a PDF or TIFF, this field gives the page number within + * the file used to produce the image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The URI of the file used to produce the image. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * The URI of the file used to produce the image. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * If the file was a PDF or TIFF, this field gives the page number within + * the file used to produce the image. + * + * Generated from protobuf field int32 page_number = 2; + * @return int + */ + public function getPageNumber() + { + return $this->page_number; + } + + /** + * If the file was a PDF or TIFF, this field gives the page number within + * the file used to produce the image. + * + * Generated from protobuf field int32 page_number = 2; + * @param int $var + * @return $this + */ + public function setPageNumber($var) + { + GPBUtil::checkInt32($var); + $this->page_number = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ImageAnnotatorClient.php b/vendor/google/cloud-vision/src/V1/ImageAnnotatorClient.php new file mode 100644 index 00000000..98781364 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ImageAnnotatorClient.php @@ -0,0 +1,558 @@ +createImageObject($imageResource); + * $response = $imageAnnotatorClient->faceDetection($image); + * ``` + * + * ``` + * //[snippet=data] + * $imageData = file_get_contents('path/to/image.jpg'); + * $image = $imageAnnotatorClient->createImageObject($imageData); + * $response = $imageAnnotatorClient->faceDetection($image); + * ``` + * + * ``` + * //[snippet=url] + * $imageUri = "gs://my-bucket/image.jpg"; + * $image = $imageAnnotatorClient->createImageObject($imageUri); + * $response = $imageAnnotatorClient->faceDetection($image); + * ``` + * + * @param resource|string $imageInput An image to configure with + * the given settings. This parameter will accept a resource, a + * string of bytes, or the URI of an image in a publicly-accessible + * web location. + * @return Image + * @throws InvalidArgumentException + */ + public function createImageObject($imageInput) + { + return $this->createImageHelper(Image::class, ImageSource::class, $imageInput); + } + + /** + * Run image detection and annotation for an image. + * + * Example: + * ``` + * use Google\Cloud\Vision\V1\Feature; + * use Google\Cloud\Vision\V1\Feature\Type; + * + * $imageResource = fopen('path/to/image.jpg', 'r'); + * $features = [Type::FACE_DETECTION]; + * $response = $imageAnnotatorClient->annotateImage($imageResource, $features); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param Feature[]|int[] $features Requested features. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function annotateImage($image, $features, $optionalArgs = []) + { + $image = $this->createImageObject($image); + return $this->annotateImageHelper( + [$this, 'batchAnnotateImages'], + AnnotateImageRequest::class, + $image, + $features, + $optionalArgs + ); + } + + /** + * Run face detection for an image. + * + * Example: + * ``` + * $imageContent = file_get_contents('path/to/image.jpg'); + * $response = $imageAnnotatorClient->faceDetection($imageContent); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function faceDetection($image, $optionalArgs = []) + { + return $this->annotateSingleFeature( + $image, + Type::FACE_DETECTION, + $optionalArgs + ); + } + + /** + * Run landmark detection for an image. + * + * Example: + * ``` + * $imageContent = file_get_contents('path/to/image.jpg'); + * $response = $imageAnnotatorClient->landmarkDetection($imageContent); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function landmarkDetection($image, $optionalArgs = []) + { + return $this->annotateSingleFeature( + $image, + Type::LANDMARK_DETECTION, + $optionalArgs + ); + } + + /** + * Run logo detection for an image. + * + * Example: + * ``` + * $imageContent = file_get_contents('path/to/image.jpg'); + * $response = $imageAnnotatorClient->logoDetection($imageContent); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function logoDetection($image, $optionalArgs = []) + { + return $this->annotateSingleFeature( + $image, + Type::LOGO_DETECTION, + $optionalArgs + ); + } + + /** + * Run label detection for an image. + * + * Example: + * ``` + * $imageContent = file_get_contents('path/to/image.jpg'); + * $response = $imageAnnotatorClient->labelDetection($imageContent); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function labelDetection($image, $optionalArgs = []) + { + return $this->annotateSingleFeature( + $image, + Type::LABEL_DETECTION, + $optionalArgs + ); + } + + /** + * Run text detection for an image. + * + * Example: + * ``` + * $imageContent = file_get_contents('path/to/image.jpg'); + * $response = $imageAnnotatorClient->textDetection($imageContent); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function textDetection($image, $optionalArgs = []) + { + return $this->annotateSingleFeature( + $image, + Type::TEXT_DETECTION, + $optionalArgs + ); + } + + /** + * Run document text detection for an image. + * + * Example: + * ``` + * $imageContent = file_get_contents('path/to/image.jpg'); + * $response = $imageAnnotatorClient->documentTextDetection($imageContent); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function documentTextDetection($image, $optionalArgs = []) + { + return $this->annotateSingleFeature( + $image, + Type::DOCUMENT_TEXT_DETECTION, + $optionalArgs + ); + } + + /** + * Run safe search detection for an image. + * + * Example: + * ``` + * $imageContent = file_get_contents('path/to/image.jpg'); + * $response = $imageAnnotatorClient->safeSearchDetection($imageContent); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function safeSearchDetection($image, $optionalArgs = []) + { + return $this->annotateSingleFeature( + $image, + Type::SAFE_SEARCH_DETECTION, + $optionalArgs + ); + } + + /** + * Run image properties detection for an image. + * + * Example: + * ``` + * $imageContent = file_get_contents('path/to/image.jpg'); + * $response = $imageAnnotatorClient->imagePropertiesDetection($imageContent); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function imagePropertiesDetection($image, $optionalArgs = []) + { + return $this->annotateSingleFeature( + $image, + Type::IMAGE_PROPERTIES, + $optionalArgs + ); + } + + /** + * Run crop hints detection for an image. + * + * Example: + * ``` + * $imageContent = file_get_contents('path/to/image.jpg'); + * $response = $imageAnnotatorClient->cropHintsDetection($imageContent); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function cropHintsDetection($image, $optionalArgs = []) + { + return $this->annotateSingleFeature( + $image, + Type::CROP_HINTS, + $optionalArgs + ); + } + + /** + * Run web detection for an image. + * + * Example: + * ``` + * $imageContent = file_get_contents('path/to/image.jpg'); + * $response = $imageAnnotatorClient->webDetection($imageContent); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function webDetection($image, $optionalArgs = []) + { + return $this->annotateSingleFeature( + $image, + Type::WEB_DETECTION, + $optionalArgs + ); + } + + /** + * Run object localization for an image. + * + * Example: + * ``` + * $imageContent = file_get_contents('path/to/image.jpg'); + * $response = $imageAnnotatorClient->objectLocalization($imageContent); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function objectLocalization($image, $optionalArgs = []) + { + return $this->annotateSingleFeature( + $image, + Type::OBJECT_LOCALIZATION, + $optionalArgs + ); + } + + /** + * Run product search for an image. + * + * Example: + * ``` + * use Google\Cloud\Vision\V1\ProductSearchClient; + * use Google\Cloud\Vision\V1\ProductSearchParams; + * + * $imageContent = file_get_contents('path/to/image.jpg'); + * $productSetName = ProductSearchClient::productSetName('PROJECT_ID', 'LOC_ID', 'PRODUCT_SET_ID'); + * $productSearchParams = (new ProductSearchParams) + * ->setProductSet($productSetName); + * $response = $imageAnnotatorClient->productSearch( + * $imageContent, + * $productSearchParams + * ); + * ``` + * + * @param resource|string|Image $image The image to be processed. + * @param ProductSearchParams $productSearchParams Parameters for a product search request. Please note, this + * value will override the {@see Google\Cloud\Vision\V1\ProductSearchParams} in the + * {@see Google\Cloud\Vision\V1\ImageContext} instance if provided. + * @param array $optionalArgs { + * Configuration Options. + * + * @type ImageContext $imageContext Additional context that may accompany the image. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return AnnotateImageResponse + * + * @throws ApiException if the remote call fails + */ + public function productSearch($image, ProductSearchParams $productSearchParams, $optionalArgs = []) + { + if (isset($optionalArgs['imageContext']) && $optionalArgs['imageContext'] instanceof ImageContext) { + $optionalArgs['imageContext']->setProductSearchParams($productSearchParams); + } else { + $optionalArgs['imageContext'] = (new ImageContext) + ->setProductSearchParams($productSearchParams); + } + + return $this->annotateSingleFeature( + $image, + Type::PRODUCT_SEARCH, + $optionalArgs + ); + } + + /** + * @param Image $image + * @param Feature|int $featureType + * @param array $optionalArgs + * @return AnnotateImageResponse + */ + private function annotateSingleFeature($image, $featureType, $optionalArgs) + { + return $this->annotateImage($image, [$featureType], $optionalArgs); + } +} diff --git a/vendor/google/cloud-vision/src/V1/ImageAnnotatorGrpcClient.php b/vendor/google/cloud-vision/src/V1/ImageAnnotatorGrpcClient.php new file mode 100644 index 00000000..02ed6127 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ImageAnnotatorGrpcClient.php @@ -0,0 +1,116 @@ +_simpleRequest('/google.cloud.vision.v1.ImageAnnotator/BatchAnnotateImages', + $argument, + ['\Google\Cloud\Vision\V1\BatchAnnotateImagesResponse', 'decode'], + $metadata, $options); + } + + /** + * Service that performs image detection and annotation for a batch of files. + * Now only "application/pdf", "image/tiff" and "image/gif" are supported. + * + * This service will extract at most 5 (customers can specify which 5 in + * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each + * file provided and perform detection and annotation for each image + * extracted. + * @param \Google\Cloud\Vision\V1\BatchAnnotateFilesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function BatchAnnotateFiles(\Google\Cloud\Vision\V1\BatchAnnotateFilesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ImageAnnotator/BatchAnnotateFiles', + $argument, + ['\Google\Cloud\Vision\V1\BatchAnnotateFilesResponse', 'decode'], + $metadata, $options); + } + + /** + * Run asynchronous image detection and annotation for a list of images. + * + * Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results). + * + * This service will write image annotation outputs to json files in customer + * GCS bucket, each json file containing BatchAnnotateImagesResponse proto. + * @param \Google\Cloud\Vision\V1\AsyncBatchAnnotateImagesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AsyncBatchAnnotateImages(\Google\Cloud\Vision\V1\AsyncBatchAnnotateImagesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ImageAnnotator/AsyncBatchAnnotateImages', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Run asynchronous image detection and annotation for a list of generic + * files, such as PDF files, which may contain multiple pages and multiple + * images per page. Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). + * @param \Google\Cloud\Vision\V1\AsyncBatchAnnotateFilesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AsyncBatchAnnotateFiles(\Google\Cloud\Vision\V1\AsyncBatchAnnotateFilesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ImageAnnotator/AsyncBatchAnnotateFiles', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/vendor/google/cloud-vision/src/V1/ImageContext.php b/vendor/google/cloud-vision/src/V1/ImageContext.php new file mode 100644 index 00000000..dad49bd0 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ImageContext.php @@ -0,0 +1,315 @@ +google.cloud.vision.v1.ImageContext + */ +class ImageContext extends \Google\Protobuf\Internal\Message +{ + /** + * Not used. + * + * Generated from protobuf field .google.cloud.vision.v1.LatLongRect lat_long_rect = 1; + */ + private $lat_long_rect = null; + /** + * List of languages to use for TEXT_DETECTION. In most cases, an empty value + * yields the best results since it enables automatic language detection. For + * languages based on the Latin alphabet, setting `language_hints` is not + * needed. In rare cases, when the language of the text in the image is known, + * setting a hint will help get better results (although it will be a + * significant hindrance if the hint is wrong). Text detection returns an + * error if one or more of the specified languages is not one of the + * [supported languages](https://cloud.google.com/vision/docs/languages). + * + * Generated from protobuf field repeated string language_hints = 2; + */ + private $language_hints; + /** + * Parameters for crop hints annotation request. + * + * Generated from protobuf field .google.cloud.vision.v1.CropHintsParams crop_hints_params = 4; + */ + private $crop_hints_params = null; + /** + * Parameters for product search. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchParams product_search_params = 5; + */ + private $product_search_params = null; + /** + * Parameters for web detection. + * + * Generated from protobuf field .google.cloud.vision.v1.WebDetectionParams web_detection_params = 6; + */ + private $web_detection_params = null; + /** + * Parameters for text detection and document text detection. + * + * Generated from protobuf field .google.cloud.vision.v1.TextDetectionParams text_detection_params = 12; + */ + private $text_detection_params = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\LatLongRect $lat_long_rect + * Not used. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $language_hints + * List of languages to use for TEXT_DETECTION. In most cases, an empty value + * yields the best results since it enables automatic language detection. For + * languages based on the Latin alphabet, setting `language_hints` is not + * needed. In rare cases, when the language of the text in the image is known, + * setting a hint will help get better results (although it will be a + * significant hindrance if the hint is wrong). Text detection returns an + * error if one or more of the specified languages is not one of the + * [supported languages](https://cloud.google.com/vision/docs/languages). + * @type \Google\Cloud\Vision\V1\CropHintsParams $crop_hints_params + * Parameters for crop hints annotation request. + * @type \Google\Cloud\Vision\V1\ProductSearchParams $product_search_params + * Parameters for product search. + * @type \Google\Cloud\Vision\V1\WebDetectionParams $web_detection_params + * Parameters for web detection. + * @type \Google\Cloud\Vision\V1\TextDetectionParams $text_detection_params + * Parameters for text detection and document text detection. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Not used. + * + * Generated from protobuf field .google.cloud.vision.v1.LatLongRect lat_long_rect = 1; + * @return \Google\Cloud\Vision\V1\LatLongRect|null + */ + public function getLatLongRect() + { + return $this->lat_long_rect; + } + + public function hasLatLongRect() + { + return isset($this->lat_long_rect); + } + + public function clearLatLongRect() + { + unset($this->lat_long_rect); + } + + /** + * Not used. + * + * Generated from protobuf field .google.cloud.vision.v1.LatLongRect lat_long_rect = 1; + * @param \Google\Cloud\Vision\V1\LatLongRect $var + * @return $this + */ + public function setLatLongRect($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\LatLongRect::class); + $this->lat_long_rect = $var; + + return $this; + } + + /** + * List of languages to use for TEXT_DETECTION. In most cases, an empty value + * yields the best results since it enables automatic language detection. For + * languages based on the Latin alphabet, setting `language_hints` is not + * needed. In rare cases, when the language of the text in the image is known, + * setting a hint will help get better results (although it will be a + * significant hindrance if the hint is wrong). Text detection returns an + * error if one or more of the specified languages is not one of the + * [supported languages](https://cloud.google.com/vision/docs/languages). + * + * Generated from protobuf field repeated string language_hints = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLanguageHints() + { + return $this->language_hints; + } + + /** + * List of languages to use for TEXT_DETECTION. In most cases, an empty value + * yields the best results since it enables automatic language detection. For + * languages based on the Latin alphabet, setting `language_hints` is not + * needed. In rare cases, when the language of the text in the image is known, + * setting a hint will help get better results (although it will be a + * significant hindrance if the hint is wrong). Text detection returns an + * error if one or more of the specified languages is not one of the + * [supported languages](https://cloud.google.com/vision/docs/languages). + * + * Generated from protobuf field repeated string language_hints = 2; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLanguageHints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->language_hints = $arr; + + return $this; + } + + /** + * Parameters for crop hints annotation request. + * + * Generated from protobuf field .google.cloud.vision.v1.CropHintsParams crop_hints_params = 4; + * @return \Google\Cloud\Vision\V1\CropHintsParams|null + */ + public function getCropHintsParams() + { + return $this->crop_hints_params; + } + + public function hasCropHintsParams() + { + return isset($this->crop_hints_params); + } + + public function clearCropHintsParams() + { + unset($this->crop_hints_params); + } + + /** + * Parameters for crop hints annotation request. + * + * Generated from protobuf field .google.cloud.vision.v1.CropHintsParams crop_hints_params = 4; + * @param \Google\Cloud\Vision\V1\CropHintsParams $var + * @return $this + */ + public function setCropHintsParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\CropHintsParams::class); + $this->crop_hints_params = $var; + + return $this; + } + + /** + * Parameters for product search. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchParams product_search_params = 5; + * @return \Google\Cloud\Vision\V1\ProductSearchParams|null + */ + public function getProductSearchParams() + { + return $this->product_search_params; + } + + public function hasProductSearchParams() + { + return isset($this->product_search_params); + } + + public function clearProductSearchParams() + { + unset($this->product_search_params); + } + + /** + * Parameters for product search. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchParams product_search_params = 5; + * @param \Google\Cloud\Vision\V1\ProductSearchParams $var + * @return $this + */ + public function setProductSearchParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSearchParams::class); + $this->product_search_params = $var; + + return $this; + } + + /** + * Parameters for web detection. + * + * Generated from protobuf field .google.cloud.vision.v1.WebDetectionParams web_detection_params = 6; + * @return \Google\Cloud\Vision\V1\WebDetectionParams|null + */ + public function getWebDetectionParams() + { + return $this->web_detection_params; + } + + public function hasWebDetectionParams() + { + return isset($this->web_detection_params); + } + + public function clearWebDetectionParams() + { + unset($this->web_detection_params); + } + + /** + * Parameters for web detection. + * + * Generated from protobuf field .google.cloud.vision.v1.WebDetectionParams web_detection_params = 6; + * @param \Google\Cloud\Vision\V1\WebDetectionParams $var + * @return $this + */ + public function setWebDetectionParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\WebDetectionParams::class); + $this->web_detection_params = $var; + + return $this; + } + + /** + * Parameters for text detection and document text detection. + * + * Generated from protobuf field .google.cloud.vision.v1.TextDetectionParams text_detection_params = 12; + * @return \Google\Cloud\Vision\V1\TextDetectionParams|null + */ + public function getTextDetectionParams() + { + return $this->text_detection_params; + } + + public function hasTextDetectionParams() + { + return isset($this->text_detection_params); + } + + public function clearTextDetectionParams() + { + unset($this->text_detection_params); + } + + /** + * Parameters for text detection and document text detection. + * + * Generated from protobuf field .google.cloud.vision.v1.TextDetectionParams text_detection_params = 12; + * @param \Google\Cloud\Vision\V1\TextDetectionParams $var + * @return $this + */ + public function setTextDetectionParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextDetectionParams::class); + $this->text_detection_params = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ImageProperties.php b/vendor/google/cloud-vision/src/V1/ImageProperties.php new file mode 100644 index 00000000..a4b5f875 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ImageProperties.php @@ -0,0 +1,77 @@ +google.cloud.vision.v1.ImageProperties + */ +class ImageProperties extends \Google\Protobuf\Internal\Message +{ + /** + * If present, dominant colors completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.DominantColorsAnnotation dominant_colors = 1; + */ + private $dominant_colors = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\DominantColorsAnnotation $dominant_colors + * If present, dominant colors completed successfully. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * If present, dominant colors completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.DominantColorsAnnotation dominant_colors = 1; + * @return \Google\Cloud\Vision\V1\DominantColorsAnnotation|null + */ + public function getDominantColors() + { + return $this->dominant_colors; + } + + public function hasDominantColors() + { + return isset($this->dominant_colors); + } + + public function clearDominantColors() + { + unset($this->dominant_colors); + } + + /** + * If present, dominant colors completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.DominantColorsAnnotation dominant_colors = 1; + * @param \Google\Cloud\Vision\V1\DominantColorsAnnotation $var + * @return $this + */ + public function setDominantColors($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\DominantColorsAnnotation::class); + $this->dominant_colors = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ImageSource.php b/vendor/google/cloud-vision/src/V1/ImageSource.php new file mode 100644 index 00000000..64a32d84 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ImageSource.php @@ -0,0 +1,169 @@ +google.cloud.vision.v1.ImageSource + */ +class ImageSource extends \Google\Protobuf\Internal\Message +{ + /** + * **Use `image_uri` instead.** + * The Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info. + * + * Generated from protobuf field string gcs_image_uri = 1; + */ + private $gcs_image_uri = ''; + /** + * The URI of the source image. Can be either: + * 1. A Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more + * info. + * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from + * HTTP/HTTPS URLs, Google cannot guarantee that the request will be + * completed. Your request may fail if the specified host denies the + * request (e.g. due to request throttling or DOS prevention), or if Google + * throttles requests to the site for abuse prevention. You should not + * depend on externally-hosted images for production applications. + * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes + * precedence. + * + * Generated from protobuf field string image_uri = 2; + */ + private $image_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $gcs_image_uri + * **Use `image_uri` instead.** + * The Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info. + * @type string $image_uri + * The URI of the source image. Can be either: + * 1. A Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more + * info. + * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from + * HTTP/HTTPS URLs, Google cannot guarantee that the request will be + * completed. Your request may fail if the specified host denies the + * request (e.g. due to request throttling or DOS prevention), or if Google + * throttles requests to the site for abuse prevention. You should not + * depend on externally-hosted images for production applications. + * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes + * precedence. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * **Use `image_uri` instead.** + * The Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info. + * + * Generated from protobuf field string gcs_image_uri = 1; + * @return string + */ + public function getGcsImageUri() + { + return $this->gcs_image_uri; + } + + /** + * **Use `image_uri` instead.** + * The Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info. + * + * Generated from protobuf field string gcs_image_uri = 1; + * @param string $var + * @return $this + */ + public function setGcsImageUri($var) + { + GPBUtil::checkString($var, True); + $this->gcs_image_uri = $var; + + return $this; + } + + /** + * The URI of the source image. Can be either: + * 1. A Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more + * info. + * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from + * HTTP/HTTPS URLs, Google cannot guarantee that the request will be + * completed. Your request may fail if the specified host denies the + * request (e.g. due to request throttling or DOS prevention), or if Google + * throttles requests to the site for abuse prevention. You should not + * depend on externally-hosted images for production applications. + * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes + * precedence. + * + * Generated from protobuf field string image_uri = 2; + * @return string + */ + public function getImageUri() + { + return $this->image_uri; + } + + /** + * The URI of the source image. Can be either: + * 1. A Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more + * info. + * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from + * HTTP/HTTPS URLs, Google cannot guarantee that the request will be + * completed. Your request may fail if the specified host denies the + * request (e.g. due to request throttling or DOS prevention), or if Google + * throttles requests to the site for abuse prevention. You should not + * depend on externally-hosted images for production applications. + * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes + * precedence. + * + * Generated from protobuf field string image_uri = 2; + * @param string $var + * @return $this + */ + public function setImageUri($var) + { + GPBUtil::checkString($var, True); + $this->image_uri = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ImportProductSetsGcsSource.php b/vendor/google/cloud-vision/src/V1/ImportProductSetsGcsSource.php new file mode 100644 index 00000000..d9b048da --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ImportProductSetsGcsSource.php @@ -0,0 +1,252 @@ +google.cloud.vision.v1.ImportProductSetsGcsSource + */ +class ImportProductSetsGcsSource extends \Google\Protobuf\Internal\Message +{ + /** + * The Google Cloud Storage URI of the input csv file. + * The URI must start with `gs://`. + * The format of the input csv file should be one image per line. + * In each line, there are 8 columns. + * 1. image-uri + * 2. image-id + * 3. product-set-id + * 4. product-id + * 5. product-category + * 6. product-display-name + * 7. labels + * 8. bounding-poly + * The `image-uri`, `product-set-id`, `product-id`, and `product-category` + * columns are required. All other columns are optional. + * If the `ProductSet` or `Product` specified by the `product-set-id` and + * `product-id` values does not exist, then the system will create a new + * `ProductSet` or `Product` for the image. In this case, the + * `product-display-name` column refers to + * [display_name][google.cloud.vision.v1.Product.display_name], the + * `product-category` column refers to + * [product_category][google.cloud.vision.v1.Product.product_category], and the + * `labels` column refers to [product_labels][google.cloud.vision.v1.Product.product_labels]. + * The `image-id` column is optional but must be unique if provided. If it is + * empty, the system will automatically assign a unique id to the image. + * The `product-display-name` column is optional. If it is empty, the system + * sets the [display_name][google.cloud.vision.v1.Product.display_name] field for the product to a + * space (" "). You can update the `display_name` later by using the API. + * If a `Product` with the specified `product-id` already exists, then the + * system ignores the `product-display-name`, `product-category`, and `labels` + * columns. + * The `labels` column (optional) is a line containing a list of + * comma-separated key-value pairs, in the following format: + * "key_1=value_1,key_2=value_2,...,key_n=value_n" + * The `bounding-poly` column (optional) identifies one region of + * interest from the image in the same manner as `CreateReferenceImage`. If + * you do not specify the `bounding-poly` column, then the system will try to + * detect regions of interest automatically. + * At most one `bounding-poly` column is allowed per line. If the image + * contains multiple regions of interest, add a line to the CSV file that + * includes the same product information, and the `bounding-poly` values for + * each region of interest. + * The `bounding-poly` column must contain an even number of comma-separated + * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + * non-negative integers for absolute bounding polygons, and float values + * in [0, 1] for normalized bounding polygons. + * The system will resize the image if the image resolution is too + * large to process (larger than 20MP). + * + * Generated from protobuf field string csv_file_uri = 1; + */ + private $csv_file_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $csv_file_uri + * The Google Cloud Storage URI of the input csv file. + * The URI must start with `gs://`. + * The format of the input csv file should be one image per line. + * In each line, there are 8 columns. + * 1. image-uri + * 2. image-id + * 3. product-set-id + * 4. product-id + * 5. product-category + * 6. product-display-name + * 7. labels + * 8. bounding-poly + * The `image-uri`, `product-set-id`, `product-id`, and `product-category` + * columns are required. All other columns are optional. + * If the `ProductSet` or `Product` specified by the `product-set-id` and + * `product-id` values does not exist, then the system will create a new + * `ProductSet` or `Product` for the image. In this case, the + * `product-display-name` column refers to + * [display_name][google.cloud.vision.v1.Product.display_name], the + * `product-category` column refers to + * [product_category][google.cloud.vision.v1.Product.product_category], and the + * `labels` column refers to [product_labels][google.cloud.vision.v1.Product.product_labels]. + * The `image-id` column is optional but must be unique if provided. If it is + * empty, the system will automatically assign a unique id to the image. + * The `product-display-name` column is optional. If it is empty, the system + * sets the [display_name][google.cloud.vision.v1.Product.display_name] field for the product to a + * space (" "). You can update the `display_name` later by using the API. + * If a `Product` with the specified `product-id` already exists, then the + * system ignores the `product-display-name`, `product-category`, and `labels` + * columns. + * The `labels` column (optional) is a line containing a list of + * comma-separated key-value pairs, in the following format: + * "key_1=value_1,key_2=value_2,...,key_n=value_n" + * The `bounding-poly` column (optional) identifies one region of + * interest from the image in the same manner as `CreateReferenceImage`. If + * you do not specify the `bounding-poly` column, then the system will try to + * detect regions of interest automatically. + * At most one `bounding-poly` column is allowed per line. If the image + * contains multiple regions of interest, add a line to the CSV file that + * includes the same product information, and the `bounding-poly` values for + * each region of interest. + * The `bounding-poly` column must contain an even number of comma-separated + * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + * non-negative integers for absolute bounding polygons, and float values + * in [0, 1] for normalized bounding polygons. + * The system will resize the image if the image resolution is too + * large to process (larger than 20MP). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage URI of the input csv file. + * The URI must start with `gs://`. + * The format of the input csv file should be one image per line. + * In each line, there are 8 columns. + * 1. image-uri + * 2. image-id + * 3. product-set-id + * 4. product-id + * 5. product-category + * 6. product-display-name + * 7. labels + * 8. bounding-poly + * The `image-uri`, `product-set-id`, `product-id`, and `product-category` + * columns are required. All other columns are optional. + * If the `ProductSet` or `Product` specified by the `product-set-id` and + * `product-id` values does not exist, then the system will create a new + * `ProductSet` or `Product` for the image. In this case, the + * `product-display-name` column refers to + * [display_name][google.cloud.vision.v1.Product.display_name], the + * `product-category` column refers to + * [product_category][google.cloud.vision.v1.Product.product_category], and the + * `labels` column refers to [product_labels][google.cloud.vision.v1.Product.product_labels]. + * The `image-id` column is optional but must be unique if provided. If it is + * empty, the system will automatically assign a unique id to the image. + * The `product-display-name` column is optional. If it is empty, the system + * sets the [display_name][google.cloud.vision.v1.Product.display_name] field for the product to a + * space (" "). You can update the `display_name` later by using the API. + * If a `Product` with the specified `product-id` already exists, then the + * system ignores the `product-display-name`, `product-category`, and `labels` + * columns. + * The `labels` column (optional) is a line containing a list of + * comma-separated key-value pairs, in the following format: + * "key_1=value_1,key_2=value_2,...,key_n=value_n" + * The `bounding-poly` column (optional) identifies one region of + * interest from the image in the same manner as `CreateReferenceImage`. If + * you do not specify the `bounding-poly` column, then the system will try to + * detect regions of interest automatically. + * At most one `bounding-poly` column is allowed per line. If the image + * contains multiple regions of interest, add a line to the CSV file that + * includes the same product information, and the `bounding-poly` values for + * each region of interest. + * The `bounding-poly` column must contain an even number of comma-separated + * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + * non-negative integers for absolute bounding polygons, and float values + * in [0, 1] for normalized bounding polygons. + * The system will resize the image if the image resolution is too + * large to process (larger than 20MP). + * + * Generated from protobuf field string csv_file_uri = 1; + * @return string + */ + public function getCsvFileUri() + { + return $this->csv_file_uri; + } + + /** + * The Google Cloud Storage URI of the input csv file. + * The URI must start with `gs://`. + * The format of the input csv file should be one image per line. + * In each line, there are 8 columns. + * 1. image-uri + * 2. image-id + * 3. product-set-id + * 4. product-id + * 5. product-category + * 6. product-display-name + * 7. labels + * 8. bounding-poly + * The `image-uri`, `product-set-id`, `product-id`, and `product-category` + * columns are required. All other columns are optional. + * If the `ProductSet` or `Product` specified by the `product-set-id` and + * `product-id` values does not exist, then the system will create a new + * `ProductSet` or `Product` for the image. In this case, the + * `product-display-name` column refers to + * [display_name][google.cloud.vision.v1.Product.display_name], the + * `product-category` column refers to + * [product_category][google.cloud.vision.v1.Product.product_category], and the + * `labels` column refers to [product_labels][google.cloud.vision.v1.Product.product_labels]. + * The `image-id` column is optional but must be unique if provided. If it is + * empty, the system will automatically assign a unique id to the image. + * The `product-display-name` column is optional. If it is empty, the system + * sets the [display_name][google.cloud.vision.v1.Product.display_name] field for the product to a + * space (" "). You can update the `display_name` later by using the API. + * If a `Product` with the specified `product-id` already exists, then the + * system ignores the `product-display-name`, `product-category`, and `labels` + * columns. + * The `labels` column (optional) is a line containing a list of + * comma-separated key-value pairs, in the following format: + * "key_1=value_1,key_2=value_2,...,key_n=value_n" + * The `bounding-poly` column (optional) identifies one region of + * interest from the image in the same manner as `CreateReferenceImage`. If + * you do not specify the `bounding-poly` column, then the system will try to + * detect regions of interest automatically. + * At most one `bounding-poly` column is allowed per line. If the image + * contains multiple regions of interest, add a line to the CSV file that + * includes the same product information, and the `bounding-poly` values for + * each region of interest. + * The `bounding-poly` column must contain an even number of comma-separated + * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + * non-negative integers for absolute bounding polygons, and float values + * in [0, 1] for normalized bounding polygons. + * The system will resize the image if the image resolution is too + * large to process (larger than 20MP). + * + * Generated from protobuf field string csv_file_uri = 1; + * @param string $var + * @return $this + */ + public function setCsvFileUri($var) + { + GPBUtil::checkString($var, True); + $this->csv_file_uri = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ImportProductSetsInputConfig.php b/vendor/google/cloud-vision/src/V1/ImportProductSetsInputConfig.php new file mode 100644 index 00000000..18183627 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ImportProductSetsInputConfig.php @@ -0,0 +1,78 @@ +google.cloud.vision.v1.ImportProductSetsInputConfig + */ +class ImportProductSetsInputConfig extends \Google\Protobuf\Internal\Message +{ + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ImportProductSetsGcsSource $gcs_source + * The Google Cloud Storage location for a csv file which preserves a list + * of ImportProductSetRequests in each line. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage location for a csv file which preserves a list + * of ImportProductSetRequests in each line. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsGcsSource gcs_source = 1; + * @return \Google\Cloud\Vision\V1\ImportProductSetsGcsSource|null + */ + public function getGcsSource() + { + return $this->readOneof(1); + } + + public function hasGcsSource() + { + return $this->hasOneof(1); + } + + /** + * The Google Cloud Storage location for a csv file which preserves a list + * of ImportProductSetRequests in each line. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsGcsSource gcs_source = 1; + * @param \Google\Cloud\Vision\V1\ImportProductSetsGcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImportProductSetsGcsSource::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ImportProductSetsRequest.php b/vendor/google/cloud-vision/src/V1/ImportProductSetsRequest.php new file mode 100644 index 00000000..3b02a3df --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ImportProductSetsRequest.php @@ -0,0 +1,115 @@ +google.cloud.vision.v1.ImportProductSetsRequest + */ +class ImportProductSetsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project in which the ProductSets should be imported. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * Required. The input content for the list of requests. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $input_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project in which the ProductSets should be imported. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @type \Google\Cloud\Vision\V1\ImportProductSetsInputConfig $input_config + * Required. The input content for the list of requests. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project in which the ProductSets should be imported. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project in which the ProductSets should be imported. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The input content for the list of requests. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\ImportProductSetsInputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * Required. The input content for the list of requests. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\ImportProductSetsInputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImportProductSetsInputConfig::class); + $this->input_config = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ImportProductSetsResponse.php b/vendor/google/cloud-vision/src/V1/ImportProductSetsResponse.php new file mode 100644 index 00000000..37b27a0c --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ImportProductSetsResponse.php @@ -0,0 +1,120 @@ +google.cloud.vision.v1.ImportProductSetsResponse + */ +class ImportProductSetsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of reference_images that are imported successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + */ + private $reference_images; + /** + * The rpc status for each ImportProductSet request, including both successes + * and errors. + * The number of statuses here matches the number of lines in the csv file, + * and statuses[i] stores the success or failure status of processing the i-th + * line of the csv, starting from line 0. + * + * Generated from protobuf field repeated .google.rpc.Status statuses = 2; + */ + private $statuses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ReferenceImage[]|\Google\Protobuf\Internal\RepeatedField $reference_images + * The list of reference_images that are imported successfully. + * @type \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $statuses + * The rpc status for each ImportProductSet request, including both successes + * and errors. + * The number of statuses here matches the number of lines in the csv file, + * and statuses[i] stores the success or failure status of processing the i-th + * line of the csv, starting from line 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The list of reference_images that are imported successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferenceImages() + { + return $this->reference_images; + } + + /** + * The list of reference_images that are imported successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + * @param \Google\Cloud\Vision\V1\ReferenceImage[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferenceImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ReferenceImage::class); + $this->reference_images = $arr; + + return $this; + } + + /** + * The rpc status for each ImportProductSet request, including both successes + * and errors. + * The number of statuses here matches the number of lines in the csv file, + * and statuses[i] stores the success or failure status of processing the i-th + * line of the csv, starting from line 0. + * + * Generated from protobuf field repeated .google.rpc.Status statuses = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStatuses() + { + return $this->statuses; + } + + /** + * The rpc status for each ImportProductSet request, including both successes + * and errors. + * The number of statuses here matches the number of lines in the csv file, + * and statuses[i] stores the success or failure status of processing the i-th + * line of the csv, starting from line 0. + * + * Generated from protobuf field repeated .google.rpc.Status statuses = 2; + * @param \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStatuses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->statuses = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/InputConfig.php b/vendor/google/cloud-vision/src/V1/InputConfig.php new file mode 100644 index 00000000..0742d9ba --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/InputConfig.php @@ -0,0 +1,165 @@ +google.cloud.vision.v1.InputConfig + */ +class InputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The Google Cloud Storage location to read the input from. + * + * Generated from protobuf field .google.cloud.vision.v1.GcsSource gcs_source = 1; + */ + private $gcs_source = null; + /** + * File content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateFiles requests. It does + * not work for AsyncBatchAnnotateFiles requests. + * + * Generated from protobuf field bytes content = 3; + */ + private $content = ''; + /** + * The type of the file. Currently only "application/pdf", "image/tiff" and + * "image/gif" are supported. Wildcards are not supported. + * + * Generated from protobuf field string mime_type = 2; + */ + private $mime_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\GcsSource $gcs_source + * The Google Cloud Storage location to read the input from. + * @type string $content + * File content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateFiles requests. It does + * not work for AsyncBatchAnnotateFiles requests. + * @type string $mime_type + * The type of the file. Currently only "application/pdf", "image/tiff" and + * "image/gif" are supported. Wildcards are not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage location to read the input from. + * + * Generated from protobuf field .google.cloud.vision.v1.GcsSource gcs_source = 1; + * @return \Google\Cloud\Vision\V1\GcsSource|null + */ + public function getGcsSource() + { + return $this->gcs_source; + } + + public function hasGcsSource() + { + return isset($this->gcs_source); + } + + public function clearGcsSource() + { + unset($this->gcs_source); + } + + /** + * The Google Cloud Storage location to read the input from. + * + * Generated from protobuf field .google.cloud.vision.v1.GcsSource gcs_source = 1; + * @param \Google\Cloud\Vision\V1\GcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\GcsSource::class); + $this->gcs_source = $var; + + return $this; + } + + /** + * File content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateFiles requests. It does + * not work for AsyncBatchAnnotateFiles requests. + * + * Generated from protobuf field bytes content = 3; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * File content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateFiles requests. It does + * not work for AsyncBatchAnnotateFiles requests. + * + * Generated from protobuf field bytes content = 3; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->content = $var; + + return $this; + } + + /** + * The type of the file. Currently only "application/pdf", "image/tiff" and + * "image/gif" are supported. Wildcards are not supported. + * + * Generated from protobuf field string mime_type = 2; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * The type of the file. Currently only "application/pdf", "image/tiff" and + * "image/gif" are supported. Wildcards are not supported. + * + * Generated from protobuf field string mime_type = 2; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/LatLongRect.php b/vendor/google/cloud-vision/src/V1/LatLongRect.php new file mode 100644 index 00000000..ad1fcb7b --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/LatLongRect.php @@ -0,0 +1,121 @@ +google.cloud.vision.v1.LatLongRect + */ +class LatLongRect extends \Google\Protobuf\Internal\Message +{ + /** + * Min lat/long pair. + * + * Generated from protobuf field .google.type.LatLng min_lat_lng = 1; + */ + private $min_lat_lng = null; + /** + * Max lat/long pair. + * + * Generated from protobuf field .google.type.LatLng max_lat_lng = 2; + */ + private $max_lat_lng = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Type\LatLng $min_lat_lng + * Min lat/long pair. + * @type \Google\Type\LatLng $max_lat_lng + * Max lat/long pair. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Min lat/long pair. + * + * Generated from protobuf field .google.type.LatLng min_lat_lng = 1; + * @return \Google\Type\LatLng|null + */ + public function getMinLatLng() + { + return $this->min_lat_lng; + } + + public function hasMinLatLng() + { + return isset($this->min_lat_lng); + } + + public function clearMinLatLng() + { + unset($this->min_lat_lng); + } + + /** + * Min lat/long pair. + * + * Generated from protobuf field .google.type.LatLng min_lat_lng = 1; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setMinLatLng($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->min_lat_lng = $var; + + return $this; + } + + /** + * Max lat/long pair. + * + * Generated from protobuf field .google.type.LatLng max_lat_lng = 2; + * @return \Google\Type\LatLng|null + */ + public function getMaxLatLng() + { + return $this->max_lat_lng; + } + + public function hasMaxLatLng() + { + return isset($this->max_lat_lng); + } + + public function clearMaxLatLng() + { + unset($this->max_lat_lng); + } + + /** + * Max lat/long pair. + * + * Generated from protobuf field .google.type.LatLng max_lat_lng = 2; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setMaxLatLng($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->max_lat_lng = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/Likelihood.php b/vendor/google/cloud-vision/src/V1/Likelihood.php new file mode 100644 index 00000000..a38e9ab0 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Likelihood.php @@ -0,0 +1,83 @@ +google.cloud.vision.v1.Likelihood + */ +class Likelihood +{ + /** + * Unknown likelihood. + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * It is very unlikely. + * + * Generated from protobuf enum VERY_UNLIKELY = 1; + */ + const VERY_UNLIKELY = 1; + /** + * It is unlikely. + * + * Generated from protobuf enum UNLIKELY = 2; + */ + const UNLIKELY = 2; + /** + * It is possible. + * + * Generated from protobuf enum POSSIBLE = 3; + */ + const POSSIBLE = 3; + /** + * It is likely. + * + * Generated from protobuf enum LIKELY = 4; + */ + const LIKELY = 4; + /** + * It is very likely. + * + * Generated from protobuf enum VERY_LIKELY = 5; + */ + const VERY_LIKELY = 5; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::VERY_UNLIKELY => 'VERY_UNLIKELY', + self::UNLIKELY => 'UNLIKELY', + self::POSSIBLE => 'POSSIBLE', + self::LIKELY => 'LIKELY', + self::VERY_LIKELY => 'VERY_LIKELY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/vendor/google/cloud-vision/src/V1/ListProductSetsRequest.php b/vendor/google/cloud-vision/src/V1/ListProductSetsRequest.php new file mode 100644 index 00000000..acc48a20 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ListProductSetsRequest.php @@ -0,0 +1,139 @@ +google.cloud.vision.v1.ListProductSetsRequest + */ +class ListProductSetsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project from which ProductSets should be listed. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + private $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project from which ProductSets should be listed. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $page_token + * The next_page_token returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project from which ProductSets should be listed. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project from which ProductSets should be listed. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ListProductSetsResponse.php b/vendor/google/cloud-vision/src/V1/ListProductSetsResponse.php new file mode 100644 index 00000000..98882944 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ListProductSetsResponse.php @@ -0,0 +1,105 @@ +google.cloud.vision.v1.ListProductSetsResponse + */ +class ListProductSetsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of ProductSets. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSet product_sets = 1; + */ + private $product_sets; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ProductSet[]|\Google\Protobuf\Internal\RepeatedField $product_sets + * List of ProductSets. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * List of ProductSets. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSet product_sets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductSets() + { + return $this->product_sets; + } + + /** + * List of ProductSets. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSet product_sets = 1; + * @param \Google\Cloud\Vision\V1\ProductSet[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductSets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSet::class); + $this->product_sets = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ListProductsInProductSetRequest.php b/vendor/google/cloud-vision/src/V1/ListProductsInProductSetRequest.php new file mode 100644 index 00000000..5ba960cd --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ListProductsInProductSetRequest.php @@ -0,0 +1,143 @@ +google.cloud.vision.v1.ListProductsInProductSetRequest + */ +class ListProductsInProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ProductSet resource for which to retrieve Products. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + private $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The ProductSet resource for which to retrieve Products. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $page_token + * The next_page_token returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ProductSet resource for which to retrieve Products. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The ProductSet resource for which to retrieve Products. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ListProductsInProductSetResponse.php b/vendor/google/cloud-vision/src/V1/ListProductsInProductSetResponse.php new file mode 100644 index 00000000..947c5712 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ListProductsInProductSetResponse.php @@ -0,0 +1,105 @@ +google.cloud.vision.v1.ListProductsInProductSetResponse + */ +class ListProductsInProductSetResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + */ + private $products; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Product[]|\Google\Protobuf\Internal\RepeatedField $products + * The list of Products. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The list of Products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProducts() + { + return $this->products; + } + + /** + * The list of Products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + * @param \Google\Cloud\Vision\V1\Product[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProducts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Product::class); + $this->products = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ListProductsRequest.php b/vendor/google/cloud-vision/src/V1/ListProductsRequest.php new file mode 100644 index 00000000..1f59758c --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ListProductsRequest.php @@ -0,0 +1,143 @@ +google.cloud.vision.v1.ListProductsRequest + */ +class ListProductsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project OR ProductSet from which Products should be listed. + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + private $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project OR ProductSet from which Products should be listed. + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $page_token + * The next_page_token returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project OR ProductSet from which Products should be listed. + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project OR ProductSet from which Products should be listed. + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ListProductsResponse.php b/vendor/google/cloud-vision/src/V1/ListProductsResponse.php new file mode 100644 index 00000000..cff11ed7 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ListProductsResponse.php @@ -0,0 +1,105 @@ +google.cloud.vision.v1.ListProductsResponse + */ +class ListProductsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + */ + private $products; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Product[]|\Google\Protobuf\Internal\RepeatedField $products + * List of products. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * List of products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProducts() + { + return $this->products; + } + + /** + * List of products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + * @param \Google\Cloud\Vision\V1\Product[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProducts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Product::class); + $this->products = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ListReferenceImagesRequest.php b/vendor/google/cloud-vision/src/V1/ListReferenceImagesRequest.php new file mode 100644 index 00000000..4dec2658 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ListReferenceImagesRequest.php @@ -0,0 +1,151 @@ +google.cloud.vision.v1.ListReferenceImagesRequest + */ +class ListReferenceImagesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the product containing the reference images. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * Defaults to the first page if not specified. + * + * Generated from protobuf field string page_token = 3; + */ + private $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource name of the product containing the reference images. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $page_token + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * Defaults to the first page if not specified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the product containing the reference images. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource name of the product containing the reference images. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * Defaults to the first page if not specified. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * Defaults to the first page if not specified. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ListReferenceImagesResponse.php b/vendor/google/cloud-vision/src/V1/ListReferenceImagesResponse.php new file mode 100644 index 00000000..b5afa77c --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ListReferenceImagesResponse.php @@ -0,0 +1,135 @@ +google.cloud.vision.v1.ListReferenceImagesResponse + */ +class ListReferenceImagesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of reference images. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + */ + private $reference_images; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string next_page_token = 3; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ReferenceImage[]|\Google\Protobuf\Internal\RepeatedField $reference_images + * The list of reference images. + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $next_page_token + * The next_page_token returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The list of reference images. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferenceImages() + { + return $this->reference_images; + } + + /** + * The list of reference images. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + * @param \Google\Cloud\Vision\V1\ReferenceImage[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferenceImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ReferenceImage::class); + $this->reference_images = $arr; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string next_page_token = 3; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string next_page_token = 3; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/LocalizedObjectAnnotation.php b/vendor/google/cloud-vision/src/V1/LocalizedObjectAnnotation.php new file mode 100644 index 00000000..35efa7f0 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/LocalizedObjectAnnotation.php @@ -0,0 +1,221 @@ +google.cloud.vision.v1.LocalizedObjectAnnotation + */ +class LocalizedObjectAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Object ID that should align with EntityAnnotation mid. + * + * Generated from protobuf field string mid = 1; + */ + private $mid = ''; + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + */ + private $language_code = ''; + /** + * Object name, expressed in its `language_code` language. + * + * Generated from protobuf field string name = 3; + */ + private $name = ''; + /** + * Score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + */ + private $score = 0.0; + /** + * Image region to which this object belongs. This must be populated. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 5; + */ + private $bounding_poly = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mid + * Object ID that should align with EntityAnnotation mid. + * @type string $language_code + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * @type string $name + * Object name, expressed in its `language_code` language. + * @type float $score + * Score of the result. Range [0, 1]. + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * Image region to which this object belongs. This must be populated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Object ID that should align with EntityAnnotation mid. + * + * Generated from protobuf field string mid = 1; + * @return string + */ + public function getMid() + { + return $this->mid; + } + + /** + * Object ID that should align with EntityAnnotation mid. + * + * Generated from protobuf field string mid = 1; + * @param string $var + * @return $this + */ + public function setMid($var) + { + GPBUtil::checkString($var, True); + $this->mid = $var; + + return $this; + } + + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * Object name, expressed in its `language_code` language. + * + * Generated from protobuf field string name = 3; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Object name, expressed in its `language_code` language. + * + * Generated from protobuf field string name = 3; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * Image region to which this object belongs. This must be populated. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 5; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * Image region to which this object belongs. This must be populated. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 5; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/LocationInfo.php b/vendor/google/cloud-vision/src/V1/LocationInfo.php new file mode 100644 index 00000000..50ad741a --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/LocationInfo.php @@ -0,0 +1,77 @@ +google.cloud.vision.v1.LocationInfo + */ +class LocationInfo extends \Google\Protobuf\Internal\Message +{ + /** + * lat/long location coordinates. + * + * Generated from protobuf field .google.type.LatLng lat_lng = 1; + */ + private $lat_lng = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Type\LatLng $lat_lng + * lat/long location coordinates. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * lat/long location coordinates. + * + * Generated from protobuf field .google.type.LatLng lat_lng = 1; + * @return \Google\Type\LatLng|null + */ + public function getLatLng() + { + return $this->lat_lng; + } + + public function hasLatLng() + { + return isset($this->lat_lng); + } + + public function clearLatLng() + { + unset($this->lat_lng); + } + + /** + * lat/long location coordinates. + * + * Generated from protobuf field .google.type.LatLng lat_lng = 1; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setLatLng($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->lat_lng = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/NormalizedVertex.php b/vendor/google/cloud-vision/src/V1/NormalizedVertex.php new file mode 100644 index 00000000..16e89f6d --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/NormalizedVertex.php @@ -0,0 +1,103 @@ +google.cloud.vision.v1.NormalizedVertex + */ +class NormalizedVertex extends \Google\Protobuf\Internal\Message +{ + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + */ + private $x = 0.0; + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + */ + private $y = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $x + * X coordinate. + * @type float $y + * Y coordinate. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\Geometry::initOnce(); + parent::__construct($data); + } + + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + * @return float + */ + public function getX() + { + return $this->x; + } + + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + * @param float $var + * @return $this + */ + public function setX($var) + { + GPBUtil::checkFloat($var); + $this->x = $var; + + return $this; + } + + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + * @return float + */ + public function getY() + { + return $this->y; + } + + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + * @param float $var + * @return $this + */ + public function setY($var) + { + GPBUtil::checkFloat($var); + $this->y = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/OperationMetadata.php b/vendor/google/cloud-vision/src/V1/OperationMetadata.php new file mode 100644 index 00000000..91aead79 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/OperationMetadata.php @@ -0,0 +1,155 @@ +google.cloud.vision.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.OperationMetadata.State state = 1; + */ + private $state = 0; + /** + * The time when the batch request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + */ + private $create_time = null; + /** + * The time when the operation result was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 6; + */ + private $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * Current state of the batch operation. + * @type \Google\Protobuf\Timestamp $create_time + * The time when the batch request was received. + * @type \Google\Protobuf\Timestamp $update_time + * The time when the operation result was last updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.OperationMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.OperationMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\OperationMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * The time when the batch request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time when the batch request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The time when the operation result was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * The time when the operation result was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/OperationMetadata/State.php b/vendor/google/cloud-vision/src/V1/OperationMetadata/State.php new file mode 100644 index 00000000..345f7bb0 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/OperationMetadata/State.php @@ -0,0 +1,78 @@ +google.cloud.vision.v1.OperationMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is received. + * + * Generated from protobuf enum CREATED = 1; + */ + const CREATED = 1; + /** + * Request is actively being processed. + * + * Generated from protobuf enum RUNNING = 2; + */ + const RUNNING = 2; + /** + * The batch processing is done. + * + * Generated from protobuf enum DONE = 3; + */ + const DONE = 3; + /** + * The batch processing was cancelled. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATED => 'CREATED', + self::RUNNING => 'RUNNING', + self::DONE => 'DONE', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Vision\V1\OperationMetadata_State::class); + diff --git a/vendor/google/cloud-vision/src/V1/OperationMetadata_State.php b/vendor/google/cloud-vision/src/V1/OperationMetadata_State.php new file mode 100644 index 00000000..e4d68a92 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/OperationMetadata_State.php @@ -0,0 +1,16 @@ +google.cloud.vision.v1.OutputConfig + */ +class OutputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The Google Cloud Storage location to write the output(s) to. + * + * Generated from protobuf field .google.cloud.vision.v1.GcsDestination gcs_destination = 1; + */ + private $gcs_destination = null; + /** + * The max number of response protos to put into each output JSON file on + * Google Cloud Storage. + * The valid range is [1, 100]. If not specified, the default value is 20. + * For example, for one pdf file with 100 pages, 100 response protos will + * be generated. If `batch_size` = 20, then 5 json files each + * containing 20 response protos will be written under the prefix + * `gcs_destination`.`uri`. + * Currently, batch_size only applies to GcsDestination, with potential future + * support for other output configurations. + * + * Generated from protobuf field int32 batch_size = 2; + */ + private $batch_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\GcsDestination $gcs_destination + * The Google Cloud Storage location to write the output(s) to. + * @type int $batch_size + * The max number of response protos to put into each output JSON file on + * Google Cloud Storage. + * The valid range is [1, 100]. If not specified, the default value is 20. + * For example, for one pdf file with 100 pages, 100 response protos will + * be generated. If `batch_size` = 20, then 5 json files each + * containing 20 response protos will be written under the prefix + * `gcs_destination`.`uri`. + * Currently, batch_size only applies to GcsDestination, with potential future + * support for other output configurations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage location to write the output(s) to. + * + * Generated from protobuf field .google.cloud.vision.v1.GcsDestination gcs_destination = 1; + * @return \Google\Cloud\Vision\V1\GcsDestination|null + */ + public function getGcsDestination() + { + return $this->gcs_destination; + } + + public function hasGcsDestination() + { + return isset($this->gcs_destination); + } + + public function clearGcsDestination() + { + unset($this->gcs_destination); + } + + /** + * The Google Cloud Storage location to write the output(s) to. + * + * Generated from protobuf field .google.cloud.vision.v1.GcsDestination gcs_destination = 1; + * @param \Google\Cloud\Vision\V1\GcsDestination $var + * @return $this + */ + public function setGcsDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\GcsDestination::class); + $this->gcs_destination = $var; + + return $this; + } + + /** + * The max number of response protos to put into each output JSON file on + * Google Cloud Storage. + * The valid range is [1, 100]. If not specified, the default value is 20. + * For example, for one pdf file with 100 pages, 100 response protos will + * be generated. If `batch_size` = 20, then 5 json files each + * containing 20 response protos will be written under the prefix + * `gcs_destination`.`uri`. + * Currently, batch_size only applies to GcsDestination, with potential future + * support for other output configurations. + * + * Generated from protobuf field int32 batch_size = 2; + * @return int + */ + public function getBatchSize() + { + return $this->batch_size; + } + + /** + * The max number of response protos to put into each output JSON file on + * Google Cloud Storage. + * The valid range is [1, 100]. If not specified, the default value is 20. + * For example, for one pdf file with 100 pages, 100 response protos will + * be generated. If `batch_size` = 20, then 5 json files each + * containing 20 response protos will be written under the prefix + * `gcs_destination`.`uri`. + * Currently, batch_size only applies to GcsDestination, with potential future + * support for other output configurations. + * + * Generated from protobuf field int32 batch_size = 2; + * @param int $var + * @return $this + */ + public function setBatchSize($var) + { + GPBUtil::checkInt32($var); + $this->batch_size = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/Page.php b/vendor/google/cloud-vision/src/V1/Page.php new file mode 100644 index 00000000..9fa43ffb --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Page.php @@ -0,0 +1,221 @@ +google.cloud.vision.v1.Page + */ +class Page extends \Google\Protobuf\Internal\Message +{ + /** + * Additional information detected on the page. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + */ + private $property = null; + /** + * Page width. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * + * Generated from protobuf field int32 width = 2; + */ + private $width = 0; + /** + * Page height. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * + * Generated from protobuf field int32 height = 3; + */ + private $height = 0; + /** + * List of blocks of text, images etc on this page. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Block blocks = 4; + */ + private $blocks; + /** + * Confidence of the OCR results on the page. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5; + */ + private $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $property + * Additional information detected on the page. + * @type int $width + * Page width. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * @type int $height + * Page height. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * @type \Google\Cloud\Vision\V1\Block[]|\Google\Protobuf\Internal\RepeatedField $blocks + * List of blocks of text, images etc on this page. + * @type float $confidence + * Confidence of the OCR results on the page. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * Additional information detected on the page. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @return \Google\Cloud\Vision\V1\TextAnnotation\TextProperty|null + */ + public function getProperty() + { + return $this->property; + } + + public function hasProperty() + { + return isset($this->property); + } + + public function clearProperty() + { + unset($this->property); + } + + /** + * Additional information detected on the page. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @param \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $var + * @return $this + */ + public function setProperty($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation\TextProperty::class); + $this->property = $var; + + return $this; + } + + /** + * Page width. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * + * Generated from protobuf field int32 width = 2; + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * Page width. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * + * Generated from protobuf field int32 width = 2; + * @param int $var + * @return $this + */ + public function setWidth($var) + { + GPBUtil::checkInt32($var); + $this->width = $var; + + return $this; + } + + /** + * Page height. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * + * Generated from protobuf field int32 height = 3; + * @return int + */ + public function getHeight() + { + return $this->height; + } + + /** + * Page height. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * + * Generated from protobuf field int32 height = 3; + * @param int $var + * @return $this + */ + public function setHeight($var) + { + GPBUtil::checkInt32($var); + $this->height = $var; + + return $this; + } + + /** + * List of blocks of text, images etc on this page. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Block blocks = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBlocks() + { + return $this->blocks; + } + + /** + * List of blocks of text, images etc on this page. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Block blocks = 4; + * @param \Google\Cloud\Vision\V1\Block[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBlocks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Block::class); + $this->blocks = $arr; + + return $this; + } + + /** + * Confidence of the OCR results on the page. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of the OCR results on the page. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/Paragraph.php b/vendor/google/cloud-vision/src/V1/Paragraph.php new file mode 100644 index 00000000..f692f3d9 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Paragraph.php @@ -0,0 +1,245 @@ +google.cloud.vision.v1.Paragraph + */ +class Paragraph extends \Google\Protobuf\Internal\Message +{ + /** + * Additional information detected for the paragraph. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + */ + private $property = null; + /** + * The bounding box for the paragraph. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + */ + private $bounding_box = null; + /** + * List of all words in this paragraph. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Word words = 3; + */ + private $words; + /** + * Confidence of the OCR results for the paragraph. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + */ + private $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $property + * Additional information detected for the paragraph. + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_box + * The bounding box for the paragraph. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * @type \Google\Cloud\Vision\V1\Word[]|\Google\Protobuf\Internal\RepeatedField $words + * List of all words in this paragraph. + * @type float $confidence + * Confidence of the OCR results for the paragraph. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * Additional information detected for the paragraph. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @return \Google\Cloud\Vision\V1\TextAnnotation\TextProperty|null + */ + public function getProperty() + { + return $this->property; + } + + public function hasProperty() + { + return isset($this->property); + } + + public function clearProperty() + { + unset($this->property); + } + + /** + * Additional information detected for the paragraph. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @param \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $var + * @return $this + */ + public function setProperty($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation\TextProperty::class); + $this->property = $var; + + return $this; + } + + /** + * The bounding box for the paragraph. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingBox() + { + return $this->bounding_box; + } + + public function hasBoundingBox() + { + return isset($this->bounding_box); + } + + public function clearBoundingBox() + { + unset($this->bounding_box); + } + + /** + * The bounding box for the paragraph. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingBox($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_box = $var; + + return $this; + } + + /** + * List of all words in this paragraph. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Word words = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWords() + { + return $this->words; + } + + /** + * List of all words in this paragraph. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Word words = 3; + * @param \Google\Cloud\Vision\V1\Word[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWords($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Word::class); + $this->words = $arr; + + return $this; + } + + /** + * Confidence of the OCR results for the paragraph. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of the OCR results for the paragraph. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/Position.php b/vendor/google/cloud-vision/src/V1/Position.php new file mode 100644 index 00000000..75133540 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Position.php @@ -0,0 +1,137 @@ +google.cloud.vision.v1.Position + */ +class Position extends \Google\Protobuf\Internal\Message +{ + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + */ + private $x = 0.0; + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + */ + private $y = 0.0; + /** + * Z coordinate (or depth). + * + * Generated from protobuf field float z = 3; + */ + private $z = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $x + * X coordinate. + * @type float $y + * Y coordinate. + * @type float $z + * Z coordinate (or depth). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\Geometry::initOnce(); + parent::__construct($data); + } + + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + * @return float + */ + public function getX() + { + return $this->x; + } + + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + * @param float $var + * @return $this + */ + public function setX($var) + { + GPBUtil::checkFloat($var); + $this->x = $var; + + return $this; + } + + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + * @return float + */ + public function getY() + { + return $this->y; + } + + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + * @param float $var + * @return $this + */ + public function setY($var) + { + GPBUtil::checkFloat($var); + $this->y = $var; + + return $this; + } + + /** + * Z coordinate (or depth). + * + * Generated from protobuf field float z = 3; + * @return float + */ + public function getZ() + { + return $this->z; + } + + /** + * Z coordinate (or depth). + * + * Generated from protobuf field float z = 3; + * @param float $var + * @return $this + */ + public function setZ($var) + { + GPBUtil::checkFloat($var); + $this->z = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/Product.php b/vendor/google/cloud-vision/src/V1/Product.php new file mode 100644 index 00000000..b13fba75 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Product.php @@ -0,0 +1,271 @@ +google.cloud.vision.v1.Product + */ +class Product extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the product. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * This field is ignored when creating a product. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The user-provided name for this Product. Must not be empty. Must be at most + * 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + */ + private $display_name = ''; + /** + * User-provided metadata to be stored with this product. Must be at most 4096 + * characters long. + * + * Generated from protobuf field string description = 3; + */ + private $description = ''; + /** + * Immutable. The category for the product identified by the reference image. This should + * be one of "homegoods-v2", "apparel-v2", "toys-v2", "packagedgoods-v1" or + * "general-v1". The legacy categories "homegoods", "apparel", and "toys" are + * still supported, but these should not be used for new products. + * + * Generated from protobuf field string product_category = 4 [(.google.api.field_behavior) = IMMUTABLE]; + */ + private $product_category = ''; + /** + * Key-value pairs that can be attached to a product. At query time, + * constraints can be specified based on the product_labels. + * Note that integer values can be provided as strings, e.g. "1199". Only + * strings with integer values can match a range-based restriction which is + * to be supported soon. + * Multiple values can be assigned to the same key. One product may have up to + * 500 product_labels. + * Notice that the total number of distinct product_labels over all products + * in one ProductSet cannot exceed 1M, otherwise the product search pipeline + * will refuse to work for that ProductSet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product.KeyValue product_labels = 5; + */ + private $product_labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the product. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * This field is ignored when creating a product. + * @type string $display_name + * The user-provided name for this Product. Must not be empty. Must be at most + * 4096 characters long. + * @type string $description + * User-provided metadata to be stored with this product. Must be at most 4096 + * characters long. + * @type string $product_category + * Immutable. The category for the product identified by the reference image. This should + * be one of "homegoods-v2", "apparel-v2", "toys-v2", "packagedgoods-v1" or + * "general-v1". The legacy categories "homegoods", "apparel", and "toys" are + * still supported, but these should not be used for new products. + * @type \Google\Cloud\Vision\V1\Product\KeyValue[]|\Google\Protobuf\Internal\RepeatedField $product_labels + * Key-value pairs that can be attached to a product. At query time, + * constraints can be specified based on the product_labels. + * Note that integer values can be provided as strings, e.g. "1199". Only + * strings with integer values can match a range-based restriction which is + * to be supported soon. + * Multiple values can be assigned to the same key. One product may have up to + * 500 product_labels. + * Notice that the total number of distinct product_labels over all products + * in one ProductSet cannot exceed 1M, otherwise the product search pipeline + * will refuse to work for that ProductSet. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the product. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * This field is ignored when creating a product. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the product. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * This field is ignored when creating a product. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The user-provided name for this Product. Must not be empty. Must be at most + * 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The user-provided name for this Product. Must not be empty. Must be at most + * 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * User-provided metadata to be stored with this product. Must be at most 4096 + * characters long. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided metadata to be stored with this product. Must be at most 4096 + * characters long. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Immutable. The category for the product identified by the reference image. This should + * be one of "homegoods-v2", "apparel-v2", "toys-v2", "packagedgoods-v1" or + * "general-v1". The legacy categories "homegoods", "apparel", and "toys" are + * still supported, but these should not be used for new products. + * + * Generated from protobuf field string product_category = 4 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getProductCategory() + { + return $this->product_category; + } + + /** + * Immutable. The category for the product identified by the reference image. This should + * be one of "homegoods-v2", "apparel-v2", "toys-v2", "packagedgoods-v1" or + * "general-v1". The legacy categories "homegoods", "apparel", and "toys" are + * still supported, but these should not be used for new products. + * + * Generated from protobuf field string product_category = 4 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setProductCategory($var) + { + GPBUtil::checkString($var, True); + $this->product_category = $var; + + return $this; + } + + /** + * Key-value pairs that can be attached to a product. At query time, + * constraints can be specified based on the product_labels. + * Note that integer values can be provided as strings, e.g. "1199". Only + * strings with integer values can match a range-based restriction which is + * to be supported soon. + * Multiple values can be assigned to the same key. One product may have up to + * 500 product_labels. + * Notice that the total number of distinct product_labels over all products + * in one ProductSet cannot exceed 1M, otherwise the product search pipeline + * will refuse to work for that ProductSet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product.KeyValue product_labels = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductLabels() + { + return $this->product_labels; + } + + /** + * Key-value pairs that can be attached to a product. At query time, + * constraints can be specified based on the product_labels. + * Note that integer values can be provided as strings, e.g. "1199". Only + * strings with integer values can match a range-based restriction which is + * to be supported soon. + * Multiple values can be assigned to the same key. One product may have up to + * 500 product_labels. + * Notice that the total number of distinct product_labels over all products + * in one ProductSet cannot exceed 1M, otherwise the product search pipeline + * will refuse to work for that ProductSet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product.KeyValue product_labels = 5; + * @param \Google\Cloud\Vision\V1\Product\KeyValue[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductLabels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Product\KeyValue::class); + $this->product_labels = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/Product/KeyValue.php b/vendor/google/cloud-vision/src/V1/Product/KeyValue.php new file mode 100644 index 00000000..5a68dab6 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Product/KeyValue.php @@ -0,0 +1,112 @@ +google.cloud.vision.v1.Product.KeyValue + */ +class KeyValue extends \Google\Protobuf\Internal\Message +{ + /** + * The key of the label attached to the product. Cannot be empty and cannot + * exceed 128 bytes. + * + * Generated from protobuf field string key = 1; + */ + private $key = ''; + /** + * The value of the label attached to the product. Cannot be empty and + * cannot exceed 128 bytes. + * + * Generated from protobuf field string value = 2; + */ + private $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * The key of the label attached to the product. Cannot be empty and cannot + * exceed 128 bytes. + * @type string $value + * The value of the label attached to the product. Cannot be empty and + * cannot exceed 128 bytes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The key of the label attached to the product. Cannot be empty and cannot + * exceed 128 bytes. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * The key of the label attached to the product. Cannot be empty and cannot + * exceed 128 bytes. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * The value of the label attached to the product. Cannot be empty and + * cannot exceed 128 bytes. + * + * Generated from protobuf field string value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The value of the label attached to the product. Cannot be empty and + * cannot exceed 128 bytes. + * + * Generated from protobuf field string value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(KeyValue::class, \Google\Cloud\Vision\V1\Product_KeyValue::class); + diff --git a/vendor/google/cloud-vision/src/V1/ProductSearchClient.php b/vendor/google/cloud-vision/src/V1/ProductSearchClient.php new file mode 100644 index 00000000..ba6ef5d6 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ProductSearchClient.php @@ -0,0 +1,36 @@ +_simpleRequest('/google.cloud.vision.v1.ProductSearch/CreateProductSet', + $argument, + ['\Google\Cloud\Vision\V1\ProductSet', 'decode'], + $metadata, $options); + } + + /** + * Lists ProductSets in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less + * than 1. + * @param \Google\Cloud\Vision\V1\ListProductSetsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListProductSets(\Google\Cloud\Vision\V1\ListProductSetsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/ListProductSets', + $argument, + ['\Google\Cloud\Vision\V1\ListProductSetsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets information associated with a ProductSet. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * @param \Google\Cloud\Vision\V1\GetProductSetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetProductSet(\Google\Cloud\Vision\V1\GetProductSetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/GetProductSet', + $argument, + ['\Google\Cloud\Vision\V1\ProductSet', 'decode'], + $metadata, $options); + } + + /** + * Makes changes to a ProductSet resource. + * Only display_name can be updated currently. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but + * missing from the request or longer than 4096 characters. + * @param \Google\Cloud\Vision\V1\UpdateProductSetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateProductSet(\Google\Cloud\Vision\V1\UpdateProductSetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/UpdateProductSet', + $argument, + ['\Google\Cloud\Vision\V1\ProductSet', 'decode'], + $metadata, $options); + } + + /** + * Permanently deletes a ProductSet. Products and ReferenceImages in the + * ProductSet are not deleted. + * + * The actual image files are not deleted from Google Cloud Storage. + * @param \Google\Cloud\Vision\V1\DeleteProductSetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteProductSet(\Google\Cloud\Vision\V1\DeleteProductSetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/DeleteProductSet', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Creates and returns a new product resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if description is longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is missing or invalid. + * @param \Google\Cloud\Vision\V1\CreateProductRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateProduct(\Google\Cloud\Vision\V1\CreateProductRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/CreateProduct', + $argument, + ['\Google\Cloud\Vision\V1\Product', 'decode'], + $metadata, $options); + } + + /** + * Lists products in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * @param \Google\Cloud\Vision\V1\ListProductsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListProducts(\Google\Cloud\Vision\V1\ListProductsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/ListProducts', + $argument, + ['\Google\Cloud\Vision\V1\ListProductsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets information associated with a Product. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * @param \Google\Cloud\Vision\V1\GetProductRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetProduct(\Google\Cloud\Vision\V1\GetProductRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/GetProduct', + $argument, + ['\Google\Cloud\Vision\V1\Product', 'decode'], + $metadata, $options); + } + + /** + * Makes changes to a Product resource. + * Only the `display_name`, `description`, and `labels` fields can be updated + * right now. + * + * If labels are updated, the change will not be reflected in queries until + * the next index time. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is + * missing from the request or longer than 4096 characters. + * * Returns INVALID_ARGUMENT if description is present in update_mask but is + * longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is present in update_mask. + * @param \Google\Cloud\Vision\V1\UpdateProductRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateProduct(\Google\Cloud\Vision\V1\UpdateProductRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/UpdateProduct', + $argument, + ['\Google\Cloud\Vision\V1\Product', 'decode'], + $metadata, $options); + } + + /** + * Permanently deletes a product and its reference images. + * + * Metadata of the product and all its images will be deleted right away, but + * search queries against ProductSets containing the product may still work + * until all related caches are refreshed. + * @param \Google\Cloud\Vision\V1\DeleteProductRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteProduct(\Google\Cloud\Vision\V1\DeleteProductRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/DeleteProduct', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Creates and returns a new ReferenceImage resource. + * + * The `bounding_poly` field is optional. If `bounding_poly` is not specified, + * the system will try to detect regions of interest in the image that are + * compatible with the product_category on the parent product. If it is + * specified, detection is ALWAYS skipped. The system converts polygons into + * non-rotated rectangles. + * + * Note that the pipeline will resize the image if the image resolution is too + * large to process (above 50MP). + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if the product does not exist. + * * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing + * compatible with the parent product's product_category is detected. + * * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. + * @param \Google\Cloud\Vision\V1\CreateReferenceImageRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateReferenceImage(\Google\Cloud\Vision\V1\CreateReferenceImageRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/CreateReferenceImage', + $argument, + ['\Google\Cloud\Vision\V1\ReferenceImage', 'decode'], + $metadata, $options); + } + + /** + * Permanently deletes a reference image. + * + * The image metadata will be deleted right away, but search queries + * against ProductSets containing the image may still work until all related + * caches are refreshed. + * + * The actual image files are not deleted from Google Cloud Storage. + * @param \Google\Cloud\Vision\V1\DeleteReferenceImageRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteReferenceImage(\Google\Cloud\Vision\V1\DeleteReferenceImageRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/DeleteReferenceImage', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Lists reference images. + * + * Possible errors: + * + * * Returns NOT_FOUND if the parent product does not exist. + * * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less + * than 1. + * @param \Google\Cloud\Vision\V1\ListReferenceImagesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListReferenceImages(\Google\Cloud\Vision\V1\ListReferenceImagesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/ListReferenceImages', + $argument, + ['\Google\Cloud\Vision\V1\ListReferenceImagesResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets information associated with a ReferenceImage. + * + * Possible errors: + * + * * Returns NOT_FOUND if the specified image does not exist. + * @param \Google\Cloud\Vision\V1\GetReferenceImageRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetReferenceImage(\Google\Cloud\Vision\V1\GetReferenceImageRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/GetReferenceImage', + $argument, + ['\Google\Cloud\Vision\V1\ReferenceImage', 'decode'], + $metadata, $options); + } + + /** + * Adds a Product to the specified ProductSet. If the Product is already + * present, no change is made. + * + * One Product can be added to at most 100 ProductSets. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. + * @param \Google\Cloud\Vision\V1\AddProductToProductSetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function AddProductToProductSet(\Google\Cloud\Vision\V1\AddProductToProductSetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/AddProductToProductSet', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Removes a Product from the specified ProductSet. + * @param \Google\Cloud\Vision\V1\RemoveProductFromProductSetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function RemoveProductFromProductSet(\Google\Cloud\Vision\V1\RemoveProductFromProductSetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/RemoveProductFromProductSet', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Lists the Products in a ProductSet, in an unspecified order. If the + * ProductSet does not exist, the products field of the response will be + * empty. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * @param \Google\Cloud\Vision\V1\ListProductsInProductSetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListProductsInProductSet(\Google\Cloud\Vision\V1\ListProductsInProductSetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/ListProductsInProductSet', + $argument, + ['\Google\Cloud\Vision\V1\ListProductsInProductSetResponse', 'decode'], + $metadata, $options); + } + + /** + * Asynchronous API that imports a list of reference images to specified + * product sets based on a list of image information. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the + * progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * `Operation.response` contains `ImportProductSetsResponse`. (results) + * + * The input source of this method is a csv file on Google Cloud Storage. + * For the format of the csv file please see + * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. + * @param \Google\Cloud\Vision\V1\ImportProductSetsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ImportProductSets(\Google\Cloud\Vision\V1\ImportProductSetsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/ImportProductSets', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Asynchronous API to delete all Products in a ProductSet or all Products + * that are in no ProductSet. + * + * If a Product is a member of the specified ProductSet in addition to other + * ProductSets, the Product will still be deleted. + * + * It is recommended to not delete the specified ProductSet until after this + * operation has completed. It is also recommended to not add any of the + * Products involved in the batch delete to a new ProductSet while this + * operation is running because those Products may still end up deleted. + * + * It's not possible to undo the PurgeProducts operation. Therefore, it is + * recommended to keep the csv files used in ImportProductSets (if that was + * how you originally built the Product Set) before starting PurgeProducts, in + * case you need to re-import the data after deletion. + * + * If the plan is to purge all of the Products from a ProductSet and then + * re-use the empty ProductSet to re-import new Products into the empty + * ProductSet, you must wait until the PurgeProducts operation has finished + * for that ProductSet. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the + * progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * @param \Google\Cloud\Vision\V1\PurgeProductsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function PurgeProducts(\Google\Cloud\Vision\V1\PurgeProductsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/PurgeProducts', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/vendor/google/cloud-vision/src/V1/ProductSearchParams.php b/vendor/google/cloud-vision/src/V1/ProductSearchParams.php new file mode 100644 index 00000000..06e28599 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ProductSearchParams.php @@ -0,0 +1,239 @@ +google.cloud.vision.v1.ProductSearchParams + */ +class ProductSearchParams extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon around the area of interest in the image. + * If it is not specified, system discretion will be applied. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 9; + */ + private $bounding_poly = null; + /** + * The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * + * Generated from protobuf field string product_set = 6 [(.google.api.resource_reference) = { + */ + private $product_set = ''; + /** + * The list of product categories to search in. Currently, we only consider + * the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", + * "packagedgoods-v1", or "general-v1" should be specified. The legacy + * categories "homegoods", "apparel", and "toys" are still supported but will + * be deprecated. For new products, please use "homegoods-v2", "apparel-v2", + * or "toys-v2" for better product search accuracy. It is recommended to + * migrate existing products to these categories as well. + * + * Generated from protobuf field repeated string product_categories = 7; + */ + private $product_categories; + /** + * The filtering expression. This can be used to restrict search results based + * on Product labels. We currently support an AND of OR of key-value + * expressions, where each expression within an OR must have the same key. An + * '=' should be used to connect the key and value. + * For example, "(color = red OR color = blue) AND brand = Google" is + * acceptable, but "(color = red OR brand = Google)" is not acceptable. + * "color: red" is not acceptable because it uses a ':' instead of an '='. + * + * Generated from protobuf field string filter = 8; + */ + private $filter = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * The bounding polygon around the area of interest in the image. + * If it is not specified, system discretion will be applied. + * @type string $product_set + * The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $product_categories + * The list of product categories to search in. Currently, we only consider + * the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", + * "packagedgoods-v1", or "general-v1" should be specified. The legacy + * categories "homegoods", "apparel", and "toys" are still supported but will + * be deprecated. For new products, please use "homegoods-v2", "apparel-v2", + * or "toys-v2" for better product search accuracy. It is recommended to + * migrate existing products to these categories as well. + * @type string $filter + * The filtering expression. This can be used to restrict search results based + * on Product labels. We currently support an AND of OR of key-value + * expressions, where each expression within an OR must have the same key. An + * '=' should be used to connect the key and value. + * For example, "(color = red OR color = blue) AND brand = Google" is + * acceptable, but "(color = red OR brand = Google)" is not acceptable. + * "color: red" is not acceptable because it uses a ':' instead of an '='. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon around the area of interest in the image. + * If it is not specified, system discretion will be applied. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 9; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * The bounding polygon around the area of interest in the image. + * If it is not specified, system discretion will be applied. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 9; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * + * Generated from protobuf field string product_set = 6 [(.google.api.resource_reference) = { + * @return string + */ + public function getProductSet() + { + return $this->product_set; + } + + /** + * The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * + * Generated from protobuf field string product_set = 6 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProductSet($var) + { + GPBUtil::checkString($var, True); + $this->product_set = $var; + + return $this; + } + + /** + * The list of product categories to search in. Currently, we only consider + * the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", + * "packagedgoods-v1", or "general-v1" should be specified. The legacy + * categories "homegoods", "apparel", and "toys" are still supported but will + * be deprecated. For new products, please use "homegoods-v2", "apparel-v2", + * or "toys-v2" for better product search accuracy. It is recommended to + * migrate existing products to these categories as well. + * + * Generated from protobuf field repeated string product_categories = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductCategories() + { + return $this->product_categories; + } + + /** + * The list of product categories to search in. Currently, we only consider + * the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", + * "packagedgoods-v1", or "general-v1" should be specified. The legacy + * categories "homegoods", "apparel", and "toys" are still supported but will + * be deprecated. For new products, please use "homegoods-v2", "apparel-v2", + * or "toys-v2" for better product search accuracy. It is recommended to + * migrate existing products to these categories as well. + * + * Generated from protobuf field repeated string product_categories = 7; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductCategories($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->product_categories = $arr; + + return $this; + } + + /** + * The filtering expression. This can be used to restrict search results based + * on Product labels. We currently support an AND of OR of key-value + * expressions, where each expression within an OR must have the same key. An + * '=' should be used to connect the key and value. + * For example, "(color = red OR color = blue) AND brand = Google" is + * acceptable, but "(color = red OR brand = Google)" is not acceptable. + * "color: red" is not acceptable because it uses a ':' instead of an '='. + * + * Generated from protobuf field string filter = 8; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filtering expression. This can be used to restrict search results based + * on Product labels. We currently support an AND of OR of key-value + * expressions, where each expression within an OR must have the same key. An + * '=' should be used to connect the key and value. + * For example, "(color = red OR color = blue) AND brand = Google" is + * acceptable, but "(color = red OR brand = Google)" is not acceptable. + * "color: red" is not acceptable because it uses a ':' instead of an '='. + * + * Generated from protobuf field string filter = 8; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ProductSearchResults.php b/vendor/google/cloud-vision/src/V1/ProductSearchResults.php new file mode 100644 index 00000000..30b53651 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ProductSearchResults.php @@ -0,0 +1,165 @@ +google.cloud.vision.v1.ProductSearchResults + */ +class ProductSearchResults extends \Google\Protobuf\Internal\Message +{ + /** + * Timestamp of the index which provided these results. Products added to the + * product set and products removed from the product set after this time are + * not reflected in the current results. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 2; + */ + private $index_time = null; + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 5; + */ + private $results; + /** + * List of results grouped by products detected in the query image. Each entry + * corresponds to one bounding polygon in the query image, and contains the + * matching products specific to that region. There may be duplicate product + * matches in the union of all the per-product results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.GroupedResult product_grouped_results = 6; + */ + private $product_grouped_results; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $index_time + * Timestamp of the index which provided these results. Products added to the + * product set and products removed from the product set after this time are + * not reflected in the current results. + * @type \Google\Cloud\Vision\V1\ProductSearchResults\Result[]|\Google\Protobuf\Internal\RepeatedField $results + * List of results, one for each product match. + * @type \Google\Cloud\Vision\V1\ProductSearchResults\GroupedResult[]|\Google\Protobuf\Internal\RepeatedField $product_grouped_results + * List of results grouped by products detected in the query image. Each entry + * corresponds to one bounding polygon in the query image, and contains the + * matching products specific to that region. There may be duplicate product + * matches in the union of all the per-product results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * Timestamp of the index which provided these results. Products added to the + * product set and products removed from the product set after this time are + * not reflected in the current results. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getIndexTime() + { + return $this->index_time; + } + + public function hasIndexTime() + { + return isset($this->index_time); + } + + public function clearIndexTime() + { + unset($this->index_time); + } + + /** + * Timestamp of the index which provided these results. Products added to the + * product set and products removed from the product set after this time are + * not reflected in the current results. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setIndexTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->index_time = $var; + + return $this; + } + + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResults() + { + return $this->results; + } + + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 5; + * @param \Google\Cloud\Vision\V1\ProductSearchResults\Result[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\Result::class); + $this->results = $arr; + + return $this; + } + + /** + * List of results grouped by products detected in the query image. Each entry + * corresponds to one bounding polygon in the query image, and contains the + * matching products specific to that region. There may be duplicate product + * matches in the union of all the per-product results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.GroupedResult product_grouped_results = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductGroupedResults() + { + return $this->product_grouped_results; + } + + /** + * List of results grouped by products detected in the query image. Each entry + * corresponds to one bounding polygon in the query image, and contains the + * matching products specific to that region. There may be duplicate product + * matches in the union of all the per-product results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.GroupedResult product_grouped_results = 6; + * @param \Google\Cloud\Vision\V1\ProductSearchResults\GroupedResult[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductGroupedResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\GroupedResult::class); + $this->product_grouped_results = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ProductSearchResults/GroupedResult.php b/vendor/google/cloud-vision/src/V1/ProductSearchResults/GroupedResult.php new file mode 100644 index 00000000..d589da86 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ProductSearchResults/GroupedResult.php @@ -0,0 +1,149 @@ +google.cloud.vision.v1.ProductSearchResults.GroupedResult + */ +class GroupedResult extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon around the product detected in the query image. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + */ + private $bounding_poly = null; + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 2; + */ + private $results; + /** + * List of generic predictions for the object in the bounding box. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation object_annotations = 3; + */ + private $object_annotations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * The bounding polygon around the product detected in the query image. + * @type \Google\Cloud\Vision\V1\ProductSearchResults\Result[]|\Google\Protobuf\Internal\RepeatedField $results + * List of results, one for each product match. + * @type \Google\Cloud\Vision\V1\ProductSearchResults\ObjectAnnotation[]|\Google\Protobuf\Internal\RepeatedField $object_annotations + * List of generic predictions for the object in the bounding box. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon around the product detected in the query image. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * The bounding polygon around the product detected in the query image. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResults() + { + return $this->results; + } + + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 2; + * @param \Google\Cloud\Vision\V1\ProductSearchResults\Result[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\Result::class); + $this->results = $arr; + + return $this; + } + + /** + * List of generic predictions for the object in the bounding box. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation object_annotations = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getObjectAnnotations() + { + return $this->object_annotations; + } + + /** + * List of generic predictions for the object in the bounding box. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation object_annotations = 3; + * @param \Google\Cloud\Vision\V1\ProductSearchResults\ObjectAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setObjectAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\ObjectAnnotation::class); + $this->object_annotations = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GroupedResult::class, \Google\Cloud\Vision\V1\ProductSearchResults_GroupedResult::class); + diff --git a/vendor/google/cloud-vision/src/V1/ProductSearchResults/ObjectAnnotation.php b/vendor/google/cloud-vision/src/V1/ProductSearchResults/ObjectAnnotation.php new file mode 100644 index 00000000..9ebeaa22 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ProductSearchResults/ObjectAnnotation.php @@ -0,0 +1,180 @@ +google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation + */ +class ObjectAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Object ID that should align with EntityAnnotation mid. + * + * Generated from protobuf field string mid = 1; + */ + private $mid = ''; + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + */ + private $language_code = ''; + /** + * Object name, expressed in its `language_code` language. + * + * Generated from protobuf field string name = 3; + */ + private $name = ''; + /** + * Score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + */ + private $score = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mid + * Object ID that should align with EntityAnnotation mid. + * @type string $language_code + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * @type string $name + * Object name, expressed in its `language_code` language. + * @type float $score + * Score of the result. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * Object ID that should align with EntityAnnotation mid. + * + * Generated from protobuf field string mid = 1; + * @return string + */ + public function getMid() + { + return $this->mid; + } + + /** + * Object ID that should align with EntityAnnotation mid. + * + * Generated from protobuf field string mid = 1; + * @param string $var + * @return $this + */ + public function setMid($var) + { + GPBUtil::checkString($var, True); + $this->mid = $var; + + return $this; + } + + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * Object name, expressed in its `language_code` language. + * + * Generated from protobuf field string name = 3; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Object name, expressed in its `language_code` language. + * + * Generated from protobuf field string name = 3; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ObjectAnnotation::class, \Google\Cloud\Vision\V1\ProductSearchResults_ObjectAnnotation::class); + diff --git a/vendor/google/cloud-vision/src/V1/ProductSearchResults/Result.php b/vendor/google/cloud-vision/src/V1/ProductSearchResults/Result.php new file mode 100644 index 00000000..464bd86b --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ProductSearchResults/Result.php @@ -0,0 +1,156 @@ +google.cloud.vision.v1.ProductSearchResults.Result + */ +class Result extends \Google\Protobuf\Internal\Message +{ + /** + * The Product. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1; + */ + private $product = null; + /** + * A confidence level on the match, ranging from 0 (no confidence) to + * 1 (full confidence). + * + * Generated from protobuf field float score = 2; + */ + private $score = 0.0; + /** + * The resource name of the image from the product that is the closest match + * to the query. + * + * Generated from protobuf field string image = 3; + */ + private $image = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Product $product + * The Product. + * @type float $score + * A confidence level on the match, ranging from 0 (no confidence) to + * 1 (full confidence). + * @type string $image + * The resource name of the image from the product that is the closest match + * to the query. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * The Product. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1; + * @return \Google\Cloud\Vision\V1\Product|null + */ + public function getProduct() + { + return $this->product; + } + + public function hasProduct() + { + return isset($this->product); + } + + public function clearProduct() + { + unset($this->product); + } + + /** + * The Product. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1; + * @param \Google\Cloud\Vision\V1\Product $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Product::class); + $this->product = $var; + + return $this; + } + + /** + * A confidence level on the match, ranging from 0 (no confidence) to + * 1 (full confidence). + * + * Generated from protobuf field float score = 2; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * A confidence level on the match, ranging from 0 (no confidence) to + * 1 (full confidence). + * + * Generated from protobuf field float score = 2; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * The resource name of the image from the product that is the closest match + * to the query. + * + * Generated from protobuf field string image = 3; + * @return string + */ + public function getImage() + { + return $this->image; + } + + /** + * The resource name of the image from the product that is the closest match + * to the query. + * + * Generated from protobuf field string image = 3; + * @param string $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkString($var, True); + $this->image = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Result::class, \Google\Cloud\Vision\V1\ProductSearchResults_Result::class); + diff --git a/vendor/google/cloud-vision/src/V1/ProductSearchResults_GroupedResult.php b/vendor/google/cloud-vision/src/V1/ProductSearchResults_GroupedResult.php new file mode 100644 index 00000000..82125013 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ProductSearchResults_GroupedResult.php @@ -0,0 +1,16 @@ +google.cloud.vision.v1.ProductSet + */ +class ProductSet extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The user-provided name for this ProductSet. Must not be empty. Must be at + * most 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + */ + private $display_name = ''; + /** + * Output only. The time at which this ProductSet was last indexed. Query + * results will reflect all updates before this time. If this ProductSet has + * never been indexed, this timestamp is the default value + * "1970-01-01T00:00:00Z". + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $index_time = null; + /** + * Output only. If there was an error with indexing the product set, the field + * is populated. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.rpc.Status index_error = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $index_error = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * This field is ignored when creating a ProductSet. + * @type string $display_name + * The user-provided name for this ProductSet. Must not be empty. Must be at + * most 4096 characters long. + * @type \Google\Protobuf\Timestamp $index_time + * Output only. The time at which this ProductSet was last indexed. Query + * results will reflect all updates before this time. If this ProductSet has + * never been indexed, this timestamp is the default value + * "1970-01-01T00:00:00Z". + * This field is ignored when creating a ProductSet. + * @type \Google\Rpc\Status $index_error + * Output only. If there was an error with indexing the product set, the field + * is populated. + * This field is ignored when creating a ProductSet. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The user-provided name for this ProductSet. Must not be empty. Must be at + * most 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The user-provided name for this ProductSet. Must not be empty. Must be at + * most 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. The time at which this ProductSet was last indexed. Query + * results will reflect all updates before this time. If this ProductSet has + * never been indexed, this timestamp is the default value + * "1970-01-01T00:00:00Z". + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getIndexTime() + { + return $this->index_time; + } + + public function hasIndexTime() + { + return isset($this->index_time); + } + + public function clearIndexTime() + { + unset($this->index_time); + } + + /** + * Output only. The time at which this ProductSet was last indexed. Query + * results will reflect all updates before this time. If this ProductSet has + * never been indexed, this timestamp is the default value + * "1970-01-01T00:00:00Z". + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setIndexTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->index_time = $var; + + return $this; + } + + /** + * Output only. If there was an error with indexing the product set, the field + * is populated. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.rpc.Status index_error = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getIndexError() + { + return $this->index_error; + } + + public function hasIndexError() + { + return isset($this->index_error); + } + + public function clearIndexError() + { + unset($this->index_error); + } + + /** + * Output only. If there was an error with indexing the product set, the field + * is populated. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.rpc.Status index_error = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setIndexError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->index_error = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/ProductSetPurgeConfig.php b/vendor/google/cloud-vision/src/V1/ProductSetPurgeConfig.php new file mode 100644 index 00000000..8e14cb78 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ProductSetPurgeConfig.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.ProductSetPurgeConfig + */ +class ProductSetPurgeConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The ProductSet that contains the Products to delete. If a Product is a + * member of product_set_id in addition to other ProductSets, the Product will + * still be deleted. + * + * Generated from protobuf field string product_set_id = 1; + */ + private $product_set_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $product_set_id + * The ProductSet that contains the Products to delete. If a Product is a + * member of product_set_id in addition to other ProductSets, the Product will + * still be deleted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The ProductSet that contains the Products to delete. If a Product is a + * member of product_set_id in addition to other ProductSets, the Product will + * still be deleted. + * + * Generated from protobuf field string product_set_id = 1; + * @return string + */ + public function getProductSetId() + { + return $this->product_set_id; + } + + /** + * The ProductSet that contains the Products to delete. If a Product is a + * member of product_set_id in addition to other ProductSets, the Product will + * still be deleted. + * + * Generated from protobuf field string product_set_id = 1; + * @param string $var + * @return $this + */ + public function setProductSetId($var) + { + GPBUtil::checkString($var, True); + $this->product_set_id = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/Product_KeyValue.php b/vendor/google/cloud-vision/src/V1/Product_KeyValue.php new file mode 100644 index 00000000..694da6b2 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Product_KeyValue.php @@ -0,0 +1,16 @@ +google.cloud.vision.v1.Property + */ +class Property extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the property. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * Value of the property. + * + * Generated from protobuf field string value = 2; + */ + private $value = ''; + /** + * Value of numeric properties. + * + * Generated from protobuf field uint64 uint64_value = 3; + */ + private $uint64_value = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of the property. + * @type string $value + * Value of the property. + * @type int|string $uint64_value + * Value of numeric properties. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Name of the property. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the property. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Value of the property. + * + * Generated from protobuf field string value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Value of the property. + * + * Generated from protobuf field string value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + + /** + * Value of numeric properties. + * + * Generated from protobuf field uint64 uint64_value = 3; + * @return int|string + */ + public function getUint64Value() + { + return $this->uint64_value; + } + + /** + * Value of numeric properties. + * + * Generated from protobuf field uint64 uint64_value = 3; + * @param int|string $var + * @return $this + */ + public function setUint64Value($var) + { + GPBUtil::checkUint64($var); + $this->uint64_value = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/PurgeProductsRequest.php b/vendor/google/cloud-vision/src/V1/PurgeProductsRequest.php new file mode 100644 index 00000000..7430e5ee --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/PurgeProductsRequest.php @@ -0,0 +1,187 @@ +google.cloud.vision.v1.PurgeProductsRequest + */ +class PurgeProductsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location in which the Products should be deleted. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * The default value is false. Override this value to true to actually perform + * the purge. + * + * Generated from protobuf field bool force = 4; + */ + private $force = false; + protected $target; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ProductSetPurgeConfig $product_set_purge_config + * Specify which ProductSet contains the Products to be deleted. + * @type bool $delete_orphan_products + * If delete_orphan_products is true, all Products that are not in any + * ProductSet will be deleted. + * @type string $parent + * Required. The project and location in which the Products should be deleted. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @type bool $force + * The default value is false. Override this value to true to actually perform + * the purge. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Specify which ProductSet contains the Products to be deleted. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSetPurgeConfig product_set_purge_config = 2; + * @return \Google\Cloud\Vision\V1\ProductSetPurgeConfig|null + */ + public function getProductSetPurgeConfig() + { + return $this->readOneof(2); + } + + public function hasProductSetPurgeConfig() + { + return $this->hasOneof(2); + } + + /** + * Specify which ProductSet contains the Products to be deleted. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSetPurgeConfig product_set_purge_config = 2; + * @param \Google\Cloud\Vision\V1\ProductSetPurgeConfig $var + * @return $this + */ + public function setProductSetPurgeConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSetPurgeConfig::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * If delete_orphan_products is true, all Products that are not in any + * ProductSet will be deleted. + * + * Generated from protobuf field bool delete_orphan_products = 3; + * @return bool + */ + public function getDeleteOrphanProducts() + { + return $this->readOneof(3); + } + + public function hasDeleteOrphanProducts() + { + return $this->hasOneof(3); + } + + /** + * If delete_orphan_products is true, all Products that are not in any + * ProductSet will be deleted. + * + * Generated from protobuf field bool delete_orphan_products = 3; + * @param bool $var + * @return $this + */ + public function setDeleteOrphanProducts($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Required. The project and location in which the Products should be deleted. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location in which the Products should be deleted. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The default value is false. Override this value to true to actually perform + * the purge. + * + * Generated from protobuf field bool force = 4; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * The default value is false. Override this value to true to actually perform + * the purge. + * + * Generated from protobuf field bool force = 4; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + + /** + * @return string + */ + public function getTarget() + { + return $this->whichOneof("target"); + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/README.md b/vendor/google/cloud-vision/src/V1/README.md new file mode 100644 index 00000000..1ac45178 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/README.md @@ -0,0 +1,17 @@ +# Google Cloud Vision V1 generated client for PHP + +### Sample + +```php +require 'vendor/autoload.php'; + +use Google\Cloud\Vision\V1\ImageAnnotatorClient; + +$imageAnnotatorClient = new ImageAnnotatorClient(); +try { + $requests = []; + $response = $imageAnnotatorClient->batchAnnotateImages($requests); +} finally { + $imageAnnotatorClient->close(); +} +``` diff --git a/vendor/google/cloud-vision/src/V1/ReferenceImage.php b/vendor/google/cloud-vision/src/V1/ReferenceImage.php new file mode 100644 index 00000000..c1aa62a0 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/ReferenceImage.php @@ -0,0 +1,176 @@ +google.cloud.vision.v1.ReferenceImage + */ +class ReferenceImage extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the reference image. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * This field is ignored when creating a reference image. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * Required. The Google Cloud Storage URI of the reference image. + * The URI must start with `gs://`. + * + * Generated from protobuf field string uri = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $uri = ''; + /** + * Optional. Bounding polygons around the areas of interest in the reference image. + * If this field is empty, the system will try to detect regions of + * interest. At most 10 bounding polygons will be used. + * The provided shape is converted into a non-rotated rectangle. Once + * converted, the small edge of the rectangle must be greater than or equal + * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + * is not). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.BoundingPoly bounding_polys = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $bounding_polys; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the reference image. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * This field is ignored when creating a reference image. + * @type string $uri + * Required. The Google Cloud Storage URI of the reference image. + * The URI must start with `gs://`. + * @type \Google\Cloud\Vision\V1\BoundingPoly[]|\Google\Protobuf\Internal\RepeatedField $bounding_polys + * Optional. Bounding polygons around the areas of interest in the reference image. + * If this field is empty, the system will try to detect regions of + * interest. At most 10 bounding polygons will be used. + * The provided shape is converted into a non-rotated rectangle. Once + * converted, the small edge of the rectangle must be greater than or equal + * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + * is not). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the reference image. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * This field is ignored when creating a reference image. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the reference image. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * This field is ignored when creating a reference image. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The Google Cloud Storage URI of the reference image. + * The URI must start with `gs://`. + * + * Generated from protobuf field string uri = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Required. The Google Cloud Storage URI of the reference image. + * The URI must start with `gs://`. + * + * Generated from protobuf field string uri = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Optional. Bounding polygons around the areas of interest in the reference image. + * If this field is empty, the system will try to detect regions of + * interest. At most 10 bounding polygons will be used. + * The provided shape is converted into a non-rotated rectangle. Once + * converted, the small edge of the rectangle must be greater than or equal + * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + * is not). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.BoundingPoly bounding_polys = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBoundingPolys() + { + return $this->bounding_polys; + } + + /** + * Optional. Bounding polygons around the areas of interest in the reference image. + * If this field is empty, the system will try to detect regions of + * interest. At most 10 bounding polygons will be used. + * The provided shape is converted into a non-rotated rectangle. Once + * converted, the small edge of the rectangle must be greater than or equal + * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + * is not). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.BoundingPoly bounding_polys = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Vision\V1\BoundingPoly[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBoundingPolys($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_polys = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/RemoveProductFromProductSetRequest.php b/vendor/google/cloud-vision/src/V1/RemoveProductFromProductSetRequest.php new file mode 100644 index 00000000..db0e08f4 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/RemoveProductFromProductSetRequest.php @@ -0,0 +1,117 @@ +google.cloud.vision.v1.RemoveProductFromProductSetRequest + */ +class RemoveProductFromProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + /** + * Required. The resource name for the Product to be removed from this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $product = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @type string $product + * Required. The resource name for the Product to be removed from this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The resource name for the Product to be removed from this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProduct() + { + return $this->product; + } + + /** + * Required. The resource name for the Product to be removed from this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkString($var, True); + $this->product = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/SafeSearchAnnotation.php b/vendor/google/cloud-vision/src/V1/SafeSearchAnnotation.php new file mode 100644 index 00000000..a8107a86 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/SafeSearchAnnotation.php @@ -0,0 +1,491 @@ +google.cloud.vision.v1.SafeSearchAnnotation + */ +class SafeSearchAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Represents the adult content likelihood for the image. Adult content may + * contain elements such as nudity, pornographic images or cartoons, or + * sexual activities. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood adult = 1; + */ + private $adult = 0; + /** + * Spoof likelihood. The likelihood that an modification + * was made to the image's canonical version to make it appear + * funny or offensive. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood spoof = 2; + */ + private $spoof = 0; + /** + * Likelihood that this is a medical image. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood medical = 3; + */ + private $medical = 0; + /** + * Likelihood that this image contains violent content. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood violence = 4; + */ + private $violence = 0; + /** + * Likelihood that the request image contains racy content. Racy content may + * include (but is not limited to) skimpy or sheer clothing, strategically + * covered nudity, lewd or provocative poses, or close-ups of sensitive + * body areas. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood racy = 9; + */ + private $racy = 0; + /** + * Confidence of adult_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * + * Generated from protobuf field float adult_confidence = 16 [deprecated = true]; + * @deprecated + */ + protected $adult_confidence = 0.0; + /** + * Confidence of spoof_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * + * Generated from protobuf field float spoof_confidence = 18 [deprecated = true]; + * @deprecated + */ + protected $spoof_confidence = 0.0; + /** + * Confidence of medical_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * + * Generated from protobuf field float medical_confidence = 20 [deprecated = true]; + * @deprecated + */ + protected $medical_confidence = 0.0; + /** + * Confidence of violence_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * + * Generated from protobuf field float violence_confidence = 22 [deprecated = true]; + * @deprecated + */ + protected $violence_confidence = 0.0; + /** + * Confidence of racy_score. Range [0, 1]. 0 means not confident, 1 means very + * confident. + * + * Generated from protobuf field float racy_confidence = 24 [deprecated = true]; + * @deprecated + */ + protected $racy_confidence = 0.0; + /** + * Confidence of nsfw_score. Range [0, 1]. 0 means not confident, 1 means very + * confident. + * + * Generated from protobuf field float nsfw_confidence = 26 [deprecated = true]; + * @deprecated + */ + protected $nsfw_confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $adult + * Represents the adult content likelihood for the image. Adult content may + * contain elements such as nudity, pornographic images or cartoons, or + * sexual activities. + * @type int $spoof + * Spoof likelihood. The likelihood that an modification + * was made to the image's canonical version to make it appear + * funny or offensive. + * @type int $medical + * Likelihood that this is a medical image. + * @type int $violence + * Likelihood that this image contains violent content. + * @type int $racy + * Likelihood that the request image contains racy content. Racy content may + * include (but is not limited to) skimpy or sheer clothing, strategically + * covered nudity, lewd or provocative poses, or close-ups of sensitive + * body areas. + * @type float $adult_confidence + * Confidence of adult_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * @type float $spoof_confidence + * Confidence of spoof_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * @type float $medical_confidence + * Confidence of medical_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * @type float $violence_confidence + * Confidence of violence_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * @type float $racy_confidence + * Confidence of racy_score. Range [0, 1]. 0 means not confident, 1 means very + * confident. + * @type float $nsfw_confidence + * Confidence of nsfw_score. Range [0, 1]. 0 means not confident, 1 means very + * confident. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Represents the adult content likelihood for the image. Adult content may + * contain elements such as nudity, pornographic images or cartoons, or + * sexual activities. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood adult = 1; + * @return int + */ + public function getAdult() + { + return $this->adult; + } + + /** + * Represents the adult content likelihood for the image. Adult content may + * contain elements such as nudity, pornographic images or cartoons, or + * sexual activities. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood adult = 1; + * @param int $var + * @return $this + */ + public function setAdult($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->adult = $var; + + return $this; + } + + /** + * Spoof likelihood. The likelihood that an modification + * was made to the image's canonical version to make it appear + * funny or offensive. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood spoof = 2; + * @return int + */ + public function getSpoof() + { + return $this->spoof; + } + + /** + * Spoof likelihood. The likelihood that an modification + * was made to the image's canonical version to make it appear + * funny or offensive. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood spoof = 2; + * @param int $var + * @return $this + */ + public function setSpoof($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->spoof = $var; + + return $this; + } + + /** + * Likelihood that this is a medical image. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood medical = 3; + * @return int + */ + public function getMedical() + { + return $this->medical; + } + + /** + * Likelihood that this is a medical image. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood medical = 3; + * @param int $var + * @return $this + */ + public function setMedical($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->medical = $var; + + return $this; + } + + /** + * Likelihood that this image contains violent content. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood violence = 4; + * @return int + */ + public function getViolence() + { + return $this->violence; + } + + /** + * Likelihood that this image contains violent content. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood violence = 4; + * @param int $var + * @return $this + */ + public function setViolence($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->violence = $var; + + return $this; + } + + /** + * Likelihood that the request image contains racy content. Racy content may + * include (but is not limited to) skimpy or sheer clothing, strategically + * covered nudity, lewd or provocative poses, or close-ups of sensitive + * body areas. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood racy = 9; + * @return int + */ + public function getRacy() + { + return $this->racy; + } + + /** + * Likelihood that the request image contains racy content. Racy content may + * include (but is not limited to) skimpy or sheer clothing, strategically + * covered nudity, lewd or provocative poses, or close-ups of sensitive + * body areas. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood racy = 9; + * @param int $var + * @return $this + */ + public function setRacy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->racy = $var; + + return $this; + } + + /** + * Confidence of adult_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * + * Generated from protobuf field float adult_confidence = 16 [deprecated = true]; + * @return float + * @deprecated + */ + public function getAdultConfidence() + { + @trigger_error('adult_confidence is deprecated.', E_USER_DEPRECATED); + return $this->adult_confidence; + } + + /** + * Confidence of adult_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * + * Generated from protobuf field float adult_confidence = 16 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setAdultConfidence($var) + { + @trigger_error('adult_confidence is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkFloat($var); + $this->adult_confidence = $var; + + return $this; + } + + /** + * Confidence of spoof_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * + * Generated from protobuf field float spoof_confidence = 18 [deprecated = true]; + * @return float + * @deprecated + */ + public function getSpoofConfidence() + { + @trigger_error('spoof_confidence is deprecated.', E_USER_DEPRECATED); + return $this->spoof_confidence; + } + + /** + * Confidence of spoof_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * + * Generated from protobuf field float spoof_confidence = 18 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setSpoofConfidence($var) + { + @trigger_error('spoof_confidence is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkFloat($var); + $this->spoof_confidence = $var; + + return $this; + } + + /** + * Confidence of medical_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * + * Generated from protobuf field float medical_confidence = 20 [deprecated = true]; + * @return float + * @deprecated + */ + public function getMedicalConfidence() + { + @trigger_error('medical_confidence is deprecated.', E_USER_DEPRECATED); + return $this->medical_confidence; + } + + /** + * Confidence of medical_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * + * Generated from protobuf field float medical_confidence = 20 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setMedicalConfidence($var) + { + @trigger_error('medical_confidence is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkFloat($var); + $this->medical_confidence = $var; + + return $this; + } + + /** + * Confidence of violence_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * + * Generated from protobuf field float violence_confidence = 22 [deprecated = true]; + * @return float + * @deprecated + */ + public function getViolenceConfidence() + { + @trigger_error('violence_confidence is deprecated.', E_USER_DEPRECATED); + return $this->violence_confidence; + } + + /** + * Confidence of violence_score. Range [0, 1]. 0 means not confident, 1 means + * very confident. + * + * Generated from protobuf field float violence_confidence = 22 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setViolenceConfidence($var) + { + @trigger_error('violence_confidence is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkFloat($var); + $this->violence_confidence = $var; + + return $this; + } + + /** + * Confidence of racy_score. Range [0, 1]. 0 means not confident, 1 means very + * confident. + * + * Generated from protobuf field float racy_confidence = 24 [deprecated = true]; + * @return float + * @deprecated + */ + public function getRacyConfidence() + { + @trigger_error('racy_confidence is deprecated.', E_USER_DEPRECATED); + return $this->racy_confidence; + } + + /** + * Confidence of racy_score. Range [0, 1]. 0 means not confident, 1 means very + * confident. + * + * Generated from protobuf field float racy_confidence = 24 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setRacyConfidence($var) + { + @trigger_error('racy_confidence is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkFloat($var); + $this->racy_confidence = $var; + + return $this; + } + + /** + * Confidence of nsfw_score. Range [0, 1]. 0 means not confident, 1 means very + * confident. + * + * Generated from protobuf field float nsfw_confidence = 26 [deprecated = true]; + * @return float + * @deprecated + */ + public function getNsfwConfidence() + { + @trigger_error('nsfw_confidence is deprecated.', E_USER_DEPRECATED); + return $this->nsfw_confidence; + } + + /** + * Confidence of nsfw_score. Range [0, 1]. 0 means not confident, 1 means very + * confident. + * + * Generated from protobuf field float nsfw_confidence = 26 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setNsfwConfidence($var) + { + @trigger_error('nsfw_confidence is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkFloat($var); + $this->nsfw_confidence = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/Symbol.php b/vendor/google/cloud-vision/src/V1/Symbol.php new file mode 100644 index 00000000..dafb6805 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Symbol.php @@ -0,0 +1,245 @@ +google.cloud.vision.v1.Symbol + */ +class Symbol extends \Google\Protobuf\Internal\Message +{ + /** + * Additional information detected for the symbol. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + */ + private $property = null; + /** + * The bounding box for the symbol. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + */ + private $bounding_box = null; + /** + * The actual UTF-8 representation of the symbol. + * + * Generated from protobuf field string text = 3; + */ + private $text = ''; + /** + * Confidence of the OCR results for the symbol. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + */ + private $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $property + * Additional information detected for the symbol. + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_box + * The bounding box for the symbol. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * @type string $text + * The actual UTF-8 representation of the symbol. + * @type float $confidence + * Confidence of the OCR results for the symbol. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * Additional information detected for the symbol. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @return \Google\Cloud\Vision\V1\TextAnnotation\TextProperty|null + */ + public function getProperty() + { + return $this->property; + } + + public function hasProperty() + { + return isset($this->property); + } + + public function clearProperty() + { + unset($this->property); + } + + /** + * Additional information detected for the symbol. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @param \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $var + * @return $this + */ + public function setProperty($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation\TextProperty::class); + $this->property = $var; + + return $this; + } + + /** + * The bounding box for the symbol. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingBox() + { + return $this->bounding_box; + } + + public function hasBoundingBox() + { + return isset($this->bounding_box); + } + + public function clearBoundingBox() + { + unset($this->bounding_box); + } + + /** + * The bounding box for the symbol. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingBox($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_box = $var; + + return $this; + } + + /** + * The actual UTF-8 representation of the symbol. + * + * Generated from protobuf field string text = 3; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * The actual UTF-8 representation of the symbol. + * + * Generated from protobuf field string text = 3; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * Confidence of the OCR results for the symbol. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of the OCR results for the symbol. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/TextAnnotation.php b/vendor/google/cloud-vision/src/V1/TextAnnotation.php new file mode 100644 index 00000000..0117a00f --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/TextAnnotation.php @@ -0,0 +1,107 @@ + Page -> Block -> Paragraph -> Word -> Symbol + * Each structural component, starting from Page, may further have their own + * properties. Properties describe detected languages, breaks etc.. Please refer + * to the [TextAnnotation.TextProperty][google.cloud.vision.v1.TextAnnotation.TextProperty] message definition below for more + * detail. + * + * Generated from protobuf message google.cloud.vision.v1.TextAnnotation + */ +class TextAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * List of pages detected by OCR. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Page pages = 1; + */ + private $pages; + /** + * UTF-8 text detected on the pages. + * + * Generated from protobuf field string text = 2; + */ + private $text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Page[]|\Google\Protobuf\Internal\RepeatedField $pages + * List of pages detected by OCR. + * @type string $text + * UTF-8 text detected on the pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * List of pages detected by OCR. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Page pages = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPages() + { + return $this->pages; + } + + /** + * List of pages detected by OCR. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Page pages = 1; + * @param \Google\Cloud\Vision\V1\Page[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Page::class); + $this->pages = $arr; + + return $this; + } + + /** + * UTF-8 text detected on the pages. + * + * Generated from protobuf field string text = 2; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * UTF-8 text detected on the pages. + * + * Generated from protobuf field string text = 2; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/TextAnnotation/DetectedBreak.php b/vendor/google/cloud-vision/src/V1/TextAnnotation/DetectedBreak.php new file mode 100644 index 00000000..c9104dc6 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/TextAnnotation/DetectedBreak.php @@ -0,0 +1,104 @@ +google.cloud.vision.v1.TextAnnotation.DetectedBreak + */ +class DetectedBreak extends \Google\Protobuf\Internal\Message +{ + /** + * Detected break type. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType type = 1; + */ + private $type = 0; + /** + * True if break prepends the element. + * + * Generated from protobuf field bool is_prefix = 2; + */ + private $is_prefix = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Detected break type. + * @type bool $is_prefix + * True if break prepends the element. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * Detected break type. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Detected break type. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\TextAnnotation\DetectedBreak\BreakType::class); + $this->type = $var; + + return $this; + } + + /** + * True if break prepends the element. + * + * Generated from protobuf field bool is_prefix = 2; + * @return bool + */ + public function getIsPrefix() + { + return $this->is_prefix; + } + + /** + * True if break prepends the element. + * + * Generated from protobuf field bool is_prefix = 2; + * @param bool $var + * @return $this + */ + public function setIsPrefix($var) + { + GPBUtil::checkBool($var); + $this->is_prefix = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DetectedBreak::class, \Google\Cloud\Vision\V1\TextAnnotation_DetectedBreak::class); + diff --git a/vendor/google/cloud-vision/src/V1/TextAnnotation/DetectedBreak/BreakType.php b/vendor/google/cloud-vision/src/V1/TextAnnotation/DetectedBreak/BreakType.php new file mode 100644 index 00000000..455626c4 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/TextAnnotation/DetectedBreak/BreakType.php @@ -0,0 +1,86 @@ +google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType + */ +class BreakType +{ + /** + * Unknown break label type. + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * Regular space. + * + * Generated from protobuf enum SPACE = 1; + */ + const SPACE = 1; + /** + * Sure space (very wide). + * + * Generated from protobuf enum SURE_SPACE = 2; + */ + const SURE_SPACE = 2; + /** + * Line-wrapping break. + * + * Generated from protobuf enum EOL_SURE_SPACE = 3; + */ + const EOL_SURE_SPACE = 3; + /** + * End-line hyphen that is not present in text; does not co-occur with + * `SPACE`, `LEADER_SPACE`, or `LINE_BREAK`. + * + * Generated from protobuf enum HYPHEN = 4; + */ + const HYPHEN = 4; + /** + * Line break that ends a paragraph. + * + * Generated from protobuf enum LINE_BREAK = 5; + */ + const LINE_BREAK = 5; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::SPACE => 'SPACE', + self::SURE_SPACE => 'SURE_SPACE', + self::EOL_SURE_SPACE => 'EOL_SURE_SPACE', + self::HYPHEN => 'HYPHEN', + self::LINE_BREAK => 'LINE_BREAK', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BreakType::class, \Google\Cloud\Vision\V1\TextAnnotation_DetectedBreak_BreakType::class); + diff --git a/vendor/google/cloud-vision/src/V1/TextAnnotation/DetectedLanguage.php b/vendor/google/cloud-vision/src/V1/TextAnnotation/DetectedLanguage.php new file mode 100644 index 00000000..0e763eae --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/TextAnnotation/DetectedLanguage.php @@ -0,0 +1,112 @@ +google.cloud.vision.v1.TextAnnotation.DetectedLanguage + */ +class DetectedLanguage extends \Google\Protobuf\Internal\Message +{ + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 1; + */ + private $language_code = ''; + /** + * Confidence of detected language. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + */ + private $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $language_code + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * @type float $confidence + * Confidence of detected language. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 1; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 1; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * Confidence of detected language. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of detected language. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DetectedLanguage::class, \Google\Cloud\Vision\V1\TextAnnotation_DetectedLanguage::class); + diff --git a/vendor/google/cloud-vision/src/V1/TextAnnotation/TextProperty.php b/vendor/google/cloud-vision/src/V1/TextAnnotation/TextProperty.php new file mode 100644 index 00000000..1f097763 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/TextAnnotation/TextProperty.php @@ -0,0 +1,114 @@ +google.cloud.vision.v1.TextAnnotation.TextProperty + */ +class TextProperty extends \Google\Protobuf\Internal\Message +{ + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.TextAnnotation.DetectedLanguage detected_languages = 1; + */ + private $detected_languages; + /** + * Detected start or end of a text segment. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.DetectedBreak detected_break = 2; + */ + private $detected_break = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\TextAnnotation\DetectedLanguage[]|\Google\Protobuf\Internal\RepeatedField $detected_languages + * A list of detected languages together with confidence. + * @type \Google\Cloud\Vision\V1\TextAnnotation\DetectedBreak $detected_break + * Detected start or end of a text segment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.TextAnnotation.DetectedLanguage detected_languages = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedLanguages() + { + return $this->detected_languages; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.TextAnnotation.DetectedLanguage detected_languages = 1; + * @param \Google\Cloud\Vision\V1\TextAnnotation\DetectedLanguage[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\TextAnnotation\DetectedLanguage::class); + $this->detected_languages = $arr; + + return $this; + } + + /** + * Detected start or end of a text segment. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.DetectedBreak detected_break = 2; + * @return \Google\Cloud\Vision\V1\TextAnnotation\DetectedBreak|null + */ + public function getDetectedBreak() + { + return $this->detected_break; + } + + public function hasDetectedBreak() + { + return isset($this->detected_break); + } + + public function clearDetectedBreak() + { + unset($this->detected_break); + } + + /** + * Detected start or end of a text segment. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.DetectedBreak detected_break = 2; + * @param \Google\Cloud\Vision\V1\TextAnnotation\DetectedBreak $var + * @return $this + */ + public function setDetectedBreak($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation\DetectedBreak::class); + $this->detected_break = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TextProperty::class, \Google\Cloud\Vision\V1\TextAnnotation_TextProperty::class); + diff --git a/vendor/google/cloud-vision/src/V1/TextAnnotation_DetectedBreak.php b/vendor/google/cloud-vision/src/V1/TextAnnotation_DetectedBreak.php new file mode 100644 index 00000000..4bfe2f59 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/TextAnnotation_DetectedBreak.php @@ -0,0 +1,16 @@ +google.cloud.vision.v1.TextDetectionParams + */ +class TextDetectionParams extends \Google\Protobuf\Internal\Message +{ + /** + * By default, Cloud Vision API only includes confidence score for + * DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence + * score for TEXT_DETECTION as well. + * + * Generated from protobuf field bool enable_text_detection_confidence_score = 9; + */ + private $enable_text_detection_confidence_score = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enable_text_detection_confidence_score + * By default, Cloud Vision API only includes confidence score for + * DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence + * score for TEXT_DETECTION as well. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * By default, Cloud Vision API only includes confidence score for + * DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence + * score for TEXT_DETECTION as well. + * + * Generated from protobuf field bool enable_text_detection_confidence_score = 9; + * @return bool + */ + public function getEnableTextDetectionConfidenceScore() + { + return $this->enable_text_detection_confidence_score; + } + + /** + * By default, Cloud Vision API only includes confidence score for + * DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence + * score for TEXT_DETECTION as well. + * + * Generated from protobuf field bool enable_text_detection_confidence_score = 9; + * @param bool $var + * @return $this + */ + public function setEnableTextDetectionConfidenceScore($var) + { + GPBUtil::checkBool($var); + $this->enable_text_detection_confidence_score = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/UpdateProductRequest.php b/vendor/google/cloud-vision/src/V1/UpdateProductRequest.php new file mode 100644 index 00000000..64a6a911 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/UpdateProductRequest.php @@ -0,0 +1,141 @@ +google.cloud.vision.v1.UpdateProductRequest + */ +class UpdateProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $product = null; + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + private $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Product $product + * Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * @type \Google\Protobuf\FieldMask $update_mask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\Product|null + */ + public function getProduct() + { + return $this->product; + } + + public function hasProduct() + { + return isset($this->product); + } + + public function clearProduct() + { + unset($this->product); + } + + /** + * Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\Product $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Product::class); + $this->product = $var; + + return $this; + } + + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/UpdateProductSetRequest.php b/vendor/google/cloud-vision/src/V1/UpdateProductSetRequest.php new file mode 100644 index 00000000..709b67e0 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/UpdateProductSetRequest.php @@ -0,0 +1,133 @@ +google.cloud.vision.v1.UpdateProductSetRequest + */ +class UpdateProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ProductSet resource which replaces the one on the server. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $product_set = null; + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + private $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ProductSet $product_set + * Required. The ProductSet resource which replaces the one on the server. + * @type \Google\Protobuf\FieldMask $update_mask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ProductSet resource which replaces the one on the server. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\ProductSet|null + */ + public function getProductSet() + { + return $this->product_set; + } + + public function hasProductSet() + { + return isset($this->product_set); + } + + public function clearProductSet() + { + unset($this->product_set); + } + + /** + * Required. The ProductSet resource which replaces the one on the server. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\ProductSet $var + * @return $this + */ + public function setProductSet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSet::class); + $this->product_set = $var; + + return $this; + } + + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/Vertex.php b/vendor/google/cloud-vision/src/V1/Vertex.php new file mode 100644 index 00000000..8999deb4 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/Vertex.php @@ -0,0 +1,102 @@ +google.cloud.vision.v1.Vertex + */ +class Vertex extends \Google\Protobuf\Internal\Message +{ + /** + * X coordinate. + * + * Generated from protobuf field int32 x = 1; + */ + private $x = 0; + /** + * Y coordinate. + * + * Generated from protobuf field int32 y = 2; + */ + private $y = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $x + * X coordinate. + * @type int $y + * Y coordinate. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\Geometry::initOnce(); + parent::__construct($data); + } + + /** + * X coordinate. + * + * Generated from protobuf field int32 x = 1; + * @return int + */ + public function getX() + { + return $this->x; + } + + /** + * X coordinate. + * + * Generated from protobuf field int32 x = 1; + * @param int $var + * @return $this + */ + public function setX($var) + { + GPBUtil::checkInt32($var); + $this->x = $var; + + return $this; + } + + /** + * Y coordinate. + * + * Generated from protobuf field int32 y = 2; + * @return int + */ + public function getY() + { + return $this->y; + } + + /** + * Y coordinate. + * + * Generated from protobuf field int32 y = 2; + * @param int $var + * @return $this + */ + public function setY($var) + { + GPBUtil::checkInt32($var); + $this->y = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/WebDetection.php b/vendor/google/cloud-vision/src/V1/WebDetection.php new file mode 100644 index 00000000..cc377007 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/WebDetection.php @@ -0,0 +1,253 @@ +google.cloud.vision.v1.WebDetection + */ +class WebDetection extends \Google\Protobuf\Internal\Message +{ + /** + * Deduced entities from similar images on the Internet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebEntity web_entities = 1; + */ + private $web_entities; + /** + * Fully matching images from the Internet. + * Can include resized copies of the query image. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage full_matching_images = 2; + */ + private $full_matching_images; + /** + * Partial matching images from the Internet. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its crops. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage partial_matching_images = 3; + */ + private $partial_matching_images; + /** + * Web pages containing the matching images from the Internet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebPage pages_with_matching_images = 4; + */ + private $pages_with_matching_images; + /** + * The visually similar image results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage visually_similar_images = 6; + */ + private $visually_similar_images; + /** + * The service's best guess as to the topic of the request image. + * Inferred from similar images on the open web. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebLabel best_guess_labels = 8; + */ + private $best_guess_labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\WebDetection\WebEntity[]|\Google\Protobuf\Internal\RepeatedField $web_entities + * Deduced entities from similar images on the Internet. + * @type \Google\Cloud\Vision\V1\WebDetection\WebImage[]|\Google\Protobuf\Internal\RepeatedField $full_matching_images + * Fully matching images from the Internet. + * Can include resized copies of the query image. + * @type \Google\Cloud\Vision\V1\WebDetection\WebImage[]|\Google\Protobuf\Internal\RepeatedField $partial_matching_images + * Partial matching images from the Internet. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its crops. + * @type \Google\Cloud\Vision\V1\WebDetection\WebPage[]|\Google\Protobuf\Internal\RepeatedField $pages_with_matching_images + * Web pages containing the matching images from the Internet. + * @type \Google\Cloud\Vision\V1\WebDetection\WebImage[]|\Google\Protobuf\Internal\RepeatedField $visually_similar_images + * The visually similar image results. + * @type \Google\Cloud\Vision\V1\WebDetection\WebLabel[]|\Google\Protobuf\Internal\RepeatedField $best_guess_labels + * The service's best guess as to the topic of the request image. + * Inferred from similar images on the open web. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\WebDetection::initOnce(); + parent::__construct($data); + } + + /** + * Deduced entities from similar images on the Internet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebEntity web_entities = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWebEntities() + { + return $this->web_entities; + } + + /** + * Deduced entities from similar images on the Internet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebEntity web_entities = 1; + * @param \Google\Cloud\Vision\V1\WebDetection\WebEntity[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWebEntities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebEntity::class); + $this->web_entities = $arr; + + return $this; + } + + /** + * Fully matching images from the Internet. + * Can include resized copies of the query image. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage full_matching_images = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFullMatchingImages() + { + return $this->full_matching_images; + } + + /** + * Fully matching images from the Internet. + * Can include resized copies of the query image. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage full_matching_images = 2; + * @param \Google\Cloud\Vision\V1\WebDetection\WebImage[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFullMatchingImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebImage::class); + $this->full_matching_images = $arr; + + return $this; + } + + /** + * Partial matching images from the Internet. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its crops. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage partial_matching_images = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPartialMatchingImages() + { + return $this->partial_matching_images; + } + + /** + * Partial matching images from the Internet. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its crops. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage partial_matching_images = 3; + * @param \Google\Cloud\Vision\V1\WebDetection\WebImage[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPartialMatchingImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebImage::class); + $this->partial_matching_images = $arr; + + return $this; + } + + /** + * Web pages containing the matching images from the Internet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebPage pages_with_matching_images = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPagesWithMatchingImages() + { + return $this->pages_with_matching_images; + } + + /** + * Web pages containing the matching images from the Internet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebPage pages_with_matching_images = 4; + * @param \Google\Cloud\Vision\V1\WebDetection\WebPage[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPagesWithMatchingImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebPage::class); + $this->pages_with_matching_images = $arr; + + return $this; + } + + /** + * The visually similar image results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage visually_similar_images = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVisuallySimilarImages() + { + return $this->visually_similar_images; + } + + /** + * The visually similar image results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage visually_similar_images = 6; + * @param \Google\Cloud\Vision\V1\WebDetection\WebImage[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVisuallySimilarImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebImage::class); + $this->visually_similar_images = $arr; + + return $this; + } + + /** + * The service's best guess as to the topic of the request image. + * Inferred from similar images on the open web. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebLabel best_guess_labels = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBestGuessLabels() + { + return $this->best_guess_labels; + } + + /** + * The service's best guess as to the topic of the request image. + * Inferred from similar images on the open web. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebLabel best_guess_labels = 8; + * @param \Google\Cloud\Vision\V1\WebDetection\WebLabel[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBestGuessLabels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebLabel::class); + $this->best_guess_labels = $arr; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/WebDetection/WebEntity.php b/vendor/google/cloud-vision/src/V1/WebDetection/WebEntity.php new file mode 100644 index 00000000..41fce53f --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/WebDetection/WebEntity.php @@ -0,0 +1,142 @@ +google.cloud.vision.v1.WebDetection.WebEntity + */ +class WebEntity extends \Google\Protobuf\Internal\Message +{ + /** + * Opaque entity ID. + * + * Generated from protobuf field string entity_id = 1; + */ + private $entity_id = ''; + /** + * Overall relevancy score for the entity. + * Not normalized and not comparable across different image queries. + * + * Generated from protobuf field float score = 2; + */ + private $score = 0.0; + /** + * Canonical description of the entity, in English. + * + * Generated from protobuf field string description = 3; + */ + private $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $entity_id + * Opaque entity ID. + * @type float $score + * Overall relevancy score for the entity. + * Not normalized and not comparable across different image queries. + * @type string $description + * Canonical description of the entity, in English. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\WebDetection::initOnce(); + parent::__construct($data); + } + + /** + * Opaque entity ID. + * + * Generated from protobuf field string entity_id = 1; + * @return string + */ + public function getEntityId() + { + return $this->entity_id; + } + + /** + * Opaque entity ID. + * + * Generated from protobuf field string entity_id = 1; + * @param string $var + * @return $this + */ + public function setEntityId($var) + { + GPBUtil::checkString($var, True); + $this->entity_id = $var; + + return $this; + } + + /** + * Overall relevancy score for the entity. + * Not normalized and not comparable across different image queries. + * + * Generated from protobuf field float score = 2; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Overall relevancy score for the entity. + * Not normalized and not comparable across different image queries. + * + * Generated from protobuf field float score = 2; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * Canonical description of the entity, in English. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Canonical description of the entity, in English. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WebEntity::class, \Google\Cloud\Vision\V1\WebDetection_WebEntity::class); + diff --git a/vendor/google/cloud-vision/src/V1/WebDetection/WebImage.php b/vendor/google/cloud-vision/src/V1/WebDetection/WebImage.php new file mode 100644 index 00000000..53cc9bda --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/WebDetection/WebImage.php @@ -0,0 +1,104 @@ +google.cloud.vision.v1.WebDetection.WebImage + */ +class WebImage extends \Google\Protobuf\Internal\Message +{ + /** + * The result image URL. + * + * Generated from protobuf field string url = 1; + */ + private $url = ''; + /** + * (Deprecated) Overall relevancy score for the image. + * + * Generated from protobuf field float score = 2; + */ + private $score = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * The result image URL. + * @type float $score + * (Deprecated) Overall relevancy score for the image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\WebDetection::initOnce(); + parent::__construct($data); + } + + /** + * The result image URL. + * + * Generated from protobuf field string url = 1; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The result image URL. + * + * Generated from protobuf field string url = 1; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * (Deprecated) Overall relevancy score for the image. + * + * Generated from protobuf field float score = 2; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * (Deprecated) Overall relevancy score for the image. + * + * Generated from protobuf field float score = 2; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WebImage::class, \Google\Cloud\Vision\V1\WebDetection_WebImage::class); + diff --git a/vendor/google/cloud-vision/src/V1/WebDetection/WebLabel.php b/vendor/google/cloud-vision/src/V1/WebDetection/WebLabel.php new file mode 100644 index 00000000..983b4438 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/WebDetection/WebLabel.php @@ -0,0 +1,112 @@ +google.cloud.vision.v1.WebDetection.WebLabel + */ +class WebLabel extends \Google\Protobuf\Internal\Message +{ + /** + * Label for extra metadata. + * + * Generated from protobuf field string label = 1; + */ + private $label = ''; + /** + * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". + * For more information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + */ + private $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $label + * Label for extra metadata. + * @type string $language_code + * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". + * For more information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\WebDetection::initOnce(); + parent::__construct($data); + } + + /** + * Label for extra metadata. + * + * Generated from protobuf field string label = 1; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Label for extra metadata. + * + * Generated from protobuf field string label = 1; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". + * For more information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". + * For more information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WebLabel::class, \Google\Cloud\Vision\V1\WebDetection_WebLabel::class); + diff --git a/vendor/google/cloud-vision/src/V1/WebDetection/WebPage.php b/vendor/google/cloud-vision/src/V1/WebDetection/WebPage.php new file mode 100644 index 00000000..72c3c248 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/WebDetection/WebPage.php @@ -0,0 +1,222 @@ +google.cloud.vision.v1.WebDetection.WebPage + */ +class WebPage extends \Google\Protobuf\Internal\Message +{ + /** + * The result web page URL. + * + * Generated from protobuf field string url = 1; + */ + private $url = ''; + /** + * (Deprecated) Overall relevancy score for the web page. + * + * Generated from protobuf field float score = 2; + */ + private $score = 0.0; + /** + * Title for the web page, may contain HTML markups. + * + * Generated from protobuf field string page_title = 3; + */ + private $page_title = ''; + /** + * Fully matching images on the page. + * Can include resized copies of the query image. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage full_matching_images = 4; + */ + private $full_matching_images; + /** + * Partial matching images on the page. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its + * crops. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage partial_matching_images = 5; + */ + private $partial_matching_images; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * The result web page URL. + * @type float $score + * (Deprecated) Overall relevancy score for the web page. + * @type string $page_title + * Title for the web page, may contain HTML markups. + * @type \Google\Cloud\Vision\V1\WebDetection\WebImage[]|\Google\Protobuf\Internal\RepeatedField $full_matching_images + * Fully matching images on the page. + * Can include resized copies of the query image. + * @type \Google\Cloud\Vision\V1\WebDetection\WebImage[]|\Google\Protobuf\Internal\RepeatedField $partial_matching_images + * Partial matching images on the page. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its + * crops. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\WebDetection::initOnce(); + parent::__construct($data); + } + + /** + * The result web page URL. + * + * Generated from protobuf field string url = 1; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The result web page URL. + * + * Generated from protobuf field string url = 1; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * (Deprecated) Overall relevancy score for the web page. + * + * Generated from protobuf field float score = 2; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * (Deprecated) Overall relevancy score for the web page. + * + * Generated from protobuf field float score = 2; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * Title for the web page, may contain HTML markups. + * + * Generated from protobuf field string page_title = 3; + * @return string + */ + public function getPageTitle() + { + return $this->page_title; + } + + /** + * Title for the web page, may contain HTML markups. + * + * Generated from protobuf field string page_title = 3; + * @param string $var + * @return $this + */ + public function setPageTitle($var) + { + GPBUtil::checkString($var, True); + $this->page_title = $var; + + return $this; + } + + /** + * Fully matching images on the page. + * Can include resized copies of the query image. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage full_matching_images = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFullMatchingImages() + { + return $this->full_matching_images; + } + + /** + * Fully matching images on the page. + * Can include resized copies of the query image. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage full_matching_images = 4; + * @param \Google\Cloud\Vision\V1\WebDetection\WebImage[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFullMatchingImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebImage::class); + $this->full_matching_images = $arr; + + return $this; + } + + /** + * Partial matching images on the page. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its + * crops. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage partial_matching_images = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPartialMatchingImages() + { + return $this->partial_matching_images; + } + + /** + * Partial matching images on the page. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its + * crops. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage partial_matching_images = 5; + * @param \Google\Cloud\Vision\V1\WebDetection\WebImage[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPartialMatchingImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebImage::class); + $this->partial_matching_images = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WebPage::class, \Google\Cloud\Vision\V1\WebDetection_WebPage::class); + diff --git a/vendor/google/cloud-vision/src/V1/WebDetectionParams.php b/vendor/google/cloud-vision/src/V1/WebDetectionParams.php new file mode 100644 index 00000000..0895b622 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/WebDetectionParams.php @@ -0,0 +1,67 @@ +google.cloud.vision.v1.WebDetectionParams + */ +class WebDetectionParams extends \Google\Protobuf\Internal\Message +{ + /** + * Whether to include results derived from the geo information in the image. + * + * Generated from protobuf field bool include_geo_results = 2; + */ + private $include_geo_results = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $include_geo_results + * Whether to include results derived from the geo information in the image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Whether to include results derived from the geo information in the image. + * + * Generated from protobuf field bool include_geo_results = 2; + * @return bool + */ + public function getIncludeGeoResults() + { + return $this->include_geo_results; + } + + /** + * Whether to include results derived from the geo information in the image. + * + * Generated from protobuf field bool include_geo_results = 2; + * @param bool $var + * @return $this + */ + public function setIncludeGeoResults($var) + { + GPBUtil::checkBool($var); + $this->include_geo_results = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/WebDetection_WebEntity.php b/vendor/google/cloud-vision/src/V1/WebDetection_WebEntity.php new file mode 100644 index 00000000..d5d66616 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/WebDetection_WebEntity.php @@ -0,0 +1,16 @@ +google.cloud.vision.v1.Word + */ +class Word extends \Google\Protobuf\Internal\Message +{ + /** + * Additional information detected for the word. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + */ + private $property = null; + /** + * The bounding box for the word. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + */ + private $bounding_box = null; + /** + * List of symbols in the word. + * The order of the symbols follows the natural reading order. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Symbol symbols = 3; + */ + private $symbols; + /** + * Confidence of the OCR results for the word. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + */ + private $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $property + * Additional information detected for the word. + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_box + * The bounding box for the word. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * @type \Google\Cloud\Vision\V1\Symbol[]|\Google\Protobuf\Internal\RepeatedField $symbols + * List of symbols in the word. + * The order of the symbols follows the natural reading order. + * @type float $confidence + * Confidence of the OCR results for the word. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * Additional information detected for the word. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @return \Google\Cloud\Vision\V1\TextAnnotation\TextProperty|null + */ + public function getProperty() + { + return $this->property; + } + + public function hasProperty() + { + return isset($this->property); + } + + public function clearProperty() + { + unset($this->property); + } + + /** + * Additional information detected for the word. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @param \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $var + * @return $this + */ + public function setProperty($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation\TextProperty::class); + $this->property = $var; + + return $this; + } + + /** + * The bounding box for the word. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingBox() + { + return $this->bounding_box; + } + + public function hasBoundingBox() + { + return isset($this->bounding_box); + } + + public function clearBoundingBox() + { + unset($this->bounding_box); + } + + /** + * The bounding box for the word. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingBox($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_box = $var; + + return $this; + } + + /** + * List of symbols in the word. + * The order of the symbols follows the natural reading order. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Symbol symbols = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSymbols() + { + return $this->symbols; + } + + /** + * List of symbols in the word. + * The order of the symbols follows the natural reading order. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Symbol symbols = 3; + * @param \Google\Cloud\Vision\V1\Symbol[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSymbols($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Symbol::class); + $this->symbols = $arr; + + return $this; + } + + /** + * Confidence of the OCR results for the word. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of the OCR results for the word. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/vendor/google/cloud-vision/src/V1/resources/image_annotator_client_config.json b/vendor/google/cloud-vision/src/V1/resources/image_annotator_client_config.json new file mode 100644 index 00000000..73ebf6b1 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/resources/image_annotator_client_config.json @@ -0,0 +1,55 @@ +{ + "interfaces": { + "google.cloud.vision.v1.ImageAnnotator": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "AsyncBatchAnnotateFiles": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "AsyncBatchAnnotateImages": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "BatchAnnotateFiles": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "BatchAnnotateImages": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/vendor/google/cloud-vision/src/V1/resources/image_annotator_descriptor_config.php b/vendor/google/cloud-vision/src/V1/resources/image_annotator_descriptor_config.php new file mode 100644 index 00000000..0c79b673 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/resources/image_annotator_descriptor_config.php @@ -0,0 +1,28 @@ + [ + 'google.cloud.vision.v1.ImageAnnotator' => [ + 'AsyncBatchAnnotateFiles' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Vision\V1\AsyncBatchAnnotateFilesResponse', + 'metadataReturnType' => '\Google\Cloud\Vision\V1\OperationMetadata', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '86400000', + ], + ], + 'AsyncBatchAnnotateImages' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Vision\V1\AsyncBatchAnnotateImagesResponse', + 'metadataReturnType' => '\Google\Cloud\Vision\V1\OperationMetadata', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '86400000', + ], + ], + ], + ], +]; diff --git a/vendor/google/cloud-vision/src/V1/resources/image_annotator_rest_client_config.php b/vendor/google/cloud-vision/src/V1/resources/image_annotator_rest_client_config.php new file mode 100644 index 00000000..e0391e94 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/resources/image_annotator_rest_client_config.php @@ -0,0 +1,131 @@ + [ + 'google.cloud.vision.v1.ImageAnnotator' => [ + 'AsyncBatchAnnotateFiles' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/files:asyncBatchAnnotate', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/files:asyncBatchAnnotate', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/files:asyncBatchAnnotate', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'AsyncBatchAnnotateImages' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/images:asyncBatchAnnotate', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/images:asyncBatchAnnotate', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/images:asyncBatchAnnotate', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'BatchAnnotateFiles' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/files:annotate', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/files:annotate', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/files:annotate', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'BatchAnnotateImages' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/images:annotate', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/images:annotate', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/images:annotate', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/vendor/google/cloud-vision/src/V1/resources/product_search_client_config.json b/vendor/google/cloud-vision/src/V1/resources/product_search_client_config.json new file mode 100644 index 00000000..393b5b95 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/resources/product_search_client_config.json @@ -0,0 +1,140 @@ +{ + "interfaces": { + "google.cloud.vision.v1.ProductSearch": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_2_codes": [], + "retry_policy_3_codes": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + }, + "retry_policy_3_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "AddProductToProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "CreateProduct": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "CreateProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "CreateReferenceImage": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "DeleteProduct": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "DeleteProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "DeleteReferenceImage": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "GetProduct": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "GetProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "GetReferenceImage": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "ImportProductSets": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "ListProductSets": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "ListProducts": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "ListProductsInProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "ListReferenceImages": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "PurgeProducts": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "RemoveProductFromProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "UpdateProduct": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "UpdateProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + } + } + } + } +} diff --git a/vendor/google/cloud-vision/src/V1/resources/product_search_descriptor_config.php b/vendor/google/cloud-vision/src/V1/resources/product_search_descriptor_config.php new file mode 100644 index 00000000..94b509c5 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/resources/product_search_descriptor_config.php @@ -0,0 +1,68 @@ + [ + 'google.cloud.vision.v1.ProductSearch' => [ + 'ImportProductSets' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Vision\V1\ImportProductSetsResponse', + 'metadataReturnType' => '\Google\Cloud\Vision\V1\BatchOperationMetadata', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '86400000', + ], + ], + 'PurgeProducts' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Vision\V1\BatchOperationMetadata', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '86400000', + ], + ], + 'ListProductSets' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProductSets', + ], + ], + 'ListProducts' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProducts', + ], + ], + 'ListProductsInProductSet' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProducts', + ], + ], + 'ListReferenceImages' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getReferenceImages', + ], + ], + ], + ], +]; diff --git a/vendor/google/cloud-vision/src/V1/resources/product_search_rest_client_config.php b/vendor/google/cloud-vision/src/V1/resources/product_search_rest_client_config.php new file mode 100644 index 00000000..af093824 --- /dev/null +++ b/vendor/google/cloud-vision/src/V1/resources/product_search_rest_client_config.php @@ -0,0 +1,255 @@ + [ + 'google.cloud.vision.v1.ProductSearch' => [ + 'AddProductToProductSet' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}:addProduct', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateProduct' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/products', + 'body' => 'product', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateProductSet' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/productSets', + 'body' => 'product_set', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateReferenceImage' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/products/*}/referenceImages', + 'body' => 'reference_image', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteProduct' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/products/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteProductSet' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteReferenceImage' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/products/*/referenceImages/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetProduct' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/products/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetProductSet' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetReferenceImage' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/products/*/referenceImages/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ImportProductSets' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/productSets:import', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListProductSets' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/productSets', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListProducts' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/products', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListProductsInProductSet' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}/products', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListReferenceImages' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/products/*}/referenceImages', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'PurgeProducts' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/products:purge', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'RemoveProductFromProductSet' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}:removeProduct', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateProduct' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{product.name=projects/*/locations/*/products/*}', + 'body' => 'product', + 'placeholders' => [ + 'product.name' => [ + 'getters' => [ + 'getProduct', + 'getName', + ], + ], + ], + ], + 'UpdateProductSet' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{product_set.name=projects/*/locations/*/productSets/*}', + 'body' => 'product_set', + 'placeholders' => [ + 'product_set.name' => [ + 'getters' => [ + 'getProductSet', + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/vendor/google/cloud-vision/src/VisionClient.php b/vendor/google/cloud-vision/src/VisionClient.php new file mode 100644 index 00000000..8c0c35dd --- /dev/null +++ b/vendor/google/cloud-vision/src/VisionClient.php @@ -0,0 +1,298 @@ +connection = new Rest($this->configureAuthentication($config)); + + $class = get_class($this); + $err = "The class {$class} is no longer supported"; + @trigger_error($err, E_USER_DEPRECATED); + } + + /** + * Create an instance of {@see Google\Cloud\Vision\Image} with required features and options. + * + * This method should be used to configure a single image, or when a set of + * images requires different settings for each member of the set. If you + * have a set of images which all will use the same settings, + * {@see Google\Cloud\Vision\VisionClient::images()} may be quicker and + * simpler to use. + * + * This method will not perform any service requests, and is meant to be + * used to configure a request prior to calling + * {@see Google\Cloud\Vision\VisionClient::annotate()}. + * + * For more information, including best practices and examples detailing + * other usage such as `$imageContext`, see {@see Google\Cloud\Vision\Image::__construct()}. + * + * Example: + * ``` + * $imageResource = fopen(__DIR__ . '/assets/family-photo.jpg', 'r'); + * + * $image = $vision->image($imageResource, [ + * 'FACE_DETECTION' + * ]); + * ``` + * + * ``` + * // Setting maxResults for a feature + * + * $imageResource = fopen(__DIR__ . '/assets/family-photo.jpg', 'r'); + * + * $image = $vision->image($imageResource, [ + * 'FACE_DETECTION' + * ], [ + * 'maxResults' => [ + * 'FACE_DETECTION' => 1 + * ] + * ]); + * ``` + * + * @param resource|string|StorageObject $image An image to configure with + * the given settings. This parameter will accept a resource, a + * string of bytes, the URI of an image in a publicly-accessible + * web location, or an instance of {@see Google\Cloud\Storage\StorageObject}. + * @param array $features A list of cloud vision + * [features](https://cloud.google.com/vision/reference/rest/v1/images/annotate#type) + * to apply to the image. + * @param array $options See {@see Google\Cloud\Vision\Image::__construct()} for + * configuration details. + * @return Image + * @throws InvalidArgumentException + */ + public function image($image, array $features, array $options = []) + { + return new Image($image, $features, $options); + } + + /** + * Create an array of type {@see Google\Cloud\Vision\Image} with required features and options set for + * each member of the set. + * + * This method is useful for quickly configuring every member of a set of + * images with the same features and options. Should you need to provide + * different features or options for one or more members of the set, + * {@see Google\Cloud\Vision\VisionClient::image()} is a better choice. + * + * This method will not perform any service requests, and is meant to be + * used to configure a request prior to calling + * {@see Google\Cloud\Vision\VisionClient::annotateBatch()}. + * + * For more information, including best practices and examples detailing + * other usage such as `$imageContext`, see {@see Google\Cloud\Vision\Image::__construct()}. + * + * Example: + * ``` + * // In the example below, both images will have the same settings applied. + * // They will both run face detection and return up to 10 results. + * + * $familyPhotoResource = fopen(__DIR__ . '/assets/family-photo.jpg', 'r'); + * $weddingPhotoResource = fopen(__DIR__ . '/assets/wedding-photo.jpg', 'r'); + * + * $images = $vision->images([$familyPhotoResource, $weddingPhotoResource], [ + * 'FACE_DETECTION' + * ], [ + * 'maxResults' => [ + * 'FACE_DETECTION' => 10 + * ] + * ]); + * ``` + * + * @param resource[]|string[]|StorageObject[] $images An array of images + * to configure with the given settings. Each member of the set can + * be a resource, a string of bytes, the URI of an image in a + * publicly-accessible web location, or an instance of + * {@see Google\Cloud\Storage\StorageObject}. + * @param array $features A list of cloud vision features to apply to each image. + * @param array $options See {@see Google\Cloud\Vision\Image::__construct()} for + * configuration details. + * @return Image[] + * @throws InvalidArgumentException + */ + public function images(array $images, array $features, array $options = []) + { + $result = []; + foreach ($images as $image) { + $result[] = $this->image($image, $features, $options); + } + + return $result; + } + + /** + * Annotate a single image. + * + * Example: + * ``` + * $familyPhotoResource = fopen(__DIR__ . '/assets/family-photo.jpg', 'r'); + * + * $image = $vision->image($familyPhotoResource, [ + * 'FACE_DETECTION' + * ]); + * + * $result = $vision->annotate($image); + * ``` + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate Annotate API documentation + * + * @param Image $image The image to annotate + * @param array $options Configuration options + * @return Annotation + */ + public function annotate(Image $image, array $options = []) + { + $res = $this->annotateBatch([$image], $options); + return $res[0]; + } + + /** + * Annotate a set of images. + * + * Example: + * ``` + * $images = []; + * + * $familyPhotoResource = fopen(__DIR__ . '/assets/family-photo.jpg', 'r'); + * $eiffelTowerResource = fopen(__DIR__ . '/assets/eiffel-tower.jpg', 'r'); + * + * $images[] = $vision->image($familyPhotoResource, [ + * 'FACE_DETECTION' + * ]); + * + * $images[] = $vision->image($eiffelTowerResource, [ + * 'LANDMARK_DETECTION' + * ]); + * + * $result = $vision->annotateBatch($images); + * ``` + * + * @see https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate Annotate API documentation + * + * @param Image[] $images An array consisting of instances of + * {@see Google\Cloud\Vision\Image}. + * @param array $options Configuration Options + * @return Annotation[] + */ + public function annotateBatch(array $images, array $options = []) + { + $this->validateBatch($images, Image::class); + + $requests = []; + foreach ($images as $image) { + $requests[] = $image->requestObject(); + } + + $res = $this->connection->annotate([ + 'requests' => $requests + ] + $options); + + $annotations = []; + if (isset($res['responses'])) { + foreach ($res['responses'] as $response) { + $annotations[] = new Annotation($response); + } + } + + return $annotations; + } +} diff --git a/vendor/google/cloud-vision/src/VisionHelpersTrait.php b/vendor/google/cloud-vision/src/VisionHelpersTrait.php new file mode 100644 index 00000000..5a8ccb83 --- /dev/null +++ b/vendor/google/cloud-vision/src/VisionHelpersTrait.php @@ -0,0 +1,120 @@ +setImage($image); + $features = $this->buildFeatureList(Feature::class, $features); + $request->setFeatures($features); + $imageContext = $this->pluck('imageContext', $optionalArgs, false); + if (!is_null($imageContext)) { + $request->setImageContext($imageContext); + } + return $callback([$request], $optionalArgs)->getResponses()[0]; + } + + /** + * @param string $featureClass + * @param Feature[]|int[] $featureTypes + * @return Feature[]|array + */ + private function buildFeatureList($featureClass, $featureTypes) + { + $features = []; + foreach ($featureTypes as $featureType) { + if (is_int($featureType)) { + $feature = new $featureClass(); + $feature->setType($featureType); + } else { + $feature = $featureType; + } + $features[] = $feature; + } + return $features; + } + + /** + * @param string $imageClass + * @param string $imageSourceClass + * @param string|resource|Image|mixed $imageInput + * @return Image|mixed + */ + private function createImageHelper($imageClass, $imageSourceClass, $imageInput) + { + if (is_object($imageInput) && is_a($imageInput, $imageClass)) { + return $imageInput; + } + $image = new $imageClass(); + if (is_string($imageInput)) { + if (in_array(parse_url($imageInput, PHP_URL_SCHEME), $this->urlSchemes)) { + $imageSource = new $imageSourceClass(); + $imageSource->setImageUri($imageInput); + $image->setSource($imageSource); + } else { + $image->setContent($imageInput); + } + } elseif (is_resource($imageInput)) { + $image->setContent(stream_get_contents($imageInput)); + } else { + throw new InvalidArgumentException( + 'Given image is not valid. ' . + 'Image must be a string of bytes, a valid image URI, or a resource.' + ); + } + return $image; + } +} diff --git a/vendor/google/common-protos/CODE_OF_CONDUCT.md b/vendor/google/common-protos/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..46b2a08e --- /dev/null +++ b/vendor/google/common-protos/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/vendor/google/common-protos/CONTRIBUTING.md b/vendor/google/common-protos/CONTRIBUTING.md new file mode 100644 index 00000000..23c9455d --- /dev/null +++ b/vendor/google/common-protos/CONTRIBUTING.md @@ -0,0 +1,45 @@ +## Contributing + +We are pleased that you are interested in contributing to our work. + +### Generated Protocol Buffer Classes + +The classes in this repository are generated by the protocol buffer +compiler, as known as protoc. As such, we can not accept contributions +directly to these generated classes. Instead, changes should be +suggested upstream in the [API Common Protos][api-common-protos] +repository. + + +### Documentation + +We want for both protocol buffers and the types that we have provided here +to be understandable to everyone, including to those who may be unfamiliar +with the ecosystem or concepts. + +That means we want our documentation to be better, and welcome anyone +willing to help with this. For documentation in the generated classes, please +open a pull request against the [API Common Protos][api-common-protos] +repository. + +Any improvements to READMEs or other non-generated documentation or +development scripts in this repository would be greatly appreciated - please +open a pull request. + + +## Contributor License Agreement + +Before we can accept your pull requests, you will need to sign a Contributor +License Agreement (CLA): + + - **If you are an individual writing original source code** and **you own the + intellectual property**, then you need to sign an [individual CLA][]. + - **If you work for a company that wants to allow you to contribute your + work**, then you need to sign a [corporate CLA][]. + +You can sign these electronically (just scroll to the bottom). After that, +we'll be able to accept your pull requests. + + [individual CLA]: https://developers.google.com/open-source/cla/individual + [corporate CLA]: https://developers.google.com/open-source/cla/corporate + [api-common-protos]: https://github.com/googleapis/api-common-protos \ No newline at end of file diff --git a/vendor/google/common-protos/LICENSE b/vendor/google/common-protos/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/google/common-protos/LICENSE @@ -0,0 +1,201 @@ + 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/google/common-protos/README.md b/vendor/google/common-protos/README.md new file mode 100644 index 00000000..b90a40e2 --- /dev/null +++ b/vendor/google/common-protos/README.md @@ -0,0 +1,44 @@ +## Common Protos PHP + +[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) + +![Build Status](https://github.com/googleapis/common-protos-php/actions/workflows/tests.yml/badge.svg) + +This repository is a home for the [protocol buffer][protobuf] types which are +common dependencies throughout the Google API ecosystem, generated for PHP. +The protobuf definitions for these generated PHP classes are provided in the +[API Common Protos][api-common-protos] repository. + +## Using these generated classes + +These classes are made available under an Apache license (see `LICENSE`) and +you are free to depend on them within your applications. They are +considered stable and will not change in backwards-incompaible ways. + +They are distributed as the [google/common-protos][packagist-common-protos] +composer package, available on [Packagist][packagist]. + +In order to depend on these classes, add the following line to your +composer.json file in the `requires` section: + +``` + "google/common-protos": "^1.0" +``` + +Or else use composer from the command line: + +```bash +composer require google/common-protos +``` + +## License + +These classes are licensed using the Apache 2.0 software license, a +permissive, copyfree license. You are free to use them in your applications +provided the license terms are honored. + + [api-style]: https://cloud.google.com/apis/design/ + [protobuf]: https://developers.google.com/protocol-buffers/ + [api-common-protos]: https://github.com/googleapis/api-common-protos/ + [packagist-common-protos]: https://packagist.org/packages/google/common-protos/ + [packagist]: https://packagist.org/ diff --git a/vendor/google/common-protos/SECURITY.md b/vendor/google/common-protos/SECURITY.md new file mode 100644 index 00000000..8b58ae9c --- /dev/null +++ b/vendor/google/common-protos/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/vendor/google/common-protos/composer.json b/vendor/google/common-protos/composer.json new file mode 100644 index 00000000..8131f58d --- /dev/null +++ b/vendor/google/common-protos/composer.json @@ -0,0 +1,21 @@ +{ + "name": "google/common-protos", + "type": "library", + "description": "Google API Common Protos for PHP", + "keywords": ["google"], + "homepage": "https://github.com/googleapis/common-protos-php", + "license": "Apache-2.0", + "require": { + "google/protobuf": "^3.6.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36", + "sami/sami": "*" + }, + "autoload": { + "psr-4": { + "Google\\": "src", + "GPBMetadata\\Google\\": "metadata" + } + } +} diff --git a/vendor/google/common-protos/metadata/Api/Annotations.php b/vendor/google/common-protos/metadata/Api/Annotations.php new file mode 100644 index 00000000..1e675f2d --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Annotations.php @@ -0,0 +1,31 @@ +internalAddGeneratedFile(hex2bin( + "0ac4010a1c676f6f676c652f6170692f616e6e6f746174696f6e732e7072" . + "6f746f120a676f6f676c652e6170691a20676f6f676c652f70726f746f62" . + "75662f64657363726970746f722e70726f746f426e0a0e636f6d2e676f6f" . + "676c652e6170694210416e6e6f746174696f6e7350726f746f50015a4167" . + "6f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f67" . + "6c65617069732f6170692f616e6e6f746174696f6e733b616e6e6f746174" . + "696f6e73a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Auth.php b/vendor/google/common-protos/metadata/Api/Auth.php new file mode 100644 index 00000000..070d649b --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Auth.php @@ -0,0 +1,46 @@ +internalAddGeneratedFile(hex2bin( + "0a88050a15676f6f676c652f6170692f617574682e70726f746f120a676f" . + "6f676c652e617069226c0a0e41757468656e7469636174696f6e122d0a05" . + "72756c657318032003280b321e2e676f6f676c652e6170692e4175746865" . + "6e7469636174696f6e52756c65122b0a0970726f76696465727318042003" . + "280b32182e676f6f676c652e6170692e4175746850726f766964657222a9" . + "010a1241757468656e7469636174696f6e52756c6512100a0873656c6563" . + "746f72180120012809122c0a056f6175746818022001280b321d2e676f6f" . + "676c652e6170692e4f41757468526571756972656d656e747312200a1861" . + "6c6c6f775f776974686f75745f63726564656e7469616c18052001280812" . + "310a0c726571756972656d656e747318072003280b321b2e676f6f676c65" . + "2e6170692e41757468526571756972656d656e74226a0a0c417574685072" . + "6f7669646572120a0a026964180120012809120e0a066973737565721802" . + "2001280912100a086a776b735f75726918032001280912110a0961756469" . + "656e63657318042001280912190a11617574686f72697a6174696f6e5f75" . + "726c180520012809222d0a114f41757468526571756972656d656e747312" . + "180a1063616e6f6e6963616c5f73636f70657318012001280922390a0f41" . + "757468526571756972656d656e7412130a0b70726f76696465725f696418" . + "012001280912110a0961756469656e636573180220012809426b0a0e636f" . + "6d2e676f6f676c652e61706942094175746850726f746f50015a45676f6f" . + "676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65" . + "617069732f6170692f73657276696365636f6e6669673b73657276696365" . + "636f6e666967a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Backend.php b/vendor/google/common-protos/metadata/Api/Backend.php new file mode 100644 index 00000000..5303b81d --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Backend.php @@ -0,0 +1,42 @@ +internalAddGeneratedFile(hex2bin( + "0ab4040a18676f6f676c652f6170692f6261636b656e642e70726f746f12" . + "0a676f6f676c652e61706922310a074261636b656e6412260a0572756c65" . + "7318012003280b32172e676f6f676c652e6170692e4261636b656e645275" . + "6c6522e0020a0b4261636b656e6452756c6512100a0873656c6563746f72" . + "180120012809120f0a076164647265737318022001280912100a08646561" . + "646c696e6518032001280112140a0c6d696e5f646561646c696e65180420" . + "012801121a0a126f7065726174696f6e5f646561646c696e651805200128" . + "0112410a10706174685f7472616e736c6174696f6e18062001280e32272e" . + "676f6f676c652e6170692e4261636b656e6452756c652e50617468547261" . + "6e736c6174696f6e12160a0c6a77745f61756469656e6365180720012809" . + "480012160a0c64697361626c655f61757468180820012808480022650a0f" . + "506174685472616e736c6174696f6e12200a1c504154485f5452414e534c" . + "4154494f4e5f554e535045434946494544100012140a10434f4e5354414e" . + "545f414444524553531001121a0a16415050454e445f504154485f544f5f" . + "41444452455353100242100a0e61757468656e7469636174696f6e426e0a" . + "0e636f6d2e676f6f676c652e617069420c4261636b656e6450726f746f50" . + "015a45676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f" . + "676f6f676c65617069732f6170692f73657276696365636f6e6669673b73" . + "657276696365636f6e666967a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Billing.php b/vendor/google/common-protos/metadata/Api/Billing.php new file mode 100644 index 00000000..4f26a4f7 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Billing.php @@ -0,0 +1,35 @@ +internalAddGeneratedFile(hex2bin( + "0ab4020a18676f6f676c652f6170692f62696c6c696e672e70726f746f12" . + "0a676f6f676c652e6170692293010a0742696c6c696e6712450a15636f6e" . + "73756d65725f64657374696e6174696f6e7318082003280b32262e676f6f" . + "676c652e6170692e42696c6c696e672e42696c6c696e6744657374696e61" . + "74696f6e1a410a1242696c6c696e6744657374696e6174696f6e121a0a12" . + "6d6f6e69746f7265645f7265736f75726365180120012809120f0a076d65" . + "7472696373180220032809426e0a0e636f6d2e676f6f676c652e61706942" . + "0c42696c6c696e6750726f746f50015a45676f6f676c652e676f6c616e67" . + "2e6f72672f67656e70726f746f2f676f6f676c65617069732f6170692f73" . + "657276696365636f6e6669673b73657276696365636f6e666967a2020447" . + "415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Client.php b/vendor/google/common-protos/metadata/Api/Client.php new file mode 100644 index 00000000..912933e7 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Client.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile(hex2bin( + "0aba010a17676f6f676c652f6170692f636c69656e742e70726f746f120a" . + "676f6f676c652e6170691a20676f6f676c652f70726f746f6275662f6465" . + "7363726970746f722e70726f746f42690a0e636f6d2e676f6f676c652e61" . + "7069420b436c69656e7450726f746f50015a41676f6f676c652e676f6c61" . + "6e672e6f72672f67656e70726f746f2f676f6f676c65617069732f617069" . + "2f616e6e6f746174696f6e733b616e6e6f746174696f6e73a20204474150" . + "49620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/ConfigChange.php b/vendor/google/common-protos/metadata/Api/ConfigChange.php new file mode 100644 index 00000000..69f62e20 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/ConfigChange.php @@ -0,0 +1,38 @@ +internalAddGeneratedFile(hex2bin( + "0ab1030a1e676f6f676c652f6170692f636f6e6669675f6368616e67652e" . + "70726f746f120a676f6f676c652e6170692297010a0c436f6e6669674368" . + "616e6765120f0a07656c656d656e7418012001280912110a096f6c645f76" . + "616c756518022001280912110a096e65775f76616c756518032001280912" . + "2b0a0b6368616e67655f7479706518042001280e32162e676f6f676c652e" . + "6170692e4368616e67655479706512230a07616476696365731805200328" . + "0b32122e676f6f676c652e6170692e416476696365221d0a064164766963" . + "6512130a0b6465736372697074696f6e1802200128092a4f0a0a4368616e" . + "676554797065121b0a174348414e47455f545950455f554e535045434946" . + "494544100012090a0541444445441001120b0a0752454d4f564544100212" . + "0c0a084d4f444946494544100342710a0e636f6d2e676f6f676c652e6170" . + "694211436f6e6669674368616e676550726f746f50015a43676f6f676c65" . + "2e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069" . + "732f6170692f636f6e6669676368616e67653b636f6e6669676368616e67" . + "65a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Consumer.php b/vendor/google/common-protos/metadata/Api/Consumer.php new file mode 100644 index 00000000..38156c50 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Consumer.php @@ -0,0 +1,37 @@ +internalAddGeneratedFile(hex2bin( + "0a87030a19676f6f676c652f6170692f636f6e73756d65722e70726f746f" . + "120a676f6f676c652e617069223d0a1150726f6a65637450726f70657274" . + "69657312280a0a70726f7065727469657318012003280b32142e676f6f67" . + "6c652e6170692e50726f706572747922ac010a0850726f7065727479120c" . + "0a046e616d65180120012809122f0a047479706518022001280e32212e67" . + "6f6f676c652e6170692e50726f70657274792e50726f7065727479547970" . + "6512130a0b6465736372697074696f6e180320012809224c0a0c50726f70" . + "6572747954797065120f0a0b554e535045434946494544100012090a0549" . + "4e543634100112080a04424f4f4c1002120a0a06535452494e471003120a" . + "0a06444f55424c45100442680a0e636f6d2e676f6f676c652e617069420d" . + "436f6e73756d657250726f746f50015a45676f6f676c652e676f6c616e67" . + "2e6f72672f67656e70726f746f2f676f6f676c65617069732f6170692f73" . + "657276696365636f6e6669673b73657276696365636f6e66696762067072" . + "6f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Context.php b/vendor/google/common-protos/metadata/Api/Context.php new file mode 100644 index 00000000..d50fd666 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Context.php @@ -0,0 +1,33 @@ +internalAddGeneratedFile(hex2bin( + "0a97020a18676f6f676c652f6170692f636f6e746578742e70726f746f12" . + "0a676f6f676c652e61706922310a07436f6e7465787412260a0572756c65" . + "7318012003280b32172e676f6f676c652e6170692e436f6e746578745275" . + "6c6522440a0b436f6e7465787452756c6512100a0873656c6563746f7218" . + "012001280912110a0972657175657374656418022003280912100a087072" . + "6f7669646564180320032809426e0a0e636f6d2e676f6f676c652e617069" . + "420c436f6e7465787450726f746f50015a45676f6f676c652e676f6c616e" . + "672e6f72672f67656e70726f746f2f676f6f676c65617069732f6170692f" . + "73657276696365636f6e6669673b73657276696365636f6e666967a20204" . + "47415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Control.php b/vendor/google/common-protos/metadata/Api/Control.php new file mode 100644 index 00000000..e7e7ff3e --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Control.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile(hex2bin( + "0abe010a18676f6f676c652f6170692f636f6e74726f6c2e70726f746f12" . + "0a676f6f676c652e617069221e0a07436f6e74726f6c12130a0b656e7669" . + "726f6e6d656e74180120012809426e0a0e636f6d2e676f6f676c652e6170" . + "69420c436f6e74726f6c50726f746f50015a45676f6f676c652e676f6c61" . + "6e672e6f72672f67656e70726f746f2f676f6f676c65617069732f617069" . + "2f73657276696365636f6e6669673b73657276696365636f6e666967a202" . + "0447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Distribution.php b/vendor/google/common-protos/metadata/Api/Distribution.php new file mode 100644 index 00000000..02807903 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Distribution.php @@ -0,0 +1,61 @@ +internalAddGeneratedFile(hex2bin( + "0aa3080a1d676f6f676c652f6170692f646973747269627574696f6e2e70" . + "726f746f120a676f6f676c652e6170691a1f676f6f676c652f70726f746f" . + "6275662f74696d657374616d702e70726f746f22d9060a0c446973747269" . + "627574696f6e120d0a05636f756e74180120012803120c0a046d65616e18" . + "022001280112200a1873756d5f6f665f737175617265645f646576696174" . + "696f6e180320012801122d0a0572616e676518042001280b321e2e676f6f" . + "676c652e6170692e446973747269627574696f6e2e52616e6765123e0a0e" . + "6275636b65745f6f7074696f6e7318062001280b32262e676f6f676c652e" . + "6170692e446973747269627574696f6e2e4275636b65744f7074696f6e73" . + "12150a0d6275636b65745f636f756e747318072003280312340a09657865" . + "6d706c617273180a2003280b32212e676f6f676c652e6170692e44697374" . + "7269627574696f6e2e4578656d706c61721a210a0552616e6765120b0a03" . + "6d696e180120012801120b0a036d61781802200128011ab5030a0d427563" . + "6b65744f7074696f6e7312470a0e6c696e6561725f6275636b6574731801" . + "2001280b322d2e676f6f676c652e6170692e446973747269627574696f6e" . + "2e4275636b65744f7074696f6e732e4c696e656172480012510a13657870" . + "6f6e656e7469616c5f6275636b65747318022001280b32322e676f6f676c" . + "652e6170692e446973747269627574696f6e2e4275636b65744f7074696f" . + "6e732e4578706f6e656e7469616c4800124b0a106578706c696369745f62" . + "75636b65747318032001280b322f2e676f6f676c652e6170692e44697374" . + "7269627574696f6e2e4275636b65744f7074696f6e732e4578706c696369" . + "7448001a430a064c696e656172121a0a126e756d5f66696e6974655f6275" . + "636b657473180120012805120d0a057769647468180220012801120e0a06" . + "6f66667365741803200128011a4f0a0b4578706f6e656e7469616c121a0a" . + "126e756d5f66696e6974655f6275636b65747318012001280512150a0d67" . + "726f7774685f666163746f72180220012801120d0a057363616c65180320" . + "0128011a1a0a084578706c69636974120e0a06626f756e64731801200328" . + "0142090a076f7074696f6e731a730a084578656d706c6172120d0a057661" . + "6c7565180120012801122d0a0974696d657374616d7018022001280b321a" . + "2e676f6f676c652e70726f746f6275662e54696d657374616d7012290a0b" . + "6174746163686d656e747318032003280b32142e676f6f676c652e70726f" . + "746f6275662e416e7942710a0e636f6d2e676f6f676c652e617069421144" . + "6973747269627574696f6e50726f746f50015a43676f6f676c652e676f6c" . + "616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f6170" . + "692f646973747269627574696f6e3b646973747269627574696f6ea20204" . + "47415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Documentation.php b/vendor/google/common-protos/metadata/Api/Documentation.php new file mode 100644 index 00000000..19aedeee --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Documentation.php @@ -0,0 +1,40 @@ +internalAddGeneratedFile(hex2bin( + "0af6030a1e676f6f676c652f6170692f646f63756d656e746174696f6e2e" . + "70726f746f120a676f6f676c652e61706922a1010a0d446f63756d656e74" . + "6174696f6e120f0a0773756d6d617279180120012809121f0a0570616765" . + "7318052003280b32102e676f6f676c652e6170692e50616765122c0a0572" . + "756c657318032003280b321d2e676f6f676c652e6170692e446f63756d65" . + "6e746174696f6e52756c65121e0a16646f63756d656e746174696f6e5f72" . + "6f6f745f75726c18042001280912100a086f766572766965771802200128" . + "09225b0a11446f63756d656e746174696f6e52756c6512100a0873656c65" . + "63746f7218012001280912130a0b6465736372697074696f6e1802200128" . + "09121f0a176465707265636174696f6e5f6465736372697074696f6e1803" . + "2001280922490a0450616765120c0a046e616d65180120012809120f0a07" . + "636f6e74656e7418022001280912220a0873756270616765731803200328" . + "0b32102e676f6f676c652e6170692e5061676542740a0e636f6d2e676f6f" . + "676c652e6170694212446f63756d656e746174696f6e50726f746f50015a" . + "45676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f" . + "6f676c65617069732f6170692f73657276696365636f6e6669673b736572" . + "76696365636f6e666967a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Endpoint.php b/vendor/google/common-protos/metadata/Api/Endpoint.php new file mode 100644 index 00000000..9ec9f968 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Endpoint.php @@ -0,0 +1,33 @@ +internalAddGeneratedFile(hex2bin( + "0a81020a19676f6f676c652f6170692f656e64706f696e742e70726f746f" . + "120a676f6f676c652e617069225f0a08456e64706f696e74120c0a046e61" . + "6d65180120012809120f0a07616c696173657318022003280912100a0866" . + "65617475726573180420032809120e0a0674617267657418652001280912" . + "120a0a616c6c6f775f636f7273180520012808426f0a0e636f6d2e676f6f" . + "676c652e617069420d456e64706f696e7450726f746f50015a45676f6f67" . + "6c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c6561" . + "7069732f6170692f73657276696365636f6e6669673b7365727669636563" . + "6f6e666967a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/CelService.php b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/CelService.php new file mode 100644 index 00000000..c01a779a --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/CelService.php @@ -0,0 +1,45 @@ +internalAddGeneratedFile(hex2bin( + "0acb040a2a676f6f676c652f6170692f657870722f7631616c706861312f" . + "63656c5f736572766963652e70726f746f1218676f6f676c652e6170692e" . + "657870722e7631616c706861311a32676f6f676c652f6170692f65787072" . + "2f7631616c706861312f636f6e666f726d616e63655f736572766963652e" . + "70726f746f32d2020a0a43656c5365727669636512670a05506172736512" . + "262e676f6f676c652e6170692e657870722e7631616c706861312e506172" . + "7365526571756573741a272e676f6f676c652e6170692e657870722e7631" . + "616c706861312e5061727365526573706f6e7365220dda410a63656c5f73" . + "6f7572636512680a05436865636b12262e676f6f676c652e6170692e6578" . + "70722e7631616c706861312e436865636b526571756573741a272e676f6f" . + "676c652e6170692e657870722e7631616c706861312e436865636b526573" . + "706f6e7365220eda410b7061727365645f65787072125a0a044576616c12" . + "252e676f6f676c652e6170692e657870722e7631616c706861312e457661" . + "6c526571756573741a262e676f6f676c652e6170692e657870722e763161" . + "6c706861312e4576616c526573706f6e73652203da41001a15ca41126365" . + "6c2e676f6f676c65617069732e636f6d42720a1c636f6d2e676f6f676c65" . + "2e6170692e657870722e7631616c70686131420f43656c53657276696365" . + "50726f746f50015a3c676f6f676c652e676f6c616e672e6f72672f67656e" . + "70726f746f2f676f6f676c65617069732f6170692f657870722f7631616c" . + "706861313b65787072f80101620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/Checked.php b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/Checked.php new file mode 100644 index 00000000..043d39db --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/Checked.php @@ -0,0 +1,115 @@ +internalAddGeneratedFile(hex2bin( + "0ad0140a26676f6f676c652f6170692f657870722f7631616c706861312f" . + "636865636b65642e70726f746f1218676f6f676c652e6170692e65787072" . + "2e7631616c706861311a1b676f6f676c652f70726f746f6275662f656d70" . + "74792e70726f746f1a1c676f6f676c652f70726f746f6275662f73747275" . + "63742e70726f746f22b6030a0b436865636b656445787072124e0a0d7265" . + "666572656e63655f6d617018022003280b32372e676f6f676c652e617069" . + "2e657870722e7631616c706861312e436865636b6564457870722e526566" . + "6572656e63654d6170456e74727912440a08747970655f6d617018032003" . + "280b32322e676f6f676c652e6170692e657870722e7631616c706861312e" . + "436865636b6564457870722e547970654d6170456e74727912390a0b736f" . + "757263655f696e666f18052001280b32242e676f6f676c652e6170692e65" . + "7870722e7631616c706861312e536f75726365496e666f122c0a04657870" . + "7218042001280b321e2e676f6f676c652e6170692e657870722e7631616c" . + "706861312e457870721a580a115265666572656e63654d6170456e747279" . + "120b0a036b657918012001280312320a0576616c756518022001280b3223" . + "2e676f6f676c652e6170692e657870722e7631616c706861312e52656665" . + "72656e63653a0238011a4e0a0c547970654d6170456e747279120b0a036b" . + "6579180120012803122d0a0576616c756518022001280b321e2e676f6f67" . + "6c652e6170692e657870722e7631616c706861312e547970653a02380122" . + "820a0a045479706512250a0364796e18012001280b32162e676f6f676c65" . + "2e70726f746f6275662e456d7074794800122a0a046e756c6c1802200128" . + "0e321a2e676f6f676c652e70726f746f6275662e4e756c6c56616c756548" . + "0012410a097072696d697469766518032001280e322c2e676f6f676c652e" . + "6170692e657870722e7631616c706861312e547970652e5072696d697469" . + "7665547970654800123f0a077772617070657218042001280e322c2e676f" . + "6f676c652e6170692e657870722e7631616c706861312e547970652e5072" . + "696d697469766554797065480012420a0a77656c6c5f6b6e6f776e180520" . + "01280e322c2e676f6f676c652e6170692e657870722e7631616c70686131" . + "2e547970652e57656c6c4b6e6f776e547970654800123c0a096c6973745f" . + "7479706518062001280b32272e676f6f676c652e6170692e657870722e76" . + "31616c706861312e547970652e4c697374547970654800123a0a086d6170" . + "5f7479706518072001280b32262e676f6f676c652e6170692e657870722e" . + "7631616c706861312e547970652e4d6170547970654800123f0a0866756e" . + "6374696f6e18082001280b322b2e676f6f676c652e6170692e657870722e" . + "7631616c706861312e547970652e46756e6374696f6e5479706548001216" . + "0a0c6d6573736167655f74797065180920012809480012140a0a74797065" . + "5f706172616d180a200128094800122e0a0474797065180b2001280b321e" . + "2e676f6f676c652e6170692e657870722e7631616c706861312e54797065" . + "480012270a056572726f72180c2001280b32162e676f6f676c652e70726f" . + "746f6275662e456d707479480012440a0d61627374726163745f74797065" . + "180e2001280b322b2e676f6f676c652e6170692e657870722e7631616c70" . + "6861312e547970652e41627374726163745479706548001a3d0a084c6973" . + "745479706512310a09656c656d5f7479706518012001280b321e2e676f6f" . + "676c652e6170692e657870722e7631616c706861312e547970651a6f0a07" . + "4d61705479706512300a086b65795f7479706518012001280b321e2e676f" . + "6f676c652e6170692e657870722e7631616c706861312e5479706512320a" . + "0a76616c75655f7479706518022001280b321e2e676f6f676c652e617069" . + "2e657870722e7631616c706861312e547970651a760a0c46756e6374696f" . + "6e5479706512330a0b726573756c745f7479706518012001280b321e2e67" . + "6f6f676c652e6170692e657870722e7631616c706861312e547970651231" . + "0a096172675f747970657318022003280b321e2e676f6f676c652e617069" . + "2e657870722e7631616c706861312e547970651a550a0c41627374726163" . + "7454797065120c0a046e616d6518012001280912370a0f706172616d6574" . + "65725f747970657318022003280b321e2e676f6f676c652e6170692e6578" . + "70722e7631616c706861312e5479706522730a0d5072696d697469766554" . + "797065121e0a1a5052494d49544956455f545950455f554e535045434946" . + "494544100012080a04424f4f4c100112090a05494e5436341002120a0a06" . + "55494e5436341003120a0a06444f55424c451004120a0a06535452494e47" . + "100512090a054259544553100622560a0d57656c6c4b6e6f776e54797065" . + "121f0a1b57454c4c5f4b4e4f574e5f545950455f554e5350454349464945" . + "44100012070a03414e591001120d0a0954494d455354414d501002120c0a" . + "084455524154494f4e1003420b0a09747970655f6b696e6422b9040a0444" . + "65636c120c0a046e616d6518012001280912390a056964656e7418022001" . + "280b32282e676f6f676c652e6170692e657870722e7631616c706861312e" . + "4465636c2e4964656e744465636c4800123f0a0866756e6374696f6e1803" . + "2001280b322b2e676f6f676c652e6170692e657870722e7631616c706861" . + "312e4465636c2e46756e6374696f6e4465636c48001a790a094964656e74" . + "4465636c122c0a047479706518012001280b321e2e676f6f676c652e6170" . + "692e657870722e7631616c706861312e5479706512310a0576616c756518" . + "022001280b32222e676f6f676c652e6170692e657870722e7631616c7068" . + "61312e436f6e7374616e74120b0a03646f631803200128091a9e020a0c46" . + "756e6374696f6e4465636c12470a096f7665726c6f61647318012003280b" . + "32342e676f6f676c652e6170692e657870722e7631616c706861312e4465" . + "636c2e46756e6374696f6e4465636c2e4f7665726c6f61641ac4010a084f" . + "7665726c6f616412130a0b6f7665726c6f61645f6964180120012809122e" . + "0a06706172616d7318022003280b321e2e676f6f676c652e6170692e6578" . + "70722e7631616c706861312e5479706512130a0b747970655f706172616d" . + "7318032003280912330a0b726573756c745f7479706518042001280b321e" . + "2e676f6f676c652e6170692e657870722e7631616c706861312e54797065" . + "121c0a1469735f696e7374616e63655f66756e6374696f6e180520012808" . + "120b0a03646f63180620012809420b0a096465636c5f6b696e6422610a09" . + "5265666572656e6365120c0a046e616d6518012001280912130a0b6f7665" . + "726c6f61645f696418032003280912310a0576616c756518042001280b32" . + "222e676f6f676c652e6170692e657870722e7631616c706861312e436f6e" . + "7374616e74426c0a1c636f6d2e676f6f676c652e6170692e657870722e76" . + "31616c7068613142094465636c50726f746f50015a3c676f6f676c652e67" . + "6f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f" . + "6170692f657870722f7631616c706861313b65787072f80101620670726f" . + "746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/ConformanceService.php b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/ConformanceService.php new file mode 100644 index 00000000..59a47e8d --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/ConformanceService.php @@ -0,0 +1,93 @@ +internalAddGeneratedFile(hex2bin( + "0af50e0a32676f6f676c652f6170692f657870722f7631616c706861312f" . + "636f6e666f726d616e63655f736572766963652e70726f746f1218676f6f" . + "676c652e6170692e657870722e7631616c706861311a26676f6f676c652f" . + "6170692f657870722f7631616c706861312f636865636b65642e70726f74" . + "6f1a23676f6f676c652f6170692f657870722f7631616c706861312f6576" . + "616c2e70726f746f1a25676f6f676c652f6170692f657870722f7631616c" . + "706861312f73796e7461782e70726f746f1a1f676f6f676c652f6170692f" . + "6669656c645f6265686176696f722e70726f746f1a17676f6f676c652f72" . + "70632f7374617475732e70726f746f22700a0c5061727365526571756573" . + "7412170a0a63656c5f736f757263651801200128094203e0410212160a0e" . + "73796e7461785f76657273696f6e18022001280912170a0f736f75726365" . + "5f6c6f636174696f6e18032001280912160a0e64697361626c655f6d6163" . + "726f73180420012808226e0a0d5061727365526573706f6e736512390a0b" . + "7061727365645f6578707218012001280b32242e676f6f676c652e617069" . + "2e657870722e7631616c706861312e5061727365644578707212220a0669" . + "737375657318022003280b32122e676f6f676c652e7270632e5374617475" . + "7322a7010a0c436865636b52657175657374123e0a0b7061727365645f65" . + "78707218012001280b32242e676f6f676c652e6170692e657870722e7631" . + "616c706861312e506172736564457870724203e0410212300a0874797065" . + "5f656e7618022003280b321e2e676f6f676c652e6170692e657870722e76" . + "31616c706861312e4465636c12110a09636f6e7461696e65721803200128" . + "0912120a0a6e6f5f7374645f656e7618042001280822700a0d436865636b" . + "526573706f6e7365123b0a0c636865636b65645f6578707218012001280b" . + "32252e676f6f676c652e6170692e657870722e7631616c706861312e4368" . + "65636b65644578707212220a0669737375657318022003280b32122e676f" . + "6f676c652e7270632e53746174757322c6020a0b4576616c526571756573" . + "74123b0a0b7061727365645f6578707218012001280b32242e676f6f676c" . + "652e6170692e657870722e7631616c706861312e50617273656445787072" . + "4800123d0a0c636865636b65645f6578707218022001280b32252e676f6f" . + "676c652e6170692e657870722e7631616c706861312e436865636b656445" . + "787072480012450a0862696e64696e677318032003280b32332e676f6f67" . + "6c652e6170692e657870722e7631616c706861312e4576616c5265717565" . + "73742e42696e64696e6773456e74727912110a09636f6e7461696e657218" . + "04200128091a540a0d42696e64696e6773456e747279120b0a036b657918" . + "012001280912320a0576616c756518022001280b32232e676f6f676c652e" . + "6170692e657870722e7631616c706861312e4578707256616c75653a0238" . + "01420b0a09657870725f6b696e6422670a0c4576616c526573706f6e7365" . + "12330a06726573756c7418012001280b32232e676f6f676c652e6170692e" . + "657870722e7631616c706861312e4578707256616c756512220a06697373" . + "75657318022003280b32122e676f6f676c652e7270632e53746174757322" . + "e8010a0c497373756544657461696c7312410a0873657665726974791801" . + "2001280e322f2e676f6f676c652e6170692e657870722e7631616c706861" . + "312e497373756544657461696c732e5365766572697479123a0a08706f73" . + "6974696f6e18022001280b32282e676f6f676c652e6170692e657870722e" . + "7631616c706861312e536f75726365506f736974696f6e120a0a02696418" . + "0320012803224d0a08536576657269747912180a1453455645524954595f" . + "554e5350454349464945441000120f0a0b4445505245434154494f4e1001" . + "120b0a075741524e494e47100212090a054552524f52100332d7020a1243" . + "6f6e666f726d616e63655365727669636512670a05506172736512262e67" . + "6f6f676c652e6170692e657870722e7631616c706861312e506172736552" . + "6571756573741a272e676f6f676c652e6170692e657870722e7631616c70" . + "6861312e5061727365526573706f6e7365220dda410a63656c5f736f7572" . + "636512680a05436865636b12262e676f6f676c652e6170692e657870722e" . + "7631616c706861312e436865636b526571756573741a272e676f6f676c65" . + "2e6170692e657870722e7631616c706861312e436865636b526573706f6e" . + "7365220eda410b7061727365645f6578707212570a044576616c12252e67" . + "6f6f676c652e6170692e657870722e7631616c706861312e4576616c5265" . + "71756573741a262e676f6f676c652e6170692e657870722e7631616c7068" . + "61312e4576616c526573706f6e736522001a15ca411263656c2e676f6f67" . + "6c65617069732e636f6d427a0a1c636f6d2e676f6f676c652e6170692e65" . + "7870722e7631616c706861314217436f6e666f726d616e63655365727669" . + "636550726f746f50015a3c676f6f676c652e676f6c616e672e6f72672f67" . + "656e70726f746f2f676f6f676c65617069732f6170692f657870722f7631" . + "616c706861313b65787072f80101620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/Explain.php b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/Explain.php new file mode 100644 index 00000000..f658c16f --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/Explain.php @@ -0,0 +1,37 @@ +internalAddGeneratedFile(hex2bin( + "0ae9020a26676f6f676c652f6170692f657870722f7631616c706861312f" . + "6578706c61696e2e70726f746f1218676f6f676c652e6170692e65787072" . + "2e7631616c7068613122ab010a074578706c61696e122f0a0676616c7565" . + "7318012003280b321f2e676f6f676c652e6170692e657870722e7631616c" . + "706861312e56616c7565123e0a0a657870725f737465707318022003280b" . + "322a2e676f6f676c652e6170692e657870722e7631616c706861312e4578" . + "706c61696e2e45787072537465701a2b0a084578707253746570120a0a02" . + "696418012001280312130a0b76616c75655f696e6465781802200128053a" . + "021801426f0a1c636f6d2e676f6f676c652e6170692e657870722e763161" . + "6c70686131420c4578706c61696e50726f746f50015a3c676f6f676c652e" . + "676f6c616e672e6f72672f67656e70726f746f2f676f6f676c6561706973" . + "2f6170692f657870722f7631616c706861313b65787072f8010162067072" . + "6f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/PBEval.php b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/PBEval.php new file mode 100644 index 00000000..c7f66b81 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/PBEval.php @@ -0,0 +1,47 @@ +internalAddGeneratedFile(hex2bin( + "0af8040a23676f6f676c652f6170692f657870722f7631616c706861312f" . + "6576616c2e70726f746f1218676f6f676c652e6170692e657870722e7631" . + "616c706861311a17676f6f676c652f7270632f7374617475732e70726f74" . + "6f22a4010a094576616c537461746512330a0676616c7565731801200328" . + "0b32232e676f6f676c652e6170692e657870722e7631616c706861312e45" . + "78707256616c7565123b0a07726573756c747318032003280b322a2e676f" . + "6f676c652e6170692e657870722e7631616c706861312e4576616c537461" . + "74652e526573756c741a250a06526573756c74120c0a0465787072180120" . + "012803120d0a0576616c756518022001280322b3010a094578707256616c" . + "756512300a0576616c756518012001280b321f2e676f6f676c652e617069" . + "2e657870722e7631616c706861312e56616c7565480012330a056572726f" . + "7218022001280b32222e676f6f676c652e6170692e657870722e7631616c" . + "706861312e4572726f72536574480012370a07756e6b6e6f776e18032001" . + "280b32242e676f6f676c652e6170692e657870722e7631616c706861312e" . + "556e6b6e6f776e536574480042060a046b696e64222e0a084572726f7253" . + "657412220a066572726f727318012003280b32122e676f6f676c652e7270" . + "632e537461747573221b0a0a556e6b6e6f776e536574120d0a0565787072" . + "73180120032803426c0a1c636f6d2e676f6f676c652e6170692e65787072" . + "2e7631616c7068613142094576616c50726f746f50015a3c676f6f676c65" . + "2e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069" . + "732f6170692f657870722f7631616c706861313b65787072f80101620670" . + "726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/Syntax.php b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/Syntax.php new file mode 100644 index 00000000..702fe554 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/Syntax.php @@ -0,0 +1,110 @@ +internalAddGeneratedFile(hex2bin( + "0ac0130a25676f6f676c652f6170692f657870722f7631616c706861312f" . + "73796e7461782e70726f746f1218676f6f676c652e6170692e657870722e" . + "7631616c706861311a1c676f6f676c652f70726f746f6275662f73747275" . + "63742e70726f746f1a1f676f6f676c652f70726f746f6275662f74696d65" . + "7374616d702e70726f746f22750a0a50617273656445787072122c0a0465" . + "78707218022001280b321e2e676f6f676c652e6170692e657870722e7631" . + "616c706861312e4578707212390a0b736f757263655f696e666f18032001" . + "280b32242e676f6f676c652e6170692e657870722e7631616c706861312e" . + "536f75726365496e666f22c50a0a0445787072120a0a0269641802200128" . + "0312380a0a636f6e73745f6578707218032001280b32222e676f6f676c65" . + "2e6170692e657870722e7631616c706861312e436f6e7374616e74480012" . + "3a0a0a6964656e745f6578707218042001280b32242e676f6f676c652e61" . + "70692e657870722e7631616c706861312e457870722e4964656e74480012" . + "3c0a0b73656c6563745f6578707218052001280b32252e676f6f676c652e" . + "6170692e657870722e7631616c706861312e457870722e53656c65637448" . + "0012380a0963616c6c5f6578707218062001280b32232e676f6f676c652e" . + "6170692e657870722e7631616c706861312e457870722e43616c6c480012" . + "3e0a096c6973745f6578707218072001280b32292e676f6f676c652e6170" . + "692e657870722e7631616c706861312e457870722e4372656174654c6973" . + "74480012420a0b7374727563745f6578707218082001280b322b2e676f6f" . + "676c652e6170692e657870722e7631616c706861312e457870722e437265" . + "6174655374727563744800124a0a12636f6d70726568656e73696f6e5f65" . + "78707218092001280b322c2e676f6f676c652e6170692e657870722e7631" . + "616c706861312e457870722e436f6d70726568656e73696f6e48001a150a" . + "054964656e74120c0a046e616d651801200128091a5b0a0653656c656374" . + "122f0a076f706572616e6418012001280b321e2e676f6f676c652e617069" . + "2e657870722e7631616c706861312e45787072120d0a056669656c641802" . + "2001280912110a09746573745f6f6e6c791803200128081a760a0443616c" . + "6c122e0a0674617267657418012001280b321e2e676f6f676c652e617069" . + "2e657870722e7631616c706861312e4578707212100a0866756e6374696f" . + "6e180220012809122c0a046172677318032003280b321e2e676f6f676c65" . + "2e6170692e657870722e7631616c706861312e457870721a3e0a0a437265" . + "6174654c69737412300a08656c656d656e747318012003280b321e2e676f" . + "6f676c652e6170692e657870722e7631616c706861312e457870721a8102" . + "0a0c43726561746553747275637412140a0c6d6573736167655f6e616d65" . + "18012001280912420a07656e747269657318022003280b32312e676f6f67" . + "6c652e6170692e657870722e7631616c706861312e457870722e43726561" . + "74655374727563742e456e7472791a96010a05456e747279120a0a026964" . + "18012001280312130a096669656c645f6b6579180220012809480012310a" . + "076d61705f6b657918032001280b321e2e676f6f676c652e6170692e6578" . + "70722e7631616c706861312e457870724800122d0a0576616c7565180420" . + "01280b321e2e676f6f676c652e6170692e657870722e7631616c70686131" . + "2e45787072420a0a086b65795f6b696e641ab5020a0d436f6d7072656865" . + "6e73696f6e12100a08697465725f76617218012001280912320a0a697465" . + "725f72616e676518022001280b321e2e676f6f676c652e6170692e657870" . + "722e7631616c706861312e4578707212100a08616363755f766172180320" . + "01280912310a09616363755f696e697418042001280b321e2e676f6f676c" . + "652e6170692e657870722e7631616c706861312e4578707212360a0e6c6f" . + "6f705f636f6e646974696f6e18052001280b321e2e676f6f676c652e6170" . + "692e657870722e7631616c706861312e4578707212310a096c6f6f705f73" . + "74657018062001280b321e2e676f6f676c652e6170692e657870722e7631" . + "616c706861312e45787072122e0a06726573756c7418072001280b321e2e" . + "676f6f676c652e6170692e657870722e7631616c706861312e4578707242" . + "0b0a09657870725f6b696e6422cd020a08436f6e7374616e7412300a0a6e" . + "756c6c5f76616c756518012001280e321a2e676f6f676c652e70726f746f" . + "6275662e4e756c6c56616c7565480012140a0a626f6f6c5f76616c756518" . + "0220012808480012150a0b696e7436345f76616c75651803200128034800" . + "12160a0c75696e7436345f76616c7565180420012804480012160a0c646f" . + "75626c655f76616c7565180520012801480012160a0c737472696e675f76" . + "616c7565180620012809480012150a0b62797465735f76616c7565180720" . + "01280c480012370a0e6475726174696f6e5f76616c756518082001280b32" . + "192e676f6f676c652e70726f746f6275662e4475726174696f6e42021801" . + "480012390a0f74696d657374616d705f76616c756518092001280b321a2e" . + "676f6f676c652e70726f746f6275662e54696d657374616d704202180148" . + "00420f0a0d636f6e7374616e745f6b696e6422e4020a0a536f7572636549" . + "6e666f12160a0e73796e7461785f76657273696f6e18012001280912100a" . + "086c6f636174696f6e18022001280912140a0c6c696e655f6f6666736574" . + "7318032003280512460a09706f736974696f6e7318042003280b32332e67" . + "6f6f676c652e6170692e657870722e7631616c706861312e536f75726365" . + "496e666f2e506f736974696f6e73456e74727912490a0b6d6163726f5f63" . + "616c6c7318052003280b32342e676f6f676c652e6170692e657870722e76" . + "31616c706861312e536f75726365496e666f2e4d6163726f43616c6c7345" . + "6e7472791a300a0e506f736974696f6e73456e747279120b0a036b657918" . + "0120012803120d0a0576616c75651802200128053a0238011a510a0f4d61" . + "63726f43616c6c73456e747279120b0a036b6579180120012803122d0a05" . + "76616c756518022001280b321e2e676f6f676c652e6170692e657870722e" . + "7631616c706861312e457870723a02380122500a0e536f75726365506f73" . + "6974696f6e12100a086c6f636174696f6e180120012809120e0a066f6666" . + "736574180220012805120c0a046c696e65180320012805120e0a06636f6c" . + "756d6e180420012805426e0a1c636f6d2e676f6f676c652e6170692e6578" . + "70722e7631616c70686131420b53796e74617850726f746f50015a3c676f" . + "6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c" . + "65617069732f6170692f657870722f7631616c706861313b65787072f801" . + "01620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/Value.php b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/Value.php new file mode 100644 index 00000000..dadd07ba --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Expr/V1Alpha1/Value.php @@ -0,0 +1,57 @@ +internalAddGeneratedFile(hex2bin( + "0aaf070a24676f6f676c652f6170692f657870722f7631616c706861312f" . + "76616c75652e70726f746f1218676f6f676c652e6170692e657870722e76" . + "31616c706861311a1c676f6f676c652f70726f746f6275662f7374727563" . + "742e70726f746f22c0030a0556616c756512300a0a6e756c6c5f76616c75" . + "6518012001280e321a2e676f6f676c652e70726f746f6275662e4e756c6c" . + "56616c7565480012140a0a626f6f6c5f76616c7565180220012808480012" . + "150a0b696e7436345f76616c7565180320012803480012160a0c75696e74" . + "36345f76616c7565180420012804480012160a0c646f75626c655f76616c" . + "7565180520012801480012160a0c737472696e675f76616c756518062001" . + "2809480012150a0b62797465735f76616c756518072001280c480012390a" . + "0a656e756d5f76616c756518092001280b32232e676f6f676c652e617069" . + "2e657870722e7631616c706861312e456e756d56616c75654800122c0a0c" . + "6f626a6563745f76616c7565180a2001280b32142e676f6f676c652e7072" . + "6f746f6275662e416e79480012370a096d61705f76616c7565180b200128" . + "0b32222e676f6f676c652e6170692e657870722e7631616c706861312e4d" . + "617056616c7565480012390a0a6c6973745f76616c7565180c2001280b32" . + "232e676f6f676c652e6170692e657870722e7631616c706861312e4c6973" . + "7456616c7565480012140a0a747970655f76616c7565180f200128094800" . + "42060a046b696e6422280a09456e756d56616c7565120c0a047479706518" . + "0120012809120d0a0576616c7565180220012805223c0a094c6973745661" . + "6c7565122f0a0676616c75657318012003280b321f2e676f6f676c652e61" . + "70692e657870722e7631616c706861312e56616c756522ac010a084d6170" . + "56616c756512390a07656e747269657318012003280b32282e676f6f676c" . + "652e6170692e657870722e7631616c706861312e4d617056616c75652e45" . + "6e7472791a650a05456e747279122c0a036b657918012001280b321f2e67" . + "6f6f676c652e6170692e657870722e7631616c706861312e56616c756512" . + "2e0a0576616c756518022001280b321f2e676f6f676c652e6170692e6578" . + "70722e7631616c706861312e56616c7565426d0a1c636f6d2e676f6f676c" . + "652e6170692e657870722e7631616c70686131420a56616c756550726f74" . + "6f50015a3c676f6f676c652e676f6c616e672e6f72672f67656e70726f74" . + "6f2f676f6f676c65617069732f6170692f657870722f7631616c70686131" . + "3b65787072f80101620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/Decl.php b/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/Decl.php new file mode 100644 index 00000000..9636ad11 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/Decl.php @@ -0,0 +1,48 @@ +internalAddGeneratedFile(hex2bin( + "0ab9050a22676f6f676c652f6170692f657870722f763162657461312f64" . + "65636c2e70726f746f1217676f6f676c652e6170692e657870722e763162" . + "6574613122a5010a044465636c120a0a026964180120012805120c0a046e" . + "616d65180220012809120b0a03646f6318032001280912330a056964656e" . + "7418042001280b32222e676f6f676c652e6170692e657870722e76316265" . + "7461312e4964656e744465636c480012390a0866756e6374696f6e180520" . + "01280b32252e676f6f676c652e6170692e657870722e763162657461312e" . + "46756e6374696f6e4465636c480042060a046b696e64225c0a084465636c" . + "54797065120a0a026964180120012805120c0a0474797065180220012809" . + "12360a0b747970655f706172616d7318042003280b32212e676f6f676c65" . + "2e6170692e657870722e763162657461312e4465636c54797065226a0a09" . + "4964656e744465636c122f0a047479706518032001280b32212e676f6f67" . + "6c652e6170692e657870722e763162657461312e4465636c54797065122c" . + "0a0576616c756518042001280b321d2e676f6f676c652e6170692e657870" . + "722e763162657461312e457870722293010a0c46756e6374696f6e446563" . + "6c12300a046172677318012003280b32222e676f6f676c652e6170692e65" . + "7870722e763162657461312e4964656e744465636c12360a0b7265747572" . + "6e5f7479706518022001280b32212e676f6f676c652e6170692e65787072" . + "2e763162657461312e4465636c5479706512190a1172656365697665725f" . + "66756e6374696f6e180320012808426a0a1b636f6d2e676f6f676c652e61" . + "70692e657870722e7631626574613142094465636c50726f746f50015a3b" . + "676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f" . + "676c65617069732f6170692f657870722f763162657461313b65787072f8" . + "0101620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/Expr.php b/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/Expr.php new file mode 100644 index 00000000..532b89ae --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/Expr.php @@ -0,0 +1,89 @@ +internalAddGeneratedFile(hex2bin( + "0ae60e0a22676f6f676c652f6170692f657870722f763162657461312f65" . + "7870722e70726f746f1217676f6f676c652e6170692e657870722e763162" . + "657461311a1c676f6f676c652f70726f746f6275662f7374727563742e70" . + "726f746f228b010a0a50617273656445787072122b0a0465787072180220" . + "01280b321d2e676f6f676c652e6170692e657870722e763162657461312e" . + "4578707212380a0b736f757263655f696e666f18032001280b32232e676f" . + "6f676c652e6170692e657870722e763162657461312e536f75726365496e" . + "666f12160a0e73796e7461785f76657273696f6e18042001280922ab0a0a" . + "0445787072120a0a02696418022001280512380a0c6c69746572616c5f65" . + "78707218032001280b32202e676f6f676c652e6170692e657870722e7631" . + "62657461312e4c69746572616c480012390a0a6964656e745f6578707218" . + "042001280b32232e676f6f676c652e6170692e657870722e763162657461" . + "312e457870722e4964656e744800123b0a0b73656c6563745f6578707218" . + "052001280b32242e676f6f676c652e6170692e657870722e763162657461" . + "312e457870722e53656c656374480012370a0963616c6c5f657870721806" . + "2001280b32222e676f6f676c652e6170692e657870722e76316265746131" . + "2e457870722e43616c6c4800123d0a096c6973745f657870721807200128" . + "0b32282e676f6f676c652e6170692e657870722e763162657461312e4578" . + "70722e4372656174654c697374480012410a0b7374727563745f65787072" . + "18082001280b322a2e676f6f676c652e6170692e657870722e7631626574" . + "61312e457870722e437265617465537472756374480012490a12636f6d70" . + "726568656e73696f6e5f6578707218092001280b322b2e676f6f676c652e" . + "6170692e657870722e763162657461312e457870722e436f6d7072656865" . + "6e73696f6e48001a150a054964656e74120c0a046e616d65180120012809" . + "1a5a0a0653656c656374122e0a076f706572616e6418012001280b321d2e" . + "676f6f676c652e6170692e657870722e763162657461312e45787072120d" . + "0a056669656c6418022001280912110a09746573745f6f6e6c7918032001" . + "28081a740a0443616c6c122d0a0674617267657418012001280b321d2e67" . + "6f6f676c652e6170692e657870722e763162657461312e4578707212100a" . + "0866756e6374696f6e180220012809122b0a046172677318032003280b32" . + "1d2e676f6f676c652e6170692e657870722e763162657461312e45787072" . + "1a3d0a0a4372656174654c697374122f0a08656c656d656e747318012003" . + "280b321d2e676f6f676c652e6170692e657870722e763162657461312e45" . + "7870721af6010a0c437265617465537472756374120c0a04747970651801" . + "2001280912410a07656e747269657318022003280b32302e676f6f676c65" . + "2e6170692e657870722e763162657461312e457870722e43726561746553" . + "74727563742e456e7472791a94010a05456e747279120a0a026964180120" . + "01280512130a096669656c645f6b6579180220012809480012300a076d61" . + "705f6b657918032001280b321d2e676f6f676c652e6170692e657870722e" . + "763162657461312e457870724800122c0a0576616c756518042001280b32" . + "1d2e676f6f676c652e6170692e657870722e763162657461312e45787072" . + "420a0a086b65795f6b696e641ab0020a0d436f6d70726568656e73696f6e" . + "12100a08697465725f76617218012001280912310a0a697465725f72616e" . + "676518022001280b321d2e676f6f676c652e6170692e657870722e763162" . + "657461312e4578707212100a08616363755f76617218032001280912300a" . + "09616363755f696e697418042001280b321d2e676f6f676c652e6170692e" . + "657870722e763162657461312e4578707212350a0e6c6f6f705f636f6e64" . + "6974696f6e18052001280b321d2e676f6f676c652e6170692e657870722e" . + "763162657461312e4578707212300a096c6f6f705f737465701806200128" . + "0b321d2e676f6f676c652e6170692e657870722e763162657461312e4578" . + "7072122d0a06726573756c7418072001280b321d2e676f6f676c652e6170" . + "692e657870722e763162657461312e45787072420b0a09657870725f6b69" . + "6e6422d8010a074c69746572616c12300a0a6e756c6c5f76616c75651801" . + "2001280e321a2e676f6f676c652e70726f746f6275662e4e756c6c56616c" . + "7565480012140a0a626f6f6c5f76616c7565180220012808480012150a0b" . + "696e7436345f76616c7565180320012803480012160a0c75696e7436345f" . + "76616c7565180420012804480012160a0c646f75626c655f76616c756518" . + "0520012801480012160a0c737472696e675f76616c756518062001280948" . + "0012150a0b62797465735f76616c756518072001280c4800420f0a0d636f" . + "6e7374616e745f6b696e64426a0a1b636f6d2e676f6f676c652e6170692e" . + "657870722e7631626574613142094578707250726f746f50015a3b676f6f" . + "676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65" . + "617069732f6170692f657870722f763162657461313b65787072f8010162" . + "0670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/PBEval.php b/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/PBEval.php new file mode 100644 index 00000000..b13a4392 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/PBEval.php @@ -0,0 +1,49 @@ +internalAddGeneratedFile(hex2bin( + "0ac4050a22676f6f676c652f6170692f657870722f763162657461312f65" . + "76616c2e70726f746f1217676f6f676c652e6170692e657870722e763162" . + "657461311a17676f6f676c652f7270632f7374617475732e70726f746f22" . + "c2010a094576616c537461746512320a0676616c75657318012003280b32" . + "222e676f6f676c652e6170692e657870722e763162657461312e45787072" . + "56616c7565123a0a07726573756c747318032003280b32292e676f6f676c" . + "652e6170692e657870722e763162657461312e4576616c53746174652e52" . + "6573756c741a450a06526573756c74122c0a046578707218012001280b32" . + "1e2e676f6f676c652e6170692e657870722e763162657461312e49645265" . + "66120d0a0576616c756518022001280522b0010a094578707256616c7565" . + "122f0a0576616c756518012001280b321e2e676f6f676c652e6170692e65" . + "7870722e763162657461312e56616c7565480012320a056572726f721802" . + "2001280b32212e676f6f676c652e6170692e657870722e76316265746131" . + "2e4572726f72536574480012360a07756e6b6e6f776e18032001280b3223" . + "2e676f6f676c652e6170692e657870722e763162657461312e556e6b6e6f" . + "776e536574480042060a046b696e64222e0a084572726f7253657412220a" . + "066572726f727318012003280b32122e676f6f676c652e7270632e537461" . + "747573223b0a0a556e6b6e6f776e536574122d0a05657870727318012003" . + "280b321e2e676f6f676c652e6170692e657870722e763162657461312e49" . + "6452656622130a054964526566120a0a026964180120012805426a0a1b63" . + "6f6d2e676f6f676c652e6170692e657870722e7631626574613142094576" . + "616c50726f746f50015a3b676f6f676c652e676f6c616e672e6f72672f67" . + "656e70726f746f2f676f6f676c65617069732f6170692f657870722f7631" . + "62657461313b65787072f80101620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/Source.php b/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/Source.php new file mode 100644 index 00000000..78c45b6a --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/Source.php @@ -0,0 +1,38 @@ +internalAddGeneratedFile(hex2bin( + "0ab7030a24676f6f676c652f6170692f657870722f763162657461312f73" . + "6f757263652e70726f746f1217676f6f676c652e6170692e657870722e76" . + "31626574613122ad010a0a536f75726365496e666f12100a086c6f636174" . + "696f6e18022001280912140a0c6c696e655f6f6666736574731803200328" . + "0512450a09706f736974696f6e7318042003280b32322e676f6f676c652e" . + "6170692e657870722e763162657461312e536f75726365496e666f2e506f" . + "736974696f6e73456e7472791a300a0e506f736974696f6e73456e747279" . + "120b0a036b6579180120012805120d0a0576616c75651802200128053a02" . + "380122500a0e536f75726365506f736974696f6e12100a086c6f63617469" . + "6f6e180120012809120e0a066f6666736574180220012805120c0a046c69" . + "6e65180320012805120e0a06636f6c756d6e180420012805426c0a1b636f" . + "6d2e676f6f676c652e6170692e657870722e76316265746131420b536f75" . + "72636550726f746f50015a3b676f6f676c652e676f6c616e672e6f72672f" . + "67656e70726f746f2f676f6f676c65617069732f6170692f657870722f76" . + "3162657461313b65787072f80101620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/Value.php b/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/Value.php new file mode 100644 index 00000000..787a5973 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Expr/V1Beta1/Value.php @@ -0,0 +1,57 @@ +internalAddGeneratedFile(hex2bin( + "0aa4070a23676f6f676c652f6170692f657870722f763162657461312f76" . + "616c75652e70726f746f1217676f6f676c652e6170692e657870722e7631" . + "62657461311a1c676f6f676c652f70726f746f6275662f7374727563742e" . + "70726f746f22bd030a0556616c756512300a0a6e756c6c5f76616c756518" . + "012001280e321a2e676f6f676c652e70726f746f6275662e4e756c6c5661" . + "6c7565480012140a0a626f6f6c5f76616c7565180220012808480012150a" . + "0b696e7436345f76616c7565180320012803480012160a0c75696e743634" . + "5f76616c7565180420012804480012160a0c646f75626c655f76616c7565" . + "180520012801480012160a0c737472696e675f76616c7565180620012809" . + "480012150a0b62797465735f76616c756518072001280c480012380a0a65" . + "6e756d5f76616c756518092001280b32222e676f6f676c652e6170692e65" . + "7870722e763162657461312e456e756d56616c75654800122c0a0c6f626a" . + "6563745f76616c7565180a2001280b32142e676f6f676c652e70726f746f" . + "6275662e416e79480012360a096d61705f76616c7565180b2001280b3221" . + "2e676f6f676c652e6170692e657870722e763162657461312e4d61705661" . + "6c7565480012380a0a6c6973745f76616c7565180c2001280b32222e676f" . + "6f676c652e6170692e657870722e763162657461312e4c69737456616c75" . + "65480012140a0a747970655f76616c7565180f20012809480042060a046b" . + "696e6422280a09456e756d56616c7565120c0a0474797065180120012809" . + "120d0a0576616c7565180220012805223b0a094c69737456616c7565122e" . + "0a0676616c75657318012003280b321e2e676f6f676c652e6170692e6578" . + "70722e763162657461312e56616c756522a9010a084d617056616c756512" . + "380a07656e747269657318012003280b32272e676f6f676c652e6170692e" . + "657870722e763162657461312e4d617056616c75652e456e7472791a630a" . + "05456e747279122b0a036b657918012001280b321e2e676f6f676c652e61" . + "70692e657870722e763162657461312e56616c7565122d0a0576616c7565" . + "18022001280b321e2e676f6f676c652e6170692e657870722e7631626574" . + "61312e56616c7565426b0a1b636f6d2e676f6f676c652e6170692e657870" . + "722e76316265746131420a56616c756550726f746f50015a3b676f6f676c" . + "652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c656170" . + "69732f6170692f657870722f763162657461313b65787072f80101620670" . + "726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/FieldBehavior.php b/vendor/google/common-protos/metadata/Api/FieldBehavior.php new file mode 100644 index 00000000..3c262351 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/FieldBehavior.php @@ -0,0 +1,34 @@ +internalAddGeneratedFile(hex2bin( + "0ac6020a1f676f6f676c652f6170692f6669656c645f6265686176696f72" . + "2e70726f746f120a676f6f676c652e6170691a20676f6f676c652f70726f" . + "746f6275662f64657363726970746f722e70726f746f2a7b0a0d4669656c" . + "644265686176696f72121e0a1a4649454c445f4245484156494f525f554e" . + "5350454349464945441000120c0a084f5054494f4e414c1001120c0a0852" . + "455155495245441002120f0a0b4f55545055545f4f4e4c591003120e0a0a" . + "494e5055545f4f4e4c591004120d0a09494d4d555441424c45100542700a" . + "0e636f6d2e676f6f676c652e61706942124669656c644265686176696f72" . + "50726f746f50015a41676f6f676c652e676f6c616e672e6f72672f67656e" . + "70726f746f2f676f6f676c65617069732f6170692f616e6e6f746174696f" . + "6e733b616e6e6f746174696f6e73a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Http.php b/vendor/google/common-protos/metadata/Api/Http.php new file mode 100644 index 00000000..5df9e795 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Http.php @@ -0,0 +1,42 @@ +internalAddGeneratedFile(hex2bin( + "0aa2040a15676f6f676c652f6170692f687474702e70726f746f120a676f" . + "6f676c652e61706922540a044874747012230a0572756c65731801200328" . + "0b32142e676f6f676c652e6170692e4874747052756c6512270a1f66756c" . + "6c795f6465636f64655f72657365727665645f657870616e73696f6e1802" . + "200128082281020a084874747052756c6512100a0873656c6563746f7218" . + "0120012809120d0a036765741802200128094800120d0a03707574180320" . + "0128094800120e0a04706f7374180420012809480012100a0664656c6574" . + "651805200128094800120f0a0570617463681806200128094800122f0a06" . + "637573746f6d18082001280b321d2e676f6f676c652e6170692e43757374" . + "6f6d487474705061747465726e4800120c0a04626f647918072001280912" . + "150a0d726573706f6e73655f626f6479180c2001280912310a1361646469" . + "74696f6e616c5f62696e64696e6773180b2003280b32142e676f6f676c65" . + "2e6170692e4874747052756c6542090a077061747465726e222f0a114375" . + "73746f6d487474705061747465726e120c0a046b696e6418012001280912" . + "0c0a0470617468180220012809426a0a0e636f6d2e676f6f676c652e6170" . + "6942094874747050726f746f50015a41676f6f676c652e676f6c616e672e" . + "6f72672f67656e70726f746f2f676f6f676c65617069732f6170692f616e" . + "6e6f746174696f6e733b616e6e6f746174696f6e73f80101a20204474150" . + "49620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Httpbody.php b/vendor/google/common-protos/metadata/Api/Httpbody.php new file mode 100644 index 00000000..19be392a --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Httpbody.php @@ -0,0 +1,33 @@ +internalAddGeneratedFile(hex2bin( + "0af0010a19676f6f676c652f6170692f68747470626f64792e70726f746f" . + "120a676f6f676c652e61706922580a0848747470426f647912140a0c636f" . + "6e74656e745f74797065180120012809120c0a046461746118022001280c" . + "12280a0a657874656e73696f6e7318032003280b32142e676f6f676c652e" . + "70726f746f6275662e416e7942650a0e636f6d2e676f6f676c652e617069" . + "420d48747470426f647950726f746f50015a3b676f6f676c652e676f6c61" . + "6e672e6f72672f67656e70726f746f2f676f6f676c65617069732f617069" . + "2f68747470626f64793b68747470626f6479a2020447415049620670726f" . + "746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Label.php b/vendor/google/common-protos/metadata/Api/Label.php new file mode 100644 index 00000000..3b194677 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Label.php @@ -0,0 +1,34 @@ +internalAddGeneratedFile(hex2bin( + "0aac020a16676f6f676c652f6170692f6c6162656c2e70726f746f120a67" . + "6f6f676c652e617069229c010a0f4c6162656c44657363726970746f7212" . + "0b0a036b657918012001280912390a0a76616c75655f7479706518022001" . + "280e32252e676f6f676c652e6170692e4c6162656c44657363726970746f" . + "722e56616c75655479706512130a0b6465736372697074696f6e18032001" . + "2809222c0a0956616c756554797065120a0a06535452494e47100012080a" . + "04424f4f4c100112090a05494e5436341002425f0a0e636f6d2e676f6f67" . + "6c652e617069420a4c6162656c50726f746f50015a35676f6f676c652e67" . + "6f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f" . + "6170692f6c6162656c3b6c6162656cf80101a2020447415049620670726f" . + "746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/LaunchStage.php b/vendor/google/common-protos/metadata/Api/LaunchStage.php new file mode 100644 index 00000000..ee2ad66b --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/LaunchStage.php @@ -0,0 +1,32 @@ +internalAddGeneratedFile(hex2bin( + "0afb010a1d676f6f676c652f6170692f6c61756e63685f73746167652e70" . + "726f746f120a676f6f676c652e6170692a6a0a0b4c61756e636853746167" . + "65121c0a184c41554e43485f53544147455f554e53504543494649454410" . + "0012100a0c4541524c595f414343455353100112090a05414c5048411002" . + "12080a0442455441100312060a0247411004120e0a0a4445505245434154" . + "45441005425a0a0e636f6d2e676f6f676c652e61706942104c61756e6368" . + "537461676550726f746f50015a2d676f6f676c652e676f6c616e672e6f72" . + "672f67656e70726f746f2f676f6f676c65617069732f6170693b617069a2" . + "020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Log.php b/vendor/google/common-protos/metadata/Api/Log.php new file mode 100644 index 00000000..91b3fa23 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Log.php @@ -0,0 +1,34 @@ +internalAddGeneratedFile(hex2bin( + "0a8d020a14676f6f676c652f6170692f6c6f672e70726f746f120a676f6f" . + "676c652e61706922750a0d4c6f6744657363726970746f72120c0a046e61" . + "6d65180120012809122b0a066c6162656c7318022003280b321b2e676f6f" . + "676c652e6170692e4c6162656c44657363726970746f7212130a0b646573" . + "6372697074696f6e18032001280912140a0c646973706c61795f6e616d65" . + "180420012809426a0a0e636f6d2e676f6f676c652e61706942084c6f6750" . + "726f746f50015a45676f6f676c652e676f6c616e672e6f72672f67656e70" . + "726f746f2f676f6f676c65617069732f6170692f73657276696365636f6e" . + "6669673b73657276696365636f6e666967a2020447415049620670726f74" . + "6f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Logging.php b/vendor/google/common-protos/metadata/Api/Logging.php new file mode 100644 index 00000000..d04e0c3c --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Logging.php @@ -0,0 +1,37 @@ +internalAddGeneratedFile(hex2bin( + "0af8020a18676f6f676c652f6170692f6c6f6767696e672e70726f746f12" . + "0a676f6f676c652e61706922d7010a074c6f6767696e6712450a1570726f" . + "64756365725f64657374696e6174696f6e7318012003280b32262e676f6f" . + "676c652e6170692e4c6f6767696e672e4c6f6767696e6744657374696e61" . + "74696f6e12450a15636f6e73756d65725f64657374696e6174696f6e7318" . + "022003280b32262e676f6f676c652e6170692e4c6f6767696e672e4c6f67" . + "67696e6744657374696e6174696f6e1a3e0a124c6f6767696e6744657374" . + "696e6174696f6e121a0a126d6f6e69746f7265645f7265736f7572636518" . + "0320012809120c0a046c6f6773180120032809426e0a0e636f6d2e676f6f" . + "676c652e617069420c4c6f6767696e6750726f746f50015a45676f6f676c" . + "652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c656170" . + "69732f6170692f73657276696365636f6e6669673b73657276696365636f" . + "6e666967a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Metric.php b/vendor/google/common-protos/metadata/Api/Metric.php new file mode 100644 index 00000000..3e04ee07 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Metric.php @@ -0,0 +1,63 @@ +internalAddGeneratedFile(hex2bin( + "0ac4080a17676f6f676c652f6170692f6d65747269632e70726f746f120a" . + "676f6f676c652e6170691a1d676f6f676c652f6170692f6c61756e63685f" . + "73746167652e70726f746f1a1e676f6f676c652f70726f746f6275662f64" . + "75726174696f6e2e70726f746f22fd050a104d6574726963446573637269" . + "70746f72120c0a046e616d65180120012809120c0a047479706518082001" . + "2809122b0a066c6162656c7318022003280b321b2e676f6f676c652e6170" . + "692e4c6162656c44657363726970746f72123c0a0b6d65747269635f6b69" . + "6e6418032001280e32272e676f6f676c652e6170692e4d65747269634465" . + "7363726970746f722e4d65747269634b696e64123a0a0a76616c75655f74" . + "79706518042001280e32262e676f6f676c652e6170692e4d657472696344" . + "657363726970746f722e56616c756554797065120c0a04756e6974180520" . + "01280912130a0b6465736372697074696f6e18062001280912140a0c6469" . + "73706c61795f6e616d6518072001280912470a086d65746164617461180a" . + "2001280b32352e676f6f676c652e6170692e4d6574726963446573637269" . + "70746f722e4d657472696344657363726970746f724d6574616461746112" . + "2d0a0c6c61756e63685f7374616765180c2001280e32172e676f6f676c65" . + "2e6170692e4c61756e636853746167651ab0010a184d6574726963446573" . + "63726970746f724d6574616461746112310a0c6c61756e63685f73746167" . + "6518012001280e32172e676f6f676c652e6170692e4c61756e6368537461" . + "67654202180112300a0d73616d706c655f706572696f6418022001280b32" . + "192e676f6f676c652e70726f746f6275662e4475726174696f6e122f0a0c" . + "696e676573745f64656c617918032001280b32192e676f6f676c652e7072" . + "6f746f6275662e4475726174696f6e224f0a0a4d65747269634b696e6412" . + "1b0a174d45545249435f4b494e445f554e53504543494649454410001209" . + "0a054741554745100112090a0544454c54411002120e0a0a43554d554c41" . + "54495645100322710a0956616c756554797065121a0a1656414c55455f54" . + "5950455f554e535045434946494544100012080a04424f4f4c100112090a" . + "05494e5436341002120a0a06444f55424c451003120a0a06535452494e47" . + "100412100a0c444953545249425554494f4e100512090a054d4f4e455910" . + "0622750a064d6574726963120c0a0474797065180320012809122e0a066c" . + "6162656c7318022003280b321e2e676f6f676c652e6170692e4d65747269" . + "632e4c6162656c73456e7472791a2d0a0b4c6162656c73456e747279120b" . + "0a036b6579180120012809120d0a0576616c75651802200128093a023801" . + "425f0a0e636f6d2e676f6f676c652e617069420b4d657472696350726f74" . + "6f50015a37676f6f676c652e676f6c616e672e6f72672f67656e70726f74" . + "6f2f676f6f676c65617069732f6170692f6d65747269633b6d6574726963" . + "a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/MonitoredResource.php b/vendor/google/common-protos/metadata/Api/MonitoredResource.php new file mode 100644 index 00000000..0ee2449b --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/MonitoredResource.php @@ -0,0 +1,49 @@ +internalAddGeneratedFile(hex2bin( + "0ac1050a23676f6f676c652f6170692f6d6f6e69746f7265645f7265736f" . + "757263652e70726f746f120a676f6f676c652e6170691a1c676f6f676c65" . + "2f70726f746f6275662f7374727563742e70726f746f2291010a1b4d6f6e" . + "69746f7265645265736f7572636544657363726970746f72120c0a046e61" . + "6d65180520012809120c0a047479706518012001280912140a0c64697370" . + "6c61795f6e616d6518022001280912130a0b6465736372697074696f6e18" . + "0320012809122b0a066c6162656c7318042003280b321b2e676f6f676c65" . + "2e6170692e4c6162656c44657363726970746f72228b010a114d6f6e6974" . + "6f7265645265736f75726365120c0a047479706518012001280912390a06" . + "6c6162656c7318022003280b32292e676f6f676c652e6170692e4d6f6e69" . + "746f7265645265736f757263652e4c6162656c73456e7472791a2d0a0b4c" . + "6162656c73456e747279120b0a036b6579180120012809120d0a0576616c" . + "75651802200128093a02380122ca010a194d6f6e69746f7265645265736f" . + "757263654d65746164617461122e0a0d73797374656d5f6c6162656c7318" . + "012001280b32172e676f6f676c652e70726f746f6275662e537472756374" . + "124a0a0b757365725f6c6162656c7318022003280b32352e676f6f676c65" . + "2e6170692e4d6f6e69746f7265645265736f757263654d65746164617461" . + "2e557365724c6162656c73456e7472791a310a0f557365724c6162656c73" . + "456e747279120b0a036b6579180120012809120d0a0576616c7565180220" . + "0128093a02380142790a0e636f6d2e676f6f676c652e61706942164d6f6e" . + "69746f7265645265736f7572636550726f746f50015a43676f6f676c652e" . + "676f6c616e672e6f72672f67656e70726f746f2f676f6f676c6561706973" . + "2f6170692f6d6f6e69746f7265647265733b6d6f6e69746f726564726573" . + "f80101a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Monitoring.php b/vendor/google/common-protos/metadata/Api/Monitoring.php new file mode 100644 index 00000000..a7cf561c --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Monitoring.php @@ -0,0 +1,38 @@ +internalAddGeneratedFile(hex2bin( + "0a93030a1b676f6f676c652f6170692f6d6f6e69746f72696e672e70726f" . + "746f120a676f6f676c652e61706922ec010a0a4d6f6e69746f72696e6712" . + "4b0a1570726f64756365725f64657374696e6174696f6e7318012003280b" . + "322c2e676f6f676c652e6170692e4d6f6e69746f72696e672e4d6f6e6974" . + "6f72696e6744657374696e6174696f6e124b0a15636f6e73756d65725f64" . + "657374696e6174696f6e7318022003280b322c2e676f6f676c652e617069" . + "2e4d6f6e69746f72696e672e4d6f6e69746f72696e6744657374696e6174" . + "696f6e1a440a154d6f6e69746f72696e6744657374696e6174696f6e121a" . + "0a126d6f6e69746f7265645f7265736f75726365180120012809120f0a07" . + "6d65747269637318022003280942710a0e636f6d2e676f6f676c652e6170" . + "69420f4d6f6e69746f72696e6750726f746f50015a45676f6f676c652e67" . + "6f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f" . + "6170692f73657276696365636f6e6669673b73657276696365636f6e6669" . + "67a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Quota.php b/vendor/google/common-protos/metadata/Api/Quota.php new file mode 100644 index 00000000..d5c37e7e --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Quota.php @@ -0,0 +1,47 @@ +internalAddGeneratedFile(hex2bin( + "0aa5050a16676f6f676c652f6170692f71756f74612e70726f746f120a67" . + "6f6f676c652e617069225d0a0551756f746112260a066c696d6974731803" . + "2003280b32162e676f6f676c652e6170692e51756f74614c696d6974122c" . + "0a0c6d65747269635f72756c657318042003280b32162e676f6f676c652e" . + "6170692e4d657472696352756c652291010a0a4d657472696352756c6512" . + "100a0873656c6563746f72180120012809123d0a0c6d65747269635f636f" . + "73747318022003280b32272e676f6f676c652e6170692e4d657472696352" . + "756c652e4d6574726963436f737473456e7472791a320a104d6574726963" . + "436f737473456e747279120b0a036b6579180120012809120d0a0576616c" . + "75651802200128033a0238012295020a0a51756f74614c696d6974120c0a" . + "046e616d6518062001280912130a0b6465736372697074696f6e18022001" . + "280912150a0d64656661756c745f6c696d697418032001280312110a096d" . + "61785f6c696d697418042001280312110a09667265655f74696572180720" . + "01280312100a086475726174696f6e180520012809120e0a066d65747269" . + "63180820012809120c0a04756e697418092001280912320a0676616c7565" . + "73180a2003280b32222e676f6f676c652e6170692e51756f74614c696d69" . + "742e56616c756573456e74727912140a0c646973706c61795f6e616d6518" . + "0c200128091a2d0a0b56616c756573456e747279120b0a036b6579180120" . + "012809120d0a0576616c75651802200128033a023801426c0a0e636f6d2e" . + "676f6f676c652e617069420a51756f746150726f746f50015a45676f6f67" . + "6c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c6561" . + "7069732f6170692f73657276696365636f6e6669673b7365727669636563" . + "6f6e666967a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Resource.php b/vendor/google/common-protos/metadata/Api/Resource.php new file mode 100644 index 00000000..58c7edd4 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Resource.php @@ -0,0 +1,40 @@ +internalAddGeneratedFile(hex2bin( + "0afa030a19676f6f676c652f6170692f7265736f757263652e70726f746f" . + "120a676f6f676c652e6170691a20676f6f676c652f70726f746f6275662f" . + "64657363726970746f722e70726f746f22ff010a125265736f7572636544" . + "657363726970746f72120c0a0474797065180120012809120f0a07706174" . + "7465726e18022003280912120a0a6e616d655f6669656c64180320012809" . + "12370a07686973746f727918042001280e32262e676f6f676c652e617069" . + "2e5265736f7572636544657363726970746f722e486973746f7279120e0a" . + "06706c7572616c18052001280912100a0873696e67756c61721806200128" . + "09225b0a07486973746f727912170a13484953544f52595f554e53504543" . + "49464945441000121d0a194f524947494e414c4c595f53494e474c455f50" . + "41545445524e100112180a144655545552455f4d554c54495f5041545445" . + "524e100222350a115265736f757263655265666572656e6365120c0a0474" . + "79706518012001280912120a0a6368696c645f7479706518022001280942" . + "6e0a0e636f6d2e676f6f676c652e617069420d5265736f7572636550726f" . + "746f50015a41676f6f676c652e676f6c616e672e6f72672f67656e70726f" . + "746f2f676f6f676c65617069732f6170692f616e6e6f746174696f6e733b" . + "616e6e6f746174696f6e73f80101a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Routing.php b/vendor/google/common-protos/metadata/Api/Routing.php new file mode 100644 index 00000000..6139d258 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Routing.php @@ -0,0 +1,33 @@ +internalAddGeneratedFile( + ' + +google/api/routing.proto +google.api google/protobuf/descriptor.proto"G + RoutingRule8 +routing_parameters ( 2.google.api.RoutingParameter"8 +RoutingParameter +field (  + path_template ( Bj +com.google.apiB RoutingProtoPZAgoogle.golang.org/genproto/googleapis/api/annotations;annotationsGAPIbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Service.php b/vendor/google/common-protos/metadata/Api/Service.php new file mode 100644 index 00000000..a4be551a --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Service.php @@ -0,0 +1,101 @@ +internalAddGeneratedFile(hex2bin( + "0aa10d0a18676f6f676c652f6170692f736572766963652e70726f746f12" . + "0a676f6f676c652e6170691a15676f6f676c652f6170692f617574682e70" . + "726f746f1a18676f6f676c652f6170692f6261636b656e642e70726f746f" . + "1a18676f6f676c652f6170692f62696c6c696e672e70726f746f1a18676f" . + "6f676c652f6170692f636f6e746578742e70726f746f1a18676f6f676c65" . + "2f6170692f636f6e74726f6c2e70726f746f1a1e676f6f676c652f617069" . + "2f646f63756d656e746174696f6e2e70726f746f1a19676f6f676c652f61" . + "70692f656e64706f696e742e70726f746f1a15676f6f676c652f6170692f" . + "687474702e70726f746f1a14676f6f676c652f6170692f6c6f672e70726f" . + "746f1a18676f6f676c652f6170692f6c6f6767696e672e70726f746f1a17" . + "676f6f676c652f6170692f6d65747269632e70726f746f1a23676f6f676c" . + "652f6170692f6d6f6e69746f7265645f7265736f757263652e70726f746f" . + "1a1b676f6f676c652f6170692f6d6f6e69746f72696e672e70726f746f1a" . + "16676f6f676c652f6170692f71756f74612e70726f746f1a1c676f6f676c" . + "652f6170692f736f757263655f696e666f2e70726f746f1a21676f6f676c" . + "652f6170692f73797374656d5f706172616d657465722e70726f746f1a16" . + "676f6f676c652f6170692f75736167652e70726f746f1a19676f6f676c65" . + "2f70726f746f6275662f6170692e70726f746f1a1a676f6f676c652f7072" . + "6f746f6275662f747970652e70726f746f1a1e676f6f676c652f70726f74" . + "6f6275662f77726170706572732e70726f746f22dc070a07536572766963" . + "6512340a0e636f6e6669675f76657273696f6e18142001280b321c2e676f" . + "6f676c652e70726f746f6275662e55496e74333256616c7565120c0a046e" . + "616d65180120012809120a0a026964182120012809120d0a057469746c65" . + "180220012809121b0a1370726f64756365725f70726f6a6563745f696418" . + "162001280912220a046170697318032003280b32142e676f6f676c652e70" . + "726f746f6275662e41706912240a05747970657318042003280b32152e67" . + "6f6f676c652e70726f746f6275662e5479706512240a05656e756d731805" . + "2003280b32152e676f6f676c652e70726f746f6275662e456e756d12300a" . + "0d646f63756d656e746174696f6e18062001280b32192e676f6f676c652e" . + "6170692e446f63756d656e746174696f6e12240a076261636b656e641808" . + "2001280b32132e676f6f676c652e6170692e4261636b656e64121e0a0468" . + "74747018092001280b32102e676f6f676c652e6170692e4874747012200a" . + "0571756f7461180a2001280b32112e676f6f676c652e6170692e51756f74" . + "6112320a0e61757468656e7469636174696f6e180b2001280b321a2e676f" . + "6f676c652e6170692e41757468656e7469636174696f6e12240a07636f6e" . + "74657874180c2001280b32132e676f6f676c652e6170692e436f6e746578" . + "7412200a057573616765180f2001280b32112e676f6f676c652e6170692e" . + "557361676512270a09656e64706f696e747318122003280b32142e676f6f" . + "676c652e6170692e456e64706f696e7412240a07636f6e74726f6c181520" . + "01280b32132e676f6f676c652e6170692e436f6e74726f6c12270a046c6f" . + "677318172003280b32192e676f6f676c652e6170692e4c6f674465736372" . + "6970746f72122d0a076d65747269637318182003280b321c2e676f6f676c" . + "652e6170692e4d657472696344657363726970746f7212440a136d6f6e69" . + "746f7265645f7265736f757263657318192003280b32272e676f6f676c65" . + "2e6170692e4d6f6e69746f7265645265736f757263654465736372697074" . + "6f7212240a0762696c6c696e67181a2001280b32132e676f6f676c652e61" . + "70692e42696c6c696e6712240a076c6f6767696e67181b2001280b32132e" . + "676f6f676c652e6170692e4c6f6767696e67122a0a0a6d6f6e69746f7269" . + "6e67181c2001280b32162e676f6f676c652e6170692e4d6f6e69746f7269" . + "6e6712370a1173797374656d5f706172616d6574657273181d2001280b32" . + "1c2e676f6f676c652e6170692e53797374656d506172616d657465727312" . + "2b0a0b736f757263655f696e666f18252001280b32162e676f6f676c652e" . + "6170692e536f75726365496e666f4a0408651066426e0a0e636f6d2e676f" . + "6f676c652e617069420c5365727669636550726f746f50015a45676f6f67" . + "6c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c6561" . + "7069732f6170692f73657276696365636f6e6669673b7365727669636563" . + "6f6e666967a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/SourceInfo.php b/vendor/google/common-protos/metadata/Api/SourceInfo.php new file mode 100644 index 00000000..782fa36e --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/SourceInfo.php @@ -0,0 +1,32 @@ +internalAddGeneratedFile(hex2bin( + "0adf010a1c676f6f676c652f6170692f736f757263655f696e666f2e7072" . + "6f746f120a676f6f676c652e61706922380a0a536f75726365496e666f12" . + "2a0a0c736f757263655f66696c657318012003280b32142e676f6f676c65" . + "2e70726f746f6275662e416e7942710a0e636f6d2e676f6f676c652e6170" . + "69420f536f75726365496e666f50726f746f50015a45676f6f676c652e67" . + "6f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f" . + "6170692f73657276696365636f6e6669673b73657276696365636f6e6669" . + "67a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/SystemParameter.php b/vendor/google/common-protos/metadata/Api/SystemParameter.php new file mode 100644 index 00000000..d9979fab --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/SystemParameter.php @@ -0,0 +1,37 @@ +internalAddGeneratedFile(hex2bin( + "0aa0030a21676f6f676c652f6170692f73797374656d5f706172616d6574" . + "65722e70726f746f120a676f6f676c652e61706922420a1053797374656d" . + "506172616d6574657273122e0a0572756c657318012003280b321f2e676f" . + "6f676c652e6170692e53797374656d506172616d6574657252756c652258" . + "0a1353797374656d506172616d6574657252756c6512100a0873656c6563" . + "746f72180120012809122f0a0a706172616d657465727318022003280b32" . + "1b2e676f6f676c652e6170692e53797374656d506172616d657465722251" . + "0a0f53797374656d506172616d65746572120c0a046e616d651801200128" . + "0912130a0b687474705f686561646572180220012809121b0a1375726c5f" . + "71756572795f706172616d6574657218032001280942760a0e636f6d2e67" . + "6f6f676c652e617069421453797374656d506172616d6574657250726f74" . + "6f50015a45676f6f676c652e676f6c616e672e6f72672f67656e70726f74" . + "6f2f676f6f676c65617069732f6170692f73657276696365636f6e666967" . + "3b73657276696365636f6e666967a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Api/Usage.php b/vendor/google/common-protos/metadata/Api/Usage.php new file mode 100644 index 00000000..d966c0b7 --- /dev/null +++ b/vendor/google/common-protos/metadata/Api/Usage.php @@ -0,0 +1,36 @@ +internalAddGeneratedFile(hex2bin( + "0ae5020a16676f6f676c652f6170692f75736167652e70726f746f120a67" . + "6f6f676c652e617069226a0a05557361676512140a0c726571756972656d" . + "656e747318012003280912240a0572756c657318062003280b32152e676f" . + "6f676c652e6170692e557361676552756c6512250a1d70726f6475636572" . + "5f6e6f74696669636174696f6e5f6368616e6e656c180720012809225d0a" . + "09557361676552756c6512100a0873656c6563746f721801200128091220" . + "0a18616c6c6f775f756e726567697374657265645f63616c6c7318022001" . + "2808121c0a14736b69705f736572766963655f636f6e74726f6c18032001" . + "2808426c0a0e636f6d2e676f6f676c652e617069420a557361676550726f" . + "746f50015a45676f6f676c652e676f6c616e672e6f72672f67656e70726f" . + "746f2f676f6f676c65617069732f6170692f73657276696365636f6e6669" . + "673b73657276696365636f6e666967a2020447415049620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Cloud/ExtendedOperations.php b/vendor/google/common-protos/metadata/Cloud/ExtendedOperations.php new file mode 100644 index 00000000..08219cbc Binary files /dev/null and b/vendor/google/common-protos/metadata/Cloud/ExtendedOperations.php differ diff --git a/vendor/google/common-protos/metadata/Iam/V1/IamPolicy.php b/vendor/google/common-protos/metadata/Iam/V1/IamPolicy.php new file mode 100644 index 00000000..f622f3b2 --- /dev/null +++ b/vendor/google/common-protos/metadata/Iam/V1/IamPolicy.php @@ -0,0 +1,66 @@ +internalAddGeneratedFile(hex2bin( + "0ad3080a1e676f6f676c652f69616d2f76312f69616d5f706f6c6963792e" . + "70726f746f120d676f6f676c652e69616d2e76311a1a676f6f676c652f69" . + "616d2f76312f706f6c6963792e70726f746f1a1c676f6f676c652f617069" . + "2f616e6e6f746174696f6e732e70726f746f1a17676f6f676c652f617069" . + "2f636c69656e742e70726f746f1a1f676f6f676c652f6170692f6669656c" . + "645f6265686176696f722e70726f746f1a19676f6f676c652f6170692f72" . + "65736f757263652e70726f746f225e0a1353657449616d506f6c69637952" . + "657175657374121b0a087265736f757263651801200128094209e04102fa" . + "41030a012a122a0a06706f6c69637918022001280b32152e676f6f676c65" . + "2e69616d2e76312e506f6c6963794203e0410222640a1347657449616d50" . + "6f6c69637952657175657374121b0a087265736f75726365180120012809" . + "4209e04102fa41030a012a12300a076f7074696f6e7318022001280b321f" . + "2e676f6f676c652e69616d2e76312e476574506f6c6963794f7074696f6e" . + "7322520a195465737449616d5065726d697373696f6e7352657175657374" . + "121b0a087265736f757263651801200128094209e04102fa41030a012a12" . + "180a0b7065726d697373696f6e731802200328094203e0410222310a1a54" . + "65737449616d5065726d697373696f6e73526573706f6e736512130a0b70" . + "65726d697373696f6e7318012003280932b4030a0949414d506f6c696379" . + "12740a0c53657449616d506f6c69637912222e676f6f676c652e69616d2e" . + "76312e53657449616d506f6c696379526571756573741a152e676f6f676c" . + "652e69616d2e76312e506f6c696379222982d3e4930223221e2f76312f7b" . + "7265736f757263653d2a2a7d3a73657449616d506f6c6963793a012a1274" . + "0a0c47657449616d506f6c69637912222e676f6f676c652e69616d2e7631" . + "2e47657449616d506f6c696379526571756573741a152e676f6f676c652e" . + "69616d2e76312e506f6c696379222982d3e4930223221e2f76312f7b7265" . + "736f757263653d2a2a7d3a67657449616d506f6c6963793a012a129a010a" . + "125465737449616d5065726d697373696f6e7312282e676f6f676c652e69" . + "616d2e76312e5465737449616d5065726d697373696f6e73526571756573" . + "741a292e676f6f676c652e69616d2e76312e5465737449616d5065726d69" . + "7373696f6e73526573706f6e7365222f82d3e493022922242f76312f7b72" . + "65736f757263653d2a2a7d3a7465737449616d5065726d697373696f6e73" . + "3a012a1a1eca411b69616d2d6d6574612d6170692e676f6f676c65617069" . + "732e636f6d4286010a11636f6d2e676f6f676c652e69616d2e7631420e49" . + "616d506f6c69637950726f746f50015a30676f6f676c652e676f6c616e67" . + "2e6f72672f67656e70726f746f2f676f6f676c65617069732f69616d2f76" . + "313b69616df80101aa0213476f6f676c652e436c6f75642e49616d2e5631" . + "ca0213476f6f676c655c436c6f75645c49616d5c5631620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Iam/V1/Logging/AuditData.php b/vendor/google/common-protos/metadata/Iam/V1/Logging/AuditData.php new file mode 100644 index 00000000..eab32728 --- /dev/null +++ b/vendor/google/common-protos/metadata/Iam/V1/Logging/AuditData.php @@ -0,0 +1,36 @@ +internalAddGeneratedFile(hex2bin( + "0aae020a26676f6f676c652f69616d2f76312f6c6f6767696e672f617564" . + "69745f646174612e70726f746f1215676f6f676c652e69616d2e76312e6c" . + "6f6767696e671a1a676f6f676c652f69616d2f76312f706f6c6963792e70" . + "726f746f223d0a0941756469744461746112300a0c706f6c6963795f6465" . + "6c746118022001280b321a2e676f6f676c652e69616d2e76312e506f6c69" . + "637944656c74614289010a19636f6d2e676f6f676c652e69616d2e76312e" . + "6c6f6767696e67420e41756469744461746150726f746f50015a3c676f6f" . + "676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65" . + "617069732f69616d2f76312f6c6f6767696e673b6c6f6767696e67aa021b" . + "476f6f676c652e436c6f75642e49616d2e56312e4c6f6767696e67620670" . + "726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Iam/V1/Options.php b/vendor/google/common-protos/metadata/Iam/V1/Options.php new file mode 100644 index 00000000..64b470af --- /dev/null +++ b/vendor/google/common-protos/metadata/Iam/V1/Options.php @@ -0,0 +1,33 @@ +internalAddGeneratedFile(hex2bin( + "0af1010a1b676f6f676c652f69616d2f76312f6f7074696f6e732e70726f" . + "746f120d676f6f676c652e69616d2e763122340a10476574506f6c696379" . + "4f7074696f6e7312200a187265717565737465645f706f6c6963795f7665" . + "7273696f6e1801200128054284010a11636f6d2e676f6f676c652e69616d" . + "2e7631420c4f7074696f6e7350726f746f50015a30676f6f676c652e676f" . + "6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f69" . + "616d2f76313b69616df80101aa0213476f6f676c652e436c6f75642e4961" . + "6d2e5631ca0213476f6f676c655c436c6f75645c49616d5c563162067072" . + "6f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Iam/V1/Policy.php b/vendor/google/common-protos/metadata/Iam/V1/Policy.php new file mode 100644 index 00000000..12d12915 --- /dev/null +++ b/vendor/google/common-protos/metadata/Iam/V1/Policy.php @@ -0,0 +1,55 @@ +internalAddGeneratedFile(hex2bin( + "0afd060a1a676f6f676c652f69616d2f76312f706f6c6963792e70726f74" . + "6f120d676f6f676c652e69616d2e76311a1c676f6f676c652f6170692f61" . + "6e6e6f746174696f6e732e70726f746f22510a06506f6c696379120f0a07" . + "76657273696f6e18012001280512280a0862696e64696e67731804200328" . + "0b32162e676f6f676c652e69616d2e76312e42696e64696e67120c0a0465" . + "74616718032001280c224e0a0742696e64696e67120c0a04726f6c651801" . + "20012809120f0a076d656d6265727318022003280912240a09636f6e6469" . + "74696f6e18032001280b32112e676f6f676c652e747970652e4578707222" . + "80010a0b506f6c69637944656c746112330a0e62696e64696e675f64656c" . + "74617318012003280b321b2e676f6f676c652e69616d2e76312e42696e64" . + "696e6744656c7461123c0a1361756469745f636f6e6669675f64656c7461" . + "7318022003280b321f2e676f6f676c652e69616d2e76312e417564697443" . + "6f6e66696744656c746122bd010a0c42696e64696e6744656c746112320a" . + "06616374696f6e18012001280e32222e676f6f676c652e69616d2e76312e" . + "42696e64696e6744656c74612e416374696f6e120c0a04726f6c65180220" . + "012809120e0a066d656d62657218032001280912240a09636f6e64697469" . + "6f6e18042001280b32112e676f6f676c652e747970652e4578707222350a" . + "06416374696f6e12160a12414354494f4e5f554e53504543494649454410" . + "0012070a034144441001120a0a0652454d4f5645100222bd010a10417564" . + "6974436f6e66696744656c746112360a06616374696f6e18012001280e32" . + "262e676f6f676c652e69616d2e76312e4175646974436f6e66696744656c" . + "74612e416374696f6e120f0a077365727669636518022001280912170a0f" . + "6578656d707465645f6d656d62657218032001280912100a086c6f675f74" . + "79706518042001280922350a06416374696f6e12160a12414354494f4e5f" . + "554e535045434946494544100012070a034144441001120a0a0652454d4f" . + "564510024283010a11636f6d2e676f6f676c652e69616d2e7631420b506f" . + "6c69637950726f746f50015a30676f6f676c652e676f6c616e672e6f7267" . + "2f67656e70726f746f2f676f6f676c65617069732f69616d2f76313b6961" . + "6df80101aa0213476f6f676c652e436c6f75642e49616d2e5631ca021347" . + "6f6f676c655c436c6f75645c49616d5c5631620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Logging/Type/HttpRequest.php b/vendor/google/common-protos/metadata/Logging/Type/HttpRequest.php new file mode 100644 index 00000000..57d2b17b --- /dev/null +++ b/vendor/google/common-protos/metadata/Logging/Type/HttpRequest.php @@ -0,0 +1,47 @@ +internalAddGeneratedFile(hex2bin( + "0af9040a26676f6f676c652f6c6f6767696e672f747970652f687474705f" . + "726571756573742e70726f746f1213676f6f676c652e6c6f6767696e672e" . + "747970651a1e676f6f676c652f70726f746f6275662f6475726174696f6e" . + "2e70726f746f22ef020a0b487474705265717565737412160a0e72657175" . + "6573745f6d6574686f6418012001280912130a0b726571756573745f7572" . + "6c18022001280912140a0c726571756573745f73697a6518032001280312" . + "0e0a0673746174757318042001280512150a0d726573706f6e73655f7369" . + "7a6518052001280312120a0a757365725f6167656e741806200128091211" . + "0a0972656d6f74655f697018072001280912110a097365727665725f6970" . + "180d20012809120f0a0772656665726572180820012809122a0a076c6174" . + "656e6379180e2001280b32192e676f6f676c652e70726f746f6275662e44" . + "75726174696f6e12140a0c63616368655f6c6f6f6b7570180b2001280812" . + "110a0963616368655f686974180920012808122a0a2263616368655f7661" . + "6c6964617465645f776974685f6f726967696e5f736572766572180a2001" . + "280812180a1063616368655f66696c6c5f6279746573180c200128031210" . + "0a0870726f746f636f6c180f20012809429f010a17636f6d2e676f6f676c" . + "652e6c6f6767696e672e747970654210487474705265717565737450726f" . + "746f50015a38676f6f676c652e676f6c616e672e6f72672f67656e70726f" . + "746f2f676f6f676c65617069732f6c6f6767696e672f747970653b6c7479" . + "7065aa0219476f6f676c652e436c6f75642e4c6f6767696e672e54797065" . + "ca0219476f6f676c655c436c6f75645c4c6f6767696e675c547970656206" . + "70726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Logging/Type/LogSeverity.php b/vendor/google/common-protos/metadata/Logging/Type/LogSeverity.php new file mode 100644 index 00000000..7a860cc1 --- /dev/null +++ b/vendor/google/common-protos/metadata/Logging/Type/LogSeverity.php @@ -0,0 +1,37 @@ +internalAddGeneratedFile(hex2bin( + "0aec020a26676f6f676c652f6c6f6767696e672f747970652f6c6f675f73" . + "657665726974792e70726f746f1213676f6f676c652e6c6f6767696e672e" . + "747970652a82010a0b4c6f675365766572697479120b0a0744454641554c" . + "54100012090a054445425547106412090a04494e464f10c801120b0a064e" . + "4f5449434510ac02120c0a075741524e494e47109003120a0a054552524f" . + "5210f403120d0a08435249544943414c10d804120a0a05414c45525410bc" . + "05120e0a09454d455247454e435910a006429f010a17636f6d2e676f6f67" . + "6c652e6c6f6767696e672e7479706542104c6f6753657665726974795072" . + "6f746f50015a38676f6f676c652e676f6c616e672e6f72672f67656e7072" . + "6f746f2f676f6f676c65617069732f6c6f6767696e672f747970653b6c74" . + "797065aa0219476f6f676c652e436c6f75642e4c6f6767696e672e547970" . + "65ca0219476f6f676c655c436c6f75645c4c6f6767696e675c5479706562" . + "0670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Longrunning/Operations.php b/vendor/google/common-protos/metadata/Longrunning/Operations.php new file mode 100644 index 00000000..3332a185 --- /dev/null +++ b/vendor/google/common-protos/metadata/Longrunning/Operations.php @@ -0,0 +1,74 @@ +internalAddGeneratedFile(hex2bin( + "0afd0a0a23676f6f676c652f6c6f6e6772756e6e696e672f6f7065726174" . + "696f6e732e70726f746f1212676f6f676c652e6c6f6e6772756e6e696e67" . + "1a19676f6f676c652f70726f746f6275662f616e792e70726f746f1a2067" . + "6f6f676c652f70726f746f6275662f64657363726970746f722e70726f74" . + "6f1a1b676f6f676c652f70726f746f6275662f656d7074792e70726f746f" . + "1a17676f6f676c652f7270632f7374617475732e70726f746f22a8010a09" . + "4f7065726174696f6e120c0a046e616d6518012001280912260a086d6574" . + "616461746118022001280b32142e676f6f676c652e70726f746f6275662e" . + "416e79120c0a04646f6e6518032001280812230a056572726f7218042001" . + "280b32122e676f6f676c652e7270632e537461747573480012280a087265" . + "73706f6e736518052001280b32142e676f6f676c652e70726f746f627566" . + "2e416e79480042080a06726573756c7422230a134765744f706572617469" . + "6f6e52657175657374120c0a046e616d65180120012809225c0a154c6973" . + "744f7065726174696f6e7352657175657374120c0a046e616d6518042001" . + "2809120e0a0666696c74657218012001280912110a09706167655f73697a" . + "6518022001280512120a0a706167655f746f6b656e18032001280922640a" . + "164c6973744f7065726174696f6e73526573706f6e736512310a0a6f7065" . + "726174696f6e7318012003280b321d2e676f6f676c652e6c6f6e6772756e" . + "6e696e672e4f7065726174696f6e12170a0f6e6578745f706167655f746f" . + "6b656e18022001280922260a1643616e63656c4f7065726174696f6e5265" . + "7175657374120c0a046e616d6518012001280922260a1644656c6574654f" . + "7065726174696f6e52657175657374120c0a046e616d6518012001280922" . + "3d0a0d4f7065726174696f6e496e666f12150a0d726573706f6e73655f74" . + "79706518012001280912150a0d6d657461646174615f7479706518022001" . + "2809328c040a0a4f7065726174696f6e731286010a0e4c6973744f706572" . + "6174696f6e7312292e676f6f676c652e6c6f6e6772756e6e696e672e4c69" . + "73744f7065726174696f6e73526571756573741a2a2e676f6f676c652e6c" . + "6f6e6772756e6e696e672e4c6973744f7065726174696f6e73526573706f" . + "6e7365221d82d3e493021712152f76312f7b6e616d653d6f706572617469" . + "6f6e737d12780a0c4765744f7065726174696f6e12272e676f6f676c652e" . + "6c6f6e6772756e6e696e672e4765744f7065726174696f6e526571756573" . + "741a1d2e676f6f676c652e6c6f6e6772756e6e696e672e4f706572617469" . + "6f6e222082d3e493021a12182f76312f7b6e616d653d6f7065726174696f" . + "6e732f2a2a7d12770a0f44656c6574654f7065726174696f6e122a2e676f" . + "6f676c652e6c6f6e6772756e6e696e672e44656c6574654f706572617469" . + "6f6e526571756573741a162e676f6f676c652e70726f746f6275662e456d" . + "707479222082d3e493021a2a182f76312f7b6e616d653d6f706572617469" . + "6f6e732f2a2a7d1281010a0f43616e63656c4f7065726174696f6e122a2e" . + "676f6f676c652e6c6f6e6772756e6e696e672e43616e63656c4f70657261" . + "74696f6e526571756573741a162e676f6f676c652e70726f746f6275662e" . + "456d707479222a82d3e4930224221f2f76312f7b6e616d653d6f70657261" . + "74696f6e732f2a2a7d3a63616e63656c3a012a4294010a16636f6d2e676f" . + "6f676c652e6c6f6e6772756e6e696e67420f4f7065726174696f6e735072" . + "6f746f50015a3d676f6f676c652e676f6c616e672e6f72672f67656e7072" . + "6f746f2f676f6f676c65617069732f6c6f6e6772756e6e696e673b6c6f6e" . + "6772756e6e696e67aa0212476f6f676c652e4c6f6e6752756e6e696e67ca" . + "0212476f6f676c655c4c6f6e6752756e6e696e67620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Rpc/Code.php b/vendor/google/common-protos/metadata/Rpc/Code.php new file mode 100644 index 00000000..2a57a20c Binary files /dev/null and b/vendor/google/common-protos/metadata/Rpc/Code.php differ diff --git a/vendor/google/common-protos/metadata/Rpc/ErrorDetails.php b/vendor/google/common-protos/metadata/Rpc/ErrorDetails.php new file mode 100644 index 00000000..b9053d01 --- /dev/null +++ b/vendor/google/common-protos/metadata/Rpc/ErrorDetails.php @@ -0,0 +1,77 @@ +internalAddGeneratedFile( + ' + +google/rpc/error_details.proto +google.rpc"; + RetryInfo. + retry_delay ( 2.google.protobuf.Duration"2 + DebugInfo + stack_entries (  +detail ( "y + QuotaFailure6 + +violations ( 2".google.rpc.QuotaFailure.Violation1 + Violation +subject (  + description ( " + ErrorInfo +reason (  +domain ( 5 +metadata ( 2#.google.rpc.ErrorInfo.MetadataEntry/ + MetadataEntry +key (  +value ( :8" +PreconditionFailure= + +violations ( 2).google.rpc.PreconditionFailure.Violation? + Violation +type (  +subject (  + description ( " + +BadRequest? +field_violations ( 2%.google.rpc.BadRequest.FieldViolation4 +FieldViolation +field (  + description ( "7 + RequestInfo + +request_id (  + serving_data ( "` + ResourceInfo + resource_type (  + resource_name (  +owner (  + description ( "V +Help$ +links ( 2.google.rpc.Help.Link( +Link + description (  +url ( "3 +LocalizedMessage +locale (  +message ( Bl +com.google.rpcBErrorDetailsProtoPZ?google.golang.org/genproto/googleapis/rpc/errdetails;errdetailsRPCbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Rpc/Status.php b/vendor/google/common-protos/metadata/Rpc/Status.php new file mode 100644 index 00000000..8560f427 --- /dev/null +++ b/vendor/google/common-protos/metadata/Rpc/Status.php @@ -0,0 +1,33 @@ +internalAddGeneratedFile( + ' + +google/rpc/status.proto +google.rpc"N +Status +code ( +message ( % +details ( 2.google.protobuf.AnyBa +com.google.rpcB StatusProtoPZ7google.golang.org/genproto/googleapis/rpc/status;statusRPCbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/CalendarPeriod.php b/vendor/google/common-protos/metadata/Type/CalendarPeriod.php new file mode 100644 index 00000000..7924e857 --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/CalendarPeriod.php @@ -0,0 +1,34 @@ +internalAddGeneratedFile(hex2bin( + "0ab3020a21676f6f676c652f747970652f63616c656e6461725f70657269" . + "6f642e70726f746f120b676f6f676c652e747970652a7f0a0e43616c656e" . + "646172506572696f64121f0a1b43414c454e4441525f504552494f445f55" . + "4e535045434946494544100012070a03444159100112080a045745454b10" . + "02120d0a09464f52544e49474854100312090a054d4f4e54481004120b0a" . + "0751554152544552100512080a0448414c46100612080a04594541521007" . + "42780a0f636f6d2e676f6f676c652e74797065421343616c656e64617250" . + "6572696f6450726f746f50015a48676f6f676c652e676f6c616e672e6f72" . + "672f67656e70726f746f2f676f6f676c65617069732f747970652f63616c" . + "656e646172706572696f643b63616c656e646172706572696f64a2020347" . + "5450620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/Color.php b/vendor/google/common-protos/metadata/Type/Color.php new file mode 100644 index 00000000..7079aaa9 --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/Color.php @@ -0,0 +1,33 @@ +internalAddGeneratedFile(hex2bin( + "0aef010a17676f6f676c652f747970652f636f6c6f722e70726f746f120b" . + "676f6f676c652e74797065225d0a05436f6c6f72120b0a03726564180120" . + "012802120d0a05677265656e180220012802120c0a04626c756518032001" . + "2802122a0a05616c70686118042001280b321b2e676f6f676c652e70726f" . + "746f6275662e466c6f617456616c756542600a0f636f6d2e676f6f676c65" . + "2e74797065420a436f6c6f7250726f746f50015a36676f6f676c652e676f" . + "6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f74" . + "7970652f636f6c6f723b636f6c6f72f80101a20203475450620670726f74" . + "6f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/Date.php b/vendor/google/common-protos/metadata/Type/Date.php new file mode 100644 index 00000000..2b762cf3 --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/Date.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile(hex2bin( + "0abe010a16676f6f676c652f747970652f646174652e70726f746f120b67" . + "6f6f676c652e7479706522300a0444617465120c0a047965617218012001" . + "2805120d0a056d6f6e7468180220012805120b0a03646179180320012805" . + "425d0a0f636f6d2e676f6f676c652e7479706542094461746550726f746f" . + "50015a34676f6f676c652e676f6c616e672e6f72672f67656e70726f746f" . + "2f676f6f676c65617069732f747970652f646174653b64617465f80101a2" . + "0203475450620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/Datetime.php b/vendor/google/common-protos/metadata/Type/Datetime.php new file mode 100644 index 00000000..e095c857 --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/Datetime.php @@ -0,0 +1,39 @@ +internalAddGeneratedFile(hex2bin( + "0aa8030a1a676f6f676c652f747970652f6461746574696d652e70726f74" . + "6f120b676f6f676c652e7479706522e0010a084461746554696d65120c0a" . + "0479656172180120012805120d0a056d6f6e7468180220012805120b0a03" . + "646179180320012805120d0a05686f757273180420012805120f0a076d69" . + "6e75746573180520012805120f0a077365636f6e6473180620012805120d" . + "0a056e616e6f73180720012805122f0a0a7574635f6f6666736574180820" . + "01280b32192e676f6f676c652e70726f746f6275662e4475726174696f6e" . + "4800122a0a0974696d655f7a6f6e6518092001280b32152e676f6f676c65" . + "2e747970652e54696d655a6f6e654800420d0a0b74696d655f6f66667365" . + "7422270a0854696d655a6f6e65120a0a026964180120012809120f0a0776" . + "657273696f6e18022001280942690a0f636f6d2e676f6f676c652e747970" . + "65420d4461746554696d6550726f746f50015a3c676f6f676c652e676f6c" . + "616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f7479" . + "70652f6461746574696d653b6461746574696d65f80101a2020347545062" . + "0670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/Dayofweek.php b/vendor/google/common-protos/metadata/Type/Dayofweek.php new file mode 100644 index 00000000..b6a253b9 --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/Dayofweek.php @@ -0,0 +1,33 @@ +internalAddGeneratedFile(hex2bin( + "0aa4020a1b676f6f676c652f747970652f6461796f667765656b2e70726f" . + "746f120b676f6f676c652e747970652a84010a094461794f665765656b12" . + "1b0a174441595f4f465f5745454b5f554e5350454349464945441000120a" . + "0a064d4f4e4441591001120b0a07545545534441591002120d0a09574544" . + "4e45534441591003120c0a0854485552534441591004120a0a0646524944" . + "41591005120c0a0853415455524441591006120a0a0653554e4441591007" . + "42690a0f636f6d2e676f6f676c652e74797065420e4461794f665765656b" . + "50726f746f50015a3e676f6f676c652e676f6c616e672e6f72672f67656e" . + "70726f746f2f676f6f676c65617069732f747970652f6461796f66776565" . + "6b3b6461796f667765656ba20203475450620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/Expr.php b/vendor/google/common-protos/metadata/Type/Expr.php new file mode 100644 index 00000000..30689cac --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/Expr.php @@ -0,0 +1,31 @@ +internalAddGeneratedFile(hex2bin( + "0adb010a16676f6f676c652f747970652f657870722e70726f746f120b67" . + "6f6f676c652e7479706522500a044578707212120a0a6578707265737369" . + "6f6e180120012809120d0a057469746c6518022001280912130a0b646573" . + "6372697074696f6e18032001280912100a086c6f636174696f6e18042001" . + "2809425a0a0f636f6d2e676f6f676c652e7479706542094578707250726f" . + "746f50015a34676f6f676c652e676f6c616e672e6f72672f67656e70726f" . + "746f2f676f6f676c65617069732f747970652f657870723b65787072a202" . + "03475450620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/Fraction.php b/vendor/google/common-protos/metadata/Type/Fraction.php new file mode 100644 index 00000000..70115c13 --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/Fraction.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile(hex2bin( + "0acd010a1a676f6f676c652f747970652f6672616374696f6e2e70726f74" . + "6f120b676f6f676c652e7479706522320a084672616374696f6e12110a09" . + "6e756d657261746f7218012001280312130a0b64656e6f6d696e61746f72" . + "18022001280342660a0f636f6d2e676f6f676c652e74797065420d467261" . + "6374696f6e50726f746f50015a3c676f6f676c652e676f6c616e672e6f72" . + "672f67656e70726f746f2f676f6f676c65617069732f747970652f667261" . + "6374696f6e3b6672616374696f6ea20203475450620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/Latlng.php b/vendor/google/common-protos/metadata/Type/Latlng.php new file mode 100644 index 00000000..903c898a --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/Latlng.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile(hex2bin( + "0ac3010a18676f6f676c652f747970652f6c61746c6e672e70726f746f12" . + "0b676f6f676c652e74797065222d0a064c61744c6e6712100a086c617469" . + "7475646518012001280112110a096c6f6e67697475646518022001280142" . + "630a0f636f6d2e676f6f676c652e74797065420b4c61744c6e6750726f74" . + "6f50015a38676f6f676c652e676f6c616e672e6f72672f67656e70726f74" . + "6f2f676f6f676c65617069732f747970652f6c61746c6e673b6c61746c6e" . + "67f80101a20203475450620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/Money.php b/vendor/google/common-protos/metadata/Type/Money.php new file mode 100644 index 00000000..18f6eb68 --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/Money.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile(hex2bin( + "0ace010a17676f6f676c652f747970652f6d6f6e65792e70726f746f120b" . + "676f6f676c652e74797065223c0a054d6f6e657912150a0d63757272656e" . + "63795f636f6465180120012809120d0a05756e697473180220012803120d" . + "0a056e616e6f7318032001280542600a0f636f6d2e676f6f676c652e7479" . + "7065420a4d6f6e657950726f746f50015a36676f6f676c652e676f6c616e" . + "672e6f72672f67656e70726f746f2f676f6f676c65617069732f74797065" . + "2f6d6f6e65793b6d6f6e6579f80101a20203475450620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/Month.php b/vendor/google/common-protos/metadata/Type/Month.php new file mode 100644 index 00000000..2b62528e --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/Month.php @@ -0,0 +1,34 @@ +internalAddGeneratedFile(hex2bin( + "0ac0020a17676f6f676c652f747970652f6d6f6e74682e70726f746f120b" . + "676f6f676c652e747970652ab0010a054d6f6e746812150a114d4f4e5448" . + "5f554e5350454349464945441000120b0a074a414e554152591001120c0a" . + "084645425255415259100212090a054d41524348100312090a0541505249" . + "4c100412070a034d4159100512080a044a554e45100612080a044a554c59" . + "1007120a0a064155475553541008120d0a0953455054454d424552100912" . + "0b0a074f43544f424552100a120c0a084e4f56454d424552100b120c0a08" . + "444543454d424552100c425d0a0f636f6d2e676f6f676c652e7479706542" . + "0a4d6f6e746850726f746f50015a36676f6f676c652e676f6c616e672e6f" . + "72672f67656e70726f746f2f676f6f676c65617069732f747970652f6d6f" . + "6e74683b6d6f6e7468a20203475450620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/PostalAddress.php b/vendor/google/common-protos/metadata/Type/PostalAddress.php new file mode 100644 index 00000000..bf37030c --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/PostalAddress.php @@ -0,0 +1,38 @@ +internalAddGeneratedFile(hex2bin( + "0ab1030a20676f6f676c652f747970652f706f7374616c5f616464726573" . + "732e70726f746f120b676f6f676c652e7479706522fd010a0d506f737461" . + "6c4164647265737312100a087265766973696f6e18012001280512130a0b" . + "726567696f6e5f636f646518022001280912150a0d6c616e67756167655f" . + "636f646518032001280912130a0b706f7374616c5f636f64651804200128" . + "0912140a0c736f7274696e675f636f6465180520012809121b0a1361646d" . + "696e6973747261746976655f6172656118062001280912100a086c6f6361" . + "6c69747918072001280912130a0b7375626c6f63616c6974791808200128" . + "0912150a0d616464726573735f6c696e657318092003280912120a0a7265" . + "63697069656e7473180a2003280912140a0c6f7267616e697a6174696f6e" . + "180b2001280942780a0f636f6d2e676f6f676c652e747970654212506f73" . + "74616c4164647265737350726f746f50015a46676f6f676c652e676f6c61" . + "6e672e6f72672f67656e70726f746f2f676f6f676c65617069732f747970" . + "652f706f7374616c616464726573733b706f7374616c61646472657373f8" . + "0101a20203475450620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/Quaternion.php b/vendor/google/common-protos/metadata/Type/Quaternion.php new file mode 100644 index 00000000..ff8b5fa9 --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/Quaternion.php @@ -0,0 +1,31 @@ +internalAddGeneratedFile(hex2bin( + "0ade010a1c676f6f676c652f747970652f7175617465726e696f6e2e7072" . + "6f746f120b676f6f676c652e7479706522380a0a5175617465726e696f6e" . + "12090a017818012001280112090a017918022001280112090a017a180320" . + "01280112090a0177180420012801426f0a0f636f6d2e676f6f676c652e74" . + "797065420f5175617465726e696f6e50726f746f50015a40676f6f676c65" . + "2e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069" . + "732f747970652f7175617465726e696f6e3b7175617465726e696f6ef801" . + "01a20203475450620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/metadata/Type/Timeofday.php b/vendor/google/common-protos/metadata/Type/Timeofday.php new file mode 100644 index 00000000..e74d2454 --- /dev/null +++ b/vendor/google/common-protos/metadata/Type/Timeofday.php @@ -0,0 +1,31 @@ +internalAddGeneratedFile(hex2bin( + "0aed010a1b676f6f676c652f747970652f74696d656f666461792e70726f" . + "746f120b676f6f676c652e74797065224b0a0954696d654f66446179120d" . + "0a05686f757273180120012805120f0a076d696e75746573180220012805" . + "120f0a077365636f6e6473180320012805120d0a056e616e6f7318042001" . + "2805426c0a0f636f6d2e676f6f676c652e74797065420e54696d654f6644" . + "617950726f746f50015a3e676f6f676c652e676f6c616e672e6f72672f67" . + "656e70726f746f2f676f6f676c65617069732f747970652f74696d656f66" . + "6461793b74696d656f66646179f80101a20203475450620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/common-protos/renovate.json b/vendor/google/common-protos/renovate.json new file mode 100644 index 00000000..f45d8f11 --- /dev/null +++ b/vendor/google/common-protos/renovate.json @@ -0,0 +1,5 @@ +{ + "extends": [ + "config:base" + ] +} diff --git a/vendor/google/common-protos/src/Api/Advice.php b/vendor/google/common-protos/src/Api/Advice.php new file mode 100644 index 00000000..9fa8468e --- /dev/null +++ b/vendor/google/common-protos/src/Api/Advice.php @@ -0,0 +1,72 @@ +google.api.Advice + */ +class Advice extends \Google\Protobuf\Internal\Message +{ + /** + * Useful description for why this advice was applied and what actions should + * be taken to mitigate any implied risks. + * + * Generated from protobuf field string description = 2; + */ + private $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $description + * Useful description for why this advice was applied and what actions should + * be taken to mitigate any implied risks. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\ConfigChange::initOnce(); + parent::__construct($data); + } + + /** + * Useful description for why this advice was applied and what actions should + * be taken to mitigate any implied risks. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Useful description for why this advice was applied and what actions should + * be taken to mitigate any implied risks. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/AuthProvider.php b/vendor/google/common-protos/src/Api/AuthProvider.php new file mode 100644 index 00000000..7f22ac79 --- /dev/null +++ b/vendor/google/common-protos/src/Api/AuthProvider.php @@ -0,0 +1,300 @@ +google.api.AuthProvider + */ +class AuthProvider extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the auth provider. It will be referred to by + * `AuthRequirement.provider_id`. + * Example: "bookstore_auth". + * + * Generated from protobuf field string id = 1; + */ + private $id = ''; + /** + * Identifies the principal that issued the JWT. See + * https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 + * Usually a URL or an email address. + * Example: https://securetoken.google.com + * Example: 1234567-compute@developer.gserviceaccount.com + * + * Generated from protobuf field string issuer = 2; + */ + private $issuer = ''; + /** + * URL of the provider's public key set to validate signature of the JWT. See + * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). + * Optional if the key set document: + * - can be retrieved from + * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html + * of the issuer. + * - can be inferred from the email domain of the issuer (e.g. a Google service account). + * Example: https://www.googleapis.com/oauth2/v1/certs + * + * Generated from protobuf field string jwks_uri = 3; + */ + private $jwks_uri = ''; + /** + * The list of JWT + * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). + * that are allowed to access. A JWT containing any of these audiences will + * be accepted. When this setting is absent, only JWTs with audience + * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" + * will be accepted. For example, if no audiences are in the setting, + * LibraryService API will only accept JWTs with the following audience + * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". + * Example: + * audiences: bookstore_android.apps.googleusercontent.com, + * bookstore_web.apps.googleusercontent.com + * + * Generated from protobuf field string audiences = 4; + */ + private $audiences = ''; + /** + * Redirect URL if JWT token is required but no present or is expired. + * Implement authorizationUrl of securityDefinitions in OpenAPI spec. + * + * Generated from protobuf field string authorization_url = 5; + */ + private $authorization_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * The unique identifier of the auth provider. It will be referred to by + * `AuthRequirement.provider_id`. + * Example: "bookstore_auth". + * @type string $issuer + * Identifies the principal that issued the JWT. See + * https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 + * Usually a URL or an email address. + * Example: https://securetoken.google.com + * Example: 1234567-compute@developer.gserviceaccount.com + * @type string $jwks_uri + * URL of the provider's public key set to validate signature of the JWT. See + * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). + * Optional if the key set document: + * - can be retrieved from + * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html + * of the issuer. + * - can be inferred from the email domain of the issuer (e.g. a Google service account). + * Example: https://www.googleapis.com/oauth2/v1/certs + * @type string $audiences + * The list of JWT + * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). + * that are allowed to access. A JWT containing any of these audiences will + * be accepted. When this setting is absent, only JWTs with audience + * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" + * will be accepted. For example, if no audiences are in the setting, + * LibraryService API will only accept JWTs with the following audience + * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". + * Example: + * audiences: bookstore_android.apps.googleusercontent.com, + * bookstore_web.apps.googleusercontent.com + * @type string $authorization_url + * Redirect URL if JWT token is required but no present or is expired. + * Implement authorizationUrl of securityDefinitions in OpenAPI spec. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Auth::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the auth provider. It will be referred to by + * `AuthRequirement.provider_id`. + * Example: "bookstore_auth". + * + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * The unique identifier of the auth provider. It will be referred to by + * `AuthRequirement.provider_id`. + * Example: "bookstore_auth". + * + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Identifies the principal that issued the JWT. See + * https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 + * Usually a URL or an email address. + * Example: https://securetoken.google.com + * Example: 1234567-compute@developer.gserviceaccount.com + * + * Generated from protobuf field string issuer = 2; + * @return string + */ + public function getIssuer() + { + return $this->issuer; + } + + /** + * Identifies the principal that issued the JWT. See + * https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 + * Usually a URL or an email address. + * Example: https://securetoken.google.com + * Example: 1234567-compute@developer.gserviceaccount.com + * + * Generated from protobuf field string issuer = 2; + * @param string $var + * @return $this + */ + public function setIssuer($var) + { + GPBUtil::checkString($var, True); + $this->issuer = $var; + + return $this; + } + + /** + * URL of the provider's public key set to validate signature of the JWT. See + * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). + * Optional if the key set document: + * - can be retrieved from + * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html + * of the issuer. + * - can be inferred from the email domain of the issuer (e.g. a Google service account). + * Example: https://www.googleapis.com/oauth2/v1/certs + * + * Generated from protobuf field string jwks_uri = 3; + * @return string + */ + public function getJwksUri() + { + return $this->jwks_uri; + } + + /** + * URL of the provider's public key set to validate signature of the JWT. See + * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). + * Optional if the key set document: + * - can be retrieved from + * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html + * of the issuer. + * - can be inferred from the email domain of the issuer (e.g. a Google service account). + * Example: https://www.googleapis.com/oauth2/v1/certs + * + * Generated from protobuf field string jwks_uri = 3; + * @param string $var + * @return $this + */ + public function setJwksUri($var) + { + GPBUtil::checkString($var, True); + $this->jwks_uri = $var; + + return $this; + } + + /** + * The list of JWT + * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). + * that are allowed to access. A JWT containing any of these audiences will + * be accepted. When this setting is absent, only JWTs with audience + * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" + * will be accepted. For example, if no audiences are in the setting, + * LibraryService API will only accept JWTs with the following audience + * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". + * Example: + * audiences: bookstore_android.apps.googleusercontent.com, + * bookstore_web.apps.googleusercontent.com + * + * Generated from protobuf field string audiences = 4; + * @return string + */ + public function getAudiences() + { + return $this->audiences; + } + + /** + * The list of JWT + * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). + * that are allowed to access. A JWT containing any of these audiences will + * be accepted. When this setting is absent, only JWTs with audience + * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" + * will be accepted. For example, if no audiences are in the setting, + * LibraryService API will only accept JWTs with the following audience + * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". + * Example: + * audiences: bookstore_android.apps.googleusercontent.com, + * bookstore_web.apps.googleusercontent.com + * + * Generated from protobuf field string audiences = 4; + * @param string $var + * @return $this + */ + public function setAudiences($var) + { + GPBUtil::checkString($var, True); + $this->audiences = $var; + + return $this; + } + + /** + * Redirect URL if JWT token is required but no present or is expired. + * Implement authorizationUrl of securityDefinitions in OpenAPI spec. + * + * Generated from protobuf field string authorization_url = 5; + * @return string + */ + public function getAuthorizationUrl() + { + return $this->authorization_url; + } + + /** + * Redirect URL if JWT token is required but no present or is expired. + * Implement authorizationUrl of securityDefinitions in OpenAPI spec. + * + * Generated from protobuf field string authorization_url = 5; + * @param string $var + * @return $this + */ + public function setAuthorizationUrl($var) + { + GPBUtil::checkString($var, True); + $this->authorization_url = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/AuthRequirement.php b/vendor/google/common-protos/src/Api/AuthRequirement.php new file mode 100644 index 00000000..5f52263c --- /dev/null +++ b/vendor/google/common-protos/src/Api/AuthRequirement.php @@ -0,0 +1,158 @@ +google.api.AuthRequirement + */ +class AuthRequirement extends \Google\Protobuf\Internal\Message +{ + /** + * [id][google.api.AuthProvider.id] from authentication provider. + * Example: + * provider_id: bookstore_auth + * + * Generated from protobuf field string provider_id = 1; + */ + private $provider_id = ''; + /** + * NOTE: This will be deprecated soon, once AuthProvider.audiences is + * implemented and accepted in all the runtime components. + * The list of JWT + * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). + * that are allowed to access. A JWT containing any of these audiences will + * be accepted. When this setting is absent, only JWTs with audience + * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" + * will be accepted. For example, if no audiences are in the setting, + * LibraryService API will only accept JWTs with the following audience + * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". + * Example: + * audiences: bookstore_android.apps.googleusercontent.com, + * bookstore_web.apps.googleusercontent.com + * + * Generated from protobuf field string audiences = 2; + */ + private $audiences = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $provider_id + * [id][google.api.AuthProvider.id] from authentication provider. + * Example: + * provider_id: bookstore_auth + * @type string $audiences + * NOTE: This will be deprecated soon, once AuthProvider.audiences is + * implemented and accepted in all the runtime components. + * The list of JWT + * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). + * that are allowed to access. A JWT containing any of these audiences will + * be accepted. When this setting is absent, only JWTs with audience + * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" + * will be accepted. For example, if no audiences are in the setting, + * LibraryService API will only accept JWTs with the following audience + * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". + * Example: + * audiences: bookstore_android.apps.googleusercontent.com, + * bookstore_web.apps.googleusercontent.com + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Auth::initOnce(); + parent::__construct($data); + } + + /** + * [id][google.api.AuthProvider.id] from authentication provider. + * Example: + * provider_id: bookstore_auth + * + * Generated from protobuf field string provider_id = 1; + * @return string + */ + public function getProviderId() + { + return $this->provider_id; + } + + /** + * [id][google.api.AuthProvider.id] from authentication provider. + * Example: + * provider_id: bookstore_auth + * + * Generated from protobuf field string provider_id = 1; + * @param string $var + * @return $this + */ + public function setProviderId($var) + { + GPBUtil::checkString($var, True); + $this->provider_id = $var; + + return $this; + } + + /** + * NOTE: This will be deprecated soon, once AuthProvider.audiences is + * implemented and accepted in all the runtime components. + * The list of JWT + * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). + * that are allowed to access. A JWT containing any of these audiences will + * be accepted. When this setting is absent, only JWTs with audience + * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" + * will be accepted. For example, if no audiences are in the setting, + * LibraryService API will only accept JWTs with the following audience + * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". + * Example: + * audiences: bookstore_android.apps.googleusercontent.com, + * bookstore_web.apps.googleusercontent.com + * + * Generated from protobuf field string audiences = 2; + * @return string + */ + public function getAudiences() + { + return $this->audiences; + } + + /** + * NOTE: This will be deprecated soon, once AuthProvider.audiences is + * implemented and accepted in all the runtime components. + * The list of JWT + * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). + * that are allowed to access. A JWT containing any of these audiences will + * be accepted. When this setting is absent, only JWTs with audience + * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" + * will be accepted. For example, if no audiences are in the setting, + * LibraryService API will only accept JWTs with the following audience + * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". + * Example: + * audiences: bookstore_android.apps.googleusercontent.com, + * bookstore_web.apps.googleusercontent.com + * + * Generated from protobuf field string audiences = 2; + * @param string $var + * @return $this + */ + public function setAudiences($var) + { + GPBUtil::checkString($var, True); + $this->audiences = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Authentication.php b/vendor/google/common-protos/src/Api/Authentication.php new file mode 100644 index 00000000..a89e4e2b --- /dev/null +++ b/vendor/google/common-protos/src/Api/Authentication.php @@ -0,0 +1,116 @@ +google.api.Authentication + */ +class Authentication extends \Google\Protobuf\Internal\Message +{ + /** + * A list of authentication rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.AuthenticationRule rules = 3; + */ + private $rules; + /** + * Defines a set of authentication providers that a service supports. + * + * Generated from protobuf field repeated .google.api.AuthProvider providers = 4; + */ + private $providers; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\AuthenticationRule[]|\Google\Protobuf\Internal\RepeatedField $rules + * A list of authentication rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * @type \Google\Api\AuthProvider[]|\Google\Protobuf\Internal\RepeatedField $providers + * Defines a set of authentication providers that a service supports. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Auth::initOnce(); + parent::__construct($data); + } + + /** + * A list of authentication rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.AuthenticationRule rules = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * A list of authentication rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.AuthenticationRule rules = 3; + * @param \Google\Api\AuthenticationRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\AuthenticationRule::class); + $this->rules = $arr; + + return $this; + } + + /** + * Defines a set of authentication providers that a service supports. + * + * Generated from protobuf field repeated .google.api.AuthProvider providers = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProviders() + { + return $this->providers; + } + + /** + * Defines a set of authentication providers that a service supports. + * + * Generated from protobuf field repeated .google.api.AuthProvider providers = 4; + * @param \Google\Api\AuthProvider[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProviders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\AuthProvider::class); + $this->providers = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/AuthenticationRule.php b/vendor/google/common-protos/src/Api/AuthenticationRule.php new file mode 100644 index 00000000..03e8dd2a --- /dev/null +++ b/vendor/google/common-protos/src/Api/AuthenticationRule.php @@ -0,0 +1,179 @@ +google.api.AuthenticationRule + */ +class AuthenticationRule extends \Google\Protobuf\Internal\Message +{ + /** + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + */ + private $selector = ''; + /** + * The requirements for OAuth credentials. + * + * Generated from protobuf field .google.api.OAuthRequirements oauth = 2; + */ + private $oauth = null; + /** + * If true, the service accepts API keys without any other credential. + * + * Generated from protobuf field bool allow_without_credential = 5; + */ + private $allow_without_credential = false; + /** + * Requirements for additional authentication providers. + * + * Generated from protobuf field repeated .google.api.AuthRequirement requirements = 7; + */ + private $requirements; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $selector + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * @type \Google\Api\OAuthRequirements $oauth + * The requirements for OAuth credentials. + * @type bool $allow_without_credential + * If true, the service accepts API keys without any other credential. + * @type \Google\Api\AuthRequirement[]|\Google\Protobuf\Internal\RepeatedField $requirements + * Requirements for additional authentication providers. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Auth::initOnce(); + parent::__construct($data); + } + + /** + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @return string + */ + public function getSelector() + { + return $this->selector; + } + + /** + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @param string $var + * @return $this + */ + public function setSelector($var) + { + GPBUtil::checkString($var, True); + $this->selector = $var; + + return $this; + } + + /** + * The requirements for OAuth credentials. + * + * Generated from protobuf field .google.api.OAuthRequirements oauth = 2; + * @return \Google\Api\OAuthRequirements + */ + public function getOauth() + { + return $this->oauth; + } + + /** + * The requirements for OAuth credentials. + * + * Generated from protobuf field .google.api.OAuthRequirements oauth = 2; + * @param \Google\Api\OAuthRequirements $var + * @return $this + */ + public function setOauth($var) + { + GPBUtil::checkMessage($var, \Google\Api\OAuthRequirements::class); + $this->oauth = $var; + + return $this; + } + + /** + * If true, the service accepts API keys without any other credential. + * + * Generated from protobuf field bool allow_without_credential = 5; + * @return bool + */ + public function getAllowWithoutCredential() + { + return $this->allow_without_credential; + } + + /** + * If true, the service accepts API keys without any other credential. + * + * Generated from protobuf field bool allow_without_credential = 5; + * @param bool $var + * @return $this + */ + public function setAllowWithoutCredential($var) + { + GPBUtil::checkBool($var); + $this->allow_without_credential = $var; + + return $this; + } + + /** + * Requirements for additional authentication providers. + * + * Generated from protobuf field repeated .google.api.AuthRequirement requirements = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequirements() + { + return $this->requirements; + } + + /** + * Requirements for additional authentication providers. + * + * Generated from protobuf field repeated .google.api.AuthRequirement requirements = 7; + * @param \Google\Api\AuthRequirement[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequirements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\AuthRequirement::class); + $this->requirements = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Backend.php b/vendor/google/common-protos/src/Api/Backend.php new file mode 100644 index 00000000..62443333 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Backend.php @@ -0,0 +1,71 @@ +google.api.Backend + */ +class Backend extends \Google\Protobuf\Internal\Message +{ + /** + * A list of API backend rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.BackendRule rules = 1; + */ + private $rules; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\BackendRule[]|\Google\Protobuf\Internal\RepeatedField $rules + * A list of API backend rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Backend::initOnce(); + parent::__construct($data); + } + + /** + * A list of API backend rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.BackendRule rules = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * A list of API backend rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.BackendRule rules = 1; + * @param \Google\Api\BackendRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\BackendRule::class); + $this->rules = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/BackendRule.php b/vendor/google/common-protos/src/Api/BackendRule.php new file mode 100644 index 00000000..48c290f3 --- /dev/null +++ b/vendor/google/common-protos/src/Api/BackendRule.php @@ -0,0 +1,335 @@ +google.api.BackendRule + */ +class BackendRule extends \Google\Protobuf\Internal\Message +{ + /** + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + */ + private $selector = ''; + /** + * The address of the API backend. + * + * Generated from protobuf field string address = 2; + */ + private $address = ''; + /** + * The number of seconds to wait for a response from a request. The default + * varies based on the request protocol and deployment environment. + * + * Generated from protobuf field double deadline = 3; + */ + private $deadline = 0.0; + /** + * Minimum deadline in seconds needed for this method. Calls having deadline + * value lower than this will be rejected. + * + * Generated from protobuf field double min_deadline = 4; + */ + private $min_deadline = 0.0; + /** + * The number of seconds to wait for the completion of a long running + * operation. The default is no deadline. + * + * Generated from protobuf field double operation_deadline = 5; + */ + private $operation_deadline = 0.0; + /** + * Generated from protobuf field .google.api.BackendRule.PathTranslation path_translation = 6; + */ + private $path_translation = 0; + protected $authentication; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $selector + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * @type string $address + * The address of the API backend. + * @type float $deadline + * The number of seconds to wait for a response from a request. The default + * varies based on the request protocol and deployment environment. + * @type float $min_deadline + * Minimum deadline in seconds needed for this method. Calls having deadline + * value lower than this will be rejected. + * @type float $operation_deadline + * The number of seconds to wait for the completion of a long running + * operation. The default is no deadline. + * @type int $path_translation + * @type string $jwt_audience + * The JWT audience is used when generating a JWT ID token for the backend. + * This ID token will be added in the HTTP "authorization" header, and sent + * to the backend. + * @type bool $disable_auth + * When disable_auth is false, a JWT ID token will be generated with the + * value from [BackendRule.address][google.api.BackendRule.address] as jwt_audience, overrode to the HTTP + * "Authorization" request header and sent to the backend. + * When disable_auth is true, a JWT ID token won't be generated and the + * original "Authorization" HTTP header will be preserved. If the header is + * used to carry the original token and is expected by the backend, this + * field must be set to true to preserve the header. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Backend::initOnce(); + parent::__construct($data); + } + + /** + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @return string + */ + public function getSelector() + { + return $this->selector; + } + + /** + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @param string $var + * @return $this + */ + public function setSelector($var) + { + GPBUtil::checkString($var, True); + $this->selector = $var; + + return $this; + } + + /** + * The address of the API backend. + * + * Generated from protobuf field string address = 2; + * @return string + */ + public function getAddress() + { + return $this->address; + } + + /** + * The address of the API backend. + * + * Generated from protobuf field string address = 2; + * @param string $var + * @return $this + */ + public function setAddress($var) + { + GPBUtil::checkString($var, True); + $this->address = $var; + + return $this; + } + + /** + * The number of seconds to wait for a response from a request. The default + * varies based on the request protocol and deployment environment. + * + * Generated from protobuf field double deadline = 3; + * @return float + */ + public function getDeadline() + { + return $this->deadline; + } + + /** + * The number of seconds to wait for a response from a request. The default + * varies based on the request protocol and deployment environment. + * + * Generated from protobuf field double deadline = 3; + * @param float $var + * @return $this + */ + public function setDeadline($var) + { + GPBUtil::checkDouble($var); + $this->deadline = $var; + + return $this; + } + + /** + * Minimum deadline in seconds needed for this method. Calls having deadline + * value lower than this will be rejected. + * + * Generated from protobuf field double min_deadline = 4; + * @return float + */ + public function getMinDeadline() + { + return $this->min_deadline; + } + + /** + * Minimum deadline in seconds needed for this method. Calls having deadline + * value lower than this will be rejected. + * + * Generated from protobuf field double min_deadline = 4; + * @param float $var + * @return $this + */ + public function setMinDeadline($var) + { + GPBUtil::checkDouble($var); + $this->min_deadline = $var; + + return $this; + } + + /** + * The number of seconds to wait for the completion of a long running + * operation. The default is no deadline. + * + * Generated from protobuf field double operation_deadline = 5; + * @return float + */ + public function getOperationDeadline() + { + return $this->operation_deadline; + } + + /** + * The number of seconds to wait for the completion of a long running + * operation. The default is no deadline. + * + * Generated from protobuf field double operation_deadline = 5; + * @param float $var + * @return $this + */ + public function setOperationDeadline($var) + { + GPBUtil::checkDouble($var); + $this->operation_deadline = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.api.BackendRule.PathTranslation path_translation = 6; + * @return int + */ + public function getPathTranslation() + { + return $this->path_translation; + } + + /** + * Generated from protobuf field .google.api.BackendRule.PathTranslation path_translation = 6; + * @param int $var + * @return $this + */ + public function setPathTranslation($var) + { + GPBUtil::checkEnum($var, \Google\Api\BackendRule_PathTranslation::class); + $this->path_translation = $var; + + return $this; + } + + /** + * The JWT audience is used when generating a JWT ID token for the backend. + * This ID token will be added in the HTTP "authorization" header, and sent + * to the backend. + * + * Generated from protobuf field string jwt_audience = 7; + * @return string + */ + public function getJwtAudience() + { + return $this->readOneof(7); + } + + /** + * The JWT audience is used when generating a JWT ID token for the backend. + * This ID token will be added in the HTTP "authorization" header, and sent + * to the backend. + * + * Generated from protobuf field string jwt_audience = 7; + * @param string $var + * @return $this + */ + public function setJwtAudience($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * When disable_auth is false, a JWT ID token will be generated with the + * value from [BackendRule.address][google.api.BackendRule.address] as jwt_audience, overrode to the HTTP + * "Authorization" request header and sent to the backend. + * When disable_auth is true, a JWT ID token won't be generated and the + * original "Authorization" HTTP header will be preserved. If the header is + * used to carry the original token and is expected by the backend, this + * field must be set to true to preserve the header. + * + * Generated from protobuf field bool disable_auth = 8; + * @return bool + */ + public function getDisableAuth() + { + return $this->readOneof(8); + } + + /** + * When disable_auth is false, a JWT ID token will be generated with the + * value from [BackendRule.address][google.api.BackendRule.address] as jwt_audience, overrode to the HTTP + * "Authorization" request header and sent to the backend. + * When disable_auth is true, a JWT ID token won't be generated and the + * original "Authorization" HTTP header will be preserved. If the header is + * used to carry the original token and is expected by the backend, this + * field must be set to true to preserve the header. + * + * Generated from protobuf field bool disable_auth = 8; + * @param bool $var + * @return $this + */ + public function setDisableAuth($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * @return string + */ + public function getAuthentication() + { + return $this->whichOneof("authentication"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/BackendRule/PathTranslation.php b/vendor/google/common-protos/src/Api/BackendRule/PathTranslation.php new file mode 100644 index 00000000..224012c8 --- /dev/null +++ b/vendor/google/common-protos/src/Api/BackendRule/PathTranslation.php @@ -0,0 +1,95 @@ +google.api.BackendRule.PathTranslation + */ +class PathTranslation +{ + /** + * Generated from protobuf enum PATH_TRANSLATION_UNSPECIFIED = 0; + */ + const PATH_TRANSLATION_UNSPECIFIED = 0; + /** + * Use the backend address as-is, with no modification to the path. If the + * URL pattern contains variables, the variable names and values will be + * appended to the query string. If a query string parameter and a URL + * pattern variable have the same name, this may result in duplicate keys in + * the query string. + * # Examples + * Given the following operation config: + * Method path: /api/company/{cid}/user/{uid} + * Backend address: https://example.cloudfunctions.net/getUser + * Requests to the following request paths will call the backend at the + * translated path: + * Request path: /api/company/widgetworks/user/johndoe + * Translated: + * https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe + * Request path: /api/company/widgetworks/user/johndoe?timezone=EST + * Translated: + * https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe + * + * Generated from protobuf enum CONSTANT_ADDRESS = 1; + */ + const CONSTANT_ADDRESS = 1; + /** + * The request path will be appended to the backend address. + * # Examples + * Given the following operation config: + * Method path: /api/company/{cid}/user/{uid} + * Backend address: https://example.appspot.com + * Requests to the following request paths will call the backend at the + * translated path: + * Request path: /api/company/widgetworks/user/johndoe + * Translated: + * https://example.appspot.com/api/company/widgetworks/user/johndoe + * Request path: /api/company/widgetworks/user/johndoe?timezone=EST + * Translated: + * https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST + * + * Generated from protobuf enum APPEND_PATH_TO_ADDRESS = 2; + */ + const APPEND_PATH_TO_ADDRESS = 2; + + private static $valueToName = [ + self::PATH_TRANSLATION_UNSPECIFIED => 'PATH_TRANSLATION_UNSPECIFIED', + self::CONSTANT_ADDRESS => 'CONSTANT_ADDRESS', + self::APPEND_PATH_TO_ADDRESS => 'APPEND_PATH_TO_ADDRESS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PathTranslation::class, \Google\Api\BackendRule_PathTranslation::class); + diff --git a/vendor/google/common-protos/src/Api/BackendRule_PathTranslation.php b/vendor/google/common-protos/src/Api/BackendRule_PathTranslation.php new file mode 100644 index 00000000..6b004e62 --- /dev/null +++ b/vendor/google/common-protos/src/Api/BackendRule_PathTranslation.php @@ -0,0 +1,16 @@ +google.api.Billing + */ +class Billing extends \Google\Protobuf\Internal\Message +{ + /** + * Billing configurations for sending metrics to the consumer project. + * There can be multiple consumer destinations per service, each one must have + * a different monitored resource type. A metric can be used in at most + * one consumer destination. + * + * Generated from protobuf field repeated .google.api.Billing.BillingDestination consumer_destinations = 8; + */ + private $consumer_destinations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Billing\BillingDestination[]|\Google\Protobuf\Internal\RepeatedField $consumer_destinations + * Billing configurations for sending metrics to the consumer project. + * There can be multiple consumer destinations per service, each one must have + * a different monitored resource type. A metric can be used in at most + * one consumer destination. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Billing::initOnce(); + parent::__construct($data); + } + + /** + * Billing configurations for sending metrics to the consumer project. + * There can be multiple consumer destinations per service, each one must have + * a different monitored resource type. A metric can be used in at most + * one consumer destination. + * + * Generated from protobuf field repeated .google.api.Billing.BillingDestination consumer_destinations = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConsumerDestinations() + { + return $this->consumer_destinations; + } + + /** + * Billing configurations for sending metrics to the consumer project. + * There can be multiple consumer destinations per service, each one must have + * a different monitored resource type. A metric can be used in at most + * one consumer destination. + * + * Generated from protobuf field repeated .google.api.Billing.BillingDestination consumer_destinations = 8; + * @param \Google\Api\Billing\BillingDestination[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConsumerDestinations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Billing\BillingDestination::class); + $this->consumer_destinations = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Billing/BillingDestination.php b/vendor/google/common-protos/src/Api/Billing/BillingDestination.php new file mode 100644 index 00000000..c641f00f --- /dev/null +++ b/vendor/google/common-protos/src/Api/Billing/BillingDestination.php @@ -0,0 +1,113 @@ +google.api.Billing.BillingDestination + */ +class BillingDestination extends \Google\Protobuf\Internal\Message +{ + /** + * The monitored resource type. The type must be defined in + * [Service.monitored_resources][google.api.Service.monitored_resources] section. + * + * Generated from protobuf field string monitored_resource = 1; + */ + private $monitored_resource = ''; + /** + * Names of the metrics to report to this billing destination. + * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. + * + * Generated from protobuf field repeated string metrics = 2; + */ + private $metrics; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $monitored_resource + * The monitored resource type. The type must be defined in + * [Service.monitored_resources][google.api.Service.monitored_resources] section. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $metrics + * Names of the metrics to report to this billing destination. + * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Billing::initOnce(); + parent::__construct($data); + } + + /** + * The monitored resource type. The type must be defined in + * [Service.monitored_resources][google.api.Service.monitored_resources] section. + * + * Generated from protobuf field string monitored_resource = 1; + * @return string + */ + public function getMonitoredResource() + { + return $this->monitored_resource; + } + + /** + * The monitored resource type. The type must be defined in + * [Service.monitored_resources][google.api.Service.monitored_resources] section. + * + * Generated from protobuf field string monitored_resource = 1; + * @param string $var + * @return $this + */ + public function setMonitoredResource($var) + { + GPBUtil::checkString($var, True); + $this->monitored_resource = $var; + + return $this; + } + + /** + * Names of the metrics to report to this billing destination. + * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. + * + * Generated from protobuf field repeated string metrics = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetrics() + { + return $this->metrics; + } + + /** + * Names of the metrics to report to this billing destination. + * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. + * + * Generated from protobuf field repeated string metrics = 2; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetrics($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->metrics = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BillingDestination::class, \Google\Api\Billing_BillingDestination::class); + diff --git a/vendor/google/common-protos/src/Api/Billing_BillingDestination.php b/vendor/google/common-protos/src/Api/Billing_BillingDestination.php new file mode 100644 index 00000000..d1df1fb7 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Billing_BillingDestination.php @@ -0,0 +1,16 @@ +google.api.ChangeType + */ +class ChangeType +{ + /** + * No value was provided. + * + * Generated from protobuf enum CHANGE_TYPE_UNSPECIFIED = 0; + */ + const CHANGE_TYPE_UNSPECIFIED = 0; + /** + * The changed object exists in the 'new' service configuration, but not + * in the 'old' service configuration. + * + * Generated from protobuf enum ADDED = 1; + */ + const ADDED = 1; + /** + * The changed object exists in the 'old' service configuration, but not + * in the 'new' service configuration. + * + * Generated from protobuf enum REMOVED = 2; + */ + const REMOVED = 2; + /** + * The changed object exists in both service configurations, but its value + * is different. + * + * Generated from protobuf enum MODIFIED = 3; + */ + const MODIFIED = 3; + + private static $valueToName = [ + self::CHANGE_TYPE_UNSPECIFIED => 'CHANGE_TYPE_UNSPECIFIED', + self::ADDED => 'ADDED', + self::REMOVED => 'REMOVED', + self::MODIFIED => 'MODIFIED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/vendor/google/common-protos/src/Api/ConfigChange.php b/vendor/google/common-protos/src/Api/ConfigChange.php new file mode 100644 index 00000000..7f558ff5 --- /dev/null +++ b/vendor/google/common-protos/src/Api/ConfigChange.php @@ -0,0 +1,251 @@ +google.api.ConfigChange + */ +class ConfigChange extends \Google\Protobuf\Internal\Message +{ + /** + * Object hierarchy path to the change, with levels separated by a '.' + * character. For repeated fields, an applicable unique identifier field is + * used for the index (usually selector, name, or id). For maps, the term + * 'key' is used. If the field has no unique identifier, the numeric index + * is used. + * Examples: + * - visibility.rules[selector=="google.LibraryService.CreateBook"].restriction + * - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value + * - logging.producer_destinations[0] + * + * Generated from protobuf field string element = 1; + */ + private $element = ''; + /** + * Value of the changed object in the old Service configuration, + * in JSON format. This field will not be populated if ChangeType == ADDED. + * + * Generated from protobuf field string old_value = 2; + */ + private $old_value = ''; + /** + * Value of the changed object in the new Service configuration, + * in JSON format. This field will not be populated if ChangeType == REMOVED. + * + * Generated from protobuf field string new_value = 3; + */ + private $new_value = ''; + /** + * The type for this change, either ADDED, REMOVED, or MODIFIED. + * + * Generated from protobuf field .google.api.ChangeType change_type = 4; + */ + private $change_type = 0; + /** + * Collection of advice provided for this change, useful for determining the + * possible impact of this change. + * + * Generated from protobuf field repeated .google.api.Advice advices = 5; + */ + private $advices; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $element + * Object hierarchy path to the change, with levels separated by a '.' + * character. For repeated fields, an applicable unique identifier field is + * used for the index (usually selector, name, or id). For maps, the term + * 'key' is used. If the field has no unique identifier, the numeric index + * is used. + * Examples: + * - visibility.rules[selector=="google.LibraryService.CreateBook"].restriction + * - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value + * - logging.producer_destinations[0] + * @type string $old_value + * Value of the changed object in the old Service configuration, + * in JSON format. This field will not be populated if ChangeType == ADDED. + * @type string $new_value + * Value of the changed object in the new Service configuration, + * in JSON format. This field will not be populated if ChangeType == REMOVED. + * @type int $change_type + * The type for this change, either ADDED, REMOVED, or MODIFIED. + * @type \Google\Api\Advice[]|\Google\Protobuf\Internal\RepeatedField $advices + * Collection of advice provided for this change, useful for determining the + * possible impact of this change. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\ConfigChange::initOnce(); + parent::__construct($data); + } + + /** + * Object hierarchy path to the change, with levels separated by a '.' + * character. For repeated fields, an applicable unique identifier field is + * used for the index (usually selector, name, or id). For maps, the term + * 'key' is used. If the field has no unique identifier, the numeric index + * is used. + * Examples: + * - visibility.rules[selector=="google.LibraryService.CreateBook"].restriction + * - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value + * - logging.producer_destinations[0] + * + * Generated from protobuf field string element = 1; + * @return string + */ + public function getElement() + { + return $this->element; + } + + /** + * Object hierarchy path to the change, with levels separated by a '.' + * character. For repeated fields, an applicable unique identifier field is + * used for the index (usually selector, name, or id). For maps, the term + * 'key' is used. If the field has no unique identifier, the numeric index + * is used. + * Examples: + * - visibility.rules[selector=="google.LibraryService.CreateBook"].restriction + * - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value + * - logging.producer_destinations[0] + * + * Generated from protobuf field string element = 1; + * @param string $var + * @return $this + */ + public function setElement($var) + { + GPBUtil::checkString($var, True); + $this->element = $var; + + return $this; + } + + /** + * Value of the changed object in the old Service configuration, + * in JSON format. This field will not be populated if ChangeType == ADDED. + * + * Generated from protobuf field string old_value = 2; + * @return string + */ + public function getOldValue() + { + return $this->old_value; + } + + /** + * Value of the changed object in the old Service configuration, + * in JSON format. This field will not be populated if ChangeType == ADDED. + * + * Generated from protobuf field string old_value = 2; + * @param string $var + * @return $this + */ + public function setOldValue($var) + { + GPBUtil::checkString($var, True); + $this->old_value = $var; + + return $this; + } + + /** + * Value of the changed object in the new Service configuration, + * in JSON format. This field will not be populated if ChangeType == REMOVED. + * + * Generated from protobuf field string new_value = 3; + * @return string + */ + public function getNewValue() + { + return $this->new_value; + } + + /** + * Value of the changed object in the new Service configuration, + * in JSON format. This field will not be populated if ChangeType == REMOVED. + * + * Generated from protobuf field string new_value = 3; + * @param string $var + * @return $this + */ + public function setNewValue($var) + { + GPBUtil::checkString($var, True); + $this->new_value = $var; + + return $this; + } + + /** + * The type for this change, either ADDED, REMOVED, or MODIFIED. + * + * Generated from protobuf field .google.api.ChangeType change_type = 4; + * @return int + */ + public function getChangeType() + { + return $this->change_type; + } + + /** + * The type for this change, either ADDED, REMOVED, or MODIFIED. + * + * Generated from protobuf field .google.api.ChangeType change_type = 4; + * @param int $var + * @return $this + */ + public function setChangeType($var) + { + GPBUtil::checkEnum($var, \Google\Api\ChangeType::class); + $this->change_type = $var; + + return $this; + } + + /** + * Collection of advice provided for this change, useful for determining the + * possible impact of this change. + * + * Generated from protobuf field repeated .google.api.Advice advices = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdvices() + { + return $this->advices; + } + + /** + * Collection of advice provided for this change, useful for determining the + * possible impact of this change. + * + * Generated from protobuf field repeated .google.api.Advice advices = 5; + * @param \Google\Api\Advice[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdvices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Advice::class); + $this->advices = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Context.php b/vendor/google/common-protos/src/Api/Context.php new file mode 100644 index 00000000..f96eb084 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Context.php @@ -0,0 +1,83 @@ +google.api.Context + */ +class Context extends \Google\Protobuf\Internal\Message +{ + /** + * A list of RPC context rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.ContextRule rules = 1; + */ + private $rules; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\ContextRule[]|\Google\Protobuf\Internal\RepeatedField $rules + * A list of RPC context rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Context::initOnce(); + parent::__construct($data); + } + + /** + * A list of RPC context rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.ContextRule rules = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * A list of RPC context rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.ContextRule rules = 1; + * @param \Google\Api\ContextRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\ContextRule::class); + $this->rules = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/ContextRule.php b/vendor/google/common-protos/src/Api/ContextRule.php new file mode 100644 index 00000000..ace854ac --- /dev/null +++ b/vendor/google/common-protos/src/Api/ContextRule.php @@ -0,0 +1,140 @@ +google.api.ContextRule + */ +class ContextRule extends \Google\Protobuf\Internal\Message +{ + /** + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + */ + private $selector = ''; + /** + * A list of full type names of requested contexts. + * + * Generated from protobuf field repeated string requested = 2; + */ + private $requested; + /** + * A list of full type names of provided contexts. + * + * Generated from protobuf field repeated string provided = 3; + */ + private $provided; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $selector + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $requested + * A list of full type names of requested contexts. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $provided + * A list of full type names of provided contexts. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Context::initOnce(); + parent::__construct($data); + } + + /** + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @return string + */ + public function getSelector() + { + return $this->selector; + } + + /** + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @param string $var + * @return $this + */ + public function setSelector($var) + { + GPBUtil::checkString($var, True); + $this->selector = $var; + + return $this; + } + + /** + * A list of full type names of requested contexts. + * + * Generated from protobuf field repeated string requested = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequested() + { + return $this->requested; + } + + /** + * A list of full type names of requested contexts. + * + * Generated from protobuf field repeated string requested = 2; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequested($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->requested = $arr; + + return $this; + } + + /** + * A list of full type names of provided contexts. + * + * Generated from protobuf field repeated string provided = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProvided() + { + return $this->provided; + } + + /** + * A list of full type names of provided contexts. + * + * Generated from protobuf field repeated string provided = 3; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProvided($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->provided = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Control.php b/vendor/google/common-protos/src/Api/Control.php new file mode 100644 index 00000000..d7f10dc1 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Control.php @@ -0,0 +1,73 @@ +google.api.Control + */ +class Control extends \Google\Protobuf\Internal\Message +{ + /** + * The service control environment to use. If empty, no control plane + * feature (like quota and billing) will be enabled. + * + * Generated from protobuf field string environment = 1; + */ + private $environment = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $environment + * The service control environment to use. If empty, no control plane + * feature (like quota and billing) will be enabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Control::initOnce(); + parent::__construct($data); + } + + /** + * The service control environment to use. If empty, no control plane + * feature (like quota and billing) will be enabled. + * + * Generated from protobuf field string environment = 1; + * @return string + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * The service control environment to use. If empty, no control plane + * feature (like quota and billing) will be enabled. + * + * Generated from protobuf field string environment = 1; + * @param string $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkString($var, True); + $this->environment = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/CustomHttpPattern.php b/vendor/google/common-protos/src/Api/CustomHttpPattern.php new file mode 100644 index 00000000..269c8837 --- /dev/null +++ b/vendor/google/common-protos/src/Api/CustomHttpPattern.php @@ -0,0 +1,101 @@ +google.api.CustomHttpPattern + */ +class CustomHttpPattern extends \Google\Protobuf\Internal\Message +{ + /** + * The name of this custom HTTP verb. + * + * Generated from protobuf field string kind = 1; + */ + private $kind = ''; + /** + * The path matched by this custom verb. + * + * Generated from protobuf field string path = 2; + */ + private $path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $kind + * The name of this custom HTTP verb. + * @type string $path + * The path matched by this custom verb. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Http::initOnce(); + parent::__construct($data); + } + + /** + * The name of this custom HTTP verb. + * + * Generated from protobuf field string kind = 1; + * @return string + */ + public function getKind() + { + return $this->kind; + } + + /** + * The name of this custom HTTP verb. + * + * Generated from protobuf field string kind = 1; + * @param string $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkString($var, True); + $this->kind = $var; + + return $this; + } + + /** + * The path matched by this custom verb. + * + * Generated from protobuf field string path = 2; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * The path matched by this custom verb. + * + * Generated from protobuf field string path = 2; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Distribution.php b/vendor/google/common-protos/src/Api/Distribution.php new file mode 100644 index 00000000..c619fb57 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Distribution.php @@ -0,0 +1,370 @@ +google.api.Distribution + */ +class Distribution extends \Google\Protobuf\Internal\Message +{ + /** + * The number of values in the population. Must be non-negative. This value + * must equal the sum of the values in `bucket_counts` if a histogram is + * provided. + * + * Generated from protobuf field int64 count = 1; + */ + private $count = 0; + /** + * The arithmetic mean of the values in the population. If `count` is zero + * then this field must be zero. + * + * Generated from protobuf field double mean = 2; + */ + private $mean = 0.0; + /** + * The sum of squared deviations from the mean of the values in the + * population. For values x_i this is: + * Sum[i=1..n]((x_i - mean)^2) + * Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition + * describes Welford's method for accumulating this sum in one pass. + * If `count` is zero then this field must be zero. + * + * Generated from protobuf field double sum_of_squared_deviation = 3; + */ + private $sum_of_squared_deviation = 0.0; + /** + * If specified, contains the range of the population values. The field + * must not be present if the `count` is zero. + * + * Generated from protobuf field .google.api.Distribution.Range range = 4; + */ + private $range = null; + /** + * Defines the histogram bucket boundaries. If the distribution does not + * contain a histogram, then omit this field. + * + * Generated from protobuf field .google.api.Distribution.BucketOptions bucket_options = 6; + */ + private $bucket_options = null; + /** + * The number of values in each bucket of the histogram, as described in + * `bucket_options`. If the distribution does not have a histogram, then omit + * this field. If there is a histogram, then the sum of the values in + * `bucket_counts` must equal the value in the `count` field of the + * distribution. + * If present, `bucket_counts` should contain N values, where N is the number + * of buckets specified in `bucket_options`. If you supply fewer than N + * values, the remaining values are assumed to be 0. + * The order of the values in `bucket_counts` follows the bucket numbering + * schemes described for the three bucket types. The first value must be the + * count for the underflow bucket (number 0). The next N-2 values are the + * counts for the finite buckets (number 1 through N-2). The N'th value in + * `bucket_counts` is the count for the overflow bucket (number N-1). + * + * Generated from protobuf field repeated int64 bucket_counts = 7; + */ + private $bucket_counts; + /** + * Must be in increasing order of `value` field. + * + * Generated from protobuf field repeated .google.api.Distribution.Exemplar exemplars = 10; + */ + private $exemplars; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $count + * The number of values in the population. Must be non-negative. This value + * must equal the sum of the values in `bucket_counts` if a histogram is + * provided. + * @type float $mean + * The arithmetic mean of the values in the population. If `count` is zero + * then this field must be zero. + * @type float $sum_of_squared_deviation + * The sum of squared deviations from the mean of the values in the + * population. For values x_i this is: + * Sum[i=1..n]((x_i - mean)^2) + * Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition + * describes Welford's method for accumulating this sum in one pass. + * If `count` is zero then this field must be zero. + * @type \Google\Api\Distribution\Range $range + * If specified, contains the range of the population values. The field + * must not be present if the `count` is zero. + * @type \Google\Api\Distribution\BucketOptions $bucket_options + * Defines the histogram bucket boundaries. If the distribution does not + * contain a histogram, then omit this field. + * @type int[]|string[]|\Google\Protobuf\Internal\RepeatedField $bucket_counts + * The number of values in each bucket of the histogram, as described in + * `bucket_options`. If the distribution does not have a histogram, then omit + * this field. If there is a histogram, then the sum of the values in + * `bucket_counts` must equal the value in the `count` field of the + * distribution. + * If present, `bucket_counts` should contain N values, where N is the number + * of buckets specified in `bucket_options`. If you supply fewer than N + * values, the remaining values are assumed to be 0. + * The order of the values in `bucket_counts` follows the bucket numbering + * schemes described for the three bucket types. The first value must be the + * count for the underflow bucket (number 0). The next N-2 values are the + * counts for the finite buckets (number 1 through N-2). The N'th value in + * `bucket_counts` is the count for the overflow bucket (number N-1). + * @type \Google\Api\Distribution\Exemplar[]|\Google\Protobuf\Internal\RepeatedField $exemplars + * Must be in increasing order of `value` field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Distribution::initOnce(); + parent::__construct($data); + } + + /** + * The number of values in the population. Must be non-negative. This value + * must equal the sum of the values in `bucket_counts` if a histogram is + * provided. + * + * Generated from protobuf field int64 count = 1; + * @return int|string + */ + public function getCount() + { + return $this->count; + } + + /** + * The number of values in the population. Must be non-negative. This value + * must equal the sum of the values in `bucket_counts` if a histogram is + * provided. + * + * Generated from protobuf field int64 count = 1; + * @param int|string $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkInt64($var); + $this->count = $var; + + return $this; + } + + /** + * The arithmetic mean of the values in the population. If `count` is zero + * then this field must be zero. + * + * Generated from protobuf field double mean = 2; + * @return float + */ + public function getMean() + { + return $this->mean; + } + + /** + * The arithmetic mean of the values in the population. If `count` is zero + * then this field must be zero. + * + * Generated from protobuf field double mean = 2; + * @param float $var + * @return $this + */ + public function setMean($var) + { + GPBUtil::checkDouble($var); + $this->mean = $var; + + return $this; + } + + /** + * The sum of squared deviations from the mean of the values in the + * population. For values x_i this is: + * Sum[i=1..n]((x_i - mean)^2) + * Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition + * describes Welford's method for accumulating this sum in one pass. + * If `count` is zero then this field must be zero. + * + * Generated from protobuf field double sum_of_squared_deviation = 3; + * @return float + */ + public function getSumOfSquaredDeviation() + { + return $this->sum_of_squared_deviation; + } + + /** + * The sum of squared deviations from the mean of the values in the + * population. For values x_i this is: + * Sum[i=1..n]((x_i - mean)^2) + * Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition + * describes Welford's method for accumulating this sum in one pass. + * If `count` is zero then this field must be zero. + * + * Generated from protobuf field double sum_of_squared_deviation = 3; + * @param float $var + * @return $this + */ + public function setSumOfSquaredDeviation($var) + { + GPBUtil::checkDouble($var); + $this->sum_of_squared_deviation = $var; + + return $this; + } + + /** + * If specified, contains the range of the population values. The field + * must not be present if the `count` is zero. + * + * Generated from protobuf field .google.api.Distribution.Range range = 4; + * @return \Google\Api\Distribution\Range + */ + public function getRange() + { + return $this->range; + } + + /** + * If specified, contains the range of the population values. The field + * must not be present if the `count` is zero. + * + * Generated from protobuf field .google.api.Distribution.Range range = 4; + * @param \Google\Api\Distribution\Range $var + * @return $this + */ + public function setRange($var) + { + GPBUtil::checkMessage($var, \Google\Api\Distribution_Range::class); + $this->range = $var; + + return $this; + } + + /** + * Defines the histogram bucket boundaries. If the distribution does not + * contain a histogram, then omit this field. + * + * Generated from protobuf field .google.api.Distribution.BucketOptions bucket_options = 6; + * @return \Google\Api\Distribution\BucketOptions + */ + public function getBucketOptions() + { + return $this->bucket_options; + } + + /** + * Defines the histogram bucket boundaries. If the distribution does not + * contain a histogram, then omit this field. + * + * Generated from protobuf field .google.api.Distribution.BucketOptions bucket_options = 6; + * @param \Google\Api\Distribution\BucketOptions $var + * @return $this + */ + public function setBucketOptions($var) + { + GPBUtil::checkMessage($var, \Google\Api\Distribution_BucketOptions::class); + $this->bucket_options = $var; + + return $this; + } + + /** + * The number of values in each bucket of the histogram, as described in + * `bucket_options`. If the distribution does not have a histogram, then omit + * this field. If there is a histogram, then the sum of the values in + * `bucket_counts` must equal the value in the `count` field of the + * distribution. + * If present, `bucket_counts` should contain N values, where N is the number + * of buckets specified in `bucket_options`. If you supply fewer than N + * values, the remaining values are assumed to be 0. + * The order of the values in `bucket_counts` follows the bucket numbering + * schemes described for the three bucket types. The first value must be the + * count for the underflow bucket (number 0). The next N-2 values are the + * counts for the finite buckets (number 1 through N-2). The N'th value in + * `bucket_counts` is the count for the overflow bucket (number N-1). + * + * Generated from protobuf field repeated int64 bucket_counts = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBucketCounts() + { + return $this->bucket_counts; + } + + /** + * The number of values in each bucket of the histogram, as described in + * `bucket_options`. If the distribution does not have a histogram, then omit + * this field. If there is a histogram, then the sum of the values in + * `bucket_counts` must equal the value in the `count` field of the + * distribution. + * If present, `bucket_counts` should contain N values, where N is the number + * of buckets specified in `bucket_options`. If you supply fewer than N + * values, the remaining values are assumed to be 0. + * The order of the values in `bucket_counts` follows the bucket numbering + * schemes described for the three bucket types. The first value must be the + * count for the underflow bucket (number 0). The next N-2 values are the + * counts for the finite buckets (number 1 through N-2). The N'th value in + * `bucket_counts` is the count for the overflow bucket (number N-1). + * + * Generated from protobuf field repeated int64 bucket_counts = 7; + * @param int[]|string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBucketCounts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT64); + $this->bucket_counts = $arr; + + return $this; + } + + /** + * Must be in increasing order of `value` field. + * + * Generated from protobuf field repeated .google.api.Distribution.Exemplar exemplars = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExemplars() + { + return $this->exemplars; + } + + /** + * Must be in increasing order of `value` field. + * + * Generated from protobuf field repeated .google.api.Distribution.Exemplar exemplars = 10; + * @param \Google\Api\Distribution\Exemplar[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExemplars($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Distribution\Exemplar::class); + $this->exemplars = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Distribution/BucketOptions.php b/vendor/google/common-protos/src/Api/Distribution/BucketOptions.php new file mode 100644 index 00000000..4ae8e3d4 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Distribution/BucketOptions.php @@ -0,0 +1,142 @@ + 0) is the + * same as the upper bound of bucket i - 1. The buckets span the whole range + * of finite values: lower bound of the underflow bucket is -infinity and the + * upper bound of the overflow bucket is +infinity. The finite buckets are + * so-called because both bounds are finite. + * + * Generated from protobuf message google.api.Distribution.BucketOptions + */ +class BucketOptions extends \Google\Protobuf\Internal\Message +{ + protected $options; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Distribution\BucketOptions\Linear $linear_buckets + * The linear bucket. + * @type \Google\Api\Distribution\BucketOptions\Exponential $exponential_buckets + * The exponential buckets. + * @type \Google\Api\Distribution\BucketOptions\Explicit $explicit_buckets + * The explicit buckets. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Distribution::initOnce(); + parent::__construct($data); + } + + /** + * The linear bucket. + * + * Generated from protobuf field .google.api.Distribution.BucketOptions.Linear linear_buckets = 1; + * @return \Google\Api\Distribution\BucketOptions\Linear + */ + public function getLinearBuckets() + { + return $this->readOneof(1); + } + + /** + * The linear bucket. + * + * Generated from protobuf field .google.api.Distribution.BucketOptions.Linear linear_buckets = 1; + * @param \Google\Api\Distribution\BucketOptions\Linear $var + * @return $this + */ + public function setLinearBuckets($var) + { + GPBUtil::checkMessage($var, \Google\Api\Distribution_BucketOptions_Linear::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The exponential buckets. + * + * Generated from protobuf field .google.api.Distribution.BucketOptions.Exponential exponential_buckets = 2; + * @return \Google\Api\Distribution\BucketOptions\Exponential + */ + public function getExponentialBuckets() + { + return $this->readOneof(2); + } + + /** + * The exponential buckets. + * + * Generated from protobuf field .google.api.Distribution.BucketOptions.Exponential exponential_buckets = 2; + * @param \Google\Api\Distribution\BucketOptions\Exponential $var + * @return $this + */ + public function setExponentialBuckets($var) + { + GPBUtil::checkMessage($var, \Google\Api\Distribution_BucketOptions_Exponential::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The explicit buckets. + * + * Generated from protobuf field .google.api.Distribution.BucketOptions.Explicit explicit_buckets = 3; + * @return \Google\Api\Distribution\BucketOptions\Explicit + */ + public function getExplicitBuckets() + { + return $this->readOneof(3); + } + + /** + * The explicit buckets. + * + * Generated from protobuf field .google.api.Distribution.BucketOptions.Explicit explicit_buckets = 3; + * @param \Google\Api\Distribution\BucketOptions\Explicit $var + * @return $this + */ + public function setExplicitBuckets($var) + { + GPBUtil::checkMessage($var, \Google\Api\Distribution_BucketOptions_Explicit::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getOptions() + { + return $this->whichOneof("options"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BucketOptions::class, \Google\Api\Distribution_BucketOptions::class); + diff --git a/vendor/google/common-protos/src/Api/Distribution/BucketOptions/Explicit.php b/vendor/google/common-protos/src/Api/Distribution/BucketOptions/Explicit.php new file mode 100644 index 00000000..c5c37611 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Distribution/BucketOptions/Explicit.php @@ -0,0 +1,77 @@ +google.api.Distribution.BucketOptions.Explicit + */ +class Explicit extends \Google\Protobuf\Internal\Message +{ + /** + * The values must be monotonically increasing. + * + * Generated from protobuf field repeated double bounds = 1; + */ + private $bounds; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float[]|\Google\Protobuf\Internal\RepeatedField $bounds + * The values must be monotonically increasing. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Distribution::initOnce(); + parent::__construct($data); + } + + /** + * The values must be monotonically increasing. + * + * Generated from protobuf field repeated double bounds = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBounds() + { + return $this->bounds; + } + + /** + * The values must be monotonically increasing. + * + * Generated from protobuf field repeated double bounds = 1; + * @param float[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBounds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::DOUBLE); + $this->bounds = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Explicit::class, \Google\Api\Distribution_BucketOptions_Explicit::class); + diff --git a/vendor/google/common-protos/src/Api/Distribution/BucketOptions/Exponential.php b/vendor/google/common-protos/src/Api/Distribution/BucketOptions/Exponential.php new file mode 100644 index 00000000..37b526bc --- /dev/null +++ b/vendor/google/common-protos/src/Api/Distribution/BucketOptions/Exponential.php @@ -0,0 +1,144 @@ +google.api.Distribution.BucketOptions.Exponential + */ +class Exponential extends \Google\Protobuf\Internal\Message +{ + /** + * Must be greater than 0. + * + * Generated from protobuf field int32 num_finite_buckets = 1; + */ + private $num_finite_buckets = 0; + /** + * Must be greater than 1. + * + * Generated from protobuf field double growth_factor = 2; + */ + private $growth_factor = 0.0; + /** + * Must be greater than 0. + * + * Generated from protobuf field double scale = 3; + */ + private $scale = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $num_finite_buckets + * Must be greater than 0. + * @type float $growth_factor + * Must be greater than 1. + * @type float $scale + * Must be greater than 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Distribution::initOnce(); + parent::__construct($data); + } + + /** + * Must be greater than 0. + * + * Generated from protobuf field int32 num_finite_buckets = 1; + * @return int + */ + public function getNumFiniteBuckets() + { + return $this->num_finite_buckets; + } + + /** + * Must be greater than 0. + * + * Generated from protobuf field int32 num_finite_buckets = 1; + * @param int $var + * @return $this + */ + public function setNumFiniteBuckets($var) + { + GPBUtil::checkInt32($var); + $this->num_finite_buckets = $var; + + return $this; + } + + /** + * Must be greater than 1. + * + * Generated from protobuf field double growth_factor = 2; + * @return float + */ + public function getGrowthFactor() + { + return $this->growth_factor; + } + + /** + * Must be greater than 1. + * + * Generated from protobuf field double growth_factor = 2; + * @param float $var + * @return $this + */ + public function setGrowthFactor($var) + { + GPBUtil::checkDouble($var); + $this->growth_factor = $var; + + return $this; + } + + /** + * Must be greater than 0. + * + * Generated from protobuf field double scale = 3; + * @return float + */ + public function getScale() + { + return $this->scale; + } + + /** + * Must be greater than 0. + * + * Generated from protobuf field double scale = 3; + * @param float $var + * @return $this + */ + public function setScale($var) + { + GPBUtil::checkDouble($var); + $this->scale = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Exponential::class, \Google\Api\Distribution_BucketOptions_Exponential::class); + diff --git a/vendor/google/common-protos/src/Api/Distribution/BucketOptions/Linear.php b/vendor/google/common-protos/src/Api/Distribution/BucketOptions/Linear.php new file mode 100644 index 00000000..e7181afc --- /dev/null +++ b/vendor/google/common-protos/src/Api/Distribution/BucketOptions/Linear.php @@ -0,0 +1,144 @@ +google.api.Distribution.BucketOptions.Linear + */ +class Linear extends \Google\Protobuf\Internal\Message +{ + /** + * Must be greater than 0. + * + * Generated from protobuf field int32 num_finite_buckets = 1; + */ + private $num_finite_buckets = 0; + /** + * Must be greater than 0. + * + * Generated from protobuf field double width = 2; + */ + private $width = 0.0; + /** + * Lower bound of the first bucket. + * + * Generated from protobuf field double offset = 3; + */ + private $offset = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $num_finite_buckets + * Must be greater than 0. + * @type float $width + * Must be greater than 0. + * @type float $offset + * Lower bound of the first bucket. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Distribution::initOnce(); + parent::__construct($data); + } + + /** + * Must be greater than 0. + * + * Generated from protobuf field int32 num_finite_buckets = 1; + * @return int + */ + public function getNumFiniteBuckets() + { + return $this->num_finite_buckets; + } + + /** + * Must be greater than 0. + * + * Generated from protobuf field int32 num_finite_buckets = 1; + * @param int $var + * @return $this + */ + public function setNumFiniteBuckets($var) + { + GPBUtil::checkInt32($var); + $this->num_finite_buckets = $var; + + return $this; + } + + /** + * Must be greater than 0. + * + * Generated from protobuf field double width = 2; + * @return float + */ + public function getWidth() + { + return $this->width; + } + + /** + * Must be greater than 0. + * + * Generated from protobuf field double width = 2; + * @param float $var + * @return $this + */ + public function setWidth($var) + { + GPBUtil::checkDouble($var); + $this->width = $var; + + return $this; + } + + /** + * Lower bound of the first bucket. + * + * Generated from protobuf field double offset = 3; + * @return float + */ + public function getOffset() + { + return $this->offset; + } + + /** + * Lower bound of the first bucket. + * + * Generated from protobuf field double offset = 3; + * @param float $var + * @return $this + */ + public function setOffset($var) + { + GPBUtil::checkDouble($var); + $this->offset = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Linear::class, \Google\Api\Distribution_BucketOptions_Linear::class); + diff --git a/vendor/google/common-protos/src/Api/Distribution/Exemplar.php b/vendor/google/common-protos/src/Api/Distribution/Exemplar.php new file mode 100644 index 00000000..5474dabf --- /dev/null +++ b/vendor/google/common-protos/src/Api/Distribution/Exemplar.php @@ -0,0 +1,170 @@ +google.api.Distribution.Exemplar + */ +class Exemplar extends \Google\Protobuf\Internal\Message +{ + /** + * Value of the exemplar point. This value determines to which bucket the + * exemplar belongs. + * + * Generated from protobuf field double value = 1; + */ + private $value = 0.0; + /** + * The observation (sampling) time of the above value. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp = 2; + */ + private $timestamp = null; + /** + * Contextual information about the example value. Examples are: + * Trace ID: type.googleapis.com/google.devtools.cloudtrace.v1.Trace + * Literal string: type.googleapis.com/google.protobuf.StringValue + * Labels dropped during aggregation: + * type.googleapis.com/google.monitoring.v3.DroppedLabels + * There may be only a single attachment of any given message type in a + * single exemplar, and this is enforced by the system. + * + * Generated from protobuf field repeated .google.protobuf.Any attachments = 3; + */ + private $attachments; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $value + * Value of the exemplar point. This value determines to which bucket the + * exemplar belongs. + * @type \Google\Protobuf\Timestamp $timestamp + * The observation (sampling) time of the above value. + * @type \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $attachments + * Contextual information about the example value. Examples are: + * Trace ID: type.googleapis.com/google.devtools.cloudtrace.v1.Trace + * Literal string: type.googleapis.com/google.protobuf.StringValue + * Labels dropped during aggregation: + * type.googleapis.com/google.monitoring.v3.DroppedLabels + * There may be only a single attachment of any given message type in a + * single exemplar, and this is enforced by the system. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Distribution::initOnce(); + parent::__construct($data); + } + + /** + * Value of the exemplar point. This value determines to which bucket the + * exemplar belongs. + * + * Generated from protobuf field double value = 1; + * @return float + */ + public function getValue() + { + return $this->value; + } + + /** + * Value of the exemplar point. This value determines to which bucket the + * exemplar belongs. + * + * Generated from protobuf field double value = 1; + * @param float $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkDouble($var); + $this->value = $var; + + return $this; + } + + /** + * The observation (sampling) time of the above value. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp = 2; + * @return \Google\Protobuf\Timestamp + */ + public function getTimestamp() + { + return $this->timestamp; + } + + /** + * The observation (sampling) time of the above value. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setTimestamp($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->timestamp = $var; + + return $this; + } + + /** + * Contextual information about the example value. Examples are: + * Trace ID: type.googleapis.com/google.devtools.cloudtrace.v1.Trace + * Literal string: type.googleapis.com/google.protobuf.StringValue + * Labels dropped during aggregation: + * type.googleapis.com/google.monitoring.v3.DroppedLabels + * There may be only a single attachment of any given message type in a + * single exemplar, and this is enforced by the system. + * + * Generated from protobuf field repeated .google.protobuf.Any attachments = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAttachments() + { + return $this->attachments; + } + + /** + * Contextual information about the example value. Examples are: + * Trace ID: type.googleapis.com/google.devtools.cloudtrace.v1.Trace + * Literal string: type.googleapis.com/google.protobuf.StringValue + * Labels dropped during aggregation: + * type.googleapis.com/google.monitoring.v3.DroppedLabels + * There may be only a single attachment of any given message type in a + * single exemplar, and this is enforced by the system. + * + * Generated from protobuf field repeated .google.protobuf.Any attachments = 3; + * @param \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAttachments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class); + $this->attachments = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Exemplar::class, \Google\Api\Distribution_Exemplar::class); + diff --git a/vendor/google/common-protos/src/Api/Distribution/Range.php b/vendor/google/common-protos/src/Api/Distribution/Range.php new file mode 100644 index 00000000..9cdf21fd --- /dev/null +++ b/vendor/google/common-protos/src/Api/Distribution/Range.php @@ -0,0 +1,104 @@ +google.api.Distribution.Range + */ +class Range extends \Google\Protobuf\Internal\Message +{ + /** + * The minimum of the population values. + * + * Generated from protobuf field double min = 1; + */ + private $min = 0.0; + /** + * The maximum of the population values. + * + * Generated from protobuf field double max = 2; + */ + private $max = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $min + * The minimum of the population values. + * @type float $max + * The maximum of the population values. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Distribution::initOnce(); + parent::__construct($data); + } + + /** + * The minimum of the population values. + * + * Generated from protobuf field double min = 1; + * @return float + */ + public function getMin() + { + return $this->min; + } + + /** + * The minimum of the population values. + * + * Generated from protobuf field double min = 1; + * @param float $var + * @return $this + */ + public function setMin($var) + { + GPBUtil::checkDouble($var); + $this->min = $var; + + return $this; + } + + /** + * The maximum of the population values. + * + * Generated from protobuf field double max = 2; + * @return float + */ + public function getMax() + { + return $this->max; + } + + /** + * The maximum of the population values. + * + * Generated from protobuf field double max = 2; + * @param float $var + * @return $this + */ + public function setMax($var) + { + GPBUtil::checkDouble($var); + $this->max = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Range::class, \Google\Api\Distribution_Range::class); + diff --git a/vendor/google/common-protos/src/Api/Distribution_BucketOptions.php b/vendor/google/common-protos/src/Api/Distribution_BucketOptions.php new file mode 100644 index 00000000..bc118022 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Distribution_BucketOptions.php @@ -0,0 +1,16 @@ +documentation: + * summary: > + * The Google Calendar API gives access + * to most calendar features. + * pages: + * - name: Overview + * content: (== include google/foo/overview.md ==) + * - name: Tutorial + * content: (== include google/foo/tutorial.md ==) + * subpages; + * - name: Java + * content: (== include google/foo/tutorial_java.md ==) + * rules: + * - selector: google.calendar.Calendar.Get + * description: > + * ... + * - selector: google.calendar.Calendar.Put + * description: > + * ... + * + * Documentation is provided in markdown syntax. In addition to + * standard markdown features, definition lists, tables and fenced + * code blocks are supported. Section headers can be provided and are + * interpreted relative to the section nesting of the context where + * a documentation fragment is embedded. + * Documentation from the IDL is merged with documentation defined + * via the config at normalization time, where documentation provided + * by config rules overrides IDL provided. + * A number of constructs specific to the API platform are supported + * in documentation text. + * In order to reference a proto element, the following + * notation can be used: + *
[fully.qualified.proto.name][]
+ * To override the display text used for the link, this can be used: + *
[display text][fully.qualified.proto.name]
+ * Text can be excluded from doc using the following notation: + *
(-- internal comment --)
+ * A few directives are available in documentation. Note that + * directives must appear on a single line to be properly + * identified. The `include` directive includes a markdown file from + * an external source: + *
(== include path/to/file ==)
+ * The `resource_for` directive marks a message to be the resource of + * a collection in REST view. If it is not specified, tools attempt + * to infer the resource from the operations in a collection: + *
(== resource_for v1.shelves.books ==)
+ * The directive `suppress_warning` does not directly affect documentation + * and is documented together with service config validation. + * + * Generated from protobuf message google.api.Documentation + */ +class Documentation extends \Google\Protobuf\Internal\Message +{ + /** + * A short summary of what the service does. Can only be provided by + * plain text. + * + * Generated from protobuf field string summary = 1; + */ + private $summary = ''; + /** + * The top level pages for the documentation set. + * + * Generated from protobuf field repeated .google.api.Page pages = 5; + */ + private $pages; + /** + * A list of documentation rules that apply to individual API elements. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.DocumentationRule rules = 3; + */ + private $rules; + /** + * The URL to the root of documentation. + * + * Generated from protobuf field string documentation_root_url = 4; + */ + private $documentation_root_url = ''; + /** + * Declares a single overview page. For example: + *
documentation:
+     *   summary: ...
+     *   overview: (== include overview.md ==)
+     * 
+ * This is a shortcut for the following declaration (using pages style): + *
documentation:
+     *   summary: ...
+     *   pages:
+     *   - name: Overview
+     *     content: (== include overview.md ==)
+     * 
+ * Note: you cannot specify both `overview` field and `pages` field. + * + * Generated from protobuf field string overview = 2; + */ + private $overview = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $summary + * A short summary of what the service does. Can only be provided by + * plain text. + * @type \Google\Api\Page[]|\Google\Protobuf\Internal\RepeatedField $pages + * The top level pages for the documentation set. + * @type \Google\Api\DocumentationRule[]|\Google\Protobuf\Internal\RepeatedField $rules + * A list of documentation rules that apply to individual API elements. + * **NOTE:** All service configuration rules follow "last one wins" order. + * @type string $documentation_root_url + * The URL to the root of documentation. + * @type string $overview + * Declares a single overview page. For example: + *
documentation:
+     *             summary: ...
+     *             overview: (== include overview.md ==)
+     *           
+ * This is a shortcut for the following declaration (using pages style): + *
documentation:
+     *             summary: ...
+     *             pages:
+     *             - name: Overview
+     *               content: (== include overview.md ==)
+     *           
+ * Note: you cannot specify both `overview` field and `pages` field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Documentation::initOnce(); + parent::__construct($data); + } + + /** + * A short summary of what the service does. Can only be provided by + * plain text. + * + * Generated from protobuf field string summary = 1; + * @return string + */ + public function getSummary() + { + return $this->summary; + } + + /** + * A short summary of what the service does. Can only be provided by + * plain text. + * + * Generated from protobuf field string summary = 1; + * @param string $var + * @return $this + */ + public function setSummary($var) + { + GPBUtil::checkString($var, True); + $this->summary = $var; + + return $this; + } + + /** + * The top level pages for the documentation set. + * + * Generated from protobuf field repeated .google.api.Page pages = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPages() + { + return $this->pages; + } + + /** + * The top level pages for the documentation set. + * + * Generated from protobuf field repeated .google.api.Page pages = 5; + * @param \Google\Api\Page[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Page::class); + $this->pages = $arr; + + return $this; + } + + /** + * A list of documentation rules that apply to individual API elements. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.DocumentationRule rules = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * A list of documentation rules that apply to individual API elements. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.DocumentationRule rules = 3; + * @param \Google\Api\DocumentationRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\DocumentationRule::class); + $this->rules = $arr; + + return $this; + } + + /** + * The URL to the root of documentation. + * + * Generated from protobuf field string documentation_root_url = 4; + * @return string + */ + public function getDocumentationRootUrl() + { + return $this->documentation_root_url; + } + + /** + * The URL to the root of documentation. + * + * Generated from protobuf field string documentation_root_url = 4; + * @param string $var + * @return $this + */ + public function setDocumentationRootUrl($var) + { + GPBUtil::checkString($var, True); + $this->documentation_root_url = $var; + + return $this; + } + + /** + * Declares a single overview page. For example: + *
documentation:
+     *   summary: ...
+     *   overview: (== include overview.md ==)
+     * 
+ * This is a shortcut for the following declaration (using pages style): + *
documentation:
+     *   summary: ...
+     *   pages:
+     *   - name: Overview
+     *     content: (== include overview.md ==)
+     * 
+ * Note: you cannot specify both `overview` field and `pages` field. + * + * Generated from protobuf field string overview = 2; + * @return string + */ + public function getOverview() + { + return $this->overview; + } + + /** + * Declares a single overview page. For example: + *
documentation:
+     *   summary: ...
+     *   overview: (== include overview.md ==)
+     * 
+ * This is a shortcut for the following declaration (using pages style): + *
documentation:
+     *   summary: ...
+     *   pages:
+     *   - name: Overview
+     *     content: (== include overview.md ==)
+     * 
+ * Note: you cannot specify both `overview` field and `pages` field. + * + * Generated from protobuf field string overview = 2; + * @param string $var + * @return $this + */ + public function setOverview($var) + { + GPBUtil::checkString($var, True); + $this->overview = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/DocumentationRule.php b/vendor/google/common-protos/src/Api/DocumentationRule.php new file mode 100644 index 00000000..5f1747ad --- /dev/null +++ b/vendor/google/common-protos/src/Api/DocumentationRule.php @@ -0,0 +1,159 @@ +google.api.DocumentationRule + */ +class DocumentationRule extends \Google\Protobuf\Internal\Message +{ + /** + * The selector is a comma-separated list of patterns. Each pattern is a + * qualified name of the element which may end in "*", indicating a wildcard. + * Wildcards are only allowed at the end and for a whole component of the + * qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". To + * specify a default for all applicable elements, the whole pattern "*" + * is used. + * + * Generated from protobuf field string selector = 1; + */ + private $selector = ''; + /** + * Description of the selected API(s). + * + * Generated from protobuf field string description = 2; + */ + private $description = ''; + /** + * Deprecation description of the selected element(s). It can be provided if an + * element is marked as `deprecated`. + * + * Generated from protobuf field string deprecation_description = 3; + */ + private $deprecation_description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $selector + * The selector is a comma-separated list of patterns. Each pattern is a + * qualified name of the element which may end in "*", indicating a wildcard. + * Wildcards are only allowed at the end and for a whole component of the + * qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". To + * specify a default for all applicable elements, the whole pattern "*" + * is used. + * @type string $description + * Description of the selected API(s). + * @type string $deprecation_description + * Deprecation description of the selected element(s). It can be provided if an + * element is marked as `deprecated`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Documentation::initOnce(); + parent::__construct($data); + } + + /** + * The selector is a comma-separated list of patterns. Each pattern is a + * qualified name of the element which may end in "*", indicating a wildcard. + * Wildcards are only allowed at the end and for a whole component of the + * qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". To + * specify a default for all applicable elements, the whole pattern "*" + * is used. + * + * Generated from protobuf field string selector = 1; + * @return string + */ + public function getSelector() + { + return $this->selector; + } + + /** + * The selector is a comma-separated list of patterns. Each pattern is a + * qualified name of the element which may end in "*", indicating a wildcard. + * Wildcards are only allowed at the end and for a whole component of the + * qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". To + * specify a default for all applicable elements, the whole pattern "*" + * is used. + * + * Generated from protobuf field string selector = 1; + * @param string $var + * @return $this + */ + public function setSelector($var) + { + GPBUtil::checkString($var, True); + $this->selector = $var; + + return $this; + } + + /** + * Description of the selected API(s). + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Description of the selected API(s). + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Deprecation description of the selected element(s). It can be provided if an + * element is marked as `deprecated`. + * + * Generated from protobuf field string deprecation_description = 3; + * @return string + */ + public function getDeprecationDescription() + { + return $this->deprecation_description; + } + + /** + * Deprecation description of the selected element(s). It can be provided if an + * element is marked as `deprecated`. + * + * Generated from protobuf field string deprecation_description = 3; + * @param string $var + * @return $this + */ + public function setDeprecationDescription($var) + { + GPBUtil::checkString($var, True); + $this->deprecation_description = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Endpoint.php b/vendor/google/common-protos/src/Api/Endpoint.php new file mode 100644 index 00000000..543ba670 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Endpoint.php @@ -0,0 +1,260 @@ +google.api.Endpoint + */ +class Endpoint extends \Google\Protobuf\Internal\Message +{ + /** + * The canonical name of this endpoint. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * DEPRECATED: This field is no longer supported. Instead of using aliases, + * please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended + * aliases. + * Additional names that this endpoint will be hosted on. + * + * Generated from protobuf field repeated string aliases = 2; + */ + private $aliases; + /** + * The list of features enabled on this endpoint. + * + * Generated from protobuf field repeated string features = 4; + */ + private $features; + /** + * The specification of an Internet routable address of API frontend that will + * handle requests to this [API Endpoint](https://cloud.google.com/apis/design/glossary). + * It should be either a valid IPv4 address or a fully-qualified domain name. + * For example, "8.8.8.8" or "myservice.appspot.com". + * + * Generated from protobuf field string target = 101; + */ + private $target = ''; + /** + * Allowing + * [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka + * cross-domain traffic, would allow the backends served from this endpoint to + * receive and respond to HTTP OPTIONS requests. The response will be used by + * the browser to determine whether the subsequent cross-origin request is + * allowed to proceed. + * + * Generated from protobuf field bool allow_cors = 5; + */ + private $allow_cors = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The canonical name of this endpoint. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $aliases + * DEPRECATED: This field is no longer supported. Instead of using aliases, + * please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended + * aliases. + * Additional names that this endpoint will be hosted on. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $features + * The list of features enabled on this endpoint. + * @type string $target + * The specification of an Internet routable address of API frontend that will + * handle requests to this [API Endpoint](https://cloud.google.com/apis/design/glossary). + * It should be either a valid IPv4 address or a fully-qualified domain name. + * For example, "8.8.8.8" or "myservice.appspot.com". + * @type bool $allow_cors + * Allowing + * [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka + * cross-domain traffic, would allow the backends served from this endpoint to + * receive and respond to HTTP OPTIONS requests. The response will be used by + * the browser to determine whether the subsequent cross-origin request is + * allowed to proceed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Endpoint::initOnce(); + parent::__construct($data); + } + + /** + * The canonical name of this endpoint. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The canonical name of this endpoint. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * DEPRECATED: This field is no longer supported. Instead of using aliases, + * please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended + * aliases. + * Additional names that this endpoint will be hosted on. + * + * Generated from protobuf field repeated string aliases = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAliases() + { + return $this->aliases; + } + + /** + * DEPRECATED: This field is no longer supported. Instead of using aliases, + * please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended + * aliases. + * Additional names that this endpoint will be hosted on. + * + * Generated from protobuf field repeated string aliases = 2; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAliases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->aliases = $arr; + + return $this; + } + + /** + * The list of features enabled on this endpoint. + * + * Generated from protobuf field repeated string features = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFeatures() + { + return $this->features; + } + + /** + * The list of features enabled on this endpoint. + * + * Generated from protobuf field repeated string features = 4; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFeatures($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->features = $arr; + + return $this; + } + + /** + * The specification of an Internet routable address of API frontend that will + * handle requests to this [API Endpoint](https://cloud.google.com/apis/design/glossary). + * It should be either a valid IPv4 address or a fully-qualified domain name. + * For example, "8.8.8.8" or "myservice.appspot.com". + * + * Generated from protobuf field string target = 101; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * The specification of an Internet routable address of API frontend that will + * handle requests to this [API Endpoint](https://cloud.google.com/apis/design/glossary). + * It should be either a valid IPv4 address or a fully-qualified domain name. + * For example, "8.8.8.8" or "myservice.appspot.com". + * + * Generated from protobuf field string target = 101; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Allowing + * [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka + * cross-domain traffic, would allow the backends served from this endpoint to + * receive and respond to HTTP OPTIONS requests. The response will be used by + * the browser to determine whether the subsequent cross-origin request is + * allowed to proceed. + * + * Generated from protobuf field bool allow_cors = 5; + * @return bool + */ + public function getAllowCors() + { + return $this->allow_cors; + } + + /** + * Allowing + * [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka + * cross-domain traffic, would allow the backends served from this endpoint to + * receive and respond to HTTP OPTIONS requests. The response will be used by + * the browser to determine whether the subsequent cross-origin request is + * allowed to proceed. + * + * Generated from protobuf field bool allow_cors = 5; + * @param bool $var + * @return $this + */ + public function setAllowCors($var) + { + GPBUtil::checkBool($var); + $this->allow_cors = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/CheckRequest.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/CheckRequest.php new file mode 100644 index 00000000..a603c8c8 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/CheckRequest.php @@ -0,0 +1,189 @@ +google.api.expr.v1alpha1.CheckRequest + */ +class CheckRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parsed representation of the CEL program. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $parsed_expr = null; + /** + * Declarations of types for external variables and functions. + * Required if program uses external variables or functions + * not in the default environment. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Decl type_env = 2; + */ + private $type_env; + /** + * The protocol buffer context. See "Name Resolution" in the + * Language Definition. + * + * Generated from protobuf field string container = 3; + */ + private $container = ''; + /** + * If true, use only the declarations in [type_env][google.api.expr.v1alpha1.CheckRequest.type_env]. If false (default), + * add declarations for the standard definitions to the type environment. See + * "Standard Definitions" in the Language Definition. + * + * Generated from protobuf field bool no_std_env = 4; + */ + private $no_std_env = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\ParsedExpr $parsed_expr + * Required. The parsed representation of the CEL program. + * @type \Google\Api\Expr\V1alpha1\Decl[]|\Google\Protobuf\Internal\RepeatedField $type_env + * Declarations of types for external variables and functions. + * Required if program uses external variables or functions + * not in the default environment. + * @type string $container + * The protocol buffer context. See "Name Resolution" in the + * Language Definition. + * @type bool $no_std_env + * If true, use only the declarations in [type_env][google.api.expr.v1alpha1.CheckRequest.type_env]. If false (default), + * add declarations for the standard definitions to the type environment. See + * "Standard Definitions" in the Language Definition. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\ConformanceService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parsed representation of the CEL program. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Api\Expr\V1alpha1\ParsedExpr + */ + public function getParsedExpr() + { + return $this->parsed_expr; + } + + /** + * Required. The parsed representation of the CEL program. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Api\Expr\V1alpha1\ParsedExpr $var + * @return $this + */ + public function setParsedExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\ParsedExpr::class); + $this->parsed_expr = $var; + + return $this; + } + + /** + * Declarations of types for external variables and functions. + * Required if program uses external variables or functions + * not in the default environment. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Decl type_env = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTypeEnv() + { + return $this->type_env; + } + + /** + * Declarations of types for external variables and functions. + * Required if program uses external variables or functions + * not in the default environment. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Decl type_env = 2; + * @param \Google\Api\Expr\V1alpha1\Decl[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTypeEnv($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Decl::class); + $this->type_env = $arr; + + return $this; + } + + /** + * The protocol buffer context. See "Name Resolution" in the + * Language Definition. + * + * Generated from protobuf field string container = 3; + * @return string + */ + public function getContainer() + { + return $this->container; + } + + /** + * The protocol buffer context. See "Name Resolution" in the + * Language Definition. + * + * Generated from protobuf field string container = 3; + * @param string $var + * @return $this + */ + public function setContainer($var) + { + GPBUtil::checkString($var, True); + $this->container = $var; + + return $this; + } + + /** + * If true, use only the declarations in [type_env][google.api.expr.v1alpha1.CheckRequest.type_env]. If false (default), + * add declarations for the standard definitions to the type environment. See + * "Standard Definitions" in the Language Definition. + * + * Generated from protobuf field bool no_std_env = 4; + * @return bool + */ + public function getNoStdEnv() + { + return $this->no_std_env; + } + + /** + * If true, use only the declarations in [type_env][google.api.expr.v1alpha1.CheckRequest.type_env]. If false (default), + * add declarations for the standard definitions to the type environment. See + * "Standard Definitions" in the Language Definition. + * + * Generated from protobuf field bool no_std_env = 4; + * @param bool $var + * @return $this + */ + public function setNoStdEnv($var) + { + GPBUtil::checkBool($var); + $this->no_std_env = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/CheckResponse.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/CheckResponse.php new file mode 100644 index 00000000..97d4e17c --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/CheckResponse.php @@ -0,0 +1,101 @@ +google.api.expr.v1alpha1.CheckResponse + */ +class CheckResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The annotated representation, or unset if checking failed. + * + * Generated from protobuf field .google.api.expr.v1alpha1.CheckedExpr checked_expr = 1; + */ + private $checked_expr = null; + /** + * Any number of issues with [StatusDetails][] as the details. + * + * Generated from protobuf field repeated .google.rpc.Status issues = 2; + */ + private $issues; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\CheckedExpr $checked_expr + * The annotated representation, or unset if checking failed. + * @type \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $issues + * Any number of issues with [StatusDetails][] as the details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\ConformanceService::initOnce(); + parent::__construct($data); + } + + /** + * The annotated representation, or unset if checking failed. + * + * Generated from protobuf field .google.api.expr.v1alpha1.CheckedExpr checked_expr = 1; + * @return \Google\Api\Expr\V1alpha1\CheckedExpr + */ + public function getCheckedExpr() + { + return $this->checked_expr; + } + + /** + * The annotated representation, or unset if checking failed. + * + * Generated from protobuf field .google.api.expr.v1alpha1.CheckedExpr checked_expr = 1; + * @param \Google\Api\Expr\V1alpha1\CheckedExpr $var + * @return $this + */ + public function setCheckedExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\CheckedExpr::class); + $this->checked_expr = $var; + + return $this; + } + + /** + * Any number of issues with [StatusDetails][] as the details. + * + * Generated from protobuf field repeated .google.rpc.Status issues = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIssues() + { + return $this->issues; + } + + /** + * Any number of issues with [StatusDetails][] as the details. + * + * Generated from protobuf field repeated .google.rpc.Status issues = 2; + * @param \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIssues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->issues = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/CheckedExpr.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/CheckedExpr.php new file mode 100644 index 00000000..301ae522 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/CheckedExpr.php @@ -0,0 +1,237 @@ +google.api.expr.v1alpha1.CheckedExpr + */ +class CheckedExpr extends \Google\Protobuf\Internal\Message +{ + /** + * A map from expression ids to resolved references. + * The following entries are in this table: + * - An Ident or Select expression is represented here if it resolves to a + * declaration. For instance, if `a.b.c` is represented by + * `select(select(id(a), b), c)`, and `a.b` resolves to a declaration, + * while `c` is a field selection, then the reference is attached to the + * nested select expression (but not to the id or or the outer select). + * In turn, if `a` resolves to a declaration and `b.c` are field selections, + * the reference is attached to the ident expression. + * - Every Call expression has an entry here, identifying the function being + * called. + * - Every CreateStruct expression for a message has an entry, identifying + * the message. + * + * Generated from protobuf field map reference_map = 2; + */ + private $reference_map; + /** + * A map from expression ids to types. + * Every expression node which has a type different than DYN has a mapping + * here. If an expression has type DYN, it is omitted from this map to save + * space. + * + * Generated from protobuf field map type_map = 3; + */ + private $type_map; + /** + * The source info derived from input that generated the parsed `expr` and + * any optimizations made during the type-checking pass. + * + * Generated from protobuf field .google.api.expr.v1alpha1.SourceInfo source_info = 5; + */ + private $source_info = null; + /** + * The checked expression. Semantically equivalent to the parsed `expr`, but + * may have structural differences. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr expr = 4; + */ + private $expr = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\MapField $reference_map + * A map from expression ids to resolved references. + * The following entries are in this table: + * - An Ident or Select expression is represented here if it resolves to a + * declaration. For instance, if `a.b.c` is represented by + * `select(select(id(a), b), c)`, and `a.b` resolves to a declaration, + * while `c` is a field selection, then the reference is attached to the + * nested select expression (but not to the id or or the outer select). + * In turn, if `a` resolves to a declaration and `b.c` are field selections, + * the reference is attached to the ident expression. + * - Every Call expression has an entry here, identifying the function being + * called. + * - Every CreateStruct expression for a message has an entry, identifying + * the message. + * @type array|\Google\Protobuf\Internal\MapField $type_map + * A map from expression ids to types. + * Every expression node which has a type different than DYN has a mapping + * here. If an expression has type DYN, it is omitted from this map to save + * space. + * @type \Google\Api\Expr\V1alpha1\SourceInfo $source_info + * The source info derived from input that generated the parsed `expr` and + * any optimizations made during the type-checking pass. + * @type \Google\Api\Expr\V1alpha1\Expr $expr + * The checked expression. Semantically equivalent to the parsed `expr`, but + * may have structural differences. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Checked::initOnce(); + parent::__construct($data); + } + + /** + * A map from expression ids to resolved references. + * The following entries are in this table: + * - An Ident or Select expression is represented here if it resolves to a + * declaration. For instance, if `a.b.c` is represented by + * `select(select(id(a), b), c)`, and `a.b` resolves to a declaration, + * while `c` is a field selection, then the reference is attached to the + * nested select expression (but not to the id or or the outer select). + * In turn, if `a` resolves to a declaration and `b.c` are field selections, + * the reference is attached to the ident expression. + * - Every Call expression has an entry here, identifying the function being + * called. + * - Every CreateStruct expression for a message has an entry, identifying + * the message. + * + * Generated from protobuf field map reference_map = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getReferenceMap() + { + return $this->reference_map; + } + + /** + * A map from expression ids to resolved references. + * The following entries are in this table: + * - An Ident or Select expression is represented here if it resolves to a + * declaration. For instance, if `a.b.c` is represented by + * `select(select(id(a), b), c)`, and `a.b` resolves to a declaration, + * while `c` is a field selection, then the reference is attached to the + * nested select expression (but not to the id or or the outer select). + * In turn, if `a` resolves to a declaration and `b.c` are field selections, + * the reference is attached to the ident expression. + * - Every Call expression has an entry here, identifying the function being + * called. + * - Every CreateStruct expression for a message has an entry, identifying + * the message. + * + * Generated from protobuf field map reference_map = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setReferenceMap($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::INT64, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Reference::class); + $this->reference_map = $arr; + + return $this; + } + + /** + * A map from expression ids to types. + * Every expression node which has a type different than DYN has a mapping + * here. If an expression has type DYN, it is omitted from this map to save + * space. + * + * Generated from protobuf field map type_map = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getTypeMap() + { + return $this->type_map; + } + + /** + * A map from expression ids to types. + * Every expression node which has a type different than DYN has a mapping + * here. If an expression has type DYN, it is omitted from this map to save + * space. + * + * Generated from protobuf field map type_map = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setTypeMap($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::INT64, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Type::class); + $this->type_map = $arr; + + return $this; + } + + /** + * The source info derived from input that generated the parsed `expr` and + * any optimizations made during the type-checking pass. + * + * Generated from protobuf field .google.api.expr.v1alpha1.SourceInfo source_info = 5; + * @return \Google\Api\Expr\V1alpha1\SourceInfo + */ + public function getSourceInfo() + { + return $this->source_info; + } + + /** + * The source info derived from input that generated the parsed `expr` and + * any optimizations made during the type-checking pass. + * + * Generated from protobuf field .google.api.expr.v1alpha1.SourceInfo source_info = 5; + * @param \Google\Api\Expr\V1alpha1\SourceInfo $var + * @return $this + */ + public function setSourceInfo($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\SourceInfo::class); + $this->source_info = $var; + + return $this; + } + + /** + * The checked expression. Semantically equivalent to the parsed `expr`, but + * may have structural differences. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr expr = 4; + * @return \Google\Api\Expr\V1alpha1\Expr + */ + public function getExpr() + { + return $this->expr; + } + + /** + * The checked expression. Semantically equivalent to the parsed `expr`, but + * may have structural differences. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr expr = 4; + * @param \Google\Api\Expr\V1alpha1\Expr $var + * @return $this + */ + public function setExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr::class); + $this->expr = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Constant.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Constant.php new file mode 100644 index 00000000..f06819f3 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Constant.php @@ -0,0 +1,308 @@ +google.api.expr.v1alpha1.Constant + */ +class Constant extends \Google\Protobuf\Internal\Message +{ + protected $constant_kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $null_value + * null value. + * @type bool $bool_value + * boolean value. + * @type int|string $int64_value + * int64 value. + * @type int|string $uint64_value + * uint64 value. + * @type float $double_value + * double value. + * @type string $string_value + * string value. + * @type string $bytes_value + * bytes value. + * @type \Google\Protobuf\Duration $duration_value + * protobuf.Duration value. + * Deprecated: duration is no longer considered a builtin cel type. + * @type \Google\Protobuf\Timestamp $timestamp_value + * protobuf.Timestamp value. + * Deprecated: timestamp is no longer considered a builtin cel type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Syntax::initOnce(); + parent::__construct($data); + } + + /** + * null value. + * + * Generated from protobuf field .google.protobuf.NullValue null_value = 1; + * @return int + */ + public function getNullValue() + { + return $this->readOneof(1); + } + + /** + * null value. + * + * Generated from protobuf field .google.protobuf.NullValue null_value = 1; + * @param int $var + * @return $this + */ + public function setNullValue($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\NullValue::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * boolean value. + * + * Generated from protobuf field bool bool_value = 2; + * @return bool + */ + public function getBoolValue() + { + return $this->readOneof(2); + } + + /** + * boolean value. + * + * Generated from protobuf field bool bool_value = 2; + * @param bool $var + * @return $this + */ + public function setBoolValue($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * int64 value. + * + * Generated from protobuf field int64 int64_value = 3; + * @return int|string + */ + public function getInt64Value() + { + return $this->readOneof(3); + } + + /** + * int64 value. + * + * Generated from protobuf field int64 int64_value = 3; + * @param int|string $var + * @return $this + */ + public function setInt64Value($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * uint64 value. + * + * Generated from protobuf field uint64 uint64_value = 4; + * @return int|string + */ + public function getUint64Value() + { + return $this->readOneof(4); + } + + /** + * uint64 value. + * + * Generated from protobuf field uint64 uint64_value = 4; + * @param int|string $var + * @return $this + */ + public function setUint64Value($var) + { + GPBUtil::checkUint64($var); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * double value. + * + * Generated from protobuf field double double_value = 5; + * @return float + */ + public function getDoubleValue() + { + return $this->readOneof(5); + } + + /** + * double value. + * + * Generated from protobuf field double double_value = 5; + * @param float $var + * @return $this + */ + public function setDoubleValue($var) + { + GPBUtil::checkDouble($var); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * string value. + * + * Generated from protobuf field string string_value = 6; + * @return string + */ + public function getStringValue() + { + return $this->readOneof(6); + } + + /** + * string value. + * + * Generated from protobuf field string string_value = 6; + * @param string $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * bytes value. + * + * Generated from protobuf field bytes bytes_value = 7; + * @return string + */ + public function getBytesValue() + { + return $this->readOneof(7); + } + + /** + * bytes value. + * + * Generated from protobuf field bytes bytes_value = 7; + * @param string $var + * @return $this + */ + public function setBytesValue($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * protobuf.Duration value. + * Deprecated: duration is no longer considered a builtin cel type. + * + * Generated from protobuf field .google.protobuf.Duration duration_value = 8 [deprecated = true]; + * @return \Google\Protobuf\Duration + */ + public function getDurationValue() + { + return $this->readOneof(8); + } + + /** + * protobuf.Duration value. + * Deprecated: duration is no longer considered a builtin cel type. + * + * Generated from protobuf field .google.protobuf.Duration duration_value = 8 [deprecated = true]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDurationValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * protobuf.Timestamp value. + * Deprecated: timestamp is no longer considered a builtin cel type. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp_value = 9 [deprecated = true]; + * @return \Google\Protobuf\Timestamp + */ + public function getTimestampValue() + { + return $this->readOneof(9); + } + + /** + * protobuf.Timestamp value. + * Deprecated: timestamp is no longer considered a builtin cel type. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp_value = 9 [deprecated = true]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setTimestampValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * @return string + */ + public function getConstantKind() + { + return $this->whichOneof("constant_kind"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl.php new file mode 100644 index 00000000..d47fe820 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl.php @@ -0,0 +1,154 @@ +google.api.expr.v1alpha1.Decl + */ +class Decl extends \Google\Protobuf\Internal\Message +{ + /** + * The fully qualified name of the declaration. + * Declarations are organized in containers and this represents the full path + * to the declaration in its container, as in `google.api.expr.Decl`. + * Declarations used as [FunctionDecl.Overload][google.api.expr.v1alpha1.Decl.FunctionDecl.Overload] parameters may or may not + * have a name depending on whether the overload is function declaration or a + * function definition containing a result [Expr][google.api.expr.v1alpha1.Expr]. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + protected $decl_kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The fully qualified name of the declaration. + * Declarations are organized in containers and this represents the full path + * to the declaration in its container, as in `google.api.expr.Decl`. + * Declarations used as [FunctionDecl.Overload][google.api.expr.v1alpha1.Decl.FunctionDecl.Overload] parameters may or may not + * have a name depending on whether the overload is function declaration or a + * function definition containing a result [Expr][google.api.expr.v1alpha1.Expr]. + * @type \Google\Api\Expr\V1alpha1\Decl\IdentDecl $ident + * Identifier declaration. + * @type \Google\Api\Expr\V1alpha1\Decl\FunctionDecl $function + * Function declaration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Checked::initOnce(); + parent::__construct($data); + } + + /** + * The fully qualified name of the declaration. + * Declarations are organized in containers and this represents the full path + * to the declaration in its container, as in `google.api.expr.Decl`. + * Declarations used as [FunctionDecl.Overload][google.api.expr.v1alpha1.Decl.FunctionDecl.Overload] parameters may or may not + * have a name depending on whether the overload is function declaration or a + * function definition containing a result [Expr][google.api.expr.v1alpha1.Expr]. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The fully qualified name of the declaration. + * Declarations are organized in containers and this represents the full path + * to the declaration in its container, as in `google.api.expr.Decl`. + * Declarations used as [FunctionDecl.Overload][google.api.expr.v1alpha1.Decl.FunctionDecl.Overload] parameters may or may not + * have a name depending on whether the overload is function declaration or a + * function definition containing a result [Expr][google.api.expr.v1alpha1.Expr]. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Identifier declaration. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Decl.IdentDecl ident = 2; + * @return \Google\Api\Expr\V1alpha1\Decl\IdentDecl + */ + public function getIdent() + { + return $this->readOneof(2); + } + + /** + * Identifier declaration. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Decl.IdentDecl ident = 2; + * @param \Google\Api\Expr\V1alpha1\Decl\IdentDecl $var + * @return $this + */ + public function setIdent($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Decl_IdentDecl::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Function declaration. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Decl.FunctionDecl function = 3; + * @return \Google\Api\Expr\V1alpha1\Decl\FunctionDecl + */ + public function getFunction() + { + return $this->readOneof(3); + } + + /** + * Function declaration. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Decl.FunctionDecl function = 3; + * @param \Google\Api\Expr\V1alpha1\Decl\FunctionDecl $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Decl_FunctionDecl::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getDeclKind() + { + return $this->whichOneof("decl_kind"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl/FunctionDecl.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl/FunctionDecl.php new file mode 100644 index 00000000..eedd1a4b --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl/FunctionDecl.php @@ -0,0 +1,74 @@ +google.api.expr.v1alpha1.Decl.FunctionDecl + */ +class FunctionDecl extends \Google\Protobuf\Internal\Message +{ + /** + * Required. List of function overloads, must contain at least one overload. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Decl.FunctionDecl.Overload overloads = 1; + */ + private $overloads; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Decl\FunctionDecl\Overload[]|\Google\Protobuf\Internal\RepeatedField $overloads + * Required. List of function overloads, must contain at least one overload. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Checked::initOnce(); + parent::__construct($data); + } + + /** + * Required. List of function overloads, must contain at least one overload. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Decl.FunctionDecl.Overload overloads = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOverloads() + { + return $this->overloads; + } + + /** + * Required. List of function overloads, must contain at least one overload. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Decl.FunctionDecl.Overload overloads = 1; + * @param \Google\Api\Expr\V1alpha1\Decl\FunctionDecl\Overload[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOverloads($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Decl\FunctionDecl\Overload::class); + $this->overloads = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FunctionDecl::class, \Google\Api\Expr\V1alpha1\Decl_FunctionDecl::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl/FunctionDecl/Overload.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl/FunctionDecl/Overload.php new file mode 100644 index 00000000..fb922015 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl/FunctionDecl/Overload.php @@ -0,0 +1,311 @@ +google.api.expr.v1alpha1.Decl.FunctionDecl.Overload + */ +class Overload extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Globally unique overload name of the function which reflects + * the function name and argument types. + * This will be used by a [Reference][google.api.expr.v1alpha1.Reference] to indicate the `overload_id` that + * was resolved for the function `name`. + * + * Generated from protobuf field string overload_id = 1; + */ + private $overload_id = ''; + /** + * List of function parameter [Type][google.api.expr.v1alpha1.Type] values. + * Param types are disjoint after generic type parameters have been + * replaced with the type `DYN`. Since the `DYN` type is compatible with + * any other type, this means that if `A` is a type parameter, the + * function types `int` and `int` are not disjoint. Likewise, + * `map` is not disjoint from `map`. + * When the `result_type` of a function is a generic type param, the + * type param name also appears as the `type` of on at least one params. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Type params = 2; + */ + private $params; + /** + * The type param names associated with the function declaration. + * For example, `function ex(K key, map map) : V` would yield + * the type params of `K, V`. + * + * Generated from protobuf field repeated string type_params = 3; + */ + private $type_params; + /** + * Required. The result type of the function. For example, the operator + * `string.isEmpty()` would have `result_type` of `kind: BOOL`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type result_type = 4; + */ + private $result_type = null; + /** + * Whether the function is to be used in a method call-style `x.f(...)` + * of a function call-style `f(x, ...)`. + * For methods, the first parameter declaration, `params[0]` is the + * expected type of the target receiver. + * + * Generated from protobuf field bool is_instance_function = 5; + */ + private $is_instance_function = false; + /** + * Documentation string for the overload. + * + * Generated from protobuf field string doc = 6; + */ + private $doc = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $overload_id + * Required. Globally unique overload name of the function which reflects + * the function name and argument types. + * This will be used by a [Reference][google.api.expr.v1alpha1.Reference] to indicate the `overload_id` that + * was resolved for the function `name`. + * @type \Google\Api\Expr\V1alpha1\Type[]|\Google\Protobuf\Internal\RepeatedField $params + * List of function parameter [Type][google.api.expr.v1alpha1.Type] values. + * Param types are disjoint after generic type parameters have been + * replaced with the type `DYN`. Since the `DYN` type is compatible with + * any other type, this means that if `A` is a type parameter, the + * function types `int` and `int` are not disjoint. Likewise, + * `map` is not disjoint from `map`. + * When the `result_type` of a function is a generic type param, the + * type param name also appears as the `type` of on at least one params. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $type_params + * The type param names associated with the function declaration. + * For example, `function ex(K key, map map) : V` would yield + * the type params of `K, V`. + * @type \Google\Api\Expr\V1alpha1\Type $result_type + * Required. The result type of the function. For example, the operator + * `string.isEmpty()` would have `result_type` of `kind: BOOL`. + * @type bool $is_instance_function + * Whether the function is to be used in a method call-style `x.f(...)` + * of a function call-style `f(x, ...)`. + * For methods, the first parameter declaration, `params[0]` is the + * expected type of the target receiver. + * @type string $doc + * Documentation string for the overload. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Checked::initOnce(); + parent::__construct($data); + } + + /** + * Required. Globally unique overload name of the function which reflects + * the function name and argument types. + * This will be used by a [Reference][google.api.expr.v1alpha1.Reference] to indicate the `overload_id` that + * was resolved for the function `name`. + * + * Generated from protobuf field string overload_id = 1; + * @return string + */ + public function getOverloadId() + { + return $this->overload_id; + } + + /** + * Required. Globally unique overload name of the function which reflects + * the function name and argument types. + * This will be used by a [Reference][google.api.expr.v1alpha1.Reference] to indicate the `overload_id` that + * was resolved for the function `name`. + * + * Generated from protobuf field string overload_id = 1; + * @param string $var + * @return $this + */ + public function setOverloadId($var) + { + GPBUtil::checkString($var, True); + $this->overload_id = $var; + + return $this; + } + + /** + * List of function parameter [Type][google.api.expr.v1alpha1.Type] values. + * Param types are disjoint after generic type parameters have been + * replaced with the type `DYN`. Since the `DYN` type is compatible with + * any other type, this means that if `A` is a type parameter, the + * function types `int` and `int` are not disjoint. Likewise, + * `map` is not disjoint from `map`. + * When the `result_type` of a function is a generic type param, the + * type param name also appears as the `type` of on at least one params. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Type params = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParams() + { + return $this->params; + } + + /** + * List of function parameter [Type][google.api.expr.v1alpha1.Type] values. + * Param types are disjoint after generic type parameters have been + * replaced with the type `DYN`. Since the `DYN` type is compatible with + * any other type, this means that if `A` is a type parameter, the + * function types `int` and `int` are not disjoint. Likewise, + * `map` is not disjoint from `map`. + * When the `result_type` of a function is a generic type param, the + * type param name also appears as the `type` of on at least one params. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Type params = 2; + * @param \Google\Api\Expr\V1alpha1\Type[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Type::class); + $this->params = $arr; + + return $this; + } + + /** + * The type param names associated with the function declaration. + * For example, `function ex(K key, map map) : V` would yield + * the type params of `K, V`. + * + * Generated from protobuf field repeated string type_params = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTypeParams() + { + return $this->type_params; + } + + /** + * The type param names associated with the function declaration. + * For example, `function ex(K key, map map) : V` would yield + * the type params of `K, V`. + * + * Generated from protobuf field repeated string type_params = 3; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTypeParams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->type_params = $arr; + + return $this; + } + + /** + * Required. The result type of the function. For example, the operator + * `string.isEmpty()` would have `result_type` of `kind: BOOL`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type result_type = 4; + * @return \Google\Api\Expr\V1alpha1\Type + */ + public function getResultType() + { + return $this->result_type; + } + + /** + * Required. The result type of the function. For example, the operator + * `string.isEmpty()` would have `result_type` of `kind: BOOL`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type result_type = 4; + * @param \Google\Api\Expr\V1alpha1\Type $var + * @return $this + */ + public function setResultType($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Type::class); + $this->result_type = $var; + + return $this; + } + + /** + * Whether the function is to be used in a method call-style `x.f(...)` + * of a function call-style `f(x, ...)`. + * For methods, the first parameter declaration, `params[0]` is the + * expected type of the target receiver. + * + * Generated from protobuf field bool is_instance_function = 5; + * @return bool + */ + public function getIsInstanceFunction() + { + return $this->is_instance_function; + } + + /** + * Whether the function is to be used in a method call-style `x.f(...)` + * of a function call-style `f(x, ...)`. + * For methods, the first parameter declaration, `params[0]` is the + * expected type of the target receiver. + * + * Generated from protobuf field bool is_instance_function = 5; + * @param bool $var + * @return $this + */ + public function setIsInstanceFunction($var) + { + GPBUtil::checkBool($var); + $this->is_instance_function = $var; + + return $this; + } + + /** + * Documentation string for the overload. + * + * Generated from protobuf field string doc = 6; + * @return string + */ + public function getDoc() + { + return $this->doc; + } + + /** + * Documentation string for the overload. + * + * Generated from protobuf field string doc = 6; + * @param string $var + * @return $this + */ + public function setDoc($var) + { + GPBUtil::checkString($var, True); + $this->doc = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Overload::class, \Google\Api\Expr\V1alpha1\Decl_FunctionDecl_Overload::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl/IdentDecl.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl/IdentDecl.php new file mode 100644 index 00000000..a18fd30d --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl/IdentDecl.php @@ -0,0 +1,146 @@ +google.api.expr.v1alpha1.Decl.IdentDecl + */ +class IdentDecl extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The type of the identifier. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type type = 1; + */ + private $type = null; + /** + * The constant value of the identifier. If not specified, the identifier + * must be supplied at evaluation time. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Constant value = 2; + */ + private $value = null; + /** + * Documentation string for the identifier. + * + * Generated from protobuf field string doc = 3; + */ + private $doc = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Type $type + * Required. The type of the identifier. + * @type \Google\Api\Expr\V1alpha1\Constant $value + * The constant value of the identifier. If not specified, the identifier + * must be supplied at evaluation time. + * @type string $doc + * Documentation string for the identifier. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Checked::initOnce(); + parent::__construct($data); + } + + /** + * Required. The type of the identifier. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type type = 1; + * @return \Google\Api\Expr\V1alpha1\Type + */ + public function getType() + { + return $this->type; + } + + /** + * Required. The type of the identifier. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type type = 1; + * @param \Google\Api\Expr\V1alpha1\Type $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Type::class); + $this->type = $var; + + return $this; + } + + /** + * The constant value of the identifier. If not specified, the identifier + * must be supplied at evaluation time. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Constant value = 2; + * @return \Google\Api\Expr\V1alpha1\Constant + */ + public function getValue() + { + return $this->value; + } + + /** + * The constant value of the identifier. If not specified, the identifier + * must be supplied at evaluation time. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Constant value = 2; + * @param \Google\Api\Expr\V1alpha1\Constant $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Constant::class); + $this->value = $var; + + return $this; + } + + /** + * Documentation string for the identifier. + * + * Generated from protobuf field string doc = 3; + * @return string + */ + public function getDoc() + { + return $this->doc; + } + + /** + * Documentation string for the identifier. + * + * Generated from protobuf field string doc = 3; + * @param string $var + * @return $this + */ + public function setDoc($var) + { + GPBUtil::checkString($var, True); + $this->doc = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IdentDecl::class, \Google\Api\Expr\V1alpha1\Decl_IdentDecl::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl_FunctionDecl.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl_FunctionDecl.php new file mode 100644 index 00000000..eadfb381 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Decl_FunctionDecl.php @@ -0,0 +1,16 @@ +google.api.expr.v1alpha1.EnumValue + */ +class EnumValue extends \Google\Protobuf\Internal\Message +{ + /** + * The fully qualified name of the enum type. + * + * Generated from protobuf field string type = 1; + */ + private $type = ''; + /** + * The value of the enum. + * + * Generated from protobuf field int32 value = 2; + */ + private $value = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * The fully qualified name of the enum type. + * @type int $value + * The value of the enum. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Value::initOnce(); + parent::__construct($data); + } + + /** + * The fully qualified name of the enum type. + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The fully qualified name of the enum type. + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The value of the enum. + * + * Generated from protobuf field int32 value = 2; + * @return int + */ + public function getValue() + { + return $this->value; + } + + /** + * The value of the enum. + * + * Generated from protobuf field int32 value = 2; + * @param int $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkInt32($var); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/ErrorSet.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/ErrorSet.php new file mode 100644 index 00000000..7bfbbf92 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/ErrorSet.php @@ -0,0 +1,68 @@ +google.api.expr.v1alpha1.ErrorSet + */ +class ErrorSet extends \Google\Protobuf\Internal\Message +{ + /** + * The errors in the set. + * + * Generated from protobuf field repeated .google.rpc.Status errors = 1; + */ + private $errors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $errors + * The errors in the set. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\PBEval::initOnce(); + parent::__construct($data); + } + + /** + * The errors in the set. + * + * Generated from protobuf field repeated .google.rpc.Status errors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrors() + { + return $this->errors; + } + + /** + * The errors in the set. + * + * Generated from protobuf field repeated .google.rpc.Status errors = 1; + * @param \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->errors = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalRequest.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalRequest.php new file mode 100644 index 00000000..c3e8b24c --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalRequest.php @@ -0,0 +1,170 @@ +google.api.expr.v1alpha1.EvalRequest + */ +class EvalRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Bindings for the external variables. The types SHOULD be compatible + * with the type environment in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked. + * + * Generated from protobuf field map bindings = 3; + */ + private $bindings; + /** + * SHOULD be the same container as used in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked. + * + * Generated from protobuf field string container = 4; + */ + private $container = ''; + protected $expr_kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\ParsedExpr $parsed_expr + * Evaluate based on the parsed representation. + * @type \Google\Api\Expr\V1alpha1\CheckedExpr $checked_expr + * Evaluate based on the checked representation. + * @type array|\Google\Protobuf\Internal\MapField $bindings + * Bindings for the external variables. The types SHOULD be compatible + * with the type environment in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked. + * @type string $container + * SHOULD be the same container as used in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\ConformanceService::initOnce(); + parent::__construct($data); + } + + /** + * Evaluate based on the parsed representation. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1; + * @return \Google\Api\Expr\V1alpha1\ParsedExpr + */ + public function getParsedExpr() + { + return $this->readOneof(1); + } + + /** + * Evaluate based on the parsed representation. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1; + * @param \Google\Api\Expr\V1alpha1\ParsedExpr $var + * @return $this + */ + public function setParsedExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\ParsedExpr::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Evaluate based on the checked representation. + * + * Generated from protobuf field .google.api.expr.v1alpha1.CheckedExpr checked_expr = 2; + * @return \Google\Api\Expr\V1alpha1\CheckedExpr + */ + public function getCheckedExpr() + { + return $this->readOneof(2); + } + + /** + * Evaluate based on the checked representation. + * + * Generated from protobuf field .google.api.expr.v1alpha1.CheckedExpr checked_expr = 2; + * @param \Google\Api\Expr\V1alpha1\CheckedExpr $var + * @return $this + */ + public function setCheckedExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\CheckedExpr::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Bindings for the external variables. The types SHOULD be compatible + * with the type environment in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked. + * + * Generated from protobuf field map bindings = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getBindings() + { + return $this->bindings; + } + + /** + * Bindings for the external variables. The types SHOULD be compatible + * with the type environment in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked. + * + * Generated from protobuf field map bindings = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setBindings($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\ExprValue::class); + $this->bindings = $arr; + + return $this; + } + + /** + * SHOULD be the same container as used in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked. + * + * Generated from protobuf field string container = 4; + * @return string + */ + public function getContainer() + { + return $this->container; + } + + /** + * SHOULD be the same container as used in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked. + * + * Generated from protobuf field string container = 4; + * @param string $var + * @return $this + */ + public function setContainer($var) + { + GPBUtil::checkString($var, True); + $this->container = $var; + + return $this; + } + + /** + * @return string + */ + public function getExprKind() + { + return $this->whichOneof("expr_kind"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalResponse.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalResponse.php new file mode 100644 index 00000000..98f56086 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalResponse.php @@ -0,0 +1,113 @@ +google.api.expr.v1alpha1.EvalResponse + */ +class EvalResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The execution result, or unset if execution couldn't start. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ExprValue result = 1; + */ + private $result = null; + /** + * Any number of issues with [StatusDetails][] as the details. + * Note that CEL execution errors are reified into [ExprValue][google.api.expr.v1alpha1.ExprValue]. + * Nevertheless, we'll allow out-of-band issues to be raised, + * which also makes the replies more regular. + * + * Generated from protobuf field repeated .google.rpc.Status issues = 2; + */ + private $issues; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\ExprValue $result + * The execution result, or unset if execution couldn't start. + * @type \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $issues + * Any number of issues with [StatusDetails][] as the details. + * Note that CEL execution errors are reified into [ExprValue][google.api.expr.v1alpha1.ExprValue]. + * Nevertheless, we'll allow out-of-band issues to be raised, + * which also makes the replies more regular. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\ConformanceService::initOnce(); + parent::__construct($data); + } + + /** + * The execution result, or unset if execution couldn't start. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ExprValue result = 1; + * @return \Google\Api\Expr\V1alpha1\ExprValue + */ + public function getResult() + { + return $this->result; + } + + /** + * The execution result, or unset if execution couldn't start. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ExprValue result = 1; + * @param \Google\Api\Expr\V1alpha1\ExprValue $var + * @return $this + */ + public function setResult($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\ExprValue::class); + $this->result = $var; + + return $this; + } + + /** + * Any number of issues with [StatusDetails][] as the details. + * Note that CEL execution errors are reified into [ExprValue][google.api.expr.v1alpha1.ExprValue]. + * Nevertheless, we'll allow out-of-band issues to be raised, + * which also makes the replies more regular. + * + * Generated from protobuf field repeated .google.rpc.Status issues = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIssues() + { + return $this->issues; + } + + /** + * Any number of issues with [StatusDetails][] as the details. + * Note that CEL execution errors are reified into [ExprValue][google.api.expr.v1alpha1.ExprValue]. + * Nevertheless, we'll allow out-of-band issues to be raised, + * which also makes the replies more regular. + * + * Generated from protobuf field repeated .google.rpc.Status issues = 2; + * @param \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIssues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->issues = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalState.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalState.php new file mode 100644 index 00000000..55d68c95 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalState.php @@ -0,0 +1,110 @@ +google.api.expr.v1alpha1.EvalState + */ +class EvalState extends \Google\Protobuf\Internal\Message +{ + /** + * The unique values referenced in this message. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.ExprValue values = 1; + */ + private $values; + /** + * An ordered list of results. + * Tracks the flow of evaluation through the expression. + * May be sparse. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.EvalState.Result results = 3; + */ + private $results; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\ExprValue[]|\Google\Protobuf\Internal\RepeatedField $values + * The unique values referenced in this message. + * @type \Google\Api\Expr\V1alpha1\EvalState\Result[]|\Google\Protobuf\Internal\RepeatedField $results + * An ordered list of results. + * Tracks the flow of evaluation through the expression. + * May be sparse. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\PBEval::initOnce(); + parent::__construct($data); + } + + /** + * The unique values referenced in this message. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.ExprValue values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * The unique values referenced in this message. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.ExprValue values = 1; + * @param \Google\Api\Expr\V1alpha1\ExprValue[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\ExprValue::class); + $this->values = $arr; + + return $this; + } + + /** + * An ordered list of results. + * Tracks the flow of evaluation through the expression. + * May be sparse. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.EvalState.Result results = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResults() + { + return $this->results; + } + + /** + * An ordered list of results. + * Tracks the flow of evaluation through the expression. + * May be sparse. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.EvalState.Result results = 3; + * @param \Google\Api\Expr\V1alpha1\EvalState\Result[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\EvalState\Result::class); + $this->results = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalState/Result.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalState/Result.php new file mode 100644 index 00000000..037ba80d --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalState/Result.php @@ -0,0 +1,104 @@ +google.api.expr.v1alpha1.EvalState.Result + */ +class Result extends \Google\Protobuf\Internal\Message +{ + /** + * The id of the expression this result if for. + * + * Generated from protobuf field int64 expr = 1; + */ + private $expr = 0; + /** + * The index in `values` of the resulting value. + * + * Generated from protobuf field int64 value = 2; + */ + private $value = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $expr + * The id of the expression this result if for. + * @type int|string $value + * The index in `values` of the resulting value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\PBEval::initOnce(); + parent::__construct($data); + } + + /** + * The id of the expression this result if for. + * + * Generated from protobuf field int64 expr = 1; + * @return int|string + */ + public function getExpr() + { + return $this->expr; + } + + /** + * The id of the expression this result if for. + * + * Generated from protobuf field int64 expr = 1; + * @param int|string $var + * @return $this + */ + public function setExpr($var) + { + GPBUtil::checkInt64($var); + $this->expr = $var; + + return $this; + } + + /** + * The index in `values` of the resulting value. + * + * Generated from protobuf field int64 value = 2; + * @return int|string + */ + public function getValue() + { + return $this->value; + } + + /** + * The index in `values` of the resulting value. + * + * Generated from protobuf field int64 value = 2; + * @param int|string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkInt64($var); + $this->value = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Result::class, \Google\Api\Expr\V1alpha1\EvalState_Result::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalState_Result.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalState_Result.php new file mode 100644 index 00000000..16f94c41 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/EvalState_Result.php @@ -0,0 +1,16 @@ +google.api.expr.v1alpha1.Explain + */ +class Explain extends \Google\Protobuf\Internal\Message +{ + /** + * All of the observed values. + * The field value_index is an index in the values list. + * Separating values from steps is needed to remove redundant values. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Value values = 1; + */ + private $values; + /** + * List of steps. + * Repeated evaluations of the same expression generate new ExprStep + * instances. The order of such ExprStep instances matches the order of + * elements returned by Comprehension.iter_range. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Explain.ExprStep expr_steps = 2; + */ + private $expr_steps; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Value[]|\Google\Protobuf\Internal\RepeatedField $values + * All of the observed values. + * The field value_index is an index in the values list. + * Separating values from steps is needed to remove redundant values. + * @type \Google\Api\Expr\V1alpha1\Explain\ExprStep[]|\Google\Protobuf\Internal\RepeatedField $expr_steps + * List of steps. + * Repeated evaluations of the same expression generate new ExprStep + * instances. The order of such ExprStep instances matches the order of + * elements returned by Comprehension.iter_range. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Explain::initOnce(); + parent::__construct($data); + } + + /** + * All of the observed values. + * The field value_index is an index in the values list. + * Separating values from steps is needed to remove redundant values. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Value values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * All of the observed values. + * The field value_index is an index in the values list. + * Separating values from steps is needed to remove redundant values. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Value values = 1; + * @param \Google\Api\Expr\V1alpha1\Value[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Value::class); + $this->values = $arr; + + return $this; + } + + /** + * List of steps. + * Repeated evaluations of the same expression generate new ExprStep + * instances. The order of such ExprStep instances matches the order of + * elements returned by Comprehension.iter_range. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Explain.ExprStep expr_steps = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExprSteps() + { + return $this->expr_steps; + } + + /** + * List of steps. + * Repeated evaluations of the same expression generate new ExprStep + * instances. The order of such ExprStep instances matches the order of + * elements returned by Comprehension.iter_range. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Explain.ExprStep expr_steps = 2; + * @param \Google\Api\Expr\V1alpha1\Explain\ExprStep[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExprSteps($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Explain\ExprStep::class); + $this->expr_steps = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Explain/ExprStep.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Explain/ExprStep.php new file mode 100644 index 00000000..843ad4f0 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Explain/ExprStep.php @@ -0,0 +1,104 @@ +google.api.expr.v1alpha1.Explain.ExprStep + */ +class ExprStep extends \Google\Protobuf\Internal\Message +{ + /** + * ID of corresponding Expr node. + * + * Generated from protobuf field int64 id = 1; + */ + private $id = 0; + /** + * Index of the value in the values list. + * + * Generated from protobuf field int32 value_index = 2; + */ + private $value_index = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $id + * ID of corresponding Expr node. + * @type int $value_index + * Index of the value in the values list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Explain::initOnce(); + parent::__construct($data); + } + + /** + * ID of corresponding Expr node. + * + * Generated from protobuf field int64 id = 1; + * @return int|string + */ + public function getId() + { + return $this->id; + } + + /** + * ID of corresponding Expr node. + * + * Generated from protobuf field int64 id = 1; + * @param int|string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkInt64($var); + $this->id = $var; + + return $this; + } + + /** + * Index of the value in the values list. + * + * Generated from protobuf field int32 value_index = 2; + * @return int + */ + public function getValueIndex() + { + return $this->value_index; + } + + /** + * Index of the value in the values list. + * + * Generated from protobuf field int32 value_index = 2; + * @param int $var + * @return $this + */ + public function setValueIndex($var) + { + GPBUtil::checkInt32($var); + $this->value_index = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ExprStep::class, \Google\Api\Expr\V1alpha1\Explain_ExprStep::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Explain_ExprStep.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Explain_ExprStep.php new file mode 100644 index 00000000..181daf62 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Explain_ExprStep.php @@ -0,0 +1,16 @@ +google.api.expr.v1alpha1.Expr + */ +class Expr extends \Google\Protobuf\Internal\Message +{ + /** + * Required. An id assigned to this node by the parser which is unique in a + * given expression tree. This is used to associate type information and other + * attributes to a node in the parse tree. + * + * Generated from protobuf field int64 id = 2; + */ + private $id = 0; + protected $expr_kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $id + * Required. An id assigned to this node by the parser which is unique in a + * given expression tree. This is used to associate type information and other + * attributes to a node in the parse tree. + * @type \Google\Api\Expr\V1alpha1\Constant $const_expr + * A literal expression. + * @type \Google\Api\Expr\V1alpha1\Expr\Ident $ident_expr + * An identifier expression. + * @type \Google\Api\Expr\V1alpha1\Expr\Select $select_expr + * A field selection expression, e.g. `request.auth`. + * @type \Google\Api\Expr\V1alpha1\Expr\Call $call_expr + * A call expression, including calls to predefined functions and operators. + * @type \Google\Api\Expr\V1alpha1\Expr\CreateList $list_expr + * A list creation expression. + * @type \Google\Api\Expr\V1alpha1\Expr\CreateStruct $struct_expr + * A map or message creation expression. + * @type \Google\Api\Expr\V1alpha1\Expr\Comprehension $comprehension_expr + * A comprehension expression. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Syntax::initOnce(); + parent::__construct($data); + } + + /** + * Required. An id assigned to this node by the parser which is unique in a + * given expression tree. This is used to associate type information and other + * attributes to a node in the parse tree. + * + * Generated from protobuf field int64 id = 2; + * @return int|string + */ + public function getId() + { + return $this->id; + } + + /** + * Required. An id assigned to this node by the parser which is unique in a + * given expression tree. This is used to associate type information and other + * attributes to a node in the parse tree. + * + * Generated from protobuf field int64 id = 2; + * @param int|string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkInt64($var); + $this->id = $var; + + return $this; + } + + /** + * A literal expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Constant const_expr = 3; + * @return \Google\Api\Expr\V1alpha1\Constant + */ + public function getConstExpr() + { + return $this->readOneof(3); + } + + /** + * A literal expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Constant const_expr = 3; + * @param \Google\Api\Expr\V1alpha1\Constant $var + * @return $this + */ + public function setConstExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Constant::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * An identifier expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr.Ident ident_expr = 4; + * @return \Google\Api\Expr\V1alpha1\Expr\Ident + */ + public function getIdentExpr() + { + return $this->readOneof(4); + } + + /** + * An identifier expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr.Ident ident_expr = 4; + * @param \Google\Api\Expr\V1alpha1\Expr\Ident $var + * @return $this + */ + public function setIdentExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr_Ident::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * A field selection expression, e.g. `request.auth`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr.Select select_expr = 5; + * @return \Google\Api\Expr\V1alpha1\Expr\Select + */ + public function getSelectExpr() + { + return $this->readOneof(5); + } + + /** + * A field selection expression, e.g. `request.auth`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr.Select select_expr = 5; + * @param \Google\Api\Expr\V1alpha1\Expr\Select $var + * @return $this + */ + public function setSelectExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr_Select::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * A call expression, including calls to predefined functions and operators. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr.Call call_expr = 6; + * @return \Google\Api\Expr\V1alpha1\Expr\Call + */ + public function getCallExpr() + { + return $this->readOneof(6); + } + + /** + * A call expression, including calls to predefined functions and operators. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr.Call call_expr = 6; + * @param \Google\Api\Expr\V1alpha1\Expr\Call $var + * @return $this + */ + public function setCallExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr_Call::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * A list creation expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr.CreateList list_expr = 7; + * @return \Google\Api\Expr\V1alpha1\Expr\CreateList + */ + public function getListExpr() + { + return $this->readOneof(7); + } + + /** + * A list creation expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr.CreateList list_expr = 7; + * @param \Google\Api\Expr\V1alpha1\Expr\CreateList $var + * @return $this + */ + public function setListExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr_CreateList::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * A map or message creation expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr.CreateStruct struct_expr = 8; + * @return \Google\Api\Expr\V1alpha1\Expr\CreateStruct + */ + public function getStructExpr() + { + return $this->readOneof(8); + } + + /** + * A map or message creation expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr.CreateStruct struct_expr = 8; + * @param \Google\Api\Expr\V1alpha1\Expr\CreateStruct $var + * @return $this + */ + public function setStructExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr_CreateStruct::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * A comprehension expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr.Comprehension comprehension_expr = 9; + * @return \Google\Api\Expr\V1alpha1\Expr\Comprehension + */ + public function getComprehensionExpr() + { + return $this->readOneof(9); + } + + /** + * A comprehension expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr.Comprehension comprehension_expr = 9; + * @param \Google\Api\Expr\V1alpha1\Expr\Comprehension $var + * @return $this + */ + public function setComprehensionExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr_Comprehension::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * @return string + */ + public function getExprKind() + { + return $this->whichOneof("expr_kind"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/Call.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/Call.php new file mode 100644 index 00000000..0b02be32 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/Call.php @@ -0,0 +1,143 @@ +google.api.expr.v1alpha1.Expr.Call + */ +class Call extends \Google\Protobuf\Internal\Message +{ + /** + * The target of an method call-style expression. For example, `x` in + * `x.f()`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr target = 1; + */ + private $target = null; + /** + * Required. The name of the function or method being called. + * + * Generated from protobuf field string function = 2; + */ + private $function = ''; + /** + * The arguments. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Expr args = 3; + */ + private $args; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Expr $target + * The target of an method call-style expression. For example, `x` in + * `x.f()`. + * @type string $function + * Required. The name of the function or method being called. + * @type \Google\Api\Expr\V1alpha1\Expr[]|\Google\Protobuf\Internal\RepeatedField $args + * The arguments. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Syntax::initOnce(); + parent::__construct($data); + } + + /** + * The target of an method call-style expression. For example, `x` in + * `x.f()`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr target = 1; + * @return \Google\Api\Expr\V1alpha1\Expr + */ + public function getTarget() + { + return $this->target; + } + + /** + * The target of an method call-style expression. For example, `x` in + * `x.f()`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr target = 1; + * @param \Google\Api\Expr\V1alpha1\Expr $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr::class); + $this->target = $var; + + return $this; + } + + /** + * Required. The name of the function or method being called. + * + * Generated from protobuf field string function = 2; + * @return string + */ + public function getFunction() + { + return $this->function; + } + + /** + * Required. The name of the function or method being called. + * + * Generated from protobuf field string function = 2; + * @param string $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkString($var, True); + $this->function = $var; + + return $this; + } + + /** + * The arguments. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Expr args = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getArgs() + { + return $this->args; + } + + /** + * The arguments. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Expr args = 3; + * @param \Google\Api\Expr\V1alpha1\Expr[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setArgs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Expr::class); + $this->args = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Call::class, \Google\Api\Expr\V1alpha1\Expr_Call::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/Comprehension.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/Comprehension.php new file mode 100644 index 00000000..b86e4ac4 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/Comprehension.php @@ -0,0 +1,310 @@ + 1000)`. + * * `map` - apply an expression to all elements in the input and return the + * output aggregate type: `[1, 2, 3].map(i, i * i)`. + * The `has(m.x)` macro tests whether the property `x` is present in struct + * `m`. The semantics of this macro depend on the type of `m`. For proto2 + * messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the + * macro tests whether the property is set to its default. For map and struct + * types, the macro tests whether the property `x` is defined on `m`. + * + * Generated from protobuf message google.api.expr.v1alpha1.Expr.Comprehension + */ +class Comprehension extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the iteration variable. + * + * Generated from protobuf field string iter_var = 1; + */ + private $iter_var = ''; + /** + * The range over which var iterates. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr iter_range = 2; + */ + private $iter_range = null; + /** + * The name of the variable used for accumulation of the result. + * + * Generated from protobuf field string accu_var = 3; + */ + private $accu_var = ''; + /** + * The initial value of the accumulator. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr accu_init = 4; + */ + private $accu_init = null; + /** + * An expression which can contain iter_var and accu_var. + * Returns false when the result has been computed and may be used as + * a hint to short-circuit the remainder of the comprehension. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr loop_condition = 5; + */ + private $loop_condition = null; + /** + * An expression which can contain iter_var and accu_var. + * Computes the next value of accu_var. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr loop_step = 6; + */ + private $loop_step = null; + /** + * An expression which can contain accu_var. + * Computes the result. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr result = 7; + */ + private $result = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $iter_var + * The name of the iteration variable. + * @type \Google\Api\Expr\V1alpha1\Expr $iter_range + * The range over which var iterates. + * @type string $accu_var + * The name of the variable used for accumulation of the result. + * @type \Google\Api\Expr\V1alpha1\Expr $accu_init + * The initial value of the accumulator. + * @type \Google\Api\Expr\V1alpha1\Expr $loop_condition + * An expression which can contain iter_var and accu_var. + * Returns false when the result has been computed and may be used as + * a hint to short-circuit the remainder of the comprehension. + * @type \Google\Api\Expr\V1alpha1\Expr $loop_step + * An expression which can contain iter_var and accu_var. + * Computes the next value of accu_var. + * @type \Google\Api\Expr\V1alpha1\Expr $result + * An expression which can contain accu_var. + * Computes the result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Syntax::initOnce(); + parent::__construct($data); + } + + /** + * The name of the iteration variable. + * + * Generated from protobuf field string iter_var = 1; + * @return string + */ + public function getIterVar() + { + return $this->iter_var; + } + + /** + * The name of the iteration variable. + * + * Generated from protobuf field string iter_var = 1; + * @param string $var + * @return $this + */ + public function setIterVar($var) + { + GPBUtil::checkString($var, True); + $this->iter_var = $var; + + return $this; + } + + /** + * The range over which var iterates. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr iter_range = 2; + * @return \Google\Api\Expr\V1alpha1\Expr + */ + public function getIterRange() + { + return $this->iter_range; + } + + /** + * The range over which var iterates. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr iter_range = 2; + * @param \Google\Api\Expr\V1alpha1\Expr $var + * @return $this + */ + public function setIterRange($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr::class); + $this->iter_range = $var; + + return $this; + } + + /** + * The name of the variable used for accumulation of the result. + * + * Generated from protobuf field string accu_var = 3; + * @return string + */ + public function getAccuVar() + { + return $this->accu_var; + } + + /** + * The name of the variable used for accumulation of the result. + * + * Generated from protobuf field string accu_var = 3; + * @param string $var + * @return $this + */ + public function setAccuVar($var) + { + GPBUtil::checkString($var, True); + $this->accu_var = $var; + + return $this; + } + + /** + * The initial value of the accumulator. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr accu_init = 4; + * @return \Google\Api\Expr\V1alpha1\Expr + */ + public function getAccuInit() + { + return $this->accu_init; + } + + /** + * The initial value of the accumulator. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr accu_init = 4; + * @param \Google\Api\Expr\V1alpha1\Expr $var + * @return $this + */ + public function setAccuInit($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr::class); + $this->accu_init = $var; + + return $this; + } + + /** + * An expression which can contain iter_var and accu_var. + * Returns false when the result has been computed and may be used as + * a hint to short-circuit the remainder of the comprehension. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr loop_condition = 5; + * @return \Google\Api\Expr\V1alpha1\Expr + */ + public function getLoopCondition() + { + return $this->loop_condition; + } + + /** + * An expression which can contain iter_var and accu_var. + * Returns false when the result has been computed and may be used as + * a hint to short-circuit the remainder of the comprehension. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr loop_condition = 5; + * @param \Google\Api\Expr\V1alpha1\Expr $var + * @return $this + */ + public function setLoopCondition($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr::class); + $this->loop_condition = $var; + + return $this; + } + + /** + * An expression which can contain iter_var and accu_var. + * Computes the next value of accu_var. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr loop_step = 6; + * @return \Google\Api\Expr\V1alpha1\Expr + */ + public function getLoopStep() + { + return $this->loop_step; + } + + /** + * An expression which can contain iter_var and accu_var. + * Computes the next value of accu_var. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr loop_step = 6; + * @param \Google\Api\Expr\V1alpha1\Expr $var + * @return $this + */ + public function setLoopStep($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr::class); + $this->loop_step = $var; + + return $this; + } + + /** + * An expression which can contain accu_var. + * Computes the result. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr result = 7; + * @return \Google\Api\Expr\V1alpha1\Expr + */ + public function getResult() + { + return $this->result; + } + + /** + * An expression which can contain accu_var. + * Computes the result. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr result = 7; + * @param \Google\Api\Expr\V1alpha1\Expr $var + * @return $this + */ + public function setResult($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr::class); + $this->result = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Comprehension::class, \Google\Api\Expr\V1alpha1\Expr_Comprehension::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/CreateList.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/CreateList.php new file mode 100644 index 00000000..644f60f9 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/CreateList.php @@ -0,0 +1,72 @@ +google.api.expr.v1alpha1.Expr.CreateList + */ +class CreateList extends \Google\Protobuf\Internal\Message +{ + /** + * The elements part of the list. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Expr elements = 1; + */ + private $elements; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Expr[]|\Google\Protobuf\Internal\RepeatedField $elements + * The elements part of the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Syntax::initOnce(); + parent::__construct($data); + } + + /** + * The elements part of the list. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Expr elements = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getElements() + { + return $this->elements; + } + + /** + * The elements part of the list. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Expr elements = 1; + * @param \Google\Api\Expr\V1alpha1\Expr[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setElements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Expr::class); + $this->elements = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CreateList::class, \Google\Api\Expr\V1alpha1\Expr_CreateList::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/CreateStruct.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/CreateStruct.php new file mode 100644 index 00000000..78b1d212 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/CreateStruct.php @@ -0,0 +1,111 @@ +google.api.expr.v1alpha1.Expr.CreateStruct + */ +class CreateStruct extends \Google\Protobuf\Internal\Message +{ + /** + * The type name of the message to be created, empty when creating map + * literals. + * + * Generated from protobuf field string message_name = 1; + */ + private $message_name = ''; + /** + * The entries in the creation expression. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Expr.CreateStruct.Entry entries = 2; + */ + private $entries; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message_name + * The type name of the message to be created, empty when creating map + * literals. + * @type \Google\Api\Expr\V1alpha1\Expr\CreateStruct\Entry[]|\Google\Protobuf\Internal\RepeatedField $entries + * The entries in the creation expression. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Syntax::initOnce(); + parent::__construct($data); + } + + /** + * The type name of the message to be created, empty when creating map + * literals. + * + * Generated from protobuf field string message_name = 1; + * @return string + */ + public function getMessageName() + { + return $this->message_name; + } + + /** + * The type name of the message to be created, empty when creating map + * literals. + * + * Generated from protobuf field string message_name = 1; + * @param string $var + * @return $this + */ + public function setMessageName($var) + { + GPBUtil::checkString($var, True); + $this->message_name = $var; + + return $this; + } + + /** + * The entries in the creation expression. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Expr.CreateStruct.Entry entries = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntries() + { + return $this->entries; + } + + /** + * The entries in the creation expression. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Expr.CreateStruct.Entry entries = 2; + * @param \Google\Api\Expr\V1alpha1\Expr\CreateStruct\Entry[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Expr\CreateStruct\Entry::class); + $this->entries = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CreateStruct::class, \Google\Api\Expr\V1alpha1\Expr_CreateStruct::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/CreateStruct/Entry.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/CreateStruct/Entry.php new file mode 100644 index 00000000..53b81d4a --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/CreateStruct/Entry.php @@ -0,0 +1,177 @@ +google.api.expr.v1alpha1.Expr.CreateStruct.Entry + */ +class Entry extends \Google\Protobuf\Internal\Message +{ + /** + * Required. An id assigned to this node by the parser which is unique + * in a given expression tree. This is used to associate type + * information and other attributes to the node. + * + * Generated from protobuf field int64 id = 1; + */ + private $id = 0; + /** + * Required. The value assigned to the key. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr value = 4; + */ + private $value = null; + protected $key_kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $id + * Required. An id assigned to this node by the parser which is unique + * in a given expression tree. This is used to associate type + * information and other attributes to the node. + * @type string $field_key + * The field key for a message creator statement. + * @type \Google\Api\Expr\V1alpha1\Expr $map_key + * The key expression for a map creation statement. + * @type \Google\Api\Expr\V1alpha1\Expr $value + * Required. The value assigned to the key. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Syntax::initOnce(); + parent::__construct($data); + } + + /** + * Required. An id assigned to this node by the parser which is unique + * in a given expression tree. This is used to associate type + * information and other attributes to the node. + * + * Generated from protobuf field int64 id = 1; + * @return int|string + */ + public function getId() + { + return $this->id; + } + + /** + * Required. An id assigned to this node by the parser which is unique + * in a given expression tree. This is used to associate type + * information and other attributes to the node. + * + * Generated from protobuf field int64 id = 1; + * @param int|string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkInt64($var); + $this->id = $var; + + return $this; + } + + /** + * The field key for a message creator statement. + * + * Generated from protobuf field string field_key = 2; + * @return string + */ + public function getFieldKey() + { + return $this->readOneof(2); + } + + /** + * The field key for a message creator statement. + * + * Generated from protobuf field string field_key = 2; + * @param string $var + * @return $this + */ + public function setFieldKey($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The key expression for a map creation statement. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr map_key = 3; + * @return \Google\Api\Expr\V1alpha1\Expr + */ + public function getMapKey() + { + return $this->readOneof(3); + } + + /** + * The key expression for a map creation statement. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr map_key = 3; + * @param \Google\Api\Expr\V1alpha1\Expr $var + * @return $this + */ + public function setMapKey($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Required. The value assigned to the key. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr value = 4; + * @return \Google\Api\Expr\V1alpha1\Expr + */ + public function getValue() + { + return $this->value; + } + + /** + * Required. The value assigned to the key. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr value = 4; + * @param \Google\Api\Expr\V1alpha1\Expr $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr::class); + $this->value = $var; + + return $this; + } + + /** + * @return string + */ + public function getKeyKind() + { + return $this->whichOneof("key_kind"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Entry::class, \Google\Api\Expr\V1alpha1\Expr_CreateStruct_Entry::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/Ident.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/Ident.php new file mode 100644 index 00000000..bb0b0bc7 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/Ident.php @@ -0,0 +1,78 @@ +google.api.expr.v1alpha1.Expr.Ident + */ +class Ident extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Holds a single, unqualified identifier, possibly preceded by a + * '.'. + * Qualified names are represented by the [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Holds a single, unqualified identifier, possibly preceded by a + * '.'. + * Qualified names are represented by the [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Syntax::initOnce(); + parent::__construct($data); + } + + /** + * Required. Holds a single, unqualified identifier, possibly preceded by a + * '.'. + * Qualified names are represented by the [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Holds a single, unqualified identifier, possibly preceded by a + * '.'. + * Qualified names are represented by the [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Ident::class, \Google\Api\Expr\V1alpha1\Expr_Ident::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/Select.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/Select.php new file mode 100644 index 00000000..8dbe5c54 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr/Select.php @@ -0,0 +1,158 @@ +google.api.expr.v1alpha1.Expr.Select + */ +class Select extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The target of the selection expression. + * For example, in the select expression `request.auth`, the `request` + * portion of the expression is the `operand`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr operand = 1; + */ + private $operand = null; + /** + * Required. The name of the field to select. + * For example, in the select expression `request.auth`, the `auth` portion + * of the expression would be the `field`. + * + * Generated from protobuf field string field = 2; + */ + private $field = ''; + /** + * Whether the select is to be interpreted as a field presence test. + * This results from the macro `has(request.auth)`. + * + * Generated from protobuf field bool test_only = 3; + */ + private $test_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Expr $operand + * Required. The target of the selection expression. + * For example, in the select expression `request.auth`, the `request` + * portion of the expression is the `operand`. + * @type string $field + * Required. The name of the field to select. + * For example, in the select expression `request.auth`, the `auth` portion + * of the expression would be the `field`. + * @type bool $test_only + * Whether the select is to be interpreted as a field presence test. + * This results from the macro `has(request.auth)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Syntax::initOnce(); + parent::__construct($data); + } + + /** + * Required. The target of the selection expression. + * For example, in the select expression `request.auth`, the `request` + * portion of the expression is the `operand`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr operand = 1; + * @return \Google\Api\Expr\V1alpha1\Expr + */ + public function getOperand() + { + return $this->operand; + } + + /** + * Required. The target of the selection expression. + * For example, in the select expression `request.auth`, the `request` + * portion of the expression is the `operand`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr operand = 1; + * @param \Google\Api\Expr\V1alpha1\Expr $var + * @return $this + */ + public function setOperand($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr::class); + $this->operand = $var; + + return $this; + } + + /** + * Required. The name of the field to select. + * For example, in the select expression `request.auth`, the `auth` portion + * of the expression would be the `field`. + * + * Generated from protobuf field string field = 2; + * @return string + */ + public function getField() + { + return $this->field; + } + + /** + * Required. The name of the field to select. + * For example, in the select expression `request.auth`, the `auth` portion + * of the expression would be the `field`. + * + * Generated from protobuf field string field = 2; + * @param string $var + * @return $this + */ + public function setField($var) + { + GPBUtil::checkString($var, True); + $this->field = $var; + + return $this; + } + + /** + * Whether the select is to be interpreted as a field presence test. + * This results from the macro `has(request.auth)`. + * + * Generated from protobuf field bool test_only = 3; + * @return bool + */ + public function getTestOnly() + { + return $this->test_only; + } + + /** + * Whether the select is to be interpreted as a field presence test. + * This results from the macro `has(request.auth)`. + * + * Generated from protobuf field bool test_only = 3; + * @param bool $var + * @return $this + */ + public function setTestOnly($var) + { + GPBUtil::checkBool($var); + $this->test_only = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Select::class, \Google\Api\Expr\V1alpha1\Expr_Select::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/ExprValue.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/ExprValue.php new file mode 100644 index 00000000..b050e14a --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/ExprValue.php @@ -0,0 +1,213 @@ +google.api.expr.v1alpha1.ExprValue + */ +class ExprValue extends \Google\Protobuf\Internal\Message +{ + protected $kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Value $value + * A concrete value. + * @type \Google\Api\Expr\V1alpha1\ErrorSet $error + * The set of errors in the critical path of evalution. + * Only errors in the critical path are included. For example, + * `( || true) && ` will only result in ``, + * while ` || ` will result in both `` and + * ``. + * Errors cause by the presence of other errors are not included in the + * set. For example `.foo`, `foo()`, and ` + 1` will + * only result in ``. + * Multiple errors *might* be included when evaluation could result + * in different errors. For example ` + ` and + * `foo(, )` may result in ``, `` or both. + * The exact subset of errors included for this case is unspecified and + * depends on the implementation details of the evaluator. + * @type \Google\Api\Expr\V1alpha1\UnknownSet $unknown + * The set of unknowns in the critical path of evaluation. + * Unknown behaves identically to Error with regards to propagation. + * Specifically, only unknowns in the critical path are included, unknowns + * caused by the presence of other unknowns are not included, and multiple + * unknowns *might* be included included when evaluation could result in + * different unknowns. For example: + * ( || true) && -> + * || -> + * .foo -> + * foo() -> + * + -> or + * Unknown takes precidence over Error in cases where a `Value` can short + * circuit the result: + * || -> + * && -> + * Errors take precidence in all other cases: + * + -> + * foo(, ) -> + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\PBEval::initOnce(); + parent::__construct($data); + } + + /** + * A concrete value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Value value = 1; + * @return \Google\Api\Expr\V1alpha1\Value + */ + public function getValue() + { + return $this->readOneof(1); + } + + /** + * A concrete value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Value value = 1; + * @param \Google\Api\Expr\V1alpha1\Value $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Value::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The set of errors in the critical path of evalution. + * Only errors in the critical path are included. For example, + * `( || true) && ` will only result in ``, + * while ` || ` will result in both `` and + * ``. + * Errors cause by the presence of other errors are not included in the + * set. For example `.foo`, `foo()`, and ` + 1` will + * only result in ``. + * Multiple errors *might* be included when evaluation could result + * in different errors. For example ` + ` and + * `foo(, )` may result in ``, `` or both. + * The exact subset of errors included for this case is unspecified and + * depends on the implementation details of the evaluator. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ErrorSet error = 2; + * @return \Google\Api\Expr\V1alpha1\ErrorSet + */ + public function getError() + { + return $this->readOneof(2); + } + + /** + * The set of errors in the critical path of evalution. + * Only errors in the critical path are included. For example, + * `( || true) && ` will only result in ``, + * while ` || ` will result in both `` and + * ``. + * Errors cause by the presence of other errors are not included in the + * set. For example `.foo`, `foo()`, and ` + 1` will + * only result in ``. + * Multiple errors *might* be included when evaluation could result + * in different errors. For example ` + ` and + * `foo(, )` may result in ``, `` or both. + * The exact subset of errors included for this case is unspecified and + * depends on the implementation details of the evaluator. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ErrorSet error = 2; + * @param \Google\Api\Expr\V1alpha1\ErrorSet $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\ErrorSet::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The set of unknowns in the critical path of evaluation. + * Unknown behaves identically to Error with regards to propagation. + * Specifically, only unknowns in the critical path are included, unknowns + * caused by the presence of other unknowns are not included, and multiple + * unknowns *might* be included included when evaluation could result in + * different unknowns. For example: + * ( || true) && -> + * || -> + * .foo -> + * foo() -> + * + -> or + * Unknown takes precidence over Error in cases where a `Value` can short + * circuit the result: + * || -> + * && -> + * Errors take precidence in all other cases: + * + -> + * foo(, ) -> + * + * Generated from protobuf field .google.api.expr.v1alpha1.UnknownSet unknown = 3; + * @return \Google\Api\Expr\V1alpha1\UnknownSet + */ + public function getUnknown() + { + return $this->readOneof(3); + } + + /** + * The set of unknowns in the critical path of evaluation. + * Unknown behaves identically to Error with regards to propagation. + * Specifically, only unknowns in the critical path are included, unknowns + * caused by the presence of other unknowns are not included, and multiple + * unknowns *might* be included included when evaluation could result in + * different unknowns. For example: + * ( || true) && -> + * || -> + * .foo -> + * foo() -> + * + -> or + * Unknown takes precidence over Error in cases where a `Value` can short + * circuit the result: + * || -> + * && -> + * Errors take precidence in all other cases: + * + -> + * foo(, ) -> + * + * Generated from protobuf field .google.api.expr.v1alpha1.UnknownSet unknown = 3; + * @param \Google\Api\Expr\V1alpha1\UnknownSet $var + * @return $this + */ + public function setUnknown($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\UnknownSet::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getKind() + { + return $this->whichOneof("kind"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr_Call.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr_Call.php new file mode 100644 index 00000000..cb9893c5 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr_Call.php @@ -0,0 +1,16 @@ +google.api.expr.v1alpha1.IssueDetails + */ +class IssueDetails extends \Google\Protobuf\Internal\Message +{ + /** + * The severity of the issue. + * + * Generated from protobuf field .google.api.expr.v1alpha1.IssueDetails.Severity severity = 1; + */ + private $severity = 0; + /** + * Position in the source, if known. + * + * Generated from protobuf field .google.api.expr.v1alpha1.SourcePosition position = 2; + */ + private $position = null; + /** + * Expression ID from [Expr][google.api.expr.v1alpha1.Expr], 0 if unknown. + * + * Generated from protobuf field int64 id = 3; + */ + private $id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $severity + * The severity of the issue. + * @type \Google\Api\Expr\V1alpha1\SourcePosition $position + * Position in the source, if known. + * @type int|string $id + * Expression ID from [Expr][google.api.expr.v1alpha1.Expr], 0 if unknown. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\ConformanceService::initOnce(); + parent::__construct($data); + } + + /** + * The severity of the issue. + * + * Generated from protobuf field .google.api.expr.v1alpha1.IssueDetails.Severity severity = 1; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * The severity of the issue. + * + * Generated from protobuf field .google.api.expr.v1alpha1.IssueDetails.Severity severity = 1; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Google\Api\Expr\V1alpha1\IssueDetails_Severity::class); + $this->severity = $var; + + return $this; + } + + /** + * Position in the source, if known. + * + * Generated from protobuf field .google.api.expr.v1alpha1.SourcePosition position = 2; + * @return \Google\Api\Expr\V1alpha1\SourcePosition + */ + public function getPosition() + { + return $this->position; + } + + /** + * Position in the source, if known. + * + * Generated from protobuf field .google.api.expr.v1alpha1.SourcePosition position = 2; + * @param \Google\Api\Expr\V1alpha1\SourcePosition $var + * @return $this + */ + public function setPosition($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\SourcePosition::class); + $this->position = $var; + + return $this; + } + + /** + * Expression ID from [Expr][google.api.expr.v1alpha1.Expr], 0 if unknown. + * + * Generated from protobuf field int64 id = 3; + * @return int|string + */ + public function getId() + { + return $this->id; + } + + /** + * Expression ID from [Expr][google.api.expr.v1alpha1.Expr], 0 if unknown. + * + * Generated from protobuf field int64 id = 3; + * @param int|string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkInt64($var); + $this->id = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/IssueDetails/Severity.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/IssueDetails/Severity.php new file mode 100644 index 00000000..74c1644a --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/IssueDetails/Severity.php @@ -0,0 +1,72 @@ +google.api.expr.v1alpha1.IssueDetails.Severity + */ +class Severity +{ + /** + * An unspecified severity. + * + * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; + */ + const SEVERITY_UNSPECIFIED = 0; + /** + * Deprecation issue for statements and method that may no longer be + * supported or maintained. + * + * Generated from protobuf enum DEPRECATION = 1; + */ + const DEPRECATION = 1; + /** + * Warnings such as: unused variables. + * + * Generated from protobuf enum WARNING = 2; + */ + const WARNING = 2; + /** + * Errors such as: unmatched curly braces or variable redefinition. + * + * Generated from protobuf enum ERROR = 3; + */ + const ERROR = 3; + + private static $valueToName = [ + self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', + self::DEPRECATION => 'DEPRECATION', + self::WARNING => 'WARNING', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Severity::class, \Google\Api\Expr\V1alpha1\IssueDetails_Severity::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/IssueDetails_Severity.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/IssueDetails_Severity.php new file mode 100644 index 00000000..0ade1fc4 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/IssueDetails_Severity.php @@ -0,0 +1,16 @@ +google.api.expr.v1alpha1.ListValue + */ +class ListValue extends \Google\Protobuf\Internal\Message +{ + /** + * The ordered values in the list. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Value values = 1; + */ + private $values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Value[]|\Google\Protobuf\Internal\RepeatedField $values + * The ordered values in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Value::initOnce(); + parent::__construct($data); + } + + /** + * The ordered values in the list. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Value values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * The ordered values in the list. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Value values = 1; + * @param \Google\Api\Expr\V1alpha1\Value[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Value::class); + $this->values = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/MapValue.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/MapValue.php new file mode 100644 index 00000000..2cb20eb2 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/MapValue.php @@ -0,0 +1,77 @@ +google.api.expr.v1alpha1.MapValue + */ +class MapValue extends \Google\Protobuf\Internal\Message +{ + /** + * The set of map entries. + * CEL has fewer restrictions on keys, so a protobuf map represenation + * cannot be used. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.MapValue.Entry entries = 1; + */ + private $entries; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\MapValue\Entry[]|\Google\Protobuf\Internal\RepeatedField $entries + * The set of map entries. + * CEL has fewer restrictions on keys, so a protobuf map represenation + * cannot be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Value::initOnce(); + parent::__construct($data); + } + + /** + * The set of map entries. + * CEL has fewer restrictions on keys, so a protobuf map represenation + * cannot be used. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.MapValue.Entry entries = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntries() + { + return $this->entries; + } + + /** + * The set of map entries. + * CEL has fewer restrictions on keys, so a protobuf map represenation + * cannot be used. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.MapValue.Entry entries = 1; + * @param \Google\Api\Expr\V1alpha1\MapValue\Entry[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\MapValue\Entry::class); + $this->entries = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/MapValue/Entry.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/MapValue/Entry.php new file mode 100644 index 00000000..a4528df5 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/MapValue/Entry.php @@ -0,0 +1,112 @@ +google.api.expr.v1alpha1.MapValue.Entry + */ +class Entry extends \Google\Protobuf\Internal\Message +{ + /** + * The key. + * Must be unique with in the map. + * Currently only boolean, int, uint, and string values can be keys. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Value key = 1; + */ + private $key = null; + /** + * The value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Value value = 2; + */ + private $value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Value $key + * The key. + * Must be unique with in the map. + * Currently only boolean, int, uint, and string values can be keys. + * @type \Google\Api\Expr\V1alpha1\Value $value + * The value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Value::initOnce(); + parent::__construct($data); + } + + /** + * The key. + * Must be unique with in the map. + * Currently only boolean, int, uint, and string values can be keys. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Value key = 1; + * @return \Google\Api\Expr\V1alpha1\Value + */ + public function getKey() + { + return $this->key; + } + + /** + * The key. + * Must be unique with in the map. + * Currently only boolean, int, uint, and string values can be keys. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Value key = 1; + * @param \Google\Api\Expr\V1alpha1\Value $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Value::class); + $this->key = $var; + + return $this; + } + + /** + * The value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Value value = 2; + * @return \Google\Api\Expr\V1alpha1\Value + */ + public function getValue() + { + return $this->value; + } + + /** + * The value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Value value = 2; + * @param \Google\Api\Expr\V1alpha1\Value $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Value::class); + $this->value = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Entry::class, \Google\Api\Expr\V1alpha1\MapValue_Entry::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/MapValue_Entry.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/MapValue_Entry.php new file mode 100644 index 00000000..352fcde3 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/MapValue_Entry.php @@ -0,0 +1,16 @@ +google.api.expr.v1alpha1.ParseRequest + */ +class ParseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Source text in CEL syntax. + * + * Generated from protobuf field string cel_source = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $cel_source = ''; + /** + * Tag for version of CEL syntax, for future use. + * + * Generated from protobuf field string syntax_version = 2; + */ + private $syntax_version = ''; + /** + * File or resource for source text, used in [SourceInfo][google.api.expr.v1alpha1.SourceInfo]. + * + * Generated from protobuf field string source_location = 3; + */ + private $source_location = ''; + /** + * Prevent macro expansion. See "Macros" in Language Defiinition. + * + * Generated from protobuf field bool disable_macros = 4; + */ + private $disable_macros = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cel_source + * Required. Source text in CEL syntax. + * @type string $syntax_version + * Tag for version of CEL syntax, for future use. + * @type string $source_location + * File or resource for source text, used in [SourceInfo][google.api.expr.v1alpha1.SourceInfo]. + * @type bool $disable_macros + * Prevent macro expansion. See "Macros" in Language Defiinition. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\ConformanceService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Source text in CEL syntax. + * + * Generated from protobuf field string cel_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCelSource() + { + return $this->cel_source; + } + + /** + * Required. Source text in CEL syntax. + * + * Generated from protobuf field string cel_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCelSource($var) + { + GPBUtil::checkString($var, True); + $this->cel_source = $var; + + return $this; + } + + /** + * Tag for version of CEL syntax, for future use. + * + * Generated from protobuf field string syntax_version = 2; + * @return string + */ + public function getSyntaxVersion() + { + return $this->syntax_version; + } + + /** + * Tag for version of CEL syntax, for future use. + * + * Generated from protobuf field string syntax_version = 2; + * @param string $var + * @return $this + */ + public function setSyntaxVersion($var) + { + GPBUtil::checkString($var, True); + $this->syntax_version = $var; + + return $this; + } + + /** + * File or resource for source text, used in [SourceInfo][google.api.expr.v1alpha1.SourceInfo]. + * + * Generated from protobuf field string source_location = 3; + * @return string + */ + public function getSourceLocation() + { + return $this->source_location; + } + + /** + * File or resource for source text, used in [SourceInfo][google.api.expr.v1alpha1.SourceInfo]. + * + * Generated from protobuf field string source_location = 3; + * @param string $var + * @return $this + */ + public function setSourceLocation($var) + { + GPBUtil::checkString($var, True); + $this->source_location = $var; + + return $this; + } + + /** + * Prevent macro expansion. See "Macros" in Language Defiinition. + * + * Generated from protobuf field bool disable_macros = 4; + * @return bool + */ + public function getDisableMacros() + { + return $this->disable_macros; + } + + /** + * Prevent macro expansion. See "Macros" in Language Defiinition. + * + * Generated from protobuf field bool disable_macros = 4; + * @param bool $var + * @return $this + */ + public function setDisableMacros($var) + { + GPBUtil::checkBool($var); + $this->disable_macros = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/ParseResponse.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/ParseResponse.php new file mode 100644 index 00000000..1b6509ae --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/ParseResponse.php @@ -0,0 +1,101 @@ +google.api.expr.v1alpha1.ParseResponse + */ +class ParseResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The parsed representation, or unset if parsing failed. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1; + */ + private $parsed_expr = null; + /** + * Any number of issues with [StatusDetails][] as the details. + * + * Generated from protobuf field repeated .google.rpc.Status issues = 2; + */ + private $issues; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\ParsedExpr $parsed_expr + * The parsed representation, or unset if parsing failed. + * @type \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $issues + * Any number of issues with [StatusDetails][] as the details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\ConformanceService::initOnce(); + parent::__construct($data); + } + + /** + * The parsed representation, or unset if parsing failed. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1; + * @return \Google\Api\Expr\V1alpha1\ParsedExpr + */ + public function getParsedExpr() + { + return $this->parsed_expr; + } + + /** + * The parsed representation, or unset if parsing failed. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1; + * @param \Google\Api\Expr\V1alpha1\ParsedExpr $var + * @return $this + */ + public function setParsedExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\ParsedExpr::class); + $this->parsed_expr = $var; + + return $this; + } + + /** + * Any number of issues with [StatusDetails][] as the details. + * + * Generated from protobuf field repeated .google.rpc.Status issues = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIssues() + { + return $this->issues; + } + + /** + * Any number of issues with [StatusDetails][] as the details. + * + * Generated from protobuf field repeated .google.rpc.Status issues = 2; + * @param \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIssues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->issues = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/ParsedExpr.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/ParsedExpr.php new file mode 100644 index 00000000..6641573f --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/ParsedExpr.php @@ -0,0 +1,101 @@ +google.api.expr.v1alpha1.ParsedExpr + */ +class ParsedExpr extends \Google\Protobuf\Internal\Message +{ + /** + * The parsed expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr expr = 2; + */ + private $expr = null; + /** + * The source info derived from input that generated the parsed `expr`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.SourceInfo source_info = 3; + */ + private $source_info = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Expr $expr + * The parsed expression. + * @type \Google\Api\Expr\V1alpha1\SourceInfo $source_info + * The source info derived from input that generated the parsed `expr`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Syntax::initOnce(); + parent::__construct($data); + } + + /** + * The parsed expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr expr = 2; + * @return \Google\Api\Expr\V1alpha1\Expr + */ + public function getExpr() + { + return $this->expr; + } + + /** + * The parsed expression. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Expr expr = 2; + * @param \Google\Api\Expr\V1alpha1\Expr $var + * @return $this + */ + public function setExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Expr::class); + $this->expr = $var; + + return $this; + } + + /** + * The source info derived from input that generated the parsed `expr`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.SourceInfo source_info = 3; + * @return \Google\Api\Expr\V1alpha1\SourceInfo + */ + public function getSourceInfo() + { + return $this->source_info; + } + + /** + * The source info derived from input that generated the parsed `expr`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.SourceInfo source_info = 3; + * @param \Google\Api\Expr\V1alpha1\SourceInfo $var + * @return $this + */ + public function setSourceInfo($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\SourceInfo::class); + $this->source_info = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Reference.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Reference.php new file mode 100644 index 00000000..41c8c11f --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Reference.php @@ -0,0 +1,159 @@ +google.api.expr.v1alpha1.Reference + */ +class Reference extends \Google\Protobuf\Internal\Message +{ + /** + * The fully qualified name of the declaration. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * For references to functions, this is a list of `Overload.overload_id` + * values which match according to typing rules. + * If the list has more than one element, overload resolution among the + * presented candidates must happen at runtime because of dynamic types. The + * type checker attempts to narrow down this list as much as possible. + * Empty if this is not a reference to a [Decl.FunctionDecl][google.api.expr.v1alpha1.Decl.FunctionDecl]. + * + * Generated from protobuf field repeated string overload_id = 3; + */ + private $overload_id; + /** + * For references to constants, this may contain the value of the + * constant if known at compile time. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Constant value = 4; + */ + private $value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The fully qualified name of the declaration. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $overload_id + * For references to functions, this is a list of `Overload.overload_id` + * values which match according to typing rules. + * If the list has more than one element, overload resolution among the + * presented candidates must happen at runtime because of dynamic types. The + * type checker attempts to narrow down this list as much as possible. + * Empty if this is not a reference to a [Decl.FunctionDecl][google.api.expr.v1alpha1.Decl.FunctionDecl]. + * @type \Google\Api\Expr\V1alpha1\Constant $value + * For references to constants, this may contain the value of the + * constant if known at compile time. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Checked::initOnce(); + parent::__construct($data); + } + + /** + * The fully qualified name of the declaration. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The fully qualified name of the declaration. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * For references to functions, this is a list of `Overload.overload_id` + * values which match according to typing rules. + * If the list has more than one element, overload resolution among the + * presented candidates must happen at runtime because of dynamic types. The + * type checker attempts to narrow down this list as much as possible. + * Empty if this is not a reference to a [Decl.FunctionDecl][google.api.expr.v1alpha1.Decl.FunctionDecl]. + * + * Generated from protobuf field repeated string overload_id = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOverloadId() + { + return $this->overload_id; + } + + /** + * For references to functions, this is a list of `Overload.overload_id` + * values which match according to typing rules. + * If the list has more than one element, overload resolution among the + * presented candidates must happen at runtime because of dynamic types. The + * type checker attempts to narrow down this list as much as possible. + * Empty if this is not a reference to a [Decl.FunctionDecl][google.api.expr.v1alpha1.Decl.FunctionDecl]. + * + * Generated from protobuf field repeated string overload_id = 3; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOverloadId($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->overload_id = $arr; + + return $this; + } + + /** + * For references to constants, this may contain the value of the + * constant if known at compile time. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Constant value = 4; + * @return \Google\Api\Expr\V1alpha1\Constant + */ + public function getValue() + { + return $this->value; + } + + /** + * For references to constants, this may contain the value of the + * constant if known at compile time. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Constant value = 4; + * @param \Google\Api\Expr\V1alpha1\Constant $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Constant::class); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/SourceInfo.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/SourceInfo.php new file mode 100644 index 00000000..779b2d99 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/SourceInfo.php @@ -0,0 +1,255 @@ +google.api.expr.v1alpha1.SourceInfo + */ +class SourceInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The syntax version of the source, e.g. `cel1`. + * + * Generated from protobuf field string syntax_version = 1; + */ + private $syntax_version = ''; + /** + * The location name. All position information attached to an expression is + * relative to this location. + * The location could be a file, UI element, or similar. For example, + * `acme/app/AnvilPolicy.cel`. + * + * Generated from protobuf field string location = 2; + */ + private $location = ''; + /** + * Monotonically increasing list of character offsets where newlines appear. + * The line number of a given position is the index `i` where for a given + * `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The + * column may be derivd from `id_positions[id] - line_offsets[i]`. + * + * Generated from protobuf field repeated int32 line_offsets = 3; + */ + private $line_offsets; + /** + * A map from the parse node id (e.g. `Expr.id`) to the character offset + * within source. + * + * Generated from protobuf field map positions = 4; + */ + private $positions; + /** + * A map from the parse node id where a macro replacement was made to the + * call `Expr` that resulted in a macro expansion. + * For example, `has(value.field)` is a function call that is replaced by a + * `test_only` field selection in the AST. Likewise, the call + * `list.exists(e, e > 10)` translates to a comprehension expression. The key + * in the map corresponds to the expression id of the expanded macro, and the + * value is the call `Expr` that was replaced. + * + * Generated from protobuf field map macro_calls = 5; + */ + private $macro_calls; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $syntax_version + * The syntax version of the source, e.g. `cel1`. + * @type string $location + * The location name. All position information attached to an expression is + * relative to this location. + * The location could be a file, UI element, or similar. For example, + * `acme/app/AnvilPolicy.cel`. + * @type int[]|\Google\Protobuf\Internal\RepeatedField $line_offsets + * Monotonically increasing list of character offsets where newlines appear. + * The line number of a given position is the index `i` where for a given + * `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The + * column may be derivd from `id_positions[id] - line_offsets[i]`. + * @type array|\Google\Protobuf\Internal\MapField $positions + * A map from the parse node id (e.g. `Expr.id`) to the character offset + * within source. + * @type array|\Google\Protobuf\Internal\MapField $macro_calls + * A map from the parse node id where a macro replacement was made to the + * call `Expr` that resulted in a macro expansion. + * For example, `has(value.field)` is a function call that is replaced by a + * `test_only` field selection in the AST. Likewise, the call + * `list.exists(e, e > 10)` translates to a comprehension expression. The key + * in the map corresponds to the expression id of the expanded macro, and the + * value is the call `Expr` that was replaced. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Syntax::initOnce(); + parent::__construct($data); + } + + /** + * The syntax version of the source, e.g. `cel1`. + * + * Generated from protobuf field string syntax_version = 1; + * @return string + */ + public function getSyntaxVersion() + { + return $this->syntax_version; + } + + /** + * The syntax version of the source, e.g. `cel1`. + * + * Generated from protobuf field string syntax_version = 1; + * @param string $var + * @return $this + */ + public function setSyntaxVersion($var) + { + GPBUtil::checkString($var, True); + $this->syntax_version = $var; + + return $this; + } + + /** + * The location name. All position information attached to an expression is + * relative to this location. + * The location could be a file, UI element, or similar. For example, + * `acme/app/AnvilPolicy.cel`. + * + * Generated from protobuf field string location = 2; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The location name. All position information attached to an expression is + * relative to this location. + * The location could be a file, UI element, or similar. For example, + * `acme/app/AnvilPolicy.cel`. + * + * Generated from protobuf field string location = 2; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * Monotonically increasing list of character offsets where newlines appear. + * The line number of a given position is the index `i` where for a given + * `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The + * column may be derivd from `id_positions[id] - line_offsets[i]`. + * + * Generated from protobuf field repeated int32 line_offsets = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLineOffsets() + { + return $this->line_offsets; + } + + /** + * Monotonically increasing list of character offsets where newlines appear. + * The line number of a given position is the index `i` where for a given + * `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The + * column may be derivd from `id_positions[id] - line_offsets[i]`. + * + * Generated from protobuf field repeated int32 line_offsets = 3; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLineOffsets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->line_offsets = $arr; + + return $this; + } + + /** + * A map from the parse node id (e.g. `Expr.id`) to the character offset + * within source. + * + * Generated from protobuf field map positions = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getPositions() + { + return $this->positions; + } + + /** + * A map from the parse node id (e.g. `Expr.id`) to the character offset + * within source. + * + * Generated from protobuf field map positions = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setPositions($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::INT64, \Google\Protobuf\Internal\GPBType::INT32); + $this->positions = $arr; + + return $this; + } + + /** + * A map from the parse node id where a macro replacement was made to the + * call `Expr` that resulted in a macro expansion. + * For example, `has(value.field)` is a function call that is replaced by a + * `test_only` field selection in the AST. Likewise, the call + * `list.exists(e, e > 10)` translates to a comprehension expression. The key + * in the map corresponds to the expression id of the expanded macro, and the + * value is the call `Expr` that was replaced. + * + * Generated from protobuf field map macro_calls = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMacroCalls() + { + return $this->macro_calls; + } + + /** + * A map from the parse node id where a macro replacement was made to the + * call `Expr` that resulted in a macro expansion. + * For example, `has(value.field)` is a function call that is replaced by a + * `test_only` field selection in the AST. Likewise, the call + * `list.exists(e, e > 10)` translates to a comprehension expression. The key + * in the map corresponds to the expression id of the expanded macro, and the + * value is the call `Expr` that was replaced. + * + * Generated from protobuf field map macro_calls = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMacroCalls($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::INT64, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Expr::class); + $this->macro_calls = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/SourcePosition.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/SourcePosition.php new file mode 100644 index 00000000..0ddcb4d8 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/SourcePosition.php @@ -0,0 +1,177 @@ +google.api.expr.v1alpha1.SourcePosition + */ +class SourcePosition extends \Google\Protobuf\Internal\Message +{ + /** + * The soucre location name (e.g. file name). + * + * Generated from protobuf field string location = 1; + */ + private $location = ''; + /** + * The character offset. + * + * Generated from protobuf field int32 offset = 2; + */ + private $offset = 0; + /** + * The 1-based index of the starting line in the source text + * where the issue occurs, or 0 if unknown. + * + * Generated from protobuf field int32 line = 3; + */ + private $line = 0; + /** + * The 0-based index of the starting position within the line of source text + * where the issue occurs. Only meaningful if line is nonzero. + * + * Generated from protobuf field int32 column = 4; + */ + private $column = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $location + * The soucre location name (e.g. file name). + * @type int $offset + * The character offset. + * @type int $line + * The 1-based index of the starting line in the source text + * where the issue occurs, or 0 if unknown. + * @type int $column + * The 0-based index of the starting position within the line of source text + * where the issue occurs. Only meaningful if line is nonzero. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Syntax::initOnce(); + parent::__construct($data); + } + + /** + * The soucre location name (e.g. file name). + * + * Generated from protobuf field string location = 1; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The soucre location name (e.g. file name). + * + * Generated from protobuf field string location = 1; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * The character offset. + * + * Generated from protobuf field int32 offset = 2; + * @return int + */ + public function getOffset() + { + return $this->offset; + } + + /** + * The character offset. + * + * Generated from protobuf field int32 offset = 2; + * @param int $var + * @return $this + */ + public function setOffset($var) + { + GPBUtil::checkInt32($var); + $this->offset = $var; + + return $this; + } + + /** + * The 1-based index of the starting line in the source text + * where the issue occurs, or 0 if unknown. + * + * Generated from protobuf field int32 line = 3; + * @return int + */ + public function getLine() + { + return $this->line; + } + + /** + * The 1-based index of the starting line in the source text + * where the issue occurs, or 0 if unknown. + * + * Generated from protobuf field int32 line = 3; + * @param int $var + * @return $this + */ + public function setLine($var) + { + GPBUtil::checkInt32($var); + $this->line = $var; + + return $this; + } + + /** + * The 0-based index of the starting position within the line of source text + * where the issue occurs. Only meaningful if line is nonzero. + * + * Generated from protobuf field int32 column = 4; + * @return int + */ + public function getColumn() + { + return $this->column; + } + + /** + * The 0-based index of the starting position within the line of source text + * where the issue occurs. Only meaningful if line is nonzero. + * + * Generated from protobuf field int32 column = 4; + * @param int $var + * @return $this + */ + public function setColumn($var) + { + GPBUtil::checkInt32($var); + $this->column = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type.php new file mode 100644 index 00000000..43491910 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type.php @@ -0,0 +1,436 @@ +google.api.expr.v1alpha1.Type + */ +class Type extends \Google\Protobuf\Internal\Message +{ + protected $type_kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\GPBEmpty $dyn + * Dynamic type. + * @type int $null + * Null value. + * @type int $primitive + * Primitive types: `true`, `1u`, `-2.0`, `'string'`, `b'bytes'`. + * @type int $wrapper + * Wrapper of a primitive type, e.g. `google.protobuf.Int64Value`. + * @type int $well_known + * Well-known protobuf type such as `google.protobuf.Timestamp`. + * @type \Google\Api\Expr\V1alpha1\Type\ListType $list_type + * Parameterized list with elements of `list_type`, e.g. `list`. + * @type \Google\Api\Expr\V1alpha1\Type\MapType $map_type + * Parameterized map with typed keys and values. + * @type \Google\Api\Expr\V1alpha1\Type\FunctionType $function + * Function type. + * @type string $message_type + * Protocol buffer message type. + * The `message_type` string specifies the qualified message type name. For + * example, `google.plus.Profile`. + * @type string $type_param + * Type param type. + * The `type_param` string specifies the type parameter name, e.g. `list` + * would be a `list_type` whose element type was a `type_param` type + * named `E`. + * @type \Google\Api\Expr\V1alpha1\Type $type + * Type type. + * The `type` value specifies the target type. e.g. int is type with a + * target type of `Primitive.INT`. + * @type \Google\Protobuf\GPBEmpty $error + * Error type. + * During type-checking if an expression is an error, its type is propagated + * as the `ERROR` type. This permits the type-checker to discover other + * errors present in the expression. + * @type \Google\Api\Expr\V1alpha1\Type\AbstractType $abstract_type + * Abstract, application defined type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Checked::initOnce(); + parent::__construct($data); + } + + /** + * Dynamic type. + * + * Generated from protobuf field .google.protobuf.Empty dyn = 1; + * @return \Google\Protobuf\GPBEmpty + */ + public function getDyn() + { + return $this->readOneof(1); + } + + /** + * Dynamic type. + * + * Generated from protobuf field .google.protobuf.Empty dyn = 1; + * @param \Google\Protobuf\GPBEmpty $var + * @return $this + */ + public function setDyn($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\GPBEmpty::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Null value. + * + * Generated from protobuf field .google.protobuf.NullValue null = 2; + * @return int + */ + public function getNull() + { + return $this->readOneof(2); + } + + /** + * Null value. + * + * Generated from protobuf field .google.protobuf.NullValue null = 2; + * @param int $var + * @return $this + */ + public function setNull($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\NullValue::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Primitive types: `true`, `1u`, `-2.0`, `'string'`, `b'bytes'`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.PrimitiveType primitive = 3; + * @return int + */ + public function getPrimitive() + { + return $this->readOneof(3); + } + + /** + * Primitive types: `true`, `1u`, `-2.0`, `'string'`, `b'bytes'`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.PrimitiveType primitive = 3; + * @param int $var + * @return $this + */ + public function setPrimitive($var) + { + GPBUtil::checkEnum($var, \Google\Api\Expr\V1alpha1\Type_PrimitiveType::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Wrapper of a primitive type, e.g. `google.protobuf.Int64Value`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.PrimitiveType wrapper = 4; + * @return int + */ + public function getWrapper() + { + return $this->readOneof(4); + } + + /** + * Wrapper of a primitive type, e.g. `google.protobuf.Int64Value`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.PrimitiveType wrapper = 4; + * @param int $var + * @return $this + */ + public function setWrapper($var) + { + GPBUtil::checkEnum($var, \Google\Api\Expr\V1alpha1\Type_PrimitiveType::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Well-known protobuf type such as `google.protobuf.Timestamp`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.WellKnownType well_known = 5; + * @return int + */ + public function getWellKnown() + { + return $this->readOneof(5); + } + + /** + * Well-known protobuf type such as `google.protobuf.Timestamp`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.WellKnownType well_known = 5; + * @param int $var + * @return $this + */ + public function setWellKnown($var) + { + GPBUtil::checkEnum($var, \Google\Api\Expr\V1alpha1\Type_WellKnownType::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Parameterized list with elements of `list_type`, e.g. `list`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.ListType list_type = 6; + * @return \Google\Api\Expr\V1alpha1\Type\ListType + */ + public function getListType() + { + return $this->readOneof(6); + } + + /** + * Parameterized list with elements of `list_type`, e.g. `list`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.ListType list_type = 6; + * @param \Google\Api\Expr\V1alpha1\Type\ListType $var + * @return $this + */ + public function setListType($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Type_ListType::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Parameterized map with typed keys and values. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.MapType map_type = 7; + * @return \Google\Api\Expr\V1alpha1\Type\MapType + */ + public function getMapType() + { + return $this->readOneof(7); + } + + /** + * Parameterized map with typed keys and values. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.MapType map_type = 7; + * @param \Google\Api\Expr\V1alpha1\Type\MapType $var + * @return $this + */ + public function setMapType($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Type_MapType::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Function type. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.FunctionType function = 8; + * @return \Google\Api\Expr\V1alpha1\Type\FunctionType + */ + public function getFunction() + { + return $this->readOneof(8); + } + + /** + * Function type. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.FunctionType function = 8; + * @param \Google\Api\Expr\V1alpha1\Type\FunctionType $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Type_FunctionType::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Protocol buffer message type. + * The `message_type` string specifies the qualified message type name. For + * example, `google.plus.Profile`. + * + * Generated from protobuf field string message_type = 9; + * @return string + */ + public function getMessageType() + { + return $this->readOneof(9); + } + + /** + * Protocol buffer message type. + * The `message_type` string specifies the qualified message type name. For + * example, `google.plus.Profile`. + * + * Generated from protobuf field string message_type = 9; + * @param string $var + * @return $this + */ + public function setMessageType($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Type param type. + * The `type_param` string specifies the type parameter name, e.g. `list` + * would be a `list_type` whose element type was a `type_param` type + * named `E`. + * + * Generated from protobuf field string type_param = 10; + * @return string + */ + public function getTypeParam() + { + return $this->readOneof(10); + } + + /** + * Type param type. + * The `type_param` string specifies the type parameter name, e.g. `list` + * would be a `list_type` whose element type was a `type_param` type + * named `E`. + * + * Generated from protobuf field string type_param = 10; + * @param string $var + * @return $this + */ + public function setTypeParam($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Type type. + * The `type` value specifies the target type. e.g. int is type with a + * target type of `Primitive.INT`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type type = 11; + * @return \Google\Api\Expr\V1alpha1\Type + */ + public function getType() + { + return $this->readOneof(11); + } + + /** + * Type type. + * The `type` value specifies the target type. e.g. int is type with a + * target type of `Primitive.INT`. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type type = 11; + * @param \Google\Api\Expr\V1alpha1\Type $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Type::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * Error type. + * During type-checking if an expression is an error, its type is propagated + * as the `ERROR` type. This permits the type-checker to discover other + * errors present in the expression. + * + * Generated from protobuf field .google.protobuf.Empty error = 12; + * @return \Google\Protobuf\GPBEmpty + */ + public function getError() + { + return $this->readOneof(12); + } + + /** + * Error type. + * During type-checking if an expression is an error, its type is propagated + * as the `ERROR` type. This permits the type-checker to discover other + * errors present in the expression. + * + * Generated from protobuf field .google.protobuf.Empty error = 12; + * @param \Google\Protobuf\GPBEmpty $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\GPBEmpty::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * Abstract, application defined type. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.AbstractType abstract_type = 14; + * @return \Google\Api\Expr\V1alpha1\Type\AbstractType + */ + public function getAbstractType() + { + return $this->readOneof(14); + } + + /** + * Abstract, application defined type. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type.AbstractType abstract_type = 14; + * @param \Google\Api\Expr\V1alpha1\Type\AbstractType $var + * @return $this + */ + public function setAbstractType($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Type_AbstractType::class); + $this->writeOneof(14, $var); + + return $this; + } + + /** + * @return string + */ + public function getTypeKind() + { + return $this->whichOneof("type_kind"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/AbstractType.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/AbstractType.php new file mode 100644 index 00000000..effc16b3 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/AbstractType.php @@ -0,0 +1,104 @@ +google.api.expr.v1alpha1.Type.AbstractType + */ +class AbstractType extends \Google\Protobuf\Internal\Message +{ + /** + * The fully qualified name of this abstract type. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * Parameter types for this abstract type. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Type parameter_types = 2; + */ + private $parameter_types; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The fully qualified name of this abstract type. + * @type \Google\Api\Expr\V1alpha1\Type[]|\Google\Protobuf\Internal\RepeatedField $parameter_types + * Parameter types for this abstract type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Checked::initOnce(); + parent::__construct($data); + } + + /** + * The fully qualified name of this abstract type. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The fully qualified name of this abstract type. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Parameter types for this abstract type. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Type parameter_types = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParameterTypes() + { + return $this->parameter_types; + } + + /** + * Parameter types for this abstract type. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Type parameter_types = 2; + * @param \Google\Api\Expr\V1alpha1\Type[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParameterTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Type::class); + $this->parameter_types = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AbstractType::class, \Google\Api\Expr\V1alpha1\Type_AbstractType::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/FunctionType.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/FunctionType.php new file mode 100644 index 00000000..648c36e8 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/FunctionType.php @@ -0,0 +1,104 @@ +google.api.expr.v1alpha1.Type.FunctionType + */ +class FunctionType extends \Google\Protobuf\Internal\Message +{ + /** + * Result type of the function. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type result_type = 1; + */ + private $result_type = null; + /** + * Argument types of the function. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Type arg_types = 2; + */ + private $arg_types; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Type $result_type + * Result type of the function. + * @type \Google\Api\Expr\V1alpha1\Type[]|\Google\Protobuf\Internal\RepeatedField $arg_types + * Argument types of the function. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Checked::initOnce(); + parent::__construct($data); + } + + /** + * Result type of the function. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type result_type = 1; + * @return \Google\Api\Expr\V1alpha1\Type + */ + public function getResultType() + { + return $this->result_type; + } + + /** + * Result type of the function. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type result_type = 1; + * @param \Google\Api\Expr\V1alpha1\Type $var + * @return $this + */ + public function setResultType($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Type::class); + $this->result_type = $var; + + return $this; + } + + /** + * Argument types of the function. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Type arg_types = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getArgTypes() + { + return $this->arg_types; + } + + /** + * Argument types of the function. + * + * Generated from protobuf field repeated .google.api.expr.v1alpha1.Type arg_types = 2; + * @param \Google\Api\Expr\V1alpha1\Type[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setArgTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1alpha1\Type::class); + $this->arg_types = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FunctionType::class, \Google\Api\Expr\V1alpha1\Type_FunctionType::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/ListType.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/ListType.php new file mode 100644 index 00000000..b8694aa7 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/ListType.php @@ -0,0 +1,70 @@ +`. + * + * Generated from protobuf message google.api.expr.v1alpha1.Type.ListType + */ +class ListType extends \Google\Protobuf\Internal\Message +{ + /** + * The element type. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type elem_type = 1; + */ + private $elem_type = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Type $elem_type + * The element type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Checked::initOnce(); + parent::__construct($data); + } + + /** + * The element type. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type elem_type = 1; + * @return \Google\Api\Expr\V1alpha1\Type + */ + public function getElemType() + { + return $this->elem_type; + } + + /** + * The element type. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type elem_type = 1; + * @param \Google\Api\Expr\V1alpha1\Type $var + * @return $this + */ + public function setElemType($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Type::class); + $this->elem_type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ListType::class, \Google\Api\Expr\V1alpha1\Type_ListType::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/MapType.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/MapType.php new file mode 100644 index 00000000..783b8ec7 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/MapType.php @@ -0,0 +1,104 @@ +`. + * + * Generated from protobuf message google.api.expr.v1alpha1.Type.MapType + */ +class MapType extends \Google\Protobuf\Internal\Message +{ + /** + * The type of the key. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type key_type = 1; + */ + private $key_type = null; + /** + * The type of the value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type value_type = 2; + */ + private $value_type = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1alpha1\Type $key_type + * The type of the key. + * @type \Google\Api\Expr\V1alpha1\Type $value_type + * The type of the value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Checked::initOnce(); + parent::__construct($data); + } + + /** + * The type of the key. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type key_type = 1; + * @return \Google\Api\Expr\V1alpha1\Type + */ + public function getKeyType() + { + return $this->key_type; + } + + /** + * The type of the key. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type key_type = 1; + * @param \Google\Api\Expr\V1alpha1\Type $var + * @return $this + */ + public function setKeyType($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Type::class); + $this->key_type = $var; + + return $this; + } + + /** + * The type of the value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type value_type = 2; + * @return \Google\Api\Expr\V1alpha1\Type + */ + public function getValueType() + { + return $this->value_type; + } + + /** + * The type of the value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.Type value_type = 2; + * @param \Google\Api\Expr\V1alpha1\Type $var + * @return $this + */ + public function setValueType($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\Type::class); + $this->value_type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MapType::class, \Google\Api\Expr\V1alpha1\Type_MapType::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/PrimitiveType.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/PrimitiveType.php new file mode 100644 index 00000000..a3b04998 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/PrimitiveType.php @@ -0,0 +1,95 @@ +google.api.expr.v1alpha1.Type.PrimitiveType + */ +class PrimitiveType +{ + /** + * Unspecified type. + * + * Generated from protobuf enum PRIMITIVE_TYPE_UNSPECIFIED = 0; + */ + const PRIMITIVE_TYPE_UNSPECIFIED = 0; + /** + * Boolean type. + * + * Generated from protobuf enum BOOL = 1; + */ + const BOOL = 1; + /** + * Int64 type. + * Proto-based integer values are widened to int64. + * + * Generated from protobuf enum INT64 = 2; + */ + const INT64 = 2; + /** + * Uint64 type. + * Proto-based unsigned integer values are widened to uint64. + * + * Generated from protobuf enum UINT64 = 3; + */ + const UINT64 = 3; + /** + * Double type. + * Proto-based float values are widened to double values. + * + * Generated from protobuf enum DOUBLE = 4; + */ + const DOUBLE = 4; + /** + * String type. + * + * Generated from protobuf enum STRING = 5; + */ + const STRING = 5; + /** + * Bytes type. + * + * Generated from protobuf enum BYTES = 6; + */ + const BYTES = 6; + + private static $valueToName = [ + self::PRIMITIVE_TYPE_UNSPECIFIED => 'PRIMITIVE_TYPE_UNSPECIFIED', + self::BOOL => 'BOOL', + self::INT64 => 'INT64', + self::UINT64 => 'UINT64', + self::DOUBLE => 'DOUBLE', + self::STRING => 'STRING', + self::BYTES => 'BYTES', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PrimitiveType::class, \Google\Api\Expr\V1alpha1\Type_PrimitiveType::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/WellKnownType.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/WellKnownType.php new file mode 100644 index 00000000..3daf5ecd --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type/WellKnownType.php @@ -0,0 +1,74 @@ +google.api.expr.v1alpha1.Type.WellKnownType + */ +class WellKnownType +{ + /** + * Unspecified type. + * + * Generated from protobuf enum WELL_KNOWN_TYPE_UNSPECIFIED = 0; + */ + const WELL_KNOWN_TYPE_UNSPECIFIED = 0; + /** + * Well-known protobuf.Any type. + * Any types are a polymorphic message type. During type-checking they are + * treated like `DYN` types, but at runtime they are resolved to a specific + * message type specified at evaluation time. + * + * Generated from protobuf enum ANY = 1; + */ + const ANY = 1; + /** + * Well-known protobuf.Timestamp type, internally referenced as `timestamp`. + * + * Generated from protobuf enum TIMESTAMP = 2; + */ + const TIMESTAMP = 2; + /** + * Well-known protobuf.Duration type, internally referenced as `duration`. + * + * Generated from protobuf enum DURATION = 3; + */ + const DURATION = 3; + + private static $valueToName = [ + self::WELL_KNOWN_TYPE_UNSPECIFIED => 'WELL_KNOWN_TYPE_UNSPECIFIED', + self::ANY => 'ANY', + self::TIMESTAMP => 'TIMESTAMP', + self::DURATION => 'DURATION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WellKnownType::class, \Google\Api\Expr\V1alpha1\Type_WellKnownType::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type_AbstractType.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type_AbstractType.php new file mode 100644 index 00000000..fadb4a0d --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Type_AbstractType.php @@ -0,0 +1,16 @@ +google.api.expr.v1alpha1.UnknownSet + */ +class UnknownSet extends \Google\Protobuf\Internal\Message +{ + /** + * The ids of the expressions with unknown values. + * + * Generated from protobuf field repeated int64 exprs = 1; + */ + private $exprs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int[]|string[]|\Google\Protobuf\Internal\RepeatedField $exprs + * The ids of the expressions with unknown values. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\PBEval::initOnce(); + parent::__construct($data); + } + + /** + * The ids of the expressions with unknown values. + * + * Generated from protobuf field repeated int64 exprs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExprs() + { + return $this->exprs; + } + + /** + * The ids of the expressions with unknown values. + * + * Generated from protobuf field repeated int64 exprs = 1; + * @param int[]|string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExprs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT64); + $this->exprs = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1alpha1/Value.php b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Value.php new file mode 100644 index 00000000..cd8326fe --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1alpha1/Value.php @@ -0,0 +1,380 @@ +google.api.expr.v1alpha1.Value + */ +class Value extends \Google\Protobuf\Internal\Message +{ + protected $kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $null_value + * Null value. + * @type bool $bool_value + * Boolean value. + * @type int|string $int64_value + * Signed integer value. + * @type int|string $uint64_value + * Unsigned integer value. + * @type float $double_value + * Floating point value. + * @type string $string_value + * UTF-8 string value. + * @type string $bytes_value + * Byte string value. + * @type \Google\Api\Expr\V1alpha1\EnumValue $enum_value + * An enum value. + * @type \Google\Protobuf\Any $object_value + * The proto message backing an object value. + * @type \Google\Api\Expr\V1alpha1\MapValue $map_value + * Map value. + * @type \Google\Api\Expr\V1alpha1\ListValue $list_value + * List value. + * @type string $type_value + * Type value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Alpha1\Value::initOnce(); + parent::__construct($data); + } + + /** + * Null value. + * + * Generated from protobuf field .google.protobuf.NullValue null_value = 1; + * @return int + */ + public function getNullValue() + { + return $this->readOneof(1); + } + + /** + * Null value. + * + * Generated from protobuf field .google.protobuf.NullValue null_value = 1; + * @param int $var + * @return $this + */ + public function setNullValue($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\NullValue::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Boolean value. + * + * Generated from protobuf field bool bool_value = 2; + * @return bool + */ + public function getBoolValue() + { + return $this->readOneof(2); + } + + /** + * Boolean value. + * + * Generated from protobuf field bool bool_value = 2; + * @param bool $var + * @return $this + */ + public function setBoolValue($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Signed integer value. + * + * Generated from protobuf field int64 int64_value = 3; + * @return int|string + */ + public function getInt64Value() + { + return $this->readOneof(3); + } + + /** + * Signed integer value. + * + * Generated from protobuf field int64 int64_value = 3; + * @param int|string $var + * @return $this + */ + public function setInt64Value($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Unsigned integer value. + * + * Generated from protobuf field uint64 uint64_value = 4; + * @return int|string + */ + public function getUint64Value() + { + return $this->readOneof(4); + } + + /** + * Unsigned integer value. + * + * Generated from protobuf field uint64 uint64_value = 4; + * @param int|string $var + * @return $this + */ + public function setUint64Value($var) + { + GPBUtil::checkUint64($var); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Floating point value. + * + * Generated from protobuf field double double_value = 5; + * @return float + */ + public function getDoubleValue() + { + return $this->readOneof(5); + } + + /** + * Floating point value. + * + * Generated from protobuf field double double_value = 5; + * @param float $var + * @return $this + */ + public function setDoubleValue($var) + { + GPBUtil::checkDouble($var); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * UTF-8 string value. + * + * Generated from protobuf field string string_value = 6; + * @return string + */ + public function getStringValue() + { + return $this->readOneof(6); + } + + /** + * UTF-8 string value. + * + * Generated from protobuf field string string_value = 6; + * @param string $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Byte string value. + * + * Generated from protobuf field bytes bytes_value = 7; + * @return string + */ + public function getBytesValue() + { + return $this->readOneof(7); + } + + /** + * Byte string value. + * + * Generated from protobuf field bytes bytes_value = 7; + * @param string $var + * @return $this + */ + public function setBytesValue($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * An enum value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.EnumValue enum_value = 9; + * @return \Google\Api\Expr\V1alpha1\EnumValue + */ + public function getEnumValue() + { + return $this->readOneof(9); + } + + /** + * An enum value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.EnumValue enum_value = 9; + * @param \Google\Api\Expr\V1alpha1\EnumValue $var + * @return $this + */ + public function setEnumValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\EnumValue::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * The proto message backing an object value. + * + * Generated from protobuf field .google.protobuf.Any object_value = 10; + * @return \Google\Protobuf\Any + */ + public function getObjectValue() + { + return $this->readOneof(10); + } + + /** + * The proto message backing an object value. + * + * Generated from protobuf field .google.protobuf.Any object_value = 10; + * @param \Google\Protobuf\Any $var + * @return $this + */ + public function setObjectValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Map value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.MapValue map_value = 11; + * @return \Google\Api\Expr\V1alpha1\MapValue + */ + public function getMapValue() + { + return $this->readOneof(11); + } + + /** + * Map value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.MapValue map_value = 11; + * @param \Google\Api\Expr\V1alpha1\MapValue $var + * @return $this + */ + public function setMapValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\MapValue::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * List value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ListValue list_value = 12; + * @return \Google\Api\Expr\V1alpha1\ListValue + */ + public function getListValue() + { + return $this->readOneof(12); + } + + /** + * List value. + * + * Generated from protobuf field .google.api.expr.v1alpha1.ListValue list_value = 12; + * @param \Google\Api\Expr\V1alpha1\ListValue $var + * @return $this + */ + public function setListValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1alpha1\ListValue::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * Type value. + * + * Generated from protobuf field string type_value = 15; + * @return string + */ + public function getTypeValue() + { + return $this->readOneof(15); + } + + /** + * Type value. + * + * Generated from protobuf field string type_value = 15; + * @param string $var + * @return $this + */ + public function setTypeValue($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(15, $var); + + return $this; + } + + /** + * @return string + */ + public function getKind() + { + return $this->whichOneof("kind"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/Decl.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/Decl.php new file mode 100644 index 00000000..cf58451c --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/Decl.php @@ -0,0 +1,200 @@ +google.api.expr.v1beta1.Decl + */ +class Decl extends \Google\Protobuf\Internal\Message +{ + /** + * The id of the declaration. + * + * Generated from protobuf field int32 id = 1; + */ + private $id = 0; + /** + * The name of the declaration. + * + * Generated from protobuf field string name = 2; + */ + private $name = ''; + /** + * The documentation string for the declaration. + * + * Generated from protobuf field string doc = 3; + */ + private $doc = ''; + protected $kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $id + * The id of the declaration. + * @type string $name + * The name of the declaration. + * @type string $doc + * The documentation string for the declaration. + * @type \Google\Api\Expr\V1beta1\IdentDecl $ident + * An identifier declaration. + * @type \Google\Api\Expr\V1beta1\FunctionDecl $function + * A function declaration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Decl::initOnce(); + parent::__construct($data); + } + + /** + * The id of the declaration. + * + * Generated from protobuf field int32 id = 1; + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * The id of the declaration. + * + * Generated from protobuf field int32 id = 1; + * @param int $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkInt32($var); + $this->id = $var; + + return $this; + } + + /** + * The name of the declaration. + * + * Generated from protobuf field string name = 2; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the declaration. + * + * Generated from protobuf field string name = 2; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The documentation string for the declaration. + * + * Generated from protobuf field string doc = 3; + * @return string + */ + public function getDoc() + { + return $this->doc; + } + + /** + * The documentation string for the declaration. + * + * Generated from protobuf field string doc = 3; + * @param string $var + * @return $this + */ + public function setDoc($var) + { + GPBUtil::checkString($var, True); + $this->doc = $var; + + return $this; + } + + /** + * An identifier declaration. + * + * Generated from protobuf field .google.api.expr.v1beta1.IdentDecl ident = 4; + * @return \Google\Api\Expr\V1beta1\IdentDecl + */ + public function getIdent() + { + return $this->readOneof(4); + } + + /** + * An identifier declaration. + * + * Generated from protobuf field .google.api.expr.v1beta1.IdentDecl ident = 4; + * @param \Google\Api\Expr\V1beta1\IdentDecl $var + * @return $this + */ + public function setIdent($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\IdentDecl::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * A function declaration. + * + * Generated from protobuf field .google.api.expr.v1beta1.FunctionDecl function = 5; + * @return \Google\Api\Expr\V1beta1\FunctionDecl + */ + public function getFunction() + { + return $this->readOneof(5); + } + + /** + * A function declaration. + * + * Generated from protobuf field .google.api.expr.v1beta1.FunctionDecl function = 5; + * @param \Google\Api\Expr\V1beta1\FunctionDecl $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\FunctionDecl::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * @return string + */ + public function getKind() + { + return $this->whichOneof("kind"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/DeclType.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/DeclType.php new file mode 100644 index 00000000..dbbbf342 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/DeclType.php @@ -0,0 +1,141 @@ +google.api.expr.v1beta1.DeclType + */ +class DeclType extends \Google\Protobuf\Internal\Message +{ + /** + * The expression id of the declared type, if applicable. + * + * Generated from protobuf field int32 id = 1; + */ + private $id = 0; + /** + * The type name, e.g. 'int', 'my.type.Type' or 'T' + * + * Generated from protobuf field string type = 2; + */ + private $type = ''; + /** + * An ordered list of type parameters, e.g. ``. + * Only applies to a subset of types, e.g. `map`, `list`. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.DeclType type_params = 4; + */ + private $type_params; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $id + * The expression id of the declared type, if applicable. + * @type string $type + * The type name, e.g. 'int', 'my.type.Type' or 'T' + * @type \Google\Api\Expr\V1beta1\DeclType[]|\Google\Protobuf\Internal\RepeatedField $type_params + * An ordered list of type parameters, e.g. ``. + * Only applies to a subset of types, e.g. `map`, `list`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Decl::initOnce(); + parent::__construct($data); + } + + /** + * The expression id of the declared type, if applicable. + * + * Generated from protobuf field int32 id = 1; + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * The expression id of the declared type, if applicable. + * + * Generated from protobuf field int32 id = 1; + * @param int $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkInt32($var); + $this->id = $var; + + return $this; + } + + /** + * The type name, e.g. 'int', 'my.type.Type' or 'T' + * + * Generated from protobuf field string type = 2; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The type name, e.g. 'int', 'my.type.Type' or 'T' + * + * Generated from protobuf field string type = 2; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * An ordered list of type parameters, e.g. ``. + * Only applies to a subset of types, e.g. `map`, `list`. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.DeclType type_params = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTypeParams() + { + return $this->type_params; + } + + /** + * An ordered list of type parameters, e.g. ``. + * Only applies to a subset of types, e.g. `map`, `list`. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.DeclType type_params = 4; + * @param \Google\Api\Expr\V1beta1\DeclType[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTypeParams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1beta1\DeclType::class); + $this->type_params = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/EnumValue.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/EnumValue.php new file mode 100644 index 00000000..d0c8baaa --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/EnumValue.php @@ -0,0 +1,101 @@ +google.api.expr.v1beta1.EnumValue + */ +class EnumValue extends \Google\Protobuf\Internal\Message +{ + /** + * The fully qualified name of the enum type. + * + * Generated from protobuf field string type = 1; + */ + private $type = ''; + /** + * The value of the enum. + * + * Generated from protobuf field int32 value = 2; + */ + private $value = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * The fully qualified name of the enum type. + * @type int $value + * The value of the enum. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Value::initOnce(); + parent::__construct($data); + } + + /** + * The fully qualified name of the enum type. + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The fully qualified name of the enum type. + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The value of the enum. + * + * Generated from protobuf field int32 value = 2; + * @return int + */ + public function getValue() + { + return $this->value; + } + + /** + * The value of the enum. + * + * Generated from protobuf field int32 value = 2; + * @param int $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkInt32($var); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/ErrorSet.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/ErrorSet.php new file mode 100644 index 00000000..ef151137 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/ErrorSet.php @@ -0,0 +1,68 @@ +google.api.expr.v1beta1.ErrorSet + */ +class ErrorSet extends \Google\Protobuf\Internal\Message +{ + /** + * The errors in the set. + * + * Generated from protobuf field repeated .google.rpc.Status errors = 1; + */ + private $errors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $errors + * The errors in the set. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\PBEval::initOnce(); + parent::__construct($data); + } + + /** + * The errors in the set. + * + * Generated from protobuf field repeated .google.rpc.Status errors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrors() + { + return $this->errors; + } + + /** + * The errors in the set. + * + * Generated from protobuf field repeated .google.rpc.Status errors = 1; + * @param \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->errors = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/EvalState.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/EvalState.php new file mode 100644 index 00000000..31966ae7 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/EvalState.php @@ -0,0 +1,110 @@ +google.api.expr.v1beta1.EvalState + */ +class EvalState extends \Google\Protobuf\Internal\Message +{ + /** + * The unique values referenced in this message. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.ExprValue values = 1; + */ + private $values; + /** + * An ordered list of results. + * Tracks the flow of evaluation through the expression. + * May be sparse. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.EvalState.Result results = 3; + */ + private $results; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\ExprValue[]|\Google\Protobuf\Internal\RepeatedField $values + * The unique values referenced in this message. + * @type \Google\Api\Expr\V1beta1\EvalState\Result[]|\Google\Protobuf\Internal\RepeatedField $results + * An ordered list of results. + * Tracks the flow of evaluation through the expression. + * May be sparse. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\PBEval::initOnce(); + parent::__construct($data); + } + + /** + * The unique values referenced in this message. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.ExprValue values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * The unique values referenced in this message. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.ExprValue values = 1; + * @param \Google\Api\Expr\V1beta1\ExprValue[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1beta1\ExprValue::class); + $this->values = $arr; + + return $this; + } + + /** + * An ordered list of results. + * Tracks the flow of evaluation through the expression. + * May be sparse. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.EvalState.Result results = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResults() + { + return $this->results; + } + + /** + * An ordered list of results. + * Tracks the flow of evaluation through the expression. + * May be sparse. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.EvalState.Result results = 3; + * @param \Google\Api\Expr\V1beta1\EvalState\Result[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1beta1\EvalState\Result::class); + $this->results = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/EvalState/Result.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/EvalState/Result.php new file mode 100644 index 00000000..82f36167 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/EvalState/Result.php @@ -0,0 +1,104 @@ +google.api.expr.v1beta1.EvalState.Result + */ +class Result extends \Google\Protobuf\Internal\Message +{ + /** + * The expression this result is for. + * + * Generated from protobuf field .google.api.expr.v1beta1.IdRef expr = 1; + */ + private $expr = null; + /** + * The index in `values` of the resulting value. + * + * Generated from protobuf field int32 value = 2; + */ + private $value = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\IdRef $expr + * The expression this result is for. + * @type int $value + * The index in `values` of the resulting value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\PBEval::initOnce(); + parent::__construct($data); + } + + /** + * The expression this result is for. + * + * Generated from protobuf field .google.api.expr.v1beta1.IdRef expr = 1; + * @return \Google\Api\Expr\V1beta1\IdRef + */ + public function getExpr() + { + return $this->expr; + } + + /** + * The expression this result is for. + * + * Generated from protobuf field .google.api.expr.v1beta1.IdRef expr = 1; + * @param \Google\Api\Expr\V1beta1\IdRef $var + * @return $this + */ + public function setExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\IdRef::class); + $this->expr = $var; + + return $this; + } + + /** + * The index in `values` of the resulting value. + * + * Generated from protobuf field int32 value = 2; + * @return int + */ + public function getValue() + { + return $this->value; + } + + /** + * The index in `values` of the resulting value. + * + * Generated from protobuf field int32 value = 2; + * @param int $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkInt32($var); + $this->value = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Result::class, \Google\Api\Expr\V1beta1\EvalState_Result::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/EvalState_Result.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/EvalState_Result.php new file mode 100644 index 00000000..cc509a40 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/EvalState_Result.php @@ -0,0 +1,16 @@ +google.api.expr.v1beta1.Expr + */ +class Expr extends \Google\Protobuf\Internal\Message +{ + /** + * Required. An id assigned to this node by the parser which is unique in a + * given expression tree. This is used to associate type information and other + * attributes to a node in the parse tree. + * + * Generated from protobuf field int32 id = 2; + */ + private $id = 0; + protected $expr_kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $id + * Required. An id assigned to this node by the parser which is unique in a + * given expression tree. This is used to associate type information and other + * attributes to a node in the parse tree. + * @type \Google\Api\Expr\V1beta1\Literal $literal_expr + * A literal expression. + * @type \Google\Api\Expr\V1beta1\Expr\Ident $ident_expr + * An identifier expression. + * @type \Google\Api\Expr\V1beta1\Expr\Select $select_expr + * A field selection expression, e.g. `request.auth`. + * @type \Google\Api\Expr\V1beta1\Expr\Call $call_expr + * A call expression, including calls to predefined functions and operators. + * @type \Google\Api\Expr\V1beta1\Expr\CreateList $list_expr + * A list creation expression. + * @type \Google\Api\Expr\V1beta1\Expr\CreateStruct $struct_expr + * A map or object creation expression. + * @type \Google\Api\Expr\V1beta1\Expr\Comprehension $comprehension_expr + * A comprehension expression. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Expr::initOnce(); + parent::__construct($data); + } + + /** + * Required. An id assigned to this node by the parser which is unique in a + * given expression tree. This is used to associate type information and other + * attributes to a node in the parse tree. + * + * Generated from protobuf field int32 id = 2; + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Required. An id assigned to this node by the parser which is unique in a + * given expression tree. This is used to associate type information and other + * attributes to a node in the parse tree. + * + * Generated from protobuf field int32 id = 2; + * @param int $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkInt32($var); + $this->id = $var; + + return $this; + } + + /** + * A literal expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Literal literal_expr = 3; + * @return \Google\Api\Expr\V1beta1\Literal + */ + public function getLiteralExpr() + { + return $this->readOneof(3); + } + + /** + * A literal expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Literal literal_expr = 3; + * @param \Google\Api\Expr\V1beta1\Literal $var + * @return $this + */ + public function setLiteralExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Literal::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * An identifier expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr.Ident ident_expr = 4; + * @return \Google\Api\Expr\V1beta1\Expr\Ident + */ + public function getIdentExpr() + { + return $this->readOneof(4); + } + + /** + * An identifier expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr.Ident ident_expr = 4; + * @param \Google\Api\Expr\V1beta1\Expr\Ident $var + * @return $this + */ + public function setIdentExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr_Ident::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * A field selection expression, e.g. `request.auth`. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr.Select select_expr = 5; + * @return \Google\Api\Expr\V1beta1\Expr\Select + */ + public function getSelectExpr() + { + return $this->readOneof(5); + } + + /** + * A field selection expression, e.g. `request.auth`. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr.Select select_expr = 5; + * @param \Google\Api\Expr\V1beta1\Expr\Select $var + * @return $this + */ + public function setSelectExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr_Select::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * A call expression, including calls to predefined functions and operators. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr.Call call_expr = 6; + * @return \Google\Api\Expr\V1beta1\Expr\Call + */ + public function getCallExpr() + { + return $this->readOneof(6); + } + + /** + * A call expression, including calls to predefined functions and operators. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr.Call call_expr = 6; + * @param \Google\Api\Expr\V1beta1\Expr\Call $var + * @return $this + */ + public function setCallExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr_Call::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * A list creation expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr.CreateList list_expr = 7; + * @return \Google\Api\Expr\V1beta1\Expr\CreateList + */ + public function getListExpr() + { + return $this->readOneof(7); + } + + /** + * A list creation expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr.CreateList list_expr = 7; + * @param \Google\Api\Expr\V1beta1\Expr\CreateList $var + * @return $this + */ + public function setListExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr_CreateList::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * A map or object creation expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr.CreateStruct struct_expr = 8; + * @return \Google\Api\Expr\V1beta1\Expr\CreateStruct + */ + public function getStructExpr() + { + return $this->readOneof(8); + } + + /** + * A map or object creation expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr.CreateStruct struct_expr = 8; + * @param \Google\Api\Expr\V1beta1\Expr\CreateStruct $var + * @return $this + */ + public function setStructExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr_CreateStruct::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * A comprehension expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr.Comprehension comprehension_expr = 9; + * @return \Google\Api\Expr\V1beta1\Expr\Comprehension + */ + public function getComprehensionExpr() + { + return $this->readOneof(9); + } + + /** + * A comprehension expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr.Comprehension comprehension_expr = 9; + * @param \Google\Api\Expr\V1beta1\Expr\Comprehension $var + * @return $this + */ + public function setComprehensionExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr_Comprehension::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * @return string + */ + public function getExprKind() + { + return $this->whichOneof("expr_kind"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/Call.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/Call.php new file mode 100644 index 00000000..1d3659d9 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/Call.php @@ -0,0 +1,143 @@ +google.api.expr.v1beta1.Expr.Call + */ +class Call extends \Google\Protobuf\Internal\Message +{ + /** + * The target of an method call-style expression. For example, `x` in + * `x.f()`. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr target = 1; + */ + private $target = null; + /** + * Required. The name of the function or method being called. + * + * Generated from protobuf field string function = 2; + */ + private $function = ''; + /** + * The arguments. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.Expr args = 3; + */ + private $args; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\Expr $target + * The target of an method call-style expression. For example, `x` in + * `x.f()`. + * @type string $function + * Required. The name of the function or method being called. + * @type \Google\Api\Expr\V1beta1\Expr[]|\Google\Protobuf\Internal\RepeatedField $args + * The arguments. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Expr::initOnce(); + parent::__construct($data); + } + + /** + * The target of an method call-style expression. For example, `x` in + * `x.f()`. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr target = 1; + * @return \Google\Api\Expr\V1beta1\Expr + */ + public function getTarget() + { + return $this->target; + } + + /** + * The target of an method call-style expression. For example, `x` in + * `x.f()`. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr target = 1; + * @param \Google\Api\Expr\V1beta1\Expr $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr::class); + $this->target = $var; + + return $this; + } + + /** + * Required. The name of the function or method being called. + * + * Generated from protobuf field string function = 2; + * @return string + */ + public function getFunction() + { + return $this->function; + } + + /** + * Required. The name of the function or method being called. + * + * Generated from protobuf field string function = 2; + * @param string $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkString($var, True); + $this->function = $var; + + return $this; + } + + /** + * The arguments. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.Expr args = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getArgs() + { + return $this->args; + } + + /** + * The arguments. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.Expr args = 3; + * @param \Google\Api\Expr\V1beta1\Expr[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setArgs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1beta1\Expr::class); + $this->args = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Call::class, \Google\Api\Expr\V1beta1\Expr_Call::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/Comprehension.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/Comprehension.php new file mode 100644 index 00000000..34e33df8 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/Comprehension.php @@ -0,0 +1,310 @@ + 1000)`. + * * `map` - apply an expression to all elements in the input and return the + * output aggregate type: `[1, 2, 3].map(i, i * i)`. + * The `has(m.x)` macro tests whether the property `x` is present in struct + * `m`. The semantics of this macro depend on the type of `m`. For proto2 + * messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the + * macro tests whether the property is set to its default. For map and struct + * types, the macro tests whether the property `x` is defined on `m`. + * + * Generated from protobuf message google.api.expr.v1beta1.Expr.Comprehension + */ +class Comprehension extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the iteration variable. + * + * Generated from protobuf field string iter_var = 1; + */ + private $iter_var = ''; + /** + * The range over which var iterates. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr iter_range = 2; + */ + private $iter_range = null; + /** + * The name of the variable used for accumulation of the result. + * + * Generated from protobuf field string accu_var = 3; + */ + private $accu_var = ''; + /** + * The initial value of the accumulator. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr accu_init = 4; + */ + private $accu_init = null; + /** + * An expression which can contain iter_var and accu_var. + * Returns false when the result has been computed and may be used as + * a hint to short-circuit the remainder of the comprehension. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr loop_condition = 5; + */ + private $loop_condition = null; + /** + * An expression which can contain iter_var and accu_var. + * Computes the next value of accu_var. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr loop_step = 6; + */ + private $loop_step = null; + /** + * An expression which can contain accu_var. + * Computes the result. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr result = 7; + */ + private $result = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $iter_var + * The name of the iteration variable. + * @type \Google\Api\Expr\V1beta1\Expr $iter_range + * The range over which var iterates. + * @type string $accu_var + * The name of the variable used for accumulation of the result. + * @type \Google\Api\Expr\V1beta1\Expr $accu_init + * The initial value of the accumulator. + * @type \Google\Api\Expr\V1beta1\Expr $loop_condition + * An expression which can contain iter_var and accu_var. + * Returns false when the result has been computed and may be used as + * a hint to short-circuit the remainder of the comprehension. + * @type \Google\Api\Expr\V1beta1\Expr $loop_step + * An expression which can contain iter_var and accu_var. + * Computes the next value of accu_var. + * @type \Google\Api\Expr\V1beta1\Expr $result + * An expression which can contain accu_var. + * Computes the result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Expr::initOnce(); + parent::__construct($data); + } + + /** + * The name of the iteration variable. + * + * Generated from protobuf field string iter_var = 1; + * @return string + */ + public function getIterVar() + { + return $this->iter_var; + } + + /** + * The name of the iteration variable. + * + * Generated from protobuf field string iter_var = 1; + * @param string $var + * @return $this + */ + public function setIterVar($var) + { + GPBUtil::checkString($var, True); + $this->iter_var = $var; + + return $this; + } + + /** + * The range over which var iterates. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr iter_range = 2; + * @return \Google\Api\Expr\V1beta1\Expr + */ + public function getIterRange() + { + return $this->iter_range; + } + + /** + * The range over which var iterates. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr iter_range = 2; + * @param \Google\Api\Expr\V1beta1\Expr $var + * @return $this + */ + public function setIterRange($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr::class); + $this->iter_range = $var; + + return $this; + } + + /** + * The name of the variable used for accumulation of the result. + * + * Generated from protobuf field string accu_var = 3; + * @return string + */ + public function getAccuVar() + { + return $this->accu_var; + } + + /** + * The name of the variable used for accumulation of the result. + * + * Generated from protobuf field string accu_var = 3; + * @param string $var + * @return $this + */ + public function setAccuVar($var) + { + GPBUtil::checkString($var, True); + $this->accu_var = $var; + + return $this; + } + + /** + * The initial value of the accumulator. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr accu_init = 4; + * @return \Google\Api\Expr\V1beta1\Expr + */ + public function getAccuInit() + { + return $this->accu_init; + } + + /** + * The initial value of the accumulator. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr accu_init = 4; + * @param \Google\Api\Expr\V1beta1\Expr $var + * @return $this + */ + public function setAccuInit($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr::class); + $this->accu_init = $var; + + return $this; + } + + /** + * An expression which can contain iter_var and accu_var. + * Returns false when the result has been computed and may be used as + * a hint to short-circuit the remainder of the comprehension. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr loop_condition = 5; + * @return \Google\Api\Expr\V1beta1\Expr + */ + public function getLoopCondition() + { + return $this->loop_condition; + } + + /** + * An expression which can contain iter_var and accu_var. + * Returns false when the result has been computed and may be used as + * a hint to short-circuit the remainder of the comprehension. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr loop_condition = 5; + * @param \Google\Api\Expr\V1beta1\Expr $var + * @return $this + */ + public function setLoopCondition($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr::class); + $this->loop_condition = $var; + + return $this; + } + + /** + * An expression which can contain iter_var and accu_var. + * Computes the next value of accu_var. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr loop_step = 6; + * @return \Google\Api\Expr\V1beta1\Expr + */ + public function getLoopStep() + { + return $this->loop_step; + } + + /** + * An expression which can contain iter_var and accu_var. + * Computes the next value of accu_var. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr loop_step = 6; + * @param \Google\Api\Expr\V1beta1\Expr $var + * @return $this + */ + public function setLoopStep($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr::class); + $this->loop_step = $var; + + return $this; + } + + /** + * An expression which can contain accu_var. + * Computes the result. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr result = 7; + * @return \Google\Api\Expr\V1beta1\Expr + */ + public function getResult() + { + return $this->result; + } + + /** + * An expression which can contain accu_var. + * Computes the result. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr result = 7; + * @param \Google\Api\Expr\V1beta1\Expr $var + * @return $this + */ + public function setResult($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr::class); + $this->result = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Comprehension::class, \Google\Api\Expr\V1beta1\Expr_Comprehension::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/CreateList.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/CreateList.php new file mode 100644 index 00000000..ffd06419 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/CreateList.php @@ -0,0 +1,72 @@ +google.api.expr.v1beta1.Expr.CreateList + */ +class CreateList extends \Google\Protobuf\Internal\Message +{ + /** + * The elements part of the list. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.Expr elements = 1; + */ + private $elements; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\Expr[]|\Google\Protobuf\Internal\RepeatedField $elements + * The elements part of the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Expr::initOnce(); + parent::__construct($data); + } + + /** + * The elements part of the list. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.Expr elements = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getElements() + { + return $this->elements; + } + + /** + * The elements part of the list. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.Expr elements = 1; + * @param \Google\Api\Expr\V1beta1\Expr[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setElements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1beta1\Expr::class); + $this->elements = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CreateList::class, \Google\Api\Expr\V1beta1\Expr_CreateList::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/CreateStruct.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/CreateStruct.php new file mode 100644 index 00000000..ea7e07dd --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/CreateStruct.php @@ -0,0 +1,111 @@ +google.api.expr.v1beta1.Expr.CreateStruct + */ +class CreateStruct extends \Google\Protobuf\Internal\Message +{ + /** + * The type name of the message to be created, empty when creating map + * literals. + * + * Generated from protobuf field string type = 1; + */ + private $type = ''; + /** + * The entries in the creation expression. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.Expr.CreateStruct.Entry entries = 2; + */ + private $entries; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * The type name of the message to be created, empty when creating map + * literals. + * @type \Google\Api\Expr\V1beta1\Expr\CreateStruct\Entry[]|\Google\Protobuf\Internal\RepeatedField $entries + * The entries in the creation expression. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Expr::initOnce(); + parent::__construct($data); + } + + /** + * The type name of the message to be created, empty when creating map + * literals. + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The type name of the message to be created, empty when creating map + * literals. + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The entries in the creation expression. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.Expr.CreateStruct.Entry entries = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntries() + { + return $this->entries; + } + + /** + * The entries in the creation expression. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.Expr.CreateStruct.Entry entries = 2; + * @param \Google\Api\Expr\V1beta1\Expr\CreateStruct\Entry[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1beta1\Expr\CreateStruct\Entry::class); + $this->entries = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CreateStruct::class, \Google\Api\Expr\V1beta1\Expr_CreateStruct::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/CreateStruct/Entry.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/CreateStruct/Entry.php new file mode 100644 index 00000000..918e2805 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/CreateStruct/Entry.php @@ -0,0 +1,177 @@ +google.api.expr.v1beta1.Expr.CreateStruct.Entry + */ +class Entry extends \Google\Protobuf\Internal\Message +{ + /** + * Required. An id assigned to this node by the parser which is unique + * in a given expression tree. This is used to associate type + * information and other attributes to the node. + * + * Generated from protobuf field int32 id = 1; + */ + private $id = 0; + /** + * Required. The value assigned to the key. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr value = 4; + */ + private $value = null; + protected $key_kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $id + * Required. An id assigned to this node by the parser which is unique + * in a given expression tree. This is used to associate type + * information and other attributes to the node. + * @type string $field_key + * The field key for a message creator statement. + * @type \Google\Api\Expr\V1beta1\Expr $map_key + * The key expression for a map creation statement. + * @type \Google\Api\Expr\V1beta1\Expr $value + * Required. The value assigned to the key. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Expr::initOnce(); + parent::__construct($data); + } + + /** + * Required. An id assigned to this node by the parser which is unique + * in a given expression tree. This is used to associate type + * information and other attributes to the node. + * + * Generated from protobuf field int32 id = 1; + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Required. An id assigned to this node by the parser which is unique + * in a given expression tree. This is used to associate type + * information and other attributes to the node. + * + * Generated from protobuf field int32 id = 1; + * @param int $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkInt32($var); + $this->id = $var; + + return $this; + } + + /** + * The field key for a message creator statement. + * + * Generated from protobuf field string field_key = 2; + * @return string + */ + public function getFieldKey() + { + return $this->readOneof(2); + } + + /** + * The field key for a message creator statement. + * + * Generated from protobuf field string field_key = 2; + * @param string $var + * @return $this + */ + public function setFieldKey($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The key expression for a map creation statement. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr map_key = 3; + * @return \Google\Api\Expr\V1beta1\Expr + */ + public function getMapKey() + { + return $this->readOneof(3); + } + + /** + * The key expression for a map creation statement. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr map_key = 3; + * @param \Google\Api\Expr\V1beta1\Expr $var + * @return $this + */ + public function setMapKey($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Required. The value assigned to the key. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr value = 4; + * @return \Google\Api\Expr\V1beta1\Expr + */ + public function getValue() + { + return $this->value; + } + + /** + * Required. The value assigned to the key. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr value = 4; + * @param \Google\Api\Expr\V1beta1\Expr $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr::class); + $this->value = $var; + + return $this; + } + + /** + * @return string + */ + public function getKeyKind() + { + return $this->whichOneof("key_kind"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Entry::class, \Google\Api\Expr\V1beta1\Expr_CreateStruct_Entry::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/Ident.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/Ident.php new file mode 100644 index 00000000..39cccdcb --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/Ident.php @@ -0,0 +1,78 @@ +google.api.expr.v1beta1.Expr.Ident + */ +class Ident extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Holds a single, unqualified identifier, possibly preceded by a + * '.'. + * Qualified names are represented by the [Expr.Select][google.api.expr.v1beta1.Expr.Select] expression. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Holds a single, unqualified identifier, possibly preceded by a + * '.'. + * Qualified names are represented by the [Expr.Select][google.api.expr.v1beta1.Expr.Select] expression. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Expr::initOnce(); + parent::__construct($data); + } + + /** + * Required. Holds a single, unqualified identifier, possibly preceded by a + * '.'. + * Qualified names are represented by the [Expr.Select][google.api.expr.v1beta1.Expr.Select] expression. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Holds a single, unqualified identifier, possibly preceded by a + * '.'. + * Qualified names are represented by the [Expr.Select][google.api.expr.v1beta1.Expr.Select] expression. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Ident::class, \Google\Api\Expr\V1beta1\Expr_Ident::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/Select.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/Select.php new file mode 100644 index 00000000..e69456d9 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr/Select.php @@ -0,0 +1,158 @@ +google.api.expr.v1beta1.Expr.Select + */ +class Select extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The target of the selection expression. + * For example, in the select expression `request.auth`, the `request` + * portion of the expression is the `operand`. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr operand = 1; + */ + private $operand = null; + /** + * Required. The name of the field to select. + * For example, in the select expression `request.auth`, the `auth` portion + * of the expression would be the `field`. + * + * Generated from protobuf field string field = 2; + */ + private $field = ''; + /** + * Whether the select is to be interpreted as a field presence test. + * This results from the macro `has(request.auth)`. + * + * Generated from protobuf field bool test_only = 3; + */ + private $test_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\Expr $operand + * Required. The target of the selection expression. + * For example, in the select expression `request.auth`, the `request` + * portion of the expression is the `operand`. + * @type string $field + * Required. The name of the field to select. + * For example, in the select expression `request.auth`, the `auth` portion + * of the expression would be the `field`. + * @type bool $test_only + * Whether the select is to be interpreted as a field presence test. + * This results from the macro `has(request.auth)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Expr::initOnce(); + parent::__construct($data); + } + + /** + * Required. The target of the selection expression. + * For example, in the select expression `request.auth`, the `request` + * portion of the expression is the `operand`. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr operand = 1; + * @return \Google\Api\Expr\V1beta1\Expr + */ + public function getOperand() + { + return $this->operand; + } + + /** + * Required. The target of the selection expression. + * For example, in the select expression `request.auth`, the `request` + * portion of the expression is the `operand`. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr operand = 1; + * @param \Google\Api\Expr\V1beta1\Expr $var + * @return $this + */ + public function setOperand($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr::class); + $this->operand = $var; + + return $this; + } + + /** + * Required. The name of the field to select. + * For example, in the select expression `request.auth`, the `auth` portion + * of the expression would be the `field`. + * + * Generated from protobuf field string field = 2; + * @return string + */ + public function getField() + { + return $this->field; + } + + /** + * Required. The name of the field to select. + * For example, in the select expression `request.auth`, the `auth` portion + * of the expression would be the `field`. + * + * Generated from protobuf field string field = 2; + * @param string $var + * @return $this + */ + public function setField($var) + { + GPBUtil::checkString($var, True); + $this->field = $var; + + return $this; + } + + /** + * Whether the select is to be interpreted as a field presence test. + * This results from the macro `has(request.auth)`. + * + * Generated from protobuf field bool test_only = 3; + * @return bool + */ + public function getTestOnly() + { + return $this->test_only; + } + + /** + * Whether the select is to be interpreted as a field presence test. + * This results from the macro `has(request.auth)`. + * + * Generated from protobuf field bool test_only = 3; + * @param bool $var + * @return $this + */ + public function setTestOnly($var) + { + GPBUtil::checkBool($var); + $this->test_only = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Select::class, \Google\Api\Expr\V1beta1\Expr_Select::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/ExprValue.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/ExprValue.php new file mode 100644 index 00000000..041ea2d7 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/ExprValue.php @@ -0,0 +1,213 @@ +google.api.expr.v1beta1.ExprValue + */ +class ExprValue extends \Google\Protobuf\Internal\Message +{ + protected $kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\Value $value + * A concrete value. + * @type \Google\Api\Expr\V1beta1\ErrorSet $error + * The set of errors in the critical path of evalution. + * Only errors in the critical path are included. For example, + * `( || true) && ` will only result in ``, + * while ` || ` will result in both `` and + * ``. + * Errors cause by the presence of other errors are not included in the + * set. For example `.foo`, `foo()`, and ` + 1` will + * only result in ``. + * Multiple errors *might* be included when evaluation could result + * in different errors. For example ` + ` and + * `foo(, )` may result in ``, `` or both. + * The exact subset of errors included for this case is unspecified and + * depends on the implementation details of the evaluator. + * @type \Google\Api\Expr\V1beta1\UnknownSet $unknown + * The set of unknowns in the critical path of evaluation. + * Unknown behaves identically to Error with regards to propagation. + * Specifically, only unknowns in the critical path are included, unknowns + * caused by the presence of other unknowns are not included, and multiple + * unknowns *might* be included included when evaluation could result in + * different unknowns. For example: + * ( || true) && -> + * || -> + * .foo -> + * foo() -> + * + -> or + * Unknown takes precidence over Error in cases where a `Value` can short + * circuit the result: + * || -> + * && -> + * Errors take precidence in all other cases: + * + -> + * foo(, ) -> + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\PBEval::initOnce(); + parent::__construct($data); + } + + /** + * A concrete value. + * + * Generated from protobuf field .google.api.expr.v1beta1.Value value = 1; + * @return \Google\Api\Expr\V1beta1\Value + */ + public function getValue() + { + return $this->readOneof(1); + } + + /** + * A concrete value. + * + * Generated from protobuf field .google.api.expr.v1beta1.Value value = 1; + * @param \Google\Api\Expr\V1beta1\Value $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Value::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The set of errors in the critical path of evalution. + * Only errors in the critical path are included. For example, + * `( || true) && ` will only result in ``, + * while ` || ` will result in both `` and + * ``. + * Errors cause by the presence of other errors are not included in the + * set. For example `.foo`, `foo()`, and ` + 1` will + * only result in ``. + * Multiple errors *might* be included when evaluation could result + * in different errors. For example ` + ` and + * `foo(, )` may result in ``, `` or both. + * The exact subset of errors included for this case is unspecified and + * depends on the implementation details of the evaluator. + * + * Generated from protobuf field .google.api.expr.v1beta1.ErrorSet error = 2; + * @return \Google\Api\Expr\V1beta1\ErrorSet + */ + public function getError() + { + return $this->readOneof(2); + } + + /** + * The set of errors in the critical path of evalution. + * Only errors in the critical path are included. For example, + * `( || true) && ` will only result in ``, + * while ` || ` will result in both `` and + * ``. + * Errors cause by the presence of other errors are not included in the + * set. For example `.foo`, `foo()`, and ` + 1` will + * only result in ``. + * Multiple errors *might* be included when evaluation could result + * in different errors. For example ` + ` and + * `foo(, )` may result in ``, `` or both. + * The exact subset of errors included for this case is unspecified and + * depends on the implementation details of the evaluator. + * + * Generated from protobuf field .google.api.expr.v1beta1.ErrorSet error = 2; + * @param \Google\Api\Expr\V1beta1\ErrorSet $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\ErrorSet::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The set of unknowns in the critical path of evaluation. + * Unknown behaves identically to Error with regards to propagation. + * Specifically, only unknowns in the critical path are included, unknowns + * caused by the presence of other unknowns are not included, and multiple + * unknowns *might* be included included when evaluation could result in + * different unknowns. For example: + * ( || true) && -> + * || -> + * .foo -> + * foo() -> + * + -> or + * Unknown takes precidence over Error in cases where a `Value` can short + * circuit the result: + * || -> + * && -> + * Errors take precidence in all other cases: + * + -> + * foo(, ) -> + * + * Generated from protobuf field .google.api.expr.v1beta1.UnknownSet unknown = 3; + * @return \Google\Api\Expr\V1beta1\UnknownSet + */ + public function getUnknown() + { + return $this->readOneof(3); + } + + /** + * The set of unknowns in the critical path of evaluation. + * Unknown behaves identically to Error with regards to propagation. + * Specifically, only unknowns in the critical path are included, unknowns + * caused by the presence of other unknowns are not included, and multiple + * unknowns *might* be included included when evaluation could result in + * different unknowns. For example: + * ( || true) && -> + * || -> + * .foo -> + * foo() -> + * + -> or + * Unknown takes precidence over Error in cases where a `Value` can short + * circuit the result: + * || -> + * && -> + * Errors take precidence in all other cases: + * + -> + * foo(, ) -> + * + * Generated from protobuf field .google.api.expr.v1beta1.UnknownSet unknown = 3; + * @param \Google\Api\Expr\V1beta1\UnknownSet $var + * @return $this + */ + public function setUnknown($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\UnknownSet::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getKind() + { + return $this->whichOneof("kind"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr_Call.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr_Call.php new file mode 100644 index 00000000..92fbe02e --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/Expr_Call.php @@ -0,0 +1,16 @@ +google.api.expr.v1beta1.FunctionDecl + */ +class FunctionDecl extends \Google\Protobuf\Internal\Message +{ + /** + * The function arguments. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.IdentDecl args = 1; + */ + private $args; + /** + * Optional declared return type. + * + * Generated from protobuf field .google.api.expr.v1beta1.DeclType return_type = 2; + */ + private $return_type = null; + /** + * If the first argument of the function is the receiver. + * + * Generated from protobuf field bool receiver_function = 3; + */ + private $receiver_function = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\IdentDecl[]|\Google\Protobuf\Internal\RepeatedField $args + * The function arguments. + * @type \Google\Api\Expr\V1beta1\DeclType $return_type + * Optional declared return type. + * @type bool $receiver_function + * If the first argument of the function is the receiver. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Decl::initOnce(); + parent::__construct($data); + } + + /** + * The function arguments. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.IdentDecl args = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getArgs() + { + return $this->args; + } + + /** + * The function arguments. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.IdentDecl args = 1; + * @param \Google\Api\Expr\V1beta1\IdentDecl[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setArgs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1beta1\IdentDecl::class); + $this->args = $arr; + + return $this; + } + + /** + * Optional declared return type. + * + * Generated from protobuf field .google.api.expr.v1beta1.DeclType return_type = 2; + * @return \Google\Api\Expr\V1beta1\DeclType + */ + public function getReturnType() + { + return $this->return_type; + } + + /** + * Optional declared return type. + * + * Generated from protobuf field .google.api.expr.v1beta1.DeclType return_type = 2; + * @param \Google\Api\Expr\V1beta1\DeclType $var + * @return $this + */ + public function setReturnType($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\DeclType::class); + $this->return_type = $var; + + return $this; + } + + /** + * If the first argument of the function is the receiver. + * + * Generated from protobuf field bool receiver_function = 3; + * @return bool + */ + public function getReceiverFunction() + { + return $this->receiver_function; + } + + /** + * If the first argument of the function is the receiver. + * + * Generated from protobuf field bool receiver_function = 3; + * @param bool $var + * @return $this + */ + public function setReceiverFunction($var) + { + GPBUtil::checkBool($var); + $this->receiver_function = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/IdRef.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/IdRef.php new file mode 100644 index 00000000..86649dd4 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/IdRef.php @@ -0,0 +1,67 @@ +google.api.expr.v1beta1.IdRef + */ +class IdRef extends \Google\Protobuf\Internal\Message +{ + /** + * The expression id. + * + * Generated from protobuf field int32 id = 1; + */ + private $id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $id + * The expression id. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\PBEval::initOnce(); + parent::__construct($data); + } + + /** + * The expression id. + * + * Generated from protobuf field int32 id = 1; + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * The expression id. + * + * Generated from protobuf field int32 id = 1; + * @param int $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkInt32($var); + $this->id = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/IdentDecl.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/IdentDecl.php new file mode 100644 index 00000000..9db4ee10 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/IdentDecl.php @@ -0,0 +1,101 @@ +google.api.expr.v1beta1.IdentDecl + */ +class IdentDecl extends \Google\Protobuf\Internal\Message +{ + /** + * Optional type of the identifier. + * + * Generated from protobuf field .google.api.expr.v1beta1.DeclType type = 3; + */ + private $type = null; + /** + * Optional value of the identifier. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr value = 4; + */ + private $value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\DeclType $type + * Optional type of the identifier. + * @type \Google\Api\Expr\V1beta1\Expr $value + * Optional value of the identifier. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Decl::initOnce(); + parent::__construct($data); + } + + /** + * Optional type of the identifier. + * + * Generated from protobuf field .google.api.expr.v1beta1.DeclType type = 3; + * @return \Google\Api\Expr\V1beta1\DeclType + */ + public function getType() + { + return $this->type; + } + + /** + * Optional type of the identifier. + * + * Generated from protobuf field .google.api.expr.v1beta1.DeclType type = 3; + * @param \Google\Api\Expr\V1beta1\DeclType $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\DeclType::class); + $this->type = $var; + + return $this; + } + + /** + * Optional value of the identifier. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr value = 4; + * @return \Google\Api\Expr\V1beta1\Expr + */ + public function getValue() + { + return $this->value; + } + + /** + * Optional value of the identifier. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr value = 4; + * @param \Google\Api\Expr\V1beta1\Expr $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr::class); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/ListValue.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/ListValue.php new file mode 100644 index 00000000..0ab5244e --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/ListValue.php @@ -0,0 +1,69 @@ +google.api.expr.v1beta1.ListValue + */ +class ListValue extends \Google\Protobuf\Internal\Message +{ + /** + * The ordered values in the list. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.Value values = 1; + */ + private $values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\Value[]|\Google\Protobuf\Internal\RepeatedField $values + * The ordered values in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Value::initOnce(); + parent::__construct($data); + } + + /** + * The ordered values in the list. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.Value values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * The ordered values in the list. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.Value values = 1; + * @param \Google\Api\Expr\V1beta1\Value[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1beta1\Value::class); + $this->values = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/Literal.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/Literal.php new file mode 100644 index 00000000..701de445 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/Literal.php @@ -0,0 +1,245 @@ +google.api.expr.v1beta1.Literal + */ +class Literal extends \Google\Protobuf\Internal\Message +{ + protected $constant_kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $null_value + * null value. + * @type bool $bool_value + * boolean value. + * @type int|string $int64_value + * int64 value. + * @type int|string $uint64_value + * uint64 value. + * @type float $double_value + * double value. + * @type string $string_value + * string value. + * @type string $bytes_value + * bytes value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Expr::initOnce(); + parent::__construct($data); + } + + /** + * null value. + * + * Generated from protobuf field .google.protobuf.NullValue null_value = 1; + * @return int + */ + public function getNullValue() + { + return $this->readOneof(1); + } + + /** + * null value. + * + * Generated from protobuf field .google.protobuf.NullValue null_value = 1; + * @param int $var + * @return $this + */ + public function setNullValue($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\NullValue::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * boolean value. + * + * Generated from protobuf field bool bool_value = 2; + * @return bool + */ + public function getBoolValue() + { + return $this->readOneof(2); + } + + /** + * boolean value. + * + * Generated from protobuf field bool bool_value = 2; + * @param bool $var + * @return $this + */ + public function setBoolValue($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * int64 value. + * + * Generated from protobuf field int64 int64_value = 3; + * @return int|string + */ + public function getInt64Value() + { + return $this->readOneof(3); + } + + /** + * int64 value. + * + * Generated from protobuf field int64 int64_value = 3; + * @param int|string $var + * @return $this + */ + public function setInt64Value($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * uint64 value. + * + * Generated from protobuf field uint64 uint64_value = 4; + * @return int|string + */ + public function getUint64Value() + { + return $this->readOneof(4); + } + + /** + * uint64 value. + * + * Generated from protobuf field uint64 uint64_value = 4; + * @param int|string $var + * @return $this + */ + public function setUint64Value($var) + { + GPBUtil::checkUint64($var); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * double value. + * + * Generated from protobuf field double double_value = 5; + * @return float + */ + public function getDoubleValue() + { + return $this->readOneof(5); + } + + /** + * double value. + * + * Generated from protobuf field double double_value = 5; + * @param float $var + * @return $this + */ + public function setDoubleValue($var) + { + GPBUtil::checkDouble($var); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * string value. + * + * Generated from protobuf field string string_value = 6; + * @return string + */ + public function getStringValue() + { + return $this->readOneof(6); + } + + /** + * string value. + * + * Generated from protobuf field string string_value = 6; + * @param string $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * bytes value. + * + * Generated from protobuf field bytes bytes_value = 7; + * @return string + */ + public function getBytesValue() + { + return $this->readOneof(7); + } + + /** + * bytes value. + * + * Generated from protobuf field bytes bytes_value = 7; + * @param string $var + * @return $this + */ + public function setBytesValue($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * @return string + */ + public function getConstantKind() + { + return $this->whichOneof("constant_kind"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/MapValue.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/MapValue.php new file mode 100644 index 00000000..fb3718e7 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/MapValue.php @@ -0,0 +1,77 @@ +google.api.expr.v1beta1.MapValue + */ +class MapValue extends \Google\Protobuf\Internal\Message +{ + /** + * The set of map entries. + * CEL has fewer restrictions on keys, so a protobuf map represenation + * cannot be used. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.MapValue.Entry entries = 1; + */ + private $entries; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\MapValue\Entry[]|\Google\Protobuf\Internal\RepeatedField $entries + * The set of map entries. + * CEL has fewer restrictions on keys, so a protobuf map represenation + * cannot be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Value::initOnce(); + parent::__construct($data); + } + + /** + * The set of map entries. + * CEL has fewer restrictions on keys, so a protobuf map represenation + * cannot be used. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.MapValue.Entry entries = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntries() + { + return $this->entries; + } + + /** + * The set of map entries. + * CEL has fewer restrictions on keys, so a protobuf map represenation + * cannot be used. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.MapValue.Entry entries = 1; + * @param \Google\Api\Expr\V1beta1\MapValue\Entry[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1beta1\MapValue\Entry::class); + $this->entries = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/MapValue/Entry.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/MapValue/Entry.php new file mode 100644 index 00000000..0f4d5aff --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/MapValue/Entry.php @@ -0,0 +1,112 @@ +google.api.expr.v1beta1.MapValue.Entry + */ +class Entry extends \Google\Protobuf\Internal\Message +{ + /** + * The key. + * Must be unique with in the map. + * Currently only boolean, int, uint, and string values can be keys. + * + * Generated from protobuf field .google.api.expr.v1beta1.Value key = 1; + */ + private $key = null; + /** + * The value. + * + * Generated from protobuf field .google.api.expr.v1beta1.Value value = 2; + */ + private $value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\Value $key + * The key. + * Must be unique with in the map. + * Currently only boolean, int, uint, and string values can be keys. + * @type \Google\Api\Expr\V1beta1\Value $value + * The value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Value::initOnce(); + parent::__construct($data); + } + + /** + * The key. + * Must be unique with in the map. + * Currently only boolean, int, uint, and string values can be keys. + * + * Generated from protobuf field .google.api.expr.v1beta1.Value key = 1; + * @return \Google\Api\Expr\V1beta1\Value + */ + public function getKey() + { + return $this->key; + } + + /** + * The key. + * Must be unique with in the map. + * Currently only boolean, int, uint, and string values can be keys. + * + * Generated from protobuf field .google.api.expr.v1beta1.Value key = 1; + * @param \Google\Api\Expr\V1beta1\Value $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Value::class); + $this->key = $var; + + return $this; + } + + /** + * The value. + * + * Generated from protobuf field .google.api.expr.v1beta1.Value value = 2; + * @return \Google\Api\Expr\V1beta1\Value + */ + public function getValue() + { + return $this->value; + } + + /** + * The value. + * + * Generated from protobuf field .google.api.expr.v1beta1.Value value = 2; + * @param \Google\Api\Expr\V1beta1\Value $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Value::class); + $this->value = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Entry::class, \Google\Api\Expr\V1beta1\MapValue_Entry::class); + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/MapValue_Entry.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/MapValue_Entry.php new file mode 100644 index 00000000..3665120f --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/MapValue_Entry.php @@ -0,0 +1,16 @@ +google.api.expr.v1beta1.ParsedExpr + */ +class ParsedExpr extends \Google\Protobuf\Internal\Message +{ + /** + * The parsed expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr expr = 2; + */ + private $expr = null; + /** + * The source info derived from input that generated the parsed `expr`. + * + * Generated from protobuf field .google.api.expr.v1beta1.SourceInfo source_info = 3; + */ + private $source_info = null; + /** + * The syntax version of the source, e.g. `cel1`. + * + * Generated from protobuf field string syntax_version = 4; + */ + private $syntax_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\Expr $expr + * The parsed expression. + * @type \Google\Api\Expr\V1beta1\SourceInfo $source_info + * The source info derived from input that generated the parsed `expr`. + * @type string $syntax_version + * The syntax version of the source, e.g. `cel1`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Expr::initOnce(); + parent::__construct($data); + } + + /** + * The parsed expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr expr = 2; + * @return \Google\Api\Expr\V1beta1\Expr + */ + public function getExpr() + { + return $this->expr; + } + + /** + * The parsed expression. + * + * Generated from protobuf field .google.api.expr.v1beta1.Expr expr = 2; + * @param \Google\Api\Expr\V1beta1\Expr $var + * @return $this + */ + public function setExpr($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\Expr::class); + $this->expr = $var; + + return $this; + } + + /** + * The source info derived from input that generated the parsed `expr`. + * + * Generated from protobuf field .google.api.expr.v1beta1.SourceInfo source_info = 3; + * @return \Google\Api\Expr\V1beta1\SourceInfo + */ + public function getSourceInfo() + { + return $this->source_info; + } + + /** + * The source info derived from input that generated the parsed `expr`. + * + * Generated from protobuf field .google.api.expr.v1beta1.SourceInfo source_info = 3; + * @param \Google\Api\Expr\V1beta1\SourceInfo $var + * @return $this + */ + public function setSourceInfo($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\SourceInfo::class); + $this->source_info = $var; + + return $this; + } + + /** + * The syntax version of the source, e.g. `cel1`. + * + * Generated from protobuf field string syntax_version = 4; + * @return string + */ + public function getSyntaxVersion() + { + return $this->syntax_version; + } + + /** + * The syntax version of the source, e.g. `cel1`. + * + * Generated from protobuf field string syntax_version = 4; + * @param string $var + * @return $this + */ + public function setSyntaxVersion($var) + { + GPBUtil::checkString($var, True); + $this->syntax_version = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/SourceInfo.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/SourceInfo.php new file mode 100644 index 00000000..7cf5f5c3 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/SourceInfo.php @@ -0,0 +1,163 @@ +google.api.expr.v1beta1.SourceInfo + */ +class SourceInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The location name. All position information attached to an expression is + * relative to this location. + * The location could be a file, UI element, or similar. For example, + * `acme/app/AnvilPolicy.cel`. + * + * Generated from protobuf field string location = 2; + */ + private $location = ''; + /** + * Monotonically increasing list of character offsets where newlines appear. + * The line number of a given position is the index `i` where for a given + * `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The + * column may be derivd from `id_positions[id] - line_offsets[i]`. + * + * Generated from protobuf field repeated int32 line_offsets = 3; + */ + private $line_offsets; + /** + * A map from the parse node id (e.g. `Expr.id`) to the character offset + * within source. + * + * Generated from protobuf field map positions = 4; + */ + private $positions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $location + * The location name. All position information attached to an expression is + * relative to this location. + * The location could be a file, UI element, or similar. For example, + * `acme/app/AnvilPolicy.cel`. + * @type int[]|\Google\Protobuf\Internal\RepeatedField $line_offsets + * Monotonically increasing list of character offsets where newlines appear. + * The line number of a given position is the index `i` where for a given + * `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The + * column may be derivd from `id_positions[id] - line_offsets[i]`. + * @type array|\Google\Protobuf\Internal\MapField $positions + * A map from the parse node id (e.g. `Expr.id`) to the character offset + * within source. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Source::initOnce(); + parent::__construct($data); + } + + /** + * The location name. All position information attached to an expression is + * relative to this location. + * The location could be a file, UI element, or similar. For example, + * `acme/app/AnvilPolicy.cel`. + * + * Generated from protobuf field string location = 2; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The location name. All position information attached to an expression is + * relative to this location. + * The location could be a file, UI element, or similar. For example, + * `acme/app/AnvilPolicy.cel`. + * + * Generated from protobuf field string location = 2; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * Monotonically increasing list of character offsets where newlines appear. + * The line number of a given position is the index `i` where for a given + * `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The + * column may be derivd from `id_positions[id] - line_offsets[i]`. + * + * Generated from protobuf field repeated int32 line_offsets = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLineOffsets() + { + return $this->line_offsets; + } + + /** + * Monotonically increasing list of character offsets where newlines appear. + * The line number of a given position is the index `i` where for a given + * `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The + * column may be derivd from `id_positions[id] - line_offsets[i]`. + * + * Generated from protobuf field repeated int32 line_offsets = 3; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLineOffsets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->line_offsets = $arr; + + return $this; + } + + /** + * A map from the parse node id (e.g. `Expr.id`) to the character offset + * within source. + * + * Generated from protobuf field map positions = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getPositions() + { + return $this->positions; + } + + /** + * A map from the parse node id (e.g. `Expr.id`) to the character offset + * within source. + * + * Generated from protobuf field map positions = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setPositions($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::INT32, \Google\Protobuf\Internal\GPBType::INT32); + $this->positions = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/SourcePosition.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/SourcePosition.php new file mode 100644 index 00000000..87df4cff --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/SourcePosition.php @@ -0,0 +1,177 @@ +google.api.expr.v1beta1.SourcePosition + */ +class SourcePosition extends \Google\Protobuf\Internal\Message +{ + /** + * The soucre location name (e.g. file name). + * + * Generated from protobuf field string location = 1; + */ + private $location = ''; + /** + * The character offset. + * + * Generated from protobuf field int32 offset = 2; + */ + private $offset = 0; + /** + * The 1-based index of the starting line in the source text + * where the issue occurs, or 0 if unknown. + * + * Generated from protobuf field int32 line = 3; + */ + private $line = 0; + /** + * The 0-based index of the starting position within the line of source text + * where the issue occurs. Only meaningful if line is nonzer.. + * + * Generated from protobuf field int32 column = 4; + */ + private $column = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $location + * The soucre location name (e.g. file name). + * @type int $offset + * The character offset. + * @type int $line + * The 1-based index of the starting line in the source text + * where the issue occurs, or 0 if unknown. + * @type int $column + * The 0-based index of the starting position within the line of source text + * where the issue occurs. Only meaningful if line is nonzer.. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Source::initOnce(); + parent::__construct($data); + } + + /** + * The soucre location name (e.g. file name). + * + * Generated from protobuf field string location = 1; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The soucre location name (e.g. file name). + * + * Generated from protobuf field string location = 1; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * The character offset. + * + * Generated from protobuf field int32 offset = 2; + * @return int + */ + public function getOffset() + { + return $this->offset; + } + + /** + * The character offset. + * + * Generated from protobuf field int32 offset = 2; + * @param int $var + * @return $this + */ + public function setOffset($var) + { + GPBUtil::checkInt32($var); + $this->offset = $var; + + return $this; + } + + /** + * The 1-based index of the starting line in the source text + * where the issue occurs, or 0 if unknown. + * + * Generated from protobuf field int32 line = 3; + * @return int + */ + public function getLine() + { + return $this->line; + } + + /** + * The 1-based index of the starting line in the source text + * where the issue occurs, or 0 if unknown. + * + * Generated from protobuf field int32 line = 3; + * @param int $var + * @return $this + */ + public function setLine($var) + { + GPBUtil::checkInt32($var); + $this->line = $var; + + return $this; + } + + /** + * The 0-based index of the starting position within the line of source text + * where the issue occurs. Only meaningful if line is nonzer.. + * + * Generated from protobuf field int32 column = 4; + * @return int + */ + public function getColumn() + { + return $this->column; + } + + /** + * The 0-based index of the starting position within the line of source text + * where the issue occurs. Only meaningful if line is nonzer.. + * + * Generated from protobuf field int32 column = 4; + * @param int $var + * @return $this + */ + public function setColumn($var) + { + GPBUtil::checkInt32($var); + $this->column = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/UnknownSet.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/UnknownSet.php new file mode 100644 index 00000000..6200c0a1 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/UnknownSet.php @@ -0,0 +1,68 @@ +google.api.expr.v1beta1.UnknownSet + */ +class UnknownSet extends \Google\Protobuf\Internal\Message +{ + /** + * The ids of the expressions with unknown values. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.IdRef exprs = 1; + */ + private $exprs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Expr\V1beta1\IdRef[]|\Google\Protobuf\Internal\RepeatedField $exprs + * The ids of the expressions with unknown values. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\PBEval::initOnce(); + parent::__construct($data); + } + + /** + * The ids of the expressions with unknown values. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.IdRef exprs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExprs() + { + return $this->exprs; + } + + /** + * The ids of the expressions with unknown values. + * + * Generated from protobuf field repeated .google.api.expr.v1beta1.IdRef exprs = 1; + * @param \Google\Api\Expr\V1beta1\IdRef[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExprs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Expr\V1beta1\IdRef::class); + $this->exprs = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Expr/V1beta1/Value.php b/vendor/google/common-protos/src/Api/Expr/V1beta1/Value.php new file mode 100644 index 00000000..a3f31d2e --- /dev/null +++ b/vendor/google/common-protos/src/Api/Expr/V1beta1/Value.php @@ -0,0 +1,380 @@ +google.api.expr.v1beta1.Value + */ +class Value extends \Google\Protobuf\Internal\Message +{ + protected $kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $null_value + * Null value. + * @type bool $bool_value + * Boolean value. + * @type int|string $int64_value + * Signed integer value. + * @type int|string $uint64_value + * Unsigned integer value. + * @type float $double_value + * Floating point value. + * @type string $string_value + * UTF-8 string value. + * @type string $bytes_value + * Byte string value. + * @type \Google\Api\Expr\V1beta1\EnumValue $enum_value + * An enum value. + * @type \Google\Protobuf\Any $object_value + * The proto message backing an object value. + * @type \Google\Api\Expr\V1beta1\MapValue $map_value + * Map value. + * @type \Google\Api\Expr\V1beta1\ListValue $list_value + * List value. + * @type string $type_value + * A Type value represented by the fully qualified name of the type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Expr\V1Beta1\Value::initOnce(); + parent::__construct($data); + } + + /** + * Null value. + * + * Generated from protobuf field .google.protobuf.NullValue null_value = 1; + * @return int + */ + public function getNullValue() + { + return $this->readOneof(1); + } + + /** + * Null value. + * + * Generated from protobuf field .google.protobuf.NullValue null_value = 1; + * @param int $var + * @return $this + */ + public function setNullValue($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\NullValue::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Boolean value. + * + * Generated from protobuf field bool bool_value = 2; + * @return bool + */ + public function getBoolValue() + { + return $this->readOneof(2); + } + + /** + * Boolean value. + * + * Generated from protobuf field bool bool_value = 2; + * @param bool $var + * @return $this + */ + public function setBoolValue($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Signed integer value. + * + * Generated from protobuf field int64 int64_value = 3; + * @return int|string + */ + public function getInt64Value() + { + return $this->readOneof(3); + } + + /** + * Signed integer value. + * + * Generated from protobuf field int64 int64_value = 3; + * @param int|string $var + * @return $this + */ + public function setInt64Value($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Unsigned integer value. + * + * Generated from protobuf field uint64 uint64_value = 4; + * @return int|string + */ + public function getUint64Value() + { + return $this->readOneof(4); + } + + /** + * Unsigned integer value. + * + * Generated from protobuf field uint64 uint64_value = 4; + * @param int|string $var + * @return $this + */ + public function setUint64Value($var) + { + GPBUtil::checkUint64($var); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Floating point value. + * + * Generated from protobuf field double double_value = 5; + * @return float + */ + public function getDoubleValue() + { + return $this->readOneof(5); + } + + /** + * Floating point value. + * + * Generated from protobuf field double double_value = 5; + * @param float $var + * @return $this + */ + public function setDoubleValue($var) + { + GPBUtil::checkDouble($var); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * UTF-8 string value. + * + * Generated from protobuf field string string_value = 6; + * @return string + */ + public function getStringValue() + { + return $this->readOneof(6); + } + + /** + * UTF-8 string value. + * + * Generated from protobuf field string string_value = 6; + * @param string $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Byte string value. + * + * Generated from protobuf field bytes bytes_value = 7; + * @return string + */ + public function getBytesValue() + { + return $this->readOneof(7); + } + + /** + * Byte string value. + * + * Generated from protobuf field bytes bytes_value = 7; + * @param string $var + * @return $this + */ + public function setBytesValue($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * An enum value. + * + * Generated from protobuf field .google.api.expr.v1beta1.EnumValue enum_value = 9; + * @return \Google\Api\Expr\V1beta1\EnumValue + */ + public function getEnumValue() + { + return $this->readOneof(9); + } + + /** + * An enum value. + * + * Generated from protobuf field .google.api.expr.v1beta1.EnumValue enum_value = 9; + * @param \Google\Api\Expr\V1beta1\EnumValue $var + * @return $this + */ + public function setEnumValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\EnumValue::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * The proto message backing an object value. + * + * Generated from protobuf field .google.protobuf.Any object_value = 10; + * @return \Google\Protobuf\Any + */ + public function getObjectValue() + { + return $this->readOneof(10); + } + + /** + * The proto message backing an object value. + * + * Generated from protobuf field .google.protobuf.Any object_value = 10; + * @param \Google\Protobuf\Any $var + * @return $this + */ + public function setObjectValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Map value. + * + * Generated from protobuf field .google.api.expr.v1beta1.MapValue map_value = 11; + * @return \Google\Api\Expr\V1beta1\MapValue + */ + public function getMapValue() + { + return $this->readOneof(11); + } + + /** + * Map value. + * + * Generated from protobuf field .google.api.expr.v1beta1.MapValue map_value = 11; + * @param \Google\Api\Expr\V1beta1\MapValue $var + * @return $this + */ + public function setMapValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\MapValue::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * List value. + * + * Generated from protobuf field .google.api.expr.v1beta1.ListValue list_value = 12; + * @return \Google\Api\Expr\V1beta1\ListValue + */ + public function getListValue() + { + return $this->readOneof(12); + } + + /** + * List value. + * + * Generated from protobuf field .google.api.expr.v1beta1.ListValue list_value = 12; + * @param \Google\Api\Expr\V1beta1\ListValue $var + * @return $this + */ + public function setListValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Expr\V1beta1\ListValue::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * A Type value represented by the fully qualified name of the type. + * + * Generated from protobuf field string type_value = 15; + * @return string + */ + public function getTypeValue() + { + return $this->readOneof(15); + } + + /** + * A Type value represented by the fully qualified name of the type. + * + * Generated from protobuf field string type_value = 15; + * @param string $var + * @return $this + */ + public function setTypeValue($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(15, $var); + + return $this; + } + + /** + * @return string + */ + public function getKind() + { + return $this->whichOneof("kind"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/FieldBehavior.php b/vendor/google/common-protos/src/Api/FieldBehavior.php new file mode 100644 index 00000000..ccfa0e7b --- /dev/null +++ b/vendor/google/common-protos/src/Api/FieldBehavior.php @@ -0,0 +1,97 @@ +google.api.FieldBehavior + */ +class FieldBehavior +{ + /** + * Conventional default for enums. Do not use this. + * + * Generated from protobuf enum FIELD_BEHAVIOR_UNSPECIFIED = 0; + */ + const FIELD_BEHAVIOR_UNSPECIFIED = 0; + /** + * Specifically denotes a field as optional. + * While all fields in protocol buffers are optional, this may be specified + * for emphasis if appropriate. + * + * Generated from protobuf enum OPTIONAL = 1; + */ + const OPTIONAL = 1; + /** + * Denotes a field as required. + * This indicates that the field **must** be provided as part of the request, + * and failure to do so will cause an error (usually `INVALID_ARGUMENT`). + * + * Generated from protobuf enum REQUIRED = 2; + */ + const REQUIRED = 2; + /** + * Denotes a field as output only. + * This indicates that the field is provided in responses, but including the + * field in a request does nothing (the server *must* ignore it and + * *must not* throw an error as a result of the field's presence). + * + * Generated from protobuf enum OUTPUT_ONLY = 3; + */ + const OUTPUT_ONLY = 3; + /** + * Denotes a field as input only. + * This indicates that the field is provided in requests, and the + * corresponding field is not included in output. + * + * Generated from protobuf enum INPUT_ONLY = 4; + */ + const INPUT_ONLY = 4; + /** + * Denotes a field as immutable. + * This indicates that the field may be set once in a request to create a + * resource, but may not be changed thereafter. + * + * Generated from protobuf enum IMMUTABLE = 5; + */ + const IMMUTABLE = 5; + + private static $valueToName = [ + self::FIELD_BEHAVIOR_UNSPECIFIED => 'FIELD_BEHAVIOR_UNSPECIFIED', + self::OPTIONAL => 'OPTIONAL', + self::REQUIRED => 'REQUIRED', + self::OUTPUT_ONLY => 'OUTPUT_ONLY', + self::INPUT_ONLY => 'INPUT_ONLY', + self::IMMUTABLE => 'IMMUTABLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/vendor/google/common-protos/src/Api/Http.php b/vendor/google/common-protos/src/Api/Http.php new file mode 100644 index 00000000..dd1e3fad --- /dev/null +++ b/vendor/google/common-protos/src/Api/Http.php @@ -0,0 +1,123 @@ +google.api.Http + */ +class Http extends \Google\Protobuf\Internal\Message +{ + /** + * A list of HTTP configuration rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.HttpRule rules = 1; + */ + private $rules; + /** + * When set to true, URL path parmeters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + * + * Generated from protobuf field bool fully_decode_reserved_expansion = 2; + */ + private $fully_decode_reserved_expansion = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\HttpRule[]|\Google\Protobuf\Internal\RepeatedField $rules + * A list of HTTP configuration rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * @type bool $fully_decode_reserved_expansion + * When set to true, URL path parmeters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Http::initOnce(); + parent::__construct($data); + } + + /** + * A list of HTTP configuration rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.HttpRule rules = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * A list of HTTP configuration rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.HttpRule rules = 1; + * @param \Google\Api\HttpRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\HttpRule::class); + $this->rules = $arr; + + return $this; + } + + /** + * When set to true, URL path parmeters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + * + * Generated from protobuf field bool fully_decode_reserved_expansion = 2; + * @return bool + */ + public function getFullyDecodeReservedExpansion() + { + return $this->fully_decode_reserved_expansion; + } + + /** + * When set to true, URL path parmeters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + * + * Generated from protobuf field bool fully_decode_reserved_expansion = 2; + * @param bool $var + * @return $this + */ + public function setFullyDecodeReservedExpansion($var) + { + GPBUtil::checkBool($var); + $this->fully_decode_reserved_expansion = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/HttpBody.php b/vendor/google/common-protos/src/Api/HttpBody.php new file mode 100644 index 00000000..fb9ac16d --- /dev/null +++ b/vendor/google/common-protos/src/Api/HttpBody.php @@ -0,0 +1,166 @@ +google.api.HttpBody + */ +class HttpBody extends \Google\Protobuf\Internal\Message +{ + /** + * The HTTP Content-Type string representing the content type of the body. + * + * Generated from protobuf field string content_type = 1; + */ + private $content_type = ''; + /** + * HTTP body binary data. + * + * Generated from protobuf field bytes data = 2; + */ + private $data = ''; + /** + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * + * Generated from protobuf field repeated .google.protobuf.Any extensions = 3; + */ + private $extensions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content_type + * The HTTP Content-Type string representing the content type of the body. + * @type string $data + * HTTP body binary data. + * @type \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Httpbody::initOnce(); + parent::__construct($data); + } + + /** + * The HTTP Content-Type string representing the content type of the body. + * + * Generated from protobuf field string content_type = 1; + * @return string + */ + public function getContentType() + { + return $this->content_type; + } + + /** + * The HTTP Content-Type string representing the content type of the body. + * + * Generated from protobuf field string content_type = 1; + * @param string $var + * @return $this + */ + public function setContentType($var) + { + GPBUtil::checkString($var, True); + $this->content_type = $var; + + return $this; + } + + /** + * HTTP body binary data. + * + * Generated from protobuf field bytes data = 2; + * @return string + */ + public function getData() + { + return $this->data; + } + + /** + * HTTP body binary data. + * + * Generated from protobuf field bytes data = 2; + * @param string $var + * @return $this + */ + public function setData($var) + { + GPBUtil::checkString($var, False); + $this->data = $var; + + return $this; + } + + /** + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * + * Generated from protobuf field repeated .google.protobuf.Any extensions = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExtensions() + { + return $this->extensions; + } + + /** + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * + * Generated from protobuf field repeated .google.protobuf.Any extensions = 3; + * @param \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExtensions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class); + $this->extensions = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/HttpRule.php b/vendor/google/common-protos/src/Api/HttpRule.php new file mode 100644 index 00000000..bb01fb2a --- /dev/null +++ b/vendor/google/common-protos/src/Api/HttpRule.php @@ -0,0 +1,560 @@ +.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * This definition enables an automatic, bidrectional mapping of HTTP + * JSON to RPC. Example: + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * In general, not only fields but also field paths can be referenced + * from a path pattern. Fields mapped to the path pattern cannot be + * repeated and must have a primitive (non-message) type. + * Any fields in the request message which are not bound by the path + * pattern automatically become (optional) HTTP query + * parameters. Assume the following definition of the request message: + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http).get = "/v1/messages/{message_id}"; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // mapped to the URL + * int64 revision = 2; // becomes a parameter + * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * } + * This enables a HTTP JSON to RPC mapping as below: + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * Note that fields which are mapped to HTTP parameters must have a + * primitive type or a repeated primitive type. Message types are not + * allowed. In the case of a repeated type, the parameter can be + * repeated in the URL, as in `...?param=A¶m=B`. + * For HTTP method kinds which allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * put: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * HTTP | RPC + * -----|----- + * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * put: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * The following HTTP JSON to RPC mapping is enabled: + * HTTP | RPC + * -----|----- + * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice of + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * This enables the following two alternative HTTP JSON to RPC + * mappings: + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * # Rules for HTTP mapping + * The rules for mapping HTTP path, query parameters, and body fields + * to the request message are as follows: + * 1. The `body` field specifies either `*` or a field path, or is + * omitted. If omitted, it indicates there is no HTTP request body. + * 2. Leaf fields (recursive expansion of nested messages in the + * request) can be classified into three types: + * (a) Matched in the URL template. + * (b) Covered by body (if body is `*`, everything except (a) fields; + * else everything under the body field) + * (c) All other fields. + * 3. URL query parameters found in the HTTP request are mapped to (c) fields. + * 4. Any body sent with an HTTP request can contain only (b) fields. + * The syntax of the path template is as follows: + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * The syntax `*` matches a single path segment. The syntax `**` matches zero + * or more path segments, which must be the last part of the path except the + * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path, all characters + * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the + * Discovery Document as `{var}`. + * If a variable contains one or more path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path, all + * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables + * show up in the Discovery Document as `{+var}`. + * NOTE: While the single segment variable matches the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 + * Simple String Expansion, the multi segment variable **does not** match + * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. + * NOTE: the field paths in variables and in the `body` must not refer to + * repeated fields or map fields. + * + * Generated from protobuf message google.api.HttpRule + */ +class HttpRule extends \Google\Protobuf\Internal\Message +{ + /** + * Selects methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + */ + private $selector = ''; + /** + * The name of the request field whose value is mapped to the HTTP body, or + * `*` for mapping all fields not captured by the path pattern to the HTTP + * body. NOTE: the referred field must not be a repeated field and must be + * present at the top-level of request message type. + * + * Generated from protobuf field string body = 7; + */ + private $body = ''; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * body of response. Other response fields are ignored. When + * not set, the response message will be used as HTTP body of response. + * + * Generated from protobuf field string response_body = 12; + */ + private $response_body = ''; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + * + * Generated from protobuf field repeated .google.api.HttpRule additional_bindings = 11; + */ + private $additional_bindings; + protected $pattern; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $selector + * Selects methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * @type string $get + * Used for listing and getting information about resources. + * @type string $put + * Used for updating a resource. + * @type string $post + * Used for creating a resource. + * @type string $delete + * Used for deleting a resource. + * @type string $patch + * Used for updating a resource. + * @type \Google\Api\CustomHttpPattern $custom + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + * @type string $body + * The name of the request field whose value is mapped to the HTTP body, or + * `*` for mapping all fields not captured by the path pattern to the HTTP + * body. NOTE: the referred field must not be a repeated field and must be + * present at the top-level of request message type. + * @type string $response_body + * Optional. The name of the response field whose value is mapped to the HTTP + * body of response. Other response fields are ignored. When + * not set, the response message will be used as HTTP body of response. + * @type \Google\Api\HttpRule[]|\Google\Protobuf\Internal\RepeatedField $additional_bindings + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Http::initOnce(); + parent::__construct($data); + } + + /** + * Selects methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @return string + */ + public function getSelector() + { + return $this->selector; + } + + /** + * Selects methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @param string $var + * @return $this + */ + public function setSelector($var) + { + GPBUtil::checkString($var, True); + $this->selector = $var; + + return $this; + } + + /** + * Used for listing and getting information about resources. + * + * Generated from protobuf field string get = 2; + * @return string + */ + public function getGet() + { + return $this->readOneof(2); + } + + /** + * Used for listing and getting information about resources. + * + * Generated from protobuf field string get = 2; + * @param string $var + * @return $this + */ + public function setGet($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Used for updating a resource. + * + * Generated from protobuf field string put = 3; + * @return string + */ + public function getPut() + { + return $this->readOneof(3); + } + + /** + * Used for updating a resource. + * + * Generated from protobuf field string put = 3; + * @param string $var + * @return $this + */ + public function setPut($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Used for creating a resource. + * + * Generated from protobuf field string post = 4; + * @return string + */ + public function getPost() + { + return $this->readOneof(4); + } + + /** + * Used for creating a resource. + * + * Generated from protobuf field string post = 4; + * @param string $var + * @return $this + */ + public function setPost($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Used for deleting a resource. + * + * Generated from protobuf field string delete = 5; + * @return string + */ + public function getDelete() + { + return $this->readOneof(5); + } + + /** + * Used for deleting a resource. + * + * Generated from protobuf field string delete = 5; + * @param string $var + * @return $this + */ + public function setDelete($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Used for updating a resource. + * + * Generated from protobuf field string patch = 6; + * @return string + */ + public function getPatch() + { + return $this->readOneof(6); + } + + /** + * Used for updating a resource. + * + * Generated from protobuf field string patch = 6; + * @param string $var + * @return $this + */ + public function setPatch($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + * + * Generated from protobuf field .google.api.CustomHttpPattern custom = 8; + * @return \Google\Api\CustomHttpPattern + */ + public function getCustom() + { + return $this->readOneof(8); + } + + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + * + * Generated from protobuf field .google.api.CustomHttpPattern custom = 8; + * @param \Google\Api\CustomHttpPattern $var + * @return $this + */ + public function setCustom($var) + { + GPBUtil::checkMessage($var, \Google\Api\CustomHttpPattern::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * The name of the request field whose value is mapped to the HTTP body, or + * `*` for mapping all fields not captured by the path pattern to the HTTP + * body. NOTE: the referred field must not be a repeated field and must be + * present at the top-level of request message type. + * + * Generated from protobuf field string body = 7; + * @return string + */ + public function getBody() + { + return $this->body; + } + + /** + * The name of the request field whose value is mapped to the HTTP body, or + * `*` for mapping all fields not captured by the path pattern to the HTTP + * body. NOTE: the referred field must not be a repeated field and must be + * present at the top-level of request message type. + * + * Generated from protobuf field string body = 7; + * @param string $var + * @return $this + */ + public function setBody($var) + { + GPBUtil::checkString($var, True); + $this->body = $var; + + return $this; + } + + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * body of response. Other response fields are ignored. When + * not set, the response message will be used as HTTP body of response. + * + * Generated from protobuf field string response_body = 12; + * @return string + */ + public function getResponseBody() + { + return $this->response_body; + } + + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * body of response. Other response fields are ignored. When + * not set, the response message will be used as HTTP body of response. + * + * Generated from protobuf field string response_body = 12; + * @param string $var + * @return $this + */ + public function setResponseBody($var) + { + GPBUtil::checkString($var, True); + $this->response_body = $var; + + return $this; + } + + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + * + * Generated from protobuf field repeated .google.api.HttpRule additional_bindings = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdditionalBindings() + { + return $this->additional_bindings; + } + + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + * + * Generated from protobuf field repeated .google.api.HttpRule additional_bindings = 11; + * @param \Google\Api\HttpRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdditionalBindings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\HttpRule::class); + $this->additional_bindings = $arr; + + return $this; + } + + /** + * @return string + */ + public function getPattern() + { + return $this->whichOneof("pattern"); + } + +} + diff --git a/vendor/google/common-protos/src/Api/LabelDescriptor.php b/vendor/google/common-protos/src/Api/LabelDescriptor.php new file mode 100644 index 00000000..0efe1418 --- /dev/null +++ b/vendor/google/common-protos/src/Api/LabelDescriptor.php @@ -0,0 +1,135 @@ +google.api.LabelDescriptor + */ +class LabelDescriptor extends \Google\Protobuf\Internal\Message +{ + /** + * The label key. + * + * Generated from protobuf field string key = 1; + */ + private $key = ''; + /** + * The type of data that can be assigned to the label. + * + * Generated from protobuf field .google.api.LabelDescriptor.ValueType value_type = 2; + */ + private $value_type = 0; + /** + * A human-readable description for the label. + * + * Generated from protobuf field string description = 3; + */ + private $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * The label key. + * @type int $value_type + * The type of data that can be assigned to the label. + * @type string $description + * A human-readable description for the label. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Label::initOnce(); + parent::__construct($data); + } + + /** + * The label key. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * The label key. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * The type of data that can be assigned to the label. + * + * Generated from protobuf field .google.api.LabelDescriptor.ValueType value_type = 2; + * @return int + */ + public function getValueType() + { + return $this->value_type; + } + + /** + * The type of data that can be assigned to the label. + * + * Generated from protobuf field .google.api.LabelDescriptor.ValueType value_type = 2; + * @param int $var + * @return $this + */ + public function setValueType($var) + { + GPBUtil::checkEnum($var, \Google\Api\LabelDescriptor_ValueType::class); + $this->value_type = $var; + + return $this; + } + + /** + * A human-readable description for the label. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A human-readable description for the label. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/LabelDescriptor/ValueType.php b/vendor/google/common-protos/src/Api/LabelDescriptor/ValueType.php new file mode 100644 index 00000000..fd65a805 --- /dev/null +++ b/vendor/google/common-protos/src/Api/LabelDescriptor/ValueType.php @@ -0,0 +1,64 @@ +google.api.LabelDescriptor.ValueType + */ +class ValueType +{ + /** + * A variable-length string. This is the default. + * + * Generated from protobuf enum STRING = 0; + */ + const STRING = 0; + /** + * Boolean; true or false. + * + * Generated from protobuf enum BOOL = 1; + */ + const BOOL = 1; + /** + * A 64-bit signed integer. + * + * Generated from protobuf enum INT64 = 2; + */ + const INT64 = 2; + + private static $valueToName = [ + self::STRING => 'STRING', + self::BOOL => 'BOOL', + self::INT64 => 'INT64', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ValueType::class, \Google\Api\LabelDescriptor_ValueType::class); + diff --git a/vendor/google/common-protos/src/Api/LabelDescriptor_ValueType.php b/vendor/google/common-protos/src/Api/LabelDescriptor_ValueType.php new file mode 100644 index 00000000..e3ca83dc --- /dev/null +++ b/vendor/google/common-protos/src/Api/LabelDescriptor_ValueType.php @@ -0,0 +1,16 @@ +google.api.LaunchStage + */ +class LaunchStage +{ + /** + * Do not use this default value. + * + * Generated from protobuf enum LAUNCH_STAGE_UNSPECIFIED = 0; + */ + const LAUNCH_STAGE_UNSPECIFIED = 0; + /** + * Early Access features are limited to a closed group of testers. To use + * these features, you must sign up in advance and sign a Trusted Tester + * agreement (which includes confidentiality provisions). These features may + * be unstable, changed in backward-incompatible ways, and are not + * guaranteed to be released. + * + * Generated from protobuf enum EARLY_ACCESS = 1; + */ + const EARLY_ACCESS = 1; + /** + * Alpha is a limited availability test for releases before they are cleared + * for widespread use. By Alpha, all significant design issues are resolved + * and we are in the process of verifying functionality. Alpha customers + * need to apply for access, agree to applicable terms, and have their + * projects whitelisted. Alpha releases don’t have to be feature complete, + * no SLAs are provided, and there are no technical support obligations, but + * they will be far enough along that customers can actually use them in + * test environments or for limited-use tests -- just like they would in + * normal production cases. + * + * Generated from protobuf enum ALPHA = 2; + */ + const ALPHA = 2; + /** + * Beta is the point at which we are ready to open a release for any + * customer to use. There are no SLA or technical support obligations in a + * Beta release. Products will be complete from a feature perspective, but + * may have some open outstanding issues. Beta releases are suitable for + * limited production use cases. + * + * Generated from protobuf enum BETA = 3; + */ + const BETA = 3; + /** + * GA features are open to all developers and are considered stable and + * fully qualified for production use. + * + * Generated from protobuf enum GA = 4; + */ + const GA = 4; + /** + * Deprecated features are scheduled to be shut down and removed. For more + * information, see the “Deprecation Policy” section of our [Terms of + * Service](https://cloud.google.com/terms/) + * and the [Google Cloud Platform Subject to the Deprecation + * Policy](https://cloud.google.com/terms/deprecation) documentation. + * + * Generated from protobuf enum DEPRECATED = 5; + */ + const DEPRECATED = 5; + + private static $valueToName = [ + self::LAUNCH_STAGE_UNSPECIFIED => 'LAUNCH_STAGE_UNSPECIFIED', + self::EARLY_ACCESS => 'EARLY_ACCESS', + self::ALPHA => 'ALPHA', + self::BETA => 'BETA', + self::GA => 'GA', + self::DEPRECATED => 'DEPRECATED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/vendor/google/common-protos/src/Api/LogDescriptor.php b/vendor/google/common-protos/src/Api/LogDescriptor.php new file mode 100644 index 00000000..b3801f5c --- /dev/null +++ b/vendor/google/common-protos/src/Api/LogDescriptor.php @@ -0,0 +1,203 @@ +google.api.LogDescriptor + */ +class LogDescriptor extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the log. It must be less than 512 characters long and can + * include the following characters: upper- and lower-case alphanumeric + * characters [A-Za-z0-9], and punctuation characters including + * slash, underscore, hyphen, period [/_-.]. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The set of labels that are available to describe a specific log entry. + * Runtime requests that contain labels not specified here are + * considered invalid. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2; + */ + private $labels; + /** + * A human-readable description of this log. This information appears in + * the documentation and can contain details. + * + * Generated from protobuf field string description = 3; + */ + private $description = ''; + /** + * The human-readable name for this log. This information appears on + * the user interface and should be concise. + * + * Generated from protobuf field string display_name = 4; + */ + private $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the log. It must be less than 512 characters long and can + * include the following characters: upper- and lower-case alphanumeric + * characters [A-Za-z0-9], and punctuation characters including + * slash, underscore, hyphen, period [/_-.]. + * @type \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $labels + * The set of labels that are available to describe a specific log entry. + * Runtime requests that contain labels not specified here are + * considered invalid. + * @type string $description + * A human-readable description of this log. This information appears in + * the documentation and can contain details. + * @type string $display_name + * The human-readable name for this log. This information appears on + * the user interface and should be concise. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Log::initOnce(); + parent::__construct($data); + } + + /** + * The name of the log. It must be less than 512 characters long and can + * include the following characters: upper- and lower-case alphanumeric + * characters [A-Za-z0-9], and punctuation characters including + * slash, underscore, hyphen, period [/_-.]. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the log. It must be less than 512 characters long and can + * include the following characters: upper- and lower-case alphanumeric + * characters [A-Za-z0-9], and punctuation characters including + * slash, underscore, hyphen, period [/_-.]. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The set of labels that are available to describe a specific log entry. + * Runtime requests that contain labels not specified here are + * considered invalid. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The set of labels that are available to describe a specific log entry. + * Runtime requests that contain labels not specified here are + * considered invalid. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2; + * @param \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class); + $this->labels = $arr; + + return $this; + } + + /** + * A human-readable description of this log. This information appears in + * the documentation and can contain details. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A human-readable description of this log. This information appears in + * the documentation and can contain details. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The human-readable name for this log. This information appears on + * the user interface and should be concise. + * + * Generated from protobuf field string display_name = 4; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The human-readable name for this log. This information appears on + * the user interface and should be concise. + * + * Generated from protobuf field string display_name = 4; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Logging.php b/vendor/google/common-protos/src/Api/Logging.php new file mode 100644 index 00000000..2f9f2df7 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Logging.php @@ -0,0 +1,151 @@ +google.api.Logging + */ +class Logging extends \Google\Protobuf\Internal\Message +{ + /** + * Logging configurations for sending logs to the producer project. + * There can be multiple producer destinations, each one must have a + * different monitored resource type. A log can be used in at most + * one producer destination. + * + * Generated from protobuf field repeated .google.api.Logging.LoggingDestination producer_destinations = 1; + */ + private $producer_destinations; + /** + * Logging configurations for sending logs to the consumer project. + * There can be multiple consumer destinations, each one must have a + * different monitored resource type. A log can be used in at most + * one consumer destination. + * + * Generated from protobuf field repeated .google.api.Logging.LoggingDestination consumer_destinations = 2; + */ + private $consumer_destinations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Logging\LoggingDestination[]|\Google\Protobuf\Internal\RepeatedField $producer_destinations + * Logging configurations for sending logs to the producer project. + * There can be multiple producer destinations, each one must have a + * different monitored resource type. A log can be used in at most + * one producer destination. + * @type \Google\Api\Logging\LoggingDestination[]|\Google\Protobuf\Internal\RepeatedField $consumer_destinations + * Logging configurations for sending logs to the consumer project. + * There can be multiple consumer destinations, each one must have a + * different monitored resource type. A log can be used in at most + * one consumer destination. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Logging::initOnce(); + parent::__construct($data); + } + + /** + * Logging configurations for sending logs to the producer project. + * There can be multiple producer destinations, each one must have a + * different monitored resource type. A log can be used in at most + * one producer destination. + * + * Generated from protobuf field repeated .google.api.Logging.LoggingDestination producer_destinations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProducerDestinations() + { + return $this->producer_destinations; + } + + /** + * Logging configurations for sending logs to the producer project. + * There can be multiple producer destinations, each one must have a + * different monitored resource type. A log can be used in at most + * one producer destination. + * + * Generated from protobuf field repeated .google.api.Logging.LoggingDestination producer_destinations = 1; + * @param \Google\Api\Logging\LoggingDestination[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProducerDestinations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Logging\LoggingDestination::class); + $this->producer_destinations = $arr; + + return $this; + } + + /** + * Logging configurations for sending logs to the consumer project. + * There can be multiple consumer destinations, each one must have a + * different monitored resource type. A log can be used in at most + * one consumer destination. + * + * Generated from protobuf field repeated .google.api.Logging.LoggingDestination consumer_destinations = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConsumerDestinations() + { + return $this->consumer_destinations; + } + + /** + * Logging configurations for sending logs to the consumer project. + * There can be multiple consumer destinations, each one must have a + * different monitored resource type. A log can be used in at most + * one consumer destination. + * + * Generated from protobuf field repeated .google.api.Logging.LoggingDestination consumer_destinations = 2; + * @param \Google\Api\Logging\LoggingDestination[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConsumerDestinations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Logging\LoggingDestination::class); + $this->consumer_destinations = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Logging/LoggingDestination.php b/vendor/google/common-protos/src/Api/Logging/LoggingDestination.php new file mode 100644 index 00000000..22762d2a --- /dev/null +++ b/vendor/google/common-protos/src/Api/Logging/LoggingDestination.php @@ -0,0 +1,121 @@ +google.api.Logging.LoggingDestination + */ +class LoggingDestination extends \Google\Protobuf\Internal\Message +{ + /** + * The monitored resource type. The type must be defined in the + * [Service.monitored_resources][google.api.Service.monitored_resources] section. + * + * Generated from protobuf field string monitored_resource = 3; + */ + private $monitored_resource = ''; + /** + * Names of the logs to be sent to this destination. Each name must + * be defined in the [Service.logs][google.api.Service.logs] section. If the log name is + * not a domain scoped name, it will be automatically prefixed with + * the service name followed by "/". + * + * Generated from protobuf field repeated string logs = 1; + */ + private $logs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $monitored_resource + * The monitored resource type. The type must be defined in the + * [Service.monitored_resources][google.api.Service.monitored_resources] section. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $logs + * Names of the logs to be sent to this destination. Each name must + * be defined in the [Service.logs][google.api.Service.logs] section. If the log name is + * not a domain scoped name, it will be automatically prefixed with + * the service name followed by "/". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Logging::initOnce(); + parent::__construct($data); + } + + /** + * The monitored resource type. The type must be defined in the + * [Service.monitored_resources][google.api.Service.monitored_resources] section. + * + * Generated from protobuf field string monitored_resource = 3; + * @return string + */ + public function getMonitoredResource() + { + return $this->monitored_resource; + } + + /** + * The monitored resource type. The type must be defined in the + * [Service.monitored_resources][google.api.Service.monitored_resources] section. + * + * Generated from protobuf field string monitored_resource = 3; + * @param string $var + * @return $this + */ + public function setMonitoredResource($var) + { + GPBUtil::checkString($var, True); + $this->monitored_resource = $var; + + return $this; + } + + /** + * Names of the logs to be sent to this destination. Each name must + * be defined in the [Service.logs][google.api.Service.logs] section. If the log name is + * not a domain scoped name, it will be automatically prefixed with + * the service name followed by "/". + * + * Generated from protobuf field repeated string logs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLogs() + { + return $this->logs; + } + + /** + * Names of the logs to be sent to this destination. Each name must + * be defined in the [Service.logs][google.api.Service.logs] section. If the log name is + * not a domain scoped name, it will be automatically prefixed with + * the service name followed by "/". + * + * Generated from protobuf field repeated string logs = 1; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLogs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->logs = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LoggingDestination::class, \Google\Api\Logging_LoggingDestination::class); + diff --git a/vendor/google/common-protos/src/Api/Logging_LoggingDestination.php b/vendor/google/common-protos/src/Api/Logging_LoggingDestination.php new file mode 100644 index 00000000..afc41add --- /dev/null +++ b/vendor/google/common-protos/src/Api/Logging_LoggingDestination.php @@ -0,0 +1,16 @@ +google.api.Metric + */ +class Metric extends \Google\Protobuf\Internal\Message +{ + /** + * An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor]. + * For example, `custom.googleapis.com/invoice/paid/amount`. + * + * Generated from protobuf field string type = 3; + */ + private $type = ''; + /** + * The set of label values that uniquely identify this metric. All + * labels listed in the `MetricDescriptor` must be assigned values. + * + * Generated from protobuf field map labels = 2; + */ + private $labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor]. + * For example, `custom.googleapis.com/invoice/paid/amount`. + * @type array|\Google\Protobuf\Internal\MapField $labels + * The set of label values that uniquely identify this metric. All + * labels listed in the `MetricDescriptor` must be assigned values. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Metric::initOnce(); + parent::__construct($data); + } + + /** + * An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor]. + * For example, `custom.googleapis.com/invoice/paid/amount`. + * + * Generated from protobuf field string type = 3; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor]. + * For example, `custom.googleapis.com/invoice/paid/amount`. + * + * Generated from protobuf field string type = 3; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The set of label values that uniquely identify this metric. All + * labels listed in the `MetricDescriptor` must be assigned values. + * + * Generated from protobuf field map labels = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The set of label values that uniquely identify this metric. All + * labels listed in the `MetricDescriptor` must be assigned values. + * + * Generated from protobuf field map labels = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/MetricDescriptor.php b/vendor/google/common-protos/src/Api/MetricDescriptor.php new file mode 100644 index 00000000..dceaaad2 --- /dev/null +++ b/vendor/google/common-protos/src/Api/MetricDescriptor.php @@ -0,0 +1,763 @@ +google.api.MetricDescriptor + */ +class MetricDescriptor extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the metric descriptor. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The metric type, including its DNS name prefix. The type is not + * URL-encoded. All user-defined metric types have the DNS name + * `custom.googleapis.com` or `external.googleapis.com`. Metric types should + * use a natural hierarchical grouping. For example: + * "custom.googleapis.com/invoice/paid/amount" + * "external.googleapis.com/prometheus/up" + * "appengine.googleapis.com/http/server/response_latencies" + * + * Generated from protobuf field string type = 8; + */ + private $type = ''; + /** + * The set of labels that can be used to describe a specific + * instance of this metric type. For example, the + * `appengine.googleapis.com/http/server/response_latencies` metric + * type has a label for the HTTP response code, `response_code`, so + * you can look at latencies for successful responses or just + * for responses that failed. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2; + */ + private $labels; + /** + * Whether the metric records instantaneous values, changes to a value, etc. + * Some combinations of `metric_kind` and `value_type` might not be supported. + * + * Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3; + */ + private $metric_kind = 0; + /** + * Whether the measurement is an integer, a floating-point number, etc. + * Some combinations of `metric_kind` and `value_type` might not be supported. + * + * Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 4; + */ + private $value_type = 0; + /** + * The units in which the metric value is reported. It is only applicable + * if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` + * defines the representation of the stored metric values. + * Different systems may scale the values to be more easily displayed (so a + * value of `0.02KBy` _might_ be displayed as `20By`, and a value of + * `3523KBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is + * `KBy`, then the value of the metric is always in thousands of bytes, no + * matter how it may be displayed.. + * If you want a custom metric to record the exact number of CPU-seconds used + * by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is + * `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005 + * CPU-seconds, then the value is written as `12005`. + * Alternatively, if you want a custome metric to record data in a more + * granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is + * `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`), + * or use `Kis{CPU}` and write `11.723` (which is `12005/1024`). + * The supported units are a subset of [The Unified Code for Units of + * Measure](http://unitsofmeasure.org/ucum.html) standard: + * **Basic units (UNIT)** + * * `bit` bit + * * `By` byte + * * `s` second + * * `min` minute + * * `h` hour + * * `d` day + * **Prefixes (PREFIX)** + * * `k` kilo (10^3) + * * `M` mega (10^6) + * * `G` giga (10^9) + * * `T` tera (10^12) + * * `P` peta (10^15) + * * `E` exa (10^18) + * * `Z` zetta (10^21) + * * `Y` yotta (10^24) + * * `m` milli (10^-3) + * * `u` micro (10^-6) + * * `n` nano (10^-9) + * * `p` pico (10^-12) + * * `f` femto (10^-15) + * * `a` atto (10^-18) + * * `z` zepto (10^-21) + * * `y` yocto (10^-24) + * * `Ki` kibi (2^10) + * * `Mi` mebi (2^20) + * * `Gi` gibi (2^30) + * * `Ti` tebi (2^40) + * * `Pi` pebi (2^50) + * **Grammar** + * The grammar also includes these connectors: + * * `/` division or ratio (as an infix operator). For examples, + * `kBy/{email}` or `MiBy/10ms` (although you should almost never + * have `/s` in a metric `unit`; rates should always be computed at + * query time from the underlying cumulative or delta value). + * * `.` multiplication or composition (as an infix operator). For + * examples, `GBy.d` or `k{watt}.h`. + * The grammar for a unit is as follows: + * Expression = Component { "." Component } { "/" Component } ; + * Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] + * | Annotation + * | "1" + * ; + * Annotation = "{" NAME "}" ; + * Notes: + * * `Annotation` is just a comment if it follows a `UNIT`. If the annotation + * is used alone, then the unit is equivalent to `1`. For examples, + * `{request}/s == 1/s`, `By{transmitted}/s == By/s`. + * * `NAME` is a sequence of non-blank printable ASCII characters not + * containing `{` or `}`. + * * `1` represents a unitary [dimensionless + * unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such + * as in `1/s`. It is typically used when none of the basic units are + * appropriate. For example, "new users per day" can be represented as + * `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new + * users). Alternatively, "thousands of page views per day" would be + * represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric + * value of `5.3` would mean "5300 page views per day"). + * * `%` represents dimensionless value of 1/100, and annotates values giving + * a percentage (so the metric values are typically in the range of 0..100, + * and a metric value `3` means "3 percent"). + * * `10^2.%` indicates a metric contains a ratio, typically in the range + * 0..1, that will be multiplied by 100 and displayed as a percentage + * (so a metric value `0.03` means "3 percent"). + * + * Generated from protobuf field string unit = 5; + */ + private $unit = ''; + /** + * A detailed description of the metric, which can be used in documentation. + * + * Generated from protobuf field string description = 6; + */ + private $description = ''; + /** + * A concise name for the metric, which can be displayed in user interfaces. + * Use sentence case without an ending period, for example "Request count". + * This field is optional but it is recommended to be set for any metrics + * associated with user-visible concepts, such as Quota. + * + * Generated from protobuf field string display_name = 7; + */ + private $display_name = ''; + /** + * Optional. Metadata which can be used to guide usage of the metric. + * + * Generated from protobuf field .google.api.MetricDescriptor.MetricDescriptorMetadata metadata = 10; + */ + private $metadata = null; + /** + * Optional. The launch stage of the metric definition. + * + * Generated from protobuf field .google.api.LaunchStage launch_stage = 12; + */ + private $launch_stage = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the metric descriptor. + * @type string $type + * The metric type, including its DNS name prefix. The type is not + * URL-encoded. All user-defined metric types have the DNS name + * `custom.googleapis.com` or `external.googleapis.com`. Metric types should + * use a natural hierarchical grouping. For example: + * "custom.googleapis.com/invoice/paid/amount" + * "external.googleapis.com/prometheus/up" + * "appengine.googleapis.com/http/server/response_latencies" + * @type \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $labels + * The set of labels that can be used to describe a specific + * instance of this metric type. For example, the + * `appengine.googleapis.com/http/server/response_latencies` metric + * type has a label for the HTTP response code, `response_code`, so + * you can look at latencies for successful responses or just + * for responses that failed. + * @type int $metric_kind + * Whether the metric records instantaneous values, changes to a value, etc. + * Some combinations of `metric_kind` and `value_type` might not be supported. + * @type int $value_type + * Whether the measurement is an integer, a floating-point number, etc. + * Some combinations of `metric_kind` and `value_type` might not be supported. + * @type string $unit + * The units in which the metric value is reported. It is only applicable + * if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` + * defines the representation of the stored metric values. + * Different systems may scale the values to be more easily displayed (so a + * value of `0.02KBy` _might_ be displayed as `20By`, and a value of + * `3523KBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is + * `KBy`, then the value of the metric is always in thousands of bytes, no + * matter how it may be displayed.. + * If you want a custom metric to record the exact number of CPU-seconds used + * by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is + * `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005 + * CPU-seconds, then the value is written as `12005`. + * Alternatively, if you want a custome metric to record data in a more + * granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is + * `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`), + * or use `Kis{CPU}` and write `11.723` (which is `12005/1024`). + * The supported units are a subset of [The Unified Code for Units of + * Measure](http://unitsofmeasure.org/ucum.html) standard: + * **Basic units (UNIT)** + * * `bit` bit + * * `By` byte + * * `s` second + * * `min` minute + * * `h` hour + * * `d` day + * **Prefixes (PREFIX)** + * * `k` kilo (10^3) + * * `M` mega (10^6) + * * `G` giga (10^9) + * * `T` tera (10^12) + * * `P` peta (10^15) + * * `E` exa (10^18) + * * `Z` zetta (10^21) + * * `Y` yotta (10^24) + * * `m` milli (10^-3) + * * `u` micro (10^-6) + * * `n` nano (10^-9) + * * `p` pico (10^-12) + * * `f` femto (10^-15) + * * `a` atto (10^-18) + * * `z` zepto (10^-21) + * * `y` yocto (10^-24) + * * `Ki` kibi (2^10) + * * `Mi` mebi (2^20) + * * `Gi` gibi (2^30) + * * `Ti` tebi (2^40) + * * `Pi` pebi (2^50) + * **Grammar** + * The grammar also includes these connectors: + * * `/` division or ratio (as an infix operator). For examples, + * `kBy/{email}` or `MiBy/10ms` (although you should almost never + * have `/s` in a metric `unit`; rates should always be computed at + * query time from the underlying cumulative or delta value). + * * `.` multiplication or composition (as an infix operator). For + * examples, `GBy.d` or `k{watt}.h`. + * The grammar for a unit is as follows: + * Expression = Component { "." Component } { "/" Component } ; + * Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] + * | Annotation + * | "1" + * ; + * Annotation = "{" NAME "}" ; + * Notes: + * * `Annotation` is just a comment if it follows a `UNIT`. If the annotation + * is used alone, then the unit is equivalent to `1`. For examples, + * `{request}/s == 1/s`, `By{transmitted}/s == By/s`. + * * `NAME` is a sequence of non-blank printable ASCII characters not + * containing `{` or `}`. + * * `1` represents a unitary [dimensionless + * unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such + * as in `1/s`. It is typically used when none of the basic units are + * appropriate. For example, "new users per day" can be represented as + * `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new + * users). Alternatively, "thousands of page views per day" would be + * represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric + * value of `5.3` would mean "5300 page views per day"). + * * `%` represents dimensionless value of 1/100, and annotates values giving + * a percentage (so the metric values are typically in the range of 0..100, + * and a metric value `3` means "3 percent"). + * * `10^2.%` indicates a metric contains a ratio, typically in the range + * 0..1, that will be multiplied by 100 and displayed as a percentage + * (so a metric value `0.03` means "3 percent"). + * @type string $description + * A detailed description of the metric, which can be used in documentation. + * @type string $display_name + * A concise name for the metric, which can be displayed in user interfaces. + * Use sentence case without an ending period, for example "Request count". + * This field is optional but it is recommended to be set for any metrics + * associated with user-visible concepts, such as Quota. + * @type \Google\Api\MetricDescriptor\MetricDescriptorMetadata $metadata + * Optional. Metadata which can be used to guide usage of the metric. + * @type int $launch_stage + * Optional. The launch stage of the metric definition. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Metric::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the metric descriptor. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the metric descriptor. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The metric type, including its DNS name prefix. The type is not + * URL-encoded. All user-defined metric types have the DNS name + * `custom.googleapis.com` or `external.googleapis.com`. Metric types should + * use a natural hierarchical grouping. For example: + * "custom.googleapis.com/invoice/paid/amount" + * "external.googleapis.com/prometheus/up" + * "appengine.googleapis.com/http/server/response_latencies" + * + * Generated from protobuf field string type = 8; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The metric type, including its DNS name prefix. The type is not + * URL-encoded. All user-defined metric types have the DNS name + * `custom.googleapis.com` or `external.googleapis.com`. Metric types should + * use a natural hierarchical grouping. For example: + * "custom.googleapis.com/invoice/paid/amount" + * "external.googleapis.com/prometheus/up" + * "appengine.googleapis.com/http/server/response_latencies" + * + * Generated from protobuf field string type = 8; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The set of labels that can be used to describe a specific + * instance of this metric type. For example, the + * `appengine.googleapis.com/http/server/response_latencies` metric + * type has a label for the HTTP response code, `response_code`, so + * you can look at latencies for successful responses or just + * for responses that failed. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The set of labels that can be used to describe a specific + * instance of this metric type. For example, the + * `appengine.googleapis.com/http/server/response_latencies` metric + * type has a label for the HTTP response code, `response_code`, so + * you can look at latencies for successful responses or just + * for responses that failed. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2; + * @param \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class); + $this->labels = $arr; + + return $this; + } + + /** + * Whether the metric records instantaneous values, changes to a value, etc. + * Some combinations of `metric_kind` and `value_type` might not be supported. + * + * Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3; + * @return int + */ + public function getMetricKind() + { + return $this->metric_kind; + } + + /** + * Whether the metric records instantaneous values, changes to a value, etc. + * Some combinations of `metric_kind` and `value_type` might not be supported. + * + * Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3; + * @param int $var + * @return $this + */ + public function setMetricKind($var) + { + GPBUtil::checkEnum($var, \Google\Api\MetricDescriptor_MetricKind::class); + $this->metric_kind = $var; + + return $this; + } + + /** + * Whether the measurement is an integer, a floating-point number, etc. + * Some combinations of `metric_kind` and `value_type` might not be supported. + * + * Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 4; + * @return int + */ + public function getValueType() + { + return $this->value_type; + } + + /** + * Whether the measurement is an integer, a floating-point number, etc. + * Some combinations of `metric_kind` and `value_type` might not be supported. + * + * Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 4; + * @param int $var + * @return $this + */ + public function setValueType($var) + { + GPBUtil::checkEnum($var, \Google\Api\MetricDescriptor_ValueType::class); + $this->value_type = $var; + + return $this; + } + + /** + * The units in which the metric value is reported. It is only applicable + * if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` + * defines the representation of the stored metric values. + * Different systems may scale the values to be more easily displayed (so a + * value of `0.02KBy` _might_ be displayed as `20By`, and a value of + * `3523KBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is + * `KBy`, then the value of the metric is always in thousands of bytes, no + * matter how it may be displayed.. + * If you want a custom metric to record the exact number of CPU-seconds used + * by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is + * `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005 + * CPU-seconds, then the value is written as `12005`. + * Alternatively, if you want a custome metric to record data in a more + * granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is + * `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`), + * or use `Kis{CPU}` and write `11.723` (which is `12005/1024`). + * The supported units are a subset of [The Unified Code for Units of + * Measure](http://unitsofmeasure.org/ucum.html) standard: + * **Basic units (UNIT)** + * * `bit` bit + * * `By` byte + * * `s` second + * * `min` minute + * * `h` hour + * * `d` day + * **Prefixes (PREFIX)** + * * `k` kilo (10^3) + * * `M` mega (10^6) + * * `G` giga (10^9) + * * `T` tera (10^12) + * * `P` peta (10^15) + * * `E` exa (10^18) + * * `Z` zetta (10^21) + * * `Y` yotta (10^24) + * * `m` milli (10^-3) + * * `u` micro (10^-6) + * * `n` nano (10^-9) + * * `p` pico (10^-12) + * * `f` femto (10^-15) + * * `a` atto (10^-18) + * * `z` zepto (10^-21) + * * `y` yocto (10^-24) + * * `Ki` kibi (2^10) + * * `Mi` mebi (2^20) + * * `Gi` gibi (2^30) + * * `Ti` tebi (2^40) + * * `Pi` pebi (2^50) + * **Grammar** + * The grammar also includes these connectors: + * * `/` division or ratio (as an infix operator). For examples, + * `kBy/{email}` or `MiBy/10ms` (although you should almost never + * have `/s` in a metric `unit`; rates should always be computed at + * query time from the underlying cumulative or delta value). + * * `.` multiplication or composition (as an infix operator). For + * examples, `GBy.d` or `k{watt}.h`. + * The grammar for a unit is as follows: + * Expression = Component { "." Component } { "/" Component } ; + * Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] + * | Annotation + * | "1" + * ; + * Annotation = "{" NAME "}" ; + * Notes: + * * `Annotation` is just a comment if it follows a `UNIT`. If the annotation + * is used alone, then the unit is equivalent to `1`. For examples, + * `{request}/s == 1/s`, `By{transmitted}/s == By/s`. + * * `NAME` is a sequence of non-blank printable ASCII characters not + * containing `{` or `}`. + * * `1` represents a unitary [dimensionless + * unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such + * as in `1/s`. It is typically used when none of the basic units are + * appropriate. For example, "new users per day" can be represented as + * `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new + * users). Alternatively, "thousands of page views per day" would be + * represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric + * value of `5.3` would mean "5300 page views per day"). + * * `%` represents dimensionless value of 1/100, and annotates values giving + * a percentage (so the metric values are typically in the range of 0..100, + * and a metric value `3` means "3 percent"). + * * `10^2.%` indicates a metric contains a ratio, typically in the range + * 0..1, that will be multiplied by 100 and displayed as a percentage + * (so a metric value `0.03` means "3 percent"). + * + * Generated from protobuf field string unit = 5; + * @return string + */ + public function getUnit() + { + return $this->unit; + } + + /** + * The units in which the metric value is reported. It is only applicable + * if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` + * defines the representation of the stored metric values. + * Different systems may scale the values to be more easily displayed (so a + * value of `0.02KBy` _might_ be displayed as `20By`, and a value of + * `3523KBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is + * `KBy`, then the value of the metric is always in thousands of bytes, no + * matter how it may be displayed.. + * If you want a custom metric to record the exact number of CPU-seconds used + * by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is + * `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005 + * CPU-seconds, then the value is written as `12005`. + * Alternatively, if you want a custome metric to record data in a more + * granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is + * `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`), + * or use `Kis{CPU}` and write `11.723` (which is `12005/1024`). + * The supported units are a subset of [The Unified Code for Units of + * Measure](http://unitsofmeasure.org/ucum.html) standard: + * **Basic units (UNIT)** + * * `bit` bit + * * `By` byte + * * `s` second + * * `min` minute + * * `h` hour + * * `d` day + * **Prefixes (PREFIX)** + * * `k` kilo (10^3) + * * `M` mega (10^6) + * * `G` giga (10^9) + * * `T` tera (10^12) + * * `P` peta (10^15) + * * `E` exa (10^18) + * * `Z` zetta (10^21) + * * `Y` yotta (10^24) + * * `m` milli (10^-3) + * * `u` micro (10^-6) + * * `n` nano (10^-9) + * * `p` pico (10^-12) + * * `f` femto (10^-15) + * * `a` atto (10^-18) + * * `z` zepto (10^-21) + * * `y` yocto (10^-24) + * * `Ki` kibi (2^10) + * * `Mi` mebi (2^20) + * * `Gi` gibi (2^30) + * * `Ti` tebi (2^40) + * * `Pi` pebi (2^50) + * **Grammar** + * The grammar also includes these connectors: + * * `/` division or ratio (as an infix operator). For examples, + * `kBy/{email}` or `MiBy/10ms` (although you should almost never + * have `/s` in a metric `unit`; rates should always be computed at + * query time from the underlying cumulative or delta value). + * * `.` multiplication or composition (as an infix operator). For + * examples, `GBy.d` or `k{watt}.h`. + * The grammar for a unit is as follows: + * Expression = Component { "." Component } { "/" Component } ; + * Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] + * | Annotation + * | "1" + * ; + * Annotation = "{" NAME "}" ; + * Notes: + * * `Annotation` is just a comment if it follows a `UNIT`. If the annotation + * is used alone, then the unit is equivalent to `1`. For examples, + * `{request}/s == 1/s`, `By{transmitted}/s == By/s`. + * * `NAME` is a sequence of non-blank printable ASCII characters not + * containing `{` or `}`. + * * `1` represents a unitary [dimensionless + * unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such + * as in `1/s`. It is typically used when none of the basic units are + * appropriate. For example, "new users per day" can be represented as + * `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new + * users). Alternatively, "thousands of page views per day" would be + * represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric + * value of `5.3` would mean "5300 page views per day"). + * * `%` represents dimensionless value of 1/100, and annotates values giving + * a percentage (so the metric values are typically in the range of 0..100, + * and a metric value `3` means "3 percent"). + * * `10^2.%` indicates a metric contains a ratio, typically in the range + * 0..1, that will be multiplied by 100 and displayed as a percentage + * (so a metric value `0.03` means "3 percent"). + * + * Generated from protobuf field string unit = 5; + * @param string $var + * @return $this + */ + public function setUnit($var) + { + GPBUtil::checkString($var, True); + $this->unit = $var; + + return $this; + } + + /** + * A detailed description of the metric, which can be used in documentation. + * + * Generated from protobuf field string description = 6; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A detailed description of the metric, which can be used in documentation. + * + * Generated from protobuf field string description = 6; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * A concise name for the metric, which can be displayed in user interfaces. + * Use sentence case without an ending period, for example "Request count". + * This field is optional but it is recommended to be set for any metrics + * associated with user-visible concepts, such as Quota. + * + * Generated from protobuf field string display_name = 7; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * A concise name for the metric, which can be displayed in user interfaces. + * Use sentence case without an ending period, for example "Request count". + * This field is optional but it is recommended to be set for any metrics + * associated with user-visible concepts, such as Quota. + * + * Generated from protobuf field string display_name = 7; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Optional. Metadata which can be used to guide usage of the metric. + * + * Generated from protobuf field .google.api.MetricDescriptor.MetricDescriptorMetadata metadata = 10; + * @return \Google\Api\MetricDescriptor\MetricDescriptorMetadata + */ + public function getMetadata() + { + return $this->metadata; + } + + /** + * Optional. Metadata which can be used to guide usage of the metric. + * + * Generated from protobuf field .google.api.MetricDescriptor.MetricDescriptorMetadata metadata = 10; + * @param \Google\Api\MetricDescriptor\MetricDescriptorMetadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Api\MetricDescriptor_MetricDescriptorMetadata::class); + $this->metadata = $var; + + return $this; + } + + /** + * Optional. The launch stage of the metric definition. + * + * Generated from protobuf field .google.api.LaunchStage launch_stage = 12; + * @return int + */ + public function getLaunchStage() + { + return $this->launch_stage; + } + + /** + * Optional. The launch stage of the metric definition. + * + * Generated from protobuf field .google.api.LaunchStage launch_stage = 12; + * @param int $var + * @return $this + */ + public function setLaunchStage($var) + { + GPBUtil::checkEnum($var, \Google\Api\LaunchStage::class); + $this->launch_stage = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/MetricDescriptor/MetricDescriptorMetadata.php b/vendor/google/common-protos/src/Api/MetricDescriptor/MetricDescriptorMetadata.php new file mode 100644 index 00000000..d5f70e8c --- /dev/null +++ b/vendor/google/common-protos/src/Api/MetricDescriptor/MetricDescriptorMetadata.php @@ -0,0 +1,162 @@ +google.api.MetricDescriptor.MetricDescriptorMetadata + */ +class MetricDescriptorMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Deprecated. Please use the MetricDescriptor.launch_stage instead. + * The launch stage of the metric definition. + * + * Generated from protobuf field .google.api.LaunchStage launch_stage = 1 [deprecated = true]; + */ + private $launch_stage = 0; + /** + * The sampling period of metric data points. For metrics which are written + * periodically, consecutive data points are stored at this time interval, + * excluding data loss due to errors. Metrics with a higher granularity have + * a smaller sampling period. + * + * Generated from protobuf field .google.protobuf.Duration sample_period = 2; + */ + private $sample_period = null; + /** + * The delay of data points caused by ingestion. Data points older than this + * age are guaranteed to be ingested and available to be read, excluding + * data loss due to errors. + * + * Generated from protobuf field .google.protobuf.Duration ingest_delay = 3; + */ + private $ingest_delay = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $launch_stage + * Deprecated. Please use the MetricDescriptor.launch_stage instead. + * The launch stage of the metric definition. + * @type \Google\Protobuf\Duration $sample_period + * The sampling period of metric data points. For metrics which are written + * periodically, consecutive data points are stored at this time interval, + * excluding data loss due to errors. Metrics with a higher granularity have + * a smaller sampling period. + * @type \Google\Protobuf\Duration $ingest_delay + * The delay of data points caused by ingestion. Data points older than this + * age are guaranteed to be ingested and available to be read, excluding + * data loss due to errors. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Metric::initOnce(); + parent::__construct($data); + } + + /** + * Deprecated. Please use the MetricDescriptor.launch_stage instead. + * The launch stage of the metric definition. + * + * Generated from protobuf field .google.api.LaunchStage launch_stage = 1 [deprecated = true]; + * @return int + */ + public function getLaunchStage() + { + return $this->launch_stage; + } + + /** + * Deprecated. Please use the MetricDescriptor.launch_stage instead. + * The launch stage of the metric definition. + * + * Generated from protobuf field .google.api.LaunchStage launch_stage = 1 [deprecated = true]; + * @param int $var + * @return $this + */ + public function setLaunchStage($var) + { + GPBUtil::checkEnum($var, \Google\Api\LaunchStage::class); + $this->launch_stage = $var; + + return $this; + } + + /** + * The sampling period of metric data points. For metrics which are written + * periodically, consecutive data points are stored at this time interval, + * excluding data loss due to errors. Metrics with a higher granularity have + * a smaller sampling period. + * + * Generated from protobuf field .google.protobuf.Duration sample_period = 2; + * @return \Google\Protobuf\Duration + */ + public function getSamplePeriod() + { + return $this->sample_period; + } + + /** + * The sampling period of metric data points. For metrics which are written + * periodically, consecutive data points are stored at this time interval, + * excluding data loss due to errors. Metrics with a higher granularity have + * a smaller sampling period. + * + * Generated from protobuf field .google.protobuf.Duration sample_period = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setSamplePeriod($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->sample_period = $var; + + return $this; + } + + /** + * The delay of data points caused by ingestion. Data points older than this + * age are guaranteed to be ingested and available to be read, excluding + * data loss due to errors. + * + * Generated from protobuf field .google.protobuf.Duration ingest_delay = 3; + * @return \Google\Protobuf\Duration + */ + public function getIngestDelay() + { + return $this->ingest_delay; + } + + /** + * The delay of data points caused by ingestion. Data points older than this + * age are guaranteed to be ingested and available to be read, excluding + * data loss due to errors. + * + * Generated from protobuf field .google.protobuf.Duration ingest_delay = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setIngestDelay($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->ingest_delay = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MetricDescriptorMetadata::class, \Google\Api\MetricDescriptor_MetricDescriptorMetadata::class); + diff --git a/vendor/google/common-protos/src/Api/MetricDescriptor/MetricKind.php b/vendor/google/common-protos/src/Api/MetricDescriptor/MetricKind.php new file mode 100644 index 00000000..44eba0b7 --- /dev/null +++ b/vendor/google/common-protos/src/Api/MetricDescriptor/MetricKind.php @@ -0,0 +1,75 @@ +google.api.MetricDescriptor.MetricKind + */ +class MetricKind +{ + /** + * Do not use this default value. + * + * Generated from protobuf enum METRIC_KIND_UNSPECIFIED = 0; + */ + const METRIC_KIND_UNSPECIFIED = 0; + /** + * An instantaneous measurement of a value. + * + * Generated from protobuf enum GAUGE = 1; + */ + const GAUGE = 1; + /** + * The change in a value during a time interval. + * + * Generated from protobuf enum DELTA = 2; + */ + const DELTA = 2; + /** + * A value accumulated over a time interval. Cumulative + * measurements in a time series should have the same start time + * and increasing end times, until an event resets the cumulative + * value to zero and sets a new start time for the following + * points. + * + * Generated from protobuf enum CUMULATIVE = 3; + */ + const CUMULATIVE = 3; + + private static $valueToName = [ + self::METRIC_KIND_UNSPECIFIED => 'METRIC_KIND_UNSPECIFIED', + self::GAUGE => 'GAUGE', + self::DELTA => 'DELTA', + self::CUMULATIVE => 'CUMULATIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MetricKind::class, \Google\Api\MetricDescriptor_MetricKind::class); + diff --git a/vendor/google/common-protos/src/Api/MetricDescriptor/ValueType.php b/vendor/google/common-protos/src/Api/MetricDescriptor/ValueType.php new file mode 100644 index 00000000..47ae4872 --- /dev/null +++ b/vendor/google/common-protos/src/Api/MetricDescriptor/ValueType.php @@ -0,0 +1,94 @@ +google.api.MetricDescriptor.ValueType + */ +class ValueType +{ + /** + * Do not use this default value. + * + * Generated from protobuf enum VALUE_TYPE_UNSPECIFIED = 0; + */ + const VALUE_TYPE_UNSPECIFIED = 0; + /** + * The value is a boolean. + * This value type can be used only if the metric kind is `GAUGE`. + * + * Generated from protobuf enum BOOL = 1; + */ + const BOOL = 1; + /** + * The value is a signed 64-bit integer. + * + * Generated from protobuf enum INT64 = 2; + */ + const INT64 = 2; + /** + * The value is a double precision floating point number. + * + * Generated from protobuf enum DOUBLE = 3; + */ + const DOUBLE = 3; + /** + * The value is a text string. + * This value type can be used only if the metric kind is `GAUGE`. + * + * Generated from protobuf enum STRING = 4; + */ + const STRING = 4; + /** + * The value is a [`Distribution`][google.api.Distribution]. + * + * Generated from protobuf enum DISTRIBUTION = 5; + */ + const DISTRIBUTION = 5; + /** + * The value is money. + * + * Generated from protobuf enum MONEY = 6; + */ + const MONEY = 6; + + private static $valueToName = [ + self::VALUE_TYPE_UNSPECIFIED => 'VALUE_TYPE_UNSPECIFIED', + self::BOOL => 'BOOL', + self::INT64 => 'INT64', + self::DOUBLE => 'DOUBLE', + self::STRING => 'STRING', + self::DISTRIBUTION => 'DISTRIBUTION', + self::MONEY => 'MONEY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ValueType::class, \Google\Api\MetricDescriptor_ValueType::class); + diff --git a/vendor/google/common-protos/src/Api/MetricDescriptor_MetricDescriptorMetadata.php b/vendor/google/common-protos/src/Api/MetricDescriptor_MetricDescriptorMetadata.php new file mode 100644 index 00000000..210b42ad --- /dev/null +++ b/vendor/google/common-protos/src/Api/MetricDescriptor_MetricDescriptorMetadata.php @@ -0,0 +1,16 @@ +google.api.MetricRule + */ +class MetricRule extends \Google\Protobuf\Internal\Message +{ + /** + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + */ + private $selector = ''; + /** + * Metrics to update when the selected methods are called, and the associated + * cost applied to each metric. + * The key of the map is the metric name, and the values are the amount + * increased for the metric against which the quota limits are defined. + * The value must not be negative. + * + * Generated from protobuf field map metric_costs = 2; + */ + private $metric_costs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $selector + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * @type array|\Google\Protobuf\Internal\MapField $metric_costs + * Metrics to update when the selected methods are called, and the associated + * cost applied to each metric. + * The key of the map is the metric name, and the values are the amount + * increased for the metric against which the quota limits are defined. + * The value must not be negative. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Quota::initOnce(); + parent::__construct($data); + } + + /** + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @return string + */ + public function getSelector() + { + return $this->selector; + } + + /** + * Selects the methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @param string $var + * @return $this + */ + public function setSelector($var) + { + GPBUtil::checkString($var, True); + $this->selector = $var; + + return $this; + } + + /** + * Metrics to update when the selected methods are called, and the associated + * cost applied to each metric. + * The key of the map is the metric name, and the values are the amount + * increased for the metric against which the quota limits are defined. + * The value must not be negative. + * + * Generated from protobuf field map metric_costs = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMetricCosts() + { + return $this->metric_costs; + } + + /** + * Metrics to update when the selected methods are called, and the associated + * cost applied to each metric. + * The key of the map is the metric name, and the values are the amount + * increased for the metric against which the quota limits are defined. + * The value must not be negative. + * + * Generated from protobuf field map metric_costs = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMetricCosts($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64); + $this->metric_costs = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/MonitoredResource.php b/vendor/google/common-protos/src/Api/MonitoredResource.php new file mode 100644 index 00000000..55114375 --- /dev/null +++ b/vendor/google/common-protos/src/Api/MonitoredResource.php @@ -0,0 +1,128 @@ +google.api.MonitoredResource + */ +class MonitoredResource extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The monitored resource type. This field must match + * the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For + * example, the type of a Compute Engine VM instance is `gce_instance`. + * + * Generated from protobuf field string type = 1; + */ + private $type = ''; + /** + * Required. Values for all of the labels listed in the associated monitored + * resource descriptor. For example, Compute Engine VM instances use the + * labels `"project_id"`, `"instance_id"`, and `"zone"`. + * + * Generated from protobuf field map labels = 2; + */ + private $labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * Required. The monitored resource type. This field must match + * the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For + * example, the type of a Compute Engine VM instance is `gce_instance`. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Required. Values for all of the labels listed in the associated monitored + * resource descriptor. For example, Compute Engine VM instances use the + * labels `"project_id"`, `"instance_id"`, and `"zone"`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\MonitoredResource::initOnce(); + parent::__construct($data); + } + + /** + * Required. The monitored resource type. This field must match + * the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For + * example, the type of a Compute Engine VM instance is `gce_instance`. + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Required. The monitored resource type. This field must match + * the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For + * example, the type of a Compute Engine VM instance is `gce_instance`. + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Required. Values for all of the labels listed in the associated monitored + * resource descriptor. For example, Compute Engine VM instances use the + * labels `"project_id"`, `"instance_id"`, and `"zone"`. + * + * Generated from protobuf field map labels = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Required. Values for all of the labels listed in the associated monitored + * resource descriptor. For example, Compute Engine VM instances use the + * labels `"project_id"`, `"instance_id"`, and `"zone"`. + * + * Generated from protobuf field map labels = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/MonitoredResourceDescriptor.php b/vendor/google/common-protos/src/Api/MonitoredResourceDescriptor.php new file mode 100644 index 00000000..8fbf0d19 --- /dev/null +++ b/vendor/google/common-protos/src/Api/MonitoredResourceDescriptor.php @@ -0,0 +1,262 @@ +google.api.MonitoredResourceDescriptor + */ +class MonitoredResourceDescriptor extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The resource name of the monitored resource descriptor: + * `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where + * {type} is the value of the `type` field in this object and + * {project_id} is a project ID that provides API-specific context for + * accessing the type. APIs that do not use project information can use the + * resource name format `"monitoredResourceDescriptors/{type}"`. + * + * Generated from protobuf field string name = 5; + */ + private $name = ''; + /** + * Required. The monitored resource type. For example, the type + * `"cloudsql_database"` represents databases in Google Cloud SQL. + * The maximum length of this value is 256 characters. + * + * Generated from protobuf field string type = 1; + */ + private $type = ''; + /** + * Optional. A concise name for the monitored resource type that might be + * displayed in user interfaces. It should be a Title Cased Noun Phrase, + * without any article or other determiners. For example, + * `"Google Cloud SQL Database"`. + * + * Generated from protobuf field string display_name = 2; + */ + private $display_name = ''; + /** + * Optional. A detailed description of the monitored resource type that might + * be used in documentation. + * + * Generated from protobuf field string description = 3; + */ + private $description = ''; + /** + * Required. A set of labels used to describe instances of this monitored + * resource type. For example, an individual Google Cloud SQL database is + * identified by values for the labels `"database_id"` and `"zone"`. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 4; + */ + private $labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Optional. The resource name of the monitored resource descriptor: + * `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where + * {type} is the value of the `type` field in this object and + * {project_id} is a project ID that provides API-specific context for + * accessing the type. APIs that do not use project information can use the + * resource name format `"monitoredResourceDescriptors/{type}"`. + * @type string $type + * Required. The monitored resource type. For example, the type + * `"cloudsql_database"` represents databases in Google Cloud SQL. + * The maximum length of this value is 256 characters. + * @type string $display_name + * Optional. A concise name for the monitored resource type that might be + * displayed in user interfaces. It should be a Title Cased Noun Phrase, + * without any article or other determiners. For example, + * `"Google Cloud SQL Database"`. + * @type string $description + * Optional. A detailed description of the monitored resource type that might + * be used in documentation. + * @type \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $labels + * Required. A set of labels used to describe instances of this monitored + * resource type. For example, an individual Google Cloud SQL database is + * identified by values for the labels `"database_id"` and `"zone"`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\MonitoredResource::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The resource name of the monitored resource descriptor: + * `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where + * {type} is the value of the `type` field in this object and + * {project_id} is a project ID that provides API-specific context for + * accessing the type. APIs that do not use project information can use the + * resource name format `"monitoredResourceDescriptors/{type}"`. + * + * Generated from protobuf field string name = 5; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Optional. The resource name of the monitored resource descriptor: + * `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where + * {type} is the value of the `type` field in this object and + * {project_id} is a project ID that provides API-specific context for + * accessing the type. APIs that do not use project information can use the + * resource name format `"monitoredResourceDescriptors/{type}"`. + * + * Generated from protobuf field string name = 5; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The monitored resource type. For example, the type + * `"cloudsql_database"` represents databases in Google Cloud SQL. + * The maximum length of this value is 256 characters. + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Required. The monitored resource type. For example, the type + * `"cloudsql_database"` represents databases in Google Cloud SQL. + * The maximum length of this value is 256 characters. + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Optional. A concise name for the monitored resource type that might be + * displayed in user interfaces. It should be a Title Cased Noun Phrase, + * without any article or other determiners. For example, + * `"Google Cloud SQL Database"`. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Optional. A concise name for the monitored resource type that might be + * displayed in user interfaces. It should be a Title Cased Noun Phrase, + * without any article or other determiners. For example, + * `"Google Cloud SQL Database"`. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Optional. A detailed description of the monitored resource type that might + * be used in documentation. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A detailed description of the monitored resource type that might + * be used in documentation. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. A set of labels used to describe instances of this monitored + * resource type. For example, an individual Google Cloud SQL database is + * identified by values for the labels `"database_id"` and `"zone"`. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Required. A set of labels used to describe instances of this monitored + * resource type. For example, an individual Google Cloud SQL database is + * identified by values for the labels `"database_id"` and `"zone"`. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 4; + * @param \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/MonitoredResourceMetadata.php b/vendor/google/common-protos/src/Api/MonitoredResourceMetadata.php new file mode 100644 index 00000000..1bc9bf38 --- /dev/null +++ b/vendor/google/common-protos/src/Api/MonitoredResourceMetadata.php @@ -0,0 +1,142 @@ +google.api.MonitoredResourceMetadata + */ +class MonitoredResourceMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Values for predefined system metadata labels. + * System labels are a kind of metadata extracted by Google Stackdriver. + * Stackdriver determines what system labels are useful and how to obtain + * their values. Some examples: "machine_image", "vpc", "subnet_id", + * "security_group", "name", etc. + * System label values can be only strings, Boolean values, or a list of + * strings. For example: + * { "name": "my-test-instance", + * "security_group": ["a", "b", "c"], + * "spot_instance": false } + * + * Generated from protobuf field .google.protobuf.Struct system_labels = 1; + */ + private $system_labels = null; + /** + * Output only. A map of user-defined metadata labels. + * + * Generated from protobuf field map user_labels = 2; + */ + private $user_labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Struct $system_labels + * Output only. Values for predefined system metadata labels. + * System labels are a kind of metadata extracted by Google Stackdriver. + * Stackdriver determines what system labels are useful and how to obtain + * their values. Some examples: "machine_image", "vpc", "subnet_id", + * "security_group", "name", etc. + * System label values can be only strings, Boolean values, or a list of + * strings. For example: + * { "name": "my-test-instance", + * "security_group": ["a", "b", "c"], + * "spot_instance": false } + * @type array|\Google\Protobuf\Internal\MapField $user_labels + * Output only. A map of user-defined metadata labels. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\MonitoredResource::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Values for predefined system metadata labels. + * System labels are a kind of metadata extracted by Google Stackdriver. + * Stackdriver determines what system labels are useful and how to obtain + * their values. Some examples: "machine_image", "vpc", "subnet_id", + * "security_group", "name", etc. + * System label values can be only strings, Boolean values, or a list of + * strings. For example: + * { "name": "my-test-instance", + * "security_group": ["a", "b", "c"], + * "spot_instance": false } + * + * Generated from protobuf field .google.protobuf.Struct system_labels = 1; + * @return \Google\Protobuf\Struct + */ + public function getSystemLabels() + { + return $this->system_labels; + } + + /** + * Output only. Values for predefined system metadata labels. + * System labels are a kind of metadata extracted by Google Stackdriver. + * Stackdriver determines what system labels are useful and how to obtain + * their values. Some examples: "machine_image", "vpc", "subnet_id", + * "security_group", "name", etc. + * System label values can be only strings, Boolean values, or a list of + * strings. For example: + * { "name": "my-test-instance", + * "security_group": ["a", "b", "c"], + * "spot_instance": false } + * + * Generated from protobuf field .google.protobuf.Struct system_labels = 1; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setSystemLabels($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->system_labels = $var; + + return $this; + } + + /** + * Output only. A map of user-defined metadata labels. + * + * Generated from protobuf field map user_labels = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getUserLabels() + { + return $this->user_labels; + } + + /** + * Output only. A map of user-defined metadata labels. + * + * Generated from protobuf field map user_labels = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setUserLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->user_labels = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Monitoring.php b/vendor/google/common-protos/src/Api/Monitoring.php new file mode 100644 index 00000000..4f300de6 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Monitoring.php @@ -0,0 +1,159 @@ +google.api.Monitoring + */ +class Monitoring extends \Google\Protobuf\Internal\Message +{ + /** + * Monitoring configurations for sending metrics to the producer project. + * There can be multiple producer destinations, each one must have a + * different monitored resource type. A metric can be used in at most + * one producer destination. + * + * Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination producer_destinations = 1; + */ + private $producer_destinations; + /** + * Monitoring configurations for sending metrics to the consumer project. + * There can be multiple consumer destinations, each one must have a + * different monitored resource type. A metric can be used in at most + * one consumer destination. + * + * Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination consumer_destinations = 2; + */ + private $consumer_destinations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Monitoring\MonitoringDestination[]|\Google\Protobuf\Internal\RepeatedField $producer_destinations + * Monitoring configurations for sending metrics to the producer project. + * There can be multiple producer destinations, each one must have a + * different monitored resource type. A metric can be used in at most + * one producer destination. + * @type \Google\Api\Monitoring\MonitoringDestination[]|\Google\Protobuf\Internal\RepeatedField $consumer_destinations + * Monitoring configurations for sending metrics to the consumer project. + * There can be multiple consumer destinations, each one must have a + * different monitored resource type. A metric can be used in at most + * one consumer destination. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Monitoring::initOnce(); + parent::__construct($data); + } + + /** + * Monitoring configurations for sending metrics to the producer project. + * There can be multiple producer destinations, each one must have a + * different monitored resource type. A metric can be used in at most + * one producer destination. + * + * Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination producer_destinations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProducerDestinations() + { + return $this->producer_destinations; + } + + /** + * Monitoring configurations for sending metrics to the producer project. + * There can be multiple producer destinations, each one must have a + * different monitored resource type. A metric can be used in at most + * one producer destination. + * + * Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination producer_destinations = 1; + * @param \Google\Api\Monitoring\MonitoringDestination[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProducerDestinations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Monitoring\MonitoringDestination::class); + $this->producer_destinations = $arr; + + return $this; + } + + /** + * Monitoring configurations for sending metrics to the consumer project. + * There can be multiple consumer destinations, each one must have a + * different monitored resource type. A metric can be used in at most + * one consumer destination. + * + * Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination consumer_destinations = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConsumerDestinations() + { + return $this->consumer_destinations; + } + + /** + * Monitoring configurations for sending metrics to the consumer project. + * There can be multiple consumer destinations, each one must have a + * different monitored resource type. A metric can be used in at most + * one consumer destination. + * + * Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination consumer_destinations = 2; + * @param \Google\Api\Monitoring\MonitoringDestination[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConsumerDestinations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Monitoring\MonitoringDestination::class); + $this->consumer_destinations = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Monitoring/MonitoringDestination.php b/vendor/google/common-protos/src/Api/Monitoring/MonitoringDestination.php new file mode 100644 index 00000000..2ac8cb28 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Monitoring/MonitoringDestination.php @@ -0,0 +1,113 @@ +google.api.Monitoring.MonitoringDestination + */ +class MonitoringDestination extends \Google\Protobuf\Internal\Message +{ + /** + * The monitored resource type. The type must be defined in + * [Service.monitored_resources][google.api.Service.monitored_resources] section. + * + * Generated from protobuf field string monitored_resource = 1; + */ + private $monitored_resource = ''; + /** + * Names of the metrics to report to this monitoring destination. + * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. + * + * Generated from protobuf field repeated string metrics = 2; + */ + private $metrics; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $monitored_resource + * The monitored resource type. The type must be defined in + * [Service.monitored_resources][google.api.Service.monitored_resources] section. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $metrics + * Names of the metrics to report to this monitoring destination. + * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Monitoring::initOnce(); + parent::__construct($data); + } + + /** + * The monitored resource type. The type must be defined in + * [Service.monitored_resources][google.api.Service.monitored_resources] section. + * + * Generated from protobuf field string monitored_resource = 1; + * @return string + */ + public function getMonitoredResource() + { + return $this->monitored_resource; + } + + /** + * The monitored resource type. The type must be defined in + * [Service.monitored_resources][google.api.Service.monitored_resources] section. + * + * Generated from protobuf field string monitored_resource = 1; + * @param string $var + * @return $this + */ + public function setMonitoredResource($var) + { + GPBUtil::checkString($var, True); + $this->monitored_resource = $var; + + return $this; + } + + /** + * Names of the metrics to report to this monitoring destination. + * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. + * + * Generated from protobuf field repeated string metrics = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetrics() + { + return $this->metrics; + } + + /** + * Names of the metrics to report to this monitoring destination. + * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. + * + * Generated from protobuf field repeated string metrics = 2; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetrics($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->metrics = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MonitoringDestination::class, \Google\Api\Monitoring_MonitoringDestination::class); + diff --git a/vendor/google/common-protos/src/Api/Monitoring_MonitoringDestination.php b/vendor/google/common-protos/src/Api/Monitoring_MonitoringDestination.php new file mode 100644 index 00000000..148a6520 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Monitoring_MonitoringDestination.php @@ -0,0 +1,16 @@ +google.api.OAuthRequirements + */ +class OAuthRequirements extends \Google\Protobuf\Internal\Message +{ + /** + * The list of publicly documented OAuth scopes that are allowed access. An + * OAuth token containing any of these scopes will be accepted. + * Example: + * canonical_scopes: https://www.googleapis.com/auth/calendar, + * https://www.googleapis.com/auth/calendar.read + * + * Generated from protobuf field string canonical_scopes = 1; + */ + private $canonical_scopes = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $canonical_scopes + * The list of publicly documented OAuth scopes that are allowed access. An + * OAuth token containing any of these scopes will be accepted. + * Example: + * canonical_scopes: https://www.googleapis.com/auth/calendar, + * https://www.googleapis.com/auth/calendar.read + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Auth::initOnce(); + parent::__construct($data); + } + + /** + * The list of publicly documented OAuth scopes that are allowed access. An + * OAuth token containing any of these scopes will be accepted. + * Example: + * canonical_scopes: https://www.googleapis.com/auth/calendar, + * https://www.googleapis.com/auth/calendar.read + * + * Generated from protobuf field string canonical_scopes = 1; + * @return string + */ + public function getCanonicalScopes() + { + return $this->canonical_scopes; + } + + /** + * The list of publicly documented OAuth scopes that are allowed access. An + * OAuth token containing any of these scopes will be accepted. + * Example: + * canonical_scopes: https://www.googleapis.com/auth/calendar, + * https://www.googleapis.com/auth/calendar.read + * + * Generated from protobuf field string canonical_scopes = 1; + * @param string $var + * @return $this + */ + public function setCanonicalScopes($var) + { + GPBUtil::checkString($var, True); + $this->canonical_scopes = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Page.php b/vendor/google/common-protos/src/Api/Page.php new file mode 100644 index 00000000..7ae4693e --- /dev/null +++ b/vendor/google/common-protos/src/Api/Page.php @@ -0,0 +1,196 @@ +google.api.Page + */ +class Page extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the page. It will be used as an identity of the page to + * generate URI of the page, text of the link to this page in navigation, + * etc. The full page name (start from the root page name to this page + * concatenated with `.`) can be used as reference to the page in your + * documentation. For example: + *
pages:
+     * - name: Tutorial
+     *   content: (== include tutorial.md ==)
+     *   subpages:
+     *   - name: Java
+     *     content: (== include tutorial_java.md ==)
+     * 
+ * You can reference `Java` page using Markdown reference link syntax: + * `[Java][Tutorial.Java]`. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The Markdown content of the page. You can use (== include {path} ==) + * to include content from a Markdown file. + * + * Generated from protobuf field string content = 2; + */ + private $content = ''; + /** + * Subpages of this page. The order of subpages specified here will be + * honored in the generated docset. + * + * Generated from protobuf field repeated .google.api.Page subpages = 3; + */ + private $subpages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the page. It will be used as an identity of the page to + * generate URI of the page, text of the link to this page in navigation, + * etc. The full page name (start from the root page name to this page + * concatenated with `.`) can be used as reference to the page in your + * documentation. For example: + *
pages:
+     *           - name: Tutorial
+     *             content: (== include tutorial.md ==)
+     *             subpages:
+     *             - name: Java
+     *               content: (== include tutorial_java.md ==)
+     *           
+ * You can reference `Java` page using Markdown reference link syntax: + * `[Java][Tutorial.Java]`. + * @type string $content + * The Markdown content of the page. You can use (== include {path} ==) + * to include content from a Markdown file. + * @type \Google\Api\Page[]|\Google\Protobuf\Internal\RepeatedField $subpages + * Subpages of this page. The order of subpages specified here will be + * honored in the generated docset. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Documentation::initOnce(); + parent::__construct($data); + } + + /** + * The name of the page. It will be used as an identity of the page to + * generate URI of the page, text of the link to this page in navigation, + * etc. The full page name (start from the root page name to this page + * concatenated with `.`) can be used as reference to the page in your + * documentation. For example: + *
pages:
+     * - name: Tutorial
+     *   content: (== include tutorial.md ==)
+     *   subpages:
+     *   - name: Java
+     *     content: (== include tutorial_java.md ==)
+     * 
+ * You can reference `Java` page using Markdown reference link syntax: + * `[Java][Tutorial.Java]`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the page. It will be used as an identity of the page to + * generate URI of the page, text of the link to this page in navigation, + * etc. The full page name (start from the root page name to this page + * concatenated with `.`) can be used as reference to the page in your + * documentation. For example: + *
pages:
+     * - name: Tutorial
+     *   content: (== include tutorial.md ==)
+     *   subpages:
+     *   - name: Java
+     *     content: (== include tutorial_java.md ==)
+     * 
+ * You can reference `Java` page using Markdown reference link syntax: + * `[Java][Tutorial.Java]`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The Markdown content of the page. You can use (== include {path} ==) + * to include content from a Markdown file. + * + * Generated from protobuf field string content = 2; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * The Markdown content of the page. You can use (== include {path} ==) + * to include content from a Markdown file. + * + * Generated from protobuf field string content = 2; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + + /** + * Subpages of this page. The order of subpages specified here will be + * honored in the generated docset. + * + * Generated from protobuf field repeated .google.api.Page subpages = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSubpages() + { + return $this->subpages; + } + + /** + * Subpages of this page. The order of subpages specified here will be + * honored in the generated docset. + * + * Generated from protobuf field repeated .google.api.Page subpages = 3; + * @param \Google\Api\Page[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSubpages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Page::class); + $this->subpages = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/ProjectProperties.php b/vendor/google/common-protos/src/Api/ProjectProperties.php new file mode 100644 index 00000000..367b4062 --- /dev/null +++ b/vendor/google/common-protos/src/Api/ProjectProperties.php @@ -0,0 +1,80 @@ +google.api.ProjectProperties + */ +class ProjectProperties extends \Google\Protobuf\Internal\Message +{ + /** + * List of per consumer project-specific properties. + * + * Generated from protobuf field repeated .google.api.Property properties = 1; + */ + private $properties; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Property[]|\Google\Protobuf\Internal\RepeatedField $properties + * List of per consumer project-specific properties. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Consumer::initOnce(); + parent::__construct($data); + } + + /** + * List of per consumer project-specific properties. + * + * Generated from protobuf field repeated .google.api.Property properties = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProperties() + { + return $this->properties; + } + + /** + * List of per consumer project-specific properties. + * + * Generated from protobuf field repeated .google.api.Property properties = 1; + * @param \Google\Api\Property[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProperties($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Property::class); + $this->properties = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Property.php b/vendor/google/common-protos/src/Api/Property.php new file mode 100644 index 00000000..e903015e --- /dev/null +++ b/vendor/google/common-protos/src/Api/Property.php @@ -0,0 +1,142 @@ +google.api.Property + */ +class Property extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the property (a.k.a key). + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The type of this property. + * + * Generated from protobuf field .google.api.Property.PropertyType type = 2; + */ + private $type = 0; + /** + * The description of the property + * + * Generated from protobuf field string description = 3; + */ + private $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the property (a.k.a key). + * @type int $type + * The type of this property. + * @type string $description + * The description of the property + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Consumer::initOnce(); + parent::__construct($data); + } + + /** + * The name of the property (a.k.a key). + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the property (a.k.a key). + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The type of this property. + * + * Generated from protobuf field .google.api.Property.PropertyType type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of this property. + * + * Generated from protobuf field .google.api.Property.PropertyType type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Api\Property_PropertyType::class); + $this->type = $var; + + return $this; + } + + /** + * The description of the property + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the property + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Property/PropertyType.php b/vendor/google/common-protos/src/Api/Property/PropertyType.php new file mode 100644 index 00000000..4663ea54 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Property/PropertyType.php @@ -0,0 +1,78 @@ +google.api.Property.PropertyType + */ +class PropertyType +{ + /** + * The type is unspecified, and will result in an error. + * + * Generated from protobuf enum UNSPECIFIED = 0; + */ + const UNSPECIFIED = 0; + /** + * The type is `int64`. + * + * Generated from protobuf enum INT64 = 1; + */ + const INT64 = 1; + /** + * The type is `bool`. + * + * Generated from protobuf enum BOOL = 2; + */ + const BOOL = 2; + /** + * The type is `string`. + * + * Generated from protobuf enum STRING = 3; + */ + const STRING = 3; + /** + * The type is 'double'. + * + * Generated from protobuf enum DOUBLE = 4; + */ + const DOUBLE = 4; + + private static $valueToName = [ + self::UNSPECIFIED => 'UNSPECIFIED', + self::INT64 => 'INT64', + self::BOOL => 'BOOL', + self::STRING => 'STRING', + self::DOUBLE => 'DOUBLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PropertyType::class, \Google\Api\Property_PropertyType::class); + diff --git a/vendor/google/common-protos/src/Api/Property_PropertyType.php b/vendor/google/common-protos/src/Api/Property_PropertyType.php new file mode 100644 index 00000000..7b9f04ce --- /dev/null +++ b/vendor/google/common-protos/src/Api/Property_PropertyType.php @@ -0,0 +1,16 @@ +google.api.Quota + */ +class Quota extends \Google\Protobuf\Internal\Message +{ + /** + * List of `QuotaLimit` definitions for the service. + * Used by metric-based quotas only. + * + * Generated from protobuf field repeated .google.api.QuotaLimit limits = 3; + */ + private $limits; + /** + * List of `MetricRule` definitions, each one mapping a selected method to one + * or more metrics. + * Used by metric-based quotas only. + * + * Generated from protobuf field repeated .google.api.MetricRule metric_rules = 4; + */ + private $metric_rules; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\QuotaLimit[]|\Google\Protobuf\Internal\RepeatedField $limits + * List of `QuotaLimit` definitions for the service. + * Used by metric-based quotas only. + * @type \Google\Api\MetricRule[]|\Google\Protobuf\Internal\RepeatedField $metric_rules + * List of `MetricRule` definitions, each one mapping a selected method to one + * or more metrics. + * Used by metric-based quotas only. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Quota::initOnce(); + parent::__construct($data); + } + + /** + * List of `QuotaLimit` definitions for the service. + * Used by metric-based quotas only. + * + * Generated from protobuf field repeated .google.api.QuotaLimit limits = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLimits() + { + return $this->limits; + } + + /** + * List of `QuotaLimit` definitions for the service. + * Used by metric-based quotas only. + * + * Generated from protobuf field repeated .google.api.QuotaLimit limits = 3; + * @param \Google\Api\QuotaLimit[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLimits($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\QuotaLimit::class); + $this->limits = $arr; + + return $this; + } + + /** + * List of `MetricRule` definitions, each one mapping a selected method to one + * or more metrics. + * Used by metric-based quotas only. + * + * Generated from protobuf field repeated .google.api.MetricRule metric_rules = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetricRules() + { + return $this->metric_rules; + } + + /** + * List of `MetricRule` definitions, each one mapping a selected method to one + * or more metrics. + * Used by metric-based quotas only. + * + * Generated from protobuf field repeated .google.api.MetricRule metric_rules = 4; + * @param \Google\Api\MetricRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetricRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MetricRule::class); + $this->metric_rules = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/QuotaLimit.php b/vendor/google/common-protos/src/Api/QuotaLimit.php new file mode 100644 index 00000000..e74b0b11 --- /dev/null +++ b/vendor/google/common-protos/src/Api/QuotaLimit.php @@ -0,0 +1,751 @@ +google.api.QuotaLimit + */ +class QuotaLimit extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the quota limit. The name is used to refer to the limit when + * overriding the default limit on per-consumer basis. + * For group-based quota limits, the name must be unique within the quota + * group. If a name is not provided, it will be generated from the limit_by + * and duration fields. + * For metric-based quota limits, the name must be provided, and it must be + * unique within the service. The name can only include alphanumeric + * characters as well as '-'. + * The maximum length of the limit name is 64 characters. + * The name of a limit is used as a unique identifier for this limit. + * Therefore, once a limit has been put into use, its name should be + * immutable. You can use the display_name field to provide a user-friendly + * name for the limit. The display name can be evolved over time without + * affecting the identity of the limit. + * + * Generated from protobuf field string name = 6; + */ + private $name = ''; + /** + * Optional. User-visible, extended description for this quota limit. + * Should be used only when more context is needed to understand this limit + * than provided by the limit's display name (see: `display_name`). + * + * Generated from protobuf field string description = 2; + */ + private $description = ''; + /** + * Default number of tokens that can be consumed during the specified + * duration. This is the number of tokens assigned when a client + * application developer activates the service for his/her project. + * Specifying a value of 0 will block all requests. This can be used if you + * are provisioning quota to selected consumers and blocking others. + * Similarly, a value of -1 will indicate an unlimited quota. No other + * negative values are allowed. + * Used by group-based quotas only. + * + * Generated from protobuf field int64 default_limit = 3; + */ + private $default_limit = 0; + /** + * Maximum number of tokens that can be consumed during the specified + * duration. Client application developers can override the default limit up + * to this maximum. If specified, this value cannot be set to a value less + * than the default limit. If not specified, it is set to the default limit. + * To allow clients to apply overrides with no upper bound, set this to -1, + * indicating unlimited maximum quota. + * Used by group-based quotas only. + * + * Generated from protobuf field int64 max_limit = 4; + */ + private $max_limit = 0; + /** + * Free tier value displayed in the Developers Console for this limit. + * The free tier is the number of tokens that will be subtracted from the + * billed amount when billing is enabled. + * This field can only be set on a limit with duration "1d", in a billable + * group; it is invalid on any other limit. If this field is not set, it + * defaults to 0, indicating that there is no free tier for this service. + * Used by group-based quotas only. + * + * Generated from protobuf field int64 free_tier = 7; + */ + private $free_tier = 0; + /** + * Duration of this limit in textual notation. Example: "100s", "24h", "1d". + * For duration longer than a day, only multiple of days is supported. We + * support only "100s" and "1d" for now. Additional support will be added in + * the future. "0" indicates indefinite duration. + * Used by group-based quotas only. + * + * Generated from protobuf field string duration = 5; + */ + private $duration = ''; + /** + * The name of the metric this quota limit applies to. The quota limits with + * the same metric will be checked together during runtime. The metric must be + * defined within the service config. + * Used by metric-based quotas only. + * + * Generated from protobuf field string metric = 8; + */ + private $metric = ''; + /** + * Specify the unit of the quota limit. It uses the same syntax as + * [Metric.unit][]. The supported unit kinds are determined by the quota + * backend system. + * The [Google Service Control](https://cloud.google.com/service-control) + * supports the following unit components: + * * One of the time intevals: + * * "/min" for quota every minute. + * * "/d" for quota every 24 hours, starting 00:00 US Pacific Time. + * * Otherwise the quota won't be reset by time, such as storage limit. + * * One and only one of the granted containers: + * * "/{organization}" quota for an organization. + * * "/{project}" quota for a project. + * * "/{folder}" quota for a folder. + * * "/{resource}" quota for a universal resource. + * * Zero or more quota segmentation dimension. Not all combos are valid. + * * "/{region}" quota for every region. Not to be used with time intervals. + * * Otherwise the resources granted on the target is not segmented. + * * "/{zone}" quota for every zone. Not to be used with time intervals. + * * Otherwise the resources granted on the target is not segmented. + * * "/{resource}" quota for a resource associated with a project or org. + * Here are some examples: + * * "1/min/{project}" for quota per minute per project. + * * "1/min/{user}" for quota per minute per user. + * * "1/min/{organization}" for quota per minute per organization. + * Note: the order of unit components is insignificant. + * The "1" at the beginning is required to follow the metric unit syntax. + * Used by metric-based quotas only. + * + * Generated from protobuf field string unit = 9; + */ + private $unit = ''; + /** + * Tiered limit values. Also allows for regional or zone overrides for these + * values if "/{region}" or "/{zone}" is specified in the unit field. + * Currently supported tiers from low to high: + * VERY_LOW, LOW, STANDARD, HIGH, VERY_HIGH + * To apply different limit values for users according to their tiers, specify + * the values for the tiers you want to differentiate. For example: + * {LOW:100, STANDARD:500, HIGH:1000, VERY_HIGH:5000} + * The limit value for each tier is optional except for the tier STANDARD. + * The limit value for an unspecified tier falls to the value of its next + * tier towards tier STANDARD. For the above example, the limit value for tier + * STANDARD is 500. + * To apply the same limit value for all users, just specify limit value for + * tier STANDARD. For example: {STANDARD:500}. + * To apply a regional overide for a tier, add a map entry with key + * "/", where is a region name. Similarly, for a zone + * override, add a map entry with key "/{zone}". + * Further, a wildcard can be used at the end of a zone name in order to + * specify zone level overrides. For example: + * LOW: 10, STANDARD: 50, HIGH: 100, + * LOW/us-central1: 20, STANDARD/us-central1: 60, HIGH/us-central1: 200, + * LOW/us-central1-*: 10, STANDARD/us-central1-*: 20, HIGH/us-central1-*: 80 + * The regional overrides tier set for each region must be the same as + * the tier set for default limit values. Same rule applies for zone overrides + * tier as well. + * Used by metric-based quotas only. + * + * Generated from protobuf field map values = 10; + */ + private $values; + /** + * User-visible display name for this limit. + * Optional. If not set, the UI will provide a default display name based on + * the quota configuration. This field can be used to override the default + * display name generated from the configuration. + * + * Generated from protobuf field string display_name = 12; + */ + private $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of the quota limit. The name is used to refer to the limit when + * overriding the default limit on per-consumer basis. + * For group-based quota limits, the name must be unique within the quota + * group. If a name is not provided, it will be generated from the limit_by + * and duration fields. + * For metric-based quota limits, the name must be provided, and it must be + * unique within the service. The name can only include alphanumeric + * characters as well as '-'. + * The maximum length of the limit name is 64 characters. + * The name of a limit is used as a unique identifier for this limit. + * Therefore, once a limit has been put into use, its name should be + * immutable. You can use the display_name field to provide a user-friendly + * name for the limit. The display name can be evolved over time without + * affecting the identity of the limit. + * @type string $description + * Optional. User-visible, extended description for this quota limit. + * Should be used only when more context is needed to understand this limit + * than provided by the limit's display name (see: `display_name`). + * @type int|string $default_limit + * Default number of tokens that can be consumed during the specified + * duration. This is the number of tokens assigned when a client + * application developer activates the service for his/her project. + * Specifying a value of 0 will block all requests. This can be used if you + * are provisioning quota to selected consumers and blocking others. + * Similarly, a value of -1 will indicate an unlimited quota. No other + * negative values are allowed. + * Used by group-based quotas only. + * @type int|string $max_limit + * Maximum number of tokens that can be consumed during the specified + * duration. Client application developers can override the default limit up + * to this maximum. If specified, this value cannot be set to a value less + * than the default limit. If not specified, it is set to the default limit. + * To allow clients to apply overrides with no upper bound, set this to -1, + * indicating unlimited maximum quota. + * Used by group-based quotas only. + * @type int|string $free_tier + * Free tier value displayed in the Developers Console for this limit. + * The free tier is the number of tokens that will be subtracted from the + * billed amount when billing is enabled. + * This field can only be set on a limit with duration "1d", in a billable + * group; it is invalid on any other limit. If this field is not set, it + * defaults to 0, indicating that there is no free tier for this service. + * Used by group-based quotas only. + * @type string $duration + * Duration of this limit in textual notation. Example: "100s", "24h", "1d". + * For duration longer than a day, only multiple of days is supported. We + * support only "100s" and "1d" for now. Additional support will be added in + * the future. "0" indicates indefinite duration. + * Used by group-based quotas only. + * @type string $metric + * The name of the metric this quota limit applies to. The quota limits with + * the same metric will be checked together during runtime. The metric must be + * defined within the service config. + * Used by metric-based quotas only. + * @type string $unit + * Specify the unit of the quota limit. It uses the same syntax as + * [Metric.unit][]. The supported unit kinds are determined by the quota + * backend system. + * The [Google Service Control](https://cloud.google.com/service-control) + * supports the following unit components: + * * One of the time intevals: + * * "/min" for quota every minute. + * * "/d" for quota every 24 hours, starting 00:00 US Pacific Time. + * * Otherwise the quota won't be reset by time, such as storage limit. + * * One and only one of the granted containers: + * * "/{organization}" quota for an organization. + * * "/{project}" quota for a project. + * * "/{folder}" quota for a folder. + * * "/{resource}" quota for a universal resource. + * * Zero or more quota segmentation dimension. Not all combos are valid. + * * "/{region}" quota for every region. Not to be used with time intervals. + * * Otherwise the resources granted on the target is not segmented. + * * "/{zone}" quota for every zone. Not to be used with time intervals. + * * Otherwise the resources granted on the target is not segmented. + * * "/{resource}" quota for a resource associated with a project or org. + * Here are some examples: + * * "1/min/{project}" for quota per minute per project. + * * "1/min/{user}" for quota per minute per user. + * * "1/min/{organization}" for quota per minute per organization. + * Note: the order of unit components is insignificant. + * The "1" at the beginning is required to follow the metric unit syntax. + * Used by metric-based quotas only. + * @type array|\Google\Protobuf\Internal\MapField $values + * Tiered limit values. Also allows for regional or zone overrides for these + * values if "/{region}" or "/{zone}" is specified in the unit field. + * Currently supported tiers from low to high: + * VERY_LOW, LOW, STANDARD, HIGH, VERY_HIGH + * To apply different limit values for users according to their tiers, specify + * the values for the tiers you want to differentiate. For example: + * {LOW:100, STANDARD:500, HIGH:1000, VERY_HIGH:5000} + * The limit value for each tier is optional except for the tier STANDARD. + * The limit value for an unspecified tier falls to the value of its next + * tier towards tier STANDARD. For the above example, the limit value for tier + * STANDARD is 500. + * To apply the same limit value for all users, just specify limit value for + * tier STANDARD. For example: {STANDARD:500}. + * To apply a regional overide for a tier, add a map entry with key + * "/", where is a region name. Similarly, for a zone + * override, add a map entry with key "/{zone}". + * Further, a wildcard can be used at the end of a zone name in order to + * specify zone level overrides. For example: + * LOW: 10, STANDARD: 50, HIGH: 100, + * LOW/us-central1: 20, STANDARD/us-central1: 60, HIGH/us-central1: 200, + * LOW/us-central1-*: 10, STANDARD/us-central1-*: 20, HIGH/us-central1-*: 80 + * The regional overrides tier set for each region must be the same as + * the tier set for default limit values. Same rule applies for zone overrides + * tier as well. + * Used by metric-based quotas only. + * @type string $display_name + * User-visible display name for this limit. + * Optional. If not set, the UI will provide a default display name based on + * the quota configuration. This field can be used to override the default + * display name generated from the configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Quota::initOnce(); + parent::__construct($data); + } + + /** + * Name of the quota limit. The name is used to refer to the limit when + * overriding the default limit on per-consumer basis. + * For group-based quota limits, the name must be unique within the quota + * group. If a name is not provided, it will be generated from the limit_by + * and duration fields. + * For metric-based quota limits, the name must be provided, and it must be + * unique within the service. The name can only include alphanumeric + * characters as well as '-'. + * The maximum length of the limit name is 64 characters. + * The name of a limit is used as a unique identifier for this limit. + * Therefore, once a limit has been put into use, its name should be + * immutable. You can use the display_name field to provide a user-friendly + * name for the limit. The display name can be evolved over time without + * affecting the identity of the limit. + * + * Generated from protobuf field string name = 6; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the quota limit. The name is used to refer to the limit when + * overriding the default limit on per-consumer basis. + * For group-based quota limits, the name must be unique within the quota + * group. If a name is not provided, it will be generated from the limit_by + * and duration fields. + * For metric-based quota limits, the name must be provided, and it must be + * unique within the service. The name can only include alphanumeric + * characters as well as '-'. + * The maximum length of the limit name is 64 characters. + * The name of a limit is used as a unique identifier for this limit. + * Therefore, once a limit has been put into use, its name should be + * immutable. You can use the display_name field to provide a user-friendly + * name for the limit. The display name can be evolved over time without + * affecting the identity of the limit. + * + * Generated from protobuf field string name = 6; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. User-visible, extended description for this quota limit. + * Should be used only when more context is needed to understand this limit + * than provided by the limit's display name (see: `display_name`). + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. User-visible, extended description for this quota limit. + * Should be used only when more context is needed to understand this limit + * than provided by the limit's display name (see: `display_name`). + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Default number of tokens that can be consumed during the specified + * duration. This is the number of tokens assigned when a client + * application developer activates the service for his/her project. + * Specifying a value of 0 will block all requests. This can be used if you + * are provisioning quota to selected consumers and blocking others. + * Similarly, a value of -1 will indicate an unlimited quota. No other + * negative values are allowed. + * Used by group-based quotas only. + * + * Generated from protobuf field int64 default_limit = 3; + * @return int|string + */ + public function getDefaultLimit() + { + return $this->default_limit; + } + + /** + * Default number of tokens that can be consumed during the specified + * duration. This is the number of tokens assigned when a client + * application developer activates the service for his/her project. + * Specifying a value of 0 will block all requests. This can be used if you + * are provisioning quota to selected consumers and blocking others. + * Similarly, a value of -1 will indicate an unlimited quota. No other + * negative values are allowed. + * Used by group-based quotas only. + * + * Generated from protobuf field int64 default_limit = 3; + * @param int|string $var + * @return $this + */ + public function setDefaultLimit($var) + { + GPBUtil::checkInt64($var); + $this->default_limit = $var; + + return $this; + } + + /** + * Maximum number of tokens that can be consumed during the specified + * duration. Client application developers can override the default limit up + * to this maximum. If specified, this value cannot be set to a value less + * than the default limit. If not specified, it is set to the default limit. + * To allow clients to apply overrides with no upper bound, set this to -1, + * indicating unlimited maximum quota. + * Used by group-based quotas only. + * + * Generated from protobuf field int64 max_limit = 4; + * @return int|string + */ + public function getMaxLimit() + { + return $this->max_limit; + } + + /** + * Maximum number of tokens that can be consumed during the specified + * duration. Client application developers can override the default limit up + * to this maximum. If specified, this value cannot be set to a value less + * than the default limit. If not specified, it is set to the default limit. + * To allow clients to apply overrides with no upper bound, set this to -1, + * indicating unlimited maximum quota. + * Used by group-based quotas only. + * + * Generated from protobuf field int64 max_limit = 4; + * @param int|string $var + * @return $this + */ + public function setMaxLimit($var) + { + GPBUtil::checkInt64($var); + $this->max_limit = $var; + + return $this; + } + + /** + * Free tier value displayed in the Developers Console for this limit. + * The free tier is the number of tokens that will be subtracted from the + * billed amount when billing is enabled. + * This field can only be set on a limit with duration "1d", in a billable + * group; it is invalid on any other limit. If this field is not set, it + * defaults to 0, indicating that there is no free tier for this service. + * Used by group-based quotas only. + * + * Generated from protobuf field int64 free_tier = 7; + * @return int|string + */ + public function getFreeTier() + { + return $this->free_tier; + } + + /** + * Free tier value displayed in the Developers Console for this limit. + * The free tier is the number of tokens that will be subtracted from the + * billed amount when billing is enabled. + * This field can only be set on a limit with duration "1d", in a billable + * group; it is invalid on any other limit. If this field is not set, it + * defaults to 0, indicating that there is no free tier for this service. + * Used by group-based quotas only. + * + * Generated from protobuf field int64 free_tier = 7; + * @param int|string $var + * @return $this + */ + public function setFreeTier($var) + { + GPBUtil::checkInt64($var); + $this->free_tier = $var; + + return $this; + } + + /** + * Duration of this limit in textual notation. Example: "100s", "24h", "1d". + * For duration longer than a day, only multiple of days is supported. We + * support only "100s" and "1d" for now. Additional support will be added in + * the future. "0" indicates indefinite duration. + * Used by group-based quotas only. + * + * Generated from protobuf field string duration = 5; + * @return string + */ + public function getDuration() + { + return $this->duration; + } + + /** + * Duration of this limit in textual notation. Example: "100s", "24h", "1d". + * For duration longer than a day, only multiple of days is supported. We + * support only "100s" and "1d" for now. Additional support will be added in + * the future. "0" indicates indefinite duration. + * Used by group-based quotas only. + * + * Generated from protobuf field string duration = 5; + * @param string $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkString($var, True); + $this->duration = $var; + + return $this; + } + + /** + * The name of the metric this quota limit applies to. The quota limits with + * the same metric will be checked together during runtime. The metric must be + * defined within the service config. + * Used by metric-based quotas only. + * + * Generated from protobuf field string metric = 8; + * @return string + */ + public function getMetric() + { + return $this->metric; + } + + /** + * The name of the metric this quota limit applies to. The quota limits with + * the same metric will be checked together during runtime. The metric must be + * defined within the service config. + * Used by metric-based quotas only. + * + * Generated from protobuf field string metric = 8; + * @param string $var + * @return $this + */ + public function setMetric($var) + { + GPBUtil::checkString($var, True); + $this->metric = $var; + + return $this; + } + + /** + * Specify the unit of the quota limit. It uses the same syntax as + * [Metric.unit][]. The supported unit kinds are determined by the quota + * backend system. + * The [Google Service Control](https://cloud.google.com/service-control) + * supports the following unit components: + * * One of the time intevals: + * * "/min" for quota every minute. + * * "/d" for quota every 24 hours, starting 00:00 US Pacific Time. + * * Otherwise the quota won't be reset by time, such as storage limit. + * * One and only one of the granted containers: + * * "/{organization}" quota for an organization. + * * "/{project}" quota for a project. + * * "/{folder}" quota for a folder. + * * "/{resource}" quota for a universal resource. + * * Zero or more quota segmentation dimension. Not all combos are valid. + * * "/{region}" quota for every region. Not to be used with time intervals. + * * Otherwise the resources granted on the target is not segmented. + * * "/{zone}" quota for every zone. Not to be used with time intervals. + * * Otherwise the resources granted on the target is not segmented. + * * "/{resource}" quota for a resource associated with a project or org. + * Here are some examples: + * * "1/min/{project}" for quota per minute per project. + * * "1/min/{user}" for quota per minute per user. + * * "1/min/{organization}" for quota per minute per organization. + * Note: the order of unit components is insignificant. + * The "1" at the beginning is required to follow the metric unit syntax. + * Used by metric-based quotas only. + * + * Generated from protobuf field string unit = 9; + * @return string + */ + public function getUnit() + { + return $this->unit; + } + + /** + * Specify the unit of the quota limit. It uses the same syntax as + * [Metric.unit][]. The supported unit kinds are determined by the quota + * backend system. + * The [Google Service Control](https://cloud.google.com/service-control) + * supports the following unit components: + * * One of the time intevals: + * * "/min" for quota every minute. + * * "/d" for quota every 24 hours, starting 00:00 US Pacific Time. + * * Otherwise the quota won't be reset by time, such as storage limit. + * * One and only one of the granted containers: + * * "/{organization}" quota for an organization. + * * "/{project}" quota for a project. + * * "/{folder}" quota for a folder. + * * "/{resource}" quota for a universal resource. + * * Zero or more quota segmentation dimension. Not all combos are valid. + * * "/{region}" quota for every region. Not to be used with time intervals. + * * Otherwise the resources granted on the target is not segmented. + * * "/{zone}" quota for every zone. Not to be used with time intervals. + * * Otherwise the resources granted on the target is not segmented. + * * "/{resource}" quota for a resource associated with a project or org. + * Here are some examples: + * * "1/min/{project}" for quota per minute per project. + * * "1/min/{user}" for quota per minute per user. + * * "1/min/{organization}" for quota per minute per organization. + * Note: the order of unit components is insignificant. + * The "1" at the beginning is required to follow the metric unit syntax. + * Used by metric-based quotas only. + * + * Generated from protobuf field string unit = 9; + * @param string $var + * @return $this + */ + public function setUnit($var) + { + GPBUtil::checkString($var, True); + $this->unit = $var; + + return $this; + } + + /** + * Tiered limit values. Also allows for regional or zone overrides for these + * values if "/{region}" or "/{zone}" is specified in the unit field. + * Currently supported tiers from low to high: + * VERY_LOW, LOW, STANDARD, HIGH, VERY_HIGH + * To apply different limit values for users according to their tiers, specify + * the values for the tiers you want to differentiate. For example: + * {LOW:100, STANDARD:500, HIGH:1000, VERY_HIGH:5000} + * The limit value for each tier is optional except for the tier STANDARD. + * The limit value for an unspecified tier falls to the value of its next + * tier towards tier STANDARD. For the above example, the limit value for tier + * STANDARD is 500. + * To apply the same limit value for all users, just specify limit value for + * tier STANDARD. For example: {STANDARD:500}. + * To apply a regional overide for a tier, add a map entry with key + * "/", where is a region name. Similarly, for a zone + * override, add a map entry with key "/{zone}". + * Further, a wildcard can be used at the end of a zone name in order to + * specify zone level overrides. For example: + * LOW: 10, STANDARD: 50, HIGH: 100, + * LOW/us-central1: 20, STANDARD/us-central1: 60, HIGH/us-central1: 200, + * LOW/us-central1-*: 10, STANDARD/us-central1-*: 20, HIGH/us-central1-*: 80 + * The regional overrides tier set for each region must be the same as + * the tier set for default limit values. Same rule applies for zone overrides + * tier as well. + * Used by metric-based quotas only. + * + * Generated from protobuf field map values = 10; + * @return \Google\Protobuf\Internal\MapField + */ + public function getValues() + { + return $this->values; + } + + /** + * Tiered limit values. Also allows for regional or zone overrides for these + * values if "/{region}" or "/{zone}" is specified in the unit field. + * Currently supported tiers from low to high: + * VERY_LOW, LOW, STANDARD, HIGH, VERY_HIGH + * To apply different limit values for users according to their tiers, specify + * the values for the tiers you want to differentiate. For example: + * {LOW:100, STANDARD:500, HIGH:1000, VERY_HIGH:5000} + * The limit value for each tier is optional except for the tier STANDARD. + * The limit value for an unspecified tier falls to the value of its next + * tier towards tier STANDARD. For the above example, the limit value for tier + * STANDARD is 500. + * To apply the same limit value for all users, just specify limit value for + * tier STANDARD. For example: {STANDARD:500}. + * To apply a regional overide for a tier, add a map entry with key + * "/", where is a region name. Similarly, for a zone + * override, add a map entry with key "/{zone}". + * Further, a wildcard can be used at the end of a zone name in order to + * specify zone level overrides. For example: + * LOW: 10, STANDARD: 50, HIGH: 100, + * LOW/us-central1: 20, STANDARD/us-central1: 60, HIGH/us-central1: 200, + * LOW/us-central1-*: 10, STANDARD/us-central1-*: 20, HIGH/us-central1-*: 80 + * The regional overrides tier set for each region must be the same as + * the tier set for default limit values. Same rule applies for zone overrides + * tier as well. + * Used by metric-based quotas only. + * + * Generated from protobuf field map values = 10; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64); + $this->values = $arr; + + return $this; + } + + /** + * User-visible display name for this limit. + * Optional. If not set, the UI will provide a default display name based on + * the quota configuration. This field can be used to override the default + * display name generated from the configuration. + * + * Generated from protobuf field string display_name = 12; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User-visible display name for this limit. + * Optional. If not set, the UI will provide a default display name based on + * the quota configuration. This field can be used to override the default + * display name generated from the configuration. + * + * Generated from protobuf field string display_name = 12; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/ResourceDescriptor.php b/vendor/google/common-protos/src/Api/ResourceDescriptor.php new file mode 100644 index 00000000..77b54ede --- /dev/null +++ b/vendor/google/common-protos/src/Api/ResourceDescriptor.php @@ -0,0 +1,481 @@ +google.api.ResourceDescriptor + */ +class ResourceDescriptor extends \Google\Protobuf\Internal\Message +{ + /** + * The resource type. It must be in the format of + * {service_name}/{resource_type_kind}. The `resource_type_kind` must be + * singular and must not include version numbers. + * Example: `storage.googleapis.com/Bucket` + * The value of the resource_type_kind must follow the regular expression + * /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + * should use PascalCase (UpperCamelCase). The maximum number of + * characters allowed for the `resource_type_kind` is 100. + * + * Generated from protobuf field string type = 1; + */ + private $type = ''; + /** + * Optional. The relative resource name pattern associated with this resource + * type. The DNS prefix of the full resource name shouldn't be specified here. + * The path pattern must follow the syntax, which aligns with HTTP binding + * syntax: + * Template = Segment { "/" Segment } ; + * Segment = LITERAL | Variable ; + * Variable = "{" LITERAL "}" ; + * Examples: + * - "projects/{project}/topics/{topic}" + * - "projects/{project}/knowledgeBases/{knowledge_base}" + * The components in braces correspond to the IDs for each resource in the + * hierarchy. It is expected that, if multiple patterns are provided, + * the same component name (e.g. "project") refers to IDs of the same + * type of resource. + * + * Generated from protobuf field repeated string pattern = 2; + */ + private $pattern; + /** + * Optional. The field on the resource that designates the resource name + * field. If omitted, this is assumed to be "name". + * + * Generated from protobuf field string name_field = 3; + */ + private $name_field = ''; + /** + * Optional. The historical or future-looking state of the resource pattern. + * Example: + * // The InspectTemplate message originally only supported resource + * // names with organization, and project was added later. + * message InspectTemplate { + * option (google.api.resource) = { + * type: "dlp.googleapis.com/InspectTemplate" + * pattern: + * "organizations/{organization}/inspectTemplates/{inspect_template}" + * pattern: "projects/{project}/inspectTemplates/{inspect_template}" + * history: ORIGINALLY_SINGLE_PATTERN + * }; + * } + * + * Generated from protobuf field .google.api.ResourceDescriptor.History history = 4; + */ + private $history = 0; + /** + * The plural name used in the resource name, such as 'projects' for + * the name of 'projects/{project}'. It is the same concept of the `plural` + * field in k8s CRD spec + * https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + * + * Generated from protobuf field string plural = 5; + */ + private $plural = ''; + /** + * The same concept of the `singular` field in k8s CRD spec + * https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + * Such as "project" for the `resourcemanager.googleapis.com/Project` type. + * + * Generated from protobuf field string singular = 6; + */ + private $singular = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * The resource type. It must be in the format of + * {service_name}/{resource_type_kind}. The `resource_type_kind` must be + * singular and must not include version numbers. + * Example: `storage.googleapis.com/Bucket` + * The value of the resource_type_kind must follow the regular expression + * /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + * should use PascalCase (UpperCamelCase). The maximum number of + * characters allowed for the `resource_type_kind` is 100. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $pattern + * Optional. The relative resource name pattern associated with this resource + * type. The DNS prefix of the full resource name shouldn't be specified here. + * The path pattern must follow the syntax, which aligns with HTTP binding + * syntax: + * Template = Segment { "/" Segment } ; + * Segment = LITERAL | Variable ; + * Variable = "{" LITERAL "}" ; + * Examples: + * - "projects/{project}/topics/{topic}" + * - "projects/{project}/knowledgeBases/{knowledge_base}" + * The components in braces correspond to the IDs for each resource in the + * hierarchy. It is expected that, if multiple patterns are provided, + * the same component name (e.g. "project") refers to IDs of the same + * type of resource. + * @type string $name_field + * Optional. The field on the resource that designates the resource name + * field. If omitted, this is assumed to be "name". + * @type int $history + * Optional. The historical or future-looking state of the resource pattern. + * Example: + * // The InspectTemplate message originally only supported resource + * // names with organization, and project was added later. + * message InspectTemplate { + * option (google.api.resource) = { + * type: "dlp.googleapis.com/InspectTemplate" + * pattern: + * "organizations/{organization}/inspectTemplates/{inspect_template}" + * pattern: "projects/{project}/inspectTemplates/{inspect_template}" + * history: ORIGINALLY_SINGLE_PATTERN + * }; + * } + * @type string $plural + * The plural name used in the resource name, such as 'projects' for + * the name of 'projects/{project}'. It is the same concept of the `plural` + * field in k8s CRD spec + * https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + * @type string $singular + * The same concept of the `singular` field in k8s CRD spec + * https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + * Such as "project" for the `resourcemanager.googleapis.com/Project` type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Resource::initOnce(); + parent::__construct($data); + } + + /** + * The resource type. It must be in the format of + * {service_name}/{resource_type_kind}. The `resource_type_kind` must be + * singular and must not include version numbers. + * Example: `storage.googleapis.com/Bucket` + * The value of the resource_type_kind must follow the regular expression + * /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + * should use PascalCase (UpperCamelCase). The maximum number of + * characters allowed for the `resource_type_kind` is 100. + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The resource type. It must be in the format of + * {service_name}/{resource_type_kind}. The `resource_type_kind` must be + * singular and must not include version numbers. + * Example: `storage.googleapis.com/Bucket` + * The value of the resource_type_kind must follow the regular expression + * /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + * should use PascalCase (UpperCamelCase). The maximum number of + * characters allowed for the `resource_type_kind` is 100. + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Optional. The relative resource name pattern associated with this resource + * type. The DNS prefix of the full resource name shouldn't be specified here. + * The path pattern must follow the syntax, which aligns with HTTP binding + * syntax: + * Template = Segment { "/" Segment } ; + * Segment = LITERAL | Variable ; + * Variable = "{" LITERAL "}" ; + * Examples: + * - "projects/{project}/topics/{topic}" + * - "projects/{project}/knowledgeBases/{knowledge_base}" + * The components in braces correspond to the IDs for each resource in the + * hierarchy. It is expected that, if multiple patterns are provided, + * the same component name (e.g. "project") refers to IDs of the same + * type of resource. + * + * Generated from protobuf field repeated string pattern = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPattern() + { + return $this->pattern; + } + + /** + * Optional. The relative resource name pattern associated with this resource + * type. The DNS prefix of the full resource name shouldn't be specified here. + * The path pattern must follow the syntax, which aligns with HTTP binding + * syntax: + * Template = Segment { "/" Segment } ; + * Segment = LITERAL | Variable ; + * Variable = "{" LITERAL "}" ; + * Examples: + * - "projects/{project}/topics/{topic}" + * - "projects/{project}/knowledgeBases/{knowledge_base}" + * The components in braces correspond to the IDs for each resource in the + * hierarchy. It is expected that, if multiple patterns are provided, + * the same component name (e.g. "project") refers to IDs of the same + * type of resource. + * + * Generated from protobuf field repeated string pattern = 2; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPattern($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->pattern = $arr; + + return $this; + } + + /** + * Optional. The field on the resource that designates the resource name + * field. If omitted, this is assumed to be "name". + * + * Generated from protobuf field string name_field = 3; + * @return string + */ + public function getNameField() + { + return $this->name_field; + } + + /** + * Optional. The field on the resource that designates the resource name + * field. If omitted, this is assumed to be "name". + * + * Generated from protobuf field string name_field = 3; + * @param string $var + * @return $this + */ + public function setNameField($var) + { + GPBUtil::checkString($var, True); + $this->name_field = $var; + + return $this; + } + + /** + * Optional. The historical or future-looking state of the resource pattern. + * Example: + * // The InspectTemplate message originally only supported resource + * // names with organization, and project was added later. + * message InspectTemplate { + * option (google.api.resource) = { + * type: "dlp.googleapis.com/InspectTemplate" + * pattern: + * "organizations/{organization}/inspectTemplates/{inspect_template}" + * pattern: "projects/{project}/inspectTemplates/{inspect_template}" + * history: ORIGINALLY_SINGLE_PATTERN + * }; + * } + * + * Generated from protobuf field .google.api.ResourceDescriptor.History history = 4; + * @return int + */ + public function getHistory() + { + return $this->history; + } + + /** + * Optional. The historical or future-looking state of the resource pattern. + * Example: + * // The InspectTemplate message originally only supported resource + * // names with organization, and project was added later. + * message InspectTemplate { + * option (google.api.resource) = { + * type: "dlp.googleapis.com/InspectTemplate" + * pattern: + * "organizations/{organization}/inspectTemplates/{inspect_template}" + * pattern: "projects/{project}/inspectTemplates/{inspect_template}" + * history: ORIGINALLY_SINGLE_PATTERN + * }; + * } + * + * Generated from protobuf field .google.api.ResourceDescriptor.History history = 4; + * @param int $var + * @return $this + */ + public function setHistory($var) + { + GPBUtil::checkEnum($var, \Google\Api\ResourceDescriptor_History::class); + $this->history = $var; + + return $this; + } + + /** + * The plural name used in the resource name, such as 'projects' for + * the name of 'projects/{project}'. It is the same concept of the `plural` + * field in k8s CRD spec + * https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + * + * Generated from protobuf field string plural = 5; + * @return string + */ + public function getPlural() + { + return $this->plural; + } + + /** + * The plural name used in the resource name, such as 'projects' for + * the name of 'projects/{project}'. It is the same concept of the `plural` + * field in k8s CRD spec + * https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + * + * Generated from protobuf field string plural = 5; + * @param string $var + * @return $this + */ + public function setPlural($var) + { + GPBUtil::checkString($var, True); + $this->plural = $var; + + return $this; + } + + /** + * The same concept of the `singular` field in k8s CRD spec + * https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + * Such as "project" for the `resourcemanager.googleapis.com/Project` type. + * + * Generated from protobuf field string singular = 6; + * @return string + */ + public function getSingular() + { + return $this->singular; + } + + /** + * The same concept of the `singular` field in k8s CRD spec + * https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + * Such as "project" for the `resourcemanager.googleapis.com/Project` type. + * + * Generated from protobuf field string singular = 6; + * @param string $var + * @return $this + */ + public function setSingular($var) + { + GPBUtil::checkString($var, True); + $this->singular = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/ResourceDescriptor/History.php b/vendor/google/common-protos/src/Api/ResourceDescriptor/History.php new file mode 100644 index 00000000..52b74e9f --- /dev/null +++ b/vendor/google/common-protos/src/Api/ResourceDescriptor/History.php @@ -0,0 +1,68 @@ +google.api.ResourceDescriptor.History + */ +class History +{ + /** + * The "unset" value. + * + * Generated from protobuf enum HISTORY_UNSPECIFIED = 0; + */ + const HISTORY_UNSPECIFIED = 0; + /** + * The resource originally had one pattern and launched as such, and + * additional patterns were added later. + * + * Generated from protobuf enum ORIGINALLY_SINGLE_PATTERN = 1; + */ + const ORIGINALLY_SINGLE_PATTERN = 1; + /** + * The resource has one pattern, but the API owner expects to add more + * later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents + * that from being necessary once there are multiple patterns.) + * + * Generated from protobuf enum FUTURE_MULTI_PATTERN = 2; + */ + const FUTURE_MULTI_PATTERN = 2; + + private static $valueToName = [ + self::HISTORY_UNSPECIFIED => 'HISTORY_UNSPECIFIED', + self::ORIGINALLY_SINGLE_PATTERN => 'ORIGINALLY_SINGLE_PATTERN', + self::FUTURE_MULTI_PATTERN => 'FUTURE_MULTI_PATTERN', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(History::class, \Google\Api\ResourceDescriptor_History::class); + diff --git a/vendor/google/common-protos/src/Api/ResourceDescriptor_History.php b/vendor/google/common-protos/src/Api/ResourceDescriptor_History.php new file mode 100644 index 00000000..87c5801c --- /dev/null +++ b/vendor/google/common-protos/src/Api/ResourceDescriptor_History.php @@ -0,0 +1,16 @@ +google.api.ResourceReference + */ +class ResourceReference extends \Google\Protobuf\Internal\Message +{ + /** + * The resource type that the annotated field references. + * Example: + * message Subscription { + * string topic = 2 [(google.api.resource_reference) = { + * type: "pubsub.googleapis.com/Topic" + * }]; + * } + * + * Generated from protobuf field string type = 1; + */ + private $type = ''; + /** + * The resource type of a child collection that the annotated field + * references. This is useful for annotating the `parent` field that + * doesn't have a fixed resource type. + * Example: + * message ListLogEntriesRequest { + * string parent = 1 [(google.api.resource_reference) = { + * child_type: "logging.googleapis.com/LogEntry" + * }; + * } + * + * Generated from protobuf field string child_type = 2; + */ + private $child_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * The resource type that the annotated field references. + * Example: + * message Subscription { + * string topic = 2 [(google.api.resource_reference) = { + * type: "pubsub.googleapis.com/Topic" + * }]; + * } + * @type string $child_type + * The resource type of a child collection that the annotated field + * references. This is useful for annotating the `parent` field that + * doesn't have a fixed resource type. + * Example: + * message ListLogEntriesRequest { + * string parent = 1 [(google.api.resource_reference) = { + * child_type: "logging.googleapis.com/LogEntry" + * }; + * } + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Resource::initOnce(); + parent::__construct($data); + } + + /** + * The resource type that the annotated field references. + * Example: + * message Subscription { + * string topic = 2 [(google.api.resource_reference) = { + * type: "pubsub.googleapis.com/Topic" + * }]; + * } + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The resource type that the annotated field references. + * Example: + * message Subscription { + * string topic = 2 [(google.api.resource_reference) = { + * type: "pubsub.googleapis.com/Topic" + * }]; + * } + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The resource type of a child collection that the annotated field + * references. This is useful for annotating the `parent` field that + * doesn't have a fixed resource type. + * Example: + * message ListLogEntriesRequest { + * string parent = 1 [(google.api.resource_reference) = { + * child_type: "logging.googleapis.com/LogEntry" + * }; + * } + * + * Generated from protobuf field string child_type = 2; + * @return string + */ + public function getChildType() + { + return $this->child_type; + } + + /** + * The resource type of a child collection that the annotated field + * references. This is useful for annotating the `parent` field that + * doesn't have a fixed resource type. + * Example: + * message ListLogEntriesRequest { + * string parent = 1 [(google.api.resource_reference) = { + * child_type: "logging.googleapis.com/LogEntry" + * }; + * } + * + * Generated from protobuf field string child_type = 2; + * @param string $var + * @return $this + */ + public function setChildType($var) + { + GPBUtil::checkString($var, True); + $this->child_type = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/RoutingParameter.php b/vendor/google/common-protos/src/Api/RoutingParameter.php new file mode 100644 index 00000000..1b32a8ff --- /dev/null +++ b/vendor/google/common-protos/src/Api/RoutingParameter.php @@ -0,0 +1,281 @@ +google.api.RoutingParameter + */ +class RoutingParameter extends \Google\Protobuf\Internal\Message +{ + /** + * A request field to extract the header key-value pair from. + * + * Generated from protobuf field string field = 1; + */ + protected $field = ''; + /** + * A pattern matching the key-value field. Optional. + * If not specified, the whole field specified in the `field` field will be + * taken as value, and its name used as key. If specified, it MUST contain + * exactly one named segment (along with any number of unnamed segments) The + * pattern will be matched over the field specified in the `field` field, then + * if the match is successful: + * - the name of the single named segment will be used as a header name, + * - the match value of the segment will be used as a header value; + * if the match is NOT successful, nothing will be sent. + * Example: + * -- This is a field in the request message + * | that the header value will be extracted from. + * | + * | -- This is the key name in the + * | | routing header. + * V | + * field: "table_name" v + * path_template: "projects/*/{table_location=instances/*}/tables/*" + * ^ ^ + * | | + * In the {} brackets is the pattern that -- | + * specifies what to extract from the | + * field as a value to be sent. | + * | + * The string in the field must match the whole pattern -- + * before brackets, inside brackets, after brackets. + * When looking at this specific example, we can see that: + * - A key-value pair with the key `table_location` + * and the value matching `instances/*` should be added + * to the x-goog-request-params routing header. + * - The value is extracted from the request message's `table_name` field + * if it matches the full pattern specified: + * `projects/*/instances/*/tables/*`. + * **NB:** If the `path_template` field is not provided, the key name is + * equal to the field name, and the whole field should be sent as a value. + * This makes the pattern for the field and the value functionally equivalent + * to `**`, and the configuration + * { + * field: "table_name" + * } + * is a functionally equivalent shorthand to: + * { + * field: "table_name" + * path_template: "{table_name=**}" + * } + * See Example 1 for more details. + * + * Generated from protobuf field string path_template = 2; + */ + protected $path_template = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $field + * A request field to extract the header key-value pair from. + * @type string $path_template + * A pattern matching the key-value field. Optional. + * If not specified, the whole field specified in the `field` field will be + * taken as value, and its name used as key. If specified, it MUST contain + * exactly one named segment (along with any number of unnamed segments) The + * pattern will be matched over the field specified in the `field` field, then + * if the match is successful: + * - the name of the single named segment will be used as a header name, + * - the match value of the segment will be used as a header value; + * if the match is NOT successful, nothing will be sent. + * Example: + * -- This is a field in the request message + * | that the header value will be extracted from. + * | + * | -- This is the key name in the + * | | routing header. + * V | + * field: "table_name" v + * path_template: "projects/*/{table_location=instances/*}/tables/*" + * ^ ^ + * | | + * In the {} brackets is the pattern that -- | + * specifies what to extract from the | + * field as a value to be sent. | + * | + * The string in the field must match the whole pattern -- + * before brackets, inside brackets, after brackets. + * When looking at this specific example, we can see that: + * - A key-value pair with the key `table_location` + * and the value matching `instances/*` should be added + * to the x-goog-request-params routing header. + * - The value is extracted from the request message's `table_name` field + * if it matches the full pattern specified: + * `projects/*/instances/*/tables/*`. + * **NB:** If the `path_template` field is not provided, the key name is + * equal to the field name, and the whole field should be sent as a value. + * This makes the pattern for the field and the value functionally equivalent + * to `**`, and the configuration + * { + * field: "table_name" + * } + * is a functionally equivalent shorthand to: + * { + * field: "table_name" + * path_template: "{table_name=**}" + * } + * See Example 1 for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Routing::initOnce(); + parent::__construct($data); + } + + /** + * A request field to extract the header key-value pair from. + * + * Generated from protobuf field string field = 1; + * @return string + */ + public function getField() + { + return $this->field; + } + + /** + * A request field to extract the header key-value pair from. + * + * Generated from protobuf field string field = 1; + * @param string $var + * @return $this + */ + public function setField($var) + { + GPBUtil::checkString($var, True); + $this->field = $var; + + return $this; + } + + /** + * A pattern matching the key-value field. Optional. + * If not specified, the whole field specified in the `field` field will be + * taken as value, and its name used as key. If specified, it MUST contain + * exactly one named segment (along with any number of unnamed segments) The + * pattern will be matched over the field specified in the `field` field, then + * if the match is successful: + * - the name of the single named segment will be used as a header name, + * - the match value of the segment will be used as a header value; + * if the match is NOT successful, nothing will be sent. + * Example: + * -- This is a field in the request message + * | that the header value will be extracted from. + * | + * | -- This is the key name in the + * | | routing header. + * V | + * field: "table_name" v + * path_template: "projects/*/{table_location=instances/*}/tables/*" + * ^ ^ + * | | + * In the {} brackets is the pattern that -- | + * specifies what to extract from the | + * field as a value to be sent. | + * | + * The string in the field must match the whole pattern -- + * before brackets, inside brackets, after brackets. + * When looking at this specific example, we can see that: + * - A key-value pair with the key `table_location` + * and the value matching `instances/*` should be added + * to the x-goog-request-params routing header. + * - The value is extracted from the request message's `table_name` field + * if it matches the full pattern specified: + * `projects/*/instances/*/tables/*`. + * **NB:** If the `path_template` field is not provided, the key name is + * equal to the field name, and the whole field should be sent as a value. + * This makes the pattern for the field and the value functionally equivalent + * to `**`, and the configuration + * { + * field: "table_name" + * } + * is a functionally equivalent shorthand to: + * { + * field: "table_name" + * path_template: "{table_name=**}" + * } + * See Example 1 for more details. + * + * Generated from protobuf field string path_template = 2; + * @return string + */ + public function getPathTemplate() + { + return $this->path_template; + } + + /** + * A pattern matching the key-value field. Optional. + * If not specified, the whole field specified in the `field` field will be + * taken as value, and its name used as key. If specified, it MUST contain + * exactly one named segment (along with any number of unnamed segments) The + * pattern will be matched over the field specified in the `field` field, then + * if the match is successful: + * - the name of the single named segment will be used as a header name, + * - the match value of the segment will be used as a header value; + * if the match is NOT successful, nothing will be sent. + * Example: + * -- This is a field in the request message + * | that the header value will be extracted from. + * | + * | -- This is the key name in the + * | | routing header. + * V | + * field: "table_name" v + * path_template: "projects/*/{table_location=instances/*}/tables/*" + * ^ ^ + * | | + * In the {} brackets is the pattern that -- | + * specifies what to extract from the | + * field as a value to be sent. | + * | + * The string in the field must match the whole pattern -- + * before brackets, inside brackets, after brackets. + * When looking at this specific example, we can see that: + * - A key-value pair with the key `table_location` + * and the value matching `instances/*` should be added + * to the x-goog-request-params routing header. + * - The value is extracted from the request message's `table_name` field + * if it matches the full pattern specified: + * `projects/*/instances/*/tables/*`. + * **NB:** If the `path_template` field is not provided, the key name is + * equal to the field name, and the whole field should be sent as a value. + * This makes the pattern for the field and the value functionally equivalent + * to `**`, and the configuration + * { + * field: "table_name" + * } + * is a functionally equivalent shorthand to: + * { + * field: "table_name" + * path_template: "{table_name=**}" + * } + * See Example 1 for more details. + * + * Generated from protobuf field string path_template = 2; + * @param string $var + * @return $this + */ + public function setPathTemplate($var) + { + GPBUtil::checkString($var, True); + $this->path_template = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/RoutingRule.php b/vendor/google/common-protos/src/Api/RoutingRule.php new file mode 100644 index 00000000..6a42d71c --- /dev/null +++ b/vendor/google/common-protos/src/Api/RoutingRule.php @@ -0,0 +1,353 @@ +/tables/` + * // - `projects//instances//tables/
` + * // - `region//zones//tables/
` + * string table_name = 1; + * // This value specifies routing for replication. + * // It can be in the following formats: + * // - `profiles/` + * // - a legacy `profile_id` that can be any string + * string app_profile_id = 2; + * } + * Example message: + * { + * table_name: projects/proj_foo/instances/instance_bar/table/table_baz, + * app_profile_id: profiles/prof_qux + * } + * The routing header consists of one or multiple key-value pairs. Every key + * and value must be percent-encoded, and joined together in the format of + * `key1=value1&key2=value2`. + * In the examples below I am skipping the percent-encoding for readablity. + * Example 1 + * Extracting a field from the request to put into the routing header + * unchanged, with the key equal to the field name. + * annotation: + * option (google.api.routing) = { + * // Take the `app_profile_id`. + * routing_parameters { + * field: "app_profile_id" + * } + * }; + * result: + * x-goog-request-params: app_profile_id=profiles/prof_qux + * Example 2 + * Extracting a field from the request to put into the routing header + * unchanged, with the key different from the field name. + * annotation: + * option (google.api.routing) = { + * // Take the `app_profile_id`, but name it `routing_id` in the header. + * routing_parameters { + * field: "app_profile_id" + * path_template: "{routing_id=**}" + * } + * }; + * result: + * x-goog-request-params: routing_id=profiles/prof_qux + * Example 3 + * Extracting a field from the request to put into the routing + * header, while matching a path template syntax on the field's value. + * NB: it is more useful to send nothing than to send garbage for the purpose + * of dynamic routing, since garbage pollutes cache. Thus the matching. + * Sub-example 3a + * The field matches the template. + * annotation: + * option (google.api.routing) = { + * // Take the `table_name`, if it's well-formed (with project-based + * // syntax). + * routing_parameters { + * field: "table_name" + * path_template: "{table_name=projects/*/instances/*/**}" + * } + * }; + * result: + * x-goog-request-params: + * table_name=projects/proj_foo/instances/instance_bar/table/table_baz + * Sub-example 3b + * The field does not match the template. + * annotation: + * option (google.api.routing) = { + * // Take the `table_name`, if it's well-formed (with region-based + * // syntax). + * routing_parameters { + * field: "table_name" + * path_template: "{table_name=regions/*/zones/*/**}" + * } + * }; + * result: + * + * Sub-example 3c + * Multiple alternative conflictingly named path templates are + * specified. The one that matches is used to construct the header. + * annotation: + * option (google.api.routing) = { + * // Take the `table_name`, if it's well-formed, whether + * // using the region- or projects-based syntax. + * routing_parameters { + * field: "table_name" + * path_template: "{table_name=regions/*/zones/*/**}" + * } + * routing_parameters { + * field: "table_name" + * path_template: "{table_name=projects/*/instances/*/**}" + * } + * }; + * result: + * x-goog-request-params: + * table_name=projects/proj_foo/instances/instance_bar/table/table_baz + * Example 4 + * Extracting a single routing header key-value pair by matching a + * template syntax on (a part of) a single request field. + * annotation: + * option (google.api.routing) = { + * // Take just the project id from the `table_name` field. + * routing_parameters { + * field: "table_name" + * path_template: "{routing_id=projects/*}/**" + * } + * }; + * result: + * x-goog-request-params: routing_id=projects/proj_foo + * Example 5 + * Extracting a single routing header key-value pair by matching + * several conflictingly named path templates on (parts of) a single request + * field. The last template to match "wins" the conflict. + * annotation: + * option (google.api.routing) = { + * // If the `table_name` does not have instances information, + * // take just the project id for routing. + * // Otherwise take project + instance. + * routing_parameters { + * field: "table_name" + * path_template: "{routing_id=projects/*}/**" + * } + * routing_parameters { + * field: "table_name" + * path_template: "{routing_id=projects/*/instances/*}/**" + * } + * }; + * result: + * x-goog-request-params: + * routing_id=projects/proj_foo/instances/instance_bar + * Example 6 + * Extracting multiple routing header key-value pairs by matching + * several non-conflicting path templates on (parts of) a single request field. + * Sub-example 6a + * Make the templates strict, so that if the `table_name` does not + * have an instance information, nothing is sent. + * annotation: + * option (google.api.routing) = { + * // The routing code needs two keys instead of one composite + * // but works only for the tables with the "project-instance" name + * // syntax. + * routing_parameters { + * field: "table_name" + * path_template: "{project_id=projects/*}/instances/*/**" + * } + * routing_parameters { + * field: "table_name" + * path_template: "projects/*/{instance_id=instances/*}/**" + * } + * }; + * result: + * x-goog-request-params: + * project_id=projects/proj_foo&instance_id=instances/instance_bar + * Sub-example 6b + * Make the templates loose, so that if the `table_name` does not + * have an instance information, just the project id part is sent. + * annotation: + * option (google.api.routing) = { + * // The routing code wants two keys instead of one composite + * // but will work with just the `project_id` for tables without + * // an instance in the `table_name`. + * routing_parameters { + * field: "table_name" + * path_template: "{project_id=projects/*}/**" + * } + * routing_parameters { + * field: "table_name" + * path_template: "projects/*/{instance_id=instances/*}/**" + * } + * }; + * result (is the same as 6a for our example message because it has the instance + * information): + * x-goog-request-params: + * project_id=projects/proj_foo&instance_id=instances/instance_bar + * Example 7 + * Extracting multiple routing header key-value pairs by matching + * several path templates on multiple request fields. + * NB: note that here there is no way to specify sending nothing if one of the + * fields does not match its template. E.g. if the `table_name` is in the wrong + * format, the `project_id` will not be sent, but the `routing_id` will be. + * The backend routing code has to be aware of that and be prepared to not + * receive a full complement of keys if it expects multiple. + * annotation: + * option (google.api.routing) = { + * // The routing needs both `project_id` and `routing_id` + * // (from the `app_profile_id` field) for routing. + * routing_parameters { + * field: "table_name" + * path_template: "{project_id=projects/*}/**" + * } + * routing_parameters { + * field: "app_profile_id" + * path_template: "{routing_id=**}" + * } + * }; + * result: + * x-goog-request-params: + * project_id=projects/proj_foo&routing_id=profiles/prof_qux + * Example 8 + * Extracting a single routing header key-value pair by matching + * several conflictingly named path templates on several request fields. The + * last template to match "wins" the conflict. + * annotation: + * option (google.api.routing) = { + * // The `routing_id` can be a project id or a region id depending on + * // the table name format, but only if the `app_profile_id` is not set. + * // If `app_profile_id` is set it should be used instead. + * routing_parameters { + * field: "table_name" + * path_template: "{routing_id=projects/*}/**" + * } + * routing_parameters { + * field: "table_name" + * path_template: "{routing_id=regions/*}/**" + * } + * routing_parameters { + * field: "app_profile_id" + * path_template: "{routing_id=**}" + * } + * }; + * result: + * x-goog-request-params: routing_id=profiles/prof_qux + * Example 9 + * Bringing it all together. + * annotation: + * option (google.api.routing) = { + * // For routing both `table_location` and a `routing_id` are needed. + * // + * // table_location can be either an instance id or a region+zone id. + * // + * // For `routing_id`, take the value of `app_profile_id` + * // - If it's in the format `profiles/`, send + * // just the `` part. + * // - If it's any other literal, send it as is. + * // If the `app_profile_id` is empty, and the `table_name` starts with + * // the project_id, send that instead. + * routing_parameters { + * field: "table_name" + * path_template: "projects/*/{table_location=instances/*}/tables/*" + * } + * routing_parameters { + * field: "table_name" + * path_template: "{table_location=regions/*/zones/*}/tables/*" + * } + * routing_parameters { + * field: "table_name" + * path_template: "{routing_id=projects/*}/**" + * } + * routing_parameters { + * field: "app_profile_id" + * path_template: "{routing_id=**}" + * } + * routing_parameters { + * field: "app_profile_id" + * path_template: "profiles/{routing_id=*}" + * } + * }; + * result: + * x-goog-request-params: + * table_location=instances/instance_bar&routing_id=prof_qux + * + * Generated from protobuf message google.api.RoutingRule + */ +class RoutingRule extends \Google\Protobuf\Internal\Message +{ + /** + * A collection of Routing Parameter specifications. + * **NOTE:** If multiple Routing Parameters describe the same key + * (via the `path_template` field or via the `field` field when + * `path_template` is not provided), "last one wins" rule + * determines which Parameter gets used. + * See the examples for more details. + * + * Generated from protobuf field repeated .google.api.RoutingParameter routing_parameters = 2; + */ + private $routing_parameters; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\RoutingParameter[]|\Google\Protobuf\Internal\RepeatedField $routing_parameters + * A collection of Routing Parameter specifications. + * **NOTE:** If multiple Routing Parameters describe the same key + * (via the `path_template` field or via the `field` field when + * `path_template` is not provided), "last one wins" rule + * determines which Parameter gets used. + * See the examples for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Routing::initOnce(); + parent::__construct($data); + } + + /** + * A collection of Routing Parameter specifications. + * **NOTE:** If multiple Routing Parameters describe the same key + * (via the `path_template` field or via the `field` field when + * `path_template` is not provided), "last one wins" rule + * determines which Parameter gets used. + * See the examples for more details. + * + * Generated from protobuf field repeated .google.api.RoutingParameter routing_parameters = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRoutingParameters() + { + return $this->routing_parameters; + } + + /** + * A collection of Routing Parameter specifications. + * **NOTE:** If multiple Routing Parameters describe the same key + * (via the `path_template` field or via the `field` field when + * `path_template` is not provided), "last one wins" rule + * determines which Parameter gets used. + * See the examples for more details. + * + * Generated from protobuf field repeated .google.api.RoutingParameter routing_parameters = 2; + * @param \Google\Api\RoutingParameter[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRoutingParameters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\RoutingParameter::class); + $this->routing_parameters = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Service.php b/vendor/google/common-protos/src/Api/Service.php new file mode 100644 index 00000000..5ded8eb4 --- /dev/null +++ b/vendor/google/common-protos/src/Api/Service.php @@ -0,0 +1,1034 @@ +google.api.Service + */ +class Service extends \Google\Protobuf\Internal\Message +{ + /** + * The semantic version of the service configuration. The config version + * affects the interpretation of the service configuration. For example, + * certain features are enabled by default for certain config versions. + * The latest config version is `3`. + * + * Generated from protobuf field .google.protobuf.UInt32Value config_version = 20; + */ + private $config_version = null; + /** + * The DNS address at which this service is available, + * e.g. `calendar.googleapis.com`. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * A unique ID for a specific instance of this message, typically assigned + * by the client for tracking purpose. If empty, the server may choose to + * generate one instead. + * + * Generated from protobuf field string id = 33; + */ + private $id = ''; + /** + * The product title for this service. + * + * Generated from protobuf field string title = 2; + */ + private $title = ''; + /** + * The Google project that owns this service. + * + * Generated from protobuf field string producer_project_id = 22; + */ + private $producer_project_id = ''; + /** + * A list of API interfaces exported by this service. Only the `name` field + * of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration + * author, as the remaining fields will be derived from the IDL during the + * normalization process. It is an error to specify an API interface here + * which cannot be resolved against the associated IDL files. + * + * Generated from protobuf field repeated .google.protobuf.Api apis = 3; + */ + private $apis; + /** + * A list of all proto message types included in this API service. + * Types referenced directly or indirectly by the `apis` are + * automatically included. Messages which are not referenced but + * shall be included, such as types used by the `google.protobuf.Any` type, + * should be listed here by name. Example: + * types: + * - name: google.protobuf.Int32 + * + * Generated from protobuf field repeated .google.protobuf.Type types = 4; + */ + private $types; + /** + * A list of all enum types included in this API service. Enums + * referenced directly or indirectly by the `apis` are automatically + * included. Enums which are not referenced but shall be included + * should be listed here by name. Example: + * enums: + * - name: google.someapi.v1.SomeEnum + * + * Generated from protobuf field repeated .google.protobuf.Enum enums = 5; + */ + private $enums; + /** + * Additional API documentation. + * + * Generated from protobuf field .google.api.Documentation documentation = 6; + */ + private $documentation = null; + /** + * API backend configuration. + * + * Generated from protobuf field .google.api.Backend backend = 8; + */ + private $backend = null; + /** + * HTTP configuration. + * + * Generated from protobuf field .google.api.Http http = 9; + */ + private $http = null; + /** + * Quota configuration. + * + * Generated from protobuf field .google.api.Quota quota = 10; + */ + private $quota = null; + /** + * Auth configuration. + * + * Generated from protobuf field .google.api.Authentication authentication = 11; + */ + private $authentication = null; + /** + * Context configuration. + * + * Generated from protobuf field .google.api.Context context = 12; + */ + private $context = null; + /** + * Configuration controlling usage of this service. + * + * Generated from protobuf field .google.api.Usage usage = 15; + */ + private $usage = null; + /** + * Configuration for network endpoints. If this is empty, then an endpoint + * with the same name as the service is automatically generated to service all + * defined APIs. + * + * Generated from protobuf field repeated .google.api.Endpoint endpoints = 18; + */ + private $endpoints; + /** + * Configuration for the service control plane. + * + * Generated from protobuf field .google.api.Control control = 21; + */ + private $control = null; + /** + * Defines the logs used by this service. + * + * Generated from protobuf field repeated .google.api.LogDescriptor logs = 23; + */ + private $logs; + /** + * Defines the metrics used by this service. + * + * Generated from protobuf field repeated .google.api.MetricDescriptor metrics = 24; + */ + private $metrics; + /** + * Defines the monitored resources used by this service. This is required + * by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. + * + * Generated from protobuf field repeated .google.api.MonitoredResourceDescriptor monitored_resources = 25; + */ + private $monitored_resources; + /** + * Billing configuration. + * + * Generated from protobuf field .google.api.Billing billing = 26; + */ + private $billing = null; + /** + * Logging configuration. + * + * Generated from protobuf field .google.api.Logging logging = 27; + */ + private $logging = null; + /** + * Monitoring configuration. + * + * Generated from protobuf field .google.api.Monitoring monitoring = 28; + */ + private $monitoring = null; + /** + * System parameter configuration. + * + * Generated from protobuf field .google.api.SystemParameters system_parameters = 29; + */ + private $system_parameters = null; + /** + * Output only. The source information for this configuration if available. + * + * Generated from protobuf field .google.api.SourceInfo source_info = 37; + */ + private $source_info = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\UInt32Value $config_version + * The semantic version of the service configuration. The config version + * affects the interpretation of the service configuration. For example, + * certain features are enabled by default for certain config versions. + * The latest config version is `3`. + * @type string $name + * The DNS address at which this service is available, + * e.g. `calendar.googleapis.com`. + * @type string $id + * A unique ID for a specific instance of this message, typically assigned + * by the client for tracking purpose. If empty, the server may choose to + * generate one instead. + * @type string $title + * The product title for this service. + * @type string $producer_project_id + * The Google project that owns this service. + * @type \Google\Protobuf\Api[]|\Google\Protobuf\Internal\RepeatedField $apis + * A list of API interfaces exported by this service. Only the `name` field + * of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration + * author, as the remaining fields will be derived from the IDL during the + * normalization process. It is an error to specify an API interface here + * which cannot be resolved against the associated IDL files. + * @type \Google\Protobuf\Type[]|\Google\Protobuf\Internal\RepeatedField $types + * A list of all proto message types included in this API service. + * Types referenced directly or indirectly by the `apis` are + * automatically included. Messages which are not referenced but + * shall be included, such as types used by the `google.protobuf.Any` type, + * should be listed here by name. Example: + * types: + * - name: google.protobuf.Int32 + * @type \Google\Protobuf\Enum[]|\Google\Protobuf\Internal\RepeatedField $enums + * A list of all enum types included in this API service. Enums + * referenced directly or indirectly by the `apis` are automatically + * included. Enums which are not referenced but shall be included + * should be listed here by name. Example: + * enums: + * - name: google.someapi.v1.SomeEnum + * @type \Google\Api\Documentation $documentation + * Additional API documentation. + * @type \Google\Api\Backend $backend + * API backend configuration. + * @type \Google\Api\Http $http + * HTTP configuration. + * @type \Google\Api\Quota $quota + * Quota configuration. + * @type \Google\Api\Authentication $authentication + * Auth configuration. + * @type \Google\Api\Context $context + * Context configuration. + * @type \Google\Api\Usage $usage + * Configuration controlling usage of this service. + * @type \Google\Api\Endpoint[]|\Google\Protobuf\Internal\RepeatedField $endpoints + * Configuration for network endpoints. If this is empty, then an endpoint + * with the same name as the service is automatically generated to service all + * defined APIs. + * @type \Google\Api\Control $control + * Configuration for the service control plane. + * @type \Google\Api\LogDescriptor[]|\Google\Protobuf\Internal\RepeatedField $logs + * Defines the logs used by this service. + * @type \Google\Api\MetricDescriptor[]|\Google\Protobuf\Internal\RepeatedField $metrics + * Defines the metrics used by this service. + * @type \Google\Api\MonitoredResourceDescriptor[]|\Google\Protobuf\Internal\RepeatedField $monitored_resources + * Defines the monitored resources used by this service. This is required + * by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. + * @type \Google\Api\Billing $billing + * Billing configuration. + * @type \Google\Api\Logging $logging + * Logging configuration. + * @type \Google\Api\Monitoring $monitoring + * Monitoring configuration. + * @type \Google\Api\SystemParameters $system_parameters + * System parameter configuration. + * @type \Google\Api\SourceInfo $source_info + * Output only. The source information for this configuration if available. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Service::initOnce(); + parent::__construct($data); + } + + /** + * The semantic version of the service configuration. The config version + * affects the interpretation of the service configuration. For example, + * certain features are enabled by default for certain config versions. + * The latest config version is `3`. + * + * Generated from protobuf field .google.protobuf.UInt32Value config_version = 20; + * @return \Google\Protobuf\UInt32Value + */ + public function getConfigVersion() + { + return $this->config_version; + } + + /** + * Returns the unboxed value from getConfigVersion() + + * The semantic version of the service configuration. The config version + * affects the interpretation of the service configuration. For example, + * certain features are enabled by default for certain config versions. + * The latest config version is `3`. + * + * Generated from protobuf field .google.protobuf.UInt32Value config_version = 20; + * @return int|null + */ + public function getConfigVersionUnwrapped() + { + $wrapper = $this->getConfigVersion(); + return is_null($wrapper) ? null : $wrapper->getValue(); + } + + /** + * The semantic version of the service configuration. The config version + * affects the interpretation of the service configuration. For example, + * certain features are enabled by default for certain config versions. + * The latest config version is `3`. + * + * Generated from protobuf field .google.protobuf.UInt32Value config_version = 20; + * @param \Google\Protobuf\UInt32Value $var + * @return $this + */ + public function setConfigVersion($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\UInt32Value::class); + $this->config_version = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\UInt32Value object. + + * The semantic version of the service configuration. The config version + * affects the interpretation of the service configuration. For example, + * certain features are enabled by default for certain config versions. + * The latest config version is `3`. + * + * Generated from protobuf field .google.protobuf.UInt32Value config_version = 20; + * @param int|null $var + * @return $this + */ + public function setConfigVersionUnwrapped($var) + { + $wrappedVar = is_null($var) ? null : new \Google\Protobuf\UInt32Value(['value' => $var]); + return $this->setConfigVersion($wrappedVar); + } + + /** + * The DNS address at which this service is available, + * e.g. `calendar.googleapis.com`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The DNS address at which this service is available, + * e.g. `calendar.googleapis.com`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A unique ID for a specific instance of this message, typically assigned + * by the client for tracking purpose. If empty, the server may choose to + * generate one instead. + * + * Generated from protobuf field string id = 33; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * A unique ID for a specific instance of this message, typically assigned + * by the client for tracking purpose. If empty, the server may choose to + * generate one instead. + * + * Generated from protobuf field string id = 33; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * The product title for this service. + * + * Generated from protobuf field string title = 2; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * The product title for this service. + * + * Generated from protobuf field string title = 2; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * The Google project that owns this service. + * + * Generated from protobuf field string producer_project_id = 22; + * @return string + */ + public function getProducerProjectId() + { + return $this->producer_project_id; + } + + /** + * The Google project that owns this service. + * + * Generated from protobuf field string producer_project_id = 22; + * @param string $var + * @return $this + */ + public function setProducerProjectId($var) + { + GPBUtil::checkString($var, True); + $this->producer_project_id = $var; + + return $this; + } + + /** + * A list of API interfaces exported by this service. Only the `name` field + * of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration + * author, as the remaining fields will be derived from the IDL during the + * normalization process. It is an error to specify an API interface here + * which cannot be resolved against the associated IDL files. + * + * Generated from protobuf field repeated .google.protobuf.Api apis = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getApis() + { + return $this->apis; + } + + /** + * A list of API interfaces exported by this service. Only the `name` field + * of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration + * author, as the remaining fields will be derived from the IDL during the + * normalization process. It is an error to specify an API interface here + * which cannot be resolved against the associated IDL files. + * + * Generated from protobuf field repeated .google.protobuf.Api apis = 3; + * @param \Google\Protobuf\Api[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setApis($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Api::class); + $this->apis = $arr; + + return $this; + } + + /** + * A list of all proto message types included in this API service. + * Types referenced directly or indirectly by the `apis` are + * automatically included. Messages which are not referenced but + * shall be included, such as types used by the `google.protobuf.Any` type, + * should be listed here by name. Example: + * types: + * - name: google.protobuf.Int32 + * + * Generated from protobuf field repeated .google.protobuf.Type types = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTypes() + { + return $this->types; + } + + /** + * A list of all proto message types included in this API service. + * Types referenced directly or indirectly by the `apis` are + * automatically included. Messages which are not referenced but + * shall be included, such as types used by the `google.protobuf.Any` type, + * should be listed here by name. Example: + * types: + * - name: google.protobuf.Int32 + * + * Generated from protobuf field repeated .google.protobuf.Type types = 4; + * @param \Google\Protobuf\Type[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Type::class); + $this->types = $arr; + + return $this; + } + + /** + * A list of all enum types included in this API service. Enums + * referenced directly or indirectly by the `apis` are automatically + * included. Enums which are not referenced but shall be included + * should be listed here by name. Example: + * enums: + * - name: google.someapi.v1.SomeEnum + * + * Generated from protobuf field repeated .google.protobuf.Enum enums = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEnums() + { + return $this->enums; + } + + /** + * A list of all enum types included in this API service. Enums + * referenced directly or indirectly by the `apis` are automatically + * included. Enums which are not referenced but shall be included + * should be listed here by name. Example: + * enums: + * - name: google.someapi.v1.SomeEnum + * + * Generated from protobuf field repeated .google.protobuf.Enum enums = 5; + * @param \Google\Protobuf\Enum[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEnums($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Enum::class); + $this->enums = $arr; + + return $this; + } + + /** + * Additional API documentation. + * + * Generated from protobuf field .google.api.Documentation documentation = 6; + * @return \Google\Api\Documentation + */ + public function getDocumentation() + { + return $this->documentation; + } + + /** + * Additional API documentation. + * + * Generated from protobuf field .google.api.Documentation documentation = 6; + * @param \Google\Api\Documentation $var + * @return $this + */ + public function setDocumentation($var) + { + GPBUtil::checkMessage($var, \Google\Api\Documentation::class); + $this->documentation = $var; + + return $this; + } + + /** + * API backend configuration. + * + * Generated from protobuf field .google.api.Backend backend = 8; + * @return \Google\Api\Backend + */ + public function getBackend() + { + return $this->backend; + } + + /** + * API backend configuration. + * + * Generated from protobuf field .google.api.Backend backend = 8; + * @param \Google\Api\Backend $var + * @return $this + */ + public function setBackend($var) + { + GPBUtil::checkMessage($var, \Google\Api\Backend::class); + $this->backend = $var; + + return $this; + } + + /** + * HTTP configuration. + * + * Generated from protobuf field .google.api.Http http = 9; + * @return \Google\Api\Http + */ + public function getHttp() + { + return $this->http; + } + + /** + * HTTP configuration. + * + * Generated from protobuf field .google.api.Http http = 9; + * @param \Google\Api\Http $var + * @return $this + */ + public function setHttp($var) + { + GPBUtil::checkMessage($var, \Google\Api\Http::class); + $this->http = $var; + + return $this; + } + + /** + * Quota configuration. + * + * Generated from protobuf field .google.api.Quota quota = 10; + * @return \Google\Api\Quota + */ + public function getQuota() + { + return $this->quota; + } + + /** + * Quota configuration. + * + * Generated from protobuf field .google.api.Quota quota = 10; + * @param \Google\Api\Quota $var + * @return $this + */ + public function setQuota($var) + { + GPBUtil::checkMessage($var, \Google\Api\Quota::class); + $this->quota = $var; + + return $this; + } + + /** + * Auth configuration. + * + * Generated from protobuf field .google.api.Authentication authentication = 11; + * @return \Google\Api\Authentication + */ + public function getAuthentication() + { + return $this->authentication; + } + + /** + * Auth configuration. + * + * Generated from protobuf field .google.api.Authentication authentication = 11; + * @param \Google\Api\Authentication $var + * @return $this + */ + public function setAuthentication($var) + { + GPBUtil::checkMessage($var, \Google\Api\Authentication::class); + $this->authentication = $var; + + return $this; + } + + /** + * Context configuration. + * + * Generated from protobuf field .google.api.Context context = 12; + * @return \Google\Api\Context + */ + public function getContext() + { + return $this->context; + } + + /** + * Context configuration. + * + * Generated from protobuf field .google.api.Context context = 12; + * @param \Google\Api\Context $var + * @return $this + */ + public function setContext($var) + { + GPBUtil::checkMessage($var, \Google\Api\Context::class); + $this->context = $var; + + return $this; + } + + /** + * Configuration controlling usage of this service. + * + * Generated from protobuf field .google.api.Usage usage = 15; + * @return \Google\Api\Usage + */ + public function getUsage() + { + return $this->usage; + } + + /** + * Configuration controlling usage of this service. + * + * Generated from protobuf field .google.api.Usage usage = 15; + * @param \Google\Api\Usage $var + * @return $this + */ + public function setUsage($var) + { + GPBUtil::checkMessage($var, \Google\Api\Usage::class); + $this->usage = $var; + + return $this; + } + + /** + * Configuration for network endpoints. If this is empty, then an endpoint + * with the same name as the service is automatically generated to service all + * defined APIs. + * + * Generated from protobuf field repeated .google.api.Endpoint endpoints = 18; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEndpoints() + { + return $this->endpoints; + } + + /** + * Configuration for network endpoints. If this is empty, then an endpoint + * with the same name as the service is automatically generated to service all + * defined APIs. + * + * Generated from protobuf field repeated .google.api.Endpoint endpoints = 18; + * @param \Google\Api\Endpoint[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEndpoints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Endpoint::class); + $this->endpoints = $arr; + + return $this; + } + + /** + * Configuration for the service control plane. + * + * Generated from protobuf field .google.api.Control control = 21; + * @return \Google\Api\Control + */ + public function getControl() + { + return $this->control; + } + + /** + * Configuration for the service control plane. + * + * Generated from protobuf field .google.api.Control control = 21; + * @param \Google\Api\Control $var + * @return $this + */ + public function setControl($var) + { + GPBUtil::checkMessage($var, \Google\Api\Control::class); + $this->control = $var; + + return $this; + } + + /** + * Defines the logs used by this service. + * + * Generated from protobuf field repeated .google.api.LogDescriptor logs = 23; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLogs() + { + return $this->logs; + } + + /** + * Defines the logs used by this service. + * + * Generated from protobuf field repeated .google.api.LogDescriptor logs = 23; + * @param \Google\Api\LogDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLogs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LogDescriptor::class); + $this->logs = $arr; + + return $this; + } + + /** + * Defines the metrics used by this service. + * + * Generated from protobuf field repeated .google.api.MetricDescriptor metrics = 24; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetrics() + { + return $this->metrics; + } + + /** + * Defines the metrics used by this service. + * + * Generated from protobuf field repeated .google.api.MetricDescriptor metrics = 24; + * @param \Google\Api\MetricDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetrics($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MetricDescriptor::class); + $this->metrics = $arr; + + return $this; + } + + /** + * Defines the monitored resources used by this service. This is required + * by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. + * + * Generated from protobuf field repeated .google.api.MonitoredResourceDescriptor monitored_resources = 25; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMonitoredResources() + { + return $this->monitored_resources; + } + + /** + * Defines the monitored resources used by this service. This is required + * by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. + * + * Generated from protobuf field repeated .google.api.MonitoredResourceDescriptor monitored_resources = 25; + * @param \Google\Api\MonitoredResourceDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMonitoredResources($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MonitoredResourceDescriptor::class); + $this->monitored_resources = $arr; + + return $this; + } + + /** + * Billing configuration. + * + * Generated from protobuf field .google.api.Billing billing = 26; + * @return \Google\Api\Billing + */ + public function getBilling() + { + return $this->billing; + } + + /** + * Billing configuration. + * + * Generated from protobuf field .google.api.Billing billing = 26; + * @param \Google\Api\Billing $var + * @return $this + */ + public function setBilling($var) + { + GPBUtil::checkMessage($var, \Google\Api\Billing::class); + $this->billing = $var; + + return $this; + } + + /** + * Logging configuration. + * + * Generated from protobuf field .google.api.Logging logging = 27; + * @return \Google\Api\Logging + */ + public function getLogging() + { + return $this->logging; + } + + /** + * Logging configuration. + * + * Generated from protobuf field .google.api.Logging logging = 27; + * @param \Google\Api\Logging $var + * @return $this + */ + public function setLogging($var) + { + GPBUtil::checkMessage($var, \Google\Api\Logging::class); + $this->logging = $var; + + return $this; + } + + /** + * Monitoring configuration. + * + * Generated from protobuf field .google.api.Monitoring monitoring = 28; + * @return \Google\Api\Monitoring + */ + public function getMonitoring() + { + return $this->monitoring; + } + + /** + * Monitoring configuration. + * + * Generated from protobuf field .google.api.Monitoring monitoring = 28; + * @param \Google\Api\Monitoring $var + * @return $this + */ + public function setMonitoring($var) + { + GPBUtil::checkMessage($var, \Google\Api\Monitoring::class); + $this->monitoring = $var; + + return $this; + } + + /** + * System parameter configuration. + * + * Generated from protobuf field .google.api.SystemParameters system_parameters = 29; + * @return \Google\Api\SystemParameters + */ + public function getSystemParameters() + { + return $this->system_parameters; + } + + /** + * System parameter configuration. + * + * Generated from protobuf field .google.api.SystemParameters system_parameters = 29; + * @param \Google\Api\SystemParameters $var + * @return $this + */ + public function setSystemParameters($var) + { + GPBUtil::checkMessage($var, \Google\Api\SystemParameters::class); + $this->system_parameters = $var; + + return $this; + } + + /** + * Output only. The source information for this configuration if available. + * + * Generated from protobuf field .google.api.SourceInfo source_info = 37; + * @return \Google\Api\SourceInfo + */ + public function getSourceInfo() + { + return $this->source_info; + } + + /** + * Output only. The source information for this configuration if available. + * + * Generated from protobuf field .google.api.SourceInfo source_info = 37; + * @param \Google\Api\SourceInfo $var + * @return $this + */ + public function setSourceInfo($var) + { + GPBUtil::checkMessage($var, \Google\Api\SourceInfo::class); + $this->source_info = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/SourceInfo.php b/vendor/google/common-protos/src/Api/SourceInfo.php new file mode 100644 index 00000000..b06fd4c5 --- /dev/null +++ b/vendor/google/common-protos/src/Api/SourceInfo.php @@ -0,0 +1,67 @@ +google.api.SourceInfo + */ +class SourceInfo extends \Google\Protobuf\Internal\Message +{ + /** + * All files used during config generation. + * + * Generated from protobuf field repeated .google.protobuf.Any source_files = 1; + */ + private $source_files; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $source_files + * All files used during config generation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\SourceInfo::initOnce(); + parent::__construct($data); + } + + /** + * All files used during config generation. + * + * Generated from protobuf field repeated .google.protobuf.Any source_files = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSourceFiles() + { + return $this->source_files; + } + + /** + * All files used during config generation. + * + * Generated from protobuf field repeated .google.protobuf.Any source_files = 1; + * @param \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSourceFiles($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class); + $this->source_files = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/SystemParameter.php b/vendor/google/common-protos/src/Api/SystemParameter.php new file mode 100644 index 00000000..5afbbbca --- /dev/null +++ b/vendor/google/common-protos/src/Api/SystemParameter.php @@ -0,0 +1,145 @@ +google.api.SystemParameter + */ +class SystemParameter extends \Google\Protobuf\Internal\Message +{ + /** + * Define the name of the parameter, such as "api_key" . It is case sensitive. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * Define the HTTP header name to use for the parameter. It is case + * insensitive. + * + * Generated from protobuf field string http_header = 2; + */ + private $http_header = ''; + /** + * Define the URL query parameter name to use for the parameter. It is case + * sensitive. + * + * Generated from protobuf field string url_query_parameter = 3; + */ + private $url_query_parameter = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Define the name of the parameter, such as "api_key" . It is case sensitive. + * @type string $http_header + * Define the HTTP header name to use for the parameter. It is case + * insensitive. + * @type string $url_query_parameter + * Define the URL query parameter name to use for the parameter. It is case + * sensitive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\SystemParameter::initOnce(); + parent::__construct($data); + } + + /** + * Define the name of the parameter, such as "api_key" . It is case sensitive. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Define the name of the parameter, such as "api_key" . It is case sensitive. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Define the HTTP header name to use for the parameter. It is case + * insensitive. + * + * Generated from protobuf field string http_header = 2; + * @return string + */ + public function getHttpHeader() + { + return $this->http_header; + } + + /** + * Define the HTTP header name to use for the parameter. It is case + * insensitive. + * + * Generated from protobuf field string http_header = 2; + * @param string $var + * @return $this + */ + public function setHttpHeader($var) + { + GPBUtil::checkString($var, True); + $this->http_header = $var; + + return $this; + } + + /** + * Define the URL query parameter name to use for the parameter. It is case + * sensitive. + * + * Generated from protobuf field string url_query_parameter = 3; + * @return string + */ + public function getUrlQueryParameter() + { + return $this->url_query_parameter; + } + + /** + * Define the URL query parameter name to use for the parameter. It is case + * sensitive. + * + * Generated from protobuf field string url_query_parameter = 3; + * @param string $var + * @return $this + */ + public function setUrlQueryParameter($var) + { + GPBUtil::checkString($var, True); + $this->url_query_parameter = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/SystemParameterRule.php b/vendor/google/common-protos/src/Api/SystemParameterRule.php new file mode 100644 index 00000000..c19d1f69 --- /dev/null +++ b/vendor/google/common-protos/src/Api/SystemParameterRule.php @@ -0,0 +1,126 @@ +google.api.SystemParameterRule + */ +class SystemParameterRule extends \Google\Protobuf\Internal\Message +{ + /** + * Selects the methods to which this rule applies. Use '*' to indicate all + * methods in all APIs. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + */ + private $selector = ''; + /** + * Define parameters. Multiple names may be defined for a parameter. + * For a given method call, only one of them should be used. If multiple + * names are used the behavior is implementation-dependent. + * If none of the specified names are present the behavior is + * parameter-dependent. + * + * Generated from protobuf field repeated .google.api.SystemParameter parameters = 2; + */ + private $parameters; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $selector + * Selects the methods to which this rule applies. Use '*' to indicate all + * methods in all APIs. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * @type \Google\Api\SystemParameter[]|\Google\Protobuf\Internal\RepeatedField $parameters + * Define parameters. Multiple names may be defined for a parameter. + * For a given method call, only one of them should be used. If multiple + * names are used the behavior is implementation-dependent. + * If none of the specified names are present the behavior is + * parameter-dependent. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\SystemParameter::initOnce(); + parent::__construct($data); + } + + /** + * Selects the methods to which this rule applies. Use '*' to indicate all + * methods in all APIs. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @return string + */ + public function getSelector() + { + return $this->selector; + } + + /** + * Selects the methods to which this rule applies. Use '*' to indicate all + * methods in all APIs. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @param string $var + * @return $this + */ + public function setSelector($var) + { + GPBUtil::checkString($var, True); + $this->selector = $var; + + return $this; + } + + /** + * Define parameters. Multiple names may be defined for a parameter. + * For a given method call, only one of them should be used. If multiple + * names are used the behavior is implementation-dependent. + * If none of the specified names are present the behavior is + * parameter-dependent. + * + * Generated from protobuf field repeated .google.api.SystemParameter parameters = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * Define parameters. Multiple names may be defined for a parameter. + * For a given method call, only one of them should be used. If multiple + * names are used the behavior is implementation-dependent. + * If none of the specified names are present the behavior is + * parameter-dependent. + * + * Generated from protobuf field repeated .google.api.SystemParameter parameters = 2; + * @param \Google\Api\SystemParameter[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParameters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\SystemParameter::class); + $this->parameters = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/SystemParameters.php b/vendor/google/common-protos/src/Api/SystemParameters.php new file mode 100644 index 00000000..a365c585 --- /dev/null +++ b/vendor/google/common-protos/src/Api/SystemParameters.php @@ -0,0 +1,155 @@ +google.api.SystemParameters + */ +class SystemParameters extends \Google\Protobuf\Internal\Message +{ + /** + * Define system parameters. + * The parameters defined here will override the default parameters + * implemented by the system. If this field is missing from the service + * config, default system parameters will be used. Default system parameters + * and names is implementation-dependent. + * Example: define api key for all methods + * system_parameters + * rules: + * - selector: "*" + * parameters: + * - name: api_key + * url_query_parameter: api_key + * Example: define 2 api key names for a specific method. + * system_parameters + * rules: + * - selector: "/ListShelves" + * parameters: + * - name: api_key + * http_header: Api-Key1 + * - name: api_key + * http_header: Api-Key2 + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.SystemParameterRule rules = 1; + */ + private $rules; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\SystemParameterRule[]|\Google\Protobuf\Internal\RepeatedField $rules + * Define system parameters. + * The parameters defined here will override the default parameters + * implemented by the system. If this field is missing from the service + * config, default system parameters will be used. Default system parameters + * and names is implementation-dependent. + * Example: define api key for all methods + * system_parameters + * rules: + * - selector: "*" + * parameters: + * - name: api_key + * url_query_parameter: api_key + * Example: define 2 api key names for a specific method. + * system_parameters + * rules: + * - selector: "/ListShelves" + * parameters: + * - name: api_key + * http_header: Api-Key1 + * - name: api_key + * http_header: Api-Key2 + * **NOTE:** All service configuration rules follow "last one wins" order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\SystemParameter::initOnce(); + parent::__construct($data); + } + + /** + * Define system parameters. + * The parameters defined here will override the default parameters + * implemented by the system. If this field is missing from the service + * config, default system parameters will be used. Default system parameters + * and names is implementation-dependent. + * Example: define api key for all methods + * system_parameters + * rules: + * - selector: "*" + * parameters: + * - name: api_key + * url_query_parameter: api_key + * Example: define 2 api key names for a specific method. + * system_parameters + * rules: + * - selector: "/ListShelves" + * parameters: + * - name: api_key + * http_header: Api-Key1 + * - name: api_key + * http_header: Api-Key2 + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.SystemParameterRule rules = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * Define system parameters. + * The parameters defined here will override the default parameters + * implemented by the system. If this field is missing from the service + * config, default system parameters will be used. Default system parameters + * and names is implementation-dependent. + * Example: define api key for all methods + * system_parameters + * rules: + * - selector: "*" + * parameters: + * - name: api_key + * url_query_parameter: api_key + * Example: define 2 api key names for a specific method. + * system_parameters + * rules: + * - selector: "/ListShelves" + * parameters: + * - name: api_key + * http_header: Api-Key1 + * - name: api_key + * http_header: Api-Key2 + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.SystemParameterRule rules = 1; + * @param \Google\Api\SystemParameterRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\SystemParameterRule::class); + $this->rules = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/Usage.php b/vendor/google/common-protos/src/Api/Usage.php new file mode 100644 index 00000000..5e12ddfc --- /dev/null +++ b/vendor/google/common-protos/src/Api/Usage.php @@ -0,0 +1,171 @@ +google.api.Usage + */ +class Usage extends \Google\Protobuf\Internal\Message +{ + /** + * Requirements that must be satisfied before a consumer project can use the + * service. Each requirement is of the form /; + * for example 'serviceusage.googleapis.com/billing-enabled'. + * + * Generated from protobuf field repeated string requirements = 1; + */ + private $requirements; + /** + * A list of usage rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.UsageRule rules = 6; + */ + private $rules; + /** + * The full resource name of a channel used for sending notifications to the + * service producer. + * Google Service Management currently only supports + * [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification + * channel. To use Google Cloud Pub/Sub as the channel, this must be the name + * of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format + * documented in https://cloud.google.com/pubsub/docs/overview. + * + * Generated from protobuf field string producer_notification_channel = 7; + */ + private $producer_notification_channel = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string[]|\Google\Protobuf\Internal\RepeatedField $requirements + * Requirements that must be satisfied before a consumer project can use the + * service. Each requirement is of the form /; + * for example 'serviceusage.googleapis.com/billing-enabled'. + * @type \Google\Api\UsageRule[]|\Google\Protobuf\Internal\RepeatedField $rules + * A list of usage rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * @type string $producer_notification_channel + * The full resource name of a channel used for sending notifications to the + * service producer. + * Google Service Management currently only supports + * [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification + * channel. To use Google Cloud Pub/Sub as the channel, this must be the name + * of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format + * documented in https://cloud.google.com/pubsub/docs/overview. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Usage::initOnce(); + parent::__construct($data); + } + + /** + * Requirements that must be satisfied before a consumer project can use the + * service. Each requirement is of the form /; + * for example 'serviceusage.googleapis.com/billing-enabled'. + * + * Generated from protobuf field repeated string requirements = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequirements() + { + return $this->requirements; + } + + /** + * Requirements that must be satisfied before a consumer project can use the + * service. Each requirement is of the form /; + * for example 'serviceusage.googleapis.com/billing-enabled'. + * + * Generated from protobuf field repeated string requirements = 1; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequirements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->requirements = $arr; + + return $this; + } + + /** + * A list of usage rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.UsageRule rules = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * A list of usage rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.UsageRule rules = 6; + * @param \Google\Api\UsageRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\UsageRule::class); + $this->rules = $arr; + + return $this; + } + + /** + * The full resource name of a channel used for sending notifications to the + * service producer. + * Google Service Management currently only supports + * [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification + * channel. To use Google Cloud Pub/Sub as the channel, this must be the name + * of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format + * documented in https://cloud.google.com/pubsub/docs/overview. + * + * Generated from protobuf field string producer_notification_channel = 7; + * @return string + */ + public function getProducerNotificationChannel() + { + return $this->producer_notification_channel; + } + + /** + * The full resource name of a channel used for sending notifications to the + * service producer. + * Google Service Management currently only supports + * [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification + * channel. To use Google Cloud Pub/Sub as the channel, this must be the name + * of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format + * documented in https://cloud.google.com/pubsub/docs/overview. + * + * Generated from protobuf field string producer_notification_channel = 7; + * @param string $var + * @return $this + */ + public function setProducerNotificationChannel($var) + { + GPBUtil::checkString($var, True); + $this->producer_notification_channel = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Api/UsageRule.php b/vendor/google/common-protos/src/Api/UsageRule.php new file mode 100644 index 00000000..ffc0fcd2 --- /dev/null +++ b/vendor/google/common-protos/src/Api/UsageRule.php @@ -0,0 +1,176 @@ +google.api.UsageRule + */ +class UsageRule extends \Google\Protobuf\Internal\Message +{ + /** + * Selects the methods to which this rule applies. Use '*' to indicate all + * methods in all APIs. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + */ + private $selector = ''; + /** + * If true, the selected method allows unregistered calls, e.g. calls + * that don't identify any user or application. + * + * Generated from protobuf field bool allow_unregistered_calls = 2; + */ + private $allow_unregistered_calls = false; + /** + * If true, the selected method should skip service control and the control + * plane features, such as quota and billing, will not be available. + * This flag is used by Google Cloud Endpoints to bypass checks for internal + * methods, such as service health check methods. + * + * Generated from protobuf field bool skip_service_control = 3; + */ + private $skip_service_control = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $selector + * Selects the methods to which this rule applies. Use '*' to indicate all + * methods in all APIs. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * @type bool $allow_unregistered_calls + * If true, the selected method allows unregistered calls, e.g. calls + * that don't identify any user or application. + * @type bool $skip_service_control + * If true, the selected method should skip service control and the control + * plane features, such as quota and billing, will not be available. + * This flag is used by Google Cloud Endpoints to bypass checks for internal + * methods, such as service health check methods. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Usage::initOnce(); + parent::__construct($data); + } + + /** + * Selects the methods to which this rule applies. Use '*' to indicate all + * methods in all APIs. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @return string + */ + public function getSelector() + { + return $this->selector; + } + + /** + * Selects the methods to which this rule applies. Use '*' to indicate all + * methods in all APIs. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @param string $var + * @return $this + */ + public function setSelector($var) + { + GPBUtil::checkString($var, True); + $this->selector = $var; + + return $this; + } + + /** + * If true, the selected method allows unregistered calls, e.g. calls + * that don't identify any user or application. + * + * Generated from protobuf field bool allow_unregistered_calls = 2; + * @return bool + */ + public function getAllowUnregisteredCalls() + { + return $this->allow_unregistered_calls; + } + + /** + * If true, the selected method allows unregistered calls, e.g. calls + * that don't identify any user or application. + * + * Generated from protobuf field bool allow_unregistered_calls = 2; + * @param bool $var + * @return $this + */ + public function setAllowUnregisteredCalls($var) + { + GPBUtil::checkBool($var); + $this->allow_unregistered_calls = $var; + + return $this; + } + + /** + * If true, the selected method should skip service control and the control + * plane features, such as quota and billing, will not be available. + * This flag is used by Google Cloud Endpoints to bypass checks for internal + * methods, such as service health check methods. + * + * Generated from protobuf field bool skip_service_control = 3; + * @return bool + */ + public function getSkipServiceControl() + { + return $this->skip_service_control; + } + + /** + * If true, the selected method should skip service control and the control + * plane features, such as quota and billing, will not be available. + * This flag is used by Google Cloud Endpoints to bypass checks for internal + * methods, such as service health check methods. + * + * Generated from protobuf field bool skip_service_control = 3; + * @param bool $var + * @return $this + */ + public function setSkipServiceControl($var) + { + GPBUtil::checkBool($var); + $this->skip_service_control = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Cloud/Iam/V1/AuditConfigDelta.php b/vendor/google/common-protos/src/Cloud/Iam/V1/AuditConfigDelta.php new file mode 100644 index 00000000..87d82f4b --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Iam/V1/AuditConfigDelta.php @@ -0,0 +1,202 @@ +google.iam.v1.AuditConfigDelta + */ +class AuditConfigDelta extends \Google\Protobuf\Internal\Message +{ + /** + * The action that was performed on an audit configuration in a policy. + * Required + * + * Generated from protobuf field .google.iam.v1.AuditConfigDelta.Action action = 1; + */ + private $action = 0; + /** + * Specifies a service that was configured for Cloud Audit Logging. + * For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + * `allServices` is a special value that covers all services. + * Required + * + * Generated from protobuf field string service = 2; + */ + private $service = ''; + /** + * A single identity that is exempted from "data access" audit + * logging for the `service` specified above. + * Follows the same format of Binding.members. + * + * Generated from protobuf field string exempted_member = 3; + */ + private $exempted_member = ''; + /** + * Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always + * enabled, and cannot be configured. + * Required + * + * Generated from protobuf field string log_type = 4; + */ + private $log_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $action + * The action that was performed on an audit configuration in a policy. + * Required + * @type string $service + * Specifies a service that was configured for Cloud Audit Logging. + * For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + * `allServices` is a special value that covers all services. + * Required + * @type string $exempted_member + * A single identity that is exempted from "data access" audit + * logging for the `service` specified above. + * Follows the same format of Binding.members. + * @type string $log_type + * Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always + * enabled, and cannot be configured. + * Required + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V1\Policy::initOnce(); + parent::__construct($data); + } + + /** + * The action that was performed on an audit configuration in a policy. + * Required + * + * Generated from protobuf field .google.iam.v1.AuditConfigDelta.Action action = 1; + * @return int + */ + public function getAction() + { + return $this->action; + } + + /** + * The action that was performed on an audit configuration in a policy. + * Required + * + * Generated from protobuf field .google.iam.v1.AuditConfigDelta.Action action = 1; + * @param int $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Iam\V1\AuditConfigDelta_Action::class); + $this->action = $var; + + return $this; + } + + /** + * Specifies a service that was configured for Cloud Audit Logging. + * For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + * `allServices` is a special value that covers all services. + * Required + * + * Generated from protobuf field string service = 2; + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Specifies a service that was configured for Cloud Audit Logging. + * For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + * `allServices` is a special value that covers all services. + * Required + * + * Generated from protobuf field string service = 2; + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * A single identity that is exempted from "data access" audit + * logging for the `service` specified above. + * Follows the same format of Binding.members. + * + * Generated from protobuf field string exempted_member = 3; + * @return string + */ + public function getExemptedMember() + { + return $this->exempted_member; + } + + /** + * A single identity that is exempted from "data access" audit + * logging for the `service` specified above. + * Follows the same format of Binding.members. + * + * Generated from protobuf field string exempted_member = 3; + * @param string $var + * @return $this + */ + public function setExemptedMember($var) + { + GPBUtil::checkString($var, True); + $this->exempted_member = $var; + + return $this; + } + + /** + * Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always + * enabled, and cannot be configured. + * Required + * + * Generated from protobuf field string log_type = 4; + * @return string + */ + public function getLogType() + { + return $this->log_type; + } + + /** + * Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always + * enabled, and cannot be configured. + * Required + * + * Generated from protobuf field string log_type = 4; + * @param string $var + * @return $this + */ + public function setLogType($var) + { + GPBUtil::checkString($var, True); + $this->log_type = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Cloud/Iam/V1/AuditConfigDelta/Action.php b/vendor/google/common-protos/src/Cloud/Iam/V1/AuditConfigDelta/Action.php new file mode 100644 index 00000000..4a11d054 --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Iam/V1/AuditConfigDelta/Action.php @@ -0,0 +1,64 @@ +google.iam.v1.AuditConfigDelta.Action + */ +class Action +{ + /** + * Unspecified. + * + * Generated from protobuf enum ACTION_UNSPECIFIED = 0; + */ + const ACTION_UNSPECIFIED = 0; + /** + * Addition of an audit configuration. + * + * Generated from protobuf enum ADD = 1; + */ + const ADD = 1; + /** + * Removal of an audit configuration. + * + * Generated from protobuf enum REMOVE = 2; + */ + const REMOVE = 2; + + private static $valueToName = [ + self::ACTION_UNSPECIFIED => 'ACTION_UNSPECIFIED', + self::ADD => 'ADD', + self::REMOVE => 'REMOVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Action::class, \Google\Cloud\Iam\V1\AuditConfigDelta_Action::class); + diff --git a/vendor/google/common-protos/src/Cloud/Iam/V1/AuditConfigDelta_Action.php b/vendor/google/common-protos/src/Cloud/Iam/V1/AuditConfigDelta_Action.php new file mode 100644 index 00000000..9682fb1c --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Iam/V1/AuditConfigDelta_Action.php @@ -0,0 +1,16 @@ +google.iam.v1.Binding + */ +class Binding extends \Google\Protobuf\Internal\Message +{ + /** + * Role that is assigned to `members`. + * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + * + * Generated from protobuf field string role = 1; + */ + private $role = ''; + /** + * Specifies the identities requesting access for a Cloud Platform resource. + * `members` can have the following values: + * * `allUsers`: A special identifier that represents anyone who is + * on the internet; with or without a Google account. + * * `allAuthenticatedUsers`: A special identifier that represents anyone + * who is authenticated with a Google account or a service account. + * * `user:{emailid}`: An email address that represents a specific Google + * account. For example, `alice@example.com` . + * * `serviceAccount:{emailid}`: An email address that represents a service + * account. For example, `my-other-app@appspot.gserviceaccount.com`. + * * `group:{emailid}`: An email address that represents a Google group. + * For example, `admins@example.com`. + * * `domain:{domain}`: The G Suite domain (primary) that represents all the + * users of that domain. For example, `google.com` or `example.com`. + * + * Generated from protobuf field repeated string members = 2; + */ + private $members; + /** + * The condition that is associated with this binding. + * NOTE: An unsatisfied condition will not allow user access via current + * binding. Different bindings, including their conditions, are examined + * independently. + * + * Generated from protobuf field .google.type.Expr condition = 3; + */ + private $condition = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $role + * Role that is assigned to `members`. + * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $members + * Specifies the identities requesting access for a Cloud Platform resource. + * `members` can have the following values: + * * `allUsers`: A special identifier that represents anyone who is + * on the internet; with or without a Google account. + * * `allAuthenticatedUsers`: A special identifier that represents anyone + * who is authenticated with a Google account or a service account. + * * `user:{emailid}`: An email address that represents a specific Google + * account. For example, `alice@example.com` . + * * `serviceAccount:{emailid}`: An email address that represents a service + * account. For example, `my-other-app@appspot.gserviceaccount.com`. + * * `group:{emailid}`: An email address that represents a Google group. + * For example, `admins@example.com`. + * * `domain:{domain}`: The G Suite domain (primary) that represents all the + * users of that domain. For example, `google.com` or `example.com`. + * @type \Google\Type\Expr $condition + * The condition that is associated with this binding. + * NOTE: An unsatisfied condition will not allow user access via current + * binding. Different bindings, including their conditions, are examined + * independently. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V1\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Role that is assigned to `members`. + * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + * + * Generated from protobuf field string role = 1; + * @return string + */ + public function getRole() + { + return $this->role; + } + + /** + * Role that is assigned to `members`. + * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + * + * Generated from protobuf field string role = 1; + * @param string $var + * @return $this + */ + public function setRole($var) + { + GPBUtil::checkString($var, True); + $this->role = $var; + + return $this; + } + + /** + * Specifies the identities requesting access for a Cloud Platform resource. + * `members` can have the following values: + * * `allUsers`: A special identifier that represents anyone who is + * on the internet; with or without a Google account. + * * `allAuthenticatedUsers`: A special identifier that represents anyone + * who is authenticated with a Google account or a service account. + * * `user:{emailid}`: An email address that represents a specific Google + * account. For example, `alice@example.com` . + * * `serviceAccount:{emailid}`: An email address that represents a service + * account. For example, `my-other-app@appspot.gserviceaccount.com`. + * * `group:{emailid}`: An email address that represents a Google group. + * For example, `admins@example.com`. + * * `domain:{domain}`: The G Suite domain (primary) that represents all the + * users of that domain. For example, `google.com` or `example.com`. + * + * Generated from protobuf field repeated string members = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMembers() + { + return $this->members; + } + + /** + * Specifies the identities requesting access for a Cloud Platform resource. + * `members` can have the following values: + * * `allUsers`: A special identifier that represents anyone who is + * on the internet; with or without a Google account. + * * `allAuthenticatedUsers`: A special identifier that represents anyone + * who is authenticated with a Google account or a service account. + * * `user:{emailid}`: An email address that represents a specific Google + * account. For example, `alice@example.com` . + * * `serviceAccount:{emailid}`: An email address that represents a service + * account. For example, `my-other-app@appspot.gserviceaccount.com`. + * * `group:{emailid}`: An email address that represents a Google group. + * For example, `admins@example.com`. + * * `domain:{domain}`: The G Suite domain (primary) that represents all the + * users of that domain. For example, `google.com` or `example.com`. + * + * Generated from protobuf field repeated string members = 2; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMembers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->members = $arr; + + return $this; + } + + /** + * The condition that is associated with this binding. + * NOTE: An unsatisfied condition will not allow user access via current + * binding. Different bindings, including their conditions, are examined + * independently. + * + * Generated from protobuf field .google.type.Expr condition = 3; + * @return \Google\Type\Expr + */ + public function getCondition() + { + return $this->condition; + } + + /** + * The condition that is associated with this binding. + * NOTE: An unsatisfied condition will not allow user access via current + * binding. Different bindings, including their conditions, are examined + * independently. + * + * Generated from protobuf field .google.type.Expr condition = 3; + * @param \Google\Type\Expr $var + * @return $this + */ + public function setCondition($var) + { + GPBUtil::checkMessage($var, \Google\Type\Expr::class); + $this->condition = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Cloud/Iam/V1/BindingDelta.php b/vendor/google/common-protos/src/Cloud/Iam/V1/BindingDelta.php new file mode 100644 index 00000000..8a7aff46 --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Iam/V1/BindingDelta.php @@ -0,0 +1,190 @@ +google.iam.v1.BindingDelta + */ +class BindingDelta extends \Google\Protobuf\Internal\Message +{ + /** + * The action that was performed on a Binding. + * Required + * + * Generated from protobuf field .google.iam.v1.BindingDelta.Action action = 1; + */ + private $action = 0; + /** + * Role that is assigned to `members`. + * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + * Required + * + * Generated from protobuf field string role = 2; + */ + private $role = ''; + /** + * A single identity requesting access for a Cloud Platform resource. + * Follows the same format of Binding.members. + * Required + * + * Generated from protobuf field string member = 3; + */ + private $member = ''; + /** + * The condition that is associated with this binding. + * + * Generated from protobuf field .google.type.Expr condition = 4; + */ + private $condition = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $action + * The action that was performed on a Binding. + * Required + * @type string $role + * Role that is assigned to `members`. + * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + * Required + * @type string $member + * A single identity requesting access for a Cloud Platform resource. + * Follows the same format of Binding.members. + * Required + * @type \Google\Type\Expr $condition + * The condition that is associated with this binding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V1\Policy::initOnce(); + parent::__construct($data); + } + + /** + * The action that was performed on a Binding. + * Required + * + * Generated from protobuf field .google.iam.v1.BindingDelta.Action action = 1; + * @return int + */ + public function getAction() + { + return $this->action; + } + + /** + * The action that was performed on a Binding. + * Required + * + * Generated from protobuf field .google.iam.v1.BindingDelta.Action action = 1; + * @param int $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Iam\V1\BindingDelta_Action::class); + $this->action = $var; + + return $this; + } + + /** + * Role that is assigned to `members`. + * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + * Required + * + * Generated from protobuf field string role = 2; + * @return string + */ + public function getRole() + { + return $this->role; + } + + /** + * Role that is assigned to `members`. + * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + * Required + * + * Generated from protobuf field string role = 2; + * @param string $var + * @return $this + */ + public function setRole($var) + { + GPBUtil::checkString($var, True); + $this->role = $var; + + return $this; + } + + /** + * A single identity requesting access for a Cloud Platform resource. + * Follows the same format of Binding.members. + * Required + * + * Generated from protobuf field string member = 3; + * @return string + */ + public function getMember() + { + return $this->member; + } + + /** + * A single identity requesting access for a Cloud Platform resource. + * Follows the same format of Binding.members. + * Required + * + * Generated from protobuf field string member = 3; + * @param string $var + * @return $this + */ + public function setMember($var) + { + GPBUtil::checkString($var, True); + $this->member = $var; + + return $this; + } + + /** + * The condition that is associated with this binding. + * + * Generated from protobuf field .google.type.Expr condition = 4; + * @return \Google\Type\Expr + */ + public function getCondition() + { + return $this->condition; + } + + /** + * The condition that is associated with this binding. + * + * Generated from protobuf field .google.type.Expr condition = 4; + * @param \Google\Type\Expr $var + * @return $this + */ + public function setCondition($var) + { + GPBUtil::checkMessage($var, \Google\Type\Expr::class); + $this->condition = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Cloud/Iam/V1/BindingDelta/Action.php b/vendor/google/common-protos/src/Cloud/Iam/V1/BindingDelta/Action.php new file mode 100644 index 00000000..356a36b5 --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Iam/V1/BindingDelta/Action.php @@ -0,0 +1,64 @@ +google.iam.v1.BindingDelta.Action + */ +class Action +{ + /** + * Unspecified. + * + * Generated from protobuf enum ACTION_UNSPECIFIED = 0; + */ + const ACTION_UNSPECIFIED = 0; + /** + * Addition of a Binding. + * + * Generated from protobuf enum ADD = 1; + */ + const ADD = 1; + /** + * Removal of a Binding. + * + * Generated from protobuf enum REMOVE = 2; + */ + const REMOVE = 2; + + private static $valueToName = [ + self::ACTION_UNSPECIFIED => 'ACTION_UNSPECIFIED', + self::ADD => 'ADD', + self::REMOVE => 'REMOVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Action::class, \Google\Cloud\Iam\V1\BindingDelta_Action::class); + diff --git a/vendor/google/common-protos/src/Cloud/Iam/V1/BindingDelta_Action.php b/vendor/google/common-protos/src/Cloud/Iam/V1/BindingDelta_Action.php new file mode 100644 index 00000000..16f4e785 --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Iam/V1/BindingDelta_Action.php @@ -0,0 +1,16 @@ +google.iam.v1.GetIamPolicyRequest + */ +class GetIamPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $resource = ''; + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * Generated from protobuf field .google.iam.v1.GetPolicyOptions options = 2; + */ + private $options = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @type \Google\Cloud\Iam\V1\GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V1\IamPolicy::initOnce(); + parent::__construct($data); + } + + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * Generated from protobuf field .google.iam.v1.GetPolicyOptions options = 2; + * @return \Google\Cloud\Iam\V1\GetPolicyOptions + */ + public function getOptions() + { + return $this->options; + } + + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * Generated from protobuf field .google.iam.v1.GetPolicyOptions options = 2; + * @param \Google\Cloud\Iam\V1\GetPolicyOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Iam\V1\GetPolicyOptions::class); + $this->options = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Cloud/Iam/V1/GetPolicyOptions.php b/vendor/google/common-protos/src/Cloud/Iam/V1/GetPolicyOptions.php new file mode 100644 index 00000000..6c785509 --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Iam/V1/GetPolicyOptions.php @@ -0,0 +1,87 @@ +google.iam.v1.GetPolicyOptions + */ +class GetPolicyOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The policy format version to be returned. + * Valid values are 0, 1, and 3. Requests specifying an invalid value will be + * rejected. + * Requests for policies with any conditional bindings must specify version 3. + * Policies without any conditional bindings may specify any valid value or + * leave the field unset. + * + * Generated from protobuf field int32 requested_policy_version = 1; + */ + private $requested_policy_version = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $requested_policy_version + * Optional. The policy format version to be returned. + * Valid values are 0, 1, and 3. Requests specifying an invalid value will be + * rejected. + * Requests for policies with any conditional bindings must specify version 3. + * Policies without any conditional bindings may specify any valid value or + * leave the field unset. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V1\Options::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The policy format version to be returned. + * Valid values are 0, 1, and 3. Requests specifying an invalid value will be + * rejected. + * Requests for policies with any conditional bindings must specify version 3. + * Policies without any conditional bindings may specify any valid value or + * leave the field unset. + * + * Generated from protobuf field int32 requested_policy_version = 1; + * @return int + */ + public function getRequestedPolicyVersion() + { + return $this->requested_policy_version; + } + + /** + * Optional. The policy format version to be returned. + * Valid values are 0, 1, and 3. Requests specifying an invalid value will be + * rejected. + * Requests for policies with any conditional bindings must specify version 3. + * Policies without any conditional bindings may specify any valid value or + * leave the field unset. + * + * Generated from protobuf field int32 requested_policy_version = 1; + * @param int $var + * @return $this + */ + public function setRequestedPolicyVersion($var) + { + GPBUtil::checkInt32($var); + $this->requested_policy_version = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Cloud/Iam/V1/Policy.php b/vendor/google/common-protos/src/Cloud/Iam/V1/Policy.php new file mode 100644 index 00000000..eda72e4b --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Iam/V1/Policy.php @@ -0,0 +1,272 @@ +google.iam.v1.Policy + */ +class Policy extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies the format of the policy. + * Valid values are 0, 1, and 3. Requests specifying an invalid value will be + * rejected. + * Operations affecting conditional bindings must specify version 3. This can + * be either setting a conditional policy, modifying a conditional binding, + * or removing a binding (conditional or unconditional) from the stored + * conditional policy. + * Operations on non-conditional policies may specify any valid value or + * leave the field unset. + * If no etag is provided in the call to `setIamPolicy`, version compliance + * checks against the stored policy is skipped. + * + * Generated from protobuf field int32 version = 1; + */ + private $version = 0; + /** + * Associates a list of `members` to a `role`. Optionally may specify a + * `condition` that determines when binding is in effect. + * `bindings` with no members will result in an error. + * + * Generated from protobuf field repeated .google.iam.v1.Binding bindings = 4; + */ + private $bindings; + /** + * `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a policy from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform policy updates in order to avoid race + * conditions: An `etag` is returned in the response to `getIamPolicy`, and + * systems are expected to put that etag in the request to `setIamPolicy` to + * ensure that their change will be applied to the same version of the policy. + * If no `etag` is provided in the call to `setIamPolicy`, then the existing + * policy is overwritten. Due to blind-set semantics of an etag-less policy, + * 'setIamPolicy' will not fail even if the incoming policy version does not + * meet the requirements for modifying the stored policy. + * + * Generated from protobuf field bytes etag = 3; + */ + private $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $version + * Specifies the format of the policy. + * Valid values are 0, 1, and 3. Requests specifying an invalid value will be + * rejected. + * Operations affecting conditional bindings must specify version 3. This can + * be either setting a conditional policy, modifying a conditional binding, + * or removing a binding (conditional or unconditional) from the stored + * conditional policy. + * Operations on non-conditional policies may specify any valid value or + * leave the field unset. + * If no etag is provided in the call to `setIamPolicy`, version compliance + * checks against the stored policy is skipped. + * @type \Google\Cloud\Iam\V1\Binding[]|\Google\Protobuf\Internal\RepeatedField $bindings + * Associates a list of `members` to a `role`. Optionally may specify a + * `condition` that determines when binding is in effect. + * `bindings` with no members will result in an error. + * @type string $etag + * `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a policy from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform policy updates in order to avoid race + * conditions: An `etag` is returned in the response to `getIamPolicy`, and + * systems are expected to put that etag in the request to `setIamPolicy` to + * ensure that their change will be applied to the same version of the policy. + * If no `etag` is provided in the call to `setIamPolicy`, then the existing + * policy is overwritten. Due to blind-set semantics of an etag-less policy, + * 'setIamPolicy' will not fail even if the incoming policy version does not + * meet the requirements for modifying the stored policy. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V1\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Specifies the format of the policy. + * Valid values are 0, 1, and 3. Requests specifying an invalid value will be + * rejected. + * Operations affecting conditional bindings must specify version 3. This can + * be either setting a conditional policy, modifying a conditional binding, + * or removing a binding (conditional or unconditional) from the stored + * conditional policy. + * Operations on non-conditional policies may specify any valid value or + * leave the field unset. + * If no etag is provided in the call to `setIamPolicy`, version compliance + * checks against the stored policy is skipped. + * + * Generated from protobuf field int32 version = 1; + * @return int + */ + public function getVersion() + { + return $this->version; + } + + /** + * Specifies the format of the policy. + * Valid values are 0, 1, and 3. Requests specifying an invalid value will be + * rejected. + * Operations affecting conditional bindings must specify version 3. This can + * be either setting a conditional policy, modifying a conditional binding, + * or removing a binding (conditional or unconditional) from the stored + * conditional policy. + * Operations on non-conditional policies may specify any valid value or + * leave the field unset. + * If no etag is provided in the call to `setIamPolicy`, version compliance + * checks against the stored policy is skipped. + * + * Generated from protobuf field int32 version = 1; + * @param int $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkInt32($var); + $this->version = $var; + + return $this; + } + + /** + * Associates a list of `members` to a `role`. Optionally may specify a + * `condition` that determines when binding is in effect. + * `bindings` with no members will result in an error. + * + * Generated from protobuf field repeated .google.iam.v1.Binding bindings = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBindings() + { + return $this->bindings; + } + + /** + * Associates a list of `members` to a `role`. Optionally may specify a + * `condition` that determines when binding is in effect. + * `bindings` with no members will result in an error. + * + * Generated from protobuf field repeated .google.iam.v1.Binding bindings = 4; + * @param \Google\Cloud\Iam\V1\Binding[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBindings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Iam\V1\Binding::class); + $this->bindings = $arr; + + return $this; + } + + /** + * `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a policy from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform policy updates in order to avoid race + * conditions: An `etag` is returned in the response to `getIamPolicy`, and + * systems are expected to put that etag in the request to `setIamPolicy` to + * ensure that their change will be applied to the same version of the policy. + * If no `etag` is provided in the call to `setIamPolicy`, then the existing + * policy is overwritten. Due to blind-set semantics of an etag-less policy, + * 'setIamPolicy' will not fail even if the incoming policy version does not + * meet the requirements for modifying the stored policy. + * + * Generated from protobuf field bytes etag = 3; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * `etag` is used for optimistic concurrency control as a way to help + * prevent simultaneous updates of a policy from overwriting each other. + * It is strongly suggested that systems make use of the `etag` in the + * read-modify-write cycle to perform policy updates in order to avoid race + * conditions: An `etag` is returned in the response to `getIamPolicy`, and + * systems are expected to put that etag in the request to `setIamPolicy` to + * ensure that their change will be applied to the same version of the policy. + * If no `etag` is provided in the call to `setIamPolicy`, then the existing + * policy is overwritten. Due to blind-set semantics of an etag-less policy, + * 'setIamPolicy' will not fail even if the incoming policy version does not + * meet the requirements for modifying the stored policy. + * + * Generated from protobuf field bytes etag = 3; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, False); + $this->etag = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Cloud/Iam/V1/PolicyDelta.php b/vendor/google/common-protos/src/Cloud/Iam/V1/PolicyDelta.php new file mode 100644 index 00000000..7cc2e416 --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Iam/V1/PolicyDelta.php @@ -0,0 +1,101 @@ +google.iam.v1.PolicyDelta + */ +class PolicyDelta extends \Google\Protobuf\Internal\Message +{ + /** + * The delta for Bindings between two policies. + * + * Generated from protobuf field repeated .google.iam.v1.BindingDelta binding_deltas = 1; + */ + private $binding_deltas; + /** + * The delta for AuditConfigs between two policies. + * + * Generated from protobuf field repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2; + */ + private $audit_config_deltas; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Iam\V1\BindingDelta[]|\Google\Protobuf\Internal\RepeatedField $binding_deltas + * The delta for Bindings between two policies. + * @type \Google\Cloud\Iam\V1\AuditConfigDelta[]|\Google\Protobuf\Internal\RepeatedField $audit_config_deltas + * The delta for AuditConfigs between two policies. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V1\Policy::initOnce(); + parent::__construct($data); + } + + /** + * The delta for Bindings between two policies. + * + * Generated from protobuf field repeated .google.iam.v1.BindingDelta binding_deltas = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBindingDeltas() + { + return $this->binding_deltas; + } + + /** + * The delta for Bindings between two policies. + * + * Generated from protobuf field repeated .google.iam.v1.BindingDelta binding_deltas = 1; + * @param \Google\Cloud\Iam\V1\BindingDelta[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBindingDeltas($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Iam\V1\BindingDelta::class); + $this->binding_deltas = $arr; + + return $this; + } + + /** + * The delta for AuditConfigs between two policies. + * + * Generated from protobuf field repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAuditConfigDeltas() + { + return $this->audit_config_deltas; + } + + /** + * The delta for AuditConfigs between two policies. + * + * Generated from protobuf field repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2; + * @param \Google\Cloud\Iam\V1\AuditConfigDelta[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAuditConfigDeltas($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Iam\V1\AuditConfigDelta::class); + $this->audit_config_deltas = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Cloud/Iam/V1/SetIamPolicyRequest.php b/vendor/google/common-protos/src/Cloud/Iam/V1/SetIamPolicyRequest.php new file mode 100644 index 00000000..2c0d5055 --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Iam/V1/SetIamPolicyRequest.php @@ -0,0 +1,117 @@ +google.iam.v1.SetIamPolicyRequest + */ +class SetIamPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $resource = ''; + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * + * Generated from protobuf field .google.iam.v1.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $policy = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @type \Google\Cloud\Iam\V1\Policy $policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V1\IamPolicy::initOnce(); + parent::__construct($data); + } + + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * + * Generated from protobuf field .google.iam.v1.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Iam\V1\Policy + */ + public function getPolicy() + { + return $this->policy; + } + + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * + * Generated from protobuf field .google.iam.v1.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Iam\V1\Policy $var + * @return $this + */ + public function setPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Iam\V1\Policy::class); + $this->policy = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Cloud/Iam/V1/TestIamPermissionsRequest.php b/vendor/google/common-protos/src/Cloud/Iam/V1/TestIamPermissionsRequest.php new file mode 100644 index 00000000..27b68160 --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Iam/V1/TestIamPermissionsRequest.php @@ -0,0 +1,117 @@ +google.iam.v1.TestIamPermissionsRequest + */ +class TestIamPermissionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $resource = ''; + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * + * Generated from protobuf field repeated string permissions = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $permissions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V1\IamPolicy::initOnce(); + parent::__construct($data); + } + + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * + * Generated from protobuf field string resource = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * + * Generated from protobuf field repeated string permissions = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPermissions() + { + return $this->permissions; + } + + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * + * Generated from protobuf field repeated string permissions = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPermissions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->permissions = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Cloud/Iam/V1/TestIamPermissionsResponse.php b/vendor/google/common-protos/src/Cloud/Iam/V1/TestIamPermissionsResponse.php new file mode 100644 index 00000000..b8ac00fa --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Iam/V1/TestIamPermissionsResponse.php @@ -0,0 +1,71 @@ +google.iam.v1.TestIamPermissionsResponse + */ +class TestIamPermissionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A subset of `TestPermissionsRequest.permissions` that the caller is + * allowed. + * + * Generated from protobuf field repeated string permissions = 1; + */ + private $permissions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string[]|\Google\Protobuf\Internal\RepeatedField $permissions + * A subset of `TestPermissionsRequest.permissions` that the caller is + * allowed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V1\IamPolicy::initOnce(); + parent::__construct($data); + } + + /** + * A subset of `TestPermissionsRequest.permissions` that the caller is + * allowed. + * + * Generated from protobuf field repeated string permissions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPermissions() + { + return $this->permissions; + } + + /** + * A subset of `TestPermissionsRequest.permissions` that the caller is + * allowed. + * + * Generated from protobuf field repeated string permissions = 1; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPermissions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->permissions = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Cloud/Logging/Type/HttpRequest.php b/vendor/google/common-protos/src/Cloud/Logging/Type/HttpRequest.php new file mode 100644 index 00000000..6e0ad082 --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Logging/Type/HttpRequest.php @@ -0,0 +1,601 @@ +google.logging.type.HttpRequest + */ +class HttpRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. + * + * Generated from protobuf field string request_method = 1; + */ + private $request_method = ''; + /** + * The scheme (http, https), the host name, the path and the query + * portion of the URL that was requested. + * Example: `"http://example.com/some/info?color=red"`. + * + * Generated from protobuf field string request_url = 2; + */ + private $request_url = ''; + /** + * The size of the HTTP request message in bytes, including the request + * headers and the request body. + * + * Generated from protobuf field int64 request_size = 3; + */ + private $request_size = 0; + /** + * The response code indicating the status of response. + * Examples: 200, 404. + * + * Generated from protobuf field int32 status = 4; + */ + private $status = 0; + /** + * The size of the HTTP response message sent back to the client, in bytes, + * including the response headers and the response body. + * + * Generated from protobuf field int64 response_size = 5; + */ + private $response_size = 0; + /** + * The user agent sent by the client. Example: + * `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`. + * + * Generated from protobuf field string user_agent = 6; + */ + private $user_agent = ''; + /** + * The IP address (IPv4 or IPv6) of the client that issued the HTTP + * request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. + * + * Generated from protobuf field string remote_ip = 7; + */ + private $remote_ip = ''; + /** + * The IP address (IPv4 or IPv6) of the origin server that the request was + * sent to. + * + * Generated from protobuf field string server_ip = 13; + */ + private $server_ip = ''; + /** + * The referer URL of the request, as defined in + * [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). + * + * Generated from protobuf field string referer = 8; + */ + private $referer = ''; + /** + * The request processing latency on the server, from the time the request was + * received until the response was sent. + * + * Generated from protobuf field .google.protobuf.Duration latency = 14; + */ + private $latency = null; + /** + * Whether or not a cache lookup was attempted. + * + * Generated from protobuf field bool cache_lookup = 11; + */ + private $cache_lookup = false; + /** + * Whether or not an entity was served from cache + * (with or without validation). + * + * Generated from protobuf field bool cache_hit = 9; + */ + private $cache_hit = false; + /** + * Whether or not the response was validated with the origin server before + * being served from cache. This field is only meaningful if `cache_hit` is + * True. + * + * Generated from protobuf field bool cache_validated_with_origin_server = 10; + */ + private $cache_validated_with_origin_server = false; + /** + * The number of HTTP response bytes inserted into cache. Set only when a + * cache fill was attempted. + * + * Generated from protobuf field int64 cache_fill_bytes = 12; + */ + private $cache_fill_bytes = 0; + /** + * Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" + * + * Generated from protobuf field string protocol = 15; + */ + private $protocol = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $request_method + * The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. + * @type string $request_url + * The scheme (http, https), the host name, the path and the query + * portion of the URL that was requested. + * Example: `"http://example.com/some/info?color=red"`. + * @type int|string $request_size + * The size of the HTTP request message in bytes, including the request + * headers and the request body. + * @type int $status + * The response code indicating the status of response. + * Examples: 200, 404. + * @type int|string $response_size + * The size of the HTTP response message sent back to the client, in bytes, + * including the response headers and the response body. + * @type string $user_agent + * The user agent sent by the client. Example: + * `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`. + * @type string $remote_ip + * The IP address (IPv4 or IPv6) of the client that issued the HTTP + * request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. + * @type string $server_ip + * The IP address (IPv4 or IPv6) of the origin server that the request was + * sent to. + * @type string $referer + * The referer URL of the request, as defined in + * [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). + * @type \Google\Protobuf\Duration $latency + * The request processing latency on the server, from the time the request was + * received until the response was sent. + * @type bool $cache_lookup + * Whether or not a cache lookup was attempted. + * @type bool $cache_hit + * Whether or not an entity was served from cache + * (with or without validation). + * @type bool $cache_validated_with_origin_server + * Whether or not the response was validated with the origin server before + * being served from cache. This field is only meaningful if `cache_hit` is + * True. + * @type int|string $cache_fill_bytes + * The number of HTTP response bytes inserted into cache. Set only when a + * cache fill was attempted. + * @type string $protocol + * Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Logging\Type\HttpRequest::initOnce(); + parent::__construct($data); + } + + /** + * The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. + * + * Generated from protobuf field string request_method = 1; + * @return string + */ + public function getRequestMethod() + { + return $this->request_method; + } + + /** + * The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. + * + * Generated from protobuf field string request_method = 1; + * @param string $var + * @return $this + */ + public function setRequestMethod($var) + { + GPBUtil::checkString($var, True); + $this->request_method = $var; + + return $this; + } + + /** + * The scheme (http, https), the host name, the path and the query + * portion of the URL that was requested. + * Example: `"http://example.com/some/info?color=red"`. + * + * Generated from protobuf field string request_url = 2; + * @return string + */ + public function getRequestUrl() + { + return $this->request_url; + } + + /** + * The scheme (http, https), the host name, the path and the query + * portion of the URL that was requested. + * Example: `"http://example.com/some/info?color=red"`. + * + * Generated from protobuf field string request_url = 2; + * @param string $var + * @return $this + */ + public function setRequestUrl($var) + { + GPBUtil::checkString($var, True); + $this->request_url = $var; + + return $this; + } + + /** + * The size of the HTTP request message in bytes, including the request + * headers and the request body. + * + * Generated from protobuf field int64 request_size = 3; + * @return int|string + */ + public function getRequestSize() + { + return $this->request_size; + } + + /** + * The size of the HTTP request message in bytes, including the request + * headers and the request body. + * + * Generated from protobuf field int64 request_size = 3; + * @param int|string $var + * @return $this + */ + public function setRequestSize($var) + { + GPBUtil::checkInt64($var); + $this->request_size = $var; + + return $this; + } + + /** + * The response code indicating the status of response. + * Examples: 200, 404. + * + * Generated from protobuf field int32 status = 4; + * @return int + */ + public function getStatus() + { + return $this->status; + } + + /** + * The response code indicating the status of response. + * Examples: 200, 404. + * + * Generated from protobuf field int32 status = 4; + * @param int $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkInt32($var); + $this->status = $var; + + return $this; + } + + /** + * The size of the HTTP response message sent back to the client, in bytes, + * including the response headers and the response body. + * + * Generated from protobuf field int64 response_size = 5; + * @return int|string + */ + public function getResponseSize() + { + return $this->response_size; + } + + /** + * The size of the HTTP response message sent back to the client, in bytes, + * including the response headers and the response body. + * + * Generated from protobuf field int64 response_size = 5; + * @param int|string $var + * @return $this + */ + public function setResponseSize($var) + { + GPBUtil::checkInt64($var); + $this->response_size = $var; + + return $this; + } + + /** + * The user agent sent by the client. Example: + * `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`. + * + * Generated from protobuf field string user_agent = 6; + * @return string + */ + public function getUserAgent() + { + return $this->user_agent; + } + + /** + * The user agent sent by the client. Example: + * `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`. + * + * Generated from protobuf field string user_agent = 6; + * @param string $var + * @return $this + */ + public function setUserAgent($var) + { + GPBUtil::checkString($var, True); + $this->user_agent = $var; + + return $this; + } + + /** + * The IP address (IPv4 or IPv6) of the client that issued the HTTP + * request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. + * + * Generated from protobuf field string remote_ip = 7; + * @return string + */ + public function getRemoteIp() + { + return $this->remote_ip; + } + + /** + * The IP address (IPv4 or IPv6) of the client that issued the HTTP + * request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. + * + * Generated from protobuf field string remote_ip = 7; + * @param string $var + * @return $this + */ + public function setRemoteIp($var) + { + GPBUtil::checkString($var, True); + $this->remote_ip = $var; + + return $this; + } + + /** + * The IP address (IPv4 or IPv6) of the origin server that the request was + * sent to. + * + * Generated from protobuf field string server_ip = 13; + * @return string + */ + public function getServerIp() + { + return $this->server_ip; + } + + /** + * The IP address (IPv4 or IPv6) of the origin server that the request was + * sent to. + * + * Generated from protobuf field string server_ip = 13; + * @param string $var + * @return $this + */ + public function setServerIp($var) + { + GPBUtil::checkString($var, True); + $this->server_ip = $var; + + return $this; + } + + /** + * The referer URL of the request, as defined in + * [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). + * + * Generated from protobuf field string referer = 8; + * @return string + */ + public function getReferer() + { + return $this->referer; + } + + /** + * The referer URL of the request, as defined in + * [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). + * + * Generated from protobuf field string referer = 8; + * @param string $var + * @return $this + */ + public function setReferer($var) + { + GPBUtil::checkString($var, True); + $this->referer = $var; + + return $this; + } + + /** + * The request processing latency on the server, from the time the request was + * received until the response was sent. + * + * Generated from protobuf field .google.protobuf.Duration latency = 14; + * @return \Google\Protobuf\Duration + */ + public function getLatency() + { + return $this->latency; + } + + /** + * The request processing latency on the server, from the time the request was + * received until the response was sent. + * + * Generated from protobuf field .google.protobuf.Duration latency = 14; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setLatency($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->latency = $var; + + return $this; + } + + /** + * Whether or not a cache lookup was attempted. + * + * Generated from protobuf field bool cache_lookup = 11; + * @return bool + */ + public function getCacheLookup() + { + return $this->cache_lookup; + } + + /** + * Whether or not a cache lookup was attempted. + * + * Generated from protobuf field bool cache_lookup = 11; + * @param bool $var + * @return $this + */ + public function setCacheLookup($var) + { + GPBUtil::checkBool($var); + $this->cache_lookup = $var; + + return $this; + } + + /** + * Whether or not an entity was served from cache + * (with or without validation). + * + * Generated from protobuf field bool cache_hit = 9; + * @return bool + */ + public function getCacheHit() + { + return $this->cache_hit; + } + + /** + * Whether or not an entity was served from cache + * (with or without validation). + * + * Generated from protobuf field bool cache_hit = 9; + * @param bool $var + * @return $this + */ + public function setCacheHit($var) + { + GPBUtil::checkBool($var); + $this->cache_hit = $var; + + return $this; + } + + /** + * Whether or not the response was validated with the origin server before + * being served from cache. This field is only meaningful if `cache_hit` is + * True. + * + * Generated from protobuf field bool cache_validated_with_origin_server = 10; + * @return bool + */ + public function getCacheValidatedWithOriginServer() + { + return $this->cache_validated_with_origin_server; + } + + /** + * Whether or not the response was validated with the origin server before + * being served from cache. This field is only meaningful if `cache_hit` is + * True. + * + * Generated from protobuf field bool cache_validated_with_origin_server = 10; + * @param bool $var + * @return $this + */ + public function setCacheValidatedWithOriginServer($var) + { + GPBUtil::checkBool($var); + $this->cache_validated_with_origin_server = $var; + + return $this; + } + + /** + * The number of HTTP response bytes inserted into cache. Set only when a + * cache fill was attempted. + * + * Generated from protobuf field int64 cache_fill_bytes = 12; + * @return int|string + */ + public function getCacheFillBytes() + { + return $this->cache_fill_bytes; + } + + /** + * The number of HTTP response bytes inserted into cache. Set only when a + * cache fill was attempted. + * + * Generated from protobuf field int64 cache_fill_bytes = 12; + * @param int|string $var + * @return $this + */ + public function setCacheFillBytes($var) + { + GPBUtil::checkInt64($var); + $this->cache_fill_bytes = $var; + + return $this; + } + + /** + * Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" + * + * Generated from protobuf field string protocol = 15; + * @return string + */ + public function getProtocol() + { + return $this->protocol; + } + + /** + * Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" + * + * Generated from protobuf field string protocol = 15; + * @param string $var + * @return $this + */ + public function setProtocol($var) + { + GPBUtil::checkString($var, True); + $this->protocol = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Cloud/Logging/Type/LogSeverity.php b/vendor/google/common-protos/src/Cloud/Logging/Type/LogSeverity.php new file mode 100644 index 00000000..772d00ad --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/Logging/Type/LogSeverity.php @@ -0,0 +1,115 @@ + DEBUG AND severity <= WARNING + * If you are writing log entries, you should map other severity encodings to + * one of these standard levels. For example, you might map all of Java's FINE, + * FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the + * original severity level in the log entry payload if you wish. + * + * Protobuf type google.logging.type.LogSeverity + */ +class LogSeverity +{ + /** + * (0) The log entry has no assigned severity level. + * + * Generated from protobuf enum DEFAULT = 0; + */ + const PBDEFAULT = 0; + /** + * (100) Debug or trace information. + * + * Generated from protobuf enum DEBUG = 100; + */ + const DEBUG = 100; + /** + * (200) Routine information, such as ongoing status or performance. + * + * Generated from protobuf enum INFO = 200; + */ + const INFO = 200; + /** + * (300) Normal but significant events, such as start up, shut down, or + * a configuration change. + * + * Generated from protobuf enum NOTICE = 300; + */ + const NOTICE = 300; + /** + * (400) Warning events might cause problems. + * + * Generated from protobuf enum WARNING = 400; + */ + const WARNING = 400; + /** + * (500) Error events are likely to cause problems. + * + * Generated from protobuf enum ERROR = 500; + */ + const ERROR = 500; + /** + * (600) Critical events cause more severe problems or outages. + * + * Generated from protobuf enum CRITICAL = 600; + */ + const CRITICAL = 600; + /** + * (700) A person must take an action immediately. + * + * Generated from protobuf enum ALERT = 700; + */ + const ALERT = 700; + /** + * (800) One or more systems are unusable. + * + * Generated from protobuf enum EMERGENCY = 800; + */ + const EMERGENCY = 800; + + private static $valueToName = [ + self::PBDEFAULT => 'PBDEFAULT', + self::DEBUG => 'DEBUG', + self::INFO => 'INFO', + self::NOTICE => 'NOTICE', + self::WARNING => 'WARNING', + self::ERROR => 'ERROR', + self::CRITICAL => 'CRITICAL', + self::ALERT => 'ALERT', + self::EMERGENCY => 'EMERGENCY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/vendor/google/common-protos/src/Cloud/OperationResponseMapping.php b/vendor/google/common-protos/src/Cloud/OperationResponseMapping.php new file mode 100644 index 00000000..c21c294e --- /dev/null +++ b/vendor/google/common-protos/src/Cloud/OperationResponseMapping.php @@ -0,0 +1,86 @@ +google.cloud.OperationResponseMapping + */ +class OperationResponseMapping +{ + /** + * Do not use. + * + * Generated from protobuf enum UNDEFINED = 0; + */ + const UNDEFINED = 0; + /** + * A field in an API-specific (custom) Operation object which carries the same + * meaning as google.longrunning.Operation.name. + * + * Generated from protobuf enum NAME = 1; + */ + const NAME = 1; + /** + * A field in an API-specific (custom) Operation object which carries the same + * meaning as google.longrunning.Operation.done. If the annotated field is of + * an enum type, `annotated_field_name == EnumType.DONE` semantics should be + * equivalent to `Operation.done == true`. If the annotated field is of type + * boolean, then it should follow the same semantics as Operation.done. + * Otherwise, a non-empty value should be treated as `Operation.done == true`. + * + * Generated from protobuf enum STATUS = 2; + */ + const STATUS = 2; + /** + * A field in an API-specific (custom) Operation object which carries the same + * meaning as google.longrunning.Operation.error.code. + * + * Generated from protobuf enum ERROR_CODE = 3; + */ + const ERROR_CODE = 3; + /** + * A field in an API-specific (custom) Operation object which carries the same + * meaning as google.longrunning.Operation.error.message. + * + * Generated from protobuf enum ERROR_MESSAGE = 4; + */ + const ERROR_MESSAGE = 4; + + private static $valueToName = [ + self::UNDEFINED => 'UNDEFINED', + self::NAME => 'NAME', + self::STATUS => 'STATUS', + self::ERROR_CODE => 'ERROR_CODE', + self::ERROR_MESSAGE => 'ERROR_MESSAGE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/vendor/google/common-protos/src/Iam/V1/Logging/AuditData.php b/vendor/google/common-protos/src/Iam/V1/Logging/AuditData.php new file mode 100644 index 00000000..94c12c2d --- /dev/null +++ b/vendor/google/common-protos/src/Iam/V1/Logging/AuditData.php @@ -0,0 +1,69 @@ +google.iam.v1.logging.AuditData + */ +class AuditData extends \Google\Protobuf\Internal\Message +{ + /** + * Policy delta between the original policy and the newly set policy. + * + * Generated from protobuf field .google.iam.v1.PolicyDelta policy_delta = 2; + */ + private $policy_delta = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Iam\V1\PolicyDelta $policy_delta + * Policy delta between the original policy and the newly set policy. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V1\Logging\AuditData::initOnce(); + parent::__construct($data); + } + + /** + * Policy delta between the original policy and the newly set policy. + * + * Generated from protobuf field .google.iam.v1.PolicyDelta policy_delta = 2; + * @return \Google\Cloud\Iam\V1\PolicyDelta + */ + public function getPolicyDelta() + { + return $this->policy_delta; + } + + /** + * Policy delta between the original policy and the newly set policy. + * + * Generated from protobuf field .google.iam.v1.PolicyDelta policy_delta = 2; + * @param \Google\Cloud\Iam\V1\PolicyDelta $var + * @return $this + */ + public function setPolicyDelta($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Iam\V1\PolicyDelta::class); + $this->policy_delta = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/LongRunning/CancelOperationRequest.php b/vendor/google/common-protos/src/LongRunning/CancelOperationRequest.php new file mode 100644 index 00000000..48b68f41 --- /dev/null +++ b/vendor/google/common-protos/src/LongRunning/CancelOperationRequest.php @@ -0,0 +1,67 @@ +google.longrunning.CancelOperationRequest + */ +class CancelOperationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the operation resource to be cancelled. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the operation resource to be cancelled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Longrunning\Operations::initOnce(); + parent::__construct($data); + } + + /** + * The name of the operation resource to be cancelled. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the operation resource to be cancelled. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/LongRunning/DeleteOperationRequest.php b/vendor/google/common-protos/src/LongRunning/DeleteOperationRequest.php new file mode 100644 index 00000000..8fce867d --- /dev/null +++ b/vendor/google/common-protos/src/LongRunning/DeleteOperationRequest.php @@ -0,0 +1,67 @@ +google.longrunning.DeleteOperationRequest + */ +class DeleteOperationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the operation resource to be deleted. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the operation resource to be deleted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Longrunning\Operations::initOnce(); + parent::__construct($data); + } + + /** + * The name of the operation resource to be deleted. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the operation resource to be deleted. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/LongRunning/GetOperationRequest.php b/vendor/google/common-protos/src/LongRunning/GetOperationRequest.php new file mode 100644 index 00000000..061a192a --- /dev/null +++ b/vendor/google/common-protos/src/LongRunning/GetOperationRequest.php @@ -0,0 +1,67 @@ +google.longrunning.GetOperationRequest + */ +class GetOperationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the operation resource. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the operation resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Longrunning\Operations::initOnce(); + parent::__construct($data); + } + + /** + * The name of the operation resource. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the operation resource. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/LongRunning/ListOperationsRequest.php b/vendor/google/common-protos/src/LongRunning/ListOperationsRequest.php new file mode 100644 index 00000000..732203a3 --- /dev/null +++ b/vendor/google/common-protos/src/LongRunning/ListOperationsRequest.php @@ -0,0 +1,169 @@ +google.longrunning.ListOperationsRequest + */ +class ListOperationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the operation collection. + * + * Generated from protobuf field string name = 4; + */ + private $name = ''; + /** + * The standard list filter. + * + * Generated from protobuf field string filter = 1; + */ + private $filter = ''; + /** + * The standard list page size. + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * The standard list page token. + * + * Generated from protobuf field string page_token = 3; + */ + private $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the operation collection. + * @type string $filter + * The standard list filter. + * @type int $page_size + * The standard list page size. + * @type string $page_token + * The standard list page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Longrunning\Operations::initOnce(); + parent::__construct($data); + } + + /** + * The name of the operation collection. + * + * Generated from protobuf field string name = 4; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the operation collection. + * + * Generated from protobuf field string name = 4; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The standard list filter. + * + * Generated from protobuf field string filter = 1; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The standard list filter. + * + * Generated from protobuf field string filter = 1; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * The standard list page size. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The standard list page size. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The standard list page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The standard list page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/LongRunning/ListOperationsResponse.php b/vendor/google/common-protos/src/LongRunning/ListOperationsResponse.php new file mode 100644 index 00000000..ffe4ee18 --- /dev/null +++ b/vendor/google/common-protos/src/LongRunning/ListOperationsResponse.php @@ -0,0 +1,101 @@ +google.longrunning.ListOperationsResponse + */ +class ListOperationsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of operations that matches the specified filter in the request. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + */ + private $operations; + /** + * The standard List next-page token. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\LongRunning\Operation[]|\Google\Protobuf\Internal\RepeatedField $operations + * A list of operations that matches the specified filter in the request. + * @type string $next_page_token + * The standard List next-page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Longrunning\Operations::initOnce(); + parent::__construct($data); + } + + /** + * A list of operations that matches the specified filter in the request. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOperations() + { + return $this->operations; + } + + /** + * A list of operations that matches the specified filter in the request. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + * @param \Google\LongRunning\Operation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOperations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\LongRunning\Operation::class); + $this->operations = $arr; + + return $this; + } + + /** + * The standard List next-page token. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The standard List next-page token. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/LongRunning/Operation.php b/vendor/google/common-protos/src/LongRunning/Operation.php new file mode 100644 index 00000000..1cda0974 --- /dev/null +++ b/vendor/google/common-protos/src/LongRunning/Operation.php @@ -0,0 +1,250 @@ +google.longrunning.Operation + */ +class Operation extends \Google\Protobuf\Internal\Message +{ + /** + * The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the + * `name` should have the format of `operations/some/unique/name`. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * Service-specific metadata associated with the operation. It typically + * contains progress information and common metadata such as create time. + * Some services might not provide such metadata. Any method that returns a + * long-running operation should document the metadata type, if any. + * + * Generated from protobuf field .google.protobuf.Any metadata = 2; + */ + private $metadata = null; + /** + * If the value is `false`, it means the operation is still in progress. + * If true, the operation is completed, and either `error` or `response` is + * available. + * + * Generated from protobuf field bool done = 3; + */ + private $done = false; + protected $result; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the + * `name` should have the format of `operations/some/unique/name`. + * @type \Google\Protobuf\Any $metadata + * Service-specific metadata associated with the operation. It typically + * contains progress information and common metadata such as create time. + * Some services might not provide such metadata. Any method that returns a + * long-running operation should document the metadata type, if any. + * @type bool $done + * If the value is `false`, it means the operation is still in progress. + * If true, the operation is completed, and either `error` or `response` is + * available. + * @type \Google\Rpc\Status $error + * The error result of the operation in case of failure or cancellation. + * @type \Google\Protobuf\Any $response + * The normal response of the operation in case of success. If the original + * method returns no data on success, such as `Delete`, the response is + * `google.protobuf.Empty`. If the original method is standard + * `Get`/`Create`/`Update`, the response should be the resource. For other + * methods, the response should have the type `XxxResponse`, where `Xxx` + * is the original method name. For example, if the original method name + * is `TakeSnapshot()`, the inferred response type is + * `TakeSnapshotResponse`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Longrunning\Operations::initOnce(); + parent::__construct($data); + } + + /** + * The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the + * `name` should have the format of `operations/some/unique/name`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the + * `name` should have the format of `operations/some/unique/name`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Service-specific metadata associated with the operation. It typically + * contains progress information and common metadata such as create time. + * Some services might not provide such metadata. Any method that returns a + * long-running operation should document the metadata type, if any. + * + * Generated from protobuf field .google.protobuf.Any metadata = 2; + * @return \Google\Protobuf\Any + */ + public function getMetadata() + { + return $this->metadata; + } + + /** + * Service-specific metadata associated with the operation. It typically + * contains progress information and common metadata such as create time. + * Some services might not provide such metadata. Any method that returns a + * long-running operation should document the metadata type, if any. + * + * Generated from protobuf field .google.protobuf.Any metadata = 2; + * @param \Google\Protobuf\Any $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); + $this->metadata = $var; + + return $this; + } + + /** + * If the value is `false`, it means the operation is still in progress. + * If true, the operation is completed, and either `error` or `response` is + * available. + * + * Generated from protobuf field bool done = 3; + * @return bool + */ + public function getDone() + { + return $this->done; + } + + /** + * If the value is `false`, it means the operation is still in progress. + * If true, the operation is completed, and either `error` or `response` is + * available. + * + * Generated from protobuf field bool done = 3; + * @param bool $var + * @return $this + */ + public function setDone($var) + { + GPBUtil::checkBool($var); + $this->done = $var; + + return $this; + } + + /** + * The error result of the operation in case of failure or cancellation. + * + * Generated from protobuf field .google.rpc.Status error = 4; + * @return \Google\Rpc\Status + */ + public function getError() + { + return $this->readOneof(4); + } + + /** + * The error result of the operation in case of failure or cancellation. + * + * Generated from protobuf field .google.rpc.Status error = 4; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * The normal response of the operation in case of success. If the original + * method returns no data on success, such as `Delete`, the response is + * `google.protobuf.Empty`. If the original method is standard + * `Get`/`Create`/`Update`, the response should be the resource. For other + * methods, the response should have the type `XxxResponse`, where `Xxx` + * is the original method name. For example, if the original method name + * is `TakeSnapshot()`, the inferred response type is + * `TakeSnapshotResponse`. + * + * Generated from protobuf field .google.protobuf.Any response = 5; + * @return \Google\Protobuf\Any + */ + public function getResponse() + { + return $this->readOneof(5); + } + + /** + * The normal response of the operation in case of success. If the original + * method returns no data on success, such as `Delete`, the response is + * `google.protobuf.Empty`. If the original method is standard + * `Get`/`Create`/`Update`, the response should be the resource. For other + * methods, the response should have the type `XxxResponse`, where `Xxx` + * is the original method name. For example, if the original method name + * is `TakeSnapshot()`, the inferred response type is + * `TakeSnapshotResponse`. + * + * Generated from protobuf field .google.protobuf.Any response = 5; + * @param \Google\Protobuf\Any $var + * @return $this + */ + public function setResponse($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * @return string + */ + public function getResult() + { + return $this->whichOneof("result"); + } + +} + diff --git a/vendor/google/common-protos/src/LongRunning/OperationInfo.php b/vendor/google/common-protos/src/LongRunning/OperationInfo.php new file mode 100644 index 00000000..35ebb15b --- /dev/null +++ b/vendor/google/common-protos/src/LongRunning/OperationInfo.php @@ -0,0 +1,145 @@ +google.longrunning.OperationInfo + */ +class OperationInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The message name of the primary return type for this + * long-running operation. + * This type will be used to deserialize the LRO's response. + * If the response is in a different package from the rpc, a fully-qualified + * message name must be used (e.g. `google.protobuf.Struct`). + * Note: Altering this value constitutes a breaking change. + * + * Generated from protobuf field string response_type = 1; + */ + private $response_type = ''; + /** + * Required. The message name of the metadata type for this long-running + * operation. + * If the response is in a different package from the rpc, a fully-qualified + * message name must be used (e.g. `google.protobuf.Struct`). + * Note: Altering this value constitutes a breaking change. + * + * Generated from protobuf field string metadata_type = 2; + */ + private $metadata_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $response_type + * Required. The message name of the primary return type for this + * long-running operation. + * This type will be used to deserialize the LRO's response. + * If the response is in a different package from the rpc, a fully-qualified + * message name must be used (e.g. `google.protobuf.Struct`). + * Note: Altering this value constitutes a breaking change. + * @type string $metadata_type + * Required. The message name of the metadata type for this long-running + * operation. + * If the response is in a different package from the rpc, a fully-qualified + * message name must be used (e.g. `google.protobuf.Struct`). + * Note: Altering this value constitutes a breaking change. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Longrunning\Operations::initOnce(); + parent::__construct($data); + } + + /** + * Required. The message name of the primary return type for this + * long-running operation. + * This type will be used to deserialize the LRO's response. + * If the response is in a different package from the rpc, a fully-qualified + * message name must be used (e.g. `google.protobuf.Struct`). + * Note: Altering this value constitutes a breaking change. + * + * Generated from protobuf field string response_type = 1; + * @return string + */ + public function getResponseType() + { + return $this->response_type; + } + + /** + * Required. The message name of the primary return type for this + * long-running operation. + * This type will be used to deserialize the LRO's response. + * If the response is in a different package from the rpc, a fully-qualified + * message name must be used (e.g. `google.protobuf.Struct`). + * Note: Altering this value constitutes a breaking change. + * + * Generated from protobuf field string response_type = 1; + * @param string $var + * @return $this + */ + public function setResponseType($var) + { + GPBUtil::checkString($var, True); + $this->response_type = $var; + + return $this; + } + + /** + * Required. The message name of the metadata type for this long-running + * operation. + * If the response is in a different package from the rpc, a fully-qualified + * message name must be used (e.g. `google.protobuf.Struct`). + * Note: Altering this value constitutes a breaking change. + * + * Generated from protobuf field string metadata_type = 2; + * @return string + */ + public function getMetadataType() + { + return $this->metadata_type; + } + + /** + * Required. The message name of the metadata type for this long-running + * operation. + * If the response is in a different package from the rpc, a fully-qualified + * message name must be used (e.g. `google.protobuf.Struct`). + * Note: Altering this value constitutes a breaking change. + * + * Generated from protobuf field string metadata_type = 2; + * @param string $var + * @return $this + */ + public function setMetadataType($var) + { + GPBUtil::checkString($var, True); + $this->metadata_type = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Rpc/BadRequest.php b/vendor/google/common-protos/src/Rpc/BadRequest.php new file mode 100644 index 00000000..c25d9110 --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/BadRequest.php @@ -0,0 +1,68 @@ +google.rpc.BadRequest + */ +class BadRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Describes all violations in a client request. + * + * Generated from protobuf field repeated .google.rpc.BadRequest.FieldViolation field_violations = 1; + */ + private $field_violations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Rpc\BadRequest\FieldViolation[]|\Google\Protobuf\Internal\RepeatedField $field_violations + * Describes all violations in a client request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * Describes all violations in a client request. + * + * Generated from protobuf field repeated .google.rpc.BadRequest.FieldViolation field_violations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFieldViolations() + { + return $this->field_violations; + } + + /** + * Describes all violations in a client request. + * + * Generated from protobuf field repeated .google.rpc.BadRequest.FieldViolation field_violations = 1; + * @param \Google\Rpc\BadRequest\FieldViolation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFieldViolations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\BadRequest\FieldViolation::class); + $this->field_violations = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Rpc/BadRequest/FieldViolation.php b/vendor/google/common-protos/src/Rpc/BadRequest/FieldViolation.php new file mode 100644 index 00000000..0bfe6812 --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/BadRequest/FieldViolation.php @@ -0,0 +1,112 @@ +google.rpc.BadRequest.FieldViolation + */ +class FieldViolation extends \Google\Protobuf\Internal\Message +{ + /** + * A path leading to a field in the request body. The value will be a + * sequence of dot-separated identifiers that identify a protocol buffer + * field. E.g., "field_violations.field" would identify this field. + * + * Generated from protobuf field string field = 1; + */ + protected $field = ''; + /** + * A description of why the request element is bad. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $field + * A path leading to a field in the request body. The value will be a + * sequence of dot-separated identifiers that identify a protocol buffer + * field. E.g., "field_violations.field" would identify this field. + * @type string $description + * A description of why the request element is bad. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * A path leading to a field in the request body. The value will be a + * sequence of dot-separated identifiers that identify a protocol buffer + * field. E.g., "field_violations.field" would identify this field. + * + * Generated from protobuf field string field = 1; + * @return string + */ + public function getField() + { + return $this->field; + } + + /** + * A path leading to a field in the request body. The value will be a + * sequence of dot-separated identifiers that identify a protocol buffer + * field. E.g., "field_violations.field" would identify this field. + * + * Generated from protobuf field string field = 1; + * @param string $var + * @return $this + */ + public function setField($var) + { + GPBUtil::checkString($var, True); + $this->field = $var; + + return $this; + } + + /** + * A description of why the request element is bad. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A description of why the request element is bad. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FieldViolation::class, \Google\Rpc\BadRequest_FieldViolation::class); + diff --git a/vendor/google/common-protos/src/Rpc/BadRequest_FieldViolation.php b/vendor/google/common-protos/src/Rpc/BadRequest_FieldViolation.php new file mode 100644 index 00000000..bf6bdcdc --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/BadRequest_FieldViolation.php @@ -0,0 +1,16 @@ +google.rpc.Code + */ +class Code +{ + /** + * Not an error; returned on success + * HTTP Mapping: 200 OK + * + * Generated from protobuf enum OK = 0; + */ + const OK = 0; + /** + * The operation was cancelled, typically by the caller. + * HTTP Mapping: 499 Client Closed Request + * + * Generated from protobuf enum CANCELLED = 1; + */ + const CANCELLED = 1; + /** + * Unknown error. For example, this error may be returned when + * a `Status` value received from another address space belongs to + * an error space that is not known in this address space. Also + * errors raised by APIs that do not return enough error information + * may be converted to this error. + * HTTP Mapping: 500 Internal Server Error + * + * Generated from protobuf enum UNKNOWN = 2; + */ + const UNKNOWN = 2; + /** + * The client specified an invalid argument. Note that this differs + * from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments + * that are problematic regardless of the state of the system + * (e.g., a malformed file name). + * HTTP Mapping: 400 Bad Request + * + * Generated from protobuf enum INVALID_ARGUMENT = 3; + */ + const INVALID_ARGUMENT = 3; + /** + * The deadline expired before the operation could complete. For operations + * that change the state of the system, this error may be returned + * even if the operation has completed successfully. For example, a + * successful response from a server could have been delayed long + * enough for the deadline to expire. + * HTTP Mapping: 504 Gateway Timeout + * + * Generated from protobuf enum DEADLINE_EXCEEDED = 4; + */ + const DEADLINE_EXCEEDED = 4; + /** + * Some requested entity (e.g., file or directory) was not found. + * Note to server developers: if a request is denied for an entire class + * of users, such as gradual feature rollout or undocumented whitelist, + * `NOT_FOUND` may be used. If a request is denied for some users within + * a class of users, such as user-based access control, `PERMISSION_DENIED` + * must be used. + * HTTP Mapping: 404 Not Found + * + * Generated from protobuf enum NOT_FOUND = 5; + */ + const NOT_FOUND = 5; + /** + * The entity that a client attempted to create (e.g., file or directory) + * already exists. + * HTTP Mapping: 409 Conflict + * + * Generated from protobuf enum ALREADY_EXISTS = 6; + */ + const ALREADY_EXISTS = 6; + /** + * The caller does not have permission to execute the specified + * operation. `PERMISSION_DENIED` must not be used for rejections + * caused by exhausting some resource (use `RESOURCE_EXHAUSTED` + * instead for those errors). `PERMISSION_DENIED` must not be + * used if the caller can not be identified (use `UNAUTHENTICATED` + * instead for those errors). This error code does not imply the + * request is valid or the requested entity exists or satisfies + * other pre-conditions. + * HTTP Mapping: 403 Forbidden + * + * Generated from protobuf enum PERMISSION_DENIED = 7; + */ + const PERMISSION_DENIED = 7; + /** + * The request does not have valid authentication credentials for the + * operation. + * HTTP Mapping: 401 Unauthorized + * + * Generated from protobuf enum UNAUTHENTICATED = 16; + */ + const UNAUTHENTICATED = 16; + /** + * Some resource has been exhausted, perhaps a per-user quota, or + * perhaps the entire file system is out of space. + * HTTP Mapping: 429 Too Many Requests + * + * Generated from protobuf enum RESOURCE_EXHAUSTED = 8; + */ + const RESOURCE_EXHAUSTED = 8; + /** + * The operation was rejected because the system is not in a state + * required for the operation's execution. For example, the directory + * to be deleted is non-empty, an rmdir operation is applied to + * a non-directory, etc. + * Service implementors can use the following guidelines to decide + * between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: + * (a) Use `UNAVAILABLE` if the client can retry just the failing call. + * (b) Use `ABORTED` if the client should retry at a higher level + * (e.g., when a client-specified test-and-set fails, indicating the + * client should restart a read-modify-write sequence). + * (c) Use `FAILED_PRECONDITION` if the client should not retry until + * the system state has been explicitly fixed. E.g., if an "rmdir" + * fails because the directory is non-empty, `FAILED_PRECONDITION` + * should be returned since the client should not retry unless + * the files are deleted from the directory. + * HTTP Mapping: 400 Bad Request + * + * Generated from protobuf enum FAILED_PRECONDITION = 9; + */ + const FAILED_PRECONDITION = 9; + /** + * The operation was aborted, typically due to a concurrency issue such as + * a sequencer check failure or transaction abort. + * See the guidelines above for deciding between `FAILED_PRECONDITION`, + * `ABORTED`, and `UNAVAILABLE`. + * HTTP Mapping: 409 Conflict + * + * Generated from protobuf enum ABORTED = 10; + */ + const ABORTED = 10; + /** + * The operation was attempted past the valid range. E.g., seeking or + * reading past end-of-file. + * Unlike `INVALID_ARGUMENT`, this error indicates a problem that may + * be fixed if the system state changes. For example, a 32-bit file + * system will generate `INVALID_ARGUMENT` if asked to read at an + * offset that is not in the range [0,2^32-1], but it will generate + * `OUT_OF_RANGE` if asked to read from an offset past the current + * file size. + * There is a fair bit of overlap between `FAILED_PRECONDITION` and + * `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific + * error) when it applies so that callers who are iterating through + * a space can easily look for an `OUT_OF_RANGE` error to detect when + * they are done. + * HTTP Mapping: 400 Bad Request + * + * Generated from protobuf enum OUT_OF_RANGE = 11; + */ + const OUT_OF_RANGE = 11; + /** + * The operation is not implemented or is not supported/enabled in this + * service. + * HTTP Mapping: 501 Not Implemented + * + * Generated from protobuf enum UNIMPLEMENTED = 12; + */ + const UNIMPLEMENTED = 12; + /** + * Internal errors. This means that some invariants expected by the + * underlying system have been broken. This error code is reserved + * for serious errors. + * HTTP Mapping: 500 Internal Server Error + * + * Generated from protobuf enum INTERNAL = 13; + */ + const INTERNAL = 13; + /** + * The service is currently unavailable. This is most likely a + * transient condition, which can be corrected by retrying with + * a backoff. Note that it is not always safe to retry + * non-idempotent operations. + * See the guidelines above for deciding between `FAILED_PRECONDITION`, + * `ABORTED`, and `UNAVAILABLE`. + * HTTP Mapping: 503 Service Unavailable + * + * Generated from protobuf enum UNAVAILABLE = 14; + */ + const UNAVAILABLE = 14; + /** + * Unrecoverable data loss or corruption. + * HTTP Mapping: 500 Internal Server Error + * + * Generated from protobuf enum DATA_LOSS = 15; + */ + const DATA_LOSS = 15; + + private static $valueToName = [ + self::OK => 'OK', + self::CANCELLED => 'CANCELLED', + self::UNKNOWN => 'UNKNOWN', + self::INVALID_ARGUMENT => 'INVALID_ARGUMENT', + self::DEADLINE_EXCEEDED => 'DEADLINE_EXCEEDED', + self::NOT_FOUND => 'NOT_FOUND', + self::ALREADY_EXISTS => 'ALREADY_EXISTS', + self::PERMISSION_DENIED => 'PERMISSION_DENIED', + self::UNAUTHENTICATED => 'UNAUTHENTICATED', + self::RESOURCE_EXHAUSTED => 'RESOURCE_EXHAUSTED', + self::FAILED_PRECONDITION => 'FAILED_PRECONDITION', + self::ABORTED => 'ABORTED', + self::OUT_OF_RANGE => 'OUT_OF_RANGE', + self::UNIMPLEMENTED => 'UNIMPLEMENTED', + self::INTERNAL => 'INTERNAL', + self::UNAVAILABLE => 'UNAVAILABLE', + self::DATA_LOSS => 'DATA_LOSS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/vendor/google/common-protos/src/Rpc/DebugInfo.php b/vendor/google/common-protos/src/Rpc/DebugInfo.php new file mode 100644 index 00000000..7e10a904 --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/DebugInfo.php @@ -0,0 +1,101 @@ +google.rpc.DebugInfo + */ +class DebugInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The stack trace entries indicating where the error occurred. + * + * Generated from protobuf field repeated string stack_entries = 1; + */ + private $stack_entries; + /** + * Additional debugging information provided by the server. + * + * Generated from protobuf field string detail = 2; + */ + protected $detail = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string[]|\Google\Protobuf\Internal\RepeatedField $stack_entries + * The stack trace entries indicating where the error occurred. + * @type string $detail + * Additional debugging information provided by the server. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * The stack trace entries indicating where the error occurred. + * + * Generated from protobuf field repeated string stack_entries = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStackEntries() + { + return $this->stack_entries; + } + + /** + * The stack trace entries indicating where the error occurred. + * + * Generated from protobuf field repeated string stack_entries = 1; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStackEntries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->stack_entries = $arr; + + return $this; + } + + /** + * Additional debugging information provided by the server. + * + * Generated from protobuf field string detail = 2; + * @return string + */ + public function getDetail() + { + return $this->detail; + } + + /** + * Additional debugging information provided by the server. + * + * Generated from protobuf field string detail = 2; + * @param string $var + * @return $this + */ + public function setDetail($var) + { + GPBUtil::checkString($var, True); + $this->detail = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Rpc/ErrorInfo.php b/vendor/google/common-protos/src/Rpc/ErrorInfo.php new file mode 100644 index 00000000..e3b92fbc --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/ErrorInfo.php @@ -0,0 +1,209 @@ +google.rpc.ErrorInfo + */ +class ErrorInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The reason of the error. This is a constant value that identifies the + * proximate cause of the error. Error reasons are unique within a particular + * domain of errors. This should be at most 63 characters and match + * /[A-Z0-9_]+/. + * + * Generated from protobuf field string reason = 1; + */ + protected $reason = ''; + /** + * The logical grouping to which the "reason" belongs. The error domain + * is typically the registered service name of the tool or product that + * generates the error. Example: "pubsub.googleapis.com". If the error is + * generated by some common infrastructure, the error domain must be a + * globally unique value that identifies the infrastructure. For Google API + * infrastructure, the error domain is "googleapis.com". + * + * Generated from protobuf field string domain = 2; + */ + protected $domain = ''; + /** + * Additional structured details about this error. + * Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in + * length. When identifying the current value of an exceeded limit, the units + * should be contained in the key, not the value. For example, rather than + * {"instanceLimit": "100/request"}, should be returned as, + * {"instanceLimitPerRequest": "100"}, if the client exceeds the number of + * instances that can be created in a single (batch) request. + * + * Generated from protobuf field map metadata = 3; + */ + private $metadata; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $reason + * The reason of the error. This is a constant value that identifies the + * proximate cause of the error. Error reasons are unique within a particular + * domain of errors. This should be at most 63 characters and match + * /[A-Z0-9_]+/. + * @type string $domain + * The logical grouping to which the "reason" belongs. The error domain + * is typically the registered service name of the tool or product that + * generates the error. Example: "pubsub.googleapis.com". If the error is + * generated by some common infrastructure, the error domain must be a + * globally unique value that identifies the infrastructure. For Google API + * infrastructure, the error domain is "googleapis.com". + * @type array|\Google\Protobuf\Internal\MapField $metadata + * Additional structured details about this error. + * Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in + * length. When identifying the current value of an exceeded limit, the units + * should be contained in the key, not the value. For example, rather than + * {"instanceLimit": "100/request"}, should be returned as, + * {"instanceLimitPerRequest": "100"}, if the client exceeds the number of + * instances that can be created in a single (batch) request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * The reason of the error. This is a constant value that identifies the + * proximate cause of the error. Error reasons are unique within a particular + * domain of errors. This should be at most 63 characters and match + * /[A-Z0-9_]+/. + * + * Generated from protobuf field string reason = 1; + * @return string + */ + public function getReason() + { + return $this->reason; + } + + /** + * The reason of the error. This is a constant value that identifies the + * proximate cause of the error. Error reasons are unique within a particular + * domain of errors. This should be at most 63 characters and match + * /[A-Z0-9_]+/. + * + * Generated from protobuf field string reason = 1; + * @param string $var + * @return $this + */ + public function setReason($var) + { + GPBUtil::checkString($var, True); + $this->reason = $var; + + return $this; + } + + /** + * The logical grouping to which the "reason" belongs. The error domain + * is typically the registered service name of the tool or product that + * generates the error. Example: "pubsub.googleapis.com". If the error is + * generated by some common infrastructure, the error domain must be a + * globally unique value that identifies the infrastructure. For Google API + * infrastructure, the error domain is "googleapis.com". + * + * Generated from protobuf field string domain = 2; + * @return string + */ + public function getDomain() + { + return $this->domain; + } + + /** + * The logical grouping to which the "reason" belongs. The error domain + * is typically the registered service name of the tool or product that + * generates the error. Example: "pubsub.googleapis.com". If the error is + * generated by some common infrastructure, the error domain must be a + * globally unique value that identifies the infrastructure. For Google API + * infrastructure, the error domain is "googleapis.com". + * + * Generated from protobuf field string domain = 2; + * @param string $var + * @return $this + */ + public function setDomain($var) + { + GPBUtil::checkString($var, True); + $this->domain = $var; + + return $this; + } + + /** + * Additional structured details about this error. + * Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in + * length. When identifying the current value of an exceeded limit, the units + * should be contained in the key, not the value. For example, rather than + * {"instanceLimit": "100/request"}, should be returned as, + * {"instanceLimitPerRequest": "100"}, if the client exceeds the number of + * instances that can be created in a single (batch) request. + * + * Generated from protobuf field map metadata = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMetadata() + { + return $this->metadata; + } + + /** + * Additional structured details about this error. + * Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in + * length. When identifying the current value of an exceeded limit, the units + * should be contained in the key, not the value. For example, rather than + * {"instanceLimit": "100/request"}, should be returned as, + * {"instanceLimitPerRequest": "100"}, if the client exceeds the number of + * instances that can be created in a single (batch) request. + * + * Generated from protobuf field map metadata = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->metadata = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Rpc/Help.php b/vendor/google/common-protos/src/Rpc/Help.php new file mode 100644 index 00000000..13b9c8fc --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/Help.php @@ -0,0 +1,70 @@ +google.rpc.Help + */ +class Help extends \Google\Protobuf\Internal\Message +{ + /** + * URL(s) pointing to additional information on handling the current error. + * + * Generated from protobuf field repeated .google.rpc.Help.Link links = 1; + */ + private $links; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Rpc\Help\Link[]|\Google\Protobuf\Internal\RepeatedField $links + * URL(s) pointing to additional information on handling the current error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * URL(s) pointing to additional information on handling the current error. + * + * Generated from protobuf field repeated .google.rpc.Help.Link links = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLinks() + { + return $this->links; + } + + /** + * URL(s) pointing to additional information on handling the current error. + * + * Generated from protobuf field repeated .google.rpc.Help.Link links = 1; + * @param \Google\Rpc\Help\Link[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLinks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Help\Link::class); + $this->links = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Rpc/Help/Link.php b/vendor/google/common-protos/src/Rpc/Help/Link.php new file mode 100644 index 00000000..e371232f --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/Help/Link.php @@ -0,0 +1,104 @@ +google.rpc.Help.Link + */ +class Link extends \Google\Protobuf\Internal\Message +{ + /** + * Describes what the link offers. + * + * Generated from protobuf field string description = 1; + */ + protected $description = ''; + /** + * The URL of the link. + * + * Generated from protobuf field string url = 2; + */ + protected $url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $description + * Describes what the link offers. + * @type string $url + * The URL of the link. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * Describes what the link offers. + * + * Generated from protobuf field string description = 1; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Describes what the link offers. + * + * Generated from protobuf field string description = 1; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The URL of the link. + * + * Generated from protobuf field string url = 2; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The URL of the link. + * + * Generated from protobuf field string url = 2; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Link::class, \Google\Rpc\Help_Link::class); + diff --git a/vendor/google/common-protos/src/Rpc/Help_Link.php b/vendor/google/common-protos/src/Rpc/Help_Link.php new file mode 100644 index 00000000..7cb5a685 --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/Help_Link.php @@ -0,0 +1,16 @@ +google.rpc.LocalizedMessage + */ +class LocalizedMessage extends \Google\Protobuf\Internal\Message +{ + /** + * The locale used following the specification defined at + * http://www.rfc-editor.org/rfc/bcp/bcp47.txt. + * Examples are: "en-US", "fr-CH", "es-MX" + * + * Generated from protobuf field string locale = 1; + */ + protected $locale = ''; + /** + * The localized error message in the above locale. + * + * Generated from protobuf field string message = 2; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $locale + * The locale used following the specification defined at + * http://www.rfc-editor.org/rfc/bcp/bcp47.txt. + * Examples are: "en-US", "fr-CH", "es-MX" + * @type string $message + * The localized error message in the above locale. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * The locale used following the specification defined at + * http://www.rfc-editor.org/rfc/bcp/bcp47.txt. + * Examples are: "en-US", "fr-CH", "es-MX" + * + * Generated from protobuf field string locale = 1; + * @return string + */ + public function getLocale() + { + return $this->locale; + } + + /** + * The locale used following the specification defined at + * http://www.rfc-editor.org/rfc/bcp/bcp47.txt. + * Examples are: "en-US", "fr-CH", "es-MX" + * + * Generated from protobuf field string locale = 1; + * @param string $var + * @return $this + */ + public function setLocale($var) + { + GPBUtil::checkString($var, True); + $this->locale = $var; + + return $this; + } + + /** + * The localized error message in the above locale. + * + * Generated from protobuf field string message = 2; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * The localized error message in the above locale. + * + * Generated from protobuf field string message = 2; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Rpc/PreconditionFailure.php b/vendor/google/common-protos/src/Rpc/PreconditionFailure.php new file mode 100644 index 00000000..c5889993 --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/PreconditionFailure.php @@ -0,0 +1,70 @@ +google.rpc.PreconditionFailure + */ +class PreconditionFailure extends \Google\Protobuf\Internal\Message +{ + /** + * Describes all precondition violations. + * + * Generated from protobuf field repeated .google.rpc.PreconditionFailure.Violation violations = 1; + */ + private $violations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Rpc\PreconditionFailure\Violation[]|\Google\Protobuf\Internal\RepeatedField $violations + * Describes all precondition violations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * Describes all precondition violations. + * + * Generated from protobuf field repeated .google.rpc.PreconditionFailure.Violation violations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getViolations() + { + return $this->violations; + } + + /** + * Describes all precondition violations. + * + * Generated from protobuf field repeated .google.rpc.PreconditionFailure.Violation violations = 1; + * @param \Google\Rpc\PreconditionFailure\Violation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setViolations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\PreconditionFailure\Violation::class); + $this->violations = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Rpc/PreconditionFailure/Violation.php b/vendor/google/common-protos/src/Rpc/PreconditionFailure/Violation.php new file mode 100644 index 00000000..93f04bf4 --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/PreconditionFailure/Violation.php @@ -0,0 +1,162 @@ +google.rpc.PreconditionFailure.Violation + */ +class Violation extends \Google\Protobuf\Internal\Message +{ + /** + * The type of PreconditionFailure. We recommend using a service-specific + * enum type to define the supported precondition violation subjects. For + * example, "TOS" for "Terms of Service violation". + * + * Generated from protobuf field string type = 1; + */ + protected $type = ''; + /** + * The subject, relative to the type, that failed. + * For example, "google.com/cloud" relative to the "TOS" type would indicate + * which terms of service is being referenced. + * + * Generated from protobuf field string subject = 2; + */ + protected $subject = ''; + /** + * A description of how the precondition failed. Developers can use this + * description to understand how to fix the failure. + * For example: "Terms of service not accepted". + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * The type of PreconditionFailure. We recommend using a service-specific + * enum type to define the supported precondition violation subjects. For + * example, "TOS" for "Terms of Service violation". + * @type string $subject + * The subject, relative to the type, that failed. + * For example, "google.com/cloud" relative to the "TOS" type would indicate + * which terms of service is being referenced. + * @type string $description + * A description of how the precondition failed. Developers can use this + * description to understand how to fix the failure. + * For example: "Terms of service not accepted". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * The type of PreconditionFailure. We recommend using a service-specific + * enum type to define the supported precondition violation subjects. For + * example, "TOS" for "Terms of Service violation". + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The type of PreconditionFailure. We recommend using a service-specific + * enum type to define the supported precondition violation subjects. For + * example, "TOS" for "Terms of Service violation". + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The subject, relative to the type, that failed. + * For example, "google.com/cloud" relative to the "TOS" type would indicate + * which terms of service is being referenced. + * + * Generated from protobuf field string subject = 2; + * @return string + */ + public function getSubject() + { + return $this->subject; + } + + /** + * The subject, relative to the type, that failed. + * For example, "google.com/cloud" relative to the "TOS" type would indicate + * which terms of service is being referenced. + * + * Generated from protobuf field string subject = 2; + * @param string $var + * @return $this + */ + public function setSubject($var) + { + GPBUtil::checkString($var, True); + $this->subject = $var; + + return $this; + } + + /** + * A description of how the precondition failed. Developers can use this + * description to understand how to fix the failure. + * For example: "Terms of service not accepted". + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A description of how the precondition failed. Developers can use this + * description to understand how to fix the failure. + * For example: "Terms of service not accepted". + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Violation::class, \Google\Rpc\PreconditionFailure_Violation::class); + diff --git a/vendor/google/common-protos/src/Rpc/PreconditionFailure_Violation.php b/vendor/google/common-protos/src/Rpc/PreconditionFailure_Violation.php new file mode 100644 index 00000000..e2d091be --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/PreconditionFailure_Violation.php @@ -0,0 +1,16 @@ +google.rpc.QuotaFailure + */ +class QuotaFailure extends \Google\Protobuf\Internal\Message +{ + /** + * Describes all quota violations. + * + * Generated from protobuf field repeated .google.rpc.QuotaFailure.Violation violations = 1; + */ + private $violations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Rpc\QuotaFailure\Violation[]|\Google\Protobuf\Internal\RepeatedField $violations + * Describes all quota violations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * Describes all quota violations. + * + * Generated from protobuf field repeated .google.rpc.QuotaFailure.Violation violations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getViolations() + { + return $this->violations; + } + + /** + * Describes all quota violations. + * + * Generated from protobuf field repeated .google.rpc.QuotaFailure.Violation violations = 1; + * @param \Google\Rpc\QuotaFailure\Violation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setViolations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\QuotaFailure\Violation::class); + $this->violations = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Rpc/QuotaFailure/Violation.php b/vendor/google/common-protos/src/Rpc/QuotaFailure/Violation.php new file mode 100644 index 00000000..86a35fb2 --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/QuotaFailure/Violation.php @@ -0,0 +1,133 @@ +google.rpc.QuotaFailure.Violation + */ +class Violation extends \Google\Protobuf\Internal\Message +{ + /** + * The subject on which the quota check failed. + * For example, "clientip:" or "project:". + * + * Generated from protobuf field string subject = 1; + */ + protected $subject = ''; + /** + * A description of how the quota check failed. Clients can use this + * description to find more about the quota configuration in the service's + * public documentation, or find the relevant quota limit to adjust through + * developer console. + * For example: "Service disabled" or "Daily Limit for read operations + * exceeded". + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subject + * The subject on which the quota check failed. + * For example, "clientip:" or "project:". + * @type string $description + * A description of how the quota check failed. Clients can use this + * description to find more about the quota configuration in the service's + * public documentation, or find the relevant quota limit to adjust through + * developer console. + * For example: "Service disabled" or "Daily Limit for read operations + * exceeded". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * The subject on which the quota check failed. + * For example, "clientip:" or "project:". + * + * Generated from protobuf field string subject = 1; + * @return string + */ + public function getSubject() + { + return $this->subject; + } + + /** + * The subject on which the quota check failed. + * For example, "clientip:" or "project:". + * + * Generated from protobuf field string subject = 1; + * @param string $var + * @return $this + */ + public function setSubject($var) + { + GPBUtil::checkString($var, True); + $this->subject = $var; + + return $this; + } + + /** + * A description of how the quota check failed. Clients can use this + * description to find more about the quota configuration in the service's + * public documentation, or find the relevant quota limit to adjust through + * developer console. + * For example: "Service disabled" or "Daily Limit for read operations + * exceeded". + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A description of how the quota check failed. Clients can use this + * description to find more about the quota configuration in the service's + * public documentation, or find the relevant quota limit to adjust through + * developer console. + * For example: "Service disabled" or "Daily Limit for read operations + * exceeded". + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Violation::class, \Google\Rpc\QuotaFailure_Violation::class); + diff --git a/vendor/google/common-protos/src/Rpc/QuotaFailure_Violation.php b/vendor/google/common-protos/src/Rpc/QuotaFailure_Violation.php new file mode 100644 index 00000000..ba8bd9af --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/QuotaFailure_Violation.php @@ -0,0 +1,16 @@ +google.rpc.RequestInfo + */ +class RequestInfo extends \Google\Protobuf\Internal\Message +{ + /** + * An opaque string that should only be interpreted by the service generating + * it. For example, it can be used to identify requests in the service's logs. + * + * Generated from protobuf field string request_id = 1; + */ + protected $request_id = ''; + /** + * Any data that was used to serve this request. For example, an encrypted + * stack trace that can be sent back to the service provider for debugging. + * + * Generated from protobuf field string serving_data = 2; + */ + protected $serving_data = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $request_id + * An opaque string that should only be interpreted by the service generating + * it. For example, it can be used to identify requests in the service's logs. + * @type string $serving_data + * Any data that was used to serve this request. For example, an encrypted + * stack trace that can be sent back to the service provider for debugging. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * An opaque string that should only be interpreted by the service generating + * it. For example, it can be used to identify requests in the service's logs. + * + * Generated from protobuf field string request_id = 1; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * An opaque string that should only be interpreted by the service generating + * it. For example, it can be used to identify requests in the service's logs. + * + * Generated from protobuf field string request_id = 1; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Any data that was used to serve this request. For example, an encrypted + * stack trace that can be sent back to the service provider for debugging. + * + * Generated from protobuf field string serving_data = 2; + * @return string + */ + public function getServingData() + { + return $this->serving_data; + } + + /** + * Any data that was used to serve this request. For example, an encrypted + * stack trace that can be sent back to the service provider for debugging. + * + * Generated from protobuf field string serving_data = 2; + * @param string $var + * @return $this + */ + public function setServingData($var) + { + GPBUtil::checkString($var, True); + $this->serving_data = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Rpc/ResourceInfo.php b/vendor/google/common-protos/src/Rpc/ResourceInfo.php new file mode 100644 index 00000000..d665c89b --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/ResourceInfo.php @@ -0,0 +1,201 @@ +google.rpc.ResourceInfo + */ +class ResourceInfo extends \Google\Protobuf\Internal\Message +{ + /** + * A name for the type of resource being accessed, e.g. "sql table", + * "cloud storage bucket", "file", "Google calendar"; or the type URL + * of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". + * + * Generated from protobuf field string resource_type = 1; + */ + protected $resource_type = ''; + /** + * The name of the resource being accessed. For example, a shared calendar + * name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current + * error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. + * + * Generated from protobuf field string resource_name = 2; + */ + protected $resource_name = ''; + /** + * The owner of the resource (optional). + * For example, "user:" or "project:". + * + * Generated from protobuf field string owner = 3; + */ + protected $owner = ''; + /** + * Describes what error is encountered when accessing this resource. + * For example, updating a cloud project may require the `writer` permission + * on the developer console project. + * + * Generated from protobuf field string description = 4; + */ + protected $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $resource_type + * A name for the type of resource being accessed, e.g. "sql table", + * "cloud storage bucket", "file", "Google calendar"; or the type URL + * of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". + * @type string $resource_name + * The name of the resource being accessed. For example, a shared calendar + * name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current + * error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. + * @type string $owner + * The owner of the resource (optional). + * For example, "user:" or "project:". + * @type string $description + * Describes what error is encountered when accessing this resource. + * For example, updating a cloud project may require the `writer` permission + * on the developer console project. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * A name for the type of resource being accessed, e.g. "sql table", + * "cloud storage bucket", "file", "Google calendar"; or the type URL + * of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". + * + * Generated from protobuf field string resource_type = 1; + * @return string + */ + public function getResourceType() + { + return $this->resource_type; + } + + /** + * A name for the type of resource being accessed, e.g. "sql table", + * "cloud storage bucket", "file", "Google calendar"; or the type URL + * of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". + * + * Generated from protobuf field string resource_type = 1; + * @param string $var + * @return $this + */ + public function setResourceType($var) + { + GPBUtil::checkString($var, True); + $this->resource_type = $var; + + return $this; + } + + /** + * The name of the resource being accessed. For example, a shared calendar + * name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current + * error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. + * + * Generated from protobuf field string resource_name = 2; + * @return string + */ + public function getResourceName() + { + return $this->resource_name; + } + + /** + * The name of the resource being accessed. For example, a shared calendar + * name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current + * error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. + * + * Generated from protobuf field string resource_name = 2; + * @param string $var + * @return $this + */ + public function setResourceName($var) + { + GPBUtil::checkString($var, True); + $this->resource_name = $var; + + return $this; + } + + /** + * The owner of the resource (optional). + * For example, "user:" or "project:". + * + * Generated from protobuf field string owner = 3; + * @return string + */ + public function getOwner() + { + return $this->owner; + } + + /** + * The owner of the resource (optional). + * For example, "user:" or "project:". + * + * Generated from protobuf field string owner = 3; + * @param string $var + * @return $this + */ + public function setOwner($var) + { + GPBUtil::checkString($var, True); + $this->owner = $var; + + return $this; + } + + /** + * Describes what error is encountered when accessing this resource. + * For example, updating a cloud project may require the `writer` permission + * on the developer console project. + * + * Generated from protobuf field string description = 4; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Describes what error is encountered when accessing this resource. + * For example, updating a cloud project may require the `writer` permission + * on the developer console project. + * + * Generated from protobuf field string description = 4; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Rpc/RetryInfo.php b/vendor/google/common-protos/src/Rpc/RetryInfo.php new file mode 100644 index 00000000..3d391bae --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/RetryInfo.php @@ -0,0 +1,87 @@ +google.rpc.RetryInfo + */ +class RetryInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Clients should wait at least this long between retrying the same request. + * + * Generated from protobuf field .google.protobuf.Duration retry_delay = 1; + */ + protected $retry_delay = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $retry_delay + * Clients should wait at least this long between retrying the same request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); + parent::__construct($data); + } + + /** + * Clients should wait at least this long between retrying the same request. + * + * Generated from protobuf field .google.protobuf.Duration retry_delay = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getRetryDelay() + { + return $this->retry_delay; + } + + public function hasRetryDelay() + { + return isset($this->retry_delay); + } + + public function clearRetryDelay() + { + unset($this->retry_delay); + } + + /** + * Clients should wait at least this long between retrying the same request. + * + * Generated from protobuf field .google.protobuf.Duration retry_delay = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setRetryDelay($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->retry_delay = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Rpc/Status.php b/vendor/google/common-protos/src/Rpc/Status.php new file mode 100644 index 00000000..c88f4cac --- /dev/null +++ b/vendor/google/common-protos/src/Rpc/Status.php @@ -0,0 +1,152 @@ +google.rpc.Status + */ +class Status extends \Google\Protobuf\Internal\Message +{ + /** + * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + * + * Generated from protobuf field int32 code = 1; + */ + protected $code = 0; + /** + * A developer-facing error message, which should be in English. Any + * user-facing error message should be localized and sent in the + * [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + * + * Generated from protobuf field string message = 2; + */ + protected $message = ''; + /** + * A list of messages that carry the error details. There is a common set of + * message types for APIs to use. + * + * Generated from protobuf field repeated .google.protobuf.Any details = 3; + */ + private $details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + * @type string $message + * A developer-facing error message, which should be in English. Any + * user-facing error message should be localized and sent in the + * [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + * @type \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $details + * A list of messages that carry the error details. There is a common set of + * message types for APIs to use. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Rpc\Status::initOnce(); + parent::__construct($data); + } + + /** + * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + * + * Generated from protobuf field int32 code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + * + * Generated from protobuf field int32 code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkInt32($var); + $this->code = $var; + + return $this; + } + + /** + * A developer-facing error message, which should be in English. Any + * user-facing error message should be localized and sent in the + * [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + * + * Generated from protobuf field string message = 2; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * A developer-facing error message, which should be in English. Any + * user-facing error message should be localized and sent in the + * [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + * + * Generated from protobuf field string message = 2; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * A list of messages that carry the error details. There is a common set of + * message types for APIs to use. + * + * Generated from protobuf field repeated .google.protobuf.Any details = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetails() + { + return $this->details; + } + + /** + * A list of messages that carry the error details. There is a common set of + * message types for APIs to use. + * + * Generated from protobuf field repeated .google.protobuf.Any details = 3; + * @param \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class); + $this->details = $arr; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Type/CalendarPeriod.php b/vendor/google/common-protos/src/Type/CalendarPeriod.php new file mode 100644 index 00000000..e4807c07 --- /dev/null +++ b/vendor/google/common-protos/src/Type/CalendarPeriod.php @@ -0,0 +1,102 @@ +google.type.CalendarPeriod + */ +class CalendarPeriod +{ + /** + * Undefined period, raises an error. + * + * Generated from protobuf enum CALENDAR_PERIOD_UNSPECIFIED = 0; + */ + const CALENDAR_PERIOD_UNSPECIFIED = 0; + /** + * A day. + * + * Generated from protobuf enum DAY = 1; + */ + const DAY = 1; + /** + * A week. Weeks begin on Monday, following + * [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date). + * + * Generated from protobuf enum WEEK = 2; + */ + const WEEK = 2; + /** + * A fortnight. The first calendar fortnight of the year begins at the start + * of week 1 according to + * [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date). + * + * Generated from protobuf enum FORTNIGHT = 3; + */ + const FORTNIGHT = 3; + /** + * A month. + * + * Generated from protobuf enum MONTH = 4; + */ + const MONTH = 4; + /** + * A quarter. Quarters start on dates 1-Jan, 1-Apr, 1-Jul, and 1-Oct of each + * year. + * + * Generated from protobuf enum QUARTER = 5; + */ + const QUARTER = 5; + /** + * A half-year. Half-years start on dates 1-Jan and 1-Jul. + * + * Generated from protobuf enum HALF = 6; + */ + const HALF = 6; + /** + * A year. + * + * Generated from protobuf enum YEAR = 7; + */ + const YEAR = 7; + + private static $valueToName = [ + self::CALENDAR_PERIOD_UNSPECIFIED => 'CALENDAR_PERIOD_UNSPECIFIED', + self::DAY => 'DAY', + self::WEEK => 'WEEK', + self::FORTNIGHT => 'FORTNIGHT', + self::MONTH => 'MONTH', + self::QUARTER => 'QUARTER', + self::HALF => 'HALF', + self::YEAR => 'YEAR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/vendor/google/common-protos/src/Type/Color.php b/vendor/google/common-protos/src/Type/Color.php new file mode 100644 index 00000000..9414504f --- /dev/null +++ b/vendor/google/common-protos/src/Type/Color.php @@ -0,0 +1,348 @@ +google.type.Color + */ +class Color extends \Google\Protobuf\Internal\Message +{ + /** + * The amount of red in the color as a value in the interval [0, 1]. + * + * Generated from protobuf field float red = 1; + */ + private $red = 0.0; + /** + * The amount of green in the color as a value in the interval [0, 1]. + * + * Generated from protobuf field float green = 2; + */ + private $green = 0.0; + /** + * The amount of blue in the color as a value in the interval [0, 1]. + * + * Generated from protobuf field float blue = 3; + */ + private $blue = 0.0; + /** + * The fraction of this color that should be applied to the pixel. That is, + * the final pixel color is defined by the equation: + * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) + * This means that a value of 1.0 corresponds to a solid color, whereas + * a value of 0.0 corresponds to a completely transparent color. This + * uses a wrapper message rather than a simple float scalar so that it is + * possible to distinguish between a default value and the value being unset. + * If omitted, this color object is to be rendered as a solid color + * (as if the alpha value had been explicitly given with a value of 1.0). + * + * Generated from protobuf field .google.protobuf.FloatValue alpha = 4; + */ + private $alpha = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $red + * The amount of red in the color as a value in the interval [0, 1]. + * @type float $green + * The amount of green in the color as a value in the interval [0, 1]. + * @type float $blue + * The amount of blue in the color as a value in the interval [0, 1]. + * @type \Google\Protobuf\FloatValue $alpha + * The fraction of this color that should be applied to the pixel. That is, + * the final pixel color is defined by the equation: + * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) + * This means that a value of 1.0 corresponds to a solid color, whereas + * a value of 0.0 corresponds to a completely transparent color. This + * uses a wrapper message rather than a simple float scalar so that it is + * possible to distinguish between a default value and the value being unset. + * If omitted, this color object is to be rendered as a solid color + * (as if the alpha value had been explicitly given with a value of 1.0). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Type\Color::initOnce(); + parent::__construct($data); + } + + /** + * The amount of red in the color as a value in the interval [0, 1]. + * + * Generated from protobuf field float red = 1; + * @return float + */ + public function getRed() + { + return $this->red; + } + + /** + * The amount of red in the color as a value in the interval [0, 1]. + * + * Generated from protobuf field float red = 1; + * @param float $var + * @return $this + */ + public function setRed($var) + { + GPBUtil::checkFloat($var); + $this->red = $var; + + return $this; + } + + /** + * The amount of green in the color as a value in the interval [0, 1]. + * + * Generated from protobuf field float green = 2; + * @return float + */ + public function getGreen() + { + return $this->green; + } + + /** + * The amount of green in the color as a value in the interval [0, 1]. + * + * Generated from protobuf field float green = 2; + * @param float $var + * @return $this + */ + public function setGreen($var) + { + GPBUtil::checkFloat($var); + $this->green = $var; + + return $this; + } + + /** + * The amount of blue in the color as a value in the interval [0, 1]. + * + * Generated from protobuf field float blue = 3; + * @return float + */ + public function getBlue() + { + return $this->blue; + } + + /** + * The amount of blue in the color as a value in the interval [0, 1]. + * + * Generated from protobuf field float blue = 3; + * @param float $var + * @return $this + */ + public function setBlue($var) + { + GPBUtil::checkFloat($var); + $this->blue = $var; + + return $this; + } + + /** + * The fraction of this color that should be applied to the pixel. That is, + * the final pixel color is defined by the equation: + * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) + * This means that a value of 1.0 corresponds to a solid color, whereas + * a value of 0.0 corresponds to a completely transparent color. This + * uses a wrapper message rather than a simple float scalar so that it is + * possible to distinguish between a default value and the value being unset. + * If omitted, this color object is to be rendered as a solid color + * (as if the alpha value had been explicitly given with a value of 1.0). + * + * Generated from protobuf field .google.protobuf.FloatValue alpha = 4; + * @return \Google\Protobuf\FloatValue + */ + public function getAlpha() + { + return $this->alpha; + } + + /** + * Returns the unboxed value from getAlpha() + + * The fraction of this color that should be applied to the pixel. That is, + * the final pixel color is defined by the equation: + * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) + * This means that a value of 1.0 corresponds to a solid color, whereas + * a value of 0.0 corresponds to a completely transparent color. This + * uses a wrapper message rather than a simple float scalar so that it is + * possible to distinguish between a default value and the value being unset. + * If omitted, this color object is to be rendered as a solid color + * (as if the alpha value had been explicitly given with a value of 1.0). + * + * Generated from protobuf field .google.protobuf.FloatValue alpha = 4; + * @return float|null + */ + public function getAlphaUnwrapped() + { + $wrapper = $this->getAlpha(); + return is_null($wrapper) ? null : $wrapper->getValue(); + } + + /** + * The fraction of this color that should be applied to the pixel. That is, + * the final pixel color is defined by the equation: + * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) + * This means that a value of 1.0 corresponds to a solid color, whereas + * a value of 0.0 corresponds to a completely transparent color. This + * uses a wrapper message rather than a simple float scalar so that it is + * possible to distinguish between a default value and the value being unset. + * If omitted, this color object is to be rendered as a solid color + * (as if the alpha value had been explicitly given with a value of 1.0). + * + * Generated from protobuf field .google.protobuf.FloatValue alpha = 4; + * @param \Google\Protobuf\FloatValue $var + * @return $this + */ + public function setAlpha($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FloatValue::class); + $this->alpha = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\FloatValue object. + + * The fraction of this color that should be applied to the pixel. That is, + * the final pixel color is defined by the equation: + * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) + * This means that a value of 1.0 corresponds to a solid color, whereas + * a value of 0.0 corresponds to a completely transparent color. This + * uses a wrapper message rather than a simple float scalar so that it is + * possible to distinguish between a default value and the value being unset. + * If omitted, this color object is to be rendered as a solid color + * (as if the alpha value had been explicitly given with a value of 1.0). + * + * Generated from protobuf field .google.protobuf.FloatValue alpha = 4; + * @param float|null $var + * @return $this + */ + public function setAlphaUnwrapped($var) + { + $wrappedVar = is_null($var) ? null : new \Google\Protobuf\FloatValue(['value' => $var]); + return $this->setAlpha($wrappedVar); + } + +} + diff --git a/vendor/google/common-protos/src/Type/Date.php b/vendor/google/common-protos/src/Type/Date.php new file mode 100644 index 00000000..e9d36a4d --- /dev/null +++ b/vendor/google/common-protos/src/Type/Date.php @@ -0,0 +1,158 @@ +google.type.Date + */ +class Date extends \Google\Protobuf\Internal\Message +{ + /** + * Year of date. Must be from 1 to 9999, or 0 if specifying a date without + * a year. + * + * Generated from protobuf field int32 year = 1; + */ + private $year = 0; + /** + * Month of year. Must be from 1 to 12, or 0 if specifying a year without a + * month and day. + * + * Generated from protobuf field int32 month = 2; + */ + private $month = 0; + /** + * Day of month. Must be from 1 to 31 and valid for the year and month, or 0 + * if specifying a year by itself or a year and month where the day is not + * significant. + * + * Generated from protobuf field int32 day = 3; + */ + private $day = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $year + * Year of date. Must be from 1 to 9999, or 0 if specifying a date without + * a year. + * @type int $month + * Month of year. Must be from 1 to 12, or 0 if specifying a year without a + * month and day. + * @type int $day + * Day of month. Must be from 1 to 31 and valid for the year and month, or 0 + * if specifying a year by itself or a year and month where the day is not + * significant. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Type\Date::initOnce(); + parent::__construct($data); + } + + /** + * Year of date. Must be from 1 to 9999, or 0 if specifying a date without + * a year. + * + * Generated from protobuf field int32 year = 1; + * @return int + */ + public function getYear() + { + return $this->year; + } + + /** + * Year of date. Must be from 1 to 9999, or 0 if specifying a date without + * a year. + * + * Generated from protobuf field int32 year = 1; + * @param int $var + * @return $this + */ + public function setYear($var) + { + GPBUtil::checkInt32($var); + $this->year = $var; + + return $this; + } + + /** + * Month of year. Must be from 1 to 12, or 0 if specifying a year without a + * month and day. + * + * Generated from protobuf field int32 month = 2; + * @return int + */ + public function getMonth() + { + return $this->month; + } + + /** + * Month of year. Must be from 1 to 12, or 0 if specifying a year without a + * month and day. + * + * Generated from protobuf field int32 month = 2; + * @param int $var + * @return $this + */ + public function setMonth($var) + { + GPBUtil::checkInt32($var); + $this->month = $var; + + return $this; + } + + /** + * Day of month. Must be from 1 to 31 and valid for the year and month, or 0 + * if specifying a year by itself or a year and month where the day is not + * significant. + * + * Generated from protobuf field int32 day = 3; + * @return int + */ + public function getDay() + { + return $this->day; + } + + /** + * Day of month. Must be from 1 to 31 and valid for the year and month, or 0 + * if specifying a year by itself or a year and month where the day is not + * significant. + * + * Generated from protobuf field int32 day = 3; + * @param int $var + * @return $this + */ + public function setDay($var) + { + GPBUtil::checkInt32($var); + $this->day = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Type/DateTime.php b/vendor/google/common-protos/src/Type/DateTime.php new file mode 100644 index 00000000..15131cb8 --- /dev/null +++ b/vendor/google/common-protos/src/Type/DateTime.php @@ -0,0 +1,377 @@ +google.type.DateTime + */ +class DateTime extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a + * datetime without a year. + * + * Generated from protobuf field int32 year = 1; + */ + private $year = 0; + /** + * Required. Month of year. Must be from 1 to 12. + * + * Generated from protobuf field int32 month = 2; + */ + private $month = 0; + /** + * Required. Day of month. Must be from 1 to 31 and valid for the year and + * month. + * + * Generated from protobuf field int32 day = 3; + */ + private $day = 0; + /** + * Required. Hours of day in 24 hour format. Should be from 0 to 23. An API + * may choose to allow the value "24:00:00" for scenarios like business + * closing time. + * + * Generated from protobuf field int32 hours = 4; + */ + private $hours = 0; + /** + * Required. Minutes of hour of day. Must be from 0 to 59. + * + * Generated from protobuf field int32 minutes = 5; + */ + private $minutes = 0; + /** + * Required. Seconds of minutes of the time. Must normally be from 0 to 59. An + * API may allow the value 60 if it allows leap-seconds. + * + * Generated from protobuf field int32 seconds = 6; + */ + private $seconds = 0; + /** + * Required. Fractions of seconds in nanoseconds. Must be from 0 to + * 999,999,999. + * + * Generated from protobuf field int32 nanos = 7; + */ + private $nanos = 0; + protected $time_offset; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $year + * Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a + * datetime without a year. + * @type int $month + * Required. Month of year. Must be from 1 to 12. + * @type int $day + * Required. Day of month. Must be from 1 to 31 and valid for the year and + * month. + * @type int $hours + * Required. Hours of day in 24 hour format. Should be from 0 to 23. An API + * may choose to allow the value "24:00:00" for scenarios like business + * closing time. + * @type int $minutes + * Required. Minutes of hour of day. Must be from 0 to 59. + * @type int $seconds + * Required. Seconds of minutes of the time. Must normally be from 0 to 59. An + * API may allow the value 60 if it allows leap-seconds. + * @type int $nanos + * Required. Fractions of seconds in nanoseconds. Must be from 0 to + * 999,999,999. + * @type \Google\Protobuf\Duration $utc_offset + * UTC offset. Must be whole seconds, between -18 hours and +18 hours. + * For example, a UTC offset of -4:00 would be represented as + * { seconds: -14400 }. + * @type \Google\Type\TimeZone $time_zone + * Time zone. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Type\Datetime::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a + * datetime without a year. + * + * Generated from protobuf field int32 year = 1; + * @return int + */ + public function getYear() + { + return $this->year; + } + + /** + * Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a + * datetime without a year. + * + * Generated from protobuf field int32 year = 1; + * @param int $var + * @return $this + */ + public function setYear($var) + { + GPBUtil::checkInt32($var); + $this->year = $var; + + return $this; + } + + /** + * Required. Month of year. Must be from 1 to 12. + * + * Generated from protobuf field int32 month = 2; + * @return int + */ + public function getMonth() + { + return $this->month; + } + + /** + * Required. Month of year. Must be from 1 to 12. + * + * Generated from protobuf field int32 month = 2; + * @param int $var + * @return $this + */ + public function setMonth($var) + { + GPBUtil::checkInt32($var); + $this->month = $var; + + return $this; + } + + /** + * Required. Day of month. Must be from 1 to 31 and valid for the year and + * month. + * + * Generated from protobuf field int32 day = 3; + * @return int + */ + public function getDay() + { + return $this->day; + } + + /** + * Required. Day of month. Must be from 1 to 31 and valid for the year and + * month. + * + * Generated from protobuf field int32 day = 3; + * @param int $var + * @return $this + */ + public function setDay($var) + { + GPBUtil::checkInt32($var); + $this->day = $var; + + return $this; + } + + /** + * Required. Hours of day in 24 hour format. Should be from 0 to 23. An API + * may choose to allow the value "24:00:00" for scenarios like business + * closing time. + * + * Generated from protobuf field int32 hours = 4; + * @return int + */ + public function getHours() + { + return $this->hours; + } + + /** + * Required. Hours of day in 24 hour format. Should be from 0 to 23. An API + * may choose to allow the value "24:00:00" for scenarios like business + * closing time. + * + * Generated from protobuf field int32 hours = 4; + * @param int $var + * @return $this + */ + public function setHours($var) + { + GPBUtil::checkInt32($var); + $this->hours = $var; + + return $this; + } + + /** + * Required. Minutes of hour of day. Must be from 0 to 59. + * + * Generated from protobuf field int32 minutes = 5; + * @return int + */ + public function getMinutes() + { + return $this->minutes; + } + + /** + * Required. Minutes of hour of day. Must be from 0 to 59. + * + * Generated from protobuf field int32 minutes = 5; + * @param int $var + * @return $this + */ + public function setMinutes($var) + { + GPBUtil::checkInt32($var); + $this->minutes = $var; + + return $this; + } + + /** + * Required. Seconds of minutes of the time. Must normally be from 0 to 59. An + * API may allow the value 60 if it allows leap-seconds. + * + * Generated from protobuf field int32 seconds = 6; + * @return int + */ + public function getSeconds() + { + return $this->seconds; + } + + /** + * Required. Seconds of minutes of the time. Must normally be from 0 to 59. An + * API may allow the value 60 if it allows leap-seconds. + * + * Generated from protobuf field int32 seconds = 6; + * @param int $var + * @return $this + */ + public function setSeconds($var) + { + GPBUtil::checkInt32($var); + $this->seconds = $var; + + return $this; + } + + /** + * Required. Fractions of seconds in nanoseconds. Must be from 0 to + * 999,999,999. + * + * Generated from protobuf field int32 nanos = 7; + * @return int + */ + public function getNanos() + { + return $this->nanos; + } + + /** + * Required. Fractions of seconds in nanoseconds. Must be from 0 to + * 999,999,999. + * + * Generated from protobuf field int32 nanos = 7; + * @param int $var + * @return $this + */ + public function setNanos($var) + { + GPBUtil::checkInt32($var); + $this->nanos = $var; + + return $this; + } + + /** + * UTC offset. Must be whole seconds, between -18 hours and +18 hours. + * For example, a UTC offset of -4:00 would be represented as + * { seconds: -14400 }. + * + * Generated from protobuf field .google.protobuf.Duration utc_offset = 8; + * @return \Google\Protobuf\Duration + */ + public function getUtcOffset() + { + return $this->readOneof(8); + } + + /** + * UTC offset. Must be whole seconds, between -18 hours and +18 hours. + * For example, a UTC offset of -4:00 would be represented as + * { seconds: -14400 }. + * + * Generated from protobuf field .google.protobuf.Duration utc_offset = 8; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setUtcOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Time zone. + * + * Generated from protobuf field .google.type.TimeZone time_zone = 9; + * @return \Google\Type\TimeZone + */ + public function getTimeZone() + { + return $this->readOneof(9); + } + + /** + * Time zone. + * + * Generated from protobuf field .google.type.TimeZone time_zone = 9; + * @param \Google\Type\TimeZone $var + * @return $this + */ + public function setTimeZone($var) + { + GPBUtil::checkMessage($var, \Google\Type\TimeZone::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * @return string + */ + public function getTimeOffset() + { + return $this->whichOneof("time_offset"); + } + +} + diff --git a/vendor/google/common-protos/src/Type/DayOfWeek.php b/vendor/google/common-protos/src/Type/DayOfWeek.php new file mode 100644 index 00000000..151e4ef9 --- /dev/null +++ b/vendor/google/common-protos/src/Type/DayOfWeek.php @@ -0,0 +1,96 @@ +google.type.DayOfWeek + */ +class DayOfWeek +{ + /** + * The unspecified day-of-week. + * + * Generated from protobuf enum DAY_OF_WEEK_UNSPECIFIED = 0; + */ + const DAY_OF_WEEK_UNSPECIFIED = 0; + /** + * The day-of-week of Monday. + * + * Generated from protobuf enum MONDAY = 1; + */ + const MONDAY = 1; + /** + * The day-of-week of Tuesday. + * + * Generated from protobuf enum TUESDAY = 2; + */ + const TUESDAY = 2; + /** + * The day-of-week of Wednesday. + * + * Generated from protobuf enum WEDNESDAY = 3; + */ + const WEDNESDAY = 3; + /** + * The day-of-week of Thursday. + * + * Generated from protobuf enum THURSDAY = 4; + */ + const THURSDAY = 4; + /** + * The day-of-week of Friday. + * + * Generated from protobuf enum FRIDAY = 5; + */ + const FRIDAY = 5; + /** + * The day-of-week of Saturday. + * + * Generated from protobuf enum SATURDAY = 6; + */ + const SATURDAY = 6; + /** + * The day-of-week of Sunday. + * + * Generated from protobuf enum SUNDAY = 7; + */ + const SUNDAY = 7; + + private static $valueToName = [ + self::DAY_OF_WEEK_UNSPECIFIED => 'DAY_OF_WEEK_UNSPECIFIED', + self::MONDAY => 'MONDAY', + self::TUESDAY => 'TUESDAY', + self::WEDNESDAY => 'WEDNESDAY', + self::THURSDAY => 'THURSDAY', + self::FRIDAY => 'FRIDAY', + self::SATURDAY => 'SATURDAY', + self::SUNDAY => 'SUNDAY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/vendor/google/common-protos/src/Type/Expr.php b/vendor/google/common-protos/src/Type/Expr.php new file mode 100644 index 00000000..63ab1e03 --- /dev/null +++ b/vendor/google/common-protos/src/Type/Expr.php @@ -0,0 +1,200 @@ + 0" + * + * Generated from protobuf message google.type.Expr + */ +class Expr extends \Google\Protobuf\Internal\Message +{ + /** + * Textual representation of an expression in + * Common Expression Language syntax. + * The application context of the containing message determines which + * well-known feature set of CEL is supported. + * + * Generated from protobuf field string expression = 1; + */ + private $expression = ''; + /** + * An optional title for the expression, i.e. a short string describing + * its purpose. This can be used e.g. in UIs which allow to enter the + * expression. + * + * Generated from protobuf field string title = 2; + */ + private $title = ''; + /** + * An optional description of the expression. This is a longer text which + * describes the expression, e.g. when hovered over it in a UI. + * + * Generated from protobuf field string description = 3; + */ + private $description = ''; + /** + * An optional string indicating the location of the expression for error + * reporting, e.g. a file name and a position in the file. + * + * Generated from protobuf field string location = 4; + */ + private $location = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $expression + * Textual representation of an expression in + * Common Expression Language syntax. + * The application context of the containing message determines which + * well-known feature set of CEL is supported. + * @type string $title + * An optional title for the expression, i.e. a short string describing + * its purpose. This can be used e.g. in UIs which allow to enter the + * expression. + * @type string $description + * An optional description of the expression. This is a longer text which + * describes the expression, e.g. when hovered over it in a UI. + * @type string $location + * An optional string indicating the location of the expression for error + * reporting, e.g. a file name and a position in the file. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Type\Expr::initOnce(); + parent::__construct($data); + } + + /** + * Textual representation of an expression in + * Common Expression Language syntax. + * The application context of the containing message determines which + * well-known feature set of CEL is supported. + * + * Generated from protobuf field string expression = 1; + * @return string + */ + public function getExpression() + { + return $this->expression; + } + + /** + * Textual representation of an expression in + * Common Expression Language syntax. + * The application context of the containing message determines which + * well-known feature set of CEL is supported. + * + * Generated from protobuf field string expression = 1; + * @param string $var + * @return $this + */ + public function setExpression($var) + { + GPBUtil::checkString($var, True); + $this->expression = $var; + + return $this; + } + + /** + * An optional title for the expression, i.e. a short string describing + * its purpose. This can be used e.g. in UIs which allow to enter the + * expression. + * + * Generated from protobuf field string title = 2; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * An optional title for the expression, i.e. a short string describing + * its purpose. This can be used e.g. in UIs which allow to enter the + * expression. + * + * Generated from protobuf field string title = 2; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * An optional description of the expression. This is a longer text which + * describes the expression, e.g. when hovered over it in a UI. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * An optional description of the expression. This is a longer text which + * describes the expression, e.g. when hovered over it in a UI. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * An optional string indicating the location of the expression for error + * reporting, e.g. a file name and a position in the file. + * + * Generated from protobuf field string location = 4; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * An optional string indicating the location of the expression for error + * reporting, e.g. a file name and a position in the file. + * + * Generated from protobuf field string location = 4; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Type/Fraction.php b/vendor/google/common-protos/src/Type/Fraction.php new file mode 100644 index 00000000..d159cb7d --- /dev/null +++ b/vendor/google/common-protos/src/Type/Fraction.php @@ -0,0 +1,105 @@ +google.type.Fraction + */ +class Fraction extends \Google\Protobuf\Internal\Message +{ + /** + * The portion of the denominator in the faction, e.g. 2 in 2/3. + * + * Generated from protobuf field int64 numerator = 1; + */ + private $numerator = 0; + /** + * The value by which the numerator is divided, e.g. 3 in 2/3. Must be + * positive. + * + * Generated from protobuf field int64 denominator = 2; + */ + private $denominator = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $numerator + * The portion of the denominator in the faction, e.g. 2 in 2/3. + * @type int|string $denominator + * The value by which the numerator is divided, e.g. 3 in 2/3. Must be + * positive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Type\Fraction::initOnce(); + parent::__construct($data); + } + + /** + * The portion of the denominator in the faction, e.g. 2 in 2/3. + * + * Generated from protobuf field int64 numerator = 1; + * @return int|string + */ + public function getNumerator() + { + return $this->numerator; + } + + /** + * The portion of the denominator in the faction, e.g. 2 in 2/3. + * + * Generated from protobuf field int64 numerator = 1; + * @param int|string $var + * @return $this + */ + public function setNumerator($var) + { + GPBUtil::checkInt64($var); + $this->numerator = $var; + + return $this; + } + + /** + * The value by which the numerator is divided, e.g. 3 in 2/3. Must be + * positive. + * + * Generated from protobuf field int64 denominator = 2; + * @return int|string + */ + public function getDenominator() + { + return $this->denominator; + } + + /** + * The value by which the numerator is divided, e.g. 3 in 2/3. Must be + * positive. + * + * Generated from protobuf field int64 denominator = 2; + * @param int|string $var + * @return $this + */ + public function setDenominator($var) + { + GPBUtil::checkInt64($var); + $this->denominator = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Type/LatLng.php b/vendor/google/common-protos/src/Type/LatLng.php new file mode 100644 index 00000000..0292b2b8 --- /dev/null +++ b/vendor/google/common-protos/src/Type/LatLng.php @@ -0,0 +1,105 @@ +WGS84 + * standard. Values must be within normalized ranges. + * + * Generated from protobuf message google.type.LatLng + */ +class LatLng extends \Google\Protobuf\Internal\Message +{ + /** + * The latitude in degrees. It must be in the range [-90.0, +90.0]. + * + * Generated from protobuf field double latitude = 1; + */ + private $latitude = 0.0; + /** + * The longitude in degrees. It must be in the range [-180.0, +180.0]. + * + * Generated from protobuf field double longitude = 2; + */ + private $longitude = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $latitude + * The latitude in degrees. It must be in the range [-90.0, +90.0]. + * @type float $longitude + * The longitude in degrees. It must be in the range [-180.0, +180.0]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Type\Latlng::initOnce(); + parent::__construct($data); + } + + /** + * The latitude in degrees. It must be in the range [-90.0, +90.0]. + * + * Generated from protobuf field double latitude = 1; + * @return float + */ + public function getLatitude() + { + return $this->latitude; + } + + /** + * The latitude in degrees. It must be in the range [-90.0, +90.0]. + * + * Generated from protobuf field double latitude = 1; + * @param float $var + * @return $this + */ + public function setLatitude($var) + { + GPBUtil::checkDouble($var); + $this->latitude = $var; + + return $this; + } + + /** + * The longitude in degrees. It must be in the range [-180.0, +180.0]. + * + * Generated from protobuf field double longitude = 2; + * @return float + */ + public function getLongitude() + { + return $this->longitude; + } + + /** + * The longitude in degrees. It must be in the range [-180.0, +180.0]. + * + * Generated from protobuf field double longitude = 2; + * @param float $var + * @return $this + */ + public function setLongitude($var) + { + GPBUtil::checkDouble($var); + $this->longitude = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Type/Money.php b/vendor/google/common-protos/src/Type/Money.php new file mode 100644 index 00000000..3ca03337 --- /dev/null +++ b/vendor/google/common-protos/src/Type/Money.php @@ -0,0 +1,159 @@ +google.type.Money + */ +class Money extends \Google\Protobuf\Internal\Message +{ + /** + * The 3-letter currency code defined in ISO 4217. + * + * Generated from protobuf field string currency_code = 1; + */ + private $currency_code = ''; + /** + * The whole units of the amount. + * For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + * + * Generated from protobuf field int64 units = 2; + */ + private $units = 0; + /** + * Number of nano (10^-9) units of the amount. + * The value must be between -999,999,999 and +999,999,999 inclusive. + * If `units` is positive, `nanos` must be positive or zero. + * If `units` is zero, `nanos` can be positive, zero, or negative. + * If `units` is negative, `nanos` must be negative or zero. + * For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + * + * Generated from protobuf field int32 nanos = 3; + */ + private $nanos = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $currency_code + * The 3-letter currency code defined in ISO 4217. + * @type int|string $units + * The whole units of the amount. + * For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + * @type int $nanos + * Number of nano (10^-9) units of the amount. + * The value must be between -999,999,999 and +999,999,999 inclusive. + * If `units` is positive, `nanos` must be positive or zero. + * If `units` is zero, `nanos` can be positive, zero, or negative. + * If `units` is negative, `nanos` must be negative or zero. + * For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Type\Money::initOnce(); + parent::__construct($data); + } + + /** + * The 3-letter currency code defined in ISO 4217. + * + * Generated from protobuf field string currency_code = 1; + * @return string + */ + public function getCurrencyCode() + { + return $this->currency_code; + } + + /** + * The 3-letter currency code defined in ISO 4217. + * + * Generated from protobuf field string currency_code = 1; + * @param string $var + * @return $this + */ + public function setCurrencyCode($var) + { + GPBUtil::checkString($var, True); + $this->currency_code = $var; + + return $this; + } + + /** + * The whole units of the amount. + * For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + * + * Generated from protobuf field int64 units = 2; + * @return int|string + */ + public function getUnits() + { + return $this->units; + } + + /** + * The whole units of the amount. + * For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + * + * Generated from protobuf field int64 units = 2; + * @param int|string $var + * @return $this + */ + public function setUnits($var) + { + GPBUtil::checkInt64($var); + $this->units = $var; + + return $this; + } + + /** + * Number of nano (10^-9) units of the amount. + * The value must be between -999,999,999 and +999,999,999 inclusive. + * If `units` is positive, `nanos` must be positive or zero. + * If `units` is zero, `nanos` can be positive, zero, or negative. + * If `units` is negative, `nanos` must be negative or zero. + * For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + * + * Generated from protobuf field int32 nanos = 3; + * @return int + */ + public function getNanos() + { + return $this->nanos; + } + + /** + * Number of nano (10^-9) units of the amount. + * The value must be between -999,999,999 and +999,999,999 inclusive. + * If `units` is positive, `nanos` must be positive or zero. + * If `units` is zero, `nanos` can be positive, zero, or negative. + * If `units` is negative, `nanos` must be negative or zero. + * For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + * + * Generated from protobuf field int32 nanos = 3; + * @param int $var + * @return $this + */ + public function setNanos($var) + { + GPBUtil::checkInt32($var); + $this->nanos = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Type/Month.php b/vendor/google/common-protos/src/Type/Month.php new file mode 100644 index 00000000..c1cb6be4 --- /dev/null +++ b/vendor/google/common-protos/src/Type/Month.php @@ -0,0 +1,131 @@ +google.type.Month + */ +class Month +{ + /** + * The unspecifed month. + * + * Generated from protobuf enum MONTH_UNSPECIFIED = 0; + */ + const MONTH_UNSPECIFIED = 0; + /** + * The month of January. + * + * Generated from protobuf enum JANUARY = 1; + */ + const JANUARY = 1; + /** + * The month of February. + * + * Generated from protobuf enum FEBRUARY = 2; + */ + const FEBRUARY = 2; + /** + * The month of March. + * + * Generated from protobuf enum MARCH = 3; + */ + const MARCH = 3; + /** + * The month of April. + * + * Generated from protobuf enum APRIL = 4; + */ + const APRIL = 4; + /** + * The month of May. + * + * Generated from protobuf enum MAY = 5; + */ + const MAY = 5; + /** + * The month of June. + * + * Generated from protobuf enum JUNE = 6; + */ + const JUNE = 6; + /** + * The month of July. + * + * Generated from protobuf enum JULY = 7; + */ + const JULY = 7; + /** + * The month of August. + * + * Generated from protobuf enum AUGUST = 8; + */ + const AUGUST = 8; + /** + * The month of September. + * + * Generated from protobuf enum SEPTEMBER = 9; + */ + const SEPTEMBER = 9; + /** + * The month of October. + * + * Generated from protobuf enum OCTOBER = 10; + */ + const OCTOBER = 10; + /** + * The month of November. + * + * Generated from protobuf enum NOVEMBER = 11; + */ + const NOVEMBER = 11; + /** + * The month of December. + * + * Generated from protobuf enum DECEMBER = 12; + */ + const DECEMBER = 12; + + private static $valueToName = [ + self::MONTH_UNSPECIFIED => 'MONTH_UNSPECIFIED', + self::JANUARY => 'JANUARY', + self::FEBRUARY => 'FEBRUARY', + self::MARCH => 'MARCH', + self::APRIL => 'APRIL', + self::MAY => 'MAY', + self::JUNE => 'JUNE', + self::JULY => 'JULY', + self::AUGUST => 'AUGUST', + self::SEPTEMBER => 'SEPTEMBER', + self::OCTOBER => 'OCTOBER', + self::NOVEMBER => 'NOVEMBER', + self::DECEMBER => 'DECEMBER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/vendor/google/common-protos/src/Type/PostalAddress.php b/vendor/google/common-protos/src/Type/PostalAddress.php new file mode 100644 index 00000000..dc086b69 --- /dev/null +++ b/vendor/google/common-protos/src/Type/PostalAddress.php @@ -0,0 +1,628 @@ +google.type.PostalAddress + */ +class PostalAddress extends \Google\Protobuf\Internal\Message +{ + /** + * The schema revision of the `PostalAddress`. This must be set to 0, which is + * the latest revision. + * All new revisions **must** be backward compatible with old revisions. + * + * Generated from protobuf field int32 revision = 1; + */ + private $revision = 0; + /** + * Required. CLDR region code of the country/region of the address. This + * is never inferred and it is up to the user to ensure the value is + * correct. See http://cldr.unicode.org/ and + * http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html + * for details. Example: "CH" for Switzerland. + * + * Generated from protobuf field string region_code = 2; + */ + private $region_code = ''; + /** + * Optional. BCP-47 language code of the contents of this address (if + * known). This is often the UI language of the input form or is expected + * to match one of the languages used in the address' country/region, or their + * transliterated equivalents. + * This can affect formatting in certain countries, but is not critical + * to the correctness of the data and will never affect any validation or + * other non-formatting related operations. + * If this value is not known, it should be omitted (rather than specifying a + * possibly incorrect default). + * Examples: "zh-Hant", "ja", "ja-Latn", "en". + * + * Generated from protobuf field string language_code = 3; + */ + private $language_code = ''; + /** + * Optional. Postal code of the address. Not all countries use or require + * postal codes to be present, but where they are used, they may trigger + * additional validation with other parts of the address (e.g. state/zip + * validation in the U.S.A.). + * + * Generated from protobuf field string postal_code = 4; + */ + private $postal_code = ''; + /** + * Optional. Additional, country-specific, sorting code. This is not used + * in most regions. Where it is used, the value is either a string like + * "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number + * alone, representing the "sector code" (Jamaica), "delivery area indicator" + * (Malawi) or "post office indicator" (e.g. Côte d'Ivoire). + * + * Generated from protobuf field string sorting_code = 5; + */ + private $sorting_code = ''; + /** + * Optional. Highest administrative subdivision which is used for postal + * addresses of a country or region. + * For example, this can be a state, a province, an oblast, or a prefecture. + * Specifically, for Spain this is the province and not the autonomous + * community (e.g. "Barcelona" and not "Catalonia"). + * Many countries don't use an administrative area in postal addresses. E.g. + * in Switzerland this should be left unpopulated. + * + * Generated from protobuf field string administrative_area = 6; + */ + private $administrative_area = ''; + /** + * Optional. Generally refers to the city/town portion of the address. + * Examples: US city, IT comune, UK post town. + * In regions of the world where localities are not well defined or do not fit + * into this structure well, leave locality empty and use address_lines. + * + * Generated from protobuf field string locality = 7; + */ + private $locality = ''; + /** + * Optional. Sublocality of the address. + * For example, this can be neighborhoods, boroughs, districts. + * + * Generated from protobuf field string sublocality = 8; + */ + private $sublocality = ''; + /** + * Unstructured address lines describing the lower levels of an address. + * Because values in address_lines do not have type information and may + * sometimes contain multiple values in a single field (e.g. + * "Austin, TX"), it is important that the line order is clear. The order of + * address lines should be "envelope order" for the country/region of the + * address. In places where this can vary (e.g. Japan), address_language is + * used to make it explicit (e.g. "ja" for large-to-small ordering and + * "ja-Latn" or "en" for small-to-large). This way, the most specific line of + * an address can be selected based on the language. + * The minimum permitted structural representation of an address consists + * of a region_code with all remaining information placed in the + * address_lines. It would be possible to format such an address very + * approximately without geocoding, but no semantic reasoning could be + * made about any of the address components until it was at least + * partially resolved. + * Creating an address only containing a region_code and address_lines, and + * then geocoding is the recommended way to handle completely unstructured + * addresses (as opposed to guessing which parts of the address should be + * localities or administrative areas). + * + * Generated from protobuf field repeated string address_lines = 9; + */ + private $address_lines; + /** + * Optional. The recipient at the address. + * This field may, under certain circumstances, contain multiline information. + * For example, it might contain "care of" information. + * + * Generated from protobuf field repeated string recipients = 10; + */ + private $recipients; + /** + * Optional. The name of the organization at the address. + * + * Generated from protobuf field string organization = 11; + */ + private $organization = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $revision + * The schema revision of the `PostalAddress`. This must be set to 0, which is + * the latest revision. + * All new revisions **must** be backward compatible with old revisions. + * @type string $region_code + * Required. CLDR region code of the country/region of the address. This + * is never inferred and it is up to the user to ensure the value is + * correct. See http://cldr.unicode.org/ and + * http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html + * for details. Example: "CH" for Switzerland. + * @type string $language_code + * Optional. BCP-47 language code of the contents of this address (if + * known). This is often the UI language of the input form or is expected + * to match one of the languages used in the address' country/region, or their + * transliterated equivalents. + * This can affect formatting in certain countries, but is not critical + * to the correctness of the data and will never affect any validation or + * other non-formatting related operations. + * If this value is not known, it should be omitted (rather than specifying a + * possibly incorrect default). + * Examples: "zh-Hant", "ja", "ja-Latn", "en". + * @type string $postal_code + * Optional. Postal code of the address. Not all countries use or require + * postal codes to be present, but where they are used, they may trigger + * additional validation with other parts of the address (e.g. state/zip + * validation in the U.S.A.). + * @type string $sorting_code + * Optional. Additional, country-specific, sorting code. This is not used + * in most regions. Where it is used, the value is either a string like + * "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number + * alone, representing the "sector code" (Jamaica), "delivery area indicator" + * (Malawi) or "post office indicator" (e.g. Côte d'Ivoire). + * @type string $administrative_area + * Optional. Highest administrative subdivision which is used for postal + * addresses of a country or region. + * For example, this can be a state, a province, an oblast, or a prefecture. + * Specifically, for Spain this is the province and not the autonomous + * community (e.g. "Barcelona" and not "Catalonia"). + * Many countries don't use an administrative area in postal addresses. E.g. + * in Switzerland this should be left unpopulated. + * @type string $locality + * Optional. Generally refers to the city/town portion of the address. + * Examples: US city, IT comune, UK post town. + * In regions of the world where localities are not well defined or do not fit + * into this structure well, leave locality empty and use address_lines. + * @type string $sublocality + * Optional. Sublocality of the address. + * For example, this can be neighborhoods, boroughs, districts. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $address_lines + * Unstructured address lines describing the lower levels of an address. + * Because values in address_lines do not have type information and may + * sometimes contain multiple values in a single field (e.g. + * "Austin, TX"), it is important that the line order is clear. The order of + * address lines should be "envelope order" for the country/region of the + * address. In places where this can vary (e.g. Japan), address_language is + * used to make it explicit (e.g. "ja" for large-to-small ordering and + * "ja-Latn" or "en" for small-to-large). This way, the most specific line of + * an address can be selected based on the language. + * The minimum permitted structural representation of an address consists + * of a region_code with all remaining information placed in the + * address_lines. It would be possible to format such an address very + * approximately without geocoding, but no semantic reasoning could be + * made about any of the address components until it was at least + * partially resolved. + * Creating an address only containing a region_code and address_lines, and + * then geocoding is the recommended way to handle completely unstructured + * addresses (as opposed to guessing which parts of the address should be + * localities or administrative areas). + * @type string[]|\Google\Protobuf\Internal\RepeatedField $recipients + * Optional. The recipient at the address. + * This field may, under certain circumstances, contain multiline information. + * For example, it might contain "care of" information. + * @type string $organization + * Optional. The name of the organization at the address. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Type\PostalAddress::initOnce(); + parent::__construct($data); + } + + /** + * The schema revision of the `PostalAddress`. This must be set to 0, which is + * the latest revision. + * All new revisions **must** be backward compatible with old revisions. + * + * Generated from protobuf field int32 revision = 1; + * @return int + */ + public function getRevision() + { + return $this->revision; + } + + /** + * The schema revision of the `PostalAddress`. This must be set to 0, which is + * the latest revision. + * All new revisions **must** be backward compatible with old revisions. + * + * Generated from protobuf field int32 revision = 1; + * @param int $var + * @return $this + */ + public function setRevision($var) + { + GPBUtil::checkInt32($var); + $this->revision = $var; + + return $this; + } + + /** + * Required. CLDR region code of the country/region of the address. This + * is never inferred and it is up to the user to ensure the value is + * correct. See http://cldr.unicode.org/ and + * http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html + * for details. Example: "CH" for Switzerland. + * + * Generated from protobuf field string region_code = 2; + * @return string + */ + public function getRegionCode() + { + return $this->region_code; + } + + /** + * Required. CLDR region code of the country/region of the address. This + * is never inferred and it is up to the user to ensure the value is + * correct. See http://cldr.unicode.org/ and + * http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html + * for details. Example: "CH" for Switzerland. + * + * Generated from protobuf field string region_code = 2; + * @param string $var + * @return $this + */ + public function setRegionCode($var) + { + GPBUtil::checkString($var, True); + $this->region_code = $var; + + return $this; + } + + /** + * Optional. BCP-47 language code of the contents of this address (if + * known). This is often the UI language of the input form or is expected + * to match one of the languages used in the address' country/region, or their + * transliterated equivalents. + * This can affect formatting in certain countries, but is not critical + * to the correctness of the data and will never affect any validation or + * other non-formatting related operations. + * If this value is not known, it should be omitted (rather than specifying a + * possibly incorrect default). + * Examples: "zh-Hant", "ja", "ja-Latn", "en". + * + * Generated from protobuf field string language_code = 3; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Optional. BCP-47 language code of the contents of this address (if + * known). This is often the UI language of the input form or is expected + * to match one of the languages used in the address' country/region, or their + * transliterated equivalents. + * This can affect formatting in certain countries, but is not critical + * to the correctness of the data and will never affect any validation or + * other non-formatting related operations. + * If this value is not known, it should be omitted (rather than specifying a + * possibly incorrect default). + * Examples: "zh-Hant", "ja", "ja-Latn", "en". + * + * Generated from protobuf field string language_code = 3; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * Optional. Postal code of the address. Not all countries use or require + * postal codes to be present, but where they are used, they may trigger + * additional validation with other parts of the address (e.g. state/zip + * validation in the U.S.A.). + * + * Generated from protobuf field string postal_code = 4; + * @return string + */ + public function getPostalCode() + { + return $this->postal_code; + } + + /** + * Optional. Postal code of the address. Not all countries use or require + * postal codes to be present, but where they are used, they may trigger + * additional validation with other parts of the address (e.g. state/zip + * validation in the U.S.A.). + * + * Generated from protobuf field string postal_code = 4; + * @param string $var + * @return $this + */ + public function setPostalCode($var) + { + GPBUtil::checkString($var, True); + $this->postal_code = $var; + + return $this; + } + + /** + * Optional. Additional, country-specific, sorting code. This is not used + * in most regions. Where it is used, the value is either a string like + * "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number + * alone, representing the "sector code" (Jamaica), "delivery area indicator" + * (Malawi) or "post office indicator" (e.g. Côte d'Ivoire). + * + * Generated from protobuf field string sorting_code = 5; + * @return string + */ + public function getSortingCode() + { + return $this->sorting_code; + } + + /** + * Optional. Additional, country-specific, sorting code. This is not used + * in most regions. Where it is used, the value is either a string like + * "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number + * alone, representing the "sector code" (Jamaica), "delivery area indicator" + * (Malawi) or "post office indicator" (e.g. Côte d'Ivoire). + * + * Generated from protobuf field string sorting_code = 5; + * @param string $var + * @return $this + */ + public function setSortingCode($var) + { + GPBUtil::checkString($var, True); + $this->sorting_code = $var; + + return $this; + } + + /** + * Optional. Highest administrative subdivision which is used for postal + * addresses of a country or region. + * For example, this can be a state, a province, an oblast, or a prefecture. + * Specifically, for Spain this is the province and not the autonomous + * community (e.g. "Barcelona" and not "Catalonia"). + * Many countries don't use an administrative area in postal addresses. E.g. + * in Switzerland this should be left unpopulated. + * + * Generated from protobuf field string administrative_area = 6; + * @return string + */ + public function getAdministrativeArea() + { + return $this->administrative_area; + } + + /** + * Optional. Highest administrative subdivision which is used for postal + * addresses of a country or region. + * For example, this can be a state, a province, an oblast, or a prefecture. + * Specifically, for Spain this is the province and not the autonomous + * community (e.g. "Barcelona" and not "Catalonia"). + * Many countries don't use an administrative area in postal addresses. E.g. + * in Switzerland this should be left unpopulated. + * + * Generated from protobuf field string administrative_area = 6; + * @param string $var + * @return $this + */ + public function setAdministrativeArea($var) + { + GPBUtil::checkString($var, True); + $this->administrative_area = $var; + + return $this; + } + + /** + * Optional. Generally refers to the city/town portion of the address. + * Examples: US city, IT comune, UK post town. + * In regions of the world where localities are not well defined or do not fit + * into this structure well, leave locality empty and use address_lines. + * + * Generated from protobuf field string locality = 7; + * @return string + */ + public function getLocality() + { + return $this->locality; + } + + /** + * Optional. Generally refers to the city/town portion of the address. + * Examples: US city, IT comune, UK post town. + * In regions of the world where localities are not well defined or do not fit + * into this structure well, leave locality empty and use address_lines. + * + * Generated from protobuf field string locality = 7; + * @param string $var + * @return $this + */ + public function setLocality($var) + { + GPBUtil::checkString($var, True); + $this->locality = $var; + + return $this; + } + + /** + * Optional. Sublocality of the address. + * For example, this can be neighborhoods, boroughs, districts. + * + * Generated from protobuf field string sublocality = 8; + * @return string + */ + public function getSublocality() + { + return $this->sublocality; + } + + /** + * Optional. Sublocality of the address. + * For example, this can be neighborhoods, boroughs, districts. + * + * Generated from protobuf field string sublocality = 8; + * @param string $var + * @return $this + */ + public function setSublocality($var) + { + GPBUtil::checkString($var, True); + $this->sublocality = $var; + + return $this; + } + + /** + * Unstructured address lines describing the lower levels of an address. + * Because values in address_lines do not have type information and may + * sometimes contain multiple values in a single field (e.g. + * "Austin, TX"), it is important that the line order is clear. The order of + * address lines should be "envelope order" for the country/region of the + * address. In places where this can vary (e.g. Japan), address_language is + * used to make it explicit (e.g. "ja" for large-to-small ordering and + * "ja-Latn" or "en" for small-to-large). This way, the most specific line of + * an address can be selected based on the language. + * The minimum permitted structural representation of an address consists + * of a region_code with all remaining information placed in the + * address_lines. It would be possible to format such an address very + * approximately without geocoding, but no semantic reasoning could be + * made about any of the address components until it was at least + * partially resolved. + * Creating an address only containing a region_code and address_lines, and + * then geocoding is the recommended way to handle completely unstructured + * addresses (as opposed to guessing which parts of the address should be + * localities or administrative areas). + * + * Generated from protobuf field repeated string address_lines = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAddressLines() + { + return $this->address_lines; + } + + /** + * Unstructured address lines describing the lower levels of an address. + * Because values in address_lines do not have type information and may + * sometimes contain multiple values in a single field (e.g. + * "Austin, TX"), it is important that the line order is clear. The order of + * address lines should be "envelope order" for the country/region of the + * address. In places where this can vary (e.g. Japan), address_language is + * used to make it explicit (e.g. "ja" for large-to-small ordering and + * "ja-Latn" or "en" for small-to-large). This way, the most specific line of + * an address can be selected based on the language. + * The minimum permitted structural representation of an address consists + * of a region_code with all remaining information placed in the + * address_lines. It would be possible to format such an address very + * approximately without geocoding, but no semantic reasoning could be + * made about any of the address components until it was at least + * partially resolved. + * Creating an address only containing a region_code and address_lines, and + * then geocoding is the recommended way to handle completely unstructured + * addresses (as opposed to guessing which parts of the address should be + * localities or administrative areas). + * + * Generated from protobuf field repeated string address_lines = 9; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAddressLines($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->address_lines = $arr; + + return $this; + } + + /** + * Optional. The recipient at the address. + * This field may, under certain circumstances, contain multiline information. + * For example, it might contain "care of" information. + * + * Generated from protobuf field repeated string recipients = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRecipients() + { + return $this->recipients; + } + + /** + * Optional. The recipient at the address. + * This field may, under certain circumstances, contain multiline information. + * For example, it might contain "care of" information. + * + * Generated from protobuf field repeated string recipients = 10; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRecipients($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->recipients = $arr; + + return $this; + } + + /** + * Optional. The name of the organization at the address. + * + * Generated from protobuf field string organization = 11; + * @return string + */ + public function getOrganization() + { + return $this->organization; + } + + /** + * Optional. The name of the organization at the address. + * + * Generated from protobuf field string organization = 11; + * @param string $var + * @return $this + */ + public function setOrganization($var) + { + GPBUtil::checkString($var, True); + $this->organization = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Type/Quaternion.php b/vendor/google/common-protos/src/Type/Quaternion.php new file mode 100644 index 00000000..e8664e55 --- /dev/null +++ b/vendor/google/common-protos/src/Type/Quaternion.php @@ -0,0 +1,211 @@ +google.type.Quaternion + */ +class Quaternion extends \Google\Protobuf\Internal\Message +{ + /** + * The x component. + * + * Generated from protobuf field double x = 1; + */ + private $x = 0.0; + /** + * The y component. + * + * Generated from protobuf field double y = 2; + */ + private $y = 0.0; + /** + * The z component. + * + * Generated from protobuf field double z = 3; + */ + private $z = 0.0; + /** + * The scalar component. + * + * Generated from protobuf field double w = 4; + */ + private $w = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $x + * The x component. + * @type float $y + * The y component. + * @type float $z + * The z component. + * @type float $w + * The scalar component. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Type\Quaternion::initOnce(); + parent::__construct($data); + } + + /** + * The x component. + * + * Generated from protobuf field double x = 1; + * @return float + */ + public function getX() + { + return $this->x; + } + + /** + * The x component. + * + * Generated from protobuf field double x = 1; + * @param float $var + * @return $this + */ + public function setX($var) + { + GPBUtil::checkDouble($var); + $this->x = $var; + + return $this; + } + + /** + * The y component. + * + * Generated from protobuf field double y = 2; + * @return float + */ + public function getY() + { + return $this->y; + } + + /** + * The y component. + * + * Generated from protobuf field double y = 2; + * @param float $var + * @return $this + */ + public function setY($var) + { + GPBUtil::checkDouble($var); + $this->y = $var; + + return $this; + } + + /** + * The z component. + * + * Generated from protobuf field double z = 3; + * @return float + */ + public function getZ() + { + return $this->z; + } + + /** + * The z component. + * + * Generated from protobuf field double z = 3; + * @param float $var + * @return $this + */ + public function setZ($var) + { + GPBUtil::checkDouble($var); + $this->z = $var; + + return $this; + } + + /** + * The scalar component. + * + * Generated from protobuf field double w = 4; + * @return float + */ + public function getW() + { + return $this->w; + } + + /** + * The scalar component. + * + * Generated from protobuf field double w = 4; + * @param float $var + * @return $this + */ + public function setW($var) + { + GPBUtil::checkDouble($var); + $this->w = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Type/TimeOfDay.php b/vendor/google/common-protos/src/Type/TimeOfDay.php new file mode 100644 index 00000000..4117d848 --- /dev/null +++ b/vendor/google/common-protos/src/Type/TimeOfDay.php @@ -0,0 +1,179 @@ +google.type.TimeOfDay + */ +class TimeOfDay extends \Google\Protobuf\Internal\Message +{ + /** + * Hours of day in 24 hour format. Should be from 0 to 23. An API may choose + * to allow the value "24:00:00" for scenarios like business closing time. + * + * Generated from protobuf field int32 hours = 1; + */ + private $hours = 0; + /** + * Minutes of hour of day. Must be from 0 to 59. + * + * Generated from protobuf field int32 minutes = 2; + */ + private $minutes = 0; + /** + * Seconds of minutes of the time. Must normally be from 0 to 59. An API may + * allow the value 60 if it allows leap-seconds. + * + * Generated from protobuf field int32 seconds = 3; + */ + private $seconds = 0; + /** + * Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + * + * Generated from protobuf field int32 nanos = 4; + */ + private $nanos = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $hours + * Hours of day in 24 hour format. Should be from 0 to 23. An API may choose + * to allow the value "24:00:00" for scenarios like business closing time. + * @type int $minutes + * Minutes of hour of day. Must be from 0 to 59. + * @type int $seconds + * Seconds of minutes of the time. Must normally be from 0 to 59. An API may + * allow the value 60 if it allows leap-seconds. + * @type int $nanos + * Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Type\Timeofday::initOnce(); + parent::__construct($data); + } + + /** + * Hours of day in 24 hour format. Should be from 0 to 23. An API may choose + * to allow the value "24:00:00" for scenarios like business closing time. + * + * Generated from protobuf field int32 hours = 1; + * @return int + */ + public function getHours() + { + return $this->hours; + } + + /** + * Hours of day in 24 hour format. Should be from 0 to 23. An API may choose + * to allow the value "24:00:00" for scenarios like business closing time. + * + * Generated from protobuf field int32 hours = 1; + * @param int $var + * @return $this + */ + public function setHours($var) + { + GPBUtil::checkInt32($var); + $this->hours = $var; + + return $this; + } + + /** + * Minutes of hour of day. Must be from 0 to 59. + * + * Generated from protobuf field int32 minutes = 2; + * @return int + */ + public function getMinutes() + { + return $this->minutes; + } + + /** + * Minutes of hour of day. Must be from 0 to 59. + * + * Generated from protobuf field int32 minutes = 2; + * @param int $var + * @return $this + */ + public function setMinutes($var) + { + GPBUtil::checkInt32($var); + $this->minutes = $var; + + return $this; + } + + /** + * Seconds of minutes of the time. Must normally be from 0 to 59. An API may + * allow the value 60 if it allows leap-seconds. + * + * Generated from protobuf field int32 seconds = 3; + * @return int + */ + public function getSeconds() + { + return $this->seconds; + } + + /** + * Seconds of minutes of the time. Must normally be from 0 to 59. An API may + * allow the value 60 if it allows leap-seconds. + * + * Generated from protobuf field int32 seconds = 3; + * @param int $var + * @return $this + */ + public function setSeconds($var) + { + GPBUtil::checkInt32($var); + $this->seconds = $var; + + return $this; + } + + /** + * Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + * + * Generated from protobuf field int32 nanos = 4; + * @return int + */ + public function getNanos() + { + return $this->nanos; + } + + /** + * Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + * + * Generated from protobuf field int32 nanos = 4; + * @param int $var + * @return $this + */ + public function setNanos($var) + { + GPBUtil::checkInt32($var); + $this->nanos = $var; + + return $this; + } + +} + diff --git a/vendor/google/common-protos/src/Type/TimeZone.php b/vendor/google/common-protos/src/Type/TimeZone.php new file mode 100644 index 00000000..6aa16caa --- /dev/null +++ b/vendor/google/common-protos/src/Type/TimeZone.php @@ -0,0 +1,102 @@ +google.type.TimeZone + */ +class TimeZone extends \Google\Protobuf\Internal\Message +{ + /** + * IANA Time Zone Database time zone, e.g. "America/New_York". + * + * Generated from protobuf field string id = 1; + */ + private $id = ''; + /** + * Optional. IANA Time Zone Database version number, e.g. "2019a". + * + * Generated from protobuf field string version = 2; + */ + private $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * IANA Time Zone Database time zone, e.g. "America/New_York". + * @type string $version + * Optional. IANA Time Zone Database version number, e.g. "2019a". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Type\Datetime::initOnce(); + parent::__construct($data); + } + + /** + * IANA Time Zone Database time zone, e.g. "America/New_York". + * + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * IANA Time Zone Database time zone, e.g. "America/New_York". + * + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Optional. IANA Time Zone Database version number, e.g. "2019a". + * + * Generated from protobuf field string version = 2; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Optional. IANA Time Zone Database version number, e.g. "2019a". + * + * Generated from protobuf field string version = 2; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/vendor/google/gax/CODE_OF_CONDUCT.md b/vendor/google/gax/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..46b2a08e --- /dev/null +++ b/vendor/google/gax/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/vendor/google/gax/LICENSE b/vendor/google/gax/LICENSE new file mode 100644 index 00000000..1839ff93 --- /dev/null +++ b/vendor/google/gax/LICENSE @@ -0,0 +1,25 @@ +Copyright 2016, Google Inc. +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 Google 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 +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/google/gax/README.md b/vendor/google/gax/README.md new file mode 100644 index 00000000..ff9c7524 --- /dev/null +++ b/vendor/google/gax/README.md @@ -0,0 +1,98 @@ +# Google API Core for PHP + +![Build Status](https://github.com/googleapis/gax-php/actions/workflows/tests.yml/badge.svg)) + +- [Documentation](http://googleapis.github.io/gax-php) + +Google API Core for PHP (gax-php) is a set of modules which aids the development +of APIs for clients based on [gRPC][] and Google API conventions. + +Application code will rarely need to use most of the classes within this library +directly, but code generated automatically from the API definition files in +[Google APIs][] can use services such as page streaming and retry to provide a +more convenient and idiomatic API surface to callers. + +[gRPC]: http://grpc.io +[Google APIs]: https://github.com/googleapis/googleapis/ + +## PHP Versions + +gax-php currently requires PHP 5.5 or higher. + +## Contributing + +Contributions to this library are always welcome and highly encouraged. + +See the [CONTRIBUTING][] documentation for more information on how to get +started. + +[CONTRIBUTING]: https://github.com/googleapis/gax-php/blob/main/.github/CONTRIBUTING.md + +## Versioning + +This library follows [Semantic Versioning][]. + +This library is considered GA (generally available). As such, it will not +introduce backwards-incompatible changes in any minor or patch releases. We will +address issues and requests with the highest priority. + +[Semantic Versioning]: http://semver.org/ + +## Repository Structure + +All code lives under the src/ directory. Handwritten code lives in the +src/ApiCore directory and is contained in the `Google\ApiCore` namespace. + +Generated classes for protobuf common types and LongRunning client live under +the src/ directory, in the appropriate directory and namespace. + +Code in the metadata/ directory is provided to support generated protobuf +classes, and should not be used directly. + +## Development Set-Up + +These steps describe the dependencies to install for Linux, and equivalents can +be found for Mac or Windows. + +1. Install dependencies. + + ```sh + > cd ~/ + > sudo apt-get install php php-dev libcurl3-openssl-dev php-pear php-bcmath php-xml + > curl -sS https://getcomposer.org/installer | php + > sudo pecl install protobuf + ``` + +2. Set up this repo. + + ```sh + > cd /path/to/gax-php + > cp ~/composer.phar ./ + > php composer.phar install + ``` + +3. Run tests. + + ```sh + > vendor/bin/phpunit --bootstrap tests/bootstrap.php tests + ``` + +4. Updating dependencies after changing `composer.json`: + + ```sh + > php composer.phar update + ` + ``` + +5. Formatting source: + + ```sh + > vendor/bin/phpcbf -s --standard=./ruleset.xml + > vendor/bin/phpcs -s --standard=./ruleset.xml + ``` + +## License + +BSD - See [LICENSE][] for more information. + +[LICENSE]: https://github.com/googleapis/gax-php/blob/main/LICENSE diff --git a/vendor/google/gax/SECURITY.md b/vendor/google/gax/SECURITY.md new file mode 100644 index 00000000..8b58ae9c --- /dev/null +++ b/vendor/google/gax/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/vendor/google/gax/VERSION b/vendor/google/gax/VERSION new file mode 100644 index 00000000..0eed1a29 --- /dev/null +++ b/vendor/google/gax/VERSION @@ -0,0 +1 @@ +1.12.0 diff --git a/vendor/google/gax/composer.json b/vendor/google/gax/composer.json new file mode 100644 index 00000000..d9f6910f --- /dev/null +++ b/vendor/google/gax/composer.json @@ -0,0 +1,41 @@ +{ + "name": "google/gax", + "type": "library", + "description": "Google API Core for PHP", + "keywords": ["google"], + "homepage": "https://github.com/googleapis/gax-php", + "license": "BSD-3-Clause", + "require": { + "php": ">=5.5", + "google/auth": "^1.18.0", + "google/grpc-gcp": "^0.2", + "grpc/grpc": "^1.13", + "google/protobuf": "^3.12.2", + "guzzlehttp/promises": "^1.3", + "guzzlehttp/psr7": "^1.7.0||^2", + "google/common-protos": "^1.0||^2.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36", + "squizlabs/php_codesniffer": "3.*" + }, + "conflict": { + "ext-protobuf": "<3.7.0" + }, + "autoload": { + "psr-4": { + "Google\\ApiCore\\": "src", + "GPBMetadata\\ApiCore\\": "metadata/ApiCore" + } + }, + "autoload-dev": { + "psr-4": { + "Google\\ApiCore\\Dev\\": "dev/src", + "Google\\ApiCore\\": "tests", + "GPBMetadata\\Google\\": "metadata/Google" + } + }, + "scripts": { + "regenerate-test-protos": "dev/sh/regenerate-test-protos.sh" + } +} diff --git a/vendor/google/gax/metadata/ApiCore/Testing/Mocks.php b/vendor/google/gax/metadata/ApiCore/Testing/Mocks.php new file mode 100644 index 00000000..5dcb11f0 Binary files /dev/null and b/vendor/google/gax/metadata/ApiCore/Testing/Mocks.php differ diff --git a/vendor/google/gax/metadata/Google/ApiCore/Tests/Unit/Example.php b/vendor/google/gax/metadata/Google/ApiCore/Tests/Unit/Example.php new file mode 100644 index 00000000..d958e2b5 --- /dev/null +++ b/vendor/google/gax/metadata/Google/ApiCore/Tests/Unit/Example.php @@ -0,0 +1,28 @@ +internalAddGeneratedFile(hex2bin( + "0a85010a0d6578616d706c652e70726f746f1219676f6f676c652e617069" . + "636f72652e74657374732e756e6974220b0a094d794d6573736167654244" . + "ca0219476f6f676c655c417069436f72655c54657374735c556e6974e202" . + "254750424d657461646174615c476f6f676c655c417069436f72655c5465" . + "7374735c556e6974620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/gax/metadata/README.md b/vendor/google/gax/metadata/README.md new file mode 100644 index 00000000..1bd41550 --- /dev/null +++ b/vendor/google/gax/metadata/README.md @@ -0,0 +1,6 @@ +# Google Protobuf Metadata Classes + +## WARNING! + +These classes are not intended for direct use - they exist only to support +the generated protobuf classes in src/ diff --git a/vendor/google/gax/phpunit.xml.dist b/vendor/google/gax/phpunit.xml.dist new file mode 100644 index 00000000..13acfe99 --- /dev/null +++ b/vendor/google/gax/phpunit.xml.dist @@ -0,0 +1,14 @@ + + + + + tests/Tests/Unit + + + + + src/ApiCore + + + diff --git a/vendor/google/gax/renovate.json b/vendor/google/gax/renovate.json new file mode 100644 index 00000000..6d812132 --- /dev/null +++ b/vendor/google/gax/renovate.json @@ -0,0 +1,7 @@ +{ + "extends": [ + "config:base", + ":preserveSemverRanges", + ":disableDependencyDashboard" + ] +} diff --git a/vendor/google/gax/src/AgentHeader.php b/vendor/google/gax/src/AgentHeader.php new file mode 100644 index 00000000..6eb333a8 --- /dev/null +++ b/vendor/google/gax/src/AgentHeader.php @@ -0,0 +1,140 @@ + $value) { + $metricsList[] = $key . "/" . $value; + } + return [self::AGENT_HEADER_KEY => [implode(" ", $metricsList)]]; + } + + /** + * Reads the gapic version string from a VERSION file. In order to determine the file + * location, this method follows this procedure: + * - accepts a class name $callingClass + * - identifies the file defining that class + * - searches up the directory structure for the 'src' directory + * - looks in the directory above 'src' for a file named VERSION + * + * @param string $callingClass + * @return string the gapic version + * @throws \ReflectionException + */ + public static function readGapicVersionFromFile($callingClass) + { + $callingClassFile = (new \ReflectionClass($callingClass))->getFileName(); + $versionFile = substr( + $callingClassFile, + 0, + strrpos($callingClassFile, DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR) + ) . DIRECTORY_SEPARATOR . 'VERSION'; + + return Version::readVersionFile($versionFile); + } +} diff --git a/vendor/google/gax/src/ApiException.php b/vendor/google/gax/src/ApiException.php new file mode 100644 index 00000000..62540f04 --- /dev/null +++ b/vendor/google/gax/src/ApiException.php @@ -0,0 +1,337 @@ + null, + 'metadata' => null, + 'basicMessage' => $message, + ]; + parent::__construct($message, $code, $optionalArgs['previous']); + $this->status = $status; + $this->metadata = $optionalArgs['metadata']; + $this->basicMessage = $optionalArgs['basicMessage']; + if ($this->metadata) { + $this->decodedMetadataErrorInfo = self::decodeMetadataErrorInfo($this->metadata); + } + } + + public function getStatus() + { + return $this->status; + } + + /** + * Returns null if metadata does not contain error info, or returns containsErrorInfo() array + * if the metadata does contain error info. + * @param array $metadata + * @return array|null $details { + * @type string|null $reason + * @type string|null $domain + * @type array|null $errorInfoMetadata + * } + */ + private static function decodeMetadataErrorInfo(array $metadata) + { + $details = []; + // ApiExceptions created from RPC status have metadata that is an array of objects. + if (is_object(reset($metadata))) { + $metadataRpcStatus = Serializer::decodeAnyMessages($metadata); + $details = self::containsErrorInfo($metadataRpcStatus); + } elseif (self::containsErrorInfo($metadata)) { + $details = self::containsErrorInfo($metadata); + } else { + // For GRPC-based responses, the $metadata needs to be decoded. + $metadataGrpc = Serializer::decodeMetadata($metadata); + $details = self::containsErrorInfo($metadataGrpc); + } + return $details; + } + + /** + * Returns the `reason` in ErrorInfo for an exception, or null if there is no ErrorInfo. + * @return string|null $reason + */ + public function getReason() + { + return ($this->decodedMetadataErrorInfo) ? $this->decodedMetadataErrorInfo['reason'] : null; + } + + /** + * Returns the `domain` in ErrorInfo for an exception, or null if there is no ErrorInfo. + * @return string|null $domain + */ + public function getDomain() + { + return ($this->decodedMetadataErrorInfo) ? $this->decodedMetadataErrorInfo['domain'] : null; + } + + /** + * Returns the `metadata` in ErrorInfo for an exception, or null if there is no ErrorInfo. + * @return array|null $errorInfoMetadata + */ + public function getErrorInfoMetadata() + { + return ($this->decodedMetadataErrorInfo) ? $this->decodedMetadataErrorInfo['errorInfoMetadata'] : null; + } + + /** + * @param \stdClass $status + * @return ApiException + */ + public static function createFromStdClass($status) + { + $metadata = property_exists($status, 'metadata') ? $status->metadata : null; + return self::create( + $status->details, + $status->code, + $metadata, + Serializer::decodeMetadata($metadata) + ); + } + + /** + * @param string $basicMessage + * @param int $rpcCode + * @param array|null $metadata + * @param \Exception $previous + * @return ApiException + */ + public static function createFromApiResponse( + $basicMessage, + $rpcCode, + array $metadata = null, + \Exception $previous = null + ) { + return self::create( + $basicMessage, + $rpcCode, + $metadata, + Serializer::decodeMetadata($metadata), + $previous + ); + } + + /** + * For REST-based responses, the metadata does not need to be decoded. + * + * @param string $basicMessage + * @param int $rpcCode + * @param array|null $metadata + * @param \Exception $previous + * @return ApiException + */ + public static function createFromRestApiResponse( + $basicMessage, + $rpcCode, + array $metadata = null, + \Exception $previous = null + ) { + return self::create( + $basicMessage, + $rpcCode, + $metadata, + is_null($metadata) ? [] : $metadata, + $previous + ); + } + + /** + * Checks if decoded metadata includes errorInfo message. + * If errorInfo is set, it will always contain `reason`, `domain`, and `metadata` keys. + * @param array $decodedMetadata + * @return array { + * @type string $reason + * @type string $domain + * @type array $errorInfoMetadata + * } + */ + private static function containsErrorInfo(array $decodedMetadata) + { + if (empty($decodedMetadata)) { + return []; + } + foreach ($decodedMetadata as $value) { + $isErrorInfoArray = isset($value['reason']) && isset($value['domain']) && isset($value['metadata']); + if ($isErrorInfoArray) { + return [ + 'reason' => $value['reason'], + 'domain' => $value['domain'], + 'errorInfoMetadata' => $value['metadata'], + ]; + } + } + } + + /** + * Construct an ApiException with a useful message, including decoded metadata. + * If the decoded metadata includes an errorInfo message, then the domain, reason, + * and metadata fields from that message are hoisted directly into the error. + * + * @param string $basicMessage + * @param int $rpcCode + * @param mixed[]|RepeatedField $metadata + * @param array $decodedMetadata + * @param \Exception|null $previous + * @return ApiException + */ + private static function create($basicMessage, $rpcCode, $metadata, array $decodedMetadata, $previous = null) + { + $containsErrorInfo = self::containsErrorInfo($decodedMetadata); + $rpcStatus = ApiStatus::statusFromRpcCode($rpcCode); + $messageData = [ + 'message' => $basicMessage, + 'code' => $rpcCode, + 'status' => $rpcStatus, + 'details' => $decodedMetadata + ]; + if ($containsErrorInfo) { + $messageData = array_merge($containsErrorInfo, $messageData); + } + + $message = json_encode($messageData, JSON_PRETTY_PRINT); + + if ($metadata instanceof RepeatedField) { + $metadata = iterator_to_array($metadata); + } + + return new ApiException($message, $rpcCode, $rpcStatus, [ + 'previous' => $previous, + 'metadata' => $metadata, + 'basicMessage' => $basicMessage, + ]); + } + + /** + * @param Status $status + * @return ApiException + */ + public static function createFromRpcStatus(Status $status) + { + return self::create( + $status->getMessage(), + $status->getCode(), + $status->getDetails(), + Serializer::decodeAnyMessages($status->getDetails()) + ); + } + + /** + * Creates an ApiException from a GuzzleHttp RequestException. + * + * @param RequestException $ex + * @param boolean $isStream + * @return ApiException + * @throws ValidationException + */ + public static function createFromRequestException(RequestException $ex, $isStream = false) + { + $res = $ex->getResponse(); + $body = (string) $res->getBody(); + $decoded = json_decode($body, true); + + // A streaming response body will return one error in an array. Parse + // that first (and only) error message, if provided. + if ($isStream && isset($decoded[0])) { + $decoded = $decoded[0]; + } + + if ($error = $decoded['error']) { + $basicMessage = $error['message']; + $code = isset($error['status']) + ? ApiStatus::rpcCodeFromStatus($error['status']) + : $ex->getCode(); + $metadata = isset($error['details']) ? $error['details'] : null; + return static::createFromRestApiResponse($basicMessage, $code, $metadata); + } + // Use the RPC code instead of the HTTP Status Code. + $code = ApiStatus::rpcCodeFromHttpStatusCode($res->getStatusCode()); + return static::createFromApiResponse($body, $code); + } + + /** + * @return null|string + */ + public function getBasicMessage() + { + return $this->basicMessage; + } + + /** + * @return mixed[] + */ + public function getMetadata() + { + return $this->metadata; + } + + /** + * String representation of ApiException + * @return string + */ + public function __toString() + { + return __CLASS__ . ": $this->message\n"; + } +} diff --git a/vendor/google/gax/src/ApiStatus.php b/vendor/google/gax/src/ApiStatus.php new file mode 100644 index 00000000..ea8e17b4 --- /dev/null +++ b/vendor/google/gax/src/ApiStatus.php @@ -0,0 +1,171 @@ + Code::OK, + ApiStatus::CANCELLED => Code::CANCELLED, + ApiStatus::UNKNOWN => Code::UNKNOWN, + ApiStatus::INVALID_ARGUMENT => Code::INVALID_ARGUMENT, + ApiStatus::DEADLINE_EXCEEDED => Code::DEADLINE_EXCEEDED, + ApiStatus::NOT_FOUND => Code::NOT_FOUND, + ApiStatus::ALREADY_EXISTS => Code::ALREADY_EXISTS, + ApiStatus::PERMISSION_DENIED => Code::PERMISSION_DENIED, + ApiStatus::RESOURCE_EXHAUSTED => Code::RESOURCE_EXHAUSTED, + ApiStatus::FAILED_PRECONDITION => Code::FAILED_PRECONDITION, + ApiStatus::ABORTED => Code::ABORTED, + ApiStatus::OUT_OF_RANGE => Code::OUT_OF_RANGE, + ApiStatus::UNIMPLEMENTED => Code::UNIMPLEMENTED, + ApiStatus::INTERNAL => Code::INTERNAL, + ApiStatus::UNAVAILABLE => Code::UNAVAILABLE, + ApiStatus::DATA_LOSS => Code::DATA_LOSS, + ApiStatus::UNAUTHENTICATED => Code::UNAUTHENTICATED, + ]; + private static $codeToApiStatusMap = [ + Code::OK => ApiStatus::OK, + Code::CANCELLED => ApiStatus::CANCELLED, + Code::UNKNOWN => ApiStatus::UNKNOWN, + Code::INVALID_ARGUMENT => ApiStatus::INVALID_ARGUMENT, + Code::DEADLINE_EXCEEDED => ApiStatus::DEADLINE_EXCEEDED, + Code::NOT_FOUND => ApiStatus::NOT_FOUND, + Code::ALREADY_EXISTS => ApiStatus::ALREADY_EXISTS, + Code::PERMISSION_DENIED => ApiStatus::PERMISSION_DENIED, + Code::RESOURCE_EXHAUSTED => ApiStatus::RESOURCE_EXHAUSTED, + Code::FAILED_PRECONDITION => ApiStatus::FAILED_PRECONDITION, + Code::ABORTED => ApiStatus::ABORTED, + Code::OUT_OF_RANGE => ApiStatus::OUT_OF_RANGE, + Code::UNIMPLEMENTED => ApiStatus::UNIMPLEMENTED, + Code::INTERNAL => ApiStatus::INTERNAL, + Code::UNAVAILABLE => ApiStatus::UNAVAILABLE, + Code::DATA_LOSS => ApiStatus::DATA_LOSS, + Code::UNAUTHENTICATED => ApiStatus::UNAUTHENTICATED, + ]; + private static $httpStatusCodeToRpcCodeMap = [ + 400 => Code::INVALID_ARGUMENT, + 401 => Code::UNAUTHENTICATED, + 403 => Code::PERMISSION_DENIED, + 404 => Code::NOT_FOUND, + 409 => Code::ABORTED, + 416 => Code::OUT_OF_RANGE, + 429 => Code::RESOURCE_EXHAUSTED, + 499 => Code::CANCELLED, + 501 => Code::UNIMPLEMENTED, + 503 => Code::UNAVAILABLE, + 504 => Code::DEADLINE_EXCEEDED, + ]; + + /** + * @param string $status + * @return bool + */ + public static function isValidStatus($status) + { + return array_key_exists($status, self::$apiStatusToCodeMap); + } + + /** + * @param int $code + * @return string + */ + public static function statusFromRpcCode($code) + { + if (array_key_exists($code, self::$codeToApiStatusMap)) { + return self::$codeToApiStatusMap[$code]; + } + return ApiStatus::UNRECOGNIZED_STATUS; + } + + /** + * @param string $status + * @return int + */ + public static function rpcCodeFromStatus($status) + { + if (array_key_exists($status, self::$apiStatusToCodeMap)) { + return self::$apiStatusToCodeMap[$status]; + } + return ApiStatus::UNRECOGNIZED_CODE; + } + + /** + * Maps HTTP status codes to Google\Rpc\Code codes. + * Some codes are left out because they map to multiple gRPC codes (e.g. 500). + * + * @param int $httpStatusCode + * @return int + */ + public static function rpcCodeFromHttpStatusCode($httpStatusCode) + { + if (array_key_exists($httpStatusCode, self::$httpStatusCodeToRpcCodeMap)) { + return self::$httpStatusCodeToRpcCodeMap[$httpStatusCode]; + } + // All 2xx + if ($httpStatusCode >= 200 && $httpStatusCode < 300) { + return Code::OK; + } + // All 4xx + if ($httpStatusCode >= 400 && $httpStatusCode < 500) { + return Code::FAILED_PRECONDITION; + } + // All 5xx + if ($httpStatusCode >= 500 && $httpStatusCode < 600) { + return Code::INTERNAL; + } + // Everything else (We cannot change this to Code::UNKNOWN because it would break BC) + return ApiStatus::UNRECOGNIZED_CODE; + } +} diff --git a/vendor/google/gax/src/ArrayTrait.php b/vendor/google/gax/src/ArrayTrait.php new file mode 100644 index 00000000..c79e1fda --- /dev/null +++ b/vendor/google/gax/src/ArrayTrait.php @@ -0,0 +1,128 @@ +pluck($key, $arr, false); + } + } + + return $values; + } + + /** + * Determine whether given array is associative. + * + * @param array $arr + * @return bool + */ + private function isAssoc(array $arr) + { + return array_keys($arr) !== range(0, count($arr) - 1); + } + + /** + * Just like array_filter(), but preserves falsey values except null. + * + * @param array $arr + * @return array + */ + private function arrayFilterRemoveNull(array $arr) + { + return array_filter($arr, function ($element) { + if (!is_null($element)) { + return true; + } + + return false; + }); + } + + /** + * Return a subset of an array, like pluckArray, without modifying the original array. + * + * @param array $keys + * @param array $arr + * @return array + */ + private function subsetArray(array $keys, $arr) + { + return array_intersect_key( + $arr, + array_flip($keys) + ); + } +} diff --git a/vendor/google/gax/src/BidiStream.php b/vendor/google/gax/src/BidiStream.php new file mode 100644 index 00000000..47248646 --- /dev/null +++ b/vendor/google/gax/src/BidiStream.php @@ -0,0 +1,176 @@ +call = $bidiStreamingCall; + if (array_key_exists('resourcesGetMethod', $streamingDescriptor)) { + $this->resourcesGetMethod = $streamingDescriptor['resourcesGetMethod']; + } + } + + /** + * Write request to the server. + * + * @param mixed $request The request to write + * @throws ValidationException + */ + public function write($request) + { + if ($this->isComplete) { + throw new ValidationException("Cannot call write() after streaming call is complete."); + } + if ($this->writesClosed) { + throw new ValidationException("Cannot call write() after calling closeWrite()."); + } + $this->call->write($request); + } + + /** + * Write all requests in $requests. + * + * @param mixed[] $requests An Iterable of request objects to write to the server + * + * @throws ValidationException + */ + public function writeAll($requests = []) + { + foreach ($requests as $request) { + $this->write($request); + } + } + + /** + * Inform the server that no more requests will be written. The write() function cannot be + * called after closeWrite() is called. + * @throws ValidationException + */ + public function closeWrite() + { + if ($this->isComplete) { + throw new ValidationException( + "Cannot call closeWrite() after streaming call is complete." + ); + } + if (!$this->writesClosed) { + $this->call->writesDone(); + $this->writesClosed = true; + } + } + + /** + * Read the next response from the server. Returns null if the streaming call completed + * successfully. Throws an ApiException if the streaming call failed. + * + * @throws ValidationException + * @throws ApiException + * @return mixed + */ + public function read() + { + if ($this->isComplete) { + throw new ValidationException("Cannot call read() after streaming call is complete."); + } + $resourcesGetMethod = $this->resourcesGetMethod; + if (!is_null($resourcesGetMethod)) { + if (count($this->pendingResources) === 0) { + $response = $this->call->read(); + if (!is_null($response)) { + $pendingResources = []; + foreach ($response->$resourcesGetMethod() as $resource) { + $pendingResources[] = $resource; + } + $this->pendingResources = array_reverse($pendingResources); + } + } + $result = array_pop($this->pendingResources); + } else { + $result = $this->call->read(); + } + if (is_null($result)) { + $status = $this->call->getStatus(); + $this->isComplete = true; + if (!($status->code == Code::OK)) { + throw ApiException::createFromStdClass($status); + } + } + return $result; + } + + /** + * Call closeWrite(), and read all responses from the server, until the streaming call is + * completed. Throws an ApiException if the streaming call failed. + * + * @throws ValidationException + * @throws ApiException + * @return \Generator|mixed[] + */ + public function closeWriteAndReadAll() + { + $this->closeWrite(); + $response = $this->read(); + while (!is_null($response)) { + yield $response; + $response = $this->read(); + } + } + + /** + * Return the underlying gRPC call object + * + * @return \Grpc\BidiStreamingCall|mixed + */ + public function getBidiStreamingCall() + { + return $this->call; + } +} diff --git a/vendor/google/gax/src/Call.php b/vendor/google/gax/src/Call.php new file mode 100644 index 00000000..b205ea9b --- /dev/null +++ b/vendor/google/gax/src/Call.php @@ -0,0 +1,128 @@ +method = $method; + $this->decodeType = $decodeType; + $this->message = $message; + $this->descriptor = $descriptor; + $this->callType = $callType; + } + + /** + * @return string + */ + public function getMethod() + { + return $this->method; + } + + /** + * @return int + */ + public function getCallType() + { + return $this->callType; + } + + /** + * @return string + */ + public function getDecodeType() + { + return $this->decodeType; + } + + /** + * @return mixed|Message + */ + public function getMessage() + { + return $this->message; + } + + /** + * @return array|null + */ + public function getDescriptor() + { + return $this->descriptor; + } + + /** + * @param mixed|Message $message + * @return Call + */ + public function withMessage($message) + { + return new static( + $this->method, + $this->decodeType, + $message, + $this->descriptor, + $this->callType + ); + } +} diff --git a/vendor/google/gax/src/ClientStream.php b/vendor/google/gax/src/ClientStream.php new file mode 100644 index 00000000..fa9c0838 --- /dev/null +++ b/vendor/google/gax/src/ClientStream.php @@ -0,0 +1,104 @@ +call = $clientStreamingCall; + } + + /** + * Write request to the server. + * + * @param mixed $request The request to write + */ + public function write($request) + { + $this->call->write($request); + } + + /** + * Read the response from the server, completing the streaming call. + * + * @throws ApiException + * @return mixed The response object from the server + */ + public function readResponse() + { + list($response, $status) = $this->call->wait(); + if ($status->code == Code::OK) { + return $response; + } else { + throw ApiException::createFromStdClass($status); + } + } + + /** + * Write all data in $dataArray and read the response from the server, completing the streaming + * call. + * + * @param mixed[] $requests An iterator of request objects to write to the server + * @return mixed The response object from the server + */ + public function writeAllAndReadResponse($requests) + { + foreach ($requests as $request) { + $this->write($request); + } + return $this->readResponse(); + } + + /** + * Return the underlying gRPC call object + * + * @return \Grpc\ClientStreamingCall|mixed + */ + public function getClientStreamingCall() + { + return $this->call; + } +} diff --git a/vendor/google/gax/src/CredentialsWrapper.php b/vendor/google/gax/src/CredentialsWrapper.php new file mode 100644 index 00000000..81808214 --- /dev/null +++ b/vendor/google/gax/src/CredentialsWrapper.php @@ -0,0 +1,295 @@ +credentialsFetcher = $credentialsFetcher; + $this->authHttpHandler = $authHttpHandler ?: self::buildHttpHandlerFactory(); + } + + /** + * Factory method to create a CredentialsWrapper from an array of options. + * + * @param array $args { + * An array of optional arguments. + * + * @type string|array $keyFile + * Credentials to be used. Accepts either a path to a credentials file, or a decoded + * credentials file as a PHP array. If this is not specified, application default + * credentials will be used. + * @type string[] $scopes + * A string array of scopes to use when acquiring credentials. + * @type callable $authHttpHandler + * A handler used to deliver PSR-7 requests specifically + * for authentication. Should match a signature of + * `function (RequestInterface $request, array $options) : ResponseInterface`. + * @type bool $enableCaching + * Enable caching of access tokens. Defaults to true. + * @type CacheItemPoolInterface $authCache + * A cache for storing access tokens. Defaults to a simple in memory implementation. + * @type array $authCacheOptions + * Cache configuration options. + * @type string $quotaProject + * Specifies a user project to bill for access charges associated with the request. + * @type string[] $defaultScopes + * A string array of default scopes to use when acquiring + * credentials. + * @type bool $useJwtAccessWithScope + * Ensures service account credentials use JWT Access (also known as self-signed + * JWTs), even when user-defined scopes are supplied. + * } + * @return CredentialsWrapper + * @throws ValidationException + */ + public static function build(array $args = []) + { + $args += [ + 'keyFile' => null, + 'scopes' => null, + 'authHttpHandler' => null, + 'enableCaching' => true, + 'authCache' => null, + 'authCacheOptions' => [], + 'quotaProject' => null, + 'defaultScopes' => null, + 'useJwtAccessWithScope' => true, + ]; + $keyFile = $args['keyFile']; + $authHttpHandler = $args['authHttpHandler'] ?: self::buildHttpHandlerFactory(); + + if (is_null($keyFile)) { + $loader = self::buildApplicationDefaultCredentials( + $args['scopes'], + $authHttpHandler, + null, + null, + $args['quotaProject'], + $args['defaultScopes'] + ); + } else { + if (is_string($keyFile)) { + if (!file_exists($keyFile)) { + throw new ValidationException("Could not find keyfile: $keyFile"); + } + $keyFile = json_decode(file_get_contents($keyFile), true); + } + + if (isset($args['quotaProject'])) { + $keyFile['quota_project_id'] = $args['quotaProject']; + } + + $loader = CredentialsLoader::makeCredentials( + $args['scopes'], + $keyFile, + $args['defaultScopes'] + ); + } + + if ($loader instanceof ServiceAccountCredentials && $args['useJwtAccessWithScope']) { + // Ensures the ServiceAccountCredentials uses JWT Access, also known + // as self-signed JWTs, even when user-defined scopes are supplied. + $loader->useJwtAccessWithScope(); + } + + if ($args['enableCaching']) { + $authCache = $args['authCache'] ?: new MemoryCacheItemPool(); + $loader = new FetchAuthTokenCache( + $loader, + $args['authCacheOptions'], + $authCache + ); + } + + return new CredentialsWrapper($loader, $authHttpHandler); + } + + /** + * @return string|null The quota project associated with the credentials. + */ + public function getQuotaProject() + { + if ($this->credentialsFetcher instanceof GetQuotaProjectInterface) { + return $this->credentialsFetcher->getQuotaProject(); + } + } + + /** + * @deprecated + * @return string Bearer string containing access token. + */ + public function getBearerString() + { + $token = self::getToken($this->credentialsFetcher, $this->authHttpHandler); + return empty($token) ? '' : "Bearer $token"; + } + + /** + * @param string $audience optional audience for self-signed JWTs. + * @return callable Callable function that returns an authorization header. + */ + public function getAuthorizationHeaderCallback($audience = null) + { + $credentialsFetcher = $this->credentialsFetcher; + $authHttpHandler = $this->authHttpHandler; + + // NOTE: changes to this function should be treated carefully and tested thoroughly. It will + // be passed into the gRPC c extension, and changes have the potential to trigger very + // difficult-to-diagnose segmentation faults. + return function () use ($credentialsFetcher, $authHttpHandler, $audience) { + $token = $credentialsFetcher->getLastReceivedToken(); + if (self::isExpired($token)) { + // Call updateMetadata to take advantage of self-signed JWTs + if ($credentialsFetcher instanceof UpdateMetadataInterface) { + return $credentialsFetcher->updateMetadata([], $audience); + } + + // In case a custom fetcher is provided (unlikely) which doesn't + // implement UpdateMetadataInterface + $token = $credentialsFetcher->fetchAuthToken($authHttpHandler); + if (!self::isValid($token)) { + return []; + } + } + $tokenString = $token['access_token']; + if (!empty($tokenString)) { + return ['authorization' => ["Bearer $tokenString"]]; + } + return []; + }; + } + + /** + * @return Guzzle5HttpHandler|Guzzle6HttpHandler + * @throws ValidationException + */ + private static function buildHttpHandlerFactory() + { + try { + return HttpHandlerFactory::build(); + } catch (Exception $ex) { + throw new ValidationException("Failed to build HttpHandler", $ex->getCode(), $ex); + } + } + + /** + * @param array $scopes + * @param callable $authHttpHandler + * @param array $authCacheOptions + * @param CacheItemPoolInterface $authCache + * @param string $quotaProject + * @param array $defaultScopes + * @return CredentialsLoader + * @throws ValidationException + */ + private static function buildApplicationDefaultCredentials( + array $scopes = null, + callable $authHttpHandler = null, + array $authCacheOptions = null, + CacheItemPoolInterface $authCache = null, + $quotaProject = null, + array $defaultScopes = null + ) { + try { + return ApplicationDefaultCredentials::getCredentials( + $scopes, + $authHttpHandler, + $authCacheOptions, + $authCache, + $quotaProject, + $defaultScopes + ); + } catch (DomainException $ex) { + throw new ValidationException("Could not construct ApplicationDefaultCredentials", $ex->getCode(), $ex); + } + } + + private static function getToken(FetchAuthTokenInterface $credentialsFetcher, $authHttpHandler) + { + $token = $credentialsFetcher->getLastReceivedToken(); + if (self::isExpired($token)) { + $token = $credentialsFetcher->fetchAuthToken($authHttpHandler); + if (!self::isValid($token)) { + return ''; + } + } + return $token['access_token']; + } + + private static function isValid($token) + { + return is_array($token) + && array_key_exists('access_token', $token); + } + + private static function isExpired($token) + { + return !(self::isValid($token) + && array_key_exists('expires_at', $token) + && $token['expires_at'] > time()); + } +} diff --git a/vendor/google/gax/src/FixedSizeCollection.php b/vendor/google/gax/src/FixedSizeCollection.php new file mode 100644 index 00000000..215a4978 --- /dev/null +++ b/vendor/google/gax/src/FixedSizeCollection.php @@ -0,0 +1,189 @@ + 0. collectionSize: $collectionSize" + ); + } + if ($collectionSize < $initialPage->getPageElementCount()) { + $ipc = $initialPage->getPageElementCount(); + throw new InvalidArgumentException( + "collectionSize must be greater than or equal to the number of " . + "elements in initialPage. collectionSize: $collectionSize, " . + "initialPage size: $ipc" + ); + } + $this->collectionSize = $collectionSize; + + $this->pageList = FixedSizeCollection::createPageArray($initialPage, $collectionSize); + } + + /** + * Returns the number of elements in the collection. This will be + * equal to the collectionSize parameter used at construction + * unless there are no elements remaining to be retrieved. + * + * @return int + */ + public function getCollectionSize() + { + $size = 0; + foreach ($this->pageList as $page) { + $size += $page->getPageElementCount(); + } + return $size; + } + + /** + * Returns true if there are more elements that can be retrieved + * from the API. + * + * @return bool + */ + public function hasNextCollection() + { + return $this->getLastPage()->hasNextPage(); + } + + /** + * Returns a page token that can be passed into the API list + * method to retrieve additional elements. + * + * @return string + */ + public function getNextPageToken() + { + return $this->getLastPage()->getNextPageToken(); + } + + /** + * Retrieves the next FixedSizeCollection using one or more API calls. + * + * @return FixedSizeCollection + */ + public function getNextCollection() + { + $lastPage = $this->getLastPage(); + $nextPage = $lastPage->getNextPage($this->collectionSize); + return new FixedSizeCollection($nextPage, $this->collectionSize); + } + + /** + * Returns an iterator over the elements of the collection. + * + * @return Generator + */ + public function getIterator() + { + foreach ($this->pageList as $page) { + foreach ($page as $element) { + yield $element; + } + } + } + + /** + * Returns an iterator over FixedSizeCollections, starting with this + * and making API calls as required until all of the elements have + * been retrieved. + * + * @return Generator|FixedSizeCollection[] + */ + public function iterateCollections() + { + $currentCollection = $this; + yield $this; + while ($currentCollection->hasNextCollection()) { + $currentCollection = $currentCollection->getNextCollection(); + yield $currentCollection; + } + } + + private function getLastPage() + { + $pageList = $this->pageList; + // Get last element in array... + $lastPage = end($pageList); + reset($pageList); + return $lastPage; + } + + /** + * @param Page $initialPage + * @param integer $collectionSize + * @return Page[] + */ + private static function createPageArray($initialPage, $collectionSize) + { + $pageList = [$initialPage]; + $currentPage = $initialPage; + $itemCount = $currentPage->getPageElementCount(); + while ($itemCount < $collectionSize && $currentPage->hasNextPage()) { + $remainingCount = $collectionSize - $itemCount; + $currentPage = $currentPage->getNextPage($remainingCount); + $rxElementCount = $currentPage->getPageElementCount(); + if ($rxElementCount > $remainingCount) { + throw new LengthException("API returned a number of elements " . + "exceeding the specified page size limit. page size: " . + "$remainingCount, elements received: $rxElementCount"); + } + array_push($pageList, $currentPage); + $itemCount += $rxElementCount; + } + return $pageList; + } +} diff --git a/vendor/google/gax/src/GPBLabel.php b/vendor/google/gax/src/GPBLabel.php new file mode 100644 index 00000000..18208cd6 --- /dev/null +++ b/vendor/google/gax/src/GPBLabel.php @@ -0,0 +1,43 @@ + 'startUnaryCall', + Call::BIDI_STREAMING_CALL => 'startBidiStreamingCall', + Call::CLIENT_STREAMING_CALL => 'startClientStreamingCall', + Call::SERVER_STREAMING_CALL => 'startServerStreamingCall', + ]; + + /** + * Initiates an orderly shutdown in which preexisting calls continue but new + * calls are immediately cancelled. + * + * @experimental + */ + public function close() + { + $this->transport->close(); + } + + /** + * Get the transport for the client. This method is protected to support + * use by customized clients. + * + * @access private + * @return TransportInterface + */ + protected function getTransport() + { + return $this->transport; + } + + /** + * Get the credentials for the client. This method is protected to support + * use by customized clients. + * + * @access private + * @return CredentialsWrapper + */ + protected function getCredentialsWrapper() + { + return $this->credentialsWrapper; + } + + private static function getGapicVersion(array $options) + { + if (isset($options['libVersion'])) { + return $options['libVersion']; + } else { + if (!isset(self::$gapicVersionFromFile)) { + self::$gapicVersionFromFile = AgentHeader::readGapicVersionFromFile(__CLASS__); + } + return self::$gapicVersionFromFile; + } + } + + private static function initGrpcGcpConfig($hostName, $confPath) + { + $apiConfig = new ApiConfig(); + $apiConfig->mergeFromJsonString(file_get_contents($confPath)); + $config = new Config($hostName, $apiConfig); + return $config; + } + + /** + * Get default options. This function should be "overridden" by clients using late static + * binding to provide default options to the client. + * + * @return array + * @access private + */ + private static function getClientDefaults() + { + return []; + } + + private function buildClientOptions(array $options) + { + // Build $defaultOptions starting from top level + // variables, then going into deeper nesting, so that + // we will not encounter missing keys + $defaultOptions = self::getClientDefaults(); + $defaultOptions += [ + 'disableRetries' => false, + 'credentials' => null, + 'credentialsConfig' => [], + 'transport' => null, + 'transportConfig' => [], + 'gapicVersion' => self::getGapicVersion($options), + 'libName' => null, + 'libVersion' => null, + 'apiEndpoint' => null, + 'clientCertSource' => null, + ]; + + $supportedTransports = $this->supportedTransports(); + foreach ($supportedTransports as $transportName) { + if (!array_key_exists($transportName, $defaultOptions['transportConfig'])) { + $defaultOptions['transportConfig'][$transportName] = []; + } + } + if (in_array('grpc', $supportedTransports)) { + $defaultOptions['transportConfig']['grpc'] = [ + 'stubOpts' => ['grpc.service_config_disable_resolution' => 1] + ]; + } + + // Merge defaults into $options starting from top level + // variables, then going into deeper nesting, so that + // we will not encounter missing keys + $options += $defaultOptions; + $options['credentialsConfig'] += $defaultOptions['credentialsConfig']; + $options['transportConfig'] += $defaultOptions['transportConfig']; + if (isset($options['transportConfig']['grpc'])) { + $options['transportConfig']['grpc'] += $defaultOptions['transportConfig']['grpc']; + $options['transportConfig']['grpc']['stubOpts'] += $defaultOptions['transportConfig']['grpc']['stubOpts']; + } + if (isset($options['transportConfig']['rest'])) { + $options['transportConfig']['rest'] += $defaultOptions['transportConfig']['rest']; + } + + $this->modifyClientOptions($options); + + // serviceAddress is now deprecated and acts as an alias for apiEndpoint + if (isset($options['serviceAddress'])) { + $options['apiEndpoint'] = $this->pluck('serviceAddress', $options, false); + } + + // If an API endpoint is set, ensure the "audience" does not conflict + // with the custom endpoint by setting "user defined" scopes. + if ($options['apiEndpoint'] != $defaultOptions['apiEndpoint'] + && empty($options['credentialsConfig']['scopes']) + && !empty($options['credentialsConfig']['defaultScopes']) + ) { + $options['credentialsConfig']['scopes'] = $options['credentialsConfig']['defaultScopes']; + } + + if (extension_loaded('sysvshm') + && isset($options['gcpApiConfigPath']) + && file_exists($options['gcpApiConfigPath']) + && isset($options['apiEndpoint'])) { + $grpcGcpConfig = self::initGrpcGcpConfig( + $options['apiEndpoint'], + $options['gcpApiConfigPath'] + ); + + if (array_key_exists('stubOpts', $options['transportConfig']['grpc'])) { + $options['transportConfig']['grpc']['stubOpts'] += [ + 'grpc_call_invoker' => $grpcGcpConfig->callInvoker() + ]; + } else { + $options['transportConfig']['grpc'] += [ + 'stubOpts' => [ + 'grpc_call_invoker' => $grpcGcpConfig->callInvoker() + ] + ]; + } + } + + // mTLS: detect and load the default clientCertSource if the environment variable + // "GOOGLE_API_USE_CLIENT_CERTIFICATE" is true, and the cert source is available + if (empty($options['clientCertSource']) && CredentialsLoader::shouldLoadClientCertSource()) { + if ($defaultCertSource = CredentialsLoader::getDefaultClientCertSource()) { + $options['clientCertSource'] = function () use ($defaultCertSource) { + $cert = call_user_func($defaultCertSource); + + // the key and the cert are returned in one string + return [$cert, $cert]; + }; + } + } + + // mTLS: If no apiEndpoint has been supplied by the user, and either + // GOOGLE_API_USE_MTLS_ENDPOINT tells us to, or mTLS is available, use the mTLS endpoint. + if ($options['apiEndpoint'] === $defaultOptions['apiEndpoint'] + && $this->shouldUseMtlsEndpoint($options) + ) { + $options['apiEndpoint'] = self::determineMtlsEndpoint($options['apiEndpoint']); + } + + return $options; + } + + private function shouldUseMtlsEndpoint($options) + { + $mtlsEndpointEnvVar = getenv('GOOGLE_API_USE_MTLS_ENDPOINT'); + if ('always' === $mtlsEndpointEnvVar) { + return true; + } + if ('never' === $mtlsEndpointEnvVar) { + return false; + } + // For all other cases, assume "auto" and return true if clientCertSource exists + return !empty($options['clientCertSource']); + } + + private static function determineMtlsEndpoint($apiEndpoint) + { + $parts = explode('.', $apiEndpoint); + if (count($parts) < 3) { + return $apiEndpoint; // invalid endpoint! + } + return sprintf('%s.mtls.%s', array_shift($parts), implode('.', $parts)); + } + + /** + * Configures the GAPIC client based on an array of options. + * + * @param array $options { + * An array of required and optional arguments. + * + * @type string $apiEndpoint + * The address of the API remote host, for example "example.googleapis.com. May also + * include the port, for example "example.googleapis.com:443" + * @type string $serviceAddress + * **Deprecated**. This option will be removed in the next major release. Please + * utilize the `$apiEndpoint` option instead. + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either a + * path to a JSON file, or a PHP array containing the decoded JSON data. + * By default this settings points to the default client config file, which is provided + * in the resources folder. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * \Google\Auth\FetchAuthTokenInterface object or \Google\ApiCore\CredentialsWrapper + * object. Note that when one of these objects are provided, any settings in + * $authConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the client. + * For a full list of supporting configuration options, see + * \Google\ApiCore\CredentialsWrapper::build. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string `rest`, + * `grpc`, or 'grpc-fallback'. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already instantiated + * TransportInterface object. Note that when this objects is provided, any settings in + * $transportConfig, and any `$apiEndpoint` setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * 'grpc-fallback' => [...], + * ]; + * See the GrpcTransport::build and RestTransport::build + * methods for the supported options. + * @type string $versionFile + * The path to a file which contains the current version of the client. + * @type string $descriptorsConfigPath + * The path to a descriptor configuration file. + * @type string $serviceName + * The name of the service. + * @type string $libName + * The name of the client application. + * @type string $libVersion + * The version of the client application. + * @type string $gapicVersion + * The code generator version of the GAPIC library. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. + * } + * @throws ValidationException + */ + private function setClientOptions(array $options) + { + // serviceAddress is now deprecated and acts as an alias for apiEndpoint + if (isset($options['serviceAddress'])) { + $options['apiEndpoint'] = $this->pluck('serviceAddress', $options, false); + } + $this->validateNotNull($options, [ + 'apiEndpoint', + 'serviceName', + 'descriptorsConfigPath', + 'clientConfig', + 'disableRetries', + 'credentialsConfig', + 'transportConfig', + ]); + $this->traitValidate($options, [ + 'credentials', + 'transport', + 'gapicVersion', + 'libName', + 'libVersion', + ]); + + $clientConfig = $options['clientConfig']; + if (is_string($clientConfig)) { + $clientConfig = json_decode(file_get_contents($clientConfig), true); + } + $this->serviceName = $options['serviceName']; + $this->retrySettings = RetrySettings::load( + $this->serviceName, + $clientConfig, + $options['disableRetries'] + ); + + // Edge case: If the client has the gRPC extension installed, but is + // a REST-only library, then the grpcVersion header should not be set. + if ($this->transport instanceof GrpcTransport) { + $options['grpcVersion'] = phpversion('grpc'); + unset($options['restVersion']); + } elseif ($this->transport instanceof RestTransport + || $this->transport instanceof GrpcFallbackTransport) { + unset($options['grpcVersion']); + $options['restVersion'] = Version::getApiCoreVersion(); + } + + $this->agentHeader = AgentHeader::buildAgentHeader( + $this->pluckArray([ + 'libName', + 'libVersion', + 'gapicVersion' + ], $options) + ); + self::validateFileExists($options['descriptorsConfigPath']); + $descriptors = require($options['descriptorsConfigPath']); + $this->descriptors = $descriptors['interfaces'][$this->serviceName]; + + $this->credentialsWrapper = $this->createCredentialsWrapper( + $options['credentials'], + $options['credentialsConfig'] + ); + + $transport = $options['transport'] ?: self::defaultTransport(); + $this->transport = $transport instanceof TransportInterface + ? $transport + : $this->createTransport( + $options['apiEndpoint'], + $transport, + $options['transportConfig'], + $options['clientCertSource'] + ); + } + + /** + * @param mixed $credentials + * @param array $credentialsConfig + * @return CredentialsWrapper + * @throws ValidationException + */ + private function createCredentialsWrapper($credentials, array $credentialsConfig) + { + if (is_null($credentials)) { + return CredentialsWrapper::build($credentialsConfig); + } elseif (is_string($credentials) || is_array($credentials)) { + return CredentialsWrapper::build(['keyFile' => $credentials] + $credentialsConfig); + } elseif ($credentials instanceof FetchAuthTokenInterface) { + $authHttpHandler = isset($credentialsConfig['authHttpHandler']) + ? $credentialsConfig['authHttpHandler'] + : null; + return new CredentialsWrapper($credentials, $authHttpHandler); + } elseif ($credentials instanceof CredentialsWrapper) { + return $credentials; + } else { + throw new ValidationException( + 'Unexpected value in $auth option, got: ' . + print_r($credentials, true) + ); + } + } + + /** + * @param string $apiEndpoint + * @param string $transport + * @param array $transportConfig + * @param callable $clientCertSource + * @return TransportInterface + * @throws ValidationException + */ + private function createTransport( + $apiEndpoint, + $transport, + array $transportConfig, + callable $clientCertSource = null + ) { + if (!is_string($transport)) { + throw new ValidationException( + "'transport' must be a string, instead got:" . + print_r($transport, true) + ); + } + $supportedTransports = self::supportedTransports(); + if (!in_array($transport, $supportedTransports)) { + throw new ValidationException(sprintf( + 'Unexpected transport option "%s". Supported transports: %s', + $transport, + implode(', ', $supportedTransports) + )); + } + $configForSpecifiedTransport = isset($transportConfig[$transport]) + ? $transportConfig[$transport] + : []; + $configForSpecifiedTransport['clientCertSource'] = $clientCertSource; + switch ($transport) { + case 'grpc': + return GrpcTransport::build($apiEndpoint, $configForSpecifiedTransport); + case 'grpc-fallback': + return GrpcFallbackTransport::build($apiEndpoint, $configForSpecifiedTransport); + case 'rest': + if (!isset($configForSpecifiedTransport['restClientConfigPath'])) { + throw new ValidationException( + "The 'restClientConfigPath' config is required for 'rest' transport." + ); + } + $restConfigPath = $configForSpecifiedTransport['restClientConfigPath']; + return RestTransport::build($apiEndpoint, $restConfigPath, $configForSpecifiedTransport); + default: + throw new ValidationException( + "Unexpected 'transport' option: $transport. " . + "Supported values: ['grpc', 'rest', 'grpc-fallback']" + ); + } + } + + /** + * @param array $options + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + $this->pluckArray([ + 'serviceName', + 'clientConfig', + 'descriptorsConfigPath', + ], $options); + + // User-supplied operations client + if ($operationsClient = $this->pluck('operationsClient', $options, false)) { + return $operationsClient; + } + + // operationsClientClass option + $operationsClientClass = $this->pluck('operationsClientClass', $options, false) + ?: OperationsCLient::class; + return new $operationsClientClass($options); + } + + /** + * @return string + */ + private static function defaultTransport() + { + return self::getGrpcDependencyStatus() + ? 'grpc' + : 'rest'; + } + + /** + * @param string $methodName + * @param string $decodeType + * @param array $optionalArgs { + * Call Options + * + * @type array $headers [optional] key-value array containing headers + * @type int $timeoutMillis [optional] the timeout in milliseconds for the call + * @type array $transportOptions [optional] transport-specific call options + * @type RetrySettings|array $retrySettings [optional] A retry settings + * override for the call. + * } + * @param Message $request + * @param int $callType + * @param string $interfaceName + * + * @return PromiseInterface|BidiStream|ClientStream|ServerStream + */ + private function startCall( + $methodName, + $decodeType, + array $optionalArgs = [], + Message $request = null, + $callType = Call::UNARY_CALL, + $interfaceName = null + ) { + $callStack = $this->createCallStack( + $this->configureCallConstructionOptions($methodName, $optionalArgs) + ); + + $descriptor = isset($this->descriptors[$methodName]['grpcStreaming']) + ? $this->descriptors[$methodName]['grpcStreaming'] + : null; + + $call = new Call( + $this->buildMethod($interfaceName, $methodName), + $decodeType, + $request, + $descriptor, + $callType + ); + switch ($callType) { + case Call::UNARY_CALL: + $this->modifyUnaryCallable($callStack); + break; + case Call::BIDI_STREAMING_CALL: + case Call::CLIENT_STREAMING_CALL: + case Call::SERVER_STREAMING_CALL: + $this->modifyStreamingCallable($callStack); + break; + } + + return $callStack($call, $optionalArgs + array_filter([ + 'audience' => self::getDefaultAudience() + ])); + } + + /** + * @param array $callConstructionOptions { + * Call Construction Options + * + * @type RetrySettings $retrySettings [optional] A retry settings override + * For the call. + * } + * + * @return callable + */ + private function createCallStack(array $callConstructionOptions) + { + $quotaProject = $this->credentialsWrapper->getQuotaProject(); + $fixedHeaders = $this->agentHeader; + if ($quotaProject) { + $fixedHeaders += [ + 'X-Goog-User-Project' => [$quotaProject] + ]; + } + $callStack = function (Call $call, array $options) { + $startCallMethod = $this->transportCallMethods[$call->getCallType()]; + return $this->transport->$startCallMethod($call, $options); + }; + $callStack = new CredentialsWrapperMiddleware($callStack, $this->credentialsWrapper); + $callStack = new FixedHeaderMiddleware($callStack, $fixedHeaders, true); + $callStack = new RetryMiddleware($callStack, $callConstructionOptions['retrySettings']); + $callStack = new OptionsFilterMiddleware($callStack, [ + 'headers', + 'timeoutMillis', + 'transportOptions', + 'metadataCallback', + 'audience', + ]); + + return $callStack; + } + + /** + * @param string $methodName + * @param array $optionalArgs { + * Optional arguments + * + * @type RetrySettings|array $retrySettings [optional] A retry settings + * override for the call. + * } + * + * @return array + */ + private function configureCallConstructionOptions($methodName, array $optionalArgs) + { + $retrySettings = $this->retrySettings[$methodName]; + // Allow for retry settings to be changed at call time + if (isset($optionalArgs['retrySettings'])) { + if ($optionalArgs['retrySettings'] instanceof RetrySettings) { + $retrySettings = $optionalArgs['retrySettings']; + } else { + $retrySettings = $retrySettings->with( + $optionalArgs['retrySettings'] + ); + } + } + return [ + 'retrySettings' => $retrySettings, + ]; + } + + /** + * @param string $methodName + * @param array $optionalArgs { + * Call Options + * + * @type array $headers [optional] key-value array containing headers + * @type int $timeoutMillis [optional] the timeout in milliseconds for the call + * @type array $transportOptions [optional] transport-specific call options + * } + * @param Message $request + * @param OperationsClient|object $client + * @param string $interfaceName + * @param string $operationClass If provided, will be used instead of the default + * operation response class of {@see Google\LongRunning\Operation}. + * + * @return PromiseInterface + */ + private function startOperationsCall( + $methodName, + array $optionalArgs, + Message $request, + $client, + $interfaceName = null, + $operationClass = null + ) { + $callStack = $this->createCallStack( + $this->configureCallConstructionOptions($methodName, $optionalArgs) + ); + + $descriptor = $this->descriptors[$methodName]['longRunning']; + + // Call the methods supplied in "additionalArgumentMethods" on the request Message object + // to build the "additionalOperationArguments" option for the operation response. + if (isset($descriptor['additionalArgumentMethods'])) { + $additionalArgs = []; + foreach ($descriptor['additionalArgumentMethods'] as $additionalArgsMethodName) { + $additionalArgs[] = $request->$additionalArgsMethodName(); + } + $descriptor['additionalOperationArguments'] = $additionalArgs; + unset($descriptor['additionalArgumentMethods']); + } + + $callStack = new OperationsMiddleware($callStack, $client, $descriptor); + + $call = new Call( + $this->buildMethod($interfaceName, $methodName), + $operationClass ?: Operation::class, + $request, + [], + Call::UNARY_CALL + ); + + $this->modifyUnaryCallable($callStack); + return $callStack($call, $optionalArgs + array_filter([ + 'audience' => self::getDefaultAudience() + ])); + } + + /** + * @param string $methodName + * @param array $optionalArgs + * @param string $decodeType + * @param Message $request + * @param string $interfaceName + * + * @return PagedListResponse + */ + private function getPagedListResponse( + $methodName, + array $optionalArgs, + $decodeType, + Message $request, + $interfaceName = null + ) { + $callStack = $this->createCallStack( + $this->configureCallConstructionOptions($methodName, $optionalArgs) + ); + $descriptor = new PageStreamingDescriptor( + $this->descriptors[$methodName]['pageStreaming'] + ); + $callStack = new PagedMiddleware($callStack, $descriptor); + + $call = new Call( + $this->buildMethod($interfaceName, $methodName), + $decodeType, + $request, + [], + Call::UNARY_CALL + ); + + $this->modifyUnaryCallable($callStack); + return $callStack($call, $optionalArgs + array_filter([ + 'audience' => self::getDefaultAudience() + ]))->wait(); + } + + /** + * @param string $interfaceName + * @param string $methodName + * + * @return string + */ + private function buildMethod($interfaceName, $methodName) + { + return sprintf( + '%s/%s', + $interfaceName ?: $this->serviceName, + $methodName + ); + } + + /** + * The SERVICE_ADDRESS constant is set by GAPIC clients + */ + private static function getDefaultAudience() + { + if (!defined('self::SERVICE_ADDRESS')) { + return null; + } + return 'https://' . self::SERVICE_ADDRESS . '/'; + } + + /** + * This defaults to all three transports, which One-Platform supports. + * Discovery clients should define this function and only return ['rest']. + */ + private static function supportedTransports() + { + return ['grpc', 'grpc-fallback', 'rest']; + } + + // Gapic Client Extension Points + // The methods below provide extension points that can be used to customize client + // functionality. These extension points are currently considered + // private and may change at any time. + + /** + * Modify options passed to the client before calling setClientOptions. + * + * @param array $options + * @access private + */ + protected function modifyClientOptions(array &$options) + { + // Do nothing - this method exists to allow option modification by partial veneers. + } + + /** + * Modify the unary callable. + * + * @param callable $callable + * @access private + */ + protected function modifyUnaryCallable(callable &$callable) + { + // Do nothing - this method exists to allow callable modification by partial veneers. + } + + /** + * Modify the streaming callable. + * + * @param callable $callable + * @access private + */ + protected function modifyStreamingCallable(callable &$callable) + { + // Do nothing - this method exists to allow callable modification by partial veneers. + } +} diff --git a/vendor/google/gax/src/GrpcSupportTrait.php b/vendor/google/gax/src/GrpcSupportTrait.php new file mode 100644 index 00000000..c4d9067b --- /dev/null +++ b/vendor/google/gax/src/GrpcSupportTrait.php @@ -0,0 +1,61 @@ + 'my-service-address', + * 'scopes' => ['my-service-scope'], + * ]; + * $operationsClient = new OperationsClient($options); + * try { + * $name = ''; + * $response = $operationsClient->getOperation($name); + * } finally { + * if (isset($operationsClient)) { + * $operationsClient->close(); + * } + * } + * ``` + * + * @experimental + */ +class OperationsGapicClient +{ + use GapicClientTrait; + + /** + * The name of the service. + */ + const SERVICE_NAME = 'google.longrunning.Operations'; + + /** + * The default port of the service. + */ + const DEFAULT_SERVICE_PORT = 443; + + /** + * The name of the code generator, to be included in the agent header. + */ + const CODEGEN_NAME = 'gapic'; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'clientConfig' => __DIR__.'/../resources/operations_client_config.json', + 'descriptorsConfigPath' => __DIR__.'/../resources/operations_descriptor_config.php', + 'credentialsConfig' => [ + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__.'/../resources/operations_rest_client_config.php' + ], + ], + ]; + } + + /** + * Constructor. + * + * @param array $options { + * Required. Options for configuring the service API wrapper. Those options + * that must be provided are marked as Required. + * + * @type string $apiEndpoint + * Required. The address of the API remote host. May optionally include the port, + * formatted as ":". + * @type string|array $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * \Google\Auth\FetchAuthTokenInterface object or \Google\ApiCore\CredentialsWrapper + * object. Note that when one of these objects are provided, any settings in + * $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the client. For + * a full list of supporting configuration options, see + * \Google\ApiCore\CredentialsWrapper::build. + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either a + * path to a JSON file, or a PHP array containing the decoded JSON data. + * By default this settings points to the default client config file, which is provided + * in the resources folder. + * @type string $transport + * The transport used for executing network requests. May be either the string `rest` + * or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already instantiated + * TransportInterface object. Note that when this objects is provided, any settings in + * $transportConfig, and any $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...] + * ]; + * See the GrpcTransport::build and RestTransport::build methods for the supported + * options. + * } + * @experimental + */ + public function __construct($options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * Sample code: + * ``` + * $options = [ + * 'apiEndpoint' => 'my-service-address', + * 'scopes' => ['my-service-scope'], + * ]; + * $operationsClient = new OperationsClient($options); + * try { + * $name = ''; + * $response = $operationsClient->getOperation($name); + * } finally { + * if (isset($operationsClient)) { + * $operationsClient->close(); + * } + * } + * ``` + * + * @param string $name The name of the operation resource. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\LongRunning\Operation + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function getOperation($name, $optionalArgs = []) + { + $request = new GetOperationRequest(); + $request->setName($name); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'GetOperation', + Operation::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. + * + * NOTE: the `name` binding below allows API services to override the binding + * to use different resource name schemes, such as `users/*/operations`. + * + * Sample code: + * ``` + * $options = [ + * 'apiEndpoint' => 'my-service-address', + * 'scopes' => ['my-service-scope'], + * ]; + * $operationsClient = new OperationsClient($options); + * try { + * $name = ''; + * $filter = ''; + * // Iterate through all elements + * $pagedResponse = $operationsClient->listOperations($name, $filter); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * + * // OR iterate over pages of elements + * $pagedResponse = $operationsClient->listOperations($name, $filter); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * } finally { + * if (isset($operationsClient)) { + * $operationsClient->close(); + * } + * } + * ``` + * + * @param string $name The name of the operation collection. + * @param string $filter The standard list filter. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listOperations($name, $filter, $optionalArgs = []) + { + $request = new ListOperationsRequest(); + $request->setName($name); + $request->setFilter($filter); + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->getPagedListResponse( + 'ListOperations', + $optionalArgs, + ListOperationsResponse::class, + $request + ); + } + + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Sample code: + * ``` + * $options = [ + * 'apiEndpoint' => 'my-service-address', + * 'scopes' => ['my-service-scope'], + * ]; + * $operationsClient = new OperationsClient($options); + * try { + * $name = ''; + * $operationsClient->cancelOperation($name); + * } finally { + * if (isset($operationsClient)) { + * $operationsClient->close(); + * } + * } + * ``` + * + * @param string $name The name of the operation resource to be cancelled. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function cancelOperation($name, $optionalArgs = []) + { + $request = new CancelOperationRequest(); + $request->setName($name); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'CancelOperation', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * Sample code: + * ``` + * $options = [ + * 'apiEndpoint' => 'my-service-address', + * 'scopes' => ['my-service-scope'], + * ]; + * $operationsClient = new OperationsClient($options); + * try { + * $name = ''; + * $operationsClient->deleteOperation($name); + * } finally { + * if (isset($operationsClient)) { + * $operationsClient->close(); + * } + * } + * ``` + * + * @param string $name The name of the operation resource to be deleted. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function deleteOperation($name, $optionalArgs = []) + { + $request = new DeleteOperationRequest(); + $request->setName($name); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'DeleteOperation', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } +} diff --git a/vendor/google/gax/src/LongRunning/OperationsClient.php b/vendor/google/gax/src/LongRunning/OperationsClient.php new file mode 100644 index 00000000..d20e25ff --- /dev/null +++ b/vendor/google/gax/src/LongRunning/OperationsClient.php @@ -0,0 +1,56 @@ + [ + 'google.longrunning.Operations' => [ + 'ListOperations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getOperations', + ], + ], + ], + ], +]; diff --git a/vendor/google/gax/src/LongRunning/resources/operations_rest_client_config.php b/vendor/google/gax/src/LongRunning/resources/operations_rest_client_config.php new file mode 100644 index 00000000..05ef6474 --- /dev/null +++ b/vendor/google/gax/src/LongRunning/resources/operations_rest_client_config.php @@ -0,0 +1,53 @@ + [ + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=operations/**}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=operations}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=operations/**}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=operations/**}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/vendor/google/gax/src/Middleware/CredentialsWrapperMiddleware.php b/vendor/google/gax/src/Middleware/CredentialsWrapperMiddleware.php new file mode 100644 index 00000000..9f36f413 --- /dev/null +++ b/vendor/google/gax/src/Middleware/CredentialsWrapperMiddleware.php @@ -0,0 +1,64 @@ +nextHandler = $nextHandler; + $this->credentialsWrapper = $credentialsWrapper; + } + + public function __invoke(Call $call, array $options) + { + $next = $this->nextHandler; + return $next( + $call, + $options + ['credentialsWrapper' => $this->credentialsWrapper] + ); + } +} diff --git a/vendor/google/gax/src/Middleware/FixedHeaderMiddleware.php b/vendor/google/gax/src/Middleware/FixedHeaderMiddleware.php new file mode 100644 index 00000000..4734286d --- /dev/null +++ b/vendor/google/gax/src/Middleware/FixedHeaderMiddleware.php @@ -0,0 +1,70 @@ +nextHandler = $nextHandler; + $this->headers = $headers; + $this->overrideUserHeaders = $overrideUserHeaders; + } + + public function __invoke(Call $call, array $options) + { + $userHeaders = isset($options['headers']) ? $options['headers'] : []; + if ($this->overrideUserHeaders) { + $options['headers'] = $this->headers + $userHeaders; + } else { + $options['headers'] = $userHeaders + $this->headers; + } + + $next = $this->nextHandler; + return $next( + $call, + $options + ); + } +} diff --git a/vendor/google/gax/src/Middleware/OperationsMiddleware.php b/vendor/google/gax/src/Middleware/OperationsMiddleware.php new file mode 100644 index 00000000..ae4e05a5 --- /dev/null +++ b/vendor/google/gax/src/Middleware/OperationsMiddleware.php @@ -0,0 +1,78 @@ +nextHandler = $nextHandler; + $this->operationsClient = $operationsClient; + $this->descriptor = $descriptor; + } + + public function __invoke(Call $call, array $options) + { + $next = $this->nextHandler; + return $next( + $call, + $options + )->then(function (Message $response) { + $options = $this->descriptor + [ + 'lastProtoResponse' => $response + ]; + $operationNameMethod = isset($options['operationNameMethod']) + ? $options['operationNameMethod'] : 'getName'; + $operationName = call_user_func([$response, $operationNameMethod]); + return new OperationResponse($operationName, $this->operationsClient, $options); + }); + } +} diff --git a/vendor/google/gax/src/Middleware/OptionsFilterMiddleware.php b/vendor/google/gax/src/Middleware/OptionsFilterMiddleware.php new file mode 100644 index 00000000..b1d856ff --- /dev/null +++ b/vendor/google/gax/src/Middleware/OptionsFilterMiddleware.php @@ -0,0 +1,67 @@ +nextHandler = $nextHandler; + $this->permittedOptions = $permittedOptions; + } + + public function __invoke(Call $call, array $options) + { + $next = $this->nextHandler; + $filteredOptions = $this->pluckArray($this->permittedOptions, $options); + return $next( + $call, + $filteredOptions + ); + } +} diff --git a/vendor/google/gax/src/Middleware/PagedMiddleware.php b/vendor/google/gax/src/Middleware/PagedMiddleware.php new file mode 100644 index 00000000..c13e39f4 --- /dev/null +++ b/vendor/google/gax/src/Middleware/PagedMiddleware.php @@ -0,0 +1,80 @@ +nextHandler = $nextHandler; + $this->descriptor = $descriptor; + } + + public function __invoke(Call $call, array $options) + { + $next = $this->nextHandler; + $descriptor = $this->descriptor; + return $next($call, $options)->then( + function (Message $response) use ($call, $next, $options, $descriptor) { + $page = new Page( + $call, + $options, + $next, + $descriptor, + $response + ); + return new PagedListResponse($page); + } + ); + } +} diff --git a/vendor/google/gax/src/Middleware/ResponseMetadataMiddleware.php b/vendor/google/gax/src/Middleware/ResponseMetadataMiddleware.php new file mode 100644 index 00000000..37c36014 --- /dev/null +++ b/vendor/google/gax/src/Middleware/ResponseMetadataMiddleware.php @@ -0,0 +1,71 @@ +nextHandler = $nextHandler; + } + + public function __invoke(Call $call, array $options) + { + $metadataReceiver = new Promise(); + $options['metadataCallback'] = function ($metadata) use ($metadataReceiver) { + $metadataReceiver->resolve($metadata); + }; + $next = $this->nextHandler; + return $next($call, $options)->then( + function ($response) use ($metadataReceiver) { + if ($metadataReceiver->getState() === PromiseInterface::FULFILLED) { + return [$response, $metadataReceiver->wait()]; + } else { + return [$response, []]; + } + } + ); + } +} diff --git a/vendor/google/gax/src/Middleware/RetryMiddleware.php b/vendor/google/gax/src/Middleware/RetryMiddleware.php new file mode 100644 index 00000000..934b5df0 --- /dev/null +++ b/vendor/google/gax/src/Middleware/RetryMiddleware.php @@ -0,0 +1,158 @@ +nextHandler = $nextHandler; + $this->retrySettings = $retrySettings; + $this->deadlineMs = $deadlineMs; + } + + /** + * @param Call $call + * @param array $options + * + * @return PromiseInterface + */ + public function __invoke(Call $call, array $options) + { + $nextHandler = $this->nextHandler; + + if (!isset($options['timeoutMillis'])) { + // default to "noRetriesRpcTimeoutMillis" when retries are disabled, otherwise use "initialRpcTimeoutMillis" + if (!$this->retrySettings->retriesEnabled() && $this->retrySettings->getNoRetriesRpcTimeoutMillis() > 0) { + $options['timeoutMillis'] = $this->retrySettings->getNoRetriesRpcTimeoutMillis(); + } elseif ($this->retrySettings->getInitialRpcTimeoutMillis() > 0) { + $options['timeoutMillis'] = $this->retrySettings->getInitialRpcTimeoutMillis(); + } + } + + // Call the handler immediately if retry settings are disabled. + if (!$this->retrySettings->retriesEnabled()) { + return $nextHandler($call, $options); + } + + return $nextHandler($call, $options)->then(null, function ($e) use ($call, $options) { + if (!$e instanceof ApiException) { + throw $e; + } + + if (!in_array($e->getStatus(), $this->retrySettings->getRetryableCodes())) { + throw $e; + } + + return $this->retry($call, $options, $e->getStatus()); + }); + } + + /** + * @param Call $call + * @param array $options + * @param string $status + * + * @return PromiseInterface + * @throws ApiException + */ + private function retry(Call $call, array $options, $status) + { + $delayMult = $this->retrySettings->getRetryDelayMultiplier(); + $maxDelayMs = $this->retrySettings->getMaxRetryDelayMillis(); + $timeoutMult = $this->retrySettings->getRpcTimeoutMultiplier(); + $maxTimeoutMs = $this->retrySettings->getMaxRpcTimeoutMillis(); + $totalTimeoutMs = $this->retrySettings->getTotalTimeoutMillis(); + + $delayMs = $this->retrySettings->getInitialRetryDelayMillis(); + $timeoutMs = $options['timeoutMillis']; + $currentTimeMs = $this->getCurrentTimeMs(); + $deadlineMs = $this->deadlineMs ?: $currentTimeMs + $totalTimeoutMs; + + if ($currentTimeMs >= $deadlineMs) { + throw new ApiException( + 'Retry total timeout exceeded.', + \Google\Rpc\Code::DEADLINE_EXCEEDED, + ApiStatus::DEADLINE_EXCEEDED + ); + } + + $delayMs = min($delayMs * $delayMult, $maxDelayMs); + $timeoutMs = min( + $timeoutMs * $timeoutMult, + $maxTimeoutMs, + $deadlineMs - $this->getCurrentTimeMs() + ); + + $nextHandler = new RetryMiddleware( + $this->nextHandler, + $this->retrySettings->with([ + 'initialRetryDelayMillis' => $delayMs, + ]), + $deadlineMs + ); + + // Set the timeout for the call + $options['timeoutMillis'] = $timeoutMs; + + return $nextHandler( + $call, + $options + ); + } + + protected function getCurrentTimeMs() + { + return microtime(true) * 1000.0; + } +} diff --git a/vendor/google/gax/src/OperationResponse.php b/vendor/google/gax/src/OperationResponse.php new file mode 100644 index 00000000..40fb6c19 --- /dev/null +++ b/vendor/google/gax/src/OperationResponse.php @@ -0,0 +1,481 @@ + self::DEFAULT_POLLING_INTERVAL, + 'pollDelayMultiplier' => self::DEFAULT_POLLING_MULTIPLIER, + 'maxPollDelayMillis' => self::DEFAULT_MAX_POLLING_INTERVAL, + 'totalPollTimeoutMillis' => self::DEFAULT_MAX_POLLING_DURATION, + ]; + + private $lastProtoResponse; + private $deleted = false; + + private $additionalArgs; + private $getOperationMethod; + private $cancelOperationMethod; + private $deleteOperationMethod; + private $operationStatusMethod; + private $operationStatusDoneValue; + private $operationErrorCodeMethod; + private $operationErrorMessageMethod; + + /** + * OperationResponse constructor. + * + * @param string $operationName + * @param object $operationsClient + * @param array $options { + * Optional. Options for configuring the operation response object. + * + * @type string $operationReturnType The return type of the longrunning operation. + * @type string $metadataReturnType The type of the metadata returned in the operation response. + * @type int $initialPollDelayMillis The initial polling interval to use, in milliseconds. + * @type int $pollDelayMultiplier Multiplier applied to the polling interval on each retry. + * @type int $maxPollDelayMillis The maximum polling interval to use, in milliseconds. + * @type int $totalPollTimeoutMillis The maximum amount of time to continue polling. + * @type object $lastProtoResponse A response already received from the server. + * @type string $getOperationMethod The method on $operationsClient to get the operation. + * @type string $cancelOperationMethod The method on $operationsClient to cancel the operation. + * @type string $deleteOperationMethod The method on $operationsClient to delete the operation. + * @type string $operationStatusMethod The method on the operation to get the status. + * @type string $operationStatusDoneValue The method on the operation to determine if the status is done. + * @type array $additionalOperationArguments Additional arguments to pass to $operationsClient methods. + * @type string $operationErrorCodeMethod The method on the operation to get the error code + * @type string $operationErrorMessageMethod The method on the operation to get the error status + * } + */ + public function __construct($operationName, $operationsClient, $options = []) + { + $this->operationName = $operationName; + $this->operationsClient = $operationsClient; + $options += [ + 'operationReturnType' => null, + 'metadataReturnType' => null, + 'lastProtoResponse' => null, + 'getOperationMethod' => 'getOperation', + 'cancelOperationMethod' => 'cancelOperation', + 'deleteOperationMethod' => 'deleteOperation', + 'operationStatusMethod' => 'getDone', + 'operationStatusDoneValue' => true, + 'additionalOperationArguments' => [], + 'operationErrorCodeMethod' => null, + 'operationErrorMessageMethod' => null, + ]; + $this->operationReturnType = $options['operationReturnType']; + $this->metadataReturnType = $options['metadataReturnType']; + $this->lastProtoResponse = $options['lastProtoResponse']; + $this->getOperationMethod = $options['getOperationMethod']; + $this->cancelOperationMethod = $options['cancelOperationMethod']; + $this->deleteOperationMethod = $options['deleteOperationMethod']; + $this->additionalArgs = $options['additionalOperationArguments']; + $this->operationStatusMethod = $options['operationStatusMethod']; + $this->operationStatusDoneValue = $options['operationStatusDoneValue']; + $this->operationErrorCodeMethod = $options['operationErrorCodeMethod']; + $this->operationErrorMessageMethod = $options['operationErrorMessageMethod']; + + if (isset($options['initialPollDelayMillis'])) { + $this->defaultPollSettings['initialPollDelayMillis'] = $options['initialPollDelayMillis']; + } + if (isset($options['pollDelayMultiplier'])) { + $this->defaultPollSettings['pollDelayMultiplier'] = $options['pollDelayMultiplier']; + } + if (isset($options['maxPollDelayMillis'])) { + $this->defaultPollSettings['maxPollDelayMillis'] = $options['maxPollDelayMillis']; + } + if (isset($options['totalPollTimeoutMillis'])) { + $this->defaultPollSettings['totalPollTimeoutMillis'] = $options['totalPollTimeoutMillis']; + } + } + + /** + * Check whether the operation has completed. + * + * @return bool + */ + public function isDone() + { + if (!$this->hasProtoResponse()) { + return false; + } + + $status = call_user_func([$this->lastProtoResponse, $this->operationStatusMethod]); + if (is_null($status)) { + return false; + } + + return $status === $this->operationStatusDoneValue; + } + + /** + * Check whether the operation completed successfully. If the operation is not complete, or if the operation + * failed, return false. + * + * @return bool + */ + public function operationSucceeded() + { + if (!$this->hasProtoResponse()) { + return false; + } + + if (!$this->canHaveResult()) { + // For Operations which do not have a result, we consider a successful + // operation when the operation has completed without errors. + return $this->isDone() && !$this->hasErrors(); + } + + return !is_null($this->getResult()); + } + + /** + * Check whether the operation failed. If the operation is not complete, or if the operation + * succeeded, return false. + * + * @return bool + */ + public function operationFailed() + { + return $this->hasErrors(); + } + + /** + * Get the formatted name of the operation + * + * @return string The formatted name of the operation + */ + public function getName() + { + return $this->operationName; + } + + /** + * Poll the server in a loop until the operation is complete. + * + * Return true if the operation completed, otherwise return false. If the + * $options['totalPollTimeoutMillis'] setting is not set (or set <= 0) then + * pollUntilComplete will continue polling until the operation completes, + * and therefore will always return true. + * + * @param array $options { + * Options for configuring the polling behaviour. + * + * @type int $initialPollDelayMillis The initial polling interval to use, in milliseconds. + * @type int $pollDelayMultiplier Multiplier applied to the polling interval on each retry. + * @type int $maxPollDelayMillis The maximum polling interval to use, in milliseconds. + * @type int $totalPollTimeoutMillis The maximum amount of time to continue polling, in milliseconds. + * } + * @throws ApiException If an API call fails. + * @throws ValidationException + * @return bool Indicates if the operation completed. + */ + public function pollUntilComplete($options = []) + { + if ($this->isDone()) { + return true; + } + + $pollSettings = array_merge($this->defaultPollSettings, $options); + return $this->poll(function () { + $this->reload(); + return $this->isDone(); + }, $pollSettings); + } + + /** + * Reload the status of the operation with a request to the service. + * + * @throws ApiException If the API call fails. + * @throws ValidationException If called on a deleted operation. + */ + public function reload() + { + if ($this->deleted) { + throw new ValidationException("Cannot call reload() on a deleted operation"); + } + $this->lastProtoResponse = $this->operationsCall( + $this->getOperationMethod, + $this->getName(), + $this->additionalArgs + ); + } + + /** + * Return the result of the operation. If operationSucceeded() is false, return null. + * + * @return mixed|null The result of the operation, or null if operationSucceeded() is false + */ + public function getResult() + { + if (!$this->hasProtoResponse()) { + return null; + } + + if (!$this->canHaveResult()) { + return null; + } + + if (!$this->isDone()) { + return null; + } + + /** @var Any $anyResponse */ + $anyResponse = $this->lastProtoResponse->getResponse(); + if (is_null($anyResponse)) { + return null; + } + if (is_null($this->operationReturnType)) { + return $anyResponse; + } + $operationReturnType = $this->operationReturnType; + /** @var Message $response */ + $response = new $operationReturnType(); + $response->mergeFromString($anyResponse->getValue()); + return $response; + } + + /** + * If the operation failed, return the status. If operationFailed() is false, return null. + * + * @return Status|null The status of the operation in case of failure, or null if + * operationFailed() is false. + */ + public function getError() + { + if (!$this->hasProtoResponse() || !$this->isDone()) { + return null; + } + + if ($this->operationErrorCodeMethod || $this->operationErrorMessageMethod) { + $errorCode = $this->operationErrorCodeMethod + ? call_user_func([$this->lastProtoResponse, $this->operationErrorCodeMethod]) + : null; + $errorMessage = $this->operationErrorMessageMethod + ? call_user_func([$this->lastProtoResponse, $this->operationErrorMessageMethod]) + : null; + return (new Status()) + ->setCode(ApiStatus::rpcCodeFromHttpStatusCode($errorCode)) + ->setMessage($errorMessage); + } + + if (method_exists($this->lastProtoResponse, 'getError')) { + return $this->lastProtoResponse->getError(); + } + + return null; + } + + /** + * Get an array containing the values of 'operationReturnType', 'metadataReturnType', and + * the polling options `initialPollDelayMillis`, `pollDelayMultiplier`, `maxPollDelayMillis`, + * and `totalPollTimeoutMillis`. The array can be passed as the $options argument to the + * constructor when creating another OperationResponse object. + * + * @return array + */ + public function getDescriptorOptions() + { + return [ + 'operationReturnType' => $this->operationReturnType, + 'metadataReturnType' => $this->metadataReturnType, + ] + $this->defaultPollSettings; + } + + /** + * @return Operation|mixed|null The last Operation object received from the server. + */ + public function getLastProtoResponse() + { + return $this->lastProtoResponse; + } + + /** + * @return object The OperationsClient object used to make + * requests to the operations API. + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Cancel the long-running operation. + * + * For operations of type Google\LongRunning\Operation, this method starts + * asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it will throw an + * ApiException with code \Google\Rpc\Code::UNIMPLEMENTED. Clients can continue + * to use reload and pollUntilComplete methods to check whether the cancellation + * succeeded or whether the operation completed despite cancellation. + * On successful cancellation, the operation is not deleted; instead, it becomes + * an operation with a getError() value with a \Google\Rpc\Status code of 1, + * corresponding to \Google\Rpc\Code::CANCELLED. + * + * @throws ApiException If the API call fails. + * @throws LogicException If the API call method has not been configured + */ + public function cancel() + { + if (is_null($this->cancelOperationMethod)) { + throw new LogicException('The cancel operation is not supported by this API'); + } + $this->operationsCall($this->cancelOperationMethod, $this->getName(), $this->additionalArgs); + } + + /** + * Delete the long-running operation. + * + * For operations of type Google\LongRunning\Operation, this method + * indicates that the client is no longer interested in the operation result. + * It does not cancel the operation. If the server doesn't support this method, + * it will throw an ApiException with code \Google\Rpc\Code::UNIMPLEMENTED. + * + * @throws ApiException If the API call fails. + * @throws LogicException If the API call method has not been configured + */ + public function delete() + { + if (is_null($this->deleteOperationMethod)) { + throw new LogicException('The delete operation is not supported by this API'); + } + $this->operationsCall($this->deleteOperationMethod, $this->getName(), $this->additionalArgs); + $this->deleted = true; + } + + /** + * Get the metadata returned with the last proto response. If a metadata type was provided, then + * the return value will be of that type - otherwise, the return value will be of type Any. If + * no metadata object is available, returns null. + * + * @return mixed The metadata returned from the server in the last response. + */ + public function getMetadata() + { + if (!$this->hasProtoResponse()) { + return null; + } + + if (!method_exists($this->lastProtoResponse, 'getMetadata')) { + // The call to getMetadata is only for OnePlatform LROs, and is not + // supported by other LRO GAPIC clients (e.g. Compute) + return null; + } + + /** @var Any $any */ + $any = $this->lastProtoResponse->getMetadata(); + if (is_null($this->metadataReturnType)) { + return $any; + } + if (is_null($any) || is_null($any->getValue())) { + return null; + } + $metadataReturnType = $this->metadataReturnType; + /** @var Message $metadata */ + $metadata = new $metadataReturnType(); + $metadata->mergeFromString($any->getValue()); + return $metadata; + } + + private function operationsCall($method, $name, array $additionalArgs) + { + $args = array_merge([$name], $additionalArgs); + return call_user_func_array([$this->operationsClient, $method], $args); + } + + private function canHaveResult() + { + // The call to getResponse is only for OnePlatform LROs, and is not + // supported by other LRO GAPIC clients (e.g. Compute) + return method_exists($this->lastProtoResponse, 'getResponse'); + } + + private function hasErrors() + { + if (!$this->hasProtoResponse()) { + return false; + } + + if (method_exists($this->lastProtoResponse, 'getError')) { + return !empty($this->lastProtoResponse->getError()); + } + + if ($this->operationErrorCodeMethod) { + $errorCode = call_user_func([$this->lastProtoResponse, $this->operationErrorCodeMethod]); + return !empty($errorCode); + } + + // This should never happen unless an API is misconfigured + throw new LogicException('Unable to determine operation error status for this service'); + } + + private function hasProtoResponse() + { + return !is_null($this->lastProtoResponse); + } +} diff --git a/vendor/google/gax/src/Page.php b/vendor/google/gax/src/Page.php new file mode 100644 index 00000000..545cba71 --- /dev/null +++ b/vendor/google/gax/src/Page.php @@ -0,0 +1,270 @@ +call = $call; + $this->options = $options; + $this->callable = $callable; + $this->pageStreamingDescriptor = $pageStreamingDescriptor; + $this->response = $response; + + $requestPageTokenGetMethod = $this->pageStreamingDescriptor->getRequestPageTokenGetMethod(); + $this->pageToken = $this->call->getMessage()->$requestPageTokenGetMethod(); + } + + /** + * Returns true if there are more pages that can be retrieved from the + * API. + * + * @return bool + */ + public function hasNextPage() + { + return strcmp($this->getNextPageToken(), Page::FINAL_PAGE_TOKEN) != 0; + } + + /** + * Returns the next page token from the response. + * + * @return string + */ + public function getNextPageToken() + { + $responsePageTokenGetMethod = $this->pageStreamingDescriptor->getResponsePageTokenGetMethod(); + return $this->getResponseObject()->$responsePageTokenGetMethod(); + } + + /** + * Retrieves the next Page object using the next page token. + * + * @param int|null $pageSize + * @throws ValidationException if there are no pages remaining, or if pageSize is supplied but + * is not supported by the API + * @throws ApiException if the call to fetch the next page fails. + * @return Page + */ + public function getNextPage($pageSize = null) + { + if (!$this->hasNextPage()) { + throw new ValidationException( + 'Could not complete getNextPage operation: ' . + 'there are no more pages to retrieve.' + ); + } + + $oldRequest = $this->getRequestObject(); + $requestClass = get_class($oldRequest); + $newRequest = new $requestClass(); + $newRequest->mergeFrom($oldRequest); + + $requestPageTokenSetMethod = $this->pageStreamingDescriptor->getRequestPageTokenSetMethod(); + $newRequest->$requestPageTokenSetMethod($this->getNextPageToken()); + + if (isset($pageSize)) { + if (!$this->pageStreamingDescriptor->requestHasPageSizeField()) { + throw new ValidationException( + 'pageSize argument was defined, but the method does not ' . + 'support a page size parameter in the optional array argument' + ); + } + $requestPageSizeSetMethod = $this->pageStreamingDescriptor->getRequestPageSizeSetMethod(); + $newRequest->$requestPageSizeSetMethod($pageSize); + } + $this->call = $this->call->withMessage($newRequest); + + $callable = $this->callable; + $response = $callable( + $this->call, + $this->options + )->wait(); + + return new Page( + $this->call, + $this->options, + $this->callable, + $this->pageStreamingDescriptor, + $response + ); + } + + /** + * Return the number of elements in the response. + * + * @return int + */ + public function getPageElementCount() + { + $resourcesGetMethod = $this->pageStreamingDescriptor->getResourcesGetMethod(); + return count($this->getResponseObject()->$resourcesGetMethod()); + } + + /** + * Return an iterator over the elements in the response. + * + * @return Generator + */ + public function getIterator() + { + $resourcesGetMethod = $this->pageStreamingDescriptor->getResourcesGetMethod(); + $items = $this->getResponseObject()->$resourcesGetMethod(); + foreach ($items as $key => $element) { + if ($items instanceof MapField) { + yield $key => $element; + } else { + yield $element; + } + } + } + + /** + * Return an iterator over Page objects, beginning with this object. + * Additional Page objects are retrieved lazily via API calls until + * all elements have been retrieved. + * + * @return Generator|Page[] + * @throws ValidationException + * @throws ApiException + */ + public function iteratePages() + { + $currentPage = $this; + yield $this; + while ($currentPage->hasNextPage()) { + $currentPage = $currentPage->getNextPage(); + yield $currentPage; + } + } + + /** + * Gets the request object used to generate the Page. + * + * @return mixed|Message + */ + public function getRequestObject() + { + return $this->call->getMessage(); + } + + /** + * Gets the API response object. + * + * @return mixed|Message + */ + public function getResponseObject() + { + return $this->response; + } + + /** + * Returns a collection of elements with a fixed size set by + * the collectionSize parameter. The collection will only contain + * fewer than collectionSize elements if there are no more + * pages to be retrieved from the server. + * + * NOTE: it is an error to call this method if an optional parameter + * to set the page size is not supported or has not been set in the + * API call that was used to create this page. It is also an error + * if the collectionSize parameter is less than the page size that + * has been set. + * + * @param $collectionSize int + * @throws ValidationException if a FixedSizeCollection of the specified size cannot be constructed + * @return FixedSizeCollection + */ + public function expandToFixedSizeCollection($collectionSize) + { + if (!$this->pageStreamingDescriptor->requestHasPageSizeField()) { + throw new ValidationException( + "FixedSizeCollection is not supported for this method, because " . + "the method does not support an optional argument to set the " . + "page size." + ); + } + $request = $this->getRequestObject(); + $pageSizeGetMethod = $this->pageStreamingDescriptor->getRequestPageSizeGetMethod(); + $pageSize = $request->$pageSizeGetMethod(); + if (is_null($pageSize)) { + throw new ValidationException( + "Error while expanding Page to FixedSizeCollection: No page size " . + "parameter found. The page size parameter must be set in the API " . + "optional arguments array, and must be less than the collectionSize " . + "parameter, in order to create a FixedSizeCollection object." + ); + } + if ($pageSize > $collectionSize) { + throw new ValidationException( + "Error while expanding Page to FixedSizeCollection: collectionSize " . + "parameter is less than the page size optional argument specified in " . + "the API call. collectionSize: $collectionSize, page size: $pageSize" + ); + } + return new FixedSizeCollection($this, $collectionSize); + } +} diff --git a/vendor/google/gax/src/PageStreamingDescriptor.php b/vendor/google/gax/src/PageStreamingDescriptor.php new file mode 100644 index 00000000..d7fef50f --- /dev/null +++ b/vendor/google/gax/src/PageStreamingDescriptor.php @@ -0,0 +1,178 @@ +descriptor = $descriptor; + } + + /** + * @param array $fields { + * Required. + * + * @type string $requestPageTokenField the page token field in the request object. + * @type string $responsePageTokenField the page token field in the response object. + * @type string $resourceField the resource field in the response object. + * + * Optional. + * @type string $requestPageSizeField the page size field in the request object. + * } + * @return PageStreamingDescriptor + */ + public static function createFromFields($fields) + { + $requestPageToken = $fields['requestPageTokenField']; + $responsePageToken = $fields['responsePageTokenField']; + $resources = $fields['resourceField']; + + $descriptor = [ + 'requestPageTokenGetMethod' => PageStreamingDescriptor::getMethod($requestPageToken), + 'requestPageTokenSetMethod' => PageStreamingDescriptor::setMethod($requestPageToken), + 'responsePageTokenGetMethod' => PageStreamingDescriptor::getMethod($responsePageToken), + 'resourcesGetMethod' => PageStreamingDescriptor::getMethod($resources), + ]; + + if (isset($fields['requestPageSizeField'])) { + $requestPageSize = $fields['requestPageSizeField']; + $descriptor['requestPageSizeGetMethod'] = PageStreamingDescriptor::getMethod($requestPageSize); + $descriptor['requestPageSizeSetMethod'] = PageStreamingDescriptor::setMethod($requestPageSize); + } + + return new PageStreamingDescriptor($descriptor); + } + + private static function getMethod($field) + { + return 'get' . ucfirst($field); + } + + private static function setMethod($field) + { + return 'set' . ucfirst($field); + } + + /** + * @return string The page token get method on the request object + */ + public function getRequestPageTokenGetMethod() + { + return $this->descriptor['requestPageTokenGetMethod']; + } + + /** + * @return string The page size get method on the request object + */ + public function getRequestPageSizeGetMethod() + { + return $this->descriptor['requestPageSizeGetMethod']; + } + + /** + * @return bool True if the request object has a page size field + */ + public function requestHasPageSizeField() + { + return array_key_exists('requestPageSizeGetMethod', $this->descriptor); + } + + /** + * @return string The page token get method on the response object + */ + public function getResponsePageTokenGetMethod() + { + return $this->descriptor['responsePageTokenGetMethod']; + } + + /** + * @return string The resources get method on the response object + */ + public function getResourcesGetMethod() + { + return $this->descriptor['resourcesGetMethod']; + } + + /** + * @return string The page token set method on the request object + */ + public function getRequestPageTokenSetMethod() + { + return $this->descriptor['requestPageTokenSetMethod']; + } + + /** + * @return string The page size set method on the request object + */ + public function getRequestPageSizeSetMethod() + { + return $this->descriptor['requestPageSizeSetMethod']; + } + + private static function validate($descriptor) + { + $requiredFields = [ + 'requestPageTokenGetMethod', + 'requestPageTokenSetMethod', + 'responsePageTokenGetMethod', + 'resourcesGetMethod', + ]; + foreach ($requiredFields as $field) { + if (empty($descriptor[$field])) { + throw new InvalidArgumentException( + "$field is required for PageStreamingDescriptor" + ); + } + } + } +} diff --git a/vendor/google/gax/src/PagedListResponse.php b/vendor/google/gax/src/PagedListResponse.php new file mode 100644 index 00000000..88d30449 --- /dev/null +++ b/vendor/google/gax/src/PagedListResponse.php @@ -0,0 +1,196 @@ +getList(...); + * foreach ($pagedListResponse as $element) { + * // doSomethingWith($element); + * } + * ``` + * + * Example of iterating over each page of elements: + * ``` + * $pagedListResponse = $client->getList(...); + * foreach ($pagedListResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * ``` + * + * Example of accessing the current page, and manually iterating + * over pages: + * ``` + * $pagedListResponse = $client->getList(...); + * $page = $pagedListResponse->getPage(); + * // doSomethingWith($page); + * while ($page->hasNextPage()) { + * $page = $page->getNextPage(); + * // doSomethingWith($page); + * } + * ``` + */ +class PagedListResponse implements IteratorAggregate +{ + private $firstPage; + + /** + * PagedListResponse constructor. + * + * @param Page $firstPage A page containing response details. + */ + public function __construct( + Page $firstPage + ) { + $this->firstPage = $firstPage; + } + + /** + * Returns an iterator over the full list of elements. If the + * API response contains a (non-empty) next page token, then + * the PagedListResponse object will make calls to the underlying + * API to retrieve additional elements as required. + * + * NOTE: The result of this method is the same as getIterator(). + * Prefer using getIterator(), or iterate directly on the + * PagedListResponse object. + * + * @return Generator + * @throws ValidationException + */ + public function iterateAllElements() + { + return $this->getIterator(); + } + + /** + * Returns an iterator over the full list of elements. If the + * API response contains a (non-empty) next page token, then + * the PagedListResponse object will make calls to the underlying + * API to retrieve additional elements as required. + * + * @return Generator + * @throws ValidationException + */ + public function getIterator() + { + foreach ($this->iteratePages() as $page) { + foreach ($page as $key => $element) { + yield $key => $element; + } + } + } + + /** + * Return the current page of results. + * + * @return Page + */ + public function getPage() + { + return $this->firstPage; + } + + /** + * Returns an iterator over pages of results. The pages are + * retrieved lazily from the underlying API. + * + * @return Page[] + * @throws ValidationException + */ + public function iteratePages() + { + return $this->getPage()->iteratePages(); + } + + /** + * Returns a collection of elements with a fixed size set by + * the collectionSize parameter. The collection will only contain + * fewer than collectionSize elements if there are no more + * pages to be retrieved from the server. + * + * NOTE: it is an error to call this method if an optional parameter + * to set the page size is not supported or has not been set in the + * original API call. It is also an error if the collectionSize parameter + * is less than the page size that has been set. + * + * @param $collectionSize int + * @throws ValidationException if a FixedSizeCollection of the specified size cannot be constructed + * @return FixedSizeCollection + */ + public function expandToFixedSizeCollection($collectionSize) + { + return $this->getPage()->expandToFixedSizeCollection($collectionSize); + } + + /** + * Returns an iterator over fixed size collections of results. + * The collections are retrieved lazily from the underlying API. + * + * Each collection will have collectionSize elements, with the + * exception of the final collection which may contain fewer + * elements. + * + * NOTE: it is an error to call this method if an optional parameter + * to set the page size is not supported or has not been set in the + * original API call. It is also an error if the collectionSize parameter + * is less than the page size that has been set. + * + * @param $collectionSize int + * @throws ValidationException if a FixedSizeCollection of the specified size cannot be constructed + * @return Generator|FixedSizeCollection[] + */ + public function iterateFixedSizeCollections($collectionSize) + { + return $this->expandToFixedSizeCollection($collectionSize)->iterateCollections(); + } +} diff --git a/vendor/google/gax/src/PathTemplate.php b/vendor/google/gax/src/PathTemplate.php new file mode 100644 index 00000000..9374ef77 --- /dev/null +++ b/vendor/google/gax/src/PathTemplate.php @@ -0,0 +1,113 @@ +resourceTemplate = new AbsoluteResourceTemplate($path); + } else { + $this->resourceTemplate = new RelativeResourceTemplate($path); + } + } + + /** + * @return string A string representation of the path template + */ + public function __toString() + { + return $this->resourceTemplate->__toString(); + } + + /** + * Renders a path template using the provided bindings. + * + * @param array $bindings An array matching var names to binding strings. + * @throws ValidationException if a key isn't provided or if a sub-template + * can't be parsed. + * @return string A rendered representation of this path template. + */ + public function render(array $bindings) + { + return $this->resourceTemplate->render($bindings); + } + + /** + * Check if $path matches a resource string. + * + * @param string $path A resource string. + * @return bool + */ + public function matches($path) + { + return $this->resourceTemplate->matches($path); + } + + /** + * Matches a fully qualified path template string. + * + * @param string $path A fully qualified path template string. + * @throws ValidationException if path can't be matched to the template. + * @return array Array matching var names to binding values. + */ + public function match($path) + { + return $this->resourceTemplate->match($path); + } +} diff --git a/vendor/google/gax/src/PollingTrait.php b/vendor/google/gax/src/PollingTrait.php new file mode 100644 index 00000000..66efe69c --- /dev/null +++ b/vendor/google/gax/src/PollingTrait.php @@ -0,0 +1,94 @@ + 0.0; + $endTime = $this->getCurrentTimeMillis() + $totalPollTimeoutMillis; + + while (true) { + if ($hasTotalPollTimeout && $this->getCurrentTimeMillis() > $endTime) { + return false; + } + $this->sleepMillis($currentPollDelayMillis); + if ($pollCallable()) { + return true; + } + $currentPollDelayMillis = min([ + $currentPollDelayMillis * $pollDelayMultiplier, + $maxPollDelayMillis + ]); + } + } + + /** + * Protected to allow overriding for tests + * + * @return float Current time in milliseconds + */ + protected function getCurrentTimeMillis() + { + return microtime(true) * 1000.0; + } + + /** + * Protected to allow overriding for tests + * + * @param float $millis + */ + protected function sleepMillis($millis) + { + usleep($millis * 1000); + } +} diff --git a/vendor/google/gax/src/RequestBuilder.php b/vendor/google/gax/src/RequestBuilder.php new file mode 100644 index 00000000..dcfdfb7d --- /dev/null +++ b/vendor/google/gax/src/RequestBuilder.php @@ -0,0 +1,270 @@ +baseUri = $baseUri; + $this->restConfig = require($restConfigPath); + } + + /** + * @param string $path + * @return bool + */ + public function pathExists($path) + { + list($interface, $method) = explode('/', $path); + return isset($this->restConfig['interfaces'][$interface][$method]); + } + + /** + * @param string $path + * @param Message $message + * @param array $headers + * @return RequestInterface + * @throws ValidationException + */ + public function build($path, Message $message, array $headers = []) + { + list($interface, $method) = explode('/', $path); + + if (!isset($this->restConfig['interfaces'][$interface][$method])) { + throw new ValidationException( + "Failed to build request, as the provided path ($path) was not found in the configuration." + ); + } + + $methodConfig = $this->restConfig['interfaces'][$interface][$method] + [ + 'placeholders' => [], + 'body' => null, + 'additionalBindings' => null, + ]; + $bindings = $this->buildBindings($methodConfig['placeholders'], $message); + $uriTemplateConfigs = $this->getConfigsForUriTemplates($methodConfig); + + foreach ($uriTemplateConfigs as $config) { + $pathTemplate = $this->tryRenderPathTemplate($config['uriTemplate'], $bindings); + + if ($pathTemplate) { + // We found a valid uriTemplate - now build and return the Request + + list($body, $queryParams) = $this->constructBodyAndQueryParameters($message, $config); + $uri = $this->buildUri($pathTemplate, $queryParams); + + return new Request( + $config['method'], + $uri, + ['Content-Type' => 'application/json'] + $headers, + $body + ); + } + } + + // No valid uriTemplate found - construct an exception + $uriTemplates = []; + foreach ($uriTemplateConfigs as $config) { + $uriTemplates[] = $config['uriTemplate']; + } + + throw new ValidationException("Could not map bindings for $path to any Uri template.\n" . + "Bindings: " . print_r($bindings, true) . + "UriTemplates: " . print_r($uriTemplates, true)); + } + + /** + * Create a list of all possible configs using the additionalBindings + * + * @param array $config + * @return array[] An array of configs + */ + private function getConfigsForUriTemplates($config) + { + $configs = [$config]; + + if ($config['additionalBindings']) { + foreach ($config['additionalBindings'] as $additionalBinding) { + $configs[] = $additionalBinding + $config; + } + } + + return $configs; + } + + /** + * @param $message + * @param $config + * @return array Tuple [$body, $queryParams] + */ + private function constructBodyAndQueryParameters(Message $message, $config) + { + $messageDataJson = $message->serializeToJsonString(); + + if ($config['body'] === '*') { + return [$messageDataJson, []]; + } + + $body = null; + $queryParams = []; + $messageData = json_decode($messageDataJson, true); + foreach ($messageData as $name => $value) { + if (array_key_exists($name, $config['placeholders'])) { + continue; + } + + if (Serializer::toSnakeCase($name) === $config['body']) { + if (($bodyMessage = $message->{"get$name"}()) instanceof Message) { + $body = $bodyMessage->serializeToJsonString(); + } else { + $body = json_encode($value); + } + continue; + } + + if (is_array($value) && $this->isAssoc($value)) { + foreach ($value as $key => $value2) { + $queryParams[$name . '.' . $key] = $value2; + } + } else { + $queryParams[$name] = $value; + } + } + + // Ensures required query params with default values are always sent + // over the wire. + if (isset($config['queryParams'])) { + foreach ($config['queryParams'] as $requiredQueryParam) { + $requiredQueryParam = Serializer::toCamelCase($requiredQueryParam); + if (!array_key_exists($requiredQueryParam, $queryParams)) { + $getter = Serializer::getGetter($requiredQueryParam); + $queryParams[$requiredQueryParam] = $message->$getter(); + } + } + } + + return [$body, $queryParams]; + } + + /** + * @param array $placeholders + * @param Message $message + * @return array Bindings from path template fields to values from message + */ + private function buildBindings(array $placeholders, Message $message) + { + $bindings = []; + foreach ($placeholders as $placeholder => $metadata) { + $value = array_reduce( + $metadata['getters'], + function (Message $result = null, $getter) { + if ($result) { + return $result->$getter(); + } + }, + $message + ); + + $bindings[$placeholder] = $value; + } + return $bindings; + } + + /** + * Try to render the resource name. The rendered resource name will always contain a leading '/' + * + * @param $uriTemplate + * @param array $bindings + * @return null|string + * @throws ValidationException + */ + private function tryRenderPathTemplate($uriTemplate, array $bindings) + { + $template = new AbsoluteResourceTemplate($uriTemplate); + + try { + return $template->render($bindings); + } catch (ValidationException $e) { + return null; + } + } + + /** + * @param $path + * @param $queryParams + * @return UriInterface + */ + private function buildUri($path, $queryParams) + { + $uri = Utils::uriFor( + sprintf( + 'https://%s%s', + $this->baseUri, + $path + ) + ); + if ($queryParams) { + $uri = $this->buildUriWithQuery( + $uri, + $queryParams + ); + } + return $uri; + } +} diff --git a/vendor/google/gax/src/RequestParamsHeaderDescriptor.php b/vendor/google/gax/src/RequestParamsHeaderDescriptor.php new file mode 100644 index 00000000..0be8a9cb --- /dev/null +++ b/vendor/google/gax/src/RequestParamsHeaderDescriptor.php @@ -0,0 +1,78 @@ + value]. + */ + public function __construct($requestParams) + { + $headerKey = self::HEADER_KEY; + + $headerValue = ''; + foreach ($requestParams as $key => $value) { + if ('' !== $headerValue) { + $headerValue .= '&'; + } + + $headerValue .= $key . '=' . urlencode(strval($value)); + } + + $this->header = [$headerKey => [$headerValue]]; + } + + /** + * Returns an associative array that contains request params header metadata. + * + * @return array + */ + public function getHeader() + { + return $this->header; + } +} diff --git a/vendor/google/gax/src/ResourceTemplate/AbsoluteResourceTemplate.php b/vendor/google/gax/src/ResourceTemplate/AbsoluteResourceTemplate.php new file mode 100644 index 00000000..a5c70081 --- /dev/null +++ b/vendor/google/gax/src/ResourceTemplate/AbsoluteResourceTemplate.php @@ -0,0 +1,146 @@ +"). + * + * Examples: + * /projects + * /projects/{project} + * /foo/{bar=**}/fizz/*:action + * + * Templates use the syntax of the API platform; see + * https://github.com/googleapis/api-common-protos/blob/master/google/api/http.proto + * for details. A template consists of a sequence of literals, wildcards, and variable bindings, + * where each binding can have a sub-path. A string representation can be parsed into an + * instance of AbsoluteResourceTemplate, which can then be used to perform matching and instantiation. + */ +class AbsoluteResourceTemplate implements ResourceTemplateInterface +{ + /** @var RelativeResourceTemplate */ + private $resourceTemplate; + + /** @var string */ + private $verb; + + /** + * AbsoluteResourceTemplate constructor. + * @param string $path + * @throws ValidationException + */ + public function __construct($path) + { + if (empty($path)) { + throw new ValidationException("Cannot construct AbsoluteResourceTemplate from empty string"); + } + if ($path[0] !== '/') { + throw new ValidationException( + "Could not construct AbsoluteResourceTemplate from '$path': must begin with '/'" + ); + } + $verbSeparatorPos = $this->verbSeparatorPos($path); + $this->resourceTemplate = new RelativeResourceTemplate(substr($path, 1, $verbSeparatorPos - 1)); + $this->verb = substr($path, $verbSeparatorPos + 1); + } + + /** + * @inheritdoc + */ + public function __toString() + { + return sprintf("/%s%s", $this->resourceTemplate, $this->renderVerb()); + } + + /** + * @inheritdoc + */ + public function render(array $bindings) + { + return sprintf("/%s%s", $this->resourceTemplate->render($bindings), $this->renderVerb()); + } + + /** + * @inheritdoc + */ + public function matches($path) + { + try { + $this->match($path); + return true; + } catch (ValidationException $ex) { + return false; + } + } + + /** + * @inheritdoc + */ + public function match($path) + { + if (empty($path)) { + throw $this->matchException($path, "path cannot be empty"); + } + if ($path[0] !== '/') { + throw $this->matchException($path, "missing leading '/'"); + } + $verbSeparatorPos = $this->verbSeparatorPos($path); + if (substr($path, $verbSeparatorPos + 1) !== $this->verb) { + throw $this->matchException($path, "trailing verb did not match '{$this->verb}'"); + } + return $this->resourceTemplate->match(substr($path, 1, $verbSeparatorPos - 1)); + } + + private function matchException($path, $reason) + { + return new ValidationException("Could not match path '$path' to template '$this': $reason"); + } + + private function renderVerb() + { + return $this->verb ? ':' . $this->verb : ''; + } + + private function verbSeparatorPos($path) + { + $finalSeparatorPos = strrpos($path, '/'); + $verbSeparatorPos = strrpos($path, ':', $finalSeparatorPos); + if ($verbSeparatorPos === false) { + $verbSeparatorPos = strlen($path); + } + return $verbSeparatorPos; + } +} diff --git a/vendor/google/gax/src/ResourceTemplate/Parser.php b/vendor/google/gax/src/ResourceTemplate/Parser.php new file mode 100644 index 00000000..58898393 --- /dev/null +++ b/vendor/google/gax/src/ResourceTemplate/Parser.php @@ -0,0 +1,225 @@ += strlen($path)) { + // A trailing '/' has caused the index to exceed the bounds + // of the string - provide a helpful error message. + throw self::parseError($path, strlen($path) - 1, "invalid trailing '/'"); + } + if ($path[$index] === '{') { + // Validate that the { has a matching } + $closingBraceIndex = strpos($path, '}', $index); + if ($closingBraceIndex === false) { + throw self::parseError( + $path, + strlen($path), + "Expected '}' to match '{' at index $index, got end of string" + ); + } + + $segmentStringLengthWithoutBraces = $closingBraceIndex - $index - 1; + $segmentStringWithoutBraces = substr($path, $index + 1, $segmentStringLengthWithoutBraces); + $index = $closingBraceIndex + 1; + + $nextLiteral = '/'; + $remainingPath = substr($path, $index); + if (!empty($remainingPath)) { + // Find the firstnon-slash separator seen, if any. + $nextSlashIndex = strpos($remainingPath, '/', 0); + $nonSlashSeparators = ['-', '_', '~', '.']; + foreach ($nonSlashSeparators as $nonSlashSeparator) { + $nonSlashSeparatorIndex = strpos($remainingPath, $nonSlashSeparator, 0); + $nextOpenBraceIndex = strpos($remainingPath, '{', 0); + if ($nonSlashSeparatorIndex !== false && $nonSlashSeparatorIndex === $nextOpenBraceIndex - 1) { + $index += $nonSlashSeparatorIndex; + $nextLiteral = $nonSlashSeparator; + break; + } + } + } + + return self::parseVariableSegment($segmentStringWithoutBraces, $nextLiteral); + } else { + $nextSlash = strpos($path, '/', $index); + if ($nextSlash === false) { + $nextSlash = strlen($path); + } + $segmentString = substr($path, $index, $nextSlash - $index); + $nextLiteral = '/'; + $index = $nextSlash; + return self::parse($segmentString, $path, $index); + } + } + + /** + * @param string $segmentString + * @param string $path + * @param int $index + * @return Segment + * @throws ValidationException + */ + private static function parse($segmentString, $path, $index) + { + if ($segmentString === '*') { + return new Segment(Segment::WILDCARD_SEGMENT); + } elseif ($segmentString === '**') { + return new Segment(Segment::DOUBLE_WILDCARD_SEGMENT); + } else { + if (!self::isValidLiteral($segmentString)) { + if (empty($segmentString)) { + // Create user friendly message in case of empty segment + throw self::parseError($path, $index, "Unexpected empty segment (consecutive '/'s are invalid)"); + } else { + throw self::parseError($path, $index, "Unexpected characters in literal segment $segmentString"); + } + } + return new Segment(Segment::LITERAL_SEGMENT, $segmentString); + } + } + + /** + * @param string $segmentStringWithoutBraces + * @param string $separatorLiteral + * @return Segment + * @throws ValidationException + */ + private static function parseVariableSegment($segmentStringWithoutBraces, $separatorLiteral) + { + // Validate there are no nested braces + $nestedOpenBracket = strpos($segmentStringWithoutBraces, '{'); + if ($nestedOpenBracket !== false) { + throw new ValidationException( + "Unexpected '{' parsing segment $segmentStringWithoutBraces at index $nestedOpenBracket" + ); + } + + $equalsIndex = strpos($segmentStringWithoutBraces, '='); + if ($equalsIndex === false) { + // If the variable does not contain '=', we assume the pattern is '*' as per google.rpc.Http + $variableKey = $segmentStringWithoutBraces; + $nestedResource = new RelativeResourceTemplate("*"); + } else { + $variableKey = substr($segmentStringWithoutBraces, 0, $equalsIndex); + $nestedResourceString = substr($segmentStringWithoutBraces, $equalsIndex + 1); + $nestedResource = new RelativeResourceTemplate($nestedResourceString); + } + + if (!self::isValidLiteral($variableKey)) { + throw new ValidationException( + "Unexpected characters in variable name $variableKey" + ); + } + return new Segment(Segment::VARIABLE_SEGMENT, null, $variableKey, $nestedResource, $separatorLiteral); + } + + /** + * @param string $literal + * @param string $path + * @param int $index + * @return string + * @throws ValidationException + */ + private static function parseLiteralFromPath($literal, $path, &$index) + { + $literalLength = strlen($literal); + if (strlen($path) < ($index + $literalLength)) { + throw self::parseError($path, $index, "expected '$literal'"); + } + $consumedLiteral = substr($path, $index, $literalLength); + if ($consumedLiteral !== $literal) { + throw self::parseError($path, $index, "expected '$literal'"); + } + $index += $literalLength; + return $consumedLiteral; + } + + private static function parseError($path, $index, $reason) + { + return new ValidationException("Error parsing '$path' at index $index: $reason"); + } + + /** + * Check if $literal is a valid segment literal. Segment literals may only contain numbers, + * letters, and any of the following: .-~_ + * + * @param string $literal + * @return bool + */ + private static function isValidLiteral($literal) + { + return preg_match("/^[0-9a-zA-Z\\.\\-~_]+$/", $literal) === 1; + } +} diff --git a/vendor/google/gax/src/ResourceTemplate/RelativeResourceTemplate.php b/vendor/google/gax/src/ResourceTemplate/RelativeResourceTemplate.php new file mode 100644 index 00000000..8f11f477 --- /dev/null +++ b/vendor/google/gax/src/ResourceTemplate/RelativeResourceTemplate.php @@ -0,0 +1,392 @@ +"). + * + * Examples: + * projects + * projects/{project} + * foo/{bar=**}/fizz/* + * + * Templates use the syntax of the API platform; see + * https://github.com/googleapis/api-common-protos/blob/master/google/api/http.proto + * for details. A template consists of a sequence of literals, wildcards, and variable bindings, + * where each binding can have a sub-path. A string representation can be parsed into an + * instance of AbsoluteResourceTemplate, which can then be used to perform matching and instantiation. + */ +class RelativeResourceTemplate implements ResourceTemplateInterface +{ + /** @var Segment[] $segments */ + private $segments; + + /** + * RelativeResourceTemplate constructor. + * + * @param string $path + * @throws ValidationException + */ + public function __construct($path) + { + if (empty($path)) { + $msg = sprintf( + "Cannot construct RelativeResourceTemplate from %s string", + is_null($path) ? "null" : "empty" + ); + throw new ValidationException($msg); + } + $this->segments = Parser::parseSegments($path); + + $doubleWildcardCount = self::countDoubleWildcards($this->segments); + if ($doubleWildcardCount > 1) { + throw new ValidationException( + "Cannot parse '$path': cannot contain more than one path wildcard" + ); + } + + // Check for duplicate keys + $keys = []; + foreach ($this->segments as $segment) { + if ($segment->getSegmentType() === Segment::VARIABLE_SEGMENT) { + if (isset($keys[$segment->getKey()])) { + throw new ValidationException( + "Duplicate key '{$segment->getKey()}' in path $path" + ); + } + $keys[$segment->getKey()] = true; + } + } + } + + /** + * @inheritdoc + */ + public function __toString() + { + return self::renderSegments($this->segments); + } + + /** + * @inheritdoc + */ + public function render(array $bindings) + { + $literalSegments = []; + $keySegmentTuples = self::buildKeySegmentTuples($this->segments); + foreach ($keySegmentTuples as list($key, $segment)) { + /** @var Segment $segment */ + if ($segment->getSegmentType() === Segment::LITERAL_SEGMENT) { + $literalSegments[] = $segment; + continue; + } + if (!array_key_exists($key, $bindings)) { + throw $this->renderingException($bindings, "missing required binding '$key' for segment '$segment'"); + } + $value = $bindings[$key]; + if ($segment->matches($value)) { + $literalSegments[] = new Segment( + Segment::LITERAL_SEGMENT, + $value, + $segment->getValue(), + $segment->getTemplate(), + $segment->getSeparator() + ); + } else { + $valueString = is_null($value) ? "null" : "'$value'"; + throw $this->renderingException( + $bindings, + "expected binding '$key' to match segment '$segment', instead got $valueString" + ); + } + } + return self::renderSegments($literalSegments); + } + + /** + * @inheritdoc + */ + public function matches($path) + { + try { + $this->match($path); + return true; + } catch (ValidationException $ex) { + return false; + } + } + + /** + * @inheritdoc + */ + public function match($path) + { + // High level strategy for matching: + // - Build a list of Segments from our template, where any variable segments are + // flattened into a single, non-nested list + // - Break $path into pieces based on '/'. + // - Use the segments to further subdivide the pieces using any applicable non-slash separators. + // - Match pieces of the path with Segments in the flattened list + + // In order to build correct bindings after we match the $path against our template, we + // need to (a) calculate the correct positional keys for our wildcards, and (b) maintain + // information about the variable identifier of any flattened segments. To do this, we + // build a list of [string, Segment] tuples, where the string component is the appropriate + // key. + $keySegmentTuples = self::buildKeySegmentTuples($this->segments); + + $flattenedKeySegmentTuples = self::flattenKeySegmentTuples($keySegmentTuples); + $flattenedKeySegmentTuplesCount = count($flattenedKeySegmentTuples); + assert($flattenedKeySegmentTuplesCount > 0); + + $slashPathPieces = explode('/', $path); + $pathPieces = []; + $pathPiecesIndex = 0; + $startIndex = 0; + $slashPathPiecesCount = count($slashPathPieces); + $doubleWildcardPieceCount = $slashPathPiecesCount - $flattenedKeySegmentTuplesCount + 1; + + for ($i = 0; $i < count($flattenedKeySegmentTuples); $i++) { + $segmentKey = $flattenedKeySegmentTuples[$i][0]; + $segment = $flattenedKeySegmentTuples[$i][1]; + // In our flattened list of segments, we should never encounter a variable segment + assert($segment->getSegmentType() !== Segment::VARIABLE_SEGMENT); + + if ($segment->getSegmentType() == Segment::DOUBLE_WILDCARD_SEGMENT) { + $pathPiecesForSegment = array_slice($slashPathPieces, $pathPiecesIndex, $doubleWildcardPieceCount); + $pathPiece = implode('/', $pathPiecesForSegment); + $pathPiecesIndex += $doubleWildcardPieceCount; + $pathPieces[] = $pathPiece; + continue; + } + + if ($segment->getSegmentType() == Segment::WILDCARD_SEGMENT) { + if ($pathPiecesIndex >= $slashPathPiecesCount) { + break; + } + } + if ($segment->getSeparator() === '/') { + if ($pathPiecesIndex >= $slashPathPiecesCount) { + throw $this->matchException($path, "segment and path length mismatch"); + } + $pathPiece = substr($slashPathPieces[$pathPiecesIndex++], $startIndex); + $startIndex = 0; + } else { + $rawPiece = substr($slashPathPieces[$pathPiecesIndex], $startIndex); + $pathPieceLength = strpos($rawPiece, $segment->getSeparator()); + $pathPiece = substr($rawPiece, 0, $pathPieceLength); + $startIndex += $pathPieceLength + 1; + } + $pathPieces[] = $pathPiece; + } + + if ($flattenedKeySegmentTuples[$i - 1][1]->getSegmentType() !== Segment::DOUBLE_WILDCARD_SEGMENT) { + // Process any remaining pieces. The binding logic will throw exceptions for any invalid paths. + for (; $pathPiecesIndex < count($slashPathPieces); $pathPiecesIndex++) { + $pathPieces[] = $slashPathPieces[$pathPiecesIndex]; + } + } + $pathPiecesCount = count($pathPieces); + + // We would like to match pieces of our path 1:1 with the segments of our template. However, + // this is confounded by the presence of double wildcards ('**') in the template, which can + // match multiple segments in the path. + // Because there can only be one '**' present, we can determine how many segments it must + // match by examining the difference in count between the template segments and the + // path pieces. + + if ($pathPiecesCount < $flattenedKeySegmentTuplesCount) { + // Each segment in $flattenedKeyedSegments must consume at least one + // segment in $pathSegments, so matching must fail. + throw $this->matchException($path, "path does not contain enough segments to be matched"); + } + + $doubleWildcardPieceCount = $pathPiecesCount - $flattenedKeySegmentTuplesCount + 1; + + $bindings = []; + $pathPiecesIndex = 0; + /** @var Segment $segment */ + foreach ($flattenedKeySegmentTuples as list($segmentKey, $segment)) { + $pathPiece = $pathPieces[$pathPiecesIndex++]; + if (!$segment->matches($pathPiece)) { + throw $this->matchException($path, "expected path element matching '$segment', got '$pathPiece'"); + } + + // If we have a valid key, add our $pathPiece to the $bindings array. Note that there + // may be multiple copies of the same $segmentKey. This is because a flattened variable + // segment can match multiple pieces from the path. We can add these to an array and + // collapse them all once the bindings are complete. + if (isset($segmentKey)) { + $bindings += [$segmentKey => []]; + $bindings[$segmentKey][] = $pathPiece; + } + } + + // It is possible that we have left over path pieces, which can occur if our template does + // not have a double wildcard. In that case, the match should fail. + if ($pathPiecesIndex !== $pathPiecesCount) { + throw $this->matchException($path, "expected end of path, got '$pathPieces[$pathPiecesIndex]'"); + } + + // Collapse the bindings from lists into strings + $collapsedBindings = []; + foreach ($bindings as $key => $boundPieces) { + $collapsedBindings[$key] = implode('/', $boundPieces); + } + + return $collapsedBindings; + } + + private function matchException($path, $reason) + { + return new ValidationException("Could not match path '$path' to template '$this': $reason"); + } + + private function renderingException($bindings, $reason) + { + $bindingsString = print_r($bindings, true); + return new ValidationException( + "Error rendering '$this': $reason\n" . + "Provided bindings: $bindingsString" + ); + } + + /** + * @param Segment[] $segments + * @param string|null $separator An optional string separator + * @return array[] A list of [string, Segment] tuples + */ + private static function buildKeySegmentTuples(array $segments, $separator = null) + { + $keySegmentTuples = []; + $positionalArgumentCounter = 0; + foreach ($segments as $segment) { + switch ($segment->getSegmentType()) { + case Segment::WILDCARD_SEGMENT: + case Segment::DOUBLE_WILDCARD_SEGMENT: + $positionalKey = "\$$positionalArgumentCounter"; + $positionalArgumentCounter++; + $newSegment = $segment; + if ($separator !== null) { + $newSegment = new Segment( + $segment->getSegmentType(), + $segment->getValue(), + $segment->getKey(), + $segment->getTemplate(), + $separator + ); + } + $keySegmentTuples[] = [$positionalKey, $newSegment]; + break; + default: + $keySegmentTuples[] = [$segment->getKey(), $segment]; + } + } + return $keySegmentTuples; + } + + /** + * @param array[] A list of [string, Segment] tuples + * @return array[] A list of [string, Segment] tuples + */ + private static function flattenKeySegmentTuples(array $keySegmentTuples) + { + $flattenedKeySegmentTuples = []; + foreach ($keySegmentTuples as list($key, $segment)) { + /** @var Segment $segment */ + switch ($segment->getSegmentType()) { + case Segment::VARIABLE_SEGMENT: + // For segment variables, replace the segment with the segments of its children + $template = $segment->getTemplate(); + $nestedKeySegmentTuples = self::buildKeySegmentTuples( + $template->segments, + $segment->getSeparator() + ); + foreach ($nestedKeySegmentTuples as list($nestedKey, $nestedSegment)) { + /** @var Segment $nestedSegment */ + // Nested variables are not allowed + assert($nestedSegment->getSegmentType() !== Segment::VARIABLE_SEGMENT); + // Insert the nested segment with key set to the outer key of the + // parent variable segment + $flattenedKeySegmentTuples[] = [$key, $nestedSegment]; + } + break; + default: + // For all other segments, don't change the key or segment + $flattenedKeySegmentTuples[] = [$key, $segment]; + } + } + return $flattenedKeySegmentTuples; + } + + /** + * @param Segment[] $segments + * @return int + */ + private static function countDoubleWildcards(array $segments) + { + $doubleWildcardCount = 0; + foreach ($segments as $segment) { + switch ($segment->getSegmentType()) { + case Segment::DOUBLE_WILDCARD_SEGMENT: + $doubleWildcardCount++; + break; + case Segment::VARIABLE_SEGMENT: + $doubleWildcardCount += self::countDoubleWildcards($segment->getTemplate()->segments); + break; + } + } + return $doubleWildcardCount; + } + + /** + * Joins segments using their separators. + * @param array $segmentsToRender + * @return string + */ + private static function renderSegments($segmentsToRender) + { + $renderResult = ""; + for ($i = 0; $i < count($segmentsToRender); $i++) { + $segment = $segmentsToRender[$i]; + $renderResult .= $segment; + if ($i < count($segmentsToRender) - 1) { + $renderResult .= $segment->getSeparator(); + } + } + return $renderResult; + } +} diff --git a/vendor/google/gax/src/ResourceTemplate/ResourceTemplateInterface.php b/vendor/google/gax/src/ResourceTemplate/ResourceTemplateInterface.php new file mode 100644 index 00000000..1b1b80f2 --- /dev/null +++ b/vendor/google/gax/src/ResourceTemplate/ResourceTemplateInterface.php @@ -0,0 +1,89 @@ +"). (Note that a trailing verb without a + * leading slash is not permitted). + * + * Examples: + * projects + * /projects + * foo/{bar=**}/fizz/* + * /foo/{bar=**}/fizz/*:action + * + * Templates use the syntax of the API platform; see + * https://github.com/googleapis/api-common-protos/blob/master/google/api/http.proto + * for details. A template consists of a sequence of literals, wildcards, and variable bindings, + * where each binding can have a sub-path. A string representation can be parsed into an + * instance of AbsoluteResourceTemplate, which can then be used to perform matching and instantiation. + */ +interface ResourceTemplateInterface +{ + /** + * @return string A string representation of the resource template + */ + public function __toString(); + + /** + * Renders a resource template using the provided bindings. + * + * @param array $bindings An array matching var names to binding strings. + * @return string A rendered representation of this resource template. + * @throws ValidationException If $bindings does not contain all required keys + * or if a sub-template can't be parsed. + */ + public function render(array $bindings); + + /** + * Check if $path matches a resource string. + * + * @param string $path A resource string. + * @return bool + */ + public function matches($path); + + /** + * Matches a given $path to a resource template, and returns an array of bindings between + * wildcards / variables in the template and values in the path. If $path does not match the + * template, then a ValidationException is thrown. + * + * @param string $path A resource string. + * @throws ValidationException if path can't be matched to the template. + * @return array Array matching var names to binding values. + */ + public function match($path); +} diff --git a/vendor/google/gax/src/ResourceTemplate/Segment.php b/vendor/google/gax/src/ResourceTemplate/Segment.php new file mode 100644 index 00000000..9813db45 --- /dev/null +++ b/vendor/google/gax/src/ResourceTemplate/Segment.php @@ -0,0 +1,205 @@ +segmentType = $segmentType; + $this->value = $value; + $this->key = $key; + $this->template = $template; + $this->separator = $separator; + + switch ($this->segmentType) { + case Segment::LITERAL_SEGMENT: + $this->stringRepr = "{$this->value}"; + break; + case Segment::WILDCARD_SEGMENT: + $this->stringRepr = "*"; + break; + case Segment::DOUBLE_WILDCARD_SEGMENT: + $this->stringRepr = "**"; + break; + case Segment::VARIABLE_SEGMENT: + $this->stringRepr = "{{$this->key}={$this->template}}"; + break; + default: + throw new ValidationException( + "Unexpected Segment type: {$this->segmentType}" + ); + } + } + + /** + * @return string A string representation of the segment. + */ + public function __toString() + { + return $this->stringRepr; + } + + /** + * Checks if $value matches this Segment. + * + * @param string $value + * @return bool + * @throws ValidationException + */ + public function matches($value) + { + switch ($this->segmentType) { + case Segment::LITERAL_SEGMENT: + return $this->value === $value; + case Segment::WILDCARD_SEGMENT: + return self::isValidBinding($value); + case Segment::DOUBLE_WILDCARD_SEGMENT: + return self::isValidDoubleWildcardBinding($value); + case Segment::VARIABLE_SEGMENT: + return $this->template->matches($value); + default: + throw new ValidationException( + "Unexpected Segment type: {$this->segmentType}" + ); + } + } + + /** + * @return int + */ + public function getSegmentType() + { + return $this->segmentType; + } + + /** + * @return string|null + */ + public function getKey() + { + return $this->key; + } + + /** + * @return string|null + */ + public function getValue() + { + return $this->value; + } + + /** + * @return RelativeResourceTemplate|null + */ + public function getTemplate() + { + return $this->template; + } + + /** + * @return string + */ + public function getSeparator() + { + return $this->separator; + } + + /** + * Check if $binding is a valid segment binding. Segment bindings may contain any characters + * except a forward slash ('/'), and may not be empty. + * + * @param $binding + * @return bool + */ + private static function isValidBinding($binding) + { + return preg_match("-^[^/]+$-", $binding) === 1; + } + + /** + * Check if $binding is a valid double wildcard binding. Segment bindings may contain any + * characters, but may not be empty. + * + * @param $binding + * @return bool + */ + private static function isValidDoubleWildcardBinding($binding) + { + return preg_match("-^.+$-", $binding) === 1; + } +} diff --git a/vendor/google/gax/src/RetrySettings.php b/vendor/google/gax/src/RetrySettings.php new file mode 100644 index 00000000..176d3377 --- /dev/null +++ b/vendor/google/gax/src/RetrySettings.php @@ -0,0 +1,501 @@ + 100, + * 'retryDelayMultiplier' => 1.3, + * 'maxRetryDelayMillis' => 60000, + * 'initialRpcTimeoutMillis' => 20000, + * 'rpcTimeoutMultiplier' => 1.0, + * 'maxRpcTimeoutMillis' => 20000, + * 'totalTimeoutMillis' => 600000, + * 'retryableCodes' => [ApiStatus::DEADLINE_EXCEEDED, ApiStatus::UNAVAILABLE], + * ]); + * ``` + * + * It is also possible to create a new RetrySettings object from an existing + * object using the {@see Google\ApiCore\RetrySettings::with()} method. + * + * Example modifying an existing RetrySettings object using `with()`: + * ``` + * $newRetrySettings = $retrySettings->with([ + * 'totalTimeoutMillis' => 700000, + * ]); + * ``` + * + * Modifying the retry behavior of an RPC method + * --------------------------------------------- + * + * RetrySettings objects can be used to control retries for many RPC methods in + * [google-cloud-php](https://github.com/googleapis/google-cloud-php). + * The examples below make use of the + * [GroupServiceClient](https://googleapis.github.io/google-cloud-php/#/docs/google-cloud/monitoring/v3/groupserviceclient) + * from the [Monitoring V3 API](https://github.com/googleapis/google-cloud-php/tree/master/src/Monitoring/V3), + * but they can be applied to other APIs in the + * [google-cloud-php](https://github.com/googleapis/google-cloud-php) repository. + * + * It is possible to specify the retry behavior to be used by an RPC via the + * `retrySettings` field in the `optionalArgs` parameter. The `retrySettings` + * field can contain either a RetrySettings object, or a PHP array containing + * the particular retry parameters to be updated. + * + * Example of disabling retries for a single call to the + * [listGroups](https://googleapis.github.io/google-cloud-php/#/docs/google-cloud/monitoring/v3/groupserviceclient?method=listGroups) + * method, and setting a custom timeout: + * ``` + * $result = $client->listGroups($name, [ + * 'retrySettings' => [ + * 'retriesEnabled' => false, + * 'noRetriesRpcTimeoutMillis' => 5000, + * ] + * ]); + * ``` + * + * Example of creating a new RetrySettings object and using it to override + * the retry settings for a call to the + * [listGroups](https://googleapis.github.io/google-cloud-php/#/docs/google-cloud/monitoring/v3/groupserviceclient?method=listGroups) + * method: + * ``` + * $customRetrySettings = new RetrySettings([ + * 'initialRetryDelayMillis' => 100, + * 'retryDelayMultiplier' => 1.3, + * 'maxRetryDelayMillis' => 60000, + * 'initialRpcTimeoutMillis' => 20000, + * 'rpcTimeoutMultiplier' => 1.0, + * 'maxRpcTimeoutMillis' => 20000, + * 'totalTimeoutMillis' => 600000, + * 'retryableCodes' => [ApiStatus::DEADLINE_EXCEEDED, ApiStatus::UNAVAILABLE], + * ]); + * + * $result = $client->listGroups($name, [ + * 'retrySettings' => $customRetrySettings + * ]); + * ``` + * + * Modifying the default retry behavior for RPC methods on a Client object + * ----------------------------------------------------------------------- + * + * It is also possible to specify the retry behavior for RPC methods when + * constructing a client object using the 'retrySettingsArray'. The examples + * below again make use of the + * [GroupServiceClient](https://googleapis.github.io/google-cloud-php/#/docs/google-cloud/monitoring/v3/groupserviceclient) + * from the [Monitoring V3 API](https://github.com/googleapis/google-cloud-php/tree/master/src/Monitoring/V3), + * but they can be applied to other APIs in the + * [google-cloud-php](https://github.com/googleapis/google-cloud-php) repository. + * + * The GroupServiceClient object accepts an optional `retrySettingsArray` + * parameter, which can be used to specify retry behavior for RPC methods + * on the client. The `retrySettingsArray` accepts a PHP array in which keys + * are the names of RPC methods on the client, and values are either a + * RetrySettings object or a PHP array containing the particular retry + * parameters to be updated. + * + * Example updating the retry settings for four methods of GroupServiceClient: + * ``` + * use Google\Cloud\Monitoring\V3\GroupServiceClient; + * + * $customRetrySettings = new RetrySettings([ + * 'initialRetryDelayMillis' => 100, + * 'retryDelayMultiplier' => 1.3, + * 'maxRetryDelayMillis' => 60000, + * 'initialRpcTimeoutMillis' => 20000, + * 'rpcTimeoutMultiplier' => 1.0, + * 'maxRpcTimeoutMillis' => 20000, + * 'totalTimeoutMillis' => 600000, + * 'retryableCodes' => [ApiStatus::DEADLINE_EXCEEDED, ApiStatus::UNAVAILABLE], + * ]); + * + * $updatedCustomRetrySettings = $customRetrySettings->with([ + * 'totalTimeoutMillis' => 700000 + * ]); + * + * $client = new GroupServiceClient([ + * 'retrySettingsArray' => [ + * 'listGroups' => ['retriesEnabled' => false], + * 'getGroup' => [ + * 'initialRpcTimeoutMillis' => 10000, + * 'maxRpcTimeoutMillis' => 30000, + * 'totalTimeoutMillis' => 60000, + * ], + * 'deleteGroup' => $customRetrySettings, + * 'updateGroup' => $updatedCustomRetrySettings + * ], + * ]); + * ``` + * + * Configure the use of logical timeout + * ------------------------------------ + * + * To configure the use of a logical timeout, where a logical timeout is the + * duration a method is given to complete one or more RPC attempts, with each + * attempt using only the time remaining in the logical timeout, use + * {@see Google\ApiCore\RetrySettings::logicalTimeout()} combined with + * {@see Google\ApiCore\RetrySettings::with()}. + * + * ``` + * $timeoutSettings = RetrySettings::logicalTimeout(30000); + * + * $customRetrySettings = $customRetrySettings->with($timeoutSettings); + * + * $result = $client->listGroups($name, [ + * 'retrySettings' => $customRetrySettings + * ]); + * ``` + * + * {@see Google\ApiCore\RetrySettings::logicalTimeout()} can also be used on a + * method call independent of a RetrySettings instance. + * + * ``` + * $timeoutSettings = RetrySettings::logicalTimeout(30000); + * + * $result = $client->listGroups($name, [ + * 'retrySettings' => $timeoutSettings + * ]); + * ``` + */ +class RetrySettings +{ + use ValidationTrait; + + private $retriesEnabled; + + private $retryableCodes; + + private $initialRetryDelayMillis; + private $retryDelayMultiplier; + private $maxRetryDelayMillis; + private $initialRpcTimeoutMillis; + private $rpcTimeoutMultiplier; + private $maxRpcTimeoutMillis; + private $totalTimeoutMillis; + + private $noRetriesRpcTimeoutMillis; + + /** + * Constructs an instance. + * + * @param array $settings { + * Required. Settings for configuring the retry behavior. All parameters are required except + * $retriesEnabled and $noRetriesRpcTimeoutMillis, which are optional and have defaults + * determined based on the other settings provided. + * + * @type bool $retriesEnabled Optional. Enables retries. If not specified, the value is + * determined using the $retryableCodes setting. If $retryableCodes is empty, + * then $retriesEnabled is set to false; otherwise, it is set to true. + * @type int $noRetriesRpcTimeoutMillis Optional. The timeout of the rpc call to be used + * if $retriesEnabled is false, in milliseconds. It not specified, the value + * of $initialRpcTimeoutMillis is used. + * @type array $retryableCodes The Status codes that are retryable. Each status should be + * either one of the string constants defined on {@see \Google\ApiCore\ApiStatus} + * or an integer constant defined on {@see \Google\Rpc\Code}. + * @type int $initialRetryDelayMillis The initial delay of retry in milliseconds. + * @type int $retryDelayMultiplier The exponential multiplier of retry delay. + * @type int $maxRetryDelayMillis The max delay of retry in milliseconds. + * @type int $initialRpcTimeoutMillis The initial timeout of rpc call in milliseconds. + * @type int $rpcTimeoutMultiplier The exponential multiplier of rpc timeout. + * @type int $maxRpcTimeoutMillis The max timeout of rpc call in milliseconds. + * @type int $totalTimeoutMillis The max accumulative timeout in total. + * } + */ + public function __construct(array $settings) + { + $this->validateNotNull($settings, [ + 'initialRetryDelayMillis', + 'retryDelayMultiplier', + 'maxRetryDelayMillis', + 'initialRpcTimeoutMillis', + 'rpcTimeoutMultiplier', + 'maxRpcTimeoutMillis', + 'totalTimeoutMillis', + 'retryableCodes' + ]); + $this->initialRetryDelayMillis = $settings['initialRetryDelayMillis']; + $this->retryDelayMultiplier = $settings['retryDelayMultiplier']; + $this->maxRetryDelayMillis = $settings['maxRetryDelayMillis']; + $this->initialRpcTimeoutMillis = $settings['initialRpcTimeoutMillis']; + $this->rpcTimeoutMultiplier = $settings['rpcTimeoutMultiplier']; + $this->maxRpcTimeoutMillis = $settings['maxRpcTimeoutMillis']; + $this->totalTimeoutMillis = $settings['totalTimeoutMillis']; + $this->retryableCodes = $settings['retryableCodes']; + $this->retriesEnabled = array_key_exists('retriesEnabled', $settings) + ? $settings['retriesEnabled'] + : (count($this->retryableCodes) > 0); + $this->noRetriesRpcTimeoutMillis = array_key_exists('noRetriesRpcTimeoutMillis', $settings) + ? $settings['noRetriesRpcTimeoutMillis'] + : $this->initialRpcTimeoutMillis; + } + + /** + * Constructs an array mapping method names to CallSettings. + * + * @param string $serviceName + * The fully-qualified name of this service, used as a key into + * the client config file. + * @param array $clientConfig + * An array parsed from the standard API client config file. + * @param bool $disableRetries + * Disable retries in all loaded RetrySettings objects. Defaults to false. + * @throws ValidationException + * @return RetrySettings[] $retrySettings + */ + public static function load( + $serviceName, + $clientConfig, + $disableRetries = false + ) { + $serviceRetrySettings = []; + + $serviceConfig = $clientConfig['interfaces'][$serviceName]; + $retryCodes = $serviceConfig['retry_codes']; + $retryParams = $serviceConfig['retry_params']; + foreach ($serviceConfig['methods'] as $methodName => $methodConfig) { + $timeoutMillis = $methodConfig['timeout_millis']; + + if (empty($methodConfig['retry_codes_name']) || empty($methodConfig['retry_params_name'])) { + // Construct a RetrySettings object with retries disabled + $retrySettings = self::constructDefault()->with([ + 'noRetriesRpcTimeoutMillis' => $timeoutMillis, + ]); + } else { + $retryCodesName = $methodConfig['retry_codes_name']; + $retryParamsName = $methodConfig['retry_params_name']; + + if (!array_key_exists($retryCodesName, $retryCodes)) { + throw new ValidationException("Invalid retry_codes_name setting: '$retryCodesName'"); + } + if (!array_key_exists($retryParamsName, $retryParams)) { + throw new ValidationException("Invalid retry_params_name setting: '$retryParamsName'"); + } + + foreach ($retryCodes[$retryCodesName] as $status) { + if (!ApiStatus::isValidStatus($status)) { + throw new ValidationException("Invalid status code: '$status'"); + } + } + + $retryParameters = self::convertArrayFromSnakeCase($retryParams[$retryParamsName]) + [ + 'retryableCodes' => $retryCodes[$retryCodesName], + 'noRetriesRpcTimeoutMillis' => $timeoutMillis, + ]; + if ($disableRetries) { + $retryParameters['retriesEnabled'] = false; + } + + $retrySettings = new RetrySettings($retryParameters); + } + + $serviceRetrySettings[$methodName] = $retrySettings; + } + + return $serviceRetrySettings; + } + + public static function constructDefault() + { + return new RetrySettings([ + 'retriesEnabled' => false, + 'noRetriesRpcTimeoutMillis' => 30000, + 'initialRetryDelayMillis' => 100, + 'retryDelayMultiplier' => 1.3, + 'maxRetryDelayMillis' => 60000, + 'initialRpcTimeoutMillis' => 20000, + 'rpcTimeoutMultiplier' => 1, + 'maxRpcTimeoutMillis' => 20000, + 'totalTimeoutMillis' => 600000, + 'retryableCodes' => []]); + } + + /** + * Creates a new instance of RetrySettings that updates the settings in the existing instance + * with the settings specified in the $settings parameter. + * + * @param array $settings { + * Settings for configuring the retry behavior. Supports all of the options supported by + * the constructor; see {@see \Google\ApiCore\RetrySettings::__construct()}. All parameters + * are optional - all unset parameters will default to the value in the existing instance. + * } + * @return RetrySettings + */ + public function with(array $settings) + { + $existingSettings = [ + 'initialRetryDelayMillis' => $this->getInitialRetryDelayMillis(), + 'retryDelayMultiplier' => $this->getRetryDelayMultiplier(), + 'maxRetryDelayMillis' => $this->getMaxRetryDelayMillis(), + 'initialRpcTimeoutMillis' => $this->getInitialRpcTimeoutMillis(), + 'rpcTimeoutMultiplier' => $this->getRpcTimeoutMultiplier(), + 'maxRpcTimeoutMillis' => $this->getMaxRpcTimeoutMillis(), + 'totalTimeoutMillis' => $this->getTotalTimeoutMillis(), + 'retryableCodes' => $this->getRetryableCodes(), + 'retriesEnabled' => $this->retriesEnabled(), + 'noRetriesRpcTimeoutMillis' => $this->getNoRetriesRpcTimeoutMillis(), + ]; + return new RetrySettings($settings + $existingSettings); + } + + /** + * Creates an associative array of the {@see Google\ApiCore\RetrySettings} timeout fields configured + * with the given timeout specified in the $timeout parameter interpreted as a logical timeout. + * + * @param int $timeout The timeout in milliseconds to be used as a logical call timeout. + * @return array + */ + public static function logicalTimeout($timeout) + { + return [ + 'initialRpcTimeoutMillis' => $timeout, + 'maxRpcTimeoutMillis' => $timeout, + 'totalTimeoutMillis' => $timeout, + 'noRetriesRpcTimeoutMillis' => $timeout, + 'rpcTimeoutMultiplier' => 1.0 + ]; + } + + /** + * @return bool Returns true if retries are enabled, otherwise returns false. + */ + public function retriesEnabled() + { + return $this->retriesEnabled; + } + + /** + * @return int The timeout of the rpc call to be used if $retriesEnabled is false, + * in milliseconds. + */ + public function getNoRetriesRpcTimeoutMillis() + { + return $this->noRetriesRpcTimeoutMillis; + } + + /** + * @return int[] Status codes to retry + */ + public function getRetryableCodes() + { + return $this->retryableCodes; + } + + /** + * @return int The initial retry delay in milliseconds. If $this->retriesEnabled() + * is false, this setting is unused. + */ + public function getInitialRetryDelayMillis() + { + return $this->initialRetryDelayMillis; + } + + /** + * @return float The retry delay multiplier. If $this->retriesEnabled() + * is false, this setting is unused. + */ + public function getRetryDelayMultiplier() + { + return $this->retryDelayMultiplier; + } + + /** + * @return int The maximum retry delay in milliseconds. If $this->retriesEnabled() + * is false, this setting is unused. + */ + public function getMaxRetryDelayMillis() + { + return $this->maxRetryDelayMillis; + } + + /** + * @return int The initial rpc timeout in milliseconds. If $this->retriesEnabled() + * is false, this setting is unused - use noRetriesRpcTimeoutMillis to + * set the timeout in that case. + */ + public function getInitialRpcTimeoutMillis() + { + return $this->initialRpcTimeoutMillis; + } + + /** + * @return float The rpc timeout multiplier. If $this->retriesEnabled() + * is false, this setting is unused. + */ + public function getRpcTimeoutMultiplier() + { + return $this->rpcTimeoutMultiplier; + } + + /** + * @return int The maximum rpc timeout in milliseconds. If $this->retriesEnabled() + * is false, this setting is unused - use noRetriesRpcTimeoutMillis to + * set the timeout in that case. + */ + public function getMaxRpcTimeoutMillis() + { + return $this->maxRpcTimeoutMillis; + } + + /** + * @return int The total time in milliseconds to spend on the call, including all + * retry attempts and delays between attempts. If $this->retriesEnabled() + * is false, this setting is unused - use noRetriesRpcTimeoutMillis to + * set the timeout in that case. + */ + public function getTotalTimeoutMillis() + { + return $this->totalTimeoutMillis; + } + + private static function convertArrayFromSnakeCase($settings) + { + $camelCaseSettings = []; + foreach ($settings as $key => $value) { + $camelCaseKey = str_replace(' ', '', ucwords(str_replace('_', ' ', $key))); + $camelCaseSettings[lcfirst($camelCaseKey)] = $value; + } + return $camelCaseSettings; + } +} diff --git a/vendor/google/gax/src/Serializer.php b/vendor/google/gax/src/Serializer.php new file mode 100644 index 00000000..defd9e76 --- /dev/null +++ b/vendor/google/gax/src/Serializer.php @@ -0,0 +1,496 @@ + \Google\Rpc\RetryInfo::class, + 'google.rpc.debuginfo-bin' => \Google\Rpc\DebugInfo::class, + 'google.rpc.quotafailure-bin' => \Google\Rpc\QuotaFailure::class, + 'google.rpc.badrequest-bin' => \Google\Rpc\BadRequest::class, + 'google.rpc.requestinfo-bin' => \Google\Rpc\RequestInfo::class, + 'google.rpc.resourceinfo-bin' => \Google\Rpc\ResourceInfo::class, + 'google.rpc.errorinfo-bin' => \Google\Rpc\ErrorInfo::class, + 'google.rpc.help-bin' => \Google\Rpc\Help::class, + 'google.rpc.localizedmessage-bin' => \Google\Rpc\LocalizedMessage::class, + ]; + + private $fieldTransformers; + private $messageTypeTransformers; + private $decodeFieldTransformers; + private $decodeMessageTypeTransformers; + + private $descriptorMaps = []; + + /** + * Serializer constructor. + * + * @param array $fieldTransformers An array mapping field names to transformation functions + * @param array $messageTypeTransformers An array mapping message names to transformation functions + * @param array $decodeFieldTransformers An array mapping field names to transformation functions + * @param array $decodeMessageTypeTransformers An array mapping message names to transformation functions + */ + public function __construct( + $fieldTransformers = [], + $messageTypeTransformers = [], + $decodeFieldTransformers = [], + $decodeMessageTypeTransformers = [] + ) { + $this->fieldTransformers = $fieldTransformers; + $this->messageTypeTransformers = $messageTypeTransformers; + $this->decodeFieldTransformers = $decodeFieldTransformers; + $this->decodeMessageTypeTransformers = $decodeMessageTypeTransformers; + } + + /** + * Encode protobuf message as a PHP array + * + * @param mixed $message + * @return array + * @throws ValidationException + */ + public function encodeMessage($message) + { + // Get message descriptor + $pool = DescriptorPool::getGeneratedPool(); + $messageType = $pool->getDescriptorByClassName(get_class($message)); + try { + return $this->encodeMessageImpl($message, $messageType); + } catch (\Exception $e) { + throw new ValidationException( + "Error encoding message: " . $e->getMessage(), + $e->getCode(), + $e + ); + } + } + + /** + * Decode PHP array into the specified protobuf message + * + * @param mixed $message + * @param array $data + * @return mixed + * @throws ValidationException + */ + public function decodeMessage($message, $data) + { + // Get message descriptor + $pool = DescriptorPool::getGeneratedPool(); + $messageType = $pool->getDescriptorByClassName(get_class($message)); + try { + return $this->decodeMessageImpl($message, $messageType, $data); + } catch (\Exception $e) { + throw new ValidationException( + "Error decoding message: " . $e->getMessage(), + $e->getCode(), + $e + ); + } + } + + /** + * @param Message $message + * @return string Json representation of $message + * @throws ValidationException + */ + public static function serializeToJson($message) + { + return json_encode(self::serializeToPhpArray($message), JSON_PRETTY_PRINT); + } + + /** + * @param Message $message + * @return array PHP array representation of $message + * @throws ValidationException + */ + public static function serializeToPhpArray($message) + { + return self::getPhpArraySerializer()->encodeMessage($message); + } + + /** + * Decode metadata received from gRPC status object + * + * @param array $metadata + * @return array + */ + public static function decodeMetadata($metadata) + { + if (is_null($metadata) || count($metadata) == 0) { + return []; + } + $result = []; + foreach ($metadata as $key => $values) { + foreach ($values as $value) { + $decodedValue = [ + '@type' => $key, + ]; + if (self::hasBinaryHeaderSuffix($key)) { + if (isset(self::$metadataKnownTypes[$key])) { + $class = self::$metadataKnownTypes[$key]; + /** @var Message $message */ + $message = new $class(); + try { + $message->mergeFromString($value); + $decodedValue += self::serializeToPhpArray($message); + } catch (\Exception $e) { + // We encountered an error trying to deserialize the data + $decodedValue += [ + 'data' => '', + ]; + } + } else { + // The metadata contains an unexpected binary type + $decodedValue += [ + 'data' => '', + ]; + } + } else { + $decodedValue += [ + 'data' => $value, + ]; + } + $result[] = $decodedValue; + } + } + return $result; + } + + /** + * Decode an array of Any messages into a printable PHP array. + * + * @param $anyArray + * @return array + */ + public static function decodeAnyMessages($anyArray) + { + $results = []; + foreach ($anyArray as $any) { + try { + /** @var Any $any */ + /** @var Message $unpacked */ + $unpacked = $any->unpack(); + $results[] = self::serializeToPhpArray($unpacked); + } catch (\Exception $ex) { + echo "$ex\n"; + // failed to unpack the $any object - show as unknown binary data + $results[] = [ + 'typeUrl' => $any->getTypeUrl(), + 'value' => '', + ]; + } + } + return $results; + } + + /** + * @param FieldDescriptor $field + * @param $data + * @return mixed array + * @throws \Exception + */ + private function encodeElement(FieldDescriptor $field, $data) + { + switch ($field->getType()) { + case GPBType::MESSAGE: + if (is_array($data)) { + $result = $data; + } else { + $result = $this->encodeMessageImpl($data, $field->getMessageType()); + } + $messageType = $field->getMessageType()->getFullName(); + if (isset($this->messageTypeTransformers[$messageType])) { + $result = $this->messageTypeTransformers[$messageType]($result); + } + break; + default: + $result = $data; + break; + } + + if (isset($this->fieldTransformers[$field->getName()])) { + $result = $this->fieldTransformers[$field->getName()]($result); + } + return $result; + } + + private function getDescriptorMaps(Descriptor $descriptor) + { + if (!isset($this->descriptorMaps[$descriptor->getFullName()])) { + $fieldsByName = []; + $fieldCount = $descriptor->getFieldCount(); + for ($i = 0; $i < $fieldCount; $i++) { + $field = $descriptor->getField($i); + $fieldsByName[$field->getName()] = $field; + } + $fieldToOneof = []; + $oneofCount = $descriptor->getOneofDeclCount(); + for ($i = 0; $i < $oneofCount; $i++) { + $oneof = $descriptor->getOneofDecl($i); + $oneofFieldCount = $oneof->getFieldCount(); + for ($j = 0; $j < $oneofFieldCount; $j++) { + $field = $oneof->getField($j); + $fieldToOneof[$field->getName()] = $oneof->getName(); + } + } + $this->descriptorMaps[$descriptor->getFullName()] = [$fieldsByName, $fieldToOneof]; + } + return $this->descriptorMaps[$descriptor->getFullName()]; + } + + /** + * @param Message $message + * @param Descriptor $messageType + * @return array + * @throws \Exception + */ + private function encodeMessageImpl($message, Descriptor $messageType) + { + $data = []; + + $fieldCount = $messageType->getFieldCount(); + for ($i = 0; $i < $fieldCount; $i++) { + $field = $messageType->getField($i); + $key = $field->getName(); + $getter = $this->getGetter($key); + $v = $message->$getter(); + + if (is_null($v)) { + continue; + } + + // Check and skip unset fields inside oneofs + list($_, $fieldsToOneof) = $this->getDescriptorMaps($messageType); + if (isset($fieldsToOneof[$key])) { + $oneofName = $fieldsToOneof[$key]; + $oneofGetter = $this->getGetter($oneofName); + if ($message->$oneofGetter() !== $key) { + continue; + } + } + + if ($field->isMap()) { + list($mapFieldsByName, $_) = $this->getDescriptorMaps($field->getMessageType()); + $keyField = $mapFieldsByName[self::MAP_KEY_FIELD_NAME]; + $valueField = $mapFieldsByName[self::MAP_VALUE_FIELD_NAME]; + $arr = []; + foreach ($v as $k => $vv) { + $arr[$this->encodeElement($keyField, $k)] = $this->encodeElement($valueField, $vv); + } + $v = $arr; + } elseif ($field->getLabel() === GPBLabel::REPEATED) { + $arr = []; + foreach ($v as $k => $vv) { + $arr[$k] = $this->encodeElement($field, $vv); + } + $v = $arr; + } else { + $v = $this->encodeElement($field, $v); + } + + $key = self::toCamelCase($key); + $data[$key] = $v; + } + + return $data; + } + + /** + * @param FieldDescriptor $field + * @param mixed $data + * @return mixed + * @throws \Exception + */ + private function decodeElement(FieldDescriptor $field, $data) + { + if (isset($this->decodeFieldTransformers[$field->getName()])) { + $data = $this->decodeFieldTransformers[$field->getName()]($data); + } + + switch ($field->getType()) { + case GPBType::MESSAGE: + if ($data instanceof Message) { + return $data; + } + $messageType = $field->getMessageType(); + $messageTypeName = $messageType->getFullName(); + $klass = $messageType->getClass(); + $msg = new $klass(); + if (isset($this->decodeMessageTypeTransformers[$messageTypeName])) { + $data = $this->decodeMessageTypeTransformers[$messageTypeName]($data); + } + + return $this->decodeMessageImpl($msg, $messageType, $data); + default: + return $data; + } + } + + /** + * @param Message $message + * @param Descriptor $messageType + * @param array $data + * @return mixed + * @throws \Exception + */ + private function decodeMessageImpl($message, Descriptor $messageType, $data) + { + list($fieldsByName, $_) = $this->getDescriptorMaps($messageType); + foreach ($data as $key => $v) { + // Get the field by tag number or name + $fieldName = self::toSnakeCase($key); + + // Unknown field found + if (!isset($fieldsByName[$fieldName])) { + throw new RuntimeException(sprintf( + "cannot handle unknown field %s on message %s", + $fieldName, + $messageType->getFullName() + )); + } + + /** @var $field FieldDescriptor */ + $field = $fieldsByName[$fieldName]; + + if ($field->isMap()) { + list($mapFieldsByName, $_) = $this->getDescriptorMaps($field->getMessageType()); + $keyField = $mapFieldsByName[self::MAP_KEY_FIELD_NAME]; + $valueField = $mapFieldsByName[self::MAP_VALUE_FIELD_NAME]; + $arr = []; + foreach ($v as $k => $vv) { + $arr[$this->decodeElement($keyField, $k)] = $this->decodeElement($valueField, $vv); + } + $value = $arr; + } elseif ($field->getLabel() === GPBLabel::REPEATED) { + $arr = []; + foreach ($v as $k => $vv) { + $arr[$k] = $this->decodeElement($field, $vv); + } + $value = $arr; + } else { + $value = $this->decodeElement($field, $v); + } + + $setter = $this->getSetter($field->getName()); + $message->$setter($value); + + // We must unset $value here, otherwise the protobuf c extension will mix up the references + // and setting one value will change all others + unset($value); + } + return $message; + } + + /** + * @param string $name + * @return string Getter function + */ + public static function getGetter($name) + { + return 'get' . ucfirst(self::toCamelCase($name)); + } + + /** + * @param string $name + * @return string Setter function + */ + public static function getSetter($name) + { + return 'set' . ucfirst(self::toCamelCase($name)); + } + + /** + * Convert string from camelCase to snake_case + * + * @param string $key + * @return string + */ + public static function toSnakeCase($key) + { + return strtolower(preg_replace(['/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/'], '$1_$2', $key)); + } + + /** + * Convert string from snake_case to camelCase + * + * @param string $key + * @return string + */ + public static function toCamelCase($key) + { + return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $key)))); + } + + private static function hasBinaryHeaderSuffix($key) + { + return substr_compare($key, "-bin", strlen($key) - 4) === 0; + } + + private static function getPhpArraySerializer() + { + if (is_null(self::$phpArraySerializer)) { + self::$phpArraySerializer = new Serializer(); + } + return self::$phpArraySerializer; + } + + public static function loadKnownMetadataTypes() + { + foreach (self::$metadataKnownTypes as $key => $class) { + new $class; + } + } +} + +// It is necessary to call this when this file is included. Otherwise we cannot be +// guaranteed that the relevant classes will be loaded into the protobuf descriptor +// pool when we try to unpack an Any object containing that class. +// phpcs:disable PSR1.Files.SideEffects +Serializer::loadKnownMetadataTypes(); +// phpcs:enable diff --git a/vendor/google/gax/src/ServerStream.php b/vendor/google/gax/src/ServerStream.php new file mode 100644 index 00000000..b9c63259 --- /dev/null +++ b/vendor/google/gax/src/ServerStream.php @@ -0,0 +1,97 @@ +call = $serverStreamingCall; + if (array_key_exists('resourcesGetMethod', $streamingDescriptor)) { + $this->resourcesGetMethod = $streamingDescriptor['resourcesGetMethod']; + } + } + + /** + * A generator which yields results from the server until the streaming call + * completes. Throws an ApiException if the streaming call failed. + * + * @throws ApiException + * @return \Generator|mixed + */ + public function readAll() + { + $resourcesGetMethod = $this->resourcesGetMethod; + if (!is_null($resourcesGetMethod)) { + foreach ($this->call->responses() as $response) { + foreach ($response->$resourcesGetMethod() as $resource) { + yield $resource; + } + } + } else { + foreach ($this->call->responses() as $response) { + yield $response; + } + } + + // Errors in the REST transport will be thrown from there and not reach + // this handling. Successful REST server-streams will have an OK status. + $status = $this->call->getStatus(); + if ($status->code !== Code::OK) { + throw ApiException::createFromStdClass($status); + } + } + + /** + * Return the underlying call object. + * + * @return ServerStreamingCallInterface + */ + public function getServerStreamingCall() + { + return $this->call; + } +} diff --git a/vendor/google/gax/src/ServerStreamingCallInterface.php b/vendor/google/gax/src/ServerStreamingCallInterface.php new file mode 100644 index 00000000..d30c285c --- /dev/null +++ b/vendor/google/gax/src/ServerStreamingCallInterface.php @@ -0,0 +1,87 @@ + a number (optional) + */ + public function start($data, array $metadata = [], array $options = []); + + /** + * @return mixed An iterator of response values. + */ + public function responses(); + + /** + * Return the status of the server stream. + * + * @return \stdClass The API status. + */ + public function getStatus(); + + /** + * @return mixed The metadata sent by the server. + */ + public function getMetadata(); + + /** + * @return mixed The trailing metadata sent by the server. + */ + public function getTrailingMetadata(); + + /** + * @return string The URI of the endpoint. + */ + public function getPeer(); + + /** + * Cancels the call. + */ + public function cancel(); + + /** + * Set the CallCredentials for the underlying Call. + * + * @param mixed $call_credentials The CallCredentials object + */ + public function setCallCredentials($call_credentials); +} diff --git a/vendor/google/gax/src/ServiceAddressTrait.php b/vendor/google/gax/src/ServiceAddressTrait.php new file mode 100644 index 00000000..955edbf5 --- /dev/null +++ b/vendor/google/gax/src/ServiceAddressTrait.php @@ -0,0 +1,63 @@ +assertEquals($expected, $actual); + } + + $this->assertCount(count($expected), $actual); + + $expectedValues = $this->getValues($expected); + $actualValues = $this->getValues($actual); + + for ($i = 0; $i < count($expectedValues); $i++) { + $expectedElement = $expectedValues[$i]; + $actualElement = $actualValues[$i]; + $this->assertProtobufEquals($expectedElement, $actualElement); + } + } else { + $this->assertEquals($expected, $actual); + if ($expected instanceof Message) { + $pool = DescriptorPool::getGeneratedPool(); + $descriptor = $pool->getDescriptorByClassName(get_class($expected)); + + $fieldCount = $descriptor->getFieldCount(); + for ($i = 0; $i < $fieldCount; $i++) { + $field = $descriptor->getField($i); + $getter = Serializer::getGetter($field->getName()); + $expectedFieldValue = $expected->$getter(); + $actualFieldValue = $actual->$getter(); + $this->assertProtobufEquals($expectedFieldValue, $actualFieldValue); + } + } + } + } + + private function getValues($field) + { + return array_values( + is_array($field) + ? $field + : iterator_to_array($field) + ); + } +} diff --git a/vendor/google/gax/src/Testing/MessageAwareArrayComparator.php b/vendor/google/gax/src/Testing/MessageAwareArrayComparator.php new file mode 100644 index 00000000..4f7bf6d4 --- /dev/null +++ b/vendor/google/gax/src/Testing/MessageAwareArrayComparator.php @@ -0,0 +1,29 @@ +exporter = new MessageAwareExporter(); + } +} diff --git a/vendor/google/gax/src/Testing/MessageAwareExporter.php b/vendor/google/gax/src/Testing/MessageAwareExporter.php new file mode 100644 index 00000000..4b1f1860 --- /dev/null +++ b/vendor/google/gax/src/Testing/MessageAwareExporter.php @@ -0,0 +1,44 @@ +responses = $responses; + $this->deserialize = $deserialize; + if (is_null($status)) { + $status = new MockStatus(Code::OK); + } + $this->status = $status; + } + + /** + * @return mixed|null + * @throws ApiException + */ + public function read() + { + if (count($this->responses) > 0) { + $resp = array_shift($this->responses); + if (is_null($resp)) { + // Null was added to the responses list to simulate a failed stream + // To ensure that getStatus can now be called, we clear the remaining + // responses and set writesDone to true + $this->responses = []; + $this->writesDone(); + return null; + } + $obj = $this->deserializeMessage($resp, $this->deserialize); + return $obj; + } elseif ($this->writesDone) { + return null; + } else { + throw new ApiException( + "No more responses to read, but closeWrite() not called - " + . "this would be blocking", + Grpc\STATUS_INTERNAL, + null + ); + } + } + + /** + * @return MockStatus|null|\stdClass + * @throws ApiException + */ + public function getStatus() + { + if (count($this->responses) > 0) { + throw new ApiException( + "Calls to getStatus() will block if all responses are not read", + Grpc\STATUS_INTERNAL, + null + ); + } + if (!$this->writesDone) { + throw new ApiException( + "Calls to getStatus() will block if closeWrite() not called", + Grpc\STATUS_INTERNAL, + null + ); + } + return $this->status; + } + + /** + * Save the request object, to be retrieved via getReceivedCalls() + * @param \Google\Protobuf\Internal\Message|mixed $request The request object + * @param array $options An array of options. + * @throws ApiException + */ + public function write($request, array $options = []) + { + if ($this->writesDone) { + throw new ApiException( + "Cannot call write() after writesDone()", + Grpc\STATUS_INTERNAL, + null + ); + } + if (is_a($request, '\Google\Protobuf\Internal\Message')) { + /** @var Message $newRequest */ + $newRequest = new $request(); + $newRequest->mergeFromString($request->serializeToString()); + $request = $newRequest; + } + $this->receivedWrites[] = $request; + } + + /** + * Set writesDone to true + */ + public function writesDone() + { + $this->writesDone = true; + } + + /** + * Return a list of calls made to write(), and clear $receivedFuncCalls. + * + * @return mixed[] An array of received requests + */ + public function popReceivedCalls() + { + $receivedFuncCallsTemp = $this->receivedWrites; + $this->receivedWrites = []; + return $receivedFuncCallsTemp; + } +} diff --git a/vendor/google/gax/src/Testing/MockClientStreamingCall.php b/vendor/google/gax/src/Testing/MockClientStreamingCall.php new file mode 100644 index 00000000..d5691cc3 --- /dev/null +++ b/vendor/google/gax/src/Testing/MockClientStreamingCall.php @@ -0,0 +1,108 @@ +mockUnaryCall = new MockUnaryCall($response, $deserialize, $status); + } + + /** + * Immediately return the preset response object and status. + * @return array The response object and status. + */ + public function wait() + { + $this->waitCalled = true; + return $this->mockUnaryCall->wait(); + } + + /** + * Save the request object, to be retrieved via getReceivedCalls() + * @param \Google\Protobuf\Internal\Message|mixed $request The request object + * @param array $options An array of options + * @throws ApiException + */ + public function write($request, array $options = []) + { + if ($this->waitCalled) { + throw new ApiException("Cannot call write() after wait()", Code::INTERNAL, ApiStatus::INTERNAL); + } + if (is_a($request, '\Google\Protobuf\Internal\Message')) { + /** @var Message $newRequest */ + $newRequest = new $request(); + $newRequest->mergeFromString($request->serializeToString()); + $request = $newRequest; + } + $this->receivedWrites[] = $request; + } + + /** + * Return a list of calls made to write(), and clear $receivedFuncCalls. + * + * @return mixed[] An array of received requests + */ + public function popReceivedCalls() + { + $receivedFuncCallsTemp = $this->receivedWrites; + $this->receivedWrites = []; + return $receivedFuncCallsTemp; + } +} diff --git a/vendor/google/gax/src/Testing/MockGrpcTransport.php b/vendor/google/gax/src/Testing/MockGrpcTransport.php new file mode 100644 index 00000000..4a5b2351 --- /dev/null +++ b/vendor/google/gax/src/Testing/MockGrpcTransport.php @@ -0,0 +1,112 @@ +mockCall = $mockCall; + $opts = ['credentials' => ChannelCredentials::createSsl()]; + parent::__construct('', $opts); + } + + protected function _simpleRequest( + $method, + $arguments, + $deserialize, + array $metadata = [], + array $options = [] + ) { + $this->logCall($method, $deserialize, $metadata, $options, $arguments); + return $this->mockCall; + } + + protected function _clientStreamRequest( + $method, + $deserialize, + array $metadata = [], + array $options = [] + ) { + $this->logCall($method, $deserialize, $metadata, $options); + return $this->mockCall; + } + + protected function _serverStreamRequest( + $method, + $arguments, + $deserialize, + array $metadata = [], + array $options = [] + ) { + $this->logCall($method, $deserialize, $metadata, $options, $arguments); + return $this->mockCall; + } + + protected function _bidiRequest( + $method, + $deserialize, + array $metadata = [], + array $options = [] + ) { + $this->logCall($method, $deserialize, $metadata, $options); + return $this->mockCall; + } + + private function logCall( + $method, + $deserialize, + $metadata = [], + $options = [], + $arguments = null + ) { + $this->requestArguments = [ + 'method' => $method, + 'arguments' => $arguments, + 'deserialize' => $deserialize, + 'metadata' => $metadata, + 'options' => $options, + ]; + } + + public function getRequestArguments() + { + return $this->requestArguments; + } +} diff --git a/vendor/google/gax/src/Testing/MockRequest.php b/vendor/google/gax/src/Testing/MockRequest.php new file mode 100644 index 00000000..5e73dc66 --- /dev/null +++ b/vendor/google/gax/src/Testing/MockRequest.php @@ -0,0 +1,85 @@ +google.apicore.testing.MockRequest + */ +class MockRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string page_token = 1; + */ + protected $page_token = ''; + /** + * Generated from protobuf field uint64 page_size = 2; + */ + protected $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $page_token + * @type int|string $page_size + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\ApiCore\Testing\Mocks::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string page_token = 1; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Generated from protobuf field string page_token = 1; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Generated from protobuf field uint64 page_size = 2; + * @return int|string + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Generated from protobuf field uint64 page_size = 2; + * @param int|string $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkUint64($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/vendor/google/gax/src/Testing/MockRequestBody.php b/vendor/google/gax/src/Testing/MockRequestBody.php new file mode 100644 index 00000000..0bd1ee3a --- /dev/null +++ b/vendor/google/gax/src/Testing/MockRequestBody.php @@ -0,0 +1,644 @@ +google.apicore.testing.MockRequestBody + */ +class MockRequestBody extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Generated from protobuf field uint64 number = 2; + */ + protected $number = 0; + /** + * Generated from protobuf field repeated string repeated_field = 3; + */ + private $repeated_field; + /** + * Generated from protobuf field .google.apicore.testing.MockRequestBody nested_message = 4; + */ + protected $nested_message = null; + /** + * Generated from protobuf field .google.protobuf.BytesValue bytes_value = 5; + */ + protected $bytes_value = null; + /** + * Generated from protobuf field .google.protobuf.Duration duration_value = 6; + */ + protected $duration_value = null; + /** + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 7; + */ + protected $field_mask = null; + /** + * Generated from protobuf field .google.protobuf.Int64Value int64_value = 8; + */ + protected $int64_value = null; + /** + * Generated from protobuf field .google.protobuf.ListValue list_value = 9; + */ + protected $list_value = null; + /** + * Generated from protobuf field .google.protobuf.StringValue string_value = 10; + */ + protected $string_value = null; + /** + * Generated from protobuf field .google.protobuf.Struct struct_value = 11; + */ + protected $struct_value = null; + /** + * Generated from protobuf field .google.protobuf.Timestamp timestamp_value = 12; + */ + protected $timestamp_value = null; + /** + * Generated from protobuf field .google.protobuf.Value value_value = 13; + */ + protected $value_value = null; + protected $oneof_field; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type int|string $number + * @type string[]|\Google\Protobuf\Internal\RepeatedField $repeated_field + * @type \Google\ApiCore\Testing\MockRequestBody $nested_message + * @type \Google\Protobuf\BytesValue $bytes_value + * @type \Google\Protobuf\Duration $duration_value + * @type \Google\Protobuf\FieldMask $field_mask + * @type \Google\Protobuf\Int64Value $int64_value + * @type \Google\Protobuf\ListValue $list_value + * @type \Google\Protobuf\StringValue $string_value + * @type \Google\Protobuf\Struct $struct_value + * @type \Google\Protobuf\Timestamp $timestamp_value + * @type \Google\Protobuf\Value $value_value + * @type string $field_1 + * @type string $field_2 + * @type string $field_3 + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\ApiCore\Testing\Mocks::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Generated from protobuf field uint64 number = 2; + * @return int|string + */ + public function getNumber() + { + return $this->number; + } + + /** + * Generated from protobuf field uint64 number = 2; + * @param int|string $var + * @return $this + */ + public function setNumber($var) + { + GPBUtil::checkUint64($var); + $this->number = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated string repeated_field = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRepeatedField() + { + return $this->repeated_field; + } + + /** + * Generated from protobuf field repeated string repeated_field = 3; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRepeatedField($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->repeated_field = $arr; + + return $this; + } + + /** + * Generated from protobuf field .google.apicore.testing.MockRequestBody nested_message = 4; + * @return \Google\ApiCore\Testing\MockRequestBody + */ + public function getNestedMessage() + { + return isset($this->nested_message) ? $this->nested_message : null; + } + + public function hasNestedMessage() + { + return isset($this->nested_message); + } + + public function clearNestedMessage() + { + unset($this->nested_message); + } + + /** + * Generated from protobuf field .google.apicore.testing.MockRequestBody nested_message = 4; + * @param \Google\ApiCore\Testing\MockRequestBody $var + * @return $this + */ + public function setNestedMessage($var) + { + GPBUtil::checkMessage($var, \Google\ApiCore\Testing\MockRequestBody::class); + $this->nested_message = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.protobuf.BytesValue bytes_value = 5; + * @return \Google\Protobuf\BytesValue + */ + public function getBytesValue() + { + return isset($this->bytes_value) ? $this->bytes_value : null; + } + + public function hasBytesValue() + { + return isset($this->bytes_value); + } + + public function clearBytesValue() + { + unset($this->bytes_value); + } + + /** + * Returns the unboxed value from getBytesValue() + + * Generated from protobuf field .google.protobuf.BytesValue bytes_value = 5; + * @return string|null + */ + public function getBytesValueUnwrapped() + { + return $this->readWrapperValue("bytes_value"); + } + + /** + * Generated from protobuf field .google.protobuf.BytesValue bytes_value = 5; + * @param \Google\Protobuf\BytesValue $var + * @return $this + */ + public function setBytesValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\BytesValue::class); + $this->bytes_value = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\BytesValue object. + + * Generated from protobuf field .google.protobuf.BytesValue bytes_value = 5; + * @param string|null $var + * @return $this + */ + public function setBytesValueUnwrapped($var) + { + $this->writeWrapperValue("bytes_value", $var); + return $this;} + + /** + * Generated from protobuf field .google.protobuf.Duration duration_value = 6; + * @return \Google\Protobuf\Duration + */ + public function getDurationValue() + { + return isset($this->duration_value) ? $this->duration_value : null; + } + + public function hasDurationValue() + { + return isset($this->duration_value); + } + + public function clearDurationValue() + { + unset($this->duration_value); + } + + /** + * Generated from protobuf field .google.protobuf.Duration duration_value = 6; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDurationValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration_value = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 7; + * @return \Google\Protobuf\FieldMask + */ + public function getFieldMask() + { + return isset($this->field_mask) ? $this->field_mask : null; + } + + public function hasFieldMask() + { + return isset($this->field_mask); + } + + public function clearFieldMask() + { + unset($this->field_mask); + } + + /** + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 7; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setFieldMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->field_mask = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.protobuf.Int64Value int64_value = 8; + * @return \Google\Protobuf\Int64Value + */ + public function getInt64Value() + { + return isset($this->int64_value) ? $this->int64_value : null; + } + + public function hasInt64Value() + { + return isset($this->int64_value); + } + + public function clearInt64Value() + { + unset($this->int64_value); + } + + /** + * Returns the unboxed value from getInt64Value() + + * Generated from protobuf field .google.protobuf.Int64Value int64_value = 8; + * @return int|string|null + */ + public function getInt64ValueUnwrapped() + { + return $this->readWrapperValue("int64_value"); + } + + /** + * Generated from protobuf field .google.protobuf.Int64Value int64_value = 8; + * @param \Google\Protobuf\Int64Value $var + * @return $this + */ + public function setInt64Value($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class); + $this->int64_value = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\Int64Value object. + + * Generated from protobuf field .google.protobuf.Int64Value int64_value = 8; + * @param int|string|null $var + * @return $this + */ + public function setInt64ValueUnwrapped($var) + { + $this->writeWrapperValue("int64_value", $var); + return $this;} + + /** + * Generated from protobuf field .google.protobuf.ListValue list_value = 9; + * @return \Google\Protobuf\ListValue + */ + public function getListValue() + { + return isset($this->list_value) ? $this->list_value : null; + } + + public function hasListValue() + { + return isset($this->list_value); + } + + public function clearListValue() + { + unset($this->list_value); + } + + /** + * Generated from protobuf field .google.protobuf.ListValue list_value = 9; + * @param \Google\Protobuf\ListValue $var + * @return $this + */ + public function setListValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class); + $this->list_value = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.protobuf.StringValue string_value = 10; + * @return \Google\Protobuf\StringValue + */ + public function getStringValue() + { + return isset($this->string_value) ? $this->string_value : null; + } + + public function hasStringValue() + { + return isset($this->string_value); + } + + public function clearStringValue() + { + unset($this->string_value); + } + + /** + * Returns the unboxed value from getStringValue() + + * Generated from protobuf field .google.protobuf.StringValue string_value = 10; + * @return string|null + */ + public function getStringValueUnwrapped() + { + return $this->readWrapperValue("string_value"); + } + + /** + * Generated from protobuf field .google.protobuf.StringValue string_value = 10; + * @param \Google\Protobuf\StringValue $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\StringValue::class); + $this->string_value = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\StringValue object. + + * Generated from protobuf field .google.protobuf.StringValue string_value = 10; + * @param string|null $var + * @return $this + */ + public function setStringValueUnwrapped($var) + { + $this->writeWrapperValue("string_value", $var); + return $this;} + + /** + * Generated from protobuf field .google.protobuf.Struct struct_value = 11; + * @return \Google\Protobuf\Struct + */ + public function getStructValue() + { + return isset($this->struct_value) ? $this->struct_value : null; + } + + public function hasStructValue() + { + return isset($this->struct_value); + } + + public function clearStructValue() + { + unset($this->struct_value); + } + + /** + * Generated from protobuf field .google.protobuf.Struct struct_value = 11; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setStructValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->struct_value = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.protobuf.Timestamp timestamp_value = 12; + * @return \Google\Protobuf\Timestamp + */ + public function getTimestampValue() + { + return isset($this->timestamp_value) ? $this->timestamp_value : null; + } + + public function hasTimestampValue() + { + return isset($this->timestamp_value); + } + + public function clearTimestampValue() + { + unset($this->timestamp_value); + } + + /** + * Generated from protobuf field .google.protobuf.Timestamp timestamp_value = 12; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setTimestampValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->timestamp_value = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.protobuf.Value value_value = 13; + * @return \Google\Protobuf\Value + */ + public function getValueValue() + { + return isset($this->value_value) ? $this->value_value : null; + } + + public function hasValueValue() + { + return isset($this->value_value); + } + + public function clearValueValue() + { + unset($this->value_value); + } + + /** + * Generated from protobuf field .google.protobuf.Value value_value = 13; + * @param \Google\Protobuf\Value $var + * @return $this + */ + public function setValueValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Value::class); + $this->value_value = $var; + + return $this; + } + + /** + * Generated from protobuf field string field_1 = 14; + * @return string + */ + public function getField1() + { + return $this->readOneof(14); + } + + public function hasField1() + { + return $this->hasOneof(14); + } + + /** + * Generated from protobuf field string field_1 = 14; + * @param string $var + * @return $this + */ + public function setField1($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(14, $var); + + return $this; + } + + /** + * Generated from protobuf field string field_2 = 15; + * @return string + */ + public function getField2() + { + return $this->readOneof(15); + } + + public function hasField2() + { + return $this->hasOneof(15); + } + + /** + * Generated from protobuf field string field_2 = 15; + * @param string $var + * @return $this + */ + public function setField2($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(15, $var); + + return $this; + } + + /** + * Generated from protobuf field string field_3 = 16; + * @return string + */ + public function getField3() + { + return $this->readOneof(16); + } + + public function hasField3() + { + return $this->hasOneof(16); + } + + /** + * Generated from protobuf field string field_3 = 16; + * @param string $var + * @return $this + */ + public function setField3($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(16, $var); + + return $this; + } + + /** + * @return string + */ + public function getOneofField() + { + return $this->whichOneof("oneof_field"); + } + +} + diff --git a/vendor/google/gax/src/Testing/MockResponse.php b/vendor/google/gax/src/Testing/MockResponse.php new file mode 100644 index 00000000..cf0c5bb6 --- /dev/null +++ b/vendor/google/gax/src/Testing/MockResponse.php @@ -0,0 +1,166 @@ +google.apicore.testing.MockResponse + */ +class MockResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Generated from protobuf field uint64 number = 2; + */ + protected $number = 0; + /** + * Generated from protobuf field repeated string resources_list = 3; + */ + private $resources_list; + /** + * Generated from protobuf field string next_page_token = 4; + */ + protected $next_page_token = ''; + /** + * Generated from protobuf field map resources_map = 5; + */ + private $resources_map; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type int|string $number + * @type string[]|\Google\Protobuf\Internal\RepeatedField $resources_list + * @type string $next_page_token + * @type array|\Google\Protobuf\Internal\MapField $resources_map + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\ApiCore\Testing\Mocks::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Generated from protobuf field uint64 number = 2; + * @return int|string + */ + public function getNumber() + { + return $this->number; + } + + /** + * Generated from protobuf field uint64 number = 2; + * @param int|string $var + * @return $this + */ + public function setNumber($var) + { + GPBUtil::checkUint64($var); + $this->number = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated string resources_list = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResourcesList() + { + return $this->resources_list; + } + + /** + * Generated from protobuf field repeated string resources_list = 3; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResourcesList($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->resources_list = $arr; + + return $this; + } + + /** + * Generated from protobuf field string next_page_token = 4; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Generated from protobuf field string next_page_token = 4; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Generated from protobuf field map resources_map = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getResourcesMap() + { + return $this->resources_map; + } + + /** + * Generated from protobuf field map resources_map = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setResourcesMap($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->resources_map = $arr; + + return $this; + } + +} + diff --git a/vendor/google/gax/src/Testing/MockServerStreamingCall.php b/vendor/google/gax/src/Testing/MockServerStreamingCall.php new file mode 100644 index 00000000..9b174cbf --- /dev/null +++ b/vendor/google/gax/src/Testing/MockServerStreamingCall.php @@ -0,0 +1,95 @@ +responses = $responses; + $this->deserialize = $deserialize; + if (is_null($status)) { + $status = new MockStatus(Code::OK, 'OK', []); + } elseif ($status instanceof stdClass) { + if (!property_exists($status, 'metadata')) { + $status->metadata = []; + } + } + $this->status = $status; + } + + public function responses() + { + while (count($this->responses) > 0) { + $resp = array_shift($this->responses); + $obj = $this->deserializeMessage($resp, $this->deserialize); + yield $obj; + } + } + + /** + * @return MockStatus|null|\stdClass + * @throws ApiException + */ + public function getStatus() + { + if (count($this->responses) > 0) { + throw new ApiException( + "Calls to getStatus() will block if all responses are not read", + Code::INTERNAL, + ApiStatus::INTERNAL + ); + } + return $this->status; + } +} diff --git a/vendor/google/gax/src/Testing/MockStatus.php b/vendor/google/gax/src/Testing/MockStatus.php new file mode 100644 index 00000000..dfaf7ea7 --- /dev/null +++ b/vendor/google/gax/src/Testing/MockStatus.php @@ -0,0 +1,49 @@ +code = $code; + $this->details = $details; + $this->metadata = $metadata; + } +} diff --git a/vendor/google/gax/src/Testing/MockStubTrait.php b/vendor/google/gax/src/Testing/MockStubTrait.php new file mode 100644 index 00000000..67668e37 --- /dev/null +++ b/vendor/google/gax/src/Testing/MockStubTrait.php @@ -0,0 +1,294 @@ +deserialize = $deserialize; + } + + /** + * Overrides the _simpleRequest method in \Grpc\BaseStub + * (https://github.com/grpc/grpc/blob/master/src/php/lib/Grpc/BaseStub.php) + * Returns a MockUnaryCall object that will return the first item from $responses + * @param string $method The API method name to be called + * @param \Google\Protobuf\Internal\Message $argument The request object to the API method + * @param callable $deserialize A function to deserialize the response object + * @param array $metadata + * @param array $options + * @return MockUnaryCall + */ + public function _simpleRequest( + $method, + $argument, + $deserialize, + array $metadata = [], + array $options = [] + ) { + $this->receivedFuncCalls[] = new ReceivedRequest($method, $argument, $deserialize, $metadata, $options); + if (count($this->responses) < 1) { + throw new UnderflowException("ran out of responses"); + } + list($response, $status) = array_shift($this->responses); + $call = new MockUnaryCall($response, $deserialize, $status); + $this->callObjects[] = $call; + return $call; + } + + /** + * Overrides the _clientStreamRequest method in \Grpc\BaseStub + * (https://github.com/grpc/grpc/blob/master/src/php/lib/Grpc/BaseStub.php) + * Returns a MockClientStreamingCall object that will return the first item from $responses + * + * @param string $method The name of the method to call + * @param callable $deserialize A function that deserializes the responses + * @param array $metadata A metadata map to send to the server + * (optional) + * @param array $options An array of options (optional) + * + * @return MockClientStreamingCall The active call object + */ + public function _clientStreamRequest( + $method, + $deserialize, + array $metadata = [], + array $options = [] + ) { + $this->receivedFuncCalls[] = new ReceivedRequest($method, null, $deserialize, $metadata, $options); + if (count($this->responses) < 1) { + throw new UnderflowException("ran out of responses"); + } + list($response, $status) = array_shift($this->responses); + $call = new MockClientStreamingCall($response, $deserialize, $status); + $this->callObjects[] = $call; + return $call; + } + + /** + * Overrides the _serverStreamRequest method in \Grpc\BaseStub + * (https://github.com/grpc/grpc/blob/master/src/php/lib/Grpc/BaseStub.php) + * Returns a MockServerStreamingCall object that will stream items from $responses, and return + * a final status of $serverStreamingStatus. + * + * @param string $method The name of the method to call + * @param \Google\Protobuf\Internal\Message $argument The argument to the method + * @param callable $deserialize A function that deserializes the responses + * @param array $metadata A metadata map to send to the server + * (optional) + * @param array $options An array of options (optional) + * + * @return MockServerStreamingCall The active call object + */ + public function _serverStreamRequest( + $method, + $argument, + $deserialize, + array $metadata = [], + array $options = [] + ) { + + if (is_a($argument, '\Google\Protobuf\Internal\Message')) { + /** @var Message $newArgument */ + $newArgument = new $argument(); + $newArgument->mergeFromString($argument->serializeToString()); + $argument = $newArgument; + } + $this->receivedFuncCalls[] = new ReceivedRequest($method, $argument, $deserialize, $metadata, $options); + $responses = MockStubTrait::stripStatusFromResponses($this->responses); + $this->responses = []; + $call = new MockServerStreamingCall($responses, $deserialize, $this->serverStreamingStatus); + $this->callObjects[] = $call; + return $call; + } + + /** + * Overrides the _bidiRequest method in \Grpc\BaseStub + * (https://github.com/grpc/grpc/blob/master/src/php/lib/Grpc/BaseStub.php) + * Returns a MockBidiStreamingCall object that will stream items from $responses, and return + * a final status of $serverStreamingStatus. + * + * @param string $method The name of the method to call + * @param callable $deserialize A function that deserializes the responses + * @param array $metadata A metadata map to send to the server + * (optional) + * @param array $options An array of options (optional) + * + * @return MockBidiStreamingCall The active call object + */ + public function _bidiRequest( + $method, + $deserialize, + array $metadata = [], + array $options = [] + ) { + + $this->receivedFuncCalls[] = new ReceivedRequest($method, null, $deserialize, $metadata, $options); + $responses = MockStubTrait::stripStatusFromResponses($this->responses); + $this->responses = []; + $call = new MockBidiStreamingCall($responses, $deserialize, $this->serverStreamingStatus); + $this->callObjects[] = $call; + return $call; + } + + public static function stripStatusFromResponses($responses) + { + $strippedResponses = []; + foreach ($responses as $response) { + list($resp, $_) = $response; + $strippedResponses[] = $resp; + } + return $strippedResponses; + } + + /** + * Add a response object, and an optional status, to the list of responses to be returned via + * _simpleRequest. + * @param \Google\Protobuf\Internal\Message $response + * @param Status $status + */ + public function addResponse($response, $status = null) + { + if (!$this->deserialize && $response) { + $this->deserialize = [get_class($response), 'decode']; + } + + if (is_a($response, '\Google\Protobuf\Internal\Message')) { + $response = $response->serializeToString(); + } + $this->responses[] = [$response, $status]; + } + + /** + * Set the status object to be used when creating streaming calls. + * + * @param Status $status + */ + public function setStreamingStatus($status) + { + $this->serverStreamingStatus = $status; + } + + /** + * Return a list of calls made to _simpleRequest, and clear $receivedFuncCalls. + * + * @return ReceivedRequest[] An array of received requests + */ + public function popReceivedCalls() + { + $receivedFuncCallsTemp = $this->receivedFuncCalls; + $this->receivedFuncCalls = []; + return $receivedFuncCallsTemp; + } + + /** + * @return int The number of calls received. + */ + public function getReceivedCallCount() + { + return count($this->receivedFuncCalls); + } + + /** + * @return mixed[] The call objects created by calls to the stub + */ + public function popCallObjects() + { + $callObjectsTemp = $this->callObjects; + $this->callObjects = []; + return $callObjectsTemp; + } + + /** + * @return bool True if $receivedFuncCalls and $response are empty. + */ + public function isExhausted() + { + return count($this->receivedFuncCalls) === 0 + && count($this->responses) === 0; + } + + /** + * @param mixed $responseObject + * @param $status + * @param callable $deserialize + * @return static An instance of the current class type. + */ + public static function create($responseObject, $status = null, $deserialize = null) + { + $stub = new static($deserialize); + $stub->addResponse($responseObject, $status); + return $stub; + } + + /** + * Creates a sequence such that the responses are returned in order. + * @param mixed[] $sequence + * @param callable $deserialize + * @param Status $finalStatus + * @return static An instance of the current class type. + */ + public static function createWithResponseSequence($sequence, $deserialize = null, $finalStatus = null) + { + $stub = new static($deserialize); + foreach ($sequence as $elem) { + if (count($elem) == 1) { + list($resp, $status) = [$elem, null]; + } else { + list($resp, $status) = $elem; + } + $stub->addResponse($resp, $status); + } + if ($finalStatus) { + $stub->setStreamingStatus($finalStatus); + } + return $stub; + } +} diff --git a/vendor/google/gax/src/Testing/MockTransport.php b/vendor/google/gax/src/Testing/MockTransport.php new file mode 100644 index 00000000..fcd013e7 --- /dev/null +++ b/vendor/google/gax/src/Testing/MockTransport.php @@ -0,0 +1,111 @@ +agentHeaderDescriptor = $agentHeaderDescriptor; + } + + public function startUnaryCall(Call $call, array $options) + { + $call = call_user_func([$this, $call->getMethod()], $call, $options); + return $promise = new Promise( + function () use ($call, &$promise) { + list($response, $status) = $call->wait(); + + if ($status->code == Code::OK) { + $promise->resolve($response); + } else { + throw ApiException::createFromStdClass($status); + } + }, + [$call, 'cancel'] + ); + } + + public function startBidiStreamingCall(Call $call, array $options) + { + $newArgs = ['/' . $call->getMethod(), $this->deserialize, $options, $options]; + $response = call_user_func_array(array($this, '_bidiRequest'), $newArgs); + return new BidiStream($response, $call->getDescriptor()); + } + + public function startClientStreamingCall(Call $call, array $options) + { + $newArgs = ['/' . $call->getMethod(), $this->deserialize, $options, $options]; + $response = call_user_func_array(array($this, '_clientStreamRequest'), $newArgs); + return new ClientStream($response, $call->getDescriptor()); + } + + public function startServerStreamingCall(Call $call, array $options) + { + $newArgs = ['/' . $call->getMethod(), $call->getMessage(), $this->deserialize, $options, $options]; + $response = call_user_func_array(array($this, '_serverStreamRequest'), $newArgs); + return new ServerStream($response, $call->getDescriptor()); + } + + public function __call($name, $arguments) + { + $call = $arguments[0]; + $options = $arguments[1]; + $decode = $call->getDecodeType() ? [$call->getDecodeType(), 'decode'] : null; + return $this->_simpleRequest( + '/' . $call->getMethod(), + $call->getMessage(), + $decode, + isset($options['headers']) ? $options['headers'] : [], + $options + ); + } + + public function close() + { + // does nothing + } +} diff --git a/vendor/google/gax/src/Testing/MockUnaryCall.php b/vendor/google/gax/src/Testing/MockUnaryCall.php new file mode 100644 index 00000000..9270e217 --- /dev/null +++ b/vendor/google/gax/src/Testing/MockUnaryCall.php @@ -0,0 +1,79 @@ +response = $response; + $this->deserialize = $deserialize; + if (is_null($status)) { + $status = new MockStatus(Code::OK); + } + $this->status = $status; + } + + /** + * Immediately return the preset response object and status. + * @return array The response object and status. + */ + public function wait() + { + return [ + $this->deserializeMessage($this->response, $this->deserialize), + $this->status, + ]; + } +} diff --git a/vendor/google/gax/src/Testing/ProtobufGPBEmptyComparator.php b/vendor/google/gax/src/Testing/ProtobufGPBEmptyComparator.php new file mode 100644 index 00000000..99ee6896 --- /dev/null +++ b/vendor/google/gax/src/Testing/ProtobufGPBEmptyComparator.php @@ -0,0 +1,58 @@ +exporter = new MessageAwareExporter(); + } + + /** + * Returns whether the comparator can compare two values. + * + * @param mixed $expected The first value to compare + * @param mixed $actual The second value to compare + * @return boolean + */ + public function accepts($expected, $actual) + { + return $expected instanceof Message && $actual instanceof Message; + } + + /** + * Asserts that two values are equal. + * + * @param Message $expected The first value to compare + * @param Message $actual The second value to compare + * @param float|int $delta The allowed numerical distance between two values to + * consider them equal + * @param bool $canonicalize If set to TRUE, arrays are sorted before + * comparison + * @param bool $ignoreCase If set to TRUE, upper- and lowercasing is + * ignored when comparing string values + * @throws ComparisonFailure Thrown when the comparison + * fails. Contains information about the + * specific errors that lead to the failure. + */ + public function assertEquals($expected, $actual, $delta = 0, $canonicalize = FALSE, $ignoreCase = FALSE) + { + if ($expected->serializeToString() !== $actual->serializeToString()) { + throw new ComparisonFailure( + $expected, + $actual, + $this->exporter->shortenedExport($expected), + $this->exporter->shortenedExport($actual), + false, + 'Given 2 Message objects are not the same' + ); + } + } +} diff --git a/vendor/google/gax/src/Testing/ReceivedRequest.php b/vendor/google/gax/src/Testing/ReceivedRequest.php new file mode 100644 index 00000000..763f2f0f --- /dev/null +++ b/vendor/google/gax/src/Testing/ReceivedRequest.php @@ -0,0 +1,77 @@ +actualCall = [ + 'funcCall' => $funcCall, + 'request' => $requestObject, + 'deserialize' => $deserialize, + 'metadata' => $metadata, + 'options' => $options, + ]; + } + + public function getArray() + { + return $this->actualCall; + } + + public function getFuncCall() + { + return $this->actualCall['funcCall']; + } + + public function getRequestObject() + { + return $this->actualCall['request']; + } + + public function getMetadata() + { + return $this->actualCall['metadata']; + } + + public function getOptions() + { + return $this->actualCall['options']; + } +} diff --git a/vendor/google/gax/src/Testing/SerializationTrait.php b/vendor/google/gax/src/Testing/SerializationTrait.php new file mode 100644 index 00000000..d63d8d45 --- /dev/null +++ b/vendor/google/gax/src/Testing/SerializationTrait.php @@ -0,0 +1,65 @@ +$deserializeFunc($message); + } elseif (is_string($message)) { + $obj->mergeFromString($message); + } + + return $obj; + } + + // Protobuf-PHP implementation + return call_user_func($deserialize, $message); + } +} diff --git a/vendor/google/gax/src/Testing/mocks.proto b/vendor/google/gax/src/Testing/mocks.proto new file mode 100644 index 00000000..314f1313 --- /dev/null +++ b/vendor/google/gax/src/Testing/mocks.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; + +package google.apicore.testing; + +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/wrappers.proto"; + +option php_namespace = "Google\\ApiCore\\Testing"; +option php_metadata_namespace = "GPBMetadata\\ApiCore\\Testing"; + +message MockRequest { + string page_token = 1; + uint64 page_size = 2; +} + +message MockResponse { + string name = 1; + uint64 number = 2; + repeated string resources_list = 3; + string next_page_token = 4; + map resources_map = 5; +} + +message MockRequestBody { + string name = 1; + uint64 number = 2; + repeated string repeated_field = 3; + MockRequestBody nested_message = 4; + google.protobuf.BytesValue bytes_value = 5; + google.protobuf.Duration duration_value = 6; + google.protobuf.FieldMask field_mask = 7; + google.protobuf.Int64Value int64_value = 8; + google.protobuf.ListValue list_value = 9; + google.protobuf.StringValue string_value = 10; + google.protobuf.Struct struct_value = 11; + google.protobuf.Timestamp timestamp_value = 12; + google.protobuf.Value value_value = 13; + oneof oneof_field { + string field_1 = 14; + string field_2 = 15; + string field_3 = 16; + } +} diff --git a/vendor/google/gax/src/Transport/Grpc/ForwardingCall.php b/vendor/google/gax/src/Transport/Grpc/ForwardingCall.php new file mode 100644 index 00000000..bd0b4205 --- /dev/null +++ b/vendor/google/gax/src/Transport/Grpc/ForwardingCall.php @@ -0,0 +1,88 @@ +innerCall = $innerCall; + } + + /** + * @return mixed The metadata sent by the server + */ + public function getMetadata() + { + return $this->innerCall->getMetadata(); + } + + /** + * @return mixed The trailing metadata sent by the server + */ + public function getTrailingMetadata() + { + return $this->innerCall->getTrailingMetadata(); + } + + /** + * @return string The URI of the endpoint + */ + public function getPeer() + { + return $this->innerCall->getPeer(); + } + + /** + * Cancels the call. + */ + public function cancel() + { + $this->innerCall->cancel(); + } +} diff --git a/vendor/google/gax/src/Transport/Grpc/ForwardingServerStreamingCall.php b/vendor/google/gax/src/Transport/Grpc/ForwardingServerStreamingCall.php new file mode 100644 index 00000000..91656968 --- /dev/null +++ b/vendor/google/gax/src/Transport/Grpc/ForwardingServerStreamingCall.php @@ -0,0 +1,60 @@ +innerCall->responses(); + } + + /** + * Wait for the server to send the status, and return it. + * + * @return \stdClass The status object, with integer $code, string + * $details, and array $metadata members + */ + public function getStatus() + { + return $this->innerCall->getStatus(); + } +} diff --git a/vendor/google/gax/src/Transport/Grpc/ForwardingUnaryCall.php b/vendor/google/gax/src/Transport/Grpc/ForwardingUnaryCall.php new file mode 100644 index 00000000..fa993fdb --- /dev/null +++ b/vendor/google/gax/src/Transport/Grpc/ForwardingUnaryCall.php @@ -0,0 +1,51 @@ +innerCall->wait(); + } +} diff --git a/vendor/google/gax/src/Transport/Grpc/ServerStreamingCallWrapper.php b/vendor/google/gax/src/Transport/Grpc/ServerStreamingCallWrapper.php new file mode 100644 index 00000000..dd5f2bd9 --- /dev/null +++ b/vendor/google/gax/src/Transport/Grpc/ServerStreamingCallWrapper.php @@ -0,0 +1,123 @@ +stream = $stream; + } + + /** + * {@inheritdoc} + */ + public function start($data, array $metadata = [], array $callOptions = []) + { + $this->stream->start($data, $metadata, $callOptions); + } + + /** + * {@inheritdoc} + */ + public function responses() + { + foreach ($this->stream->responses() as $response) { + yield $response; + } + } + + /** + * {@inheritdoc} + */ + public function getStatus() + { + return $this->stream->getStatus(); + } + + /** + * {@inheritdoc} + */ + public function getMetadata() + { + return $this->stream->getMetadata(); + } + + /** + * {@inheritdoc} + */ + public function getTrailingMetadata() + { + return $this->stream->getTrailingMetadata(); + } + + /** + * {@inheritdoc} + */ + public function getPeer() + { + return $this->stream->getPeer(); + } + + /** + * {@inheritdoc} + */ + public function cancel() + { + $this->stream->cancel(); + } + + /** + * {@inheritdoc} + */ + public function setCallCredentials($call_credentials) + { + $this->stream->setCallCredentials($call_credentials); + } +} diff --git a/vendor/google/gax/src/Transport/Grpc/UnaryInterceptorInterface.php b/vendor/google/gax/src/Transport/Grpc/UnaryInterceptorInterface.php new file mode 100644 index 00000000..432d3ab1 --- /dev/null +++ b/vendor/google/gax/src/Transport/Grpc/UnaryInterceptorInterface.php @@ -0,0 +1,61 @@ +baseUri = $baseUri; + $this->httpHandler = $httpHandler; + $this->transportName = 'grpc-fallback'; + } + + /** + * Builds a GrpcFallbackTransport. + * + * @param string $apiEndpoint + * The address of the API remote host, for example "example.googleapis.com". + * @param array $config { + * Config options used to construct the grpc-fallback transport. + * + * @type callable $httpHandler A handler used to deliver PSR-7 requests. + * } + * @return GrpcFallbackTransport + * @throws ValidationException + */ + public static function build($apiEndpoint, array $config = []) + { + $config += [ + 'httpHandler' => null, + 'clientCertSource' => null, + ]; + list($baseUri, $port) = self::normalizeServiceAddress($apiEndpoint); + $httpHandler = $config['httpHandler'] ?: self::buildHttpHandlerAsync(); + $transport = new GrpcFallbackTransport("$baseUri:$port", $httpHandler); + if ($config['clientCertSource']) { + $transport->configureMtlsChannel($config['clientCertSource']); + } + return $transport; + } + + /** + * {@inheritdoc} + */ + public function startUnaryCall(Call $call, array $options) + { + $httpHandler = $this->httpHandler; + return $httpHandler( + $this->buildRequest($call, $options), + $this->getCallOptions($options) + )->then( + function (ResponseInterface $response) use ($options) { + if (isset($options['metadataCallback'])) { + $metadataCallback = $options['metadataCallback']; + $metadataCallback($response->getHeaders()); + } + return $response; + } + )->then( + function (ResponseInterface $response) use ($call) { + return $this->unpackResponse($call, $response); + }, + function (\Exception $ex) { + throw $this->transformException($ex); + } + ); + } + + /** + * @param Call $call + * @param array $options + * @return RequestInterface + */ + private function buildRequest(Call $call, array $options) + { + // Build common headers and set the content type to 'application/x-protobuf' + $headers = ['Content-Type' => 'application/x-protobuf'] + self::buildCommonHeaders($options); + + // It is necessary to supply 'grpc-web' in the 'x-goog-api-client' header + // when using the grpc-fallback protocol. + $headers += ['x-goog-api-client' => []]; + $headers['x-goog-api-client'][] = 'grpc-web'; + + // Uri format: https:///$rpc/ + $uri = "https://{$this->baseUri}/\$rpc/{$call->getMethod()}"; + + return new Request( + 'POST', + $uri, + $headers, + $call->getMessage()->serializeToString() + ); + } + + /** + * @param Call $call + * @param ResponseInterface $response + * @return Message + */ + private function unpackResponse(Call $call, ResponseInterface $response) + { + $decodeType = $call->getDecodeType(); + /** @var Message $responseMessage */ + $responseMessage = new $decodeType; + $responseMessage->mergeFromString((string)$response->getBody()); + return $responseMessage; + } + + /** + * @param array $options + * @return array + */ + private function getCallOptions(array $options) + { + $callOptions = isset($options['transportOptions']['grpcFallbackOptions']) + ? $options['transportOptions']['grpcFallbackOptions'] + : []; + + if (isset($options['timeoutMillis'])) { + $callOptions['timeout'] = $options['timeoutMillis'] / 1000; + } + + if ($this->clientCertSource) { + list($cert, $key) = self::loadClientCertSource(); + $callOptions['cert'] = $cert; + $callOptions['key'] = $key; + } + + return $callOptions; + } + + /** + * @param \Exception $ex + * @return \Exception + */ + private function transformException(\Exception $ex) + { + if ($ex instanceof RequestException && $ex->hasResponse()) { + $res = $ex->getResponse(); + $body = (string) $res->getBody(); + $status = new Status(); + try { + $status->mergeFromString($body); + return ApiException::createFromRpcStatus($status); + } catch (\Exception $parseException) { + // We were unable to parse the response body into a $status object. Instead, + // create an ApiException using the unparsed $body as message. + $code = ApiStatus::rpcCodeFromHttpStatusCode($res->getStatusCode()); + return ApiException::createFromApiResponse($body, $code, null, $parseException); + } + } else { + return $ex; + } + } +} diff --git a/vendor/google/gax/src/Transport/GrpcTransport.php b/vendor/google/gax/src/Transport/GrpcTransport.php new file mode 100644 index 00000000..4bf5aa54 --- /dev/null +++ b/vendor/google/gax/src/Transport/GrpcTransport.php @@ -0,0 +1,273 @@ + [], + 'channel' => null, + 'interceptors' => [], + 'clientCertSource' => null, + ]; + list($addr, $port) = self::normalizeServiceAddress($apiEndpoint); + $host = "$addr:$port"; + $stubOpts = $config['stubOpts']; + // Set the required 'credentials' key in stubOpts if it is not already set. Use + // array_key_exists because null is a valid value. + if (!array_key_exists('credentials', $stubOpts)) { + if (isset($config['clientCertSource'])) { + list($cert, $key) = self::loadClientCertSource($config['clientCertSource']); + $stubOpts['credentials'] = ChannelCredentials::createSsl(null, $key, $cert); + } else { + $stubOpts['credentials'] = ChannelCredentials::createSsl(); + } + } + $channel = $config['channel']; + if (!is_null($channel) && !($channel instanceof Channel)) { + throw new ValidationException( + "Channel argument to GrpcTransport must be of type \Grpc\Channel, " . + "instead got: " . print_r($channel, true) + ); + } + try { + return new GrpcTransport($host, $stubOpts, $channel, $config['interceptors']); + } catch (Exception $ex) { + throw new ValidationException( + "Failed to build GrpcTransport: " . $ex->getMessage(), + $ex->getCode(), + $ex + ); + } + } + + /** + * {@inheritdoc} + */ + public function startBidiStreamingCall(Call $call, array $options) + { + return new BidiStream( + $this->_bidiRequest( + '/' . $call->getMethod(), + [$call->getDecodeType(), 'decode'], + isset($options['headers']) ? $options['headers'] : [], + $this->getCallOptions($options) + ), + $call->getDescriptor() + ); + } + + /** + * {@inheritdoc} + */ + public function startClientStreamingCall(Call $call, array $options) + { + return new ClientStream( + $this->_clientStreamRequest( + '/' . $call->getMethod(), + [$call->getDecodeType(), 'decode'], + isset($options['headers']) ? $options['headers'] : [], + $this->getCallOptions($options) + ), + $call->getDescriptor() + ); + } + + /** + * {@inheritdoc} + */ + public function startServerStreamingCall(Call $call, array $options) + { + $message = $call->getMessage(); + + if (!$message) { + throw new \InvalidArgumentException('A message is required for ServerStreaming calls.'); + } + + // This simultaenously creates and starts a \Grpc\ServerStreamingCall. + $stream = $this->_serverStreamRequest( + '/' . $call->getMethod(), + $message, + [$call->getDecodeType(), 'decode'], + isset($options['headers']) ? $options['headers'] : [], + $this->getCallOptions($options) + ); + return new ServerStream( + new ServerStreamingCallWrapper($stream), + $call->getDescriptor() + ); + } + + /** + * {@inheritdoc} + */ + public function startUnaryCall(Call $call, array $options) + { + $unaryCall = $this->_simpleRequest( + '/' . $call->getMethod(), + $call->getMessage(), + [$call->getDecodeType(), 'decode'], + isset($options['headers']) ? $options['headers'] : [], + $this->getCallOptions($options) + ); + + /** @var Promise $promise */ + $promise = new Promise( + function () use ($unaryCall, $options, &$promise) { + list($response, $status) = $unaryCall->wait(); + + if ($status->code == Code::OK) { + if (isset($options['metadataCallback'])) { + $metadataCallback = $options['metadataCallback']; + $metadataCallback($unaryCall->getMetadata()); + } + $promise->resolve($response); + } else { + throw ApiException::createFromStdClass($status); + } + }, + [$unaryCall, 'cancel'] + ); + + return $promise; + } + + private function getCallOptions(array $options) + { + $callOptions = isset($options['transportOptions']['grpcOptions']) + ? $options['transportOptions']['grpcOptions'] + : []; + + if (isset($options['credentialsWrapper'])) { + $audience = isset($options['audience']) + ? $options['audience'] + : null; + $credentialsWrapper = $options['credentialsWrapper']; + $callOptions['call_credentials_callback'] = $credentialsWrapper + ->getAuthorizationHeaderCallback($audience); + } + + if (isset($options['timeoutMillis'])) { + $callOptions['timeout'] = $options['timeoutMillis'] * 1000; + } + + return $callOptions; + } + + private static function loadClientCertSource(callable $clientCertSource) + { + return call_user_func($clientCertSource); + } +} diff --git a/vendor/google/gax/src/Transport/HttpUnaryTransportTrait.php b/vendor/google/gax/src/Transport/HttpUnaryTransportTrait.php new file mode 100644 index 00000000..4a65627a --- /dev/null +++ b/vendor/google/gax/src/Transport/HttpUnaryTransportTrait.php @@ -0,0 +1,164 @@ +throwUnsupportedException(); + } + + /** + * {@inheritdoc} + * @throws \BadMethodCallException + */ + public function startServerStreamingCall(Call $call, array $options) + { + $this->throwUnsupportedException(); + } + + /** + * {@inheritdoc} + * @throws \BadMethodCallException + */ + public function startBidiStreamingCall(Call $call, array $options) + { + $this->throwUnsupportedException(); + } + + /** + * {@inheritdoc} + */ + public function close() + { + // Nothing to do. + } + + /** + * @param array $options + * @return array + */ + private static function buildCommonHeaders(array $options) + { + $headers = isset($options['headers']) + ? $options['headers'] + : []; + + if (!is_array($headers)) { + throw new \InvalidArgumentException( + 'The "headers" option must be an array' + ); + } + + // If not already set, add an auth header to the request + if (!isset($headers['Authorization']) && isset($options['credentialsWrapper'])) { + $credentialsWrapper = $options['credentialsWrapper']; + $audience = isset($options['audience']) + ? $options['audience'] + : null; + $callback = $credentialsWrapper + ->getAuthorizationHeaderCallback($audience); + // Prevent unexpected behavior, as the authorization header callback + // uses lowercase "authorization" + unset($headers['authorization']); + $authHeaders = $callback(); + if (!is_array($authHeaders)) { + throw new \UnexpectedValueException( + 'Expected array response from authorization header callback' + ); + } + $headers += $authHeaders; + } + + return $headers; + } + + /** + * @return callable + * @throws ValidationException + */ + private static function buildHttpHandlerAsync() + { + try { + return [HttpHandlerFactory::build(), 'async']; + } catch (Exception $ex) { + throw new ValidationException("Failed to build HttpHandler", $ex->getCode(), $ex); + } + } + + /** + * Set the path to a client certificate. + * + * @param string $clientCertSource + */ + private function configureMtlsChannel(callable $clientCertSource) + { + $this->clientCertSource = $clientCertSource; + } + + private function throwUnsupportedException() + { + throw new \BadMethodCallException( + "Streaming calls are not supported while using the {$this->transportName} transport." + ); + } + + private static function loadClientCertSource(callable $clientCertSource) + { + $certFile = tempnam(sys_get_temp_dir(), 'cert'); + $keyFile = tempnam(sys_get_temp_dir(), 'key'); + list($cert, $key) = call_user_func($this->clientCertSource); + file_put_contents($certFile, $cert); + file_put_contents($keyFile, $key); + + // the key and the cert are returned in one temporary file + return [$certFile, $keyFile]; + } +} diff --git a/vendor/google/gax/src/Transport/Rest/JsonStreamDecoder.php b/vendor/google/gax/src/Transport/Rest/JsonStreamDecoder.php new file mode 100644 index 00000000..45995ae9 --- /dev/null +++ b/vendor/google/gax/src/Transport/Rest/JsonStreamDecoder.php @@ -0,0 +1,231 @@ +stream = $stream; + $this->decodeType = $decodeType; + + if (isset($options['ignoreUnknown'])) { + $this->ignoreUnknown = $options['ignoreUnknown']; + } + if (isset($options['readChunkSize'])) { + $this->readChunkSize = $options['readChunkSizeBytes']; + } + } + + /** + * Begins decoding the configured response stream. It is a generator which + * yields messages of the given decode type from the stream until the stream + * completes. Throws an Exception if the stream is closed before the closing + * byte is read or if it encounters an error while decoding a message. + * + * @throws RuntimeException + * @return \Generator + */ + public function decode() + { + try { + foreach ($this->_decode() as $response) { + yield $response; + } + } catch (RuntimeException $re) { + $msg = $re->getMessage(); + $streamClosedException = + strpos($msg, 'Stream is detached') !== false || + strpos($msg, 'Unexpected stream close') !== false; + + // Only throw the exception if close() was not called and it was not + // a closing-related exception. + if (!$this->closeCalled || !$streamClosedException) { + throw $re; + } + } + } + + private function _decode() + { + $decodeType = $this->decodeType; + $str = false; + $prev = $chunk = ''; + $start = $end = $cursor = $level = 0; + while ($chunk !== '' || !$this->stream->eof()) { + // Read up to $readChunkSize bytes from the stream. + $chunk .= $this->stream->read($this->readChunkSize); + + // If the response stream has been closed and the only byte + // remaining is the closing array bracket, we are done. + if ($this->stream->eof() && $chunk === ']') { + $level--; + break; + } + + // Parse the freshly read data available in $chunk. + $chunkLength = strlen($chunk); + while ($cursor < $chunkLength) { + // Access the next byte for processing. + $b = $chunk[$cursor]; + + // Track open/close double quotes of a key or value. Do not + // toggle flag with the pervious byte was an escape character. + if ($b === '"' && $prev !== self::ESCAPE_CHAR) { + $str = !$str; + } + + // Skip over new lines that break up items. + if ($b === "\n" && $level === 1) { + $start++; + } + + // Ignore commas separating messages in the stream array. + if ($b === ',' && $level === 1) { + $start++; + } + // Track the opening of a new array or object if not in a string + // value. + if (($b === '{' || $b === '[') && !$str) { + $level++; + // Opening of the array/root object. + // Do not include it in the messageBuffer. + if ($level === 1) { + $start++; + } + } + // Track the closing of an object if not in a string value. + if ($b === '}' && !$str) { + $level--; + if ($level === 1) { + $end = $cursor+1; + } + } + // Track the closing of an array if not in a string value. + if ($b === ']' && !$str) { + $level--; + // If we are seeing a closing square bracket at the + // response message level, e.g. {"foo], there is a problem. + if ($level === 1) { + throw new \RuntimeException('Received closing byte mid-message'); + } + } + + // A message-closing byte was just buffered. Decode the + // message with the decode type, clearing the messageBuffer, + // and yield it. + // + // TODO(noahdietz): Support google.protobuf.*Value messages that + // are encoded as primitives and separated by commas. + if ($end !== 0) { + $length = $end - $start; + $return = new $decodeType(); + $return->mergeFromJsonString( + substr($chunk, $start, $length), + $this->ignoreUnknown + ); + yield $return; + + // Dump the part of the chunk used for parsing the message + // and use the remaining for the next message. + $remaining = $chunkLength-$length; + $chunk = substr($chunk, $end, $remaining); + + // Reset all indices and exit chunk processing. + $start = 0; + $end = 0; + $cursor = 0; + break; + } + + $cursor++; + + // An escaped back slash should not escape the following character. + if ($b === self::ESCAPE_CHAR && $prev === self::ESCAPE_CHAR) { + $b = ''; + } + $prev = $b; + } + // If after attempting to process the chunk, no progress was made and the + // stream is closed, we must break as the stream has closed prematurely. + if ($cursor === $chunkLength && $this->stream->eof()) { + break; + } + } + if ($level > 0) { + throw new \RuntimeException('Unexpected stream close before receiving the closing byte'); + } + } + + /** + * Closes the underlying stream. If the stream is actively being decoded, an + * exception will not be thrown due to the interruption. + */ + public function close() + { + $this->closeCalled = true; + $this->stream->close(); + } +} diff --git a/vendor/google/gax/src/Transport/Rest/RestServerStreamingCall.php b/vendor/google/gax/src/Transport/Rest/RestServerStreamingCall.php new file mode 100644 index 00000000..3cf6aeef --- /dev/null +++ b/vendor/google/gax/src/Transport/Rest/RestServerStreamingCall.php @@ -0,0 +1,180 @@ +httpHandler = $httpHandler; + $this->decodeType = $decodeType; + $this->decoderOptions = $decoderOptions; + } + + /** + * {@inheritdoc} + */ + public function start($request, array $headers = [], array $callOptions = []) + { + $this->originalRequest = $this->appendHeaders($request, $headers); + + try { + $handler = $this->httpHandler; + $response = $handler( + $this->originalRequest, + $callOptions + )->wait(); + } catch (\Exception $ex) { + if ($ex instanceof RequestException && $ex->hasResponse()) { + $ex = ApiException::createFromRequestException($ex, /* isStream */ true); + } + throw $ex; + } + + // Create an OK Status for a successful request just so that it + // has a return value. + $this->status = new stdClass(); + $this->status->code = Code::OK; + $this->status->message = ApiStatus::OK; + $this->status->details = []; + + $this->response = $response; + } + + private function appendHeaders($request, $headers) + { + foreach ($headers as $key => $value) { + $request = $request->hasHeader($key) ? + $request->withAddedHeader($key, $value) : + $request->withHeader($key, $value); + } + + return $request; + } + + /** + * {@inheritdoc} + */ + public function responses() + { + if (is_null($this->response)) { + throw new \Exception('Stream has not been started.'); + } + + // Decode the stream and yield responses as they are read. + $this->decoder = new JsonStreamDecoder( + $this->response->getBody(), + $this->decodeType, + $this->decoderOptions + ); + + foreach ($this->decoder->decode() as $message) { + yield $message; + } + } + + /** + * Return the status of the server stream. If the call has not been started + * this will be null. + * + * @return \stdClass The status, with integer $code, string + * $details, and array $metadata members + */ + public function getStatus() + { + return $this->status; + } + + /** + * {@inheritdoc} + */ + public function getMetadata() + { + return is_null($this->response) ? null : $this->response->getHeaders(); + } + + /** + * The Rest transport does not support trailing metadata. This is a + * passthrough to getMetadata(). + */ + public function getTrailingMetadata() + { + return $this->getMetadata(); + } + + /** + * {@inheritdoc} + */ + public function getPeer() + { + return $this->originalRequest->getUri(); + } + + /** + * {@inheritdoc} + */ + public function cancel() + { + if (!is_null($this->decoder)) { + $this->decoder->close(); + } + } + + /** + * For the REST transport this is a no-op. + */ + public function setCallCredentials($call_credentials) + { + // Do nothing. + } +} diff --git a/vendor/google/gax/src/Transport/RestTransport.php b/vendor/google/gax/src/Transport/RestTransport.php new file mode 100644 index 00000000..24582c84 --- /dev/null +++ b/vendor/google/gax/src/Transport/RestTransport.php @@ -0,0 +1,238 @@ +requestBuilder = $requestBuilder; + $this->httpHandler = $httpHandler; + $this->transportName = 'REST'; + } + + /** + * Builds a RestTransport. + * + * @param string $apiEndpoint + * The address of the API remote host, for example "example.googleapis.com". + * @param string $restConfigPath + * Path to rest config file. + * @param array $config { + * Config options used to construct the gRPC transport. + * + * @type callable $httpHandler A handler used to deliver PSR-7 requests. + * @type callable $clientCertSource A callable which returns the client cert as a string. + * } + * @return RestTransport + * @throws ValidationException + */ + public static function build($apiEndpoint, $restConfigPath, array $config = []) + { + $config += [ + 'httpHandler' => null, + 'clientCertSource' => null, + ]; + list($baseUri, $port) = self::normalizeServiceAddress($apiEndpoint); + $requestBuilder = new RequestBuilder("$baseUri:$port", $restConfigPath); + $httpHandler = $config['httpHandler'] ?: self::buildHttpHandlerAsync(); + $transport = new RestTransport($requestBuilder, $httpHandler); + if ($config['clientCertSource']) { + $transport->configureMtlsChannel($config['clientCertSource']); + } + return $transport; + } + + /** + * {@inheritdoc} + */ + public function startUnaryCall(Call $call, array $options) + { + $headers = self::buildCommonHeaders($options); + + // call the HTTP handler + $httpHandler = $this->httpHandler; + return $httpHandler( + $this->requestBuilder->build( + $call->getMethod(), + $call->getMessage(), + $headers + ), + $this->getCallOptions($options) + )->then( + function (ResponseInterface $response) use ($call, $options) { + $decodeType = $call->getDecodeType(); + /** @var Message $return */ + $return = new $decodeType; + $return->mergeFromJsonString( + (string) $response->getBody(), + true + ); + + if (isset($options['metadataCallback'])) { + $metadataCallback = $options['metadataCallback']; + $metadataCallback($response->getHeaders()); + } + + return $return; + }, + function (\Exception $ex) { + if ($ex instanceof RequestException && $ex->hasResponse()) { + throw ApiException::createFromRequestException($ex); + } + + throw $ex; + } + ); + } + + /** + * {@inheritdoc} + * @throws BadMethodCallException for forwards compatibility with older GAPIC clients + */ + public function startServerStreamingCall(Call $call, array $options) + { + $message = $call->getMessage(); + if (!$message) { + throw new \InvalidArgumentException('A message is required for ServerStreaming calls.'); + } + + // Maintain forwards compatibility with older GAPIC clients not configured for REST server streaming + // @see https://github.com/googleapis/gax-php/issues/370 + if (!$this->requestBuilder->pathExists($call->getMethod())) { + $this->unsupportedServerStreamingCall($call, $options); + } + + $headers = self::buildCommonHeaders($options); + $callOptions = $this->getCallOptions($options); + $request = $this->requestBuilder->build( + $call->getMethod(), + $call->getMessage() + // Exclude headers here because they will be added in _serverStreamRequest(). + ); + + $decoderOptions = []; + if (isset($options['decoderOptions'])) { + $decoderOptions = $options['decoderOptions']; + } + + return new ServerStream( + $this->_serverStreamRequest( + $this->httpHandler, + $request, + $headers, + $call->getDecodeType(), + $callOptions, + $decoderOptions + ), + $call->getDescriptor() + ); + } + + /** + * Creates and starts a RestServerStreamingCall. + * + * @param callable $httpHandler The HTTP Handler to invoke the request with. + * @param RequestInterface $request The request to invoke. + * @param array $headers The headers to include in the request. + * @param string $decodeType The response stream message type to decode. + * @param array $callOptions The call options to use when making the call. + * @param array $decoderOptions The options to use for the JsonStreamDecoder. + * + */ + private function _serverStreamRequest( + $httpHandler, + $request, + $headers, + $decodeType, + $callOptions, + $decoderOptions = [] + ) { + $call = new RestServerStreamingCall( + $httpHandler, + $decodeType, + $decoderOptions + ); + $call->start($request, $headers, $callOptions); + + return $call; + } + + private function getCallOptions(array $options) + { + $callOptions = isset($options['transportOptions']['restOptions']) + ? $options['transportOptions']['restOptions'] + : []; + + if (isset($options['timeoutMillis'])) { + $callOptions['timeout'] = $options['timeoutMillis'] / 1000; + } + + if ($this->clientCertSource) { + list($cert, $key) = self::loadClientCertSource(); + $callOptions['cert'] = $cert; + $callOptions['key'] = $key; + } + + return $callOptions; + } +} diff --git a/vendor/google/gax/src/Transport/TransportInterface.php b/vendor/google/gax/src/Transport/TransportInterface.php new file mode 100644 index 00000000..c8460935 --- /dev/null +++ b/vendor/google/gax/src/Transport/TransportInterface.php @@ -0,0 +1,89 @@ + &$v) { + if (is_bool($v)) { + $v = $v ? 'true' : 'false'; + } + } + + return Utils::uriFor($uri) + ->withQuery( + Query::build($query) + ); + } +} diff --git a/vendor/google/gax/src/ValidationException.php b/vendor/google/gax/src/ValidationException.php new file mode 100644 index 00000000..27a66a82 --- /dev/null +++ b/vendor/google/gax/src/ValidationException.php @@ -0,0 +1,41 @@ +setRules([ + '@PSR2' => true, + 'concat_space' => ['spacing' => 'one'], + 'no_unused_imports' => true, + 'method_argument_space' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->notPath('firestore') + ->in(__DIR__) + ) +; + diff --git a/vendor/google/grpc-gcp/LICENSE b/vendor/google/grpc-gcp/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/vendor/google/grpc-gcp/LICENSE @@ -0,0 +1,202 @@ + + 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/google/grpc-gcp/README.md b/vendor/google/grpc-gcp/README.md new file mode 100644 index 00000000..4d49b4e5 --- /dev/null +++ b/vendor/google/grpc-gcp/README.md @@ -0,0 +1,14 @@ +# gRPC for GCP extensions + +Copyright 2018 +[The gRPC Authors](https://github.com/grpc/grpc/blob/master/AUTHORS) + +## About This Repository + +This repo is created to support GCP specific extensions for gRPC. To use the extension features, please refer to [src](src). + +This repo also contains supporting infrastructures such as end2end tests and benchmarks for accessing cloud APIs with gRPC client libraries. + +## License + +Apache 2.0 - See [LICENSE](LICENSE) for more information. diff --git a/vendor/google/grpc-gcp/cloudprober/bins/opt/grpc_php_plugin b/vendor/google/grpc-gcp/cloudprober/bins/opt/grpc_php_plugin new file mode 100755 index 00000000..a0e24c9f Binary files /dev/null and b/vendor/google/grpc-gcp/cloudprober/bins/opt/grpc_php_plugin differ diff --git a/vendor/google/grpc-gcp/cloudprober/cloudprober.cfg b/vendor/google/grpc-gcp/cloudprober/cloudprober.cfg new file mode 100644 index 00000000..4a5270b7 --- /dev/null +++ b/vendor/google/grpc-gcp/cloudprober/cloudprober.cfg @@ -0,0 +1,31 @@ +probe { + type: EXTERNAL + name: "spanner" + interval_msec: 1800000 + timeout_msec: 30000 + targets { dummy_targets {} } # No targets for external probe + external_probe { + mode: ONCE + command: "php grpc_gpc_prober/prober.php --api=spanner" + } +} + +probe { + type: EXTERNAL + name: "firestore" + interval_msec: 1800000 + timeout_msec: 30000 + targets { dummy_targets {} } # No targets for external probe + external_probe { + mode: ONCE + command: "php grpc_gpc_prober/prober.php --api=firestore" + } +} + +surfacer { + type: STACKDRIVER + name: "stackdriver" + stackdriver_surfacer { + monitoring_url: "custom.googleapis.com/cloudprober/" + } +} diff --git a/vendor/google/grpc-gcp/cloudprober/codegen.sh b/vendor/google/grpc-gcp/cloudprober/codegen.sh new file mode 100755 index 00000000..89ec5338 --- /dev/null +++ b/vendor/google/grpc-gcp/cloudprober/codegen.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +cd "$(dirname "$0")" + +rm -rf google + +for p in $(find ../third_party/googleapis/google -type f -name *.proto); do + protoc \ + --proto_path=../third_party/googleapis \ + --php_out=./ \ + --grpc_out=./ \ + --plugin=protoc-gen-grpc="$(which grpc_php_plugin)" \ + "$p" +done diff --git a/vendor/google/grpc-gcp/cloudprober/composer.json b/vendor/google/grpc-gcp/cloudprober/composer.json new file mode 100644 index 00000000..cf255394 --- /dev/null +++ b/vendor/google/grpc-gcp/cloudprober/composer.json @@ -0,0 +1,9 @@ +{ + "name": "grpc_gcp_prober", + "description": "grpc cloudprober for PHP", + "require": { + "grpc/grpc": "^v1.15.0", + "google/auth": "^v1.4.0", + "google/cloud": "^v0.86.0" + } +} diff --git a/vendor/google/grpc-gcp/cloudprober/grpc_gpc_prober/firestore_probes.php b/vendor/google/grpc-gcp/cloudprober/grpc_gpc_prober/firestore_probes.php new file mode 100644 index 00000000..7024004f --- /dev/null +++ b/vendor/google/grpc-gcp/cloudprober/grpc_gpc_prober/firestore_probes.php @@ -0,0 +1,33 @@ +setParent($_PARENT_RESOURCE); + $time_start = microtime_float(); + + $client->ListDocuments($list_document_request); + + $lantency = (microtime_float()- $time_start) * 1000; + $metrics['list_documents_latency_ms'] = $lantency; + +} + +$probFunctions = [ + 'documents' => 'document' +]; + +return $probFunctions; \ No newline at end of file diff --git a/vendor/google/grpc-gcp/cloudprober/grpc_gpc_prober/prober.php b/vendor/google/grpc-gcp/cloudprober/grpc_gpc_prober/prober.php new file mode 100644 index 00000000..f7085a17 --- /dev/null +++ b/vendor/google/grpc-gcp/cloudprober/grpc_gpc_prober/prober.php @@ -0,0 +1,102 @@ +AuthMetadataPlugin($credentials, $request); + $ssl_credentials = Grpc\ChannelCredentials::createSsl(); + $composit_credentials = $grpc->composite_channel_credentials($ssl_credentials, $google_auth_credentials); + return $grpc_gcp->secure_channel($target, $composit_credentials, $kwargs); +} + +function getStubChannel($target){ + $res = $auth->default([$_OAUTH_SCOPE]); + $cred = $res[0]; + return secureAuthorizedChannel($cred, Request(), $target); +}*/ + +function executeProbes($api){ + global $_OAUTH_SCOPE; + global $_SPANNER_TARGET; + global $_FIRESTORE_TARGET; + + global $spanner_probes; + global $firestore_probes; + + $util = new StackdriverUtil($api); + $auth = Google\Auth\ApplicationDefaultCredentials::getCredentials($_OAUTH_SCOPE); + $opts = [ + 'credentials' => Grpc\ChannelCredentials::createSsl(), + 'update_metadata' => $auth->getUpdateMetadataFunc(), + ]; + + if($api == 'spanner'){ + $client = new SpannerGrpcClient($_SPANNER_TARGET, $opts); + $probe_functions = $spanner_probes; + } + else if($api == 'firestore'){ + $client = new FirestoreGrpcClient($_FIRESTORE_TARGET, $opts); + $probe_functions = $firestore_probes; + } + else{ + echo 'grpc not implemented for '.$api; + exit(1); + } + + $total = sizeof($probe_functions); + $success = 0; + $metrics = []; + + # Execute all probes for given api + foreach ($probe_functions as $probe_name => $probe_function) { + try{ + $probe_function($client, $metrics); + $success++; + } + catch(Exception $e){ + $util->reportError($e); + } + + } + + if($success == $total){ + $util->setSuccess(True); + } + + $util->addMetrics($metrics); + $util->outputMetrics(); + + if($success != $total){ + # TODO: exit system + exit(1); + } + +} + +function main(){ + $args = getArgs(); + executeProbes($args['api']); +} + +main(); diff --git a/vendor/google/grpc-gcp/cloudprober/grpc_gpc_prober/spanner_probes.php b/vendor/google/grpc-gcp/cloudprober/grpc_gpc_prober/spanner_probes.php new file mode 100644 index 00000000..cf94450b --- /dev/null +++ b/vendor/google/grpc-gcp/cloudprober/grpc_gpc_prober/spanner_probes.php @@ -0,0 +1,307 @@ +code !== Grpc\STATUS_OK) { + echo "Call did not complete successfully. Status object:\n"; + var_dump($status); + exit(1); + } +} + +function microtime_float() +{ + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} + +/* +Probes to test session related grpc call from Spanner stub. + + Includes tests against CreateSession, GetSession, ListSessions, and + DeleteSession of Spanner stub. + + Args: + stub: An object of SpannerStub. + metrics: A list of metrics. + +*/ + +function sessionManagement($client, &$metrics){ + global $_DATABASE; + + $createSessionRequest = new Google\Cloud\Spanner\V1\CreateSessionRequest(); + $createSessionRequest->setDatabase($_DATABASE); + #Create Session test + #Create + $time_start = microtime_float(); + list($session, $status) = $client->CreateSession($createSessionRequest)->wait(); + + hardAssertIfStatusOk($status); + hardAssert($session !== null, 'Call completed with a null response'); + + $lantency = (microtime_float()- $time_start) * 1000; + $metrics['create_session_latency_ms'] = $lantency; + + #Get Session + $getSessionRequest = new Google\Cloud\Spanner\V1\GetSessionRequest(); + $getSessionRequest->setName($session->getName()); + $time_start = microtime_float(); + $response = $client->GetSession($getSessionRequest); + $response->wait(); + $lantency = (microtime_float() - $time_start) * 1000; + $metrics['get_session_latency_ms'] = $lantency; + + #List session + $listSessionsRequest = new Google\Cloud\Spanner\V1\ListSessionsRequest(); + $listSessionsRequest->setDatabase($_DATABASE); + $time_start = microtime_float(); + $response = $client->ListSessions($listSessionsRequest); + $lantency = (microtime_float() - $time_start) * 1000; + $metrics['list_sessions_latency_ms'] = $lantency; + + #Delete session + $deleteSessionRequest = new Google\Cloud\Spanner\V1\DeleteSessionRequest(); + $deleteSessionRequest->setName($session->getName()); + $time_start = microtime_float(); + $client->deleteSession($deleteSessionRequest); + $lantency = (microtime_float() - $time_start) * 1000; + $metrics['delete_session_latency_ms'] = $lantency; + +} + +/* +Probes to test ExecuteSql and ExecuteStreamingSql call from Spanner stub. + + Args: + stub: An object of SpannerStub. + metrics: A list of metrics. + +*/ +function executeSql($client, &$metrics){ + global $_DATABASE; + + $createSessionRequest = new Google\Cloud\Spanner\V1\CreateSessionRequest(); + $createSessionRequest->setDatabase($_DATABASE); + list($session, $status) = $client->CreateSession($createSessionRequest)->wait(); + + hardAssertIfStatusOk($status); + hardAssert($session !== null, 'Call completed with a null response'); + + # Probing ExecuteSql call + $time_start = microtime_float(); + $executeSqlRequest = new Google\Cloud\Spanner\V1\ExecuteSqlRequest(); + $executeSqlRequest->setSession($session->getName()); + $executeSqlRequest->setSql('select * FROM users'); + $result_set = $client->ExecuteSql($executeSqlRequest); + $lantency = (microtime_float() - $time_start) * 1000; + $metrics['execute_sql_latency_ms'] = $lantency; + + // TODO: Error check result_set + + # Probing ExecuteStreamingSql call + $partial_result_set = $client->ExecuteStreamingSql($executeSqlRequest); + + $time_start = microtime_float(); + $first_result = array_values($partial_result_set->getMetadata())[0]; + $lantency = (microtime_float() - $time_start) * 1000; + $metrics['execute_streaming_sql_latency_ms'] = $lantency; + + // TODO: Error Check for sreaming sql first result + + $deleteSessionRequest = new Google\Cloud\Spanner\V1\DeleteSessionRequest(); + $deleteSessionRequest->setName($session->getName()); + $client->deleteSession($deleteSessionRequest); +} + +/* +Probe to test Read and StreamingRead grpc call from Spanner stub. + + Args: + stub: An object of SpannerStub. + metrics: A list of metrics. +*/ + +function read($client, &$metrics){ + global $_DATABASE; + + $createSessionRequest = new Google\Cloud\Spanner\V1\CreateSessionRequest(); + $createSessionRequest->setDatabase($_DATABASE); + list($session, $status) = $client->CreateSession($createSessionRequest)->wait(); + + hardAssertIfStatusOk($status); + hardAssert($session !== null, 'Call completed with a null response'); + + # Probing Read call + $time_start = microtime_float(); + $readRequest = new Google\Cloud\Spanner\V1\ReadRequest(); + $readRequest->setSession($session->getName()); + $readRequest->setTable('users'); + $readRequest->setColumns(['username', 'firstname', 'lastname']); + $keyset = new Google\Cloud\Spanner\V1\KeySet(); + $keyset->setAll(True); + $readRequest->setKeySet($keyset); + $result_set = $client->Read($readRequest); + $lantency = (microtime_float() - $time_start) * 1000; + $metrics['read_latency_ms'] = $lantency; + + // TODO: Error Check for result_set + + # Probing StreamingRead call + $partial_result_set = $client->StreamingRead($readRequest); + $time_start = microtime_float(); + $first_result = array_values($partial_result_set->getMetadata())[0]; + $lantency = (microtime_float() - $time_start) * 1000; + $metrics['streaming_read_latency_ms'] = $lantency; + + //TODO: Error Check for streaming read first result + + $deleteSessionRequest = new Google\Cloud\Spanner\V1\DeleteSessionRequest(); + $deleteSessionRequest->setName($session->getName()); + $client->deleteSession($deleteSessionRequest); +} + +/* +Probe to test BeginTransaction, Commit and Rollback grpc from Spanner stub. + + Args: + stub: An object of SpannerStub. + metrics: A list of metrics. +*/ + +function transaction($client, &$metrics){ + global $_DATABASE; + + $createSessionRequest = new Google\Cloud\Spanner\V1\CreateSessionRequest(); + $createSessionRequest->setDatabase($_DATABASE); + list($session, $status) = $client->CreateSession($createSessionRequest)->wait(); + + hardAssertIfStatusOk($status); + hardAssert($session !== null, 'Call completed with a null response'); + + $txn_options = new Google\Cloud\Spanner\V1\TransactionOptions(); + $rw = new Google\Cloud\Spanner\V1\TransactionOptions\ReadWrite(); + $txn_options->setReadWrite($rw); + $txn_request = new Google\Cloud\Spanner\V1\BeginTransactionRequest(); + $txn_request->setSession($session->getName()); + $txn_request->setOptions($txn_options); + + # Probing BeginTransaction call + $time_start = microtime_float(); + list($txn, $status) = $client->BeginTransaction($txn_request)->wait(); + $lantency = (microtime_float() - $time_start) * 1000; + $metrics['begin_transaction_latency_ms'] = $lantency; + + hardAssertIfStatusOk($status); + hardAssert($txn !== null, 'Call completed with a null response'); + + # Probing Commit Call + $commit_request = new Google\Cloud\Spanner\V1\CommitRequest(); + $commit_request->setSession($session->getName()); + $commit_request->setTransactionId($txn->getId()); + + $time_start = microtime_float(); + $client->Commit($commit_request); + $latency = (microtime_float() - $time_start) * 1000; + $metrics['commit_latency_ms'] = $lantency; + + # Probing Rollback call + list($txn, $status) = $client->BeginTransaction($txn_request)->wait(); + $rollback_request = new Google\Cloud\Spanner\V1\RollbackRequest(); + $rollback_request->setSession($session->getName()); + $rollback_request->setTransactionId($txn->getId()); + + hardAssertIfStatusOk($status); + hardAssert($txn !== null, 'Call completed with a null response'); + + $time_start = microtime_float(); + $client->Rollback($rollback_request); + $latency = (microtime_float() - $time_start) * 1000; + $metrics['rollback_latency_ms'] = $latency; + + $deleteSessionRequest = new Google\Cloud\Spanner\V1\DeleteSessionRequest(); + $deleteSessionRequest->setName($session->getName()); + $client->deleteSession($deleteSessionRequest); +} + +/* +Probe to test PartitionQuery and PartitionRead grpc call from Spanner stub. + + Args: + stub: An object of SpannerStub. + metrics: A list of metrics. +*/ + +function partition($client, &$metrics){ + global $_DATABASE; + global $_TEST_USERNAME; + + $createSessionRequest = new Google\Cloud\Spanner\V1\CreateSessionRequest(); + $createSessionRequest->setDatabase($_DATABASE); + list($session, $status) = $client->CreateSession($createSessionRequest)->wait(); + + hardAssertIfStatusOk($status); + hardAssert($session !== null, 'Call completed with a null response'); + + $txn_options = new Google\Cloud\Spanner\V1\TransactionOptions(); + $ro = new Google\Cloud\Spanner\V1\TransactionOptions\ReadOnly(); + $txn_options->setReadOnly($ro); + $txn_selector = new Google\Cloud\Spanner\V1\TransactionSelector(); + $txn_selector->setBegin($txn_options); + + #Probing PartitionQuery call + $ptn_query_request = new Google\Cloud\Spanner\V1\PartitionQueryRequest(); + $ptn_query_request->setSession($session->getName()); + $ptn_query_request->setSql('select * FROM users'); + $ptn_query_request->setTransaction($txn_selector); + + $time_start = microtime_float(); + $client->PartitionQuery($ptn_query_request); + $lantency = (microtime_float() - $time_start) * 1000; + $metrics['partition_query_latency_ms'] = $lantency; + + #Probing PartitionRead call + $ptn_read_request = new Google\Cloud\Spanner\V1\PartitionReadRequest(); + $ptn_read_request->setSession($session->getName()); + $ptn_read_request->setTable('users'); + $ptn_read_request->setTransaction($txn_selector); + $keyset = new Google\Cloud\Spanner\V1\KeySet(); + $keyset->setAll(True); + $ptn_read_request->setKeySet($keyset); + $ptn_read_request->setColumns(['username', 'firstname', 'lastname']); + + $time_start = microtime_float(); + $client->PartitionRead($ptn_read_request); + $latency = (microtime_float() - $time_start) * 1000; + $metrics['partition_read_latency_ms'] = $latency; + + # Delete Session + $deleteSessionRequest = new Google\Cloud\Spanner\V1\DeleteSessionRequest(); + $deleteSessionRequest->setName($session->getName()); + $client->deleteSession($deleteSessionRequest); +} + +$PROBE_FUNCTIONS = [ + 'session_management' => 'sessionManagement', + 'execute_sql' => 'executeSql', + 'read' => 'read', + 'transaction' => 'transaction', + 'partition' => 'partition' +]; + +return $PROBE_FUNCTIONS; + + + diff --git a/vendor/google/grpc-gcp/cloudprober/grpc_gpc_prober/stackdriver_util.php b/vendor/google/grpc-gcp/cloudprober/grpc_gpc_prober/stackdriver_util.php new file mode 100644 index 00000000..07a9e725 --- /dev/null +++ b/vendor/google/grpc-gcp/cloudprober/grpc_gpc_prober/stackdriver_util.php @@ -0,0 +1,59 @@ +api = $api; + $this->metrics = []; + $this->success = FALSE; + $this->err_client = new ReportErrorsServiceClient(); + } + + function addMetric($key, $value){ + $this->matrics[$key] = $value; + } + + function addMetrics($metrics){ + $this->metrics = array_merge($metrics, $this->metrics); + } + + function setSuccess($result){ + $this->success = $result; + } + + function outputMetrics(){ + if ($this->success){ + echo $this->api.'_success 1'."\n"; + } + else{ + echo $this->api.'_success 0'."\n"; + } + foreach ($this->metrics as $key => $value) { + echo $key.' '.$value."\n"; + } + } + + function reportError($err){ + error_log($err); + $projectId = '434076015357'; + $project_name = $this->err_client->projectName($projectId); + + $location = (new SourceLocation()) + ->setFunctionName($this->api); + $context = (new ErrorContext()) + ->setReportLocation($location); + + $error_event = new ReportedErrorEvent(); + $error_event->setMessage('PHPProbeFailure: fails on '.$this->api.' API. Details: '.(string)$err."\n"); + $error_event->setContext($context); + + $this->err_client->reportErrorEvent($project_name, $error_event); + } + +} \ No newline at end of file diff --git a/vendor/google/grpc-gcp/composer.json b/vendor/google/grpc-gcp/composer.json new file mode 100644 index 00000000..d26dc20d --- /dev/null +++ b/vendor/google/grpc-gcp/composer.json @@ -0,0 +1,24 @@ +{ + "name": "google/grpc-gcp", + "description": "gRPC GCP library for channel management", + "license": "Apache-2.0", + "require": { + "php": ">=5.5.0", + "google/protobuf": "^v3.3.0", + "grpc/grpc": "^v1.13.0", + "google/auth": "^1.3", + "psr/cache": "^1.0.1||^2.0.0||^3.0.0" + }, + "require-dev": { + "phpunit/phpunit": "4.8.36", + "google/cloud-spanner": "^1.7" + }, + "autoload": { + "psr-4": { + "Grpc\\Gcp\\": "src/" + }, + "classmap": [ + "src/generated/" + ] + } +} diff --git a/vendor/google/grpc-gcp/doc/gRPC-client-user-guide.md b/vendor/google/grpc-gcp/doc/gRPC-client-user-guide.md new file mode 100644 index 00000000..a9848c87 --- /dev/null +++ b/vendor/google/grpc-gcp/doc/gRPC-client-user-guide.md @@ -0,0 +1,217 @@ +# Instructions for create a gRPC client for google cloud services + +## Overview + +This instruction includes a step by step guide for creating a gRPC +client to test the google cloud service from an empty linux +VM, using GCE ubuntu 16.04 TLS instance. + +The main steps are followed as steps below: + +- Environment prerequisite +- Install protobuf plugin and gRPC-PHP/protobuf extension +- Generate client API from .proto files +- Create the client and send/receive RPC. + +## Environment Prerequisite + +**Linux** +```sh +$ [sudo] apt-get install build-essential autoconf libtool pkg-config zip unzip zlib1g-dev +``` +**PHP** +* `php` 5.5 or above, 7.0 or above +* `pecl` +* `composer` +```sh +$ [sudo] apt-get install php php-dev +$ curl -sS https://getcomposer.org/installer | php +$ [sudo] mv composer.phar /usr/local/bin/composer +``` + +## Install protobuf plugin and gRPC-PHP/protobuf extension +`grpc_php_plugin` is used to generate client API from `*.proto `files. Currently, +The only way to install `grpc_php_plugin` is to build from the gRPC source. + +**Install protobuf, gRPC, which will install the plugin** +```sh +$ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc +$ cd grpc +$ git submodule update --init +# install protobuf +$ cd third_party/protobuf +$ ./autogen.sh && ./configure && make -j8 +$ [sudo] make install +$ [sudo] ldconfig +# install gRPC +$ cd ../.. +$ make -j8 +$ [sudo] make install +``` +It will generate `grpc_php_plugin` under `/usr/local/bin`. + + +**Install gRPC-PHP extension** +```sh +$ [sudo] pecl install protobuf +$ [sudo] pecl install grpc +``` +It will generate `protobuf.so` and `grpc.so` under PHP's extension directory. +Note gRPC-PHP extension installed by pecl doesn't work on RHEL6 system. + +## Generate client API from .proto files +The common way to generate the client API is to use `grpc_php_plugin` directly. +Since the plugin won't find the dependency by itself. It works if all your +service proto files and dependent proto files are inside one directory. The +command looks like: +```sh +$ mkdir $HOME/project +$ protoc --proto_path=./ --php_out=$HOME/project \ +--grpc_out=$HOME/project \ +--plugin=protoc-gen-grpc=./bins/opt/grpc_php_plugin \ +path/to/your/proto_dependency_directory1/*.proto \ +path/to/your/proto_dependency_directory2/*.proto \ +path/to/your/proto_directory/*.proto + +``` + +Take `Firestore` service under [googleapis github repo](https://github.com/googleapis/googleapis) +for example. The proto files required for generating client API are +``` +google/api/annotations.proto +google/api/http.proto +google/api/httpbody.proto +google/longrunning/operations.proto +google/rpc/code.proto +google/rpc/error_details.proto +google/rpc/status.proto +google/type/latlng.proto +google/firestore/v1beta1/firestore.proto +google/firestore/v1beta1/common.proto +google/firestore/v1beta1/query.proto +google/firestore/v1beta1/write.proto +google/firestore/v1beta1/document.proto +``` +Thus the command looks like: +```sh +$ protoc --proto_path=googleapis --plugin=protoc-gen-grpc=`which grpc_php_plugin` \ +--php_out=./ --grpc_out=./ google/api/annotations.proto google/api/http.proto \ +google/api/httpbody.proto google/longrunning/operations.proto google/rpc/code.proto \ +google/rpc/error_details.proto google/rpc/status.proto google/type/latlng.proto \ +google/firestore/v1beta1/firestore.proto google/firestore/v1beta1/common.proto \ +google/firestore/v1beta1/query.proto google/firestore/v1beta1/write.proto \ +google/firestore/v1beta1/document.proto +``` + +Since most of cloud services already publish proto files under +[googleapis github repo](https://github.com/googleapis/googleapis), +you can use it's Makefile to generate the client API. +The `Makefile` will help you generate the client API as +well as find the dependencies. The command will simply be: +```sh +$ cd $HOME +$ mkdir project +$ git clone https://github.com/googleapis/googleapis.git +$ cd googleapis +$ make LANGUAGE=php OUTPUT=$HOME/project +# (It's okay if you see error like Please add 'syntax = "proto3";' +# to the top of your .proto file.) +``` +The client API library is generated under `$HOME/project`. +Take [`Firestore`](https://github.com/googleapis/googleapis/blob/master/google/firestore/v1beta1/firestore.proto) +as example, the Client API is under +`project/Google/Cloud/Firestore/V1beta1/FirestoreClient.php` depends on your +package name inside .proto file. An easy way to find your client is +```sh +$ find ./ -name [service_name]Client.php +``` + +## Create the client and send/receive RPC. +Now it's time to use the client API to send and receive RPCs. +```sh +$ cd $HOME/project +``` +**Install gRPC-PHP composer library** +```sh +$ vim composer.json +######## you need to change the path and service namespace. +{ + "require": { + "google/cloud": "^0.52.1" + }, + "autoload": { + "psr-4": { + "FireStore\\": "src/", + "Google\\Cloud\\Firestore\\V1beta1\\": "Google/Cloud/Firestore/V1beta1/" + } + } +} +######## +$ composer install +``` +**Set credentials file** +``` sh +$ vim $HOME/key.json +## Paste you credential file downloaded from your cloud project +## which you can find in APIs&Services => credentials => create credentials +## => Service account key => your credentials +$ export GOOGLE_APPLICATION_CREDENTIALS=$HOME/key.json +``` + +**Implement Service Client** +Take a unary-unary RPC `listDocument` from `FirestoreClient` as example. +Create a file name `ListDocumentClient.php`. +- import library +``` +require_once __DIR__ . '/vendor/autoload.php'; +use Google\Cloud\Firestore\V1beta1\FirestoreClient; +use Google\Cloud\Firestore\V1beta1\ListDocumentsRequest; +use Google\Auth\ApplicationDefaultCredentials; +``` +- Google Auth +``` +$host = "firestore.googleapis.com"; +$credentials = \Grpc\ChannelCredentials::createSsl(); +// WARNING: the environment variable "GOOGLE_APPLICATION_CREDENTIALS" needs to be set +$auth = ApplicationDefaultCredentials::getCredentials(); +$opts = [ + 'credentials' => $credentials, + 'update_metadata' => $auth->getUpdateMetadataFunc(), +] +``` +- Create Client +``` +$firestoreClient = new FirestoreClient($host, $opts); +``` +- Make and receive RPC call +``` +$argument = new ListDocumentsRequest(); +$project_id = xxxxxxx; +$argument->setParent("projects/$project_id/databases/(default)/documents"); +list($Response, $error) = $firestoreClient->ListDocuments($argument)->wait(); +``` +- print RPC response +``` +$documents = $Response->getDocuments(); +$index = 0; +foreach($documents as $document) { + $index++; + $name = $document->getName(); + echo "=> Document $index: $name\n"; + $fields = $document->getFields(); + foreach ($fields as $name => $value) { + echo "$name => ".$value->getStringValue()."\n"; + } +} +``` + +- run the script +```sh +$ php -d extension=grpc.so -d extension=protobuf.so ListDocumentClient.php +``` + +For different kinds of RPC(unary-unary, unary-stream, stream-unary, stream-stream), +please check [grpc.io PHP part](https://grpc.io/docs/tutorials/basic/php.html#calling-service-methods) +for reference. + + diff --git a/vendor/google/grpc-gcp/src/ChannelRef.php b/vendor/google/grpc-gcp/src/ChannelRef.php new file mode 100644 index 00000000..bc25836e --- /dev/null +++ b/vendor/google/grpc-gcp/src/ChannelRef.php @@ -0,0 +1,98 @@ +target = $target; + $this->channel_id = $channel_id; + $this->affinity_ref = $affinity_ref; + $this->active_stream_ref = $active_stream_ref; + $this->opts = $opts; + $this->has_deserialized = new CreatedByDeserializeCheck(); + } + + public function getRealChannel($credentials) + { + // TODO(ddyihai): remove this check once the serialize handler for + // \Grpc\Channel is implemented(issue https://github.com/grpc/grpc/issues/15870). + if (!$this->has_deserialized->getData()) { + // $real_channel exists and is not created by the deserialization. + return $this->real_channel; + } + // If this ChannelRef is created by deserialization, $real_channel is invalid + // thus needs to be recreated becasue Grpc\Channel don't have serialize and + // deserialize handler. + // Since [target + augments + credentials] will be the same during the recreation, + // it will reuse the underline grpc channel in C extension without creating a + // new connection. + + // 'credentials' in the array $opts will be unset during creating the channel. + if (!array_key_exists('credentials', $this->opts)) { + $this->opts['credentials'] = $credentials; + } + $real_channel = new \Grpc\Channel($this->target, $this->opts); + $this->real_channel = $real_channel; + // Set deserialization to false so it won't be recreated within the same script. + $this->has_deserialized->setData(0); + return $real_channel; + } + + public function getAffinityRef() + { + return $this->affinity_ref; + } + public function getActiveStreamRef() + { + return $this->active_stream_ref; + } + public function affinityRefIncr() + { + $this->affinity_ref += 1; + } + public function affinityRefDecr() + { + $this->affinity_ref -= 1; + } + public function activeStreamRefIncr() + { + $this->active_stream_ref += 1; + } + public function activeStreamRefDecr() + { + $this->active_stream_ref -= 1; + } +} diff --git a/vendor/google/grpc-gcp/src/Config.php b/vendor/google/grpc-gcp/src/Config.php new file mode 100644 index 00000000..dedc21b7 --- /dev/null +++ b/vendor/google/grpc-gcp/src/Config.php @@ -0,0 +1,113 @@ +gcp_call_invoker = new \Grpc\DefaultCallInvoker(); + return; + } + + $gcp_channel = null; + $url_host = parse_url($target, PHP_URL_HOST); + $this->hostname = $url_host ? $url_host : $target; + $channel_pool_key = $this->hostname . '.gcp.channel.' . getmypid(); + + if (!$cacheItemPool) { + $affinity_conf = $this->parseConfObject($conf); + $gcp_call_invoker = new GCPCallInvoker($affinity_conf); + $this->gcp_call_invoker = $gcp_call_invoker; + } else { + $item = $cacheItemPool->getItem($channel_pool_key); + if ($item->isHit()) { + // Channel pool for the $hostname API has already created. + $gcp_call_invoker = unserialize($item->get()); + } else { + $affinity_conf = $this->parseConfObject($conf); + // Create GCP channel based on the information. + $gcp_call_invoker = new GCPCallInvoker($affinity_conf); + } + $this->gcp_call_invoker = $gcp_call_invoker; + register_shutdown_function(function ($gcp_call_invoker, $cacheItemPool, $item) { + // Push the current gcp_channel back into the pool when the script finishes. + $item->set(serialize($gcp_call_invoker)); + $cacheItemPool->save($item); + }, $gcp_call_invoker, $cacheItemPool, $item); + } + } + + /** + * @return \Grpc\CallInvoker The call invoker to be hooked into the gRPC + */ + public function callInvoker() + { + return $this->gcp_call_invoker; + } + + /** + * @return string The URI of the endpoint + */ + public function getTarget() + { + return $this->channel->getTarget(); + } + + private function parseConfObject($conf_object) + { + $config = json_decode($conf_object->serializeToJsonString(), true); + if (isset($config['channelPool'])) { + $affinity_conf['channelPool'] = $config['channelPool']; + } + $aff_by_method = array(); + if (isset($config['method'])) { + for ($i = 0; $i < count($config['method']); $i++) { + // In proto3, if the value is default, eg 0 for int, it won't be serialized. + // Thus serialized string may not have `command` if the value is default 0(BOUND). + if (!array_key_exists('command', $config['method'][$i]['affinity'])) { + $config['method'][$i]['affinity']['command'] = 'BOUND'; + } + $aff_by_method[$config['method'][$i]['name'][0]] = $config['method'][$i]['affinity']; + } + } + $affinity_conf['affinity_by_method'] = $aff_by_method; + return $affinity_conf; + } + +} diff --git a/vendor/google/grpc-gcp/src/CreatedByDeserializeCheck.php b/vendor/google/grpc-gcp/src/CreatedByDeserializeCheck.php new file mode 100644 index 00000000..debf07db --- /dev/null +++ b/vendor/google/grpc-gcp/src/CreatedByDeserializeCheck.php @@ -0,0 +1,68 @@ +data = 1; + } + + /** + * @return string + */ + public function serialize() + { + return '0'; + } + + /** + * @param string $data + */ + public function unserialize($data) + { + $this->data = 1; + } + + /** + * @param $data + */ + public function setData($data) + { + $this->data = $data; + } + + /** + * @return int + */ + public function getData() + { + return $this->data; + } +} diff --git a/vendor/google/grpc-gcp/src/GCPBidiStreamingCall.php b/vendor/google/grpc-gcp/src/GCPBidiStreamingCall.php new file mode 100644 index 00000000..992843f4 --- /dev/null +++ b/vendor/google/grpc-gcp/src/GCPBidiStreamingCall.php @@ -0,0 +1,108 @@ +_rpcPreProcess($data); + $this->real_call = new \Grpc\BidiStreamingCall($channel_ref->getRealChannel( + $this->gcp_channel->credentials), $this->method, $this->deserialize, $this->options); + $this->real_call->start($this->metadata_rpc); + return $this->real_call; + } + + /** + * Pick a channel and start the call. + * + * @param array $metadata Metadata to send with the call, if applicable + * (optional) + */ + public function start(array $metadata = []) + { + $this->metadata_rpc = $metadata; + } + + /** + * Reads the next value from the server. + * + * @return mixed The next value from the server, or null if there is none + */ + public function read() + { + if (!$this->has_real_call) { + $this->createRealCall(); + $this->has_real_call = true; + } + $response = $this->real_call->read(); + if ($response) { + $this->response = $response; + } + return $response; + } + + /** + * Write a single message to the server. This cannot be called after + * writesDone is called. + * + * @param ByteBuffer $data The data to write + * @param array $options An array of options, possible keys: + * 'flags' => a number (optional) + */ + public function write($data, array $options = []) + { + if (!$this->has_real_call) { + $this->createRealCall($data); + $this->has_real_call = true; + } + $this->real_call->write($data, $options); + } + + /** + * Indicate that no more writes will be sent. + */ + public function writesDone() + { + if (!$this->has_real_call) { + $this->createRealCall(); + $this->has_real_call = true; + } + $this->real_call->writesDone(); + } + + /** + * Wait for the server to send the status, and return it. + * + * @return \stdClass The status object, with integer $code, string + * $details, and array $metadata members + */ + public function getStatus() + { + $status = $this->real_call->getStatus(); + $this->_rpcPostProcess($status, $this->response); + return $status; + } +} diff --git a/vendor/google/grpc-gcp/src/GCPCallInvoker.php b/vendor/google/grpc-gcp/src/GCPCallInvoker.php new file mode 100644 index 00000000..1e12fe59 --- /dev/null +++ b/vendor/google/grpc-gcp/src/GCPCallInvoker.php @@ -0,0 +1,86 @@ +affinity_conf = $affinity_conf; + } + + /** + * @param string $hostname + * @param array $opts + * @return GcpExtensionChannel + */ + public function createChannelFactory($hostname, $opts) + { + if ($this->channel) { + // $call_invoker object has already created from previews PHP-FPM scripts. + // Only need to udpate the $opts including the credentials. + $this->channel->updateOpts($opts); + } else { + $opts['affinity_conf'] = $this->affinity_conf; + $channel = new GcpExtensionChannel($hostname, $opts); + $this->channel = $channel; + } + return $this->channel; + } + + // _getChannel is used for testing only. + public function GetChannel() + { + return $this->channel; + } + + public function UnaryCall($channel, $method, $deserialize, $options) + { + return new GCPUnaryCall($channel, $method, $deserialize, $options); + } + public function ClientStreamingCall($channel, $method, $deserialize, $options) + { + return new GCPClientStreamCall($channel, $method, $deserialize, $options); + } + public function ServerStreamingCall($channel, $method, $deserialize, $options) + { + return new GCPServerStreamCall($channel, $method, $deserialize, $options); + } + public function BidiStreamingCall($channel, $method, $deserialize, $options) + { + return new GCPBidiStreamingCall($channel, $method, $deserialize, $options); + } +} diff --git a/vendor/google/grpc-gcp/src/GCPClientStreamCall.php b/vendor/google/grpc-gcp/src/GCPClientStreamCall.php new file mode 100644 index 00000000..c24a92b8 --- /dev/null +++ b/vendor/google/grpc-gcp/src/GCPClientStreamCall.php @@ -0,0 +1,76 @@ +_rpcPreProcess($data); + $this->real_call = new \Grpc\ClientStreamingCall($channel_ref->getRealChannel( + $this->gcp_channel->credentials), $this->method, $this->deserialize, $this->options); + $this->real_call->start($this->metadata_rpc); + return $this->real_call; + } + /** + * Pick a channel and start the call. + * + * @param array $metadata Metadata to send with the call, if applicable + * (optional) + */ + public function start(array $metadata = []) + { + // Postpone first rpc to write function(), where we can pick a channel + // from the channel pool. + $this->metadata_rpc = $metadata; + } + + /** + * Write a single message to the server. This cannot be called after + * wait is called. + * + * @param ByteBuffer $data The data to write + * @param array $options An array of options, possible keys: + * 'flags' => a number (optional) + */ + public function write($data, array $options = []) + { + if (!$this->has_real_call) { + $this->createRealCall($data); + $this->has_real_call = true; + } + $this->real_call->write($data, $options); + } + + /** + * Wait for the server to respond with data and a status. + * + * @return array [response data, status] + */ + public function wait() + { + list($response, $status) = $this->real_call->wait(); + $this->_rpcPostProcess($status, $response); + return [$response, $status]; + } +} diff --git a/vendor/google/grpc-gcp/src/GCPServerStreamCall.php b/vendor/google/grpc-gcp/src/GCPServerStreamCall.php new file mode 100644 index 00000000..283cd61c --- /dev/null +++ b/vendor/google/grpc-gcp/src/GCPServerStreamCall.php @@ -0,0 +1,89 @@ +real_call = new \Grpc\ServerStreamingCall($channel, $this->method, $this->deserialize, $this->options); + $this->has_real_call = true; + return $this->real_call; + } + + /** + * Pick a channel and start the call. + * + * @param mixed $data The data to send + * @param array $metadata Metadata to send with the call, if applicable + * (optional) + * @param array $options An array of options, possible keys: + * 'flags' => a number (optional) + */ + public function start($argument, $metadata, $options) + { + $channel_ref = $this->_rpcPreProcess($argument); + $this->createRealCall($channel_ref->getRealChannel( + $this->gcp_channel->credentials)); + $this->real_call->start($argument, $metadata, $options); + } + + /** + * @return mixed An iterator of response values + */ + public function responses() + { + $response = $this->real_call->responses(); + // Since the last response is empty for the server streaming RPC, + // the second last one is the last RPC response with payload. + // Use this one for searching the affinity key. + // The same as BidiStreaming. + if ($response) { + $this->response = $response; + } + return $response; + } + + /** + * Wait for the server to send the status, and return it. + * + * @return \stdClass The status object, with integer $code, string + * $details, and array $metadata members + */ + public function getStatus() + { + $status = $this->real_call->getStatus(); + $this->_rpcPostProcess($status, $this->response); + return $status; + } + + /** + * @return mixed The metadata sent by the server + */ + public function getMetadata() + { + return $this->real_call->getMetadata(); + } +} diff --git a/vendor/google/grpc-gcp/src/GCPUnaryCall.php b/vendor/google/grpc-gcp/src/GCPUnaryCall.php new file mode 100644 index 00000000..da4a2096 --- /dev/null +++ b/vendor/google/grpc-gcp/src/GCPUnaryCall.php @@ -0,0 +1,70 @@ +real_call = new \Grpc\UnaryCall($channel, $this->method, $this->deserialize, $this->options); + $this->has_real_call = true; + return $this->real_call; + } + + /** + * Pick a channel and start the call. + * + * @param mixed $data The data to send + * @param array $metadata Metadata to send with the call, if applicable + * (optional) + * @param array $options An array of options, possible keys: + * 'flags' => a number (optional) + */ + public function start($argument, $metadata, $options) + { + $channel_ref = $this->_rpcPreProcess($argument); + $real_channel = $channel_ref->getRealChannel($this->gcp_channel->credentials); + $this->createRealCall($real_channel); + $this->real_call->start($argument, $metadata, $options); + } + + /** + * Wait for the server to respond with data and a status. + * + * @return array [response data, status] + */ + public function wait() + { + list($response, $status) = $this->real_call->wait(); + $this->_rpcPostProcess($status, $response); + return [$response, $status]; + } + + /** + * @return mixed The metadata sent by the server + */ + public function getMetadata() + { + return $this->real_call->getMetadata(); + } +} diff --git a/vendor/google/grpc-gcp/src/GcpBaseCall.php b/vendor/google/grpc-gcp/src/GcpBaseCall.php new file mode 100644 index 00000000..56b42e0d --- /dev/null +++ b/vendor/google/grpc-gcp/src/GcpBaseCall.php @@ -0,0 +1,222 @@ +gcp_channel = $channel; + $this->method = $method; + $this->deserialize = $deserialize; + $this->options = $options; + $this->_affinity = null; + + if (isset($this->gcp_channel->affinity_conf['affinity_by_method'][$method])) { + $this->_affinity = $this->gcp_channel->affinity_conf['affinity_by_method'][$method]; + } + } + + /** + * Pick a ChannelRef from the channel pool based on the request and + * the affinity config. + * + * @param mixed $argument Requests. + * + * @return ChannelRef + */ + protected function _rpcPreProcess($argument) + { + $this->affinity_key = null; + if ($this->_affinity) { + $command = $this->_affinity['command']; + if ($command == self::BOUND || $command == self::UNBIND) { + $this->affinity_key = $this->getAffinityKeyFromProto($argument); + } + } + $this->channel_ref = $this->gcp_channel->getChannelRef($this->affinity_key); + $this->channel_ref->activeStreamRefIncr(); + return $this->channel_ref; + } + + /** + * Update ChannelRef when RPC finishes. + * + * @param \stdClass $status The status object, with integer $code, string + * $details, and array $metadata members + * @param mixed $response Response. + */ + protected function _rpcPostProcess($status, $response) + { + if ($this->_affinity) { + $command = $this->_affinity['command']; + if ($command == self::BIND) { + if ($status->code != \Grpc\STATUS_OK) { + return; + } + $affinity_key = $this->getAffinityKeyFromProto($response); + $this->gcp_channel->bind($this->channel_ref, $affinity_key); + } elseif ($command == self::UNBIND) { + $this->gcp_channel->unbind($this->affinity_key); + } + } + $this->channel_ref->activeStreamRefDecr(); + } + + /** + * Get the affinity key based on the affinity config. + * + * @param mixed $proto Objects may contain the affinity key. + * + * @return string Affinity key. + */ + protected function getAffinityKeyFromProto($proto) + { + if ($this->_affinity) { + $names = $this->_affinity['affinityKey']; + $names_arr = explode(".", $names); + foreach ($names_arr as $name) { + $getAttrMethod = 'get' . ucfirst($name); + $proto = call_user_func_array(array($proto, $getAttrMethod), array()); + } + return $proto; + } + echo "Cannot find the field in the proto\n"; + } + + /** + * @return mixed The metadata sent by the server + */ + public function getMetadata() + { + if (!$this->has_real_call) { + $this->createRealCall(); + $this->has_real_call = true; + } + return $this->real_call->getMetadata(); + } + + /** + * @return mixed The trailing metadata sent by the server + */ + public function getTrailingMetadata() + { + if (!$this->has_real_call) { + $this->createRealCall(); + $this->has_real_call = true; + } + return $this->real_call->getTrailingMetadata(); + } + + /** + * @return string The URI of the endpoint + */ + public function getPeer() + { + if (!$this->has_real_call) { + $this->createRealCall(); + $this->has_real_call = true; + } + return $this->real_call->getPeer(); + } + + /** + * Cancels the call. + */ + public function cancel() + { + if (!$this->has_real_call) { + $this->has_real_call = true; + $this->createRealCall(); + } + $this->real_call->cancel(); + } + + /** + * Serialize a message to the protobuf binary format. + * + * @param mixed $data The Protobuf message + * + * @return string The protobuf binary format + */ + protected function _serializeMessage($data) + { + return $this->real_call->_serializeMessage($data); + } + + /** + * Deserialize a response value to an object. + * + * @param string $value The binary value to deserialize + * + * @return mixed The deserialized value + */ + protected function _deserializeResponse($value) + { + return $this->real_call->_deserializeResponse($value); + } + + /** + * Set the CallCredentials for the underlying Call. + * + * @param CallCredentials $call_credentials The CallCredentials object + */ + public function setCallCredentials($call_credentials) + { + $this->call->setCredentials($call_credentials); + } +} diff --git a/vendor/google/grpc-gcp/src/GcpExtensionChannel.php b/vendor/google/grpc-gcp/src/GcpExtensionChannel.php new file mode 100644 index 00000000..405ba9a6 --- /dev/null +++ b/vendor/google/grpc-gcp/src/GcpExtensionChannel.php @@ -0,0 +1,281 @@ +channel_refs; + } + + /** + * @param string $hostname + * @param array $opts Options to create a \Grpc\Channel and affinity config + */ + public function __construct($hostname = null, $opts = array()) + { + if ($hostname == null || !is_array($opts)) { + throw new \InvalidArgumentException("Expected hostname is empty"); + } + $this->max_size = 10; + $this->max_concurrent_streams_low_watermark = 100; + if (isset($opts['affinity_conf'])) { + if (isset($opts['affinity_conf']['channelPool'])) { + if (isset($opts['affinity_conf']['channelPool']['maxSize'])) { + $this->max_size = $opts['affinity_conf']['channelPool']['maxSize']; + } + if (isset($opts['affinity_conf']['channelPool']['maxConcurrentStreamsLowWatermark'])) { + $this->max_concurrent_streams_low_watermark = + $opts['affinity_conf']['channelPool']['maxConcurrentStreamsLowWatermark']; + } + } + $this->affinity_by_method = $opts['affinity_conf']['affinity_by_method']; + $this->affinity_conf = $opts['affinity_conf']; + } + $this->target = $hostname; + $this->affinity_key_to_channel_ref = array(); + $this->channel_refs = array(); + $this->updateOpts($opts); + // Initiate a Grpc\Channel at the beginning in order to keep the same + // behavior as the Grpc. + $channel_ref = $this->getChannelRef(); + $channel_ref->getRealChannel($this->credentials); + } + + /** + * @param array $opts Options to create a \Grpc\Channel + */ + public function updateOpts($opts) + { + if (isset($opts['credentials'])) { + $this->credentials = $opts['credentials']; + } + unset($opts['affinity_conf']); + unset($opts['credentials']); + $this->options = $opts; + $this->is_closed = false; + } + + /** + * Bind the ChannelRef with the affinity key. This is a private method. + * + * @param ChannelRef $channel_ref + * @param string $affinity_key + * + * @return ChannelRef + */ + public function bind($channel_ref, $affinity_key) + { + if (!array_key_exists($affinity_key, $this->affinity_key_to_channel_ref)) { + $this->affinity_key_to_channel_ref[$affinity_key] = $channel_ref; + } + $channel_ref->affinityRefIncr(); + return $channel_ref; + } + + /** + * Unbind the affinity key. This is a private method. + * + * @param string $affinity_key + * + * @return ChannelRef + */ + public function unbind($affinity_key) + { + $channel_ref = null; + if (array_key_exists($affinity_key, $this->affinity_key_to_channel_ref)) { + $channel_ref = $this->affinity_key_to_channel_ref[$affinity_key]; + $channel_ref->affinityRefDecr(); + } + unset($this->affinity_key_to_channel_ref[$affinity_key]); + return $channel_ref; + } + + + public function cmp_by_active_stream_ref($a, $b) + { + return $a->getActiveStreamRef() - $b->getActiveStreamRef(); + } + + /** + * Pick or create a ChannelRef from the pool by affinity key. + * + * @param string $affinity_key + * + * @return ChannelRef + */ + public function getChannelRef($affinity_key = null) + { + if ($affinity_key) { + if (array_key_exists($affinity_key, $this->affinity_key_to_channel_ref)) { + return $this->affinity_key_to_channel_ref[$affinity_key]; + } + return $this->getChannelRef(); + } + usort($this->channel_refs, array($this, 'cmp_by_active_stream_ref')); + + if (count($this->channel_refs) > 0 && $this->channel_refs[0]->getActiveStreamRef() < + $this->max_concurrent_streams_low_watermark) { + return $this->channel_refs[0]; + } + $num_channel_refs = count($this->channel_refs); + if ($num_channel_refs < $this->max_size) { + // grpc_target_persist_bound stands for how many channels can be persisted for + // the same target in the C extension. It is possible that the user use the pure + // gRPC and this GCP extension at the same time, which share the same target. In this case + // pure gRPC channel may occupy positions in C extension, which deletes some channels created + // by this GCP extension. + // If that happens, it won't cause the script failure because we saves all arguments for creating + // a channel instead of a channel itself. If we watch to fetch a GCP channel already deleted, + // it will create a new channel. The only cons is the latency of the first RPC will high because + // it will establish the connection again. + if (!isset($this->options['grpc_target_persist_bound']) || + $this->options['grpc_target_persist_bound'] < $this->max_size) { + $this->options['grpc_target_persist_bound'] = $this->max_size; + } + $cur_opts = array_merge($this->options, + ['grpc_gcp_channel_id' => $num_channel_refs]); + $channel_ref = new ChannelRef($this->target, $num_channel_refs, $cur_opts); + array_unshift($this->channel_refs, $channel_ref); + } + return $this->channel_refs[0]; + } + + /** + * Get the connectivity state of the channel + * + * @param bool $try_to_connect try to connect on the channel + * + * @return int The grpc connectivity state + * @throws \InvalidArgumentException + */ + public function getConnectivityState($try_to_connect = false) + { + // Since getRealChannel is creating a PHP Channel object. However in gRPC, when a Channel + // object is closed, we only mark this Object to be invalid. Thus, we need a global variable + // to mark whether this GCPExtensionChannel is close or not. + if ($this->is_closed) { + throw new \RuntimeException("Channel has already been closed"); + } + $ready = 0; + $idle = 0; + $connecting = 0; + $transient_failure = 0; + $shutdown = 0; + foreach ($this->channel_refs as $channel_ref) { + $state = $channel_ref->getRealChannel($this->credentials)->getConnectivityState($try_to_connect); + switch ($state) { + case \Grpc\CHANNEL_READY: + $ready += 1; + break 2; + case \Grpc\CHANNEL_FATAL_FAILURE: + $shutdown += 1; + break; + case \Grpc\CHANNEL_CONNECTING: + $connecting += 1; + break; + case \Grpc\CHANNEL_TRANSIENT_FAILURE: + $transient_failure += 1; + break; + case \Grpc\CHANNEL_IDLE: + $idle += 1; + break; + } + } + if ($ready > 0) { + return \Grpc\CHANNEL_READY; + } elseif ($idle > 0) { + return \Grpc\CHANNEL_IDLE; + } elseif ($connecting > 0) { + return \Grpc\CHANNEL_CONNECTING; + } elseif ($transient_failure > 0) { + return \Grpc\CHANNEL_TRANSIENT_FAILURE; + } elseif ($shutdown > 0) { + return \Grpc\CHANNEL_SHUTDOWN; + } + } + + /** + * Watch the connectivity state of the channel until it changed + * + * @param int $last_state The previous connectivity state of the channel + * @param Timeval $deadline_obj The deadline this function should wait until + * + * @return bool If the connectivity state changes from last_state + * before deadline + * @throws \InvalidArgumentException + */ + public function watchConnectivityState($last_state, $deadline_obj = null) + { + if ($deadline_obj == null || !is_a($deadline_obj, '\Grpc\Timeval')) { + throw new \InvalidArgumentException(""); + } + // Since getRealChannel is creating a PHP Channel object. However in gRPC, when a Channel + // object is closed, we only mark this Object to be invalid. Thus, we need a global variable + // to mark whether this GCPExtensionChannel is close or not. + if ($this->is_closed) { + throw new \RuntimeException("Channel has already been closed"); + } + $state = 0; + foreach ($this->channel_refs as $channel_ref) { + $state = $channel_ref->getRealChannel($this->credentials)->watchConnectivityState($last_state, $deadline_obj); + } + return $state; + } + + /** + * Get the endpoint this call/stream is connected to + * + * @return string The URI of the endpoint + */ + public function getTarget() + { + return $this->target; + } + + /** + * Close the channel + */ + public function close() + { + foreach ($this->channel_refs as $channel_ref) { + $channel_ref->getRealChannel($this->credentials)->close(); + } + $this->is_closed = true; + } +} diff --git a/vendor/google/grpc-gcp/src/generated/GPBMetadata/GrpcGcp.php b/vendor/google/grpc-gcp/src/generated/GPBMetadata/GrpcGcp.php new file mode 100644 index 00000000..4164ecb3 --- /dev/null +++ b/vendor/google/grpc-gcp/src/generated/GPBMetadata/GrpcGcp.php @@ -0,0 +1,39 @@ +internalAddGeneratedFile(hex2bin( + "0ac9030a0e677270635f6763702e70726f746f1208677270632e67637022" . + "670a09417069436f6e66696712310a0c6368616e6e656c5f706f6f6c1802" . + "2001280b321b2e677270632e6763702e4368616e6e656c506f6f6c436f6e" . + "66696712270a066d6574686f6418e9072003280b32162e677270632e6763" . + "702e4d6574686f64436f6e66696722690a114368616e6e656c506f6f6c43" . + "6f6e66696712100a086d61785f73697a6518012001280d12140a0c69646c" . + "655f74696d656f7574180220012804122c0a246d61785f636f6e63757272" . + "656e745f73747265616d735f6c6f775f77617465726d61726b1803200128" . + "0d22490a0c4d6574686f64436f6e666967120c0a046e616d651801200328" . + "09122b0a08616666696e69747918e9072001280b32182e677270632e6763" . + "702e416666696e697479436f6e6669672285010a0e416666696e69747943" . + "6f6e66696712310a07636f6d6d616e6418022001280e32202e677270632e" . + "6763702e416666696e697479436f6e6669672e436f6d6d616e6412140a0c" . + "616666696e6974795f6b6579180320012809222a0a07436f6d6d616e6412" . + "090a05424f554e44100012080a0442494e441001120a0a06554e42494e44" . + "1002620670726f746f33" + )); + + static::$is_initialized = true; + } +} diff --git a/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig.php b/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig.php new file mode 100644 index 00000000..bad448ea --- /dev/null +++ b/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig.php @@ -0,0 +1,87 @@ +grpc.gcp.AffinityConfig + */ +class AffinityConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The affinity command applies on the selected gRPC methods. + * + * Generated from protobuf field .grpc.gcp.AffinityConfig.Command command = 2; + */ + private $command = 0; + /** + * The field path of the affinity key in the request/response message. + * For example: "f.a", "f.b.d", etc. + * + * Generated from protobuf field string affinity_key = 3; + */ + private $affinity_key = ''; + + public function __construct() + { + \GPBMetadata\GrpcGcp::initOnce(); + parent::__construct(); + } + + /** + * The affinity command applies on the selected gRPC methods. + * + * Generated from protobuf field .grpc.gcp.AffinityConfig.Command command = 2; + * @return int + */ + public function getCommand() + { + return $this->command; + } + + /** + * The affinity command applies on the selected gRPC methods. + * + * Generated from protobuf field .grpc.gcp.AffinityConfig.Command command = 2; + * @param int $var + * @return $this + */ + public function setCommand($var) + { + GPBUtil::checkEnum($var, \Grpc\Gcp\AffinityConfig_Command::class); + $this->command = $var; + + return $this; + } + + /** + * The field path of the affinity key in the request/response message. + * For example: "f.a", "f.b.d", etc. + * + * Generated from protobuf field string affinity_key = 3; + * @return string + */ + public function getAffinityKey() + { + return $this->affinity_key; + } + + /** + * The field path of the affinity key in the request/response message. + * For example: "f.a", "f.b.d", etc. + * + * Generated from protobuf field string affinity_key = 3; + * @param string $var + * @return $this + */ + public function setAffinityKey($var) + { + GPBUtil::checkString($var, true); + $this->affinity_key = $var; + + return $this; + } +} diff --git a/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig_Command.php b/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig_Command.php new file mode 100644 index 00000000..2efcc725 --- /dev/null +++ b/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig_Command.php @@ -0,0 +1,38 @@ +Grpc\Gcp\AffinityConfig\Command + */ +class AffinityConfig_Command +{ + /** + * The annotated method will be required to be bound to an existing session + * to execute the RPC. The corresponding will be + * used to find the affinity key from the request message. + * + * Generated from protobuf enum BOUND = 0; + */ + const BOUND = 0; + /** + * The annotated method will establish the channel affinity with the channel + * which is used to execute the RPC. The corresponding + * will be used to find the affinity key from the + * response message. + * + * Generated from protobuf enum BIND = 1; + */ + const BIND = 1; + /** + * The annotated method will remove the channel affinity with the channel + * which is used to execute the RPC. The corresponding + * will be used to find the affinity key from the + * request message. + * + * Generated from protobuf enum UNBIND = 2; + */ + const UNBIND = 2; +} diff --git a/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/ApiConfig.php b/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/ApiConfig.php new file mode 100644 index 00000000..519e31a3 --- /dev/null +++ b/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/ApiConfig.php @@ -0,0 +1,84 @@ +grpc.gcp.ApiConfig + */ +class ApiConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The channel pool configurations. + * + * Generated from protobuf field .grpc.gcp.ChannelPoolConfig channel_pool = 2; + */ + private $channel_pool = null; + /** + * The method configurations. + * + * Generated from protobuf field repeated .grpc.gcp.MethodConfig method = 1001; + */ + private $method; + + public function __construct() + { + \GPBMetadata\GrpcGcp::initOnce(); + parent::__construct(); + } + + /** + * The channel pool configurations. + * + * Generated from protobuf field .grpc.gcp.ChannelPoolConfig channel_pool = 2; + * @return \Grpc\Gcp\ChannelPoolConfig + */ + public function getChannelPool() + { + return $this->channel_pool; + } + + /** + * The channel pool configurations. + * + * Generated from protobuf field .grpc.gcp.ChannelPoolConfig channel_pool = 2; + * @param \Grpc\Gcp\ChannelPoolConfig $var + * @return $this + */ + public function setChannelPool($var) + { + GPBUtil::checkMessage($var, \Grpc\Gcp\ChannelPoolConfig::class); + $this->channel_pool = $var; + + return $this; + } + + /** + * The method configurations. + * + * Generated from protobuf field repeated .grpc.gcp.MethodConfig method = 1001; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMethod() + { + return $this->method; + } + + /** + * The method configurations. + * + * Generated from protobuf field repeated .grpc.gcp.MethodConfig method = 1001; + * @param \Grpc\Gcp\MethodConfig[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMethod($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Gcp\MethodConfig::class); + $this->method = $arr; + + return $this; + } +} diff --git a/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/ChannelPoolConfig.php b/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/ChannelPoolConfig.php new file mode 100644 index 00000000..7c03076c --- /dev/null +++ b/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/ChannelPoolConfig.php @@ -0,0 +1,122 @@ +grpc.gcp.ChannelPoolConfig + */ +class ChannelPoolConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The max number of channels in the pool. + * + * Generated from protobuf field uint32 max_size = 1; + */ + private $max_size = 0; + /** + * The idle timeout (seconds) of channels without bound affinity sessions. + * + * Generated from protobuf field uint64 idle_timeout = 2; + */ + private $idle_timeout = 0; + /** + * The low watermark of max number of concurrent streams in a channel. + * New channel will be created once it get hit, until we reach the max size + * of the channel pool. + * + * Generated from protobuf field uint32 max_concurrent_streams_low_watermark = 3; + */ + private $max_concurrent_streams_low_watermark = 0; + + public function __construct() + { + \GPBMetadata\GrpcGcp::initOnce(); + parent::__construct(); + } + + /** + * The max number of channels in the pool. + * + * Generated from protobuf field uint32 max_size = 1; + * @return int + */ + public function getMaxSize() + { + return $this->max_size; + } + + /** + * The max number of channels in the pool. + * + * Generated from protobuf field uint32 max_size = 1; + * @param int $var + * @return $this + */ + public function setMaxSize($var) + { + GPBUtil::checkUint32($var); + $this->max_size = $var; + + return $this; + } + + /** + * The idle timeout (seconds) of channels without bound affinity sessions. + * + * Generated from protobuf field uint64 idle_timeout = 2; + * @return int|string + */ + public function getIdleTimeout() + { + return $this->idle_timeout; + } + + /** + * The idle timeout (seconds) of channels without bound affinity sessions. + * + * Generated from protobuf field uint64 idle_timeout = 2; + * @param int|string $var + * @return $this + */ + public function setIdleTimeout($var) + { + GPBUtil::checkUint64($var); + $this->idle_timeout = $var; + + return $this; + } + + /** + * The low watermark of max number of concurrent streams in a channel. + * New channel will be created once it get hit, until we reach the max size + * of the channel pool. + * + * Generated from protobuf field uint32 max_concurrent_streams_low_watermark = 3; + * @return int + */ + public function getMaxConcurrentStreamsLowWatermark() + { + return $this->max_concurrent_streams_low_watermark; + } + + /** + * The low watermark of max number of concurrent streams in a channel. + * New channel will be created once it get hit, until we reach the max size + * of the channel pool. + * + * Generated from protobuf field uint32 max_concurrent_streams_low_watermark = 3; + * @param int $var + * @return $this + */ + public function setMaxConcurrentStreamsLowWatermark($var) + { + GPBUtil::checkUint32($var); + $this->max_concurrent_streams_low_watermark = $var; + + return $this; + } +} diff --git a/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/MethodConfig.php b/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/MethodConfig.php new file mode 100644 index 00000000..b60daf5d --- /dev/null +++ b/vendor/google/grpc-gcp/src/generated/Grpc/Gcp/MethodConfig.php @@ -0,0 +1,90 @@ +grpc.gcp.MethodConfig + */ +class MethodConfig extends \Google\Protobuf\Internal\Message +{ + /** + * A fully qualified name of a gRPC method, or a wildcard pattern ending + * with .*, such as foo.bar.A, foo.bar.*. Method configs are evaluated + * sequentially, and the first one takes precedence. + * + * Generated from protobuf field repeated string name = 1; + */ + private $name; + /** + * The channel affinity configurations. + * + * Generated from protobuf field .grpc.gcp.AffinityConfig affinity = 1001; + */ + private $affinity = null; + + public function __construct() + { + \GPBMetadata\GrpcGcp::initOnce(); + parent::__construct(); + } + + /** + * A fully qualified name of a gRPC method, or a wildcard pattern ending + * with .*, such as foo.bar.A, foo.bar.*. Method configs are evaluated + * sequentially, and the first one takes precedence. + * + * Generated from protobuf field repeated string name = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getName() + { + return $this->name; + } + + /** + * A fully qualified name of a gRPC method, or a wildcard pattern ending + * with .*, such as foo.bar.A, foo.bar.*. Method configs are evaluated + * sequentially, and the first one takes precedence. + * + * Generated from protobuf field repeated string name = 1; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setName($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->name = $arr; + + return $this; + } + + /** + * The channel affinity configurations. + * + * Generated from protobuf field .grpc.gcp.AffinityConfig affinity = 1001; + * @return \Grpc\Gcp\AffinityConfig + */ + public function getAffinity() + { + return $this->affinity; + } + + /** + * The channel affinity configurations. + * + * Generated from protobuf field .grpc.gcp.AffinityConfig affinity = 1001; + * @param \Grpc\Gcp\AffinityConfig $var + * @return $this + */ + public function setAffinity($var) + { + GPBUtil::checkMessage($var, \Grpc\Gcp\AffinityConfig::class); + $this->affinity = $var; + + return $this; + } +} diff --git a/vendor/google/grpc-gcp/src/grpc_gcp.proto b/vendor/google/grpc-gcp/src/grpc_gcp.proto new file mode 100644 index 00000000..ff52db20 --- /dev/null +++ b/vendor/google/grpc-gcp/src/grpc_gcp.proto @@ -0,0 +1,70 @@ +// Copyright 2018 gRPC authors. +// +// 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. + +syntax = "proto3"; + +package grpc.gcp; + +message ApiConfig { + // The channel pool configurations. + ChannelPoolConfig channel_pool = 2; + + // The method configurations. + repeated MethodConfig method = 1001; +} + +message ChannelPoolConfig { + // The max number of channels in the pool. + uint32 max_size = 1; + // The idle timeout (seconds) of channels without bound affinity sessions. + uint64 idle_timeout = 2; + // The low watermark of max number of concurrent streams in a channel. + // New channel will be created once it get hit, until we reach the max size + // of the channel pool. + uint32 max_concurrent_streams_low_watermark = 3; +} + +message MethodConfig { + // A fully qualified name of a gRPC method, or a wildcard pattern ending + // with .*, such as foo.bar.A, foo.bar.*. Method configs are evaluated + // sequentially, and the first one takes precedence. + repeated string name = 1; + + // The channel affinity configurations. + AffinityConfig affinity = 1001; +} + +message AffinityConfig { + enum Command { + // The annotated method will be required to be bound to an existing session + // to execute the RPC. The corresponding will be + // used to find the affinity key from the request message. + BOUND = 0; + // The annotated method will establish the channel affinity with the channel + // which is used to execute the RPC. The corresponding + // will be used to find the affinity key from the + // response message. + BIND = 1; + // The annotated method will remove the channel affinity with the channel + // which is used to execute the RPC. The corresponding + // will be used to find the affinity key from the + // request message. + UNBIND = 2; + } + // The affinity command applies on the selected gRPC methods. + Command command = 2; + // The field path of the affinity key in the request/response message. + // For example: "f.a", "f.b.d", etc. + string affinity_key = 3; +} diff --git a/vendor/google/protobuf/LICENSE b/vendor/google/protobuf/LICENSE new file mode 100644 index 00000000..ba32af4c --- /dev/null +++ b/vendor/google/protobuf/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2019, Protocol Buffers +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 the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/google/protobuf/README.md b/vendor/google/protobuf/README.md new file mode 100644 index 00000000..3663050d --- /dev/null +++ b/vendor/google/protobuf/README.md @@ -0,0 +1,2 @@ +# protobuf-php +This repository contains only PHP files to support Composer installation. This repository is a mirror of [protobuf](https://github.com/protocolbuffers/protobuf). Any support requests, bug reports, or development contributions should be directed to that project. To install protobuf for PHP, please see https://github.com/protocolbuffers/protobuf/tree/master/php diff --git a/vendor/google/protobuf/composer.json b/vendor/google/protobuf/composer.json new file mode 100644 index 00000000..69a3297d --- /dev/null +++ b/vendor/google/protobuf/composer.json @@ -0,0 +1,23 @@ +{ + "name": "google/protobuf", + "type": "library", + "description": "proto library for PHP", + "keywords": ["proto"], + "homepage": "https://developers.google.com/protocol-buffers/", + "license": "BSD-3-Clause", + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8.0" + }, + "suggest": { + "ext-bcmath": "Need to support JSON deserialization" + }, + "autoload": { + "psr-4": { + "Google\\Protobuf\\": "src/Google/Protobuf", + "GPBMetadata\\Google\\Protobuf\\": "src/GPBMetadata/Google/Protobuf" + } + } +} diff --git a/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Any.php b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Any.php new file mode 100644 index 00000000..fbce4bfd --- /dev/null +++ b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Any.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile( + ' + +google/protobuf/any.protogoogle.protobuf"& +Any +type_url (  +value ( Bv +com.google.protobufBAnyProtoPZ,google.golang.org/protobuf/types/known/anypbGPBGoogle.Protobuf.WellKnownTypesbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Api.php b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Api.php new file mode 100644 index 00000000..75e0ec63 --- /dev/null +++ b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Api.php @@ -0,0 +1,48 @@ +internalAddGeneratedFile( + ' + +google/protobuf/api.protogoogle.protobufgoogle/protobuf/type.proto" +Api +name ( ( +methods ( 2.google.protobuf.Method( +options ( 2.google.protobuf.Option +version ( 6 +source_context ( 2.google.protobuf.SourceContext& +mixins ( 2.google.protobuf.Mixin\' +syntax (2.google.protobuf.Syntax" +Method +name (  +request_type_url (  +request_streaming ( +response_type_url (  +response_streaming (( +options ( 2.google.protobuf.Option\' +syntax (2.google.protobuf.Syntax"# +Mixin +name (  +root ( Bv +com.google.protobufBApiProtoPZ,google.golang.org/protobuf/types/known/apipbGPBGoogle.Protobuf.WellKnownTypesbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Duration.php b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Duration.php new file mode 100644 index 00000000..5d8023e4 --- /dev/null +++ b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Duration.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile( + ' + +google/protobuf/duration.protogoogle.protobuf"* +Duration +seconds ( +nanos (B +com.google.protobufB DurationProtoPZ1google.golang.org/protobuf/types/known/durationpbGPBGoogle.Protobuf.WellKnownTypesbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/FieldMask.php b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/FieldMask.php new file mode 100644 index 00000000..f31bcc00 --- /dev/null +++ b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/FieldMask.php @@ -0,0 +1,29 @@ +internalAddGeneratedFile( + ' + + google/protobuf/field_mask.protogoogle.protobuf" + FieldMask +paths ( B +com.google.protobufBFieldMaskProtoPZ2google.golang.org/protobuf/types/known/fieldmaskpbGPBGoogle.Protobuf.WellKnownTypesbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/GPBEmpty.php b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/GPBEmpty.php new file mode 100644 index 00000000..5e42536f --- /dev/null +++ b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/GPBEmpty.php @@ -0,0 +1,29 @@ +internalAddGeneratedFile( + ' + +google/protobuf/empty.protogoogle.protobuf" +EmptyB} +com.google.protobufB +EmptyProtoPZ.google.golang.org/protobuf/types/known/emptypbGPBGoogle.Protobuf.WellKnownTypesbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php new file mode 100644 index 00000000..ea0edc55 --- /dev/null +++ b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php @@ -0,0 +1,278 @@ +addMessage('google.protobuf.internal.FileDescriptorSet', \Google\Protobuf\Internal\FileDescriptorSet::class) + ->repeated('file', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.FileDescriptorProto') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.FileDescriptorProto', \Google\Protobuf\Internal\FileDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->optional('package', \Google\Protobuf\Internal\GPBType::STRING, 2) + ->repeated('dependency', \Google\Protobuf\Internal\GPBType::STRING, 3) + ->repeated('public_dependency', \Google\Protobuf\Internal\GPBType::INT32, 10) + ->repeated('weak_dependency', \Google\Protobuf\Internal\GPBType::INT32, 11) + ->repeated('message_type', \Google\Protobuf\Internal\GPBType::MESSAGE, 4, 'google.protobuf.internal.DescriptorProto') + ->repeated('enum_type', \Google\Protobuf\Internal\GPBType::MESSAGE, 5, 'google.protobuf.internal.EnumDescriptorProto') + ->repeated('service', \Google\Protobuf\Internal\GPBType::MESSAGE, 6, 'google.protobuf.internal.ServiceDescriptorProto') + ->repeated('extension', \Google\Protobuf\Internal\GPBType::MESSAGE, 7, 'google.protobuf.internal.FieldDescriptorProto') + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 8, 'google.protobuf.internal.FileOptions') + ->optional('source_code_info', \Google\Protobuf\Internal\GPBType::MESSAGE, 9, 'google.protobuf.internal.SourceCodeInfo') + ->optional('syntax', \Google\Protobuf\Internal\GPBType::STRING, 12) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.DescriptorProto', \Google\Protobuf\Internal\DescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->repeated('field', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.FieldDescriptorProto') + ->repeated('extension', \Google\Protobuf\Internal\GPBType::MESSAGE, 6, 'google.protobuf.internal.FieldDescriptorProto') + ->repeated('nested_type', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.DescriptorProto') + ->repeated('enum_type', \Google\Protobuf\Internal\GPBType::MESSAGE, 4, 'google.protobuf.internal.EnumDescriptorProto') + ->repeated('extension_range', \Google\Protobuf\Internal\GPBType::MESSAGE, 5, 'google.protobuf.internal.DescriptorProto.ExtensionRange') + ->repeated('oneof_decl', \Google\Protobuf\Internal\GPBType::MESSAGE, 8, 'google.protobuf.internal.OneofDescriptorProto') + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 7, 'google.protobuf.internal.MessageOptions') + ->repeated('reserved_range', \Google\Protobuf\Internal\GPBType::MESSAGE, 9, 'google.protobuf.internal.DescriptorProto.ReservedRange') + ->repeated('reserved_name', \Google\Protobuf\Internal\GPBType::STRING, 10) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.DescriptorProto.ExtensionRange', \Google\Protobuf\Internal\DescriptorProto\ExtensionRange::class) + ->optional('start', \Google\Protobuf\Internal\GPBType::INT32, 1) + ->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2) + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.ExtensionRangeOptions') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.DescriptorProto.ReservedRange', \Google\Protobuf\Internal\DescriptorProto\ReservedRange::class) + ->optional('start', \Google\Protobuf\Internal\GPBType::INT32, 1) + ->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.ExtensionRangeOptions', \Google\Protobuf\Internal\ExtensionRangeOptions::class) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.FieldDescriptorProto', \Google\Protobuf\Internal\FieldDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->optional('number', \Google\Protobuf\Internal\GPBType::INT32, 3) + ->optional('label', \Google\Protobuf\Internal\GPBType::ENUM, 4, 'google.protobuf.internal.FieldDescriptorProto.Label') + ->optional('type', \Google\Protobuf\Internal\GPBType::ENUM, 5, 'google.protobuf.internal.FieldDescriptorProto.Type') + ->optional('type_name', \Google\Protobuf\Internal\GPBType::STRING, 6) + ->optional('extendee', \Google\Protobuf\Internal\GPBType::STRING, 2) + ->optional('default_value', \Google\Protobuf\Internal\GPBType::STRING, 7) + ->optional('oneof_index', \Google\Protobuf\Internal\GPBType::INT32, 9) + ->optional('json_name', \Google\Protobuf\Internal\GPBType::STRING, 10) + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 8, 'google.protobuf.internal.FieldOptions') + ->optional('proto3_optional', \Google\Protobuf\Internal\GPBType::BOOL, 17) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FieldDescriptorProto.Type', \Google\Protobuf\Internal\Type::class) + ->value("TYPE_DOUBLE", 1) + ->value("TYPE_FLOAT", 2) + ->value("TYPE_INT64", 3) + ->value("TYPE_UINT64", 4) + ->value("TYPE_INT32", 5) + ->value("TYPE_FIXED64", 6) + ->value("TYPE_FIXED32", 7) + ->value("TYPE_BOOL", 8) + ->value("TYPE_STRING", 9) + ->value("TYPE_GROUP", 10) + ->value("TYPE_MESSAGE", 11) + ->value("TYPE_BYTES", 12) + ->value("TYPE_UINT32", 13) + ->value("TYPE_ENUM", 14) + ->value("TYPE_SFIXED32", 15) + ->value("TYPE_SFIXED64", 16) + ->value("TYPE_SINT32", 17) + ->value("TYPE_SINT64", 18) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FieldDescriptorProto.Label', \Google\Protobuf\Internal\Label::class) + ->value("LABEL_OPTIONAL", 1) + ->value("LABEL_REQUIRED", 2) + ->value("LABEL_REPEATED", 3) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.OneofDescriptorProto', \Google\Protobuf\Internal\OneofDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.OneofOptions') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.EnumDescriptorProto', \Google\Protobuf\Internal\EnumDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->repeated('value', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.EnumValueDescriptorProto') + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.EnumOptions') + ->repeated('reserved_range', \Google\Protobuf\Internal\GPBType::MESSAGE, 4, 'google.protobuf.internal.EnumDescriptorProto.EnumReservedRange') + ->repeated('reserved_name', \Google\Protobuf\Internal\GPBType::STRING, 5) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.EnumDescriptorProto.EnumReservedRange', \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange::class) + ->optional('start', \Google\Protobuf\Internal\GPBType::INT32, 1) + ->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.EnumValueDescriptorProto', \Google\Protobuf\Internal\EnumValueDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->optional('number', \Google\Protobuf\Internal\GPBType::INT32, 2) + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.EnumValueOptions') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.ServiceDescriptorProto', \Google\Protobuf\Internal\ServiceDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->repeated('method', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.MethodDescriptorProto') + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.ServiceOptions') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.MethodDescriptorProto', \Google\Protobuf\Internal\MethodDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->optional('input_type', \Google\Protobuf\Internal\GPBType::STRING, 2) + ->optional('output_type', \Google\Protobuf\Internal\GPBType::STRING, 3) + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 4, 'google.protobuf.internal.MethodOptions') + ->optional('client_streaming', \Google\Protobuf\Internal\GPBType::BOOL, 5) + ->optional('server_streaming', \Google\Protobuf\Internal\GPBType::BOOL, 6) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.FileOptions', \Google\Protobuf\Internal\FileOptions::class) + ->optional('java_package', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->optional('java_outer_classname', \Google\Protobuf\Internal\GPBType::STRING, 8) + ->optional('java_multiple_files', \Google\Protobuf\Internal\GPBType::BOOL, 10) + ->optional('java_generate_equals_and_hash', \Google\Protobuf\Internal\GPBType::BOOL, 20) + ->optional('java_string_check_utf8', \Google\Protobuf\Internal\GPBType::BOOL, 27) + ->optional('optimize_for', \Google\Protobuf\Internal\GPBType::ENUM, 9, 'google.protobuf.internal.FileOptions.OptimizeMode') + ->optional('go_package', \Google\Protobuf\Internal\GPBType::STRING, 11) + ->optional('cc_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 16) + ->optional('java_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 17) + ->optional('py_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 18) + ->optional('php_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 42) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 23) + ->optional('cc_enable_arenas', \Google\Protobuf\Internal\GPBType::BOOL, 31) + ->optional('objc_class_prefix', \Google\Protobuf\Internal\GPBType::STRING, 36) + ->optional('csharp_namespace', \Google\Protobuf\Internal\GPBType::STRING, 37) + ->optional('swift_prefix', \Google\Protobuf\Internal\GPBType::STRING, 39) + ->optional('php_class_prefix', \Google\Protobuf\Internal\GPBType::STRING, 40) + ->optional('php_namespace', \Google\Protobuf\Internal\GPBType::STRING, 41) + ->optional('php_metadata_namespace', \Google\Protobuf\Internal\GPBType::STRING, 44) + ->optional('ruby_package', \Google\Protobuf\Internal\GPBType::STRING, 45) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FileOptions.OptimizeMode', \Google\Protobuf\Internal\OptimizeMode::class) + ->value("SPEED", 1) + ->value("CODE_SIZE", 2) + ->value("LITE_RUNTIME", 3) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.MessageOptions', \Google\Protobuf\Internal\MessageOptions::class) + ->optional('message_set_wire_format', \Google\Protobuf\Internal\GPBType::BOOL, 1) + ->optional('no_standard_descriptor_accessor', \Google\Protobuf\Internal\GPBType::BOOL, 2) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 3) + ->optional('map_entry', \Google\Protobuf\Internal\GPBType::BOOL, 7) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.FieldOptions', \Google\Protobuf\Internal\FieldOptions::class) + ->optional('ctype', \Google\Protobuf\Internal\GPBType::ENUM, 1, 'google.protobuf.internal.FieldOptions.CType') + ->optional('packed', \Google\Protobuf\Internal\GPBType::BOOL, 2) + ->optional('jstype', \Google\Protobuf\Internal\GPBType::ENUM, 6, 'google.protobuf.internal.FieldOptions.JSType') + ->optional('lazy', \Google\Protobuf\Internal\GPBType::BOOL, 5) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 3) + ->optional('weak', \Google\Protobuf\Internal\GPBType::BOOL, 10) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FieldOptions.CType', \Google\Protobuf\Internal\CType::class) + ->value("STRING", 0) + ->value("CORD", 1) + ->value("STRING_PIECE", 2) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FieldOptions.JSType', \Google\Protobuf\Internal\JSType::class) + ->value("JS_NORMAL", 0) + ->value("JS_STRING", 1) + ->value("JS_NUMBER", 2) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.OneofOptions', \Google\Protobuf\Internal\OneofOptions::class) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.EnumOptions', \Google\Protobuf\Internal\EnumOptions::class) + ->optional('allow_alias', \Google\Protobuf\Internal\GPBType::BOOL, 2) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 3) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.EnumValueOptions', \Google\Protobuf\Internal\EnumValueOptions::class) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 1) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.ServiceOptions', \Google\Protobuf\Internal\ServiceOptions::class) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 33) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.MethodOptions', \Google\Protobuf\Internal\MethodOptions::class) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 33) + ->optional('idempotency_level', \Google\Protobuf\Internal\GPBType::ENUM, 34, 'google.protobuf.internal.MethodOptions.IdempotencyLevel') + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.MethodOptions.IdempotencyLevel', \Google\Protobuf\Internal\IdempotencyLevel::class) + ->value("IDEMPOTENCY_UNKNOWN", 0) + ->value("NO_SIDE_EFFECTS", 1) + ->value("IDEMPOTENT", 2) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.UninterpretedOption', \Google\Protobuf\Internal\UninterpretedOption::class) + ->repeated('name', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.UninterpretedOption.NamePart') + ->optional('identifier_value', \Google\Protobuf\Internal\GPBType::STRING, 3) + ->optional('positive_int_value', \Google\Protobuf\Internal\GPBType::UINT64, 4) + ->optional('negative_int_value', \Google\Protobuf\Internal\GPBType::INT64, 5) + ->optional('double_value', \Google\Protobuf\Internal\GPBType::DOUBLE, 6) + ->optional('string_value', \Google\Protobuf\Internal\GPBType::BYTES, 7) + ->optional('aggregate_value', \Google\Protobuf\Internal\GPBType::STRING, 8) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.UninterpretedOption.NamePart', \Google\Protobuf\Internal\UninterpretedOption\NamePart::class) + ->required('name_part', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->required('is_extension', \Google\Protobuf\Internal\GPBType::BOOL, 2) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.SourceCodeInfo', \Google\Protobuf\Internal\SourceCodeInfo::class) + ->repeated('location', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.SourceCodeInfo.Location') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.SourceCodeInfo.Location', \Google\Protobuf\Internal\SourceCodeInfo\Location::class) + ->repeated('path', \Google\Protobuf\Internal\GPBType::INT32, 1) + ->repeated('span', \Google\Protobuf\Internal\GPBType::INT32, 2) + ->optional('leading_comments', \Google\Protobuf\Internal\GPBType::STRING, 3) + ->optional('trailing_comments', \Google\Protobuf\Internal\GPBType::STRING, 4) + ->repeated('leading_detached_comments', \Google\Protobuf\Internal\GPBType::STRING, 6) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.GeneratedCodeInfo', \Google\Protobuf\Internal\GeneratedCodeInfo::class) + ->repeated('annotation', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.GeneratedCodeInfo.Annotation') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.GeneratedCodeInfo.Annotation', \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation::class) + ->repeated('path', \Google\Protobuf\Internal\GPBType::INT32, 1) + ->optional('source_file', \Google\Protobuf\Internal\GPBType::STRING, 2) + ->optional('begin', \Google\Protobuf\Internal\GPBType::INT32, 3) + ->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 4) + ->finalizeToPool(); + + $pool->finish(); + static::$is_initialized = true; + } +} + diff --git a/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/SourceContext.php b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/SourceContext.php new file mode 100644 index 00000000..797732d9 --- /dev/null +++ b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/SourceContext.php @@ -0,0 +1,29 @@ +internalAddGeneratedFile( + ' + +$google/protobuf/source_context.protogoogle.protobuf"" + SourceContext + file_name ( B +com.google.protobufBSourceContextProtoPZ6google.golang.org/protobuf/types/known/sourcecontextpbGPBGoogle.Protobuf.WellKnownTypesbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Struct.php b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Struct.php new file mode 100644 index 00000000..888a81ad Binary files /dev/null and b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Struct.php differ diff --git a/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Timestamp.php b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Timestamp.php new file mode 100644 index 00000000..09437271 --- /dev/null +++ b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Timestamp.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile( + ' + +google/protobuf/timestamp.protogoogle.protobuf"+ + Timestamp +seconds ( +nanos (B +com.google.protobufBTimestampProtoPZ2google.golang.org/protobuf/types/known/timestamppbGPBGoogle.Protobuf.WellKnownTypesbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Type.php b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Type.php new file mode 100644 index 00000000..7d0bfbb5 Binary files /dev/null and b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Type.php differ diff --git a/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Wrappers.php b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Wrappers.php new file mode 100644 index 00000000..e7ea1a3b --- /dev/null +++ b/vendor/google/protobuf/src/GPBMetadata/Google/Protobuf/Wrappers.php @@ -0,0 +1,49 @@ +internalAddGeneratedFile( + ' + +google/protobuf/wrappers.protogoogle.protobuf" + DoubleValue +value (" + +FloatValue +value (" + +Int64Value +value (" + UInt64Value +value (" + +Int32Value +value (" + UInt32Value +value ( " + BoolValue +value (" + StringValue +value ( " + +BytesValue +value ( B +com.google.protobufB WrappersProtoPZ1google.golang.org/protobuf/types/known/wrapperspbGPBGoogle.Protobuf.WellKnownTypesbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Any.php b/vendor/google/protobuf/src/Google/Protobuf/Any.php new file mode 100644 index 00000000..cc64bad3 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Any.php @@ -0,0 +1,253 @@ +, + * "lastName": + * } + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + * + * Generated from protobuf message google.protobuf.Any + */ +class Any extends \Google\Protobuf\Internal\AnyBase +{ + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + * + * Generated from protobuf field string type_url = 1; + */ + protected $type_url = ''; + /** + * Must be a valid serialized protocol buffer of the above specified type. + * + * Generated from protobuf field bytes value = 2; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type_url + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + * @type string $value + * Must be a valid serialized protocol buffer of the above specified type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Any::initOnce(); + parent::__construct($data); + } + + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + * + * Generated from protobuf field string type_url = 1; + * @return string + */ + public function getTypeUrl() + { + return $this->type_url; + } + + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + * + * Generated from protobuf field string type_url = 1; + * @param string $var + * @return $this + */ + public function setTypeUrl($var) + { + GPBUtil::checkString($var, True); + $this->type_url = $var; + + return $this; + } + + /** + * Must be a valid serialized protocol buffer of the above specified type. + * + * Generated from protobuf field bytes value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Must be a valid serialized protocol buffer of the above specified type. + * + * Generated from protobuf field bytes value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, False); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Api.php b/vendor/google/protobuf/src/Google/Protobuf/Api.php new file mode 100644 index 00000000..e7d76c01 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Api.php @@ -0,0 +1,360 @@ +google.protobuf.Api + */ +class Api extends \Google\Protobuf\Internal\Message +{ + /** + * The fully qualified name of this interface, including package name + * followed by the interface's simple name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The methods of this interface, in unspecified order. + * + * Generated from protobuf field repeated .google.protobuf.Method methods = 2; + */ + private $methods; + /** + * Any metadata attached to the interface. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 3; + */ + private $options; + /** + * A version string for this interface. If specified, must have the form + * `major-version.minor-version`, as in `1.10`. If the minor version is + * omitted, it defaults to zero. If the entire version field is empty, the + * major version is derived from the package name, as outlined below. If the + * field is not empty, the version in the package name will be verified to be + * consistent with what is provided here. + * The versioning schema uses [semantic + * versioning](http://semver.org) where the major version number + * indicates a breaking change and the minor version an additive, + * non-breaking change. Both version numbers are signals to users + * what to expect from different versions, and should be carefully + * chosen based on the product plan. + * The major version is also reflected in the package name of the + * interface, which must end in `v`, as in + * `google.feature.v1`. For major versions 0 and 1, the suffix can + * be omitted. Zero major versions must only be used for + * experimental, non-GA interfaces. + * + * Generated from protobuf field string version = 4; + */ + protected $version = ''; + /** + * Source context for the protocol buffer service represented by this + * message. + * + * Generated from protobuf field .google.protobuf.SourceContext source_context = 5; + */ + protected $source_context = null; + /** + * Included interfaces. See [Mixin][]. + * + * Generated from protobuf field repeated .google.protobuf.Mixin mixins = 6; + */ + private $mixins; + /** + * The source syntax of the service. + * + * Generated from protobuf field .google.protobuf.Syntax syntax = 7; + */ + protected $syntax = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The fully qualified name of this interface, including package name + * followed by the interface's simple name. + * @type \Google\Protobuf\Method[]|\Google\Protobuf\Internal\RepeatedField $methods + * The methods of this interface, in unspecified order. + * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options + * Any metadata attached to the interface. + * @type string $version + * A version string for this interface. If specified, must have the form + * `major-version.minor-version`, as in `1.10`. If the minor version is + * omitted, it defaults to zero. If the entire version field is empty, the + * major version is derived from the package name, as outlined below. If the + * field is not empty, the version in the package name will be verified to be + * consistent with what is provided here. + * The versioning schema uses [semantic + * versioning](http://semver.org) where the major version number + * indicates a breaking change and the minor version an additive, + * non-breaking change. Both version numbers are signals to users + * what to expect from different versions, and should be carefully + * chosen based on the product plan. + * The major version is also reflected in the package name of the + * interface, which must end in `v`, as in + * `google.feature.v1`. For major versions 0 and 1, the suffix can + * be omitted. Zero major versions must only be used for + * experimental, non-GA interfaces. + * @type \Google\Protobuf\SourceContext $source_context + * Source context for the protocol buffer service represented by this + * message. + * @type \Google\Protobuf\Mixin[]|\Google\Protobuf\Internal\RepeatedField $mixins + * Included interfaces. See [Mixin][]. + * @type int $syntax + * The source syntax of the service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Api::initOnce(); + parent::__construct($data); + } + + /** + * The fully qualified name of this interface, including package name + * followed by the interface's simple name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The fully qualified name of this interface, including package name + * followed by the interface's simple name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The methods of this interface, in unspecified order. + * + * Generated from protobuf field repeated .google.protobuf.Method methods = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMethods() + { + return $this->methods; + } + + /** + * The methods of this interface, in unspecified order. + * + * Generated from protobuf field repeated .google.protobuf.Method methods = 2; + * @param \Google\Protobuf\Method[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMethods($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Method::class); + $this->methods = $arr; + + return $this; + } + + /** + * Any metadata attached to the interface. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOptions() + { + return $this->options; + } + + /** + * Any metadata attached to the interface. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 3; + * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class); + $this->options = $arr; + + return $this; + } + + /** + * A version string for this interface. If specified, must have the form + * `major-version.minor-version`, as in `1.10`. If the minor version is + * omitted, it defaults to zero. If the entire version field is empty, the + * major version is derived from the package name, as outlined below. If the + * field is not empty, the version in the package name will be verified to be + * consistent with what is provided here. + * The versioning schema uses [semantic + * versioning](http://semver.org) where the major version number + * indicates a breaking change and the minor version an additive, + * non-breaking change. Both version numbers are signals to users + * what to expect from different versions, and should be carefully + * chosen based on the product plan. + * The major version is also reflected in the package name of the + * interface, which must end in `v`, as in + * `google.feature.v1`. For major versions 0 and 1, the suffix can + * be omitted. Zero major versions must only be used for + * experimental, non-GA interfaces. + * + * Generated from protobuf field string version = 4; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * A version string for this interface. If specified, must have the form + * `major-version.minor-version`, as in `1.10`. If the minor version is + * omitted, it defaults to zero. If the entire version field is empty, the + * major version is derived from the package name, as outlined below. If the + * field is not empty, the version in the package name will be verified to be + * consistent with what is provided here. + * The versioning schema uses [semantic + * versioning](http://semver.org) where the major version number + * indicates a breaking change and the minor version an additive, + * non-breaking change. Both version numbers are signals to users + * what to expect from different versions, and should be carefully + * chosen based on the product plan. + * The major version is also reflected in the package name of the + * interface, which must end in `v`, as in + * `google.feature.v1`. For major versions 0 and 1, the suffix can + * be omitted. Zero major versions must only be used for + * experimental, non-GA interfaces. + * + * Generated from protobuf field string version = 4; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Source context for the protocol buffer service represented by this + * message. + * + * Generated from protobuf field .google.protobuf.SourceContext source_context = 5; + * @return \Google\Protobuf\SourceContext|null + */ + public function getSourceContext() + { + return $this->source_context; + } + + public function hasSourceContext() + { + return isset($this->source_context); + } + + public function clearSourceContext() + { + unset($this->source_context); + } + + /** + * Source context for the protocol buffer service represented by this + * message. + * + * Generated from protobuf field .google.protobuf.SourceContext source_context = 5; + * @param \Google\Protobuf\SourceContext $var + * @return $this + */ + public function setSourceContext($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\SourceContext::class); + $this->source_context = $var; + + return $this; + } + + /** + * Included interfaces. See [Mixin][]. + * + * Generated from protobuf field repeated .google.protobuf.Mixin mixins = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMixins() + { + return $this->mixins; + } + + /** + * Included interfaces. See [Mixin][]. + * + * Generated from protobuf field repeated .google.protobuf.Mixin mixins = 6; + * @param \Google\Protobuf\Mixin[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMixins($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Mixin::class); + $this->mixins = $arr; + + return $this; + } + + /** + * The source syntax of the service. + * + * Generated from protobuf field .google.protobuf.Syntax syntax = 7; + * @return int + */ + public function getSyntax() + { + return $this->syntax; + } + + /** + * The source syntax of the service. + * + * Generated from protobuf field .google.protobuf.Syntax syntax = 7; + * @param int $var + * @return $this + */ + public function setSyntax($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class); + $this->syntax = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/BoolValue.php b/vendor/google/protobuf/src/Google/Protobuf/BoolValue.php new file mode 100644 index 00000000..ecdbf4dc --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/BoolValue.php @@ -0,0 +1,68 @@ +google.protobuf.BoolValue + */ +class BoolValue extends \Google\Protobuf\Internal\Message +{ + /** + * The bool value. + * + * Generated from protobuf field bool value = 1; + */ + protected $value = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $value + * The bool value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); + parent::__construct($data); + } + + /** + * The bool value. + * + * Generated from protobuf field bool value = 1; + * @return bool + */ + public function getValue() + { + return $this->value; + } + + /** + * The bool value. + * + * Generated from protobuf field bool value = 1; + * @param bool $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkBool($var); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/BytesValue.php b/vendor/google/protobuf/src/Google/Protobuf/BytesValue.php new file mode 100644 index 00000000..1582e14a --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/BytesValue.php @@ -0,0 +1,68 @@ +google.protobuf.BytesValue + */ +class BytesValue extends \Google\Protobuf\Internal\Message +{ + /** + * The bytes value. + * + * Generated from protobuf field bytes value = 1; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $value + * The bytes value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); + parent::__construct($data); + } + + /** + * The bytes value. + * + * Generated from protobuf field bytes value = 1; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The bytes value. + * + * Generated from protobuf field bytes value = 1; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, False); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Descriptor.php b/vendor/google/protobuf/src/Google/Protobuf/Descriptor.php new file mode 100644 index 00000000..36436e2b --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Descriptor.php @@ -0,0 +1,108 @@ +internal_desc = $internal_desc; + } + + /** + * @return string Full protobuf message name + */ + public function getFullName() + { + return trim($this->internal_desc->getFullName(), "."); + } + + /** + * @return string PHP class name + */ + public function getClass() + { + return $this->internal_desc->getClass(); + } + + /** + * @param int $index Must be >= 0 and < getFieldCount() + * @return FieldDescriptor + */ + public function getField($index) + { + return $this->getPublicDescriptor($this->internal_desc->getFieldByIndex($index)); + } + + /** + * @return int Number of fields in message + */ + public function getFieldCount() + { + return count($this->internal_desc->getField()); + } + + /** + * @param int $index Must be >= 0 and < getOneofDeclCount() + * @return OneofDescriptor + */ + public function getOneofDecl($index) + { + return $this->getPublicDescriptor($this->internal_desc->getOneofDecl()[$index]); + } + + /** + * @return int Number of oneofs in message + */ + public function getOneofDeclCount() + { + return count($this->internal_desc->getOneofDecl()); + } + + /** + * @return int Number of real oneofs in message + */ + public function getRealOneofDeclCount() + { + return $this->internal_desc->getRealOneofDeclCount(); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/DescriptorPool.php b/vendor/google/protobuf/src/Google/Protobuf/DescriptorPool.php new file mode 100644 index 00000000..119f0e2e --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/DescriptorPool.php @@ -0,0 +1,76 @@ +internal_pool = $internal_pool; + } + + /** + * @param string $className A fully qualified protobuf class name + * @return Descriptor + */ + public function getDescriptorByClassName($className) + { + $desc = $this->internal_pool->getDescriptorByClassName($className); + return is_null($desc) ? null : $desc->getPublicDescriptor(); + } + + /** + * @param string $className A fully qualified protobuf class name + * @return EnumDescriptor + */ + public function getEnumDescriptorByClassName($className) + { + $desc = $this->internal_pool->getEnumDescriptorByClassName($className); + return is_null($desc) ? null : $desc->getPublicDescriptor(); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/DoubleValue.php b/vendor/google/protobuf/src/Google/Protobuf/DoubleValue.php new file mode 100644 index 00000000..b72399f4 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/DoubleValue.php @@ -0,0 +1,68 @@ +google.protobuf.DoubleValue + */ +class DoubleValue extends \Google\Protobuf\Internal\Message +{ + /** + * The double value. + * + * Generated from protobuf field double value = 1; + */ + protected $value = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $value + * The double value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); + parent::__construct($data); + } + + /** + * The double value. + * + * Generated from protobuf field double value = 1; + * @return float + */ + public function getValue() + { + return $this->value; + } + + /** + * The double value. + * + * Generated from protobuf field double value = 1; + * @param float $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkDouble($var); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Duration.php b/vendor/google/protobuf/src/Google/Protobuf/Duration.php new file mode 100644 index 00000000..531cd50b --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Duration.php @@ -0,0 +1,173 @@ + 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * Example 3: Compute Duration from datetime.timedelta in Python. + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * # JSON Mapping + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + * + * Generated from protobuf message google.protobuf.Duration + */ +class Duration extends \Google\Protobuf\Internal\Message +{ + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + * + * Generated from protobuf field int64 seconds = 1; + */ + protected $seconds = 0; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + * + * Generated from protobuf field int32 nanos = 2; + */ + protected $nanos = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $seconds + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + * @type int $nanos + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Duration::initOnce(); + parent::__construct($data); + } + + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + * + * Generated from protobuf field int64 seconds = 1; + * @return int|string + */ + public function getSeconds() + { + return $this->seconds; + } + + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + * + * Generated from protobuf field int64 seconds = 1; + * @param int|string $var + * @return $this + */ + public function setSeconds($var) + { + GPBUtil::checkInt64($var); + $this->seconds = $var; + + return $this; + } + + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + * + * Generated from protobuf field int32 nanos = 2; + * @return int + */ + public function getNanos() + { + return $this->nanos; + } + + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + * + * Generated from protobuf field int32 nanos = 2; + * @param int $var + * @return $this + */ + public function setNanos($var) + { + GPBUtil::checkInt32($var); + $this->nanos = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Enum.php b/vendor/google/protobuf/src/Google/Protobuf/Enum.php new file mode 100644 index 00000000..e803e930 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Enum.php @@ -0,0 +1,213 @@ +google.protobuf.Enum + */ +class Enum extends \Google\Protobuf\Internal\Message +{ + /** + * Enum type name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Enum value definitions. + * + * Generated from protobuf field repeated .google.protobuf.EnumValue enumvalue = 2; + */ + private $enumvalue; + /** + * Protocol buffer options. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 3; + */ + private $options; + /** + * The source context. + * + * Generated from protobuf field .google.protobuf.SourceContext source_context = 4; + */ + protected $source_context = null; + /** + * The source syntax. + * + * Generated from protobuf field .google.protobuf.Syntax syntax = 5; + */ + protected $syntax = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Enum type name. + * @type \Google\Protobuf\EnumValue[]|\Google\Protobuf\Internal\RepeatedField $enumvalue + * Enum value definitions. + * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options + * Protocol buffer options. + * @type \Google\Protobuf\SourceContext $source_context + * The source context. + * @type int $syntax + * The source syntax. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Type::initOnce(); + parent::__construct($data); + } + + /** + * Enum type name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Enum type name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Enum value definitions. + * + * Generated from protobuf field repeated .google.protobuf.EnumValue enumvalue = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEnumvalue() + { + return $this->enumvalue; + } + + /** + * Enum value definitions. + * + * Generated from protobuf field repeated .google.protobuf.EnumValue enumvalue = 2; + * @param \Google\Protobuf\EnumValue[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEnumvalue($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\EnumValue::class); + $this->enumvalue = $arr; + + return $this; + } + + /** + * Protocol buffer options. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOptions() + { + return $this->options; + } + + /** + * Protocol buffer options. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 3; + * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class); + $this->options = $arr; + + return $this; + } + + /** + * The source context. + * + * Generated from protobuf field .google.protobuf.SourceContext source_context = 4; + * @return \Google\Protobuf\SourceContext|null + */ + public function getSourceContext() + { + return $this->source_context; + } + + public function hasSourceContext() + { + return isset($this->source_context); + } + + public function clearSourceContext() + { + unset($this->source_context); + } + + /** + * The source context. + * + * Generated from protobuf field .google.protobuf.SourceContext source_context = 4; + * @param \Google\Protobuf\SourceContext $var + * @return $this + */ + public function setSourceContext($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\SourceContext::class); + $this->source_context = $var; + + return $this; + } + + /** + * The source syntax. + * + * Generated from protobuf field .google.protobuf.Syntax syntax = 5; + * @return int + */ + public function getSyntax() + { + return $this->syntax; + } + + /** + * The source syntax. + * + * Generated from protobuf field .google.protobuf.Syntax syntax = 5; + * @param int $var + * @return $this + */ + public function setSyntax($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class); + $this->syntax = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/EnumDescriptor.php b/vendor/google/protobuf/src/Google/Protobuf/EnumDescriptor.php new file mode 100644 index 00000000..a8b56c0d --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/EnumDescriptor.php @@ -0,0 +1,79 @@ +internal_desc = $internal_desc; + } + + /** + * @return string Full protobuf message name + */ + public function getFullName() + { + return $this->internal_desc->getFullName(); + } + + /** + * @return string PHP class name + */ + public function getClass() + { + return $this->internal_desc->getClass(); + } + + /** + * @param int $index Must be >= 0 and < getValueCount() + * @return EnumValueDescriptor + */ + public function getValue($index) + { + return $this->internal_desc->getValueDescriptorByIndex($index); + } + + /** + * @return int Number of values in enum + */ + public function getValueCount() + { + return $this->internal_desc->getValueCount(); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/EnumValue.php b/vendor/google/protobuf/src/Google/Protobuf/EnumValue.php new file mode 100644 index 00000000..905f4ad1 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/EnumValue.php @@ -0,0 +1,135 @@ +google.protobuf.EnumValue + */ +class EnumValue extends \Google\Protobuf\Internal\Message +{ + /** + * Enum value name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Enum value number. + * + * Generated from protobuf field int32 number = 2; + */ + protected $number = 0; + /** + * Protocol buffer options. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 3; + */ + private $options; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Enum value name. + * @type int $number + * Enum value number. + * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options + * Protocol buffer options. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Type::initOnce(); + parent::__construct($data); + } + + /** + * Enum value name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Enum value name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Enum value number. + * + * Generated from protobuf field int32 number = 2; + * @return int + */ + public function getNumber() + { + return $this->number; + } + + /** + * Enum value number. + * + * Generated from protobuf field int32 number = 2; + * @param int $var + * @return $this + */ + public function setNumber($var) + { + GPBUtil::checkInt32($var); + $this->number = $var; + + return $this; + } + + /** + * Protocol buffer options. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOptions() + { + return $this->options; + } + + /** + * Protocol buffer options. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 3; + * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class); + $this->options = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/EnumValueDescriptor.php b/vendor/google/protobuf/src/Google/Protobuf/EnumValueDescriptor.php new file mode 100644 index 00000000..e76e1997 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/EnumValueDescriptor.php @@ -0,0 +1,64 @@ +name = $name; + $this->number = $number; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @return int + */ + public function getNumber() + { + return $this->number; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Field.php b/vendor/google/protobuf/src/Google/Protobuf/Field.php new file mode 100644 index 00000000..76a505ea --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Field.php @@ -0,0 +1,381 @@ +google.protobuf.Field + */ +class Field extends \Google\Protobuf\Internal\Message +{ + /** + * The field type. + * + * Generated from protobuf field .google.protobuf.Field.Kind kind = 1; + */ + protected $kind = 0; + /** + * The field cardinality. + * + * Generated from protobuf field .google.protobuf.Field.Cardinality cardinality = 2; + */ + protected $cardinality = 0; + /** + * The field number. + * + * Generated from protobuf field int32 number = 3; + */ + protected $number = 0; + /** + * The field name. + * + * Generated from protobuf field string name = 4; + */ + protected $name = ''; + /** + * The field type URL, without the scheme, for message or enumeration + * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. + * + * Generated from protobuf field string type_url = 6; + */ + protected $type_url = ''; + /** + * The index of the field type in `Type.oneofs`, for message or enumeration + * types. The first type has index 1; zero means the type is not in the list. + * + * Generated from protobuf field int32 oneof_index = 7; + */ + protected $oneof_index = 0; + /** + * Whether to use alternative packed wire representation. + * + * Generated from protobuf field bool packed = 8; + */ + protected $packed = false; + /** + * The protocol buffer options. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 9; + */ + private $options; + /** + * The field JSON name. + * + * Generated from protobuf field string json_name = 10; + */ + protected $json_name = ''; + /** + * The string value of the default value of this field. Proto2 syntax only. + * + * Generated from protobuf field string default_value = 11; + */ + protected $default_value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $kind + * The field type. + * @type int $cardinality + * The field cardinality. + * @type int $number + * The field number. + * @type string $name + * The field name. + * @type string $type_url + * The field type URL, without the scheme, for message or enumeration + * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. + * @type int $oneof_index + * The index of the field type in `Type.oneofs`, for message or enumeration + * types. The first type has index 1; zero means the type is not in the list. + * @type bool $packed + * Whether to use alternative packed wire representation. + * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options + * The protocol buffer options. + * @type string $json_name + * The field JSON name. + * @type string $default_value + * The string value of the default value of this field. Proto2 syntax only. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Type::initOnce(); + parent::__construct($data); + } + + /** + * The field type. + * + * Generated from protobuf field .google.protobuf.Field.Kind kind = 1; + * @return int + */ + public function getKind() + { + return $this->kind; + } + + /** + * The field type. + * + * Generated from protobuf field .google.protobuf.Field.Kind kind = 1; + * @param int $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Field\Kind::class); + $this->kind = $var; + + return $this; + } + + /** + * The field cardinality. + * + * Generated from protobuf field .google.protobuf.Field.Cardinality cardinality = 2; + * @return int + */ + public function getCardinality() + { + return $this->cardinality; + } + + /** + * The field cardinality. + * + * Generated from protobuf field .google.protobuf.Field.Cardinality cardinality = 2; + * @param int $var + * @return $this + */ + public function setCardinality($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Field\Cardinality::class); + $this->cardinality = $var; + + return $this; + } + + /** + * The field number. + * + * Generated from protobuf field int32 number = 3; + * @return int + */ + public function getNumber() + { + return $this->number; + } + + /** + * The field number. + * + * Generated from protobuf field int32 number = 3; + * @param int $var + * @return $this + */ + public function setNumber($var) + { + GPBUtil::checkInt32($var); + $this->number = $var; + + return $this; + } + + /** + * The field name. + * + * Generated from protobuf field string name = 4; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The field name. + * + * Generated from protobuf field string name = 4; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The field type URL, without the scheme, for message or enumeration + * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. + * + * Generated from protobuf field string type_url = 6; + * @return string + */ + public function getTypeUrl() + { + return $this->type_url; + } + + /** + * The field type URL, without the scheme, for message or enumeration + * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. + * + * Generated from protobuf field string type_url = 6; + * @param string $var + * @return $this + */ + public function setTypeUrl($var) + { + GPBUtil::checkString($var, True); + $this->type_url = $var; + + return $this; + } + + /** + * The index of the field type in `Type.oneofs`, for message or enumeration + * types. The first type has index 1; zero means the type is not in the list. + * + * Generated from protobuf field int32 oneof_index = 7; + * @return int + */ + public function getOneofIndex() + { + return $this->oneof_index; + } + + /** + * The index of the field type in `Type.oneofs`, for message or enumeration + * types. The first type has index 1; zero means the type is not in the list. + * + * Generated from protobuf field int32 oneof_index = 7; + * @param int $var + * @return $this + */ + public function setOneofIndex($var) + { + GPBUtil::checkInt32($var); + $this->oneof_index = $var; + + return $this; + } + + /** + * Whether to use alternative packed wire representation. + * + * Generated from protobuf field bool packed = 8; + * @return bool + */ + public function getPacked() + { + return $this->packed; + } + + /** + * Whether to use alternative packed wire representation. + * + * Generated from protobuf field bool packed = 8; + * @param bool $var + * @return $this + */ + public function setPacked($var) + { + GPBUtil::checkBool($var); + $this->packed = $var; + + return $this; + } + + /** + * The protocol buffer options. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOptions() + { + return $this->options; + } + + /** + * The protocol buffer options. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 9; + * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class); + $this->options = $arr; + + return $this; + } + + /** + * The field JSON name. + * + * Generated from protobuf field string json_name = 10; + * @return string + */ + public function getJsonName() + { + return $this->json_name; + } + + /** + * The field JSON name. + * + * Generated from protobuf field string json_name = 10; + * @param string $var + * @return $this + */ + public function setJsonName($var) + { + GPBUtil::checkString($var, True); + $this->json_name = $var; + + return $this; + } + + /** + * The string value of the default value of this field. Proto2 syntax only. + * + * Generated from protobuf field string default_value = 11; + * @return string + */ + public function getDefaultValue() + { + return $this->default_value; + } + + /** + * The string value of the default value of this field. Proto2 syntax only. + * + * Generated from protobuf field string default_value = 11; + * @param string $var + * @return $this + */ + public function setDefaultValue($var) + { + GPBUtil::checkString($var, True); + $this->default_value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Field/Cardinality.php b/vendor/google/protobuf/src/Google/Protobuf/Field/Cardinality.php new file mode 100644 index 00000000..a4221995 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Field/Cardinality.php @@ -0,0 +1,71 @@ +google.protobuf.Field.Cardinality + */ +class Cardinality +{ + /** + * For fields with unknown cardinality. + * + * Generated from protobuf enum CARDINALITY_UNKNOWN = 0; + */ + const CARDINALITY_UNKNOWN = 0; + /** + * For optional fields. + * + * Generated from protobuf enum CARDINALITY_OPTIONAL = 1; + */ + const CARDINALITY_OPTIONAL = 1; + /** + * For required fields. Proto2 syntax only. + * + * Generated from protobuf enum CARDINALITY_REQUIRED = 2; + */ + const CARDINALITY_REQUIRED = 2; + /** + * For repeated fields. + * + * Generated from protobuf enum CARDINALITY_REPEATED = 3; + */ + const CARDINALITY_REPEATED = 3; + + private static $valueToName = [ + self::CARDINALITY_UNKNOWN => 'CARDINALITY_UNKNOWN', + self::CARDINALITY_OPTIONAL => 'CARDINALITY_OPTIONAL', + self::CARDINALITY_REQUIRED => 'CARDINALITY_REQUIRED', + self::CARDINALITY_REPEATED => 'CARDINALITY_REPEATED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Cardinality::class, \Google\Protobuf\Field_Cardinality::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Field/Kind.php b/vendor/google/protobuf/src/Google/Protobuf/Field/Kind.php new file mode 100644 index 00000000..2d8dd77c --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Field/Kind.php @@ -0,0 +1,176 @@ +google.protobuf.Field.Kind + */ +class Kind +{ + /** + * Field type unknown. + * + * Generated from protobuf enum TYPE_UNKNOWN = 0; + */ + const TYPE_UNKNOWN = 0; + /** + * Field type double. + * + * Generated from protobuf enum TYPE_DOUBLE = 1; + */ + const TYPE_DOUBLE = 1; + /** + * Field type float. + * + * Generated from protobuf enum TYPE_FLOAT = 2; + */ + const TYPE_FLOAT = 2; + /** + * Field type int64. + * + * Generated from protobuf enum TYPE_INT64 = 3; + */ + const TYPE_INT64 = 3; + /** + * Field type uint64. + * + * Generated from protobuf enum TYPE_UINT64 = 4; + */ + const TYPE_UINT64 = 4; + /** + * Field type int32. + * + * Generated from protobuf enum TYPE_INT32 = 5; + */ + const TYPE_INT32 = 5; + /** + * Field type fixed64. + * + * Generated from protobuf enum TYPE_FIXED64 = 6; + */ + const TYPE_FIXED64 = 6; + /** + * Field type fixed32. + * + * Generated from protobuf enum TYPE_FIXED32 = 7; + */ + const TYPE_FIXED32 = 7; + /** + * Field type bool. + * + * Generated from protobuf enum TYPE_BOOL = 8; + */ + const TYPE_BOOL = 8; + /** + * Field type string. + * + * Generated from protobuf enum TYPE_STRING = 9; + */ + const TYPE_STRING = 9; + /** + * Field type group. Proto2 syntax only, and deprecated. + * + * Generated from protobuf enum TYPE_GROUP = 10; + */ + const TYPE_GROUP = 10; + /** + * Field type message. + * + * Generated from protobuf enum TYPE_MESSAGE = 11; + */ + const TYPE_MESSAGE = 11; + /** + * Field type bytes. + * + * Generated from protobuf enum TYPE_BYTES = 12; + */ + const TYPE_BYTES = 12; + /** + * Field type uint32. + * + * Generated from protobuf enum TYPE_UINT32 = 13; + */ + const TYPE_UINT32 = 13; + /** + * Field type enum. + * + * Generated from protobuf enum TYPE_ENUM = 14; + */ + const TYPE_ENUM = 14; + /** + * Field type sfixed32. + * + * Generated from protobuf enum TYPE_SFIXED32 = 15; + */ + const TYPE_SFIXED32 = 15; + /** + * Field type sfixed64. + * + * Generated from protobuf enum TYPE_SFIXED64 = 16; + */ + const TYPE_SFIXED64 = 16; + /** + * Field type sint32. + * + * Generated from protobuf enum TYPE_SINT32 = 17; + */ + const TYPE_SINT32 = 17; + /** + * Field type sint64. + * + * Generated from protobuf enum TYPE_SINT64 = 18; + */ + const TYPE_SINT64 = 18; + + private static $valueToName = [ + self::TYPE_UNKNOWN => 'TYPE_UNKNOWN', + self::TYPE_DOUBLE => 'TYPE_DOUBLE', + self::TYPE_FLOAT => 'TYPE_FLOAT', + self::TYPE_INT64 => 'TYPE_INT64', + self::TYPE_UINT64 => 'TYPE_UINT64', + self::TYPE_INT32 => 'TYPE_INT32', + self::TYPE_FIXED64 => 'TYPE_FIXED64', + self::TYPE_FIXED32 => 'TYPE_FIXED32', + self::TYPE_BOOL => 'TYPE_BOOL', + self::TYPE_STRING => 'TYPE_STRING', + self::TYPE_GROUP => 'TYPE_GROUP', + self::TYPE_MESSAGE => 'TYPE_MESSAGE', + self::TYPE_BYTES => 'TYPE_BYTES', + self::TYPE_UINT32 => 'TYPE_UINT32', + self::TYPE_ENUM => 'TYPE_ENUM', + self::TYPE_SFIXED32 => 'TYPE_SFIXED32', + self::TYPE_SFIXED64 => 'TYPE_SFIXED64', + self::TYPE_SINT32 => 'TYPE_SINT32', + self::TYPE_SINT64 => 'TYPE_SINT64', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Kind::class, \Google\Protobuf\Field_Kind::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/FieldDescriptor.php b/vendor/google/protobuf/src/Google/Protobuf/FieldDescriptor.php new file mode 100644 index 00000000..6d08cea9 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/FieldDescriptor.php @@ -0,0 +1,125 @@ +internal_desc = $internal_desc; + } + + /** + * @return string Field name + */ + public function getName() + { + return $this->internal_desc->getName(); + } + + /** + * @return int Protobuf field number + */ + public function getNumber() + { + return $this->internal_desc->getNumber(); + } + + /** + * @return int + */ + public function getLabel() + { + return $this->internal_desc->getLabel(); + } + + /** + * @return int + */ + public function getType() + { + return $this->internal_desc->getType(); + } + + /** + * @return Descriptor Returns a descriptor for the field type if the field type is a message, otherwise throws \Exception + * @throws \Exception + */ + public function getMessageType() + { + if ($this->getType() == GPBType::MESSAGE) { + return $this->getPublicDescriptor($this->internal_desc->getMessageType()); + } else { + throw new \Exception("Cannot get message type for non-message field '" . $this->getName() . "'"); + } + } + + /** + * @return EnumDescriptor Returns an enum descriptor if the field type is an enum, otherwise throws \Exception + * @throws \Exception + */ + public function getEnumType() + { + if ($this->getType() == GPBType::ENUM) { + return $this->getPublicDescriptor($this->internal_desc->getEnumType()); + } else { + throw new \Exception("Cannot get enum type for non-enum field '" . $this->getName() . "'"); + } + } + + /** + * @return boolean + */ + public function isMap() + { + return $this->internal_desc->isMap(); + } + + /** + * @return boolean + */ + public function hasOptionalKeyword() + { + return $this->internal_desc->hasOptionalKeyword(); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/FieldMask.php b/vendor/google/protobuf/src/Google/Protobuf/FieldMask.php new file mode 100644 index 00000000..0b9659d3 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/FieldMask.php @@ -0,0 +1,217 @@ +google.protobuf.FieldMask + */ +class FieldMask extends \Google\Protobuf\Internal\Message +{ + /** + * The set of field mask paths. + * + * Generated from protobuf field repeated string paths = 1; + */ + private $paths; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string[]|\Google\Protobuf\Internal\RepeatedField $paths + * The set of field mask paths. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\FieldMask::initOnce(); + parent::__construct($data); + } + + /** + * The set of field mask paths. + * + * Generated from protobuf field repeated string paths = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPaths() + { + return $this->paths; + } + + /** + * The set of field mask paths. + * + * Generated from protobuf field repeated string paths = 1; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPaths($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->paths = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Field_Cardinality.php b/vendor/google/protobuf/src/Google/Protobuf/Field_Cardinality.php new file mode 100644 index 00000000..dff8f893 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Field_Cardinality.php @@ -0,0 +1,16 @@ +google.protobuf.FloatValue + */ +class FloatValue extends \Google\Protobuf\Internal\Message +{ + /** + * The float value. + * + * Generated from protobuf field float value = 1; + */ + protected $value = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $value + * The float value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); + parent::__construct($data); + } + + /** + * The float value. + * + * Generated from protobuf field float value = 1; + * @return float + */ + public function getValue() + { + return $this->value; + } + + /** + * The float value. + * + * Generated from protobuf field float value = 1; + * @param float $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkFloat($var); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/GPBEmpty.php b/vendor/google/protobuf/src/Google/Protobuf/GPBEmpty.php new file mode 100644 index 00000000..2de9c3bc --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/GPBEmpty.php @@ -0,0 +1,39 @@ +google.protobuf.Empty + */ +class GPBEmpty extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\GPBEmpty::initOnce(); + parent::__construct($data); + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Int32Value.php b/vendor/google/protobuf/src/Google/Protobuf/Int32Value.php new file mode 100644 index 00000000..cfd73cdc --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Int32Value.php @@ -0,0 +1,68 @@ +google.protobuf.Int32Value + */ +class Int32Value extends \Google\Protobuf\Internal\Message +{ + /** + * The int32 value. + * + * Generated from protobuf field int32 value = 1; + */ + protected $value = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $value + * The int32 value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); + parent::__construct($data); + } + + /** + * The int32 value. + * + * Generated from protobuf field int32 value = 1; + * @return int + */ + public function getValue() + { + return $this->value; + } + + /** + * The int32 value. + * + * Generated from protobuf field int32 value = 1; + * @param int $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkInt32($var); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Int64Value.php b/vendor/google/protobuf/src/Google/Protobuf/Int64Value.php new file mode 100644 index 00000000..143474fc --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Int64Value.php @@ -0,0 +1,68 @@ +google.protobuf.Int64Value + */ +class Int64Value extends \Google\Protobuf\Internal\Message +{ + /** + * The int64 value. + * + * Generated from protobuf field int64 value = 1; + */ + protected $value = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $value + * The int64 value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); + parent::__construct($data); + } + + /** + * The int64 value. + * + * Generated from protobuf field int64 value = 1; + * @return int|string + */ + public function getValue() + { + return $this->value; + } + + /** + * The int64 value. + * + * Generated from protobuf field int64 value = 1; + * @param int|string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkInt64($var); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/AnyBase.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/AnyBase.php new file mode 100644 index 00000000..cba922d4 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/AnyBase.php @@ -0,0 +1,86 @@ +type_url, 0, $url_prifix_len) != + GPBUtil::TYPE_URL_PREFIX) { + throw new \Exception( + "Type url needs to be type.googleapis.com/fully-qulified"); + } + $fully_qualifed_name = + substr($this->type_url, $url_prifix_len); + + // Create message according to fully qualified name. + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + $desc = $pool->getDescriptorByProtoName($fully_qualifed_name); + if (is_null($desc)) { + throw new \Exception("Class ".$fully_qualifed_name + ." hasn't been added to descriptor pool"); + } + $klass = $desc->getClass(); + $msg = new $klass(); + + // Merge data into message. + $msg->mergeFromString($this->value); + return $msg; + } + + /** + * The type_url will be created according to the given message’s type and + * the value is encoded data from the given message.. + * @param message: A proto message. + */ + public function pack($msg) + { + if (!$msg instanceof Message) { + trigger_error("Given parameter is not a message instance.", + E_USER_ERROR); + return; + } + + // Set value using serialized message. + $this->value = $msg->serializeToString(); + + // Set type url. + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + $desc = $pool->getDescriptorByClassName(get_class($msg)); + $fully_qualifed_name = $desc->getFullName(); + $this->type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualifed_name; + } + + /** + * This method returns whether the type_url in any_message is corresponded + * to the given class. + * @param klass: The fully qualified PHP class name of a proto message type. + */ + public function is($klass) + { + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + $desc = $pool->getDescriptorByClassName($klass); + $fully_qualifed_name = $desc->getFullName(); + $type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualifed_name; + return $this->type_url === $type_url; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/CodedInputStream.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/CodedInputStream.php new file mode 100644 index 00000000..2ed2dfde --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/CodedInputStream.php @@ -0,0 +1,382 @@ +buffer = $buffer; + $this->buffer_size_after_limit = 0; + $this->buffer_end = $end; + $this->current = $start; + $this->current_limit = $end; + $this->legitimate_message_end = false; + $this->recursion_budget = self::DEFAULT_RECURSION_LIMIT; + $this->recursion_limit = self::DEFAULT_RECURSION_LIMIT; + $this->total_bytes_limit = self::DEFAULT_TOTAL_BYTES_LIMIT; + $this->total_bytes_read = $end - $start; + } + + private function advance($amount) + { + $this->current += $amount; + } + + public function bufferSize() + { + return $this->buffer_end - $this->current; + } + + public function current() + { + return $this->total_bytes_read - + ($this->buffer_end - $this->current + + $this->buffer_size_after_limit); + } + + public function substr($start, $end) + { + return substr($this->buffer, $start, $end - $start); + } + + private function recomputeBufferLimits() + { + $this->buffer_end += $this->buffer_size_after_limit; + $closest_limit = min($this->current_limit, $this->total_bytes_limit); + if ($closest_limit < $this->total_bytes_read) { + // The limit position is in the current buffer. We must adjust the + // buffer size accordingly. + $this->buffer_size_after_limit = $this->total_bytes_read - + $closest_limit; + $this->buffer_end -= $this->buffer_size_after_limit; + } else { + $this->buffer_size_after_limit = 0; + } + } + + private function consumedEntireMessage() + { + return $this->legitimate_message_end; + } + + /** + * Read uint32 into $var. Advance buffer with consumed bytes. If the + * contained varint is larger than 32 bits, discard the high order bits. + * @param $var. + */ + public function readVarint32(&$var) + { + if (!$this->readVarint64($var)) { + return false; + } + + if (PHP_INT_SIZE == 4) { + $var = bcmod($var, 4294967296); + } else { + $var &= 0xFFFFFFFF; + } + + // Convert large uint32 to int32. + if ($var > 0x7FFFFFFF) { + if (PHP_INT_SIZE === 8) { + $var = $var | (0xFFFFFFFF << 32); + } else { + $var = bcsub($var, 4294967296); + } + } + + $var = intval($var); + return true; + } + + /** + * Read Uint64 into $var. Advance buffer with consumed bytes. + * @param $var. + */ + public function readVarint64(&$var) + { + $count = 0; + + if (PHP_INT_SIZE == 4) { + $high = 0; + $low = 0; + $b = 0; + + do { + if ($this->current === $this->buffer_end) { + return false; + } + if ($count === self::MAX_VARINT_BYTES) { + return false; + } + $b = ord($this->buffer[$this->current]); + $bits = 7 * $count; + if ($bits >= 32) { + $high |= (($b & 0x7F) << ($bits - 32)); + } else if ($bits > 25){ + // $bits is 28 in this case. + $low |= (($b & 0x7F) << 28); + $high = ($b & 0x7F) >> 4; + } else { + $low |= (($b & 0x7F) << $bits); + } + + $this->advance(1); + $count += 1; + } while ($b & 0x80); + + $var = GPBUtil::combineInt32ToInt64($high, $low); + if (bccomp($var, 0) < 0) { + $var = bcadd($var, "18446744073709551616"); + } + } else { + $result = 0; + $shift = 0; + + do { + if ($this->current === $this->buffer_end) { + return false; + } + if ($count === self::MAX_VARINT_BYTES) { + return false; + } + + $byte = ord($this->buffer[$this->current]); + $result |= ($byte & 0x7f) << $shift; + $shift += 7; + $this->advance(1); + $count += 1; + } while ($byte > 0x7f); + + $var = $result; + } + + return true; + } + + /** + * Read int into $var. If the result is larger than the largest integer, $var + * will be -1. Advance buffer with consumed bytes. + * @param $var. + */ + public function readVarintSizeAsInt(&$var) + { + if (!$this->readVarint64($var)) { + return false; + } + $var = (int)$var; + return true; + } + + /** + * Read 32-bit unsigned integer to $var. If the buffer has less than 4 bytes, + * return false. Advance buffer with consumed bytes. + * @param $var. + */ + public function readLittleEndian32(&$var) + { + $data = null; + if (!$this->readRaw(4, $data)) { + return false; + } + $var = unpack('V', $data); + $var = $var[1]; + return true; + } + + /** + * Read 64-bit unsigned integer to $var. If the buffer has less than 8 bytes, + * return false. Advance buffer with consumed bytes. + * @param $var. + */ + public function readLittleEndian64(&$var) + { + $data = null; + if (!$this->readRaw(4, $data)) { + return false; + } + $low = unpack('V', $data)[1]; + if (!$this->readRaw(4, $data)) { + return false; + } + $high = unpack('V', $data)[1]; + if (PHP_INT_SIZE == 4) { + $var = GPBUtil::combineInt32ToInt64($high, $low); + } else { + $var = ($high << 32) | $low; + } + return true; + } + + /** + * Read tag into $var. Advance buffer with consumed bytes. + * @param $var. + */ + public function readTag() + { + if ($this->current === $this->buffer_end) { + // Make sure that it failed due to EOF, not because we hit + // total_bytes_limit, which, unlike normal limits, is not a valid + // place to end a message. + $current_position = $this->total_bytes_read - + $this->buffer_size_after_limit; + if ($current_position >= $this->total_bytes_limit) { + // Hit total_bytes_limit_. But if we also hit the normal limit, + // we're still OK. + $this->legitimate_message_end = + ($this->current_limit === $this->total_bytes_limit); + } else { + $this->legitimate_message_end = true; + } + return 0; + } + + $result = 0; + // The largest tag is 2^29 - 1, which can be represented by int32. + $success = $this->readVarint32($result); + if ($success) { + return $result; + } else { + return 0; + } + } + + public function readRaw($size, &$buffer) + { + $current_buffer_size = 0; + if ($this->bufferSize() < $size) { + return false; + } + + if ($size === 0) { + $buffer = ""; + } else { + $buffer = substr($this->buffer, $this->current, $size); + $this->advance($size); + } + + return true; + } + + /* Places a limit on the number of bytes that the stream may read, starting + * from the current position. Once the stream hits this limit, it will act + * like the end of the input has been reached until popLimit() is called. + * + * As the names imply, the stream conceptually has a stack of limits. The + * shortest limit on the stack is always enforced, even if it is not the top + * limit. + * + * The value returned by pushLimit() is opaque to the caller, and must be + * passed unchanged to the corresponding call to popLimit(). + * + * @param integer $byte_limit + * @throws \Exception Fail to push limit. + */ + public function pushLimit($byte_limit) + { + // Current position relative to the beginning of the stream. + $current_position = $this->current(); + $old_limit = $this->current_limit; + + // security: byte_limit is possibly evil, so check for negative values + // and overflow. + if ($byte_limit >= 0 && + $byte_limit <= PHP_INT_MAX - $current_position && + $byte_limit <= $this->current_limit - $current_position) { + $this->current_limit = $current_position + $byte_limit; + $this->recomputeBufferLimits(); + } else { + throw new GPBDecodeException("Fail to push limit."); + } + + return $old_limit; + } + + /* The limit passed in is actually the *old* limit, which we returned from + * PushLimit(). + * + * @param integer $byte_limit + */ + public function popLimit($byte_limit) + { + $this->current_limit = $byte_limit; + $this->recomputeBufferLimits(); + // We may no longer be at a legitimate message end. ReadTag() needs to + // be called again to find out. + $this->legitimate_message_end = false; + } + + public function incrementRecursionDepthAndPushLimit( + $byte_limit, &$old_limit, &$recursion_budget) + { + $old_limit = $this->pushLimit($byte_limit); + $recursion_limit = --$this->recursion_limit; + } + + public function decrementRecursionDepthAndPopLimit($byte_limit) + { + $result = $this->consumedEntireMessage(); + $this->popLimit($byte_limit); + ++$this->recursion_budget; + return $result; + } + + public function bytesUntilLimit() + { + if ($this->current_limit === PHP_INT_MAX) { + return -1; + } + return $this->current_limit - $this->current; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/CodedOutputStream.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/CodedOutputStream.php new file mode 100644 index 00000000..f75e9c66 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/CodedOutputStream.php @@ -0,0 +1,159 @@ +current = 0; + $this->buffer_size = $size; + $this->buffer = str_repeat(chr(0), $this->buffer_size); + } + + public function getData() + { + return $this->buffer; + } + + public function writeVarint32($value, $trim) + { + $bytes = str_repeat(chr(0), self::MAX_VARINT64_BYTES); + $size = self::writeVarintToArray($value, $bytes, $trim); + return $this->writeRaw($bytes, $size); + } + + public function writeVarint64($value) + { + $bytes = str_repeat(chr(0), self::MAX_VARINT64_BYTES); + $size = self::writeVarintToArray($value, $bytes); + return $this->writeRaw($bytes, $size); + } + + public function writeLittleEndian32($value) + { + $bytes = str_repeat(chr(0), 4); + $size = self::writeLittleEndian32ToArray($value, $bytes); + return $this->writeRaw($bytes, $size); + } + + public function writeLittleEndian64($value) + { + $bytes = str_repeat(chr(0), 8); + $size = self::writeLittleEndian64ToArray($value, $bytes); + return $this->writeRaw($bytes, $size); + } + + public function writeTag($tag) + { + return $this->writeVarint32($tag, true); + } + + public function writeRaw($data, $size) + { + if ($this->buffer_size < $size) { + trigger_error("Output stream doesn't have enough buffer."); + return false; + } + + for ($i = 0; $i < $size; $i++) { + $this->buffer[$this->current] = $data[$i]; + $this->current++; + $this->buffer_size--; + } + return true; + } + + public static function writeVarintToArray($value, &$buffer, $trim = false) + { + $current = 0; + + $high = 0; + $low = 0; + if (PHP_INT_SIZE == 4) { + GPBUtil::divideInt64ToInt32($value, $high, $low, $trim); + } else { + $low = $value; + } + + while (($low >= 0x80 || $low < 0) || $high != 0) { + $buffer[$current] = chr($low | 0x80); + $value = ($value >> 7) & ~(0x7F << ((PHP_INT_SIZE << 3) - 7)); + $carry = ($high & 0x7F) << ((PHP_INT_SIZE << 3) - 7); + $high = ($high >> 7) & ~(0x7F << ((PHP_INT_SIZE << 3) - 7)); + $low = (($low >> 7) & ~(0x7F << ((PHP_INT_SIZE << 3) - 7)) | $carry); + $current++; + } + $buffer[$current] = chr($low); + return $current + 1; + } + + private static function writeLittleEndian32ToArray($value, &$buffer) + { + $buffer[0] = chr($value & 0x000000FF); + $buffer[1] = chr(($value >> 8) & 0x000000FF); + $buffer[2] = chr(($value >> 16) & 0x000000FF); + $buffer[3] = chr(($value >> 24) & 0x000000FF); + return 4; + } + + private static function writeLittleEndian64ToArray($value, &$buffer) + { + $high = 0; + $low = 0; + if (PHP_INT_SIZE == 4) { + GPBUtil::divideInt64ToInt32($value, $high, $low); + } else { + $low = $value & 0xFFFFFFFF; + $high = ($value >> 32) & 0xFFFFFFFF; + } + + $buffer[0] = chr($low & 0x000000FF); + $buffer[1] = chr(($low >> 8) & 0x000000FF); + $buffer[2] = chr(($low >> 16) & 0x000000FF); + $buffer[3] = chr(($low >> 24) & 0x000000FF); + $buffer[4] = chr($high & 0x000000FF); + $buffer[5] = chr(($high >> 8) & 0x000000FF); + $buffer[6] = chr(($high >> 16) & 0x000000FF); + $buffer[7] = chr(($high >> 24) & 0x000000FF); + return 8; + } + +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/Descriptor.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/Descriptor.php new file mode 100644 index 00000000..a7f80d53 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/Descriptor.php @@ -0,0 +1,222 @@ +public_desc = new \Google\Protobuf\Descriptor($this); + } + + public function addOneofDecl($oneof) + { + $this->oneof_decl[] = $oneof; + } + + public function getOneofDecl() + { + return $this->oneof_decl; + } + + public function setFullName($full_name) + { + $this->full_name = $full_name; + } + + public function getFullName() + { + return $this->full_name; + } + + public function addField($field) + { + $this->field[$field->getNumber()] = $field; + $this->json_to_field[$field->getJsonName()] = $field; + $this->name_to_field[$field->getName()] = $field; + $this->index_to_field[] = $field; + } + + public function getField() + { + return $this->field; + } + + public function addNestedType($desc) + { + $this->nested_type[] = $desc; + } + + public function getNestedType() + { + return $this->nested_type; + } + + public function addEnumType($desc) + { + $this->enum_type[] = $desc; + } + + public function getEnumType() + { + return $this->enum_type; + } + + public function getFieldByNumber($number) + { + if (!isset($this->field[$number])) { + return NULL; + } else { + return $this->field[$number]; + } + } + + public function getFieldByJsonName($json_name) + { + if (!isset($this->json_to_field[$json_name])) { + return NULL; + } else { + return $this->json_to_field[$json_name]; + } + } + + public function getFieldByName($name) + { + if (!isset($this->name_to_field[$name])) { + return NULL; + } else { + return $this->name_to_field[$name]; + } + } + + public function getFieldByIndex($index) + { + if (count($this->index_to_field) <= $index) { + return NULL; + } else { + return $this->index_to_field[$index]; + } + } + + public function setClass($klass) + { + $this->klass = $klass; + } + + public function getClass() + { + return $this->klass; + } + + public function setLegacyClass($klass) + { + $this->legacy_klass = $klass; + } + + public function getLegacyClass() + { + return $this->legacy_klass; + } + + public function setOptions($options) + { + $this->options = $options; + } + + public function getOptions() + { + return $this->options; + } + + public static function buildFromProto($proto, $file_proto, $containing) + { + $desc = new Descriptor(); + + $message_name_without_package = ""; + $classname = ""; + $legacy_classname = ""; + $fullname = ""; + GPBUtil::getFullClassName( + $proto, + $containing, + $file_proto, + $message_name_without_package, + $classname, + $legacy_classname, + $fullname); + $desc->setFullName($fullname); + $desc->setClass($classname); + $desc->setLegacyClass($legacy_classname); + $desc->setOptions($proto->getOptions()); + + foreach ($proto->getField() as $field_proto) { + $desc->addField(FieldDescriptor::buildFromProto($field_proto)); + } + + // Handle nested types. + foreach ($proto->getNestedType() as $nested_proto) { + $desc->addNestedType(Descriptor::buildFromProto( + $nested_proto, $file_proto, $message_name_without_package)); + } + + // Handle nested enum. + foreach ($proto->getEnumType() as $enum_proto) { + $desc->addEnumType(EnumDescriptor::buildFromProto( + $enum_proto, $file_proto, $message_name_without_package)); + } + + // Handle oneof fields. + $index = 0; + foreach ($proto->getOneofDecl() as $oneof_proto) { + $desc->addOneofDecl( + OneofDescriptor::buildFromProto($oneof_proto, $desc, $index)); + $index++; + } + + return $desc; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorPool.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorPool.php new file mode 100644 index 00000000..2880cee6 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorPool.php @@ -0,0 +1,193 @@ +mergeFromString($data); + + foreach($files->getFile() as $file_proto) { + $file = FileDescriptor::buildFromProto($file_proto); + + foreach ($file->getMessageType() as $desc) { + $this->addDescriptor($desc); + } + unset($desc); + + foreach ($file->getEnumType() as $desc) { + $this->addEnumDescriptor($desc); + } + unset($desc); + + foreach ($file->getMessageType() as $desc) { + $this->crossLink($desc); + } + unset($desc); + } + } + + public function addMessage($name, $klass) + { + return new MessageBuilderContext($name, $klass, $this); + } + + public function addEnum($name, $klass) + { + return new EnumBuilderContext($name, $klass, $this); + } + + public function addDescriptor($descriptor) + { + $this->proto_to_class[$descriptor->getFullName()] = + $descriptor->getClass(); + $this->class_to_desc[$descriptor->getClass()] = $descriptor; + $this->class_to_desc[$descriptor->getLegacyClass()] = $descriptor; + foreach ($descriptor->getNestedType() as $nested_type) { + $this->addDescriptor($nested_type); + } + foreach ($descriptor->getEnumType() as $enum_type) { + $this->addEnumDescriptor($enum_type); + } + } + + public function addEnumDescriptor($descriptor) + { + $this->proto_to_class[$descriptor->getFullName()] = + $descriptor->getClass(); + $this->class_to_enum_desc[$descriptor->getClass()] = $descriptor; + $this->class_to_enum_desc[$descriptor->getLegacyClass()] = $descriptor; + } + + public function getDescriptorByClassName($klass) + { + if (isset($this->class_to_desc[$klass])) { + return $this->class_to_desc[$klass]; + } else { + return null; + } + } + + public function getEnumDescriptorByClassName($klass) + { + if (isset($this->class_to_enum_desc[$klass])) { + return $this->class_to_enum_desc[$klass]; + } else { + return null; + } + } + + public function getDescriptorByProtoName($proto) + { + if (isset($this->proto_to_class[$proto])) { + $klass = $this->proto_to_class[$proto]; + return $this->class_to_desc[$klass]; + } else { + return null; + } + } + + public function getEnumDescriptorByProtoName($proto) + { + $klass = $this->proto_to_class[$proto]; + return $this->class_to_enum_desc[$klass]; + } + + private function crossLink(Descriptor $desc) + { + foreach ($desc->getField() as $field) { + switch ($field->getType()) { + case GPBType::MESSAGE: + $proto = $field->getMessageType(); + if ($proto[0] == '.') { + $proto = substr($proto, 1); + } + $subdesc = $this->getDescriptorByProtoName($proto); + if (is_null($subdesc)) { + trigger_error( + 'proto not added: ' . $proto + . " for " . $desc->getFullName(), E_ERROR); + } + $field->setMessageType($subdesc); + break; + case GPBType::ENUM: + $proto = $field->getEnumType(); + if ($proto[0] == '.') { + $proto = substr($proto, 1); + } + $field->setEnumType( + $this->getEnumDescriptorByProtoName($proto)); + break; + default: + break; + } + } + unset($field); + + foreach ($desc->getNestedType() as $nested_type) { + $this->crossLink($nested_type); + } + unset($nested_type); + } + + public function finish() + { + foreach ($this->class_to_desc as $klass => $desc) { + $this->crossLink($desc); + } + unset($desc); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorProto.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorProto.php new file mode 100644 index 00000000..c58c5739 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorProto.php @@ -0,0 +1,336 @@ +google.protobuf.DescriptorProto + */ +class DescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field optional string name = 1; + */ + protected $name = null; + /** + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto field = 2; + */ + private $field; + /** + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 6; + */ + private $extension; + /** + * Generated from protobuf field repeated .google.protobuf.DescriptorProto nested_type = 3; + */ + private $nested_type; + /** + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + */ + private $enum_type; + /** + * Generated from protobuf field repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + */ + private $extension_range; + /** + * Generated from protobuf field repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + */ + private $oneof_decl; + /** + * Generated from protobuf field optional .google.protobuf.MessageOptions options = 7; + */ + protected $options = null; + /** + * Generated from protobuf field repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + */ + private $reserved_range; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + * + * Generated from protobuf field repeated string reserved_name = 10; + */ + private $reserved_name; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $field + * @type \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $extension + * @type \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $nested_type + * @type \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $enum_type + * @type \Google\Protobuf\Internal\DescriptorProto\ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $extension_range + * @type \Google\Protobuf\Internal\OneofDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $oneof_decl + * @type \Google\Protobuf\Internal\MessageOptions $options + * @type \Google\Protobuf\Internal\DescriptorProto\ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range + * @type string[]|\Google\Protobuf\Internal\RepeatedField $reserved_name + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field optional string name = 1; + * @return string + */ + public function getName() + { + return isset($this->name) ? $this->name : ''; + } + + public function hasName() + { + return isset($this->name); + } + + public function clearName() + { + unset($this->name); + } + + /** + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto field = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getField() + { + return $this->field; + } + + /** + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto field = 2; + * @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setField($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); + $this->field = $arr; + + return $this; + } + + /** + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExtension() + { + return $this->extension; + } + + /** + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 6; + * @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExtension($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); + $this->extension = $arr; + + return $this; + } + + /** + * Generated from protobuf field repeated .google.protobuf.DescriptorProto nested_type = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNestedType() + { + return $this->nested_type; + } + + /** + * Generated from protobuf field repeated .google.protobuf.DescriptorProto nested_type = 3; + * @param \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNestedType($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); + $this->nested_type = $arr; + + return $this; + } + + /** + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEnumType() + { + return $this->enum_type; + } + + /** + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + * @param \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEnumType($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); + $this->enum_type = $arr; + + return $this; + } + + /** + * Generated from protobuf field repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExtensionRange() + { + return $this->extension_range; + } + + /** + * Generated from protobuf field repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + * @param \Google\Protobuf\Internal\DescriptorProto\ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExtensionRange($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto\ExtensionRange::class); + $this->extension_range = $arr; + + return $this; + } + + /** + * Generated from protobuf field repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOneofDecl() + { + return $this->oneof_decl; + } + + /** + * Generated from protobuf field repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + * @param \Google\Protobuf\Internal\OneofDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOneofDecl($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\OneofDescriptorProto::class); + $this->oneof_decl = $arr; + + return $this; + } + + /** + * Generated from protobuf field optional .google.protobuf.MessageOptions options = 7; + * @return \Google\Protobuf\Internal\MessageOptions|null + */ + public function getOptions() + { + return $this->options; + } + + public function hasOptions() + { + return isset($this->options); + } + + public function clearOptions() + { + unset($this->options); + } + + /** + * Generated from protobuf field optional .google.protobuf.MessageOptions options = 7; + * @param \Google\Protobuf\Internal\MessageOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\MessageOptions::class); + $this->options = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReservedRange() + { + return $this->reserved_range; + } + + /** + * Generated from protobuf field repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + * @param \Google\Protobuf\Internal\DescriptorProto\ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReservedRange($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto\ReservedRange::class); + $this->reserved_range = $arr; + + return $this; + } + + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + * + * Generated from protobuf field repeated string reserved_name = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReservedName() + { + return $this->reserved_name; + } + + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + * + * Generated from protobuf field repeated string reserved_name = 10; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReservedName($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->reserved_name = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php new file mode 100644 index 00000000..43c33c4a --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php @@ -0,0 +1,161 @@ +google.protobuf.DescriptorProto.ExtensionRange + */ +class ExtensionRange extends \Google\Protobuf\Internal\Message +{ + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + */ + protected $start = null; + /** + * Exclusive. + * + * Generated from protobuf field optional int32 end = 2; + */ + protected $end = null; + /** + * Generated from protobuf field optional .google.protobuf.ExtensionRangeOptions options = 3; + */ + protected $options = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $start + * Inclusive. + * @type int $end + * Exclusive. + * @type \Google\Protobuf\Internal\ExtensionRangeOptions $options + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + * @return int + */ + public function getStart() + { + return isset($this->start) ? $this->start : 0; + } + + public function hasStart() + { + return isset($this->start); + } + + public function clearStart() + { + unset($this->start); + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + * @param int $var + * @return $this + */ + public function setStart($var) + { + GPBUtil::checkInt32($var); + $this->start = $var; + + return $this; + } + + /** + * Exclusive. + * + * Generated from protobuf field optional int32 end = 2; + * @return int + */ + public function getEnd() + { + return isset($this->end) ? $this->end : 0; + } + + public function hasEnd() + { + return isset($this->end); + } + + public function clearEnd() + { + unset($this->end); + } + + /** + * Exclusive. + * + * Generated from protobuf field optional int32 end = 2; + * @param int $var + * @return $this + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + + return $this; + } + + /** + * Generated from protobuf field optional .google.protobuf.ExtensionRangeOptions options = 3; + * @return \Google\Protobuf\Internal\ExtensionRangeOptions|null + */ + public function getOptions() + { + return $this->options; + } + + public function hasOptions() + { + return isset($this->options); + } + + public function clearOptions() + { + unset($this->options); + } + + /** + * Generated from protobuf field optional .google.protobuf.ExtensionRangeOptions options = 3; + * @param \Google\Protobuf\Internal\ExtensionRangeOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\ExtensionRangeOptions::class); + $this->options = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ExtensionRange::class, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php new file mode 100644 index 00000000..f099cc34 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php @@ -0,0 +1,128 @@ +google.protobuf.DescriptorProto.ReservedRange + */ +class ReservedRange extends \Google\Protobuf\Internal\Message +{ + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + */ + protected $start = null; + /** + * Exclusive. + * + * Generated from protobuf field optional int32 end = 2; + */ + protected $end = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $start + * Inclusive. + * @type int $end + * Exclusive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + * @return int + */ + public function getStart() + { + return isset($this->start) ? $this->start : 0; + } + + public function hasStart() + { + return isset($this->start); + } + + public function clearStart() + { + unset($this->start); + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + * @param int $var + * @return $this + */ + public function setStart($var) + { + GPBUtil::checkInt32($var); + $this->start = $var; + + return $this; + } + + /** + * Exclusive. + * + * Generated from protobuf field optional int32 end = 2; + * @return int + */ + public function getEnd() + { + return isset($this->end) ? $this->end : 0; + } + + public function hasEnd() + { + return isset($this->end); + } + + public function clearEnd() + { + unset($this->end); + } + + /** + * Exclusive. + * + * Generated from protobuf field optional int32 end = 2; + * @param int $var + * @return $this + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReservedRange::class, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php new file mode 100644 index 00000000..c928fbe5 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php @@ -0,0 +1,16 @@ +descriptor = new EnumDescriptor(); + $this->descriptor->setFullName($full_name); + $this->descriptor->setClass($klass); + $this->pool = $pool; + } + + public function value($name, $number) + { + $value = new EnumValueDescriptor($name, $number); + $this->descriptor->addValue($number, $value); + return $this; + } + + public function finalizeToPool() + { + $this->pool->addEnumDescriptor($this->descriptor); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumDescriptor.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumDescriptor.php new file mode 100644 index 00000000..7af4f840 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumDescriptor.php @@ -0,0 +1,115 @@ +public_desc = new \Google\Protobuf\EnumDescriptor($this); + } + + public function setFullName($full_name) + { + $this->full_name = $full_name; + } + + public function getFullName() + { + return $this->full_name; + } + + public function addValue($number, $value) + { + $this->value[$number] = $value; + $this->name_to_value[$value->getName()] = $value; + $this->value_descriptor[] = new EnumValueDescriptor($value->getName(), $number); + } + + public function getValueByNumber($number) + { + if (isset($this->value[$number])) { + return $this->value[$number]; + } + return null; + } + + public function getValueByName($name) + { + if (isset($this->name_to_value[$name])) { + return $this->name_to_value[$name]; + } + return null; + } + + public function getValueDescriptorByIndex($index) + { + if (isset($this->value_descriptor[$index])) { + return $this->value_descriptor[$index]; + } + return null; + } + + public function getValueCount() + { + return count($this->value); + } + + public function setClass($klass) + { + $this->klass = $klass; + } + + public function getClass() + { + return $this->klass; + } + + public function setLegacyClass($klass) + { + $this->legacy_klass = $klass; + } + + public function getLegacyClass() + { + return $this->legacy_klass; + } + + public static function buildFromProto($proto, $file_proto, $containing) + { + $desc = new EnumDescriptor(); + + $enum_name_without_package = ""; + $classname = ""; + $legacy_classname = ""; + $fullname = ""; + GPBUtil::getFullClassName( + $proto, + $containing, + $file_proto, + $enum_name_without_package, + $classname, + $legacy_classname, + $fullname); + $desc->setFullName($fullname); + $desc->setClass($classname); + $desc->setLegacyClass($legacy_classname); + $values = $proto->getValue(); + foreach ($values as $value) { + $desc->addValue($value->getNumber(), $value); + } + + return $desc; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumDescriptorProto.php new file mode 100644 index 00000000..bd50834f --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumDescriptorProto.php @@ -0,0 +1,216 @@ +google.protobuf.EnumDescriptorProto + */ +class EnumDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field optional string name = 1; + */ + protected $name = null; + /** + * Generated from protobuf field repeated .google.protobuf.EnumValueDescriptorProto value = 2; + */ + private $value; + /** + * Generated from protobuf field optional .google.protobuf.EnumOptions options = 3; + */ + protected $options = null; + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + * + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; + */ + private $reserved_range; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + * + * Generated from protobuf field repeated string reserved_name = 5; + */ + private $reserved_name; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type \Google\Protobuf\Internal\EnumValueDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $value + * @type \Google\Protobuf\Internal\EnumOptions $options + * @type \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $reserved_name + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field optional string name = 1; + * @return string + */ + public function getName() + { + return isset($this->name) ? $this->name : ''; + } + + public function hasName() + { + return isset($this->name); + } + + public function clearName() + { + unset($this->name); + } + + /** + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated .google.protobuf.EnumValueDescriptorProto value = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValue() + { + return $this->value; + } + + /** + * Generated from protobuf field repeated .google.protobuf.EnumValueDescriptorProto value = 2; + * @param \Google\Protobuf\Internal\EnumValueDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValue($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumValueDescriptorProto::class); + $this->value = $arr; + + return $this; + } + + /** + * Generated from protobuf field optional .google.protobuf.EnumOptions options = 3; + * @return \Google\Protobuf\Internal\EnumOptions|null + */ + public function getOptions() + { + return $this->options; + } + + public function hasOptions() + { + return isset($this->options); + } + + public function clearOptions() + { + unset($this->options); + } + + /** + * Generated from protobuf field optional .google.protobuf.EnumOptions options = 3; + * @param \Google\Protobuf\Internal\EnumOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumOptions::class); + $this->options = $var; + + return $this; + } + + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + * + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReservedRange() + { + return $this->reserved_range; + } + + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + * + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; + * @param \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReservedRange($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange::class); + $this->reserved_range = $arr; + + return $this; + } + + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + * + * Generated from protobuf field repeated string reserved_name = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReservedName() + { + return $this->reserved_name; + } + + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + * + * Generated from protobuf field repeated string reserved_name = 5; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReservedName($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->reserved_name = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php new file mode 100644 index 00000000..7282fccb --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php @@ -0,0 +1,130 @@ +google.protobuf.EnumDescriptorProto.EnumReservedRange + */ +class EnumReservedRange extends \Google\Protobuf\Internal\Message +{ + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + */ + protected $start = null; + /** + * Inclusive. + * + * Generated from protobuf field optional int32 end = 2; + */ + protected $end = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $start + * Inclusive. + * @type int $end + * Inclusive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + * @return int + */ + public function getStart() + { + return isset($this->start) ? $this->start : 0; + } + + public function hasStart() + { + return isset($this->start); + } + + public function clearStart() + { + unset($this->start); + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + * @param int $var + * @return $this + */ + public function setStart($var) + { + GPBUtil::checkInt32($var); + $this->start = $var; + + return $this; + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 end = 2; + * @return int + */ + public function getEnd() + { + return isset($this->end) ? $this->end : 0; + } + + public function hasEnd() + { + return isset($this->end); + } + + public function clearEnd() + { + unset($this->end); + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 end = 2; + * @param int $var + * @return $this + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EnumReservedRange::class, \Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php new file mode 100644 index 00000000..b1b59ed9 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php @@ -0,0 +1,16 @@ +google.protobuf.EnumOptions + */ +class EnumOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Set this option to true to allow mapping different tag names to the same + * value. + * + * Generated from protobuf field optional bool allow_alias = 2; + */ + protected $allow_alias = null; + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + * + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + */ + protected $deprecated = null; + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $allow_alias + * Set this option to true to allow mapping different tag names to the same + * value. + * @type bool $deprecated + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option + * The parser stores options it doesn't recognize here. See above. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Set this option to true to allow mapping different tag names to the same + * value. + * + * Generated from protobuf field optional bool allow_alias = 2; + * @return bool + */ + public function getAllowAlias() + { + return isset($this->allow_alias) ? $this->allow_alias : false; + } + + public function hasAllowAlias() + { + return isset($this->allow_alias); + } + + public function clearAllowAlias() + { + unset($this->allow_alias); + } + + /** + * Set this option to true to allow mapping different tag names to the same + * value. + * + * Generated from protobuf field optional bool allow_alias = 2; + * @param bool $var + * @return $this + */ + public function setAllowAlias($var) + { + GPBUtil::checkBool($var); + $this->allow_alias = $var; + + return $this; + } + + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + * + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + * @return bool + */ + public function getDeprecated() + { + return isset($this->deprecated) ? $this->deprecated : false; + } + + public function hasDeprecated() + { + return isset($this->deprecated); + } + + public function clearDeprecated() + { + unset($this->deprecated); + } + + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + * + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + * @param bool $var + * @return $this + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + + return $this; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUninterpretedOption($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php new file mode 100644 index 00000000..0feaea6f --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php @@ -0,0 +1,146 @@ +google.protobuf.EnumValueDescriptorProto + */ +class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field optional string name = 1; + */ + protected $name = null; + /** + * Generated from protobuf field optional int32 number = 2; + */ + protected $number = null; + /** + * Generated from protobuf field optional .google.protobuf.EnumValueOptions options = 3; + */ + protected $options = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type int $number + * @type \Google\Protobuf\Internal\EnumValueOptions $options + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field optional string name = 1; + * @return string + */ + public function getName() + { + return isset($this->name) ? $this->name : ''; + } + + public function hasName() + { + return isset($this->name); + } + + public function clearName() + { + unset($this->name); + } + + /** + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Generated from protobuf field optional int32 number = 2; + * @return int + */ + public function getNumber() + { + return isset($this->number) ? $this->number : 0; + } + + public function hasNumber() + { + return isset($this->number); + } + + public function clearNumber() + { + unset($this->number); + } + + /** + * Generated from protobuf field optional int32 number = 2; + * @param int $var + * @return $this + */ + public function setNumber($var) + { + GPBUtil::checkInt32($var); + $this->number = $var; + + return $this; + } + + /** + * Generated from protobuf field optional .google.protobuf.EnumValueOptions options = 3; + * @return \Google\Protobuf\Internal\EnumValueOptions|null + */ + public function getOptions() + { + return $this->options; + } + + public function hasOptions() + { + return isset($this->options); + } + + public function clearOptions() + { + unset($this->options); + } + + /** + * Generated from protobuf field optional .google.protobuf.EnumValueOptions options = 3; + * @param \Google\Protobuf\Internal\EnumValueOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumValueOptions::class); + $this->options = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumValueOptions.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumValueOptions.php new file mode 100644 index 00000000..84ba7bc8 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/EnumValueOptions.php @@ -0,0 +1,123 @@ +google.protobuf.EnumValueOptions + */ +class EnumValueOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + * + * Generated from protobuf field optional bool deprecated = 1 [default = false]; + */ + protected $deprecated = null; + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $deprecated + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option + * The parser stores options it doesn't recognize here. See above. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + * + * Generated from protobuf field optional bool deprecated = 1 [default = false]; + * @return bool + */ + public function getDeprecated() + { + return isset($this->deprecated) ? $this->deprecated : false; + } + + public function hasDeprecated() + { + return isset($this->deprecated); + } + + public function clearDeprecated() + { + unset($this->deprecated); + } + + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + * + * Generated from protobuf field optional bool deprecated = 1 [default = false]; + * @param bool $var + * @return $this + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + + return $this; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUninterpretedOption($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/ExtensionRangeOptions.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/ExtensionRangeOptions.php new file mode 100644 index 00000000..b5e27c3e --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/ExtensionRangeOptions.php @@ -0,0 +1,67 @@ +google.protobuf.ExtensionRangeOptions + */ +class ExtensionRangeOptions extends \Google\Protobuf\Internal\Message +{ + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option + * The parser stores options it doesn't recognize here. See above. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUninterpretedOption($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptor.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptor.php new file mode 100644 index 00000000..ce83f63a --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptor.php @@ -0,0 +1,294 @@ +public_desc = new \Google\Protobuf\FieldDescriptor($this); + } + + public function setOneofIndex($index) + { + $this->oneof_index = $index; + } + + public function getOneofIndex() + { + return $this->oneof_index; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function setJsonName($json_name) + { + $this->json_name = $json_name; + } + + public function getJsonName() + { + return $this->json_name; + } + + public function setSetter($setter) + { + $this->setter = $setter; + } + + public function getSetter() + { + return $this->setter; + } + + public function setGetter($getter) + { + $this->getter = $getter; + } + + public function getGetter() + { + return $this->getter; + } + + public function setNumber($number) + { + $this->number = $number; + } + + public function getNumber() + { + return $this->number; + } + + public function setLabel($label) + { + $this->label = $label; + } + + public function getLabel() + { + return $this->label; + } + + public function isRepeated() + { + return $this->label === GPBLabel::REPEATED; + } + + public function setType($type) + { + $this->type = $type; + } + + public function getType() + { + return $this->type; + } + + public function setMessageType($message_type) + { + $this->message_type = $message_type; + } + + public function getMessageType() + { + return $this->message_type; + } + + public function setEnumType($enum_type) + { + $this->enum_type = $enum_type; + } + + public function getEnumType() + { + return $this->enum_type; + } + + public function setPacked($packed) + { + $this->packed = $packed; + } + + public function getPacked() + { + return $this->packed; + } + + public function isPackable() + { + return $this->isRepeated() && self::isTypePackable($this->type); + } + + public function isMap() + { + return $this->getType() == GPBType::MESSAGE && + !is_null($this->getMessageType()->getOptions()) && + $this->getMessageType()->getOptions()->getMapEntry(); + } + + public function isTimestamp() + { + return $this->getType() == GPBType::MESSAGE && + $this->getMessageType()->getClass() === "Google\Protobuf\Timestamp"; + } + + public function isWrapperType() + { + if ($this->getType() == GPBType::MESSAGE) { + $class = $this->getMessageType()->getClass(); + return in_array($class, [ + "Google\Protobuf\DoubleValue", + "Google\Protobuf\FloatValue", + "Google\Protobuf\Int64Value", + "Google\Protobuf\UInt64Value", + "Google\Protobuf\Int32Value", + "Google\Protobuf\UInt32Value", + "Google\Protobuf\BoolValue", + "Google\Protobuf\StringValue", + "Google\Protobuf\BytesValue", + ]); + } + return false; + } + + private static function isTypePackable($field_type) + { + return ($field_type !== GPBType::STRING && + $field_type !== GPBType::GROUP && + $field_type !== GPBType::MESSAGE && + $field_type !== GPBType::BYTES); + } + + public static function getFieldDescriptor($proto) + { + $type_name = null; + $type = $proto->getType(); + switch ($type) { + case GPBType::MESSAGE: + case GPBType::GROUP: + case GPBType::ENUM: + $type_name = $proto->getTypeName(); + break; + default: + break; + } + + $oneof_index = $proto->hasOneofIndex() ? $proto->getOneofIndex() : -1; + // TODO: once proto2 is supported, this default should be false + // for proto2. + if ($proto->getLabel() === GPBLabel::REPEATED && + $proto->getType() !== GPBType::MESSAGE && + $proto->getType() !== GPBType::GROUP && + $proto->getType() !== GPBType::STRING && + $proto->getType() !== GPBType::BYTES) { + $packed = true; + } else { + $packed = false; + } + $options = $proto->getOptions(); + if ($options !== null) { + $packed = $options->getPacked(); + } + + $field = new FieldDescriptor(); + $field->setName($proto->getName()); + + $json_name = $proto->hasJsonName() ? $proto->getJsonName() : + lcfirst(implode('', array_map('ucwords', explode('_', $proto->getName())))); + if ($proto->hasJsonName()) { + $json_name = $proto->getJsonName(); + } else { + $proto_name = $proto->getName(); + $json_name = implode('', array_map('ucwords', explode('_', $proto_name))); + if ($proto_name[0] !== "_" && !ctype_upper($proto_name[0])) { + $json_name = lcfirst($json_name); + } + } + $field->setJsonName($json_name); + + $camel_name = implode('', array_map('ucwords', explode('_', $proto->getName()))); + $field->setGetter('get' . $camel_name); + $field->setSetter('set' . $camel_name); + $field->setType($proto->getType()); + $field->setNumber($proto->getNumber()); + $field->setLabel($proto->getLabel()); + $field->setPacked($packed); + $field->setOneofIndex($oneof_index); + + // At this time, the message/enum type may have not been added to pool. + // So we use the type name as place holder and will replace it with the + // actual descriptor in cross building. + switch ($type) { + case GPBType::MESSAGE: + $field->setMessageType($type_name); + break; + case GPBType::ENUM: + $field->setEnumType($type_name); + break; + default: + break; + } + + return $field; + } + + public static function buildFromProto($proto) + { + return FieldDescriptor::getFieldDescriptor($proto); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptorProto.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptorProto.php new file mode 100644 index 00000000..9cf6f10c --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptorProto.php @@ -0,0 +1,615 @@ +google.protobuf.FieldDescriptorProto + */ +class FieldDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field optional string name = 1; + */ + protected $name = null; + /** + * Generated from protobuf field optional int32 number = 3; + */ + protected $number = null; + /** + * Generated from protobuf field optional .google.protobuf.FieldDescriptorProto.Label label = 4; + */ + protected $label = null; + /** + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + * + * Generated from protobuf field optional .google.protobuf.FieldDescriptorProto.Type type = 5; + */ + protected $type = null; + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + * + * Generated from protobuf field optional string type_name = 6; + */ + protected $type_name = null; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + * + * Generated from protobuf field optional string extendee = 2; + */ + protected $extendee = null; + /** + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + * TODO(kenton): Base-64 encode? + * + * Generated from protobuf field optional string default_value = 7; + */ + protected $default_value = null; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + * + * Generated from protobuf field optional int32 oneof_index = 9; + */ + protected $oneof_index = null; + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + * + * Generated from protobuf field optional string json_name = 10; + */ + protected $json_name = null; + /** + * Generated from protobuf field optional .google.protobuf.FieldOptions options = 8; + */ + protected $options = null; + /** + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. + * When proto3_optional is true, this field must be belong to a oneof to + * signal to old proto3 clients that presence is tracked for this field. This + * oneof is known as a "synthetic" oneof, and this field must be its sole + * member (each proto3 optional field gets its own synthetic oneof). Synthetic + * oneofs exist in the descriptor only, and do not generate any API. Synthetic + * oneofs must be ordered after all "real" oneofs. + * For message fields, proto3_optional doesn't create any semantic change, + * since non-repeated message fields always track presence. However it still + * indicates the semantic detail of whether the user wrote "optional" or not. + * This can be useful for round-tripping the .proto file. For consistency we + * give message fields a synthetic oneof also, even though it is not required + * to track presence. This is especially important because the parser can't + * tell if a field is a message or an enum, so it must always create a + * synthetic oneof. + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. + * + * Generated from protobuf field optional bool proto3_optional = 17; + */ + protected $proto3_optional = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type int $number + * @type int $label + * @type int $type + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + * @type string $type_name + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + * @type string $extendee + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + * @type string $default_value + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + * TODO(kenton): Base-64 encode? + * @type int $oneof_index + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + * @type string $json_name + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + * @type \Google\Protobuf\Internal\FieldOptions $options + * @type bool $proto3_optional + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. + * When proto3_optional is true, this field must be belong to a oneof to + * signal to old proto3 clients that presence is tracked for this field. This + * oneof is known as a "synthetic" oneof, and this field must be its sole + * member (each proto3 optional field gets its own synthetic oneof). Synthetic + * oneofs exist in the descriptor only, and do not generate any API. Synthetic + * oneofs must be ordered after all "real" oneofs. + * For message fields, proto3_optional doesn't create any semantic change, + * since non-repeated message fields always track presence. However it still + * indicates the semantic detail of whether the user wrote "optional" or not. + * This can be useful for round-tripping the .proto file. For consistency we + * give message fields a synthetic oneof also, even though it is not required + * to track presence. This is especially important because the parser can't + * tell if a field is a message or an enum, so it must always create a + * synthetic oneof. + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field optional string name = 1; + * @return string + */ + public function getName() + { + return isset($this->name) ? $this->name : ''; + } + + public function hasName() + { + return isset($this->name); + } + + public function clearName() + { + unset($this->name); + } + + /** + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Generated from protobuf field optional int32 number = 3; + * @return int + */ + public function getNumber() + { + return isset($this->number) ? $this->number : 0; + } + + public function hasNumber() + { + return isset($this->number); + } + + public function clearNumber() + { + unset($this->number); + } + + /** + * Generated from protobuf field optional int32 number = 3; + * @param int $var + * @return $this + */ + public function setNumber($var) + { + GPBUtil::checkInt32($var); + $this->number = $var; + + return $this; + } + + /** + * Generated from protobuf field optional .google.protobuf.FieldDescriptorProto.Label label = 4; + * @return int + */ + public function getLabel() + { + return isset($this->label) ? $this->label : 0; + } + + public function hasLabel() + { + return isset($this->label); + } + + public function clearLabel() + { + unset($this->label); + } + + /** + * Generated from protobuf field optional .google.protobuf.FieldDescriptorProto.Label label = 4; + * @param int $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto\Label::class); + $this->label = $var; + + return $this; + } + + /** + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + * + * Generated from protobuf field optional .google.protobuf.FieldDescriptorProto.Type type = 5; + * @return int + */ + public function getType() + { + return isset($this->type) ? $this->type : 0; + } + + public function hasType() + { + return isset($this->type); + } + + public function clearType() + { + unset($this->type); + } + + /** + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + * + * Generated from protobuf field optional .google.protobuf.FieldDescriptorProto.Type type = 5; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto\Type::class); + $this->type = $var; + + return $this; + } + + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + * + * Generated from protobuf field optional string type_name = 6; + * @return string + */ + public function getTypeName() + { + return isset($this->type_name) ? $this->type_name : ''; + } + + public function hasTypeName() + { + return isset($this->type_name); + } + + public function clearTypeName() + { + unset($this->type_name); + } + + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + * + * Generated from protobuf field optional string type_name = 6; + * @param string $var + * @return $this + */ + public function setTypeName($var) + { + GPBUtil::checkString($var, True); + $this->type_name = $var; + + return $this; + } + + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + * + * Generated from protobuf field optional string extendee = 2; + * @return string + */ + public function getExtendee() + { + return isset($this->extendee) ? $this->extendee : ''; + } + + public function hasExtendee() + { + return isset($this->extendee); + } + + public function clearExtendee() + { + unset($this->extendee); + } + + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + * + * Generated from protobuf field optional string extendee = 2; + * @param string $var + * @return $this + */ + public function setExtendee($var) + { + GPBUtil::checkString($var, True); + $this->extendee = $var; + + return $this; + } + + /** + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + * TODO(kenton): Base-64 encode? + * + * Generated from protobuf field optional string default_value = 7; + * @return string + */ + public function getDefaultValue() + { + return isset($this->default_value) ? $this->default_value : ''; + } + + public function hasDefaultValue() + { + return isset($this->default_value); + } + + public function clearDefaultValue() + { + unset($this->default_value); + } + + /** + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + * TODO(kenton): Base-64 encode? + * + * Generated from protobuf field optional string default_value = 7; + * @param string $var + * @return $this + */ + public function setDefaultValue($var) + { + GPBUtil::checkString($var, True); + $this->default_value = $var; + + return $this; + } + + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + * + * Generated from protobuf field optional int32 oneof_index = 9; + * @return int + */ + public function getOneofIndex() + { + return isset($this->oneof_index) ? $this->oneof_index : 0; + } + + public function hasOneofIndex() + { + return isset($this->oneof_index); + } + + public function clearOneofIndex() + { + unset($this->oneof_index); + } + + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + * + * Generated from protobuf field optional int32 oneof_index = 9; + * @param int $var + * @return $this + */ + public function setOneofIndex($var) + { + GPBUtil::checkInt32($var); + $this->oneof_index = $var; + + return $this; + } + + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + * + * Generated from protobuf field optional string json_name = 10; + * @return string + */ + public function getJsonName() + { + return isset($this->json_name) ? $this->json_name : ''; + } + + public function hasJsonName() + { + return isset($this->json_name); + } + + public function clearJsonName() + { + unset($this->json_name); + } + + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + * + * Generated from protobuf field optional string json_name = 10; + * @param string $var + * @return $this + */ + public function setJsonName($var) + { + GPBUtil::checkString($var, True); + $this->json_name = $var; + + return $this; + } + + /** + * Generated from protobuf field optional .google.protobuf.FieldOptions options = 8; + * @return \Google\Protobuf\Internal\FieldOptions|null + */ + public function getOptions() + { + return $this->options; + } + + public function hasOptions() + { + return isset($this->options); + } + + public function clearOptions() + { + unset($this->options); + } + + /** + * Generated from protobuf field optional .google.protobuf.FieldOptions options = 8; + * @param \Google\Protobuf\Internal\FieldOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FieldOptions::class); + $this->options = $var; + + return $this; + } + + /** + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. + * When proto3_optional is true, this field must be belong to a oneof to + * signal to old proto3 clients that presence is tracked for this field. This + * oneof is known as a "synthetic" oneof, and this field must be its sole + * member (each proto3 optional field gets its own synthetic oneof). Synthetic + * oneofs exist in the descriptor only, and do not generate any API. Synthetic + * oneofs must be ordered after all "real" oneofs. + * For message fields, proto3_optional doesn't create any semantic change, + * since non-repeated message fields always track presence. However it still + * indicates the semantic detail of whether the user wrote "optional" or not. + * This can be useful for round-tripping the .proto file. For consistency we + * give message fields a synthetic oneof also, even though it is not required + * to track presence. This is especially important because the parser can't + * tell if a field is a message or an enum, so it must always create a + * synthetic oneof. + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. + * + * Generated from protobuf field optional bool proto3_optional = 17; + * @return bool + */ + public function getProto3Optional() + { + return isset($this->proto3_optional) ? $this->proto3_optional : false; + } + + public function hasProto3Optional() + { + return isset($this->proto3_optional); + } + + public function clearProto3Optional() + { + unset($this->proto3_optional); + } + + /** + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. + * When proto3_optional is true, this field must be belong to a oneof to + * signal to old proto3 clients that presence is tracked for this field. This + * oneof is known as a "synthetic" oneof, and this field must be its sole + * member (each proto3 optional field gets its own synthetic oneof). Synthetic + * oneofs exist in the descriptor only, and do not generate any API. Synthetic + * oneofs must be ordered after all "real" oneofs. + * For message fields, proto3_optional doesn't create any semantic change, + * since non-repeated message fields always track presence. However it still + * indicates the semantic detail of whether the user wrote "optional" or not. + * This can be useful for round-tripping the .proto file. For consistency we + * give message fields a synthetic oneof also, even though it is not required + * to track presence. This is especially important because the parser can't + * tell if a field is a message or an enum, so it must always create a + * synthetic oneof. + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. + * + * Generated from protobuf field optional bool proto3_optional = 17; + * @param bool $var + * @return $this + */ + public function setProto3Optional($var) + { + GPBUtil::checkBool($var); + $this->proto3_optional = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php new file mode 100644 index 00000000..a54b228f --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php @@ -0,0 +1,58 @@ +google.protobuf.FieldDescriptorProto.Label + */ +class Label +{ + /** + * 0 is reserved for errors + * + * Generated from protobuf enum LABEL_OPTIONAL = 1; + */ + const LABEL_OPTIONAL = 1; + /** + * Generated from protobuf enum LABEL_REQUIRED = 2; + */ + const LABEL_REQUIRED = 2; + /** + * Generated from protobuf enum LABEL_REPEATED = 3; + */ + const LABEL_REPEATED = 3; + + private static $valueToName = [ + self::LABEL_OPTIONAL => 'LABEL_OPTIONAL', + self::LABEL_REQUIRED => 'LABEL_REQUIRED', + self::LABEL_REPEATED => 'LABEL_REPEATED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Label::class, \Google\Protobuf\Internal\FieldDescriptorProto_Label::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php new file mode 100644 index 00000000..6072e999 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php @@ -0,0 +1,153 @@ +google.protobuf.FieldDescriptorProto.Type + */ +class Type +{ + /** + * 0 is reserved for errors. + * Order is weird for historical reasons. + * + * Generated from protobuf enum TYPE_DOUBLE = 1; + */ + const TYPE_DOUBLE = 1; + /** + * Generated from protobuf enum TYPE_FLOAT = 2; + */ + const TYPE_FLOAT = 2; + /** + * Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + * + * Generated from protobuf enum TYPE_INT64 = 3; + */ + const TYPE_INT64 = 3; + /** + * Generated from protobuf enum TYPE_UINT64 = 4; + */ + const TYPE_UINT64 = 4; + /** + * Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + * + * Generated from protobuf enum TYPE_INT32 = 5; + */ + const TYPE_INT32 = 5; + /** + * Generated from protobuf enum TYPE_FIXED64 = 6; + */ + const TYPE_FIXED64 = 6; + /** + * Generated from protobuf enum TYPE_FIXED32 = 7; + */ + const TYPE_FIXED32 = 7; + /** + * Generated from protobuf enum TYPE_BOOL = 8; + */ + const TYPE_BOOL = 8; + /** + * Generated from protobuf enum TYPE_STRING = 9; + */ + const TYPE_STRING = 9; + /** + * Tag-delimited aggregate. + * Group type is deprecated and not supported in proto3. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. + * + * Generated from protobuf enum TYPE_GROUP = 10; + */ + const TYPE_GROUP = 10; + /** + * Length-delimited aggregate. + * + * Generated from protobuf enum TYPE_MESSAGE = 11; + */ + const TYPE_MESSAGE = 11; + /** + * New in version 2. + * + * Generated from protobuf enum TYPE_BYTES = 12; + */ + const TYPE_BYTES = 12; + /** + * Generated from protobuf enum TYPE_UINT32 = 13; + */ + const TYPE_UINT32 = 13; + /** + * Generated from protobuf enum TYPE_ENUM = 14; + */ + const TYPE_ENUM = 14; + /** + * Generated from protobuf enum TYPE_SFIXED32 = 15; + */ + const TYPE_SFIXED32 = 15; + /** + * Generated from protobuf enum TYPE_SFIXED64 = 16; + */ + const TYPE_SFIXED64 = 16; + /** + * Uses ZigZag encoding. + * + * Generated from protobuf enum TYPE_SINT32 = 17; + */ + const TYPE_SINT32 = 17; + /** + * Uses ZigZag encoding. + * + * Generated from protobuf enum TYPE_SINT64 = 18; + */ + const TYPE_SINT64 = 18; + + private static $valueToName = [ + self::TYPE_DOUBLE => 'TYPE_DOUBLE', + self::TYPE_FLOAT => 'TYPE_FLOAT', + self::TYPE_INT64 => 'TYPE_INT64', + self::TYPE_UINT64 => 'TYPE_UINT64', + self::TYPE_INT32 => 'TYPE_INT32', + self::TYPE_FIXED64 => 'TYPE_FIXED64', + self::TYPE_FIXED32 => 'TYPE_FIXED32', + self::TYPE_BOOL => 'TYPE_BOOL', + self::TYPE_STRING => 'TYPE_STRING', + self::TYPE_GROUP => 'TYPE_GROUP', + self::TYPE_MESSAGE => 'TYPE_MESSAGE', + self::TYPE_BYTES => 'TYPE_BYTES', + self::TYPE_UINT32 => 'TYPE_UINT32', + self::TYPE_ENUM => 'TYPE_ENUM', + self::TYPE_SFIXED32 => 'TYPE_SFIXED32', + self::TYPE_SFIXED64 => 'TYPE_SFIXED64', + self::TYPE_SINT32 => 'TYPE_SINT32', + self::TYPE_SINT64 => 'TYPE_SINT64', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Protobuf\Internal\FieldDescriptorProto_Type::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php new file mode 100644 index 00000000..218a846e --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php @@ -0,0 +1,16 @@ +google.protobuf.FieldOptions + */ +class FieldOptions extends \Google\Protobuf\Internal\Message +{ + /** + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! + * + * Generated from protobuf field optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + */ + protected $ctype = null; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. + * + * Generated from protobuf field optional bool packed = 2; + */ + protected $packed = null; + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + * + * Generated from protobuf field optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + */ + protected $jstype = null; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * Note that implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + * + * Generated from protobuf field optional bool lazy = 5 [default = false]; + */ + protected $lazy = null; + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + * + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + */ + protected $deprecated = null; + /** + * For Google-internal migration only. Do not use. + * + * Generated from protobuf field optional bool weak = 10 [default = false]; + */ + protected $weak = null; + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $ctype + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! + * @type bool $packed + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. + * @type int $jstype + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + * @type bool $lazy + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * Note that implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + * @type bool $deprecated + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + * @type bool $weak + * For Google-internal migration only. Do not use. + * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option + * The parser stores options it doesn't recognize here. See above. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! + * + * Generated from protobuf field optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + * @return int + */ + public function getCtype() + { + return isset($this->ctype) ? $this->ctype : 0; + } + + public function hasCtype() + { + return isset($this->ctype); + } + + public function clearCtype() + { + unset($this->ctype); + } + + /** + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! + * + * Generated from protobuf field optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + * @param int $var + * @return $this + */ + public function setCtype($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions\CType::class); + $this->ctype = $var; + + return $this; + } + + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. + * + * Generated from protobuf field optional bool packed = 2; + * @return bool + */ + public function getPacked() + { + return isset($this->packed) ? $this->packed : false; + } + + public function hasPacked() + { + return isset($this->packed); + } + + public function clearPacked() + { + unset($this->packed); + } + + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. + * + * Generated from protobuf field optional bool packed = 2; + * @param bool $var + * @return $this + */ + public function setPacked($var) + { + GPBUtil::checkBool($var); + $this->packed = $var; + + return $this; + } + + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + * + * Generated from protobuf field optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + * @return int + */ + public function getJstype() + { + return isset($this->jstype) ? $this->jstype : 0; + } + + public function hasJstype() + { + return isset($this->jstype); + } + + public function clearJstype() + { + unset($this->jstype); + } + + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + * + * Generated from protobuf field optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + * @param int $var + * @return $this + */ + public function setJstype($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions\JSType::class); + $this->jstype = $var; + + return $this; + } + + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * Note that implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + * + * Generated from protobuf field optional bool lazy = 5 [default = false]; + * @return bool + */ + public function getLazy() + { + return isset($this->lazy) ? $this->lazy : false; + } + + public function hasLazy() + { + return isset($this->lazy); + } + + public function clearLazy() + { + unset($this->lazy); + } + + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * Note that implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + * + * Generated from protobuf field optional bool lazy = 5 [default = false]; + * @param bool $var + * @return $this + */ + public function setLazy($var) + { + GPBUtil::checkBool($var); + $this->lazy = $var; + + return $this; + } + + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + * + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + * @return bool + */ + public function getDeprecated() + { + return isset($this->deprecated) ? $this->deprecated : false; + } + + public function hasDeprecated() + { + return isset($this->deprecated); + } + + public function clearDeprecated() + { + unset($this->deprecated); + } + + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + * + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + * @param bool $var + * @return $this + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + + return $this; + } + + /** + * For Google-internal migration only. Do not use. + * + * Generated from protobuf field optional bool weak = 10 [default = false]; + * @return bool + */ + public function getWeak() + { + return isset($this->weak) ? $this->weak : false; + } + + public function hasWeak() + { + return isset($this->weak); + } + + public function clearWeak() + { + unset($this->weak); + } + + /** + * For Google-internal migration only. Do not use. + * + * Generated from protobuf field optional bool weak = 10 [default = false]; + * @param bool $var + * @return $this + */ + public function setWeak($var) + { + GPBUtil::checkBool($var); + $this->weak = $var; + + return $this; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUninterpretedOption($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions/CType.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions/CType.php new file mode 100644 index 00000000..ba9eb4ad --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions/CType.php @@ -0,0 +1,58 @@ +google.protobuf.FieldOptions.CType + */ +class CType +{ + /** + * Default mode. + * + * Generated from protobuf enum STRING = 0; + */ + const STRING = 0; + /** + * Generated from protobuf enum CORD = 1; + */ + const CORD = 1; + /** + * Generated from protobuf enum STRING_PIECE = 2; + */ + const STRING_PIECE = 2; + + private static $valueToName = [ + self::STRING => 'STRING', + self::CORD => 'CORD', + self::STRING_PIECE => 'STRING_PIECE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CType::class, \Google\Protobuf\Internal\FieldOptions_CType::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions/JSType.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions/JSType.php new file mode 100644 index 00000000..175a4330 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions/JSType.php @@ -0,0 +1,62 @@ +google.protobuf.FieldOptions.JSType + */ +class JSType +{ + /** + * Use the default type. + * + * Generated from protobuf enum JS_NORMAL = 0; + */ + const JS_NORMAL = 0; + /** + * Use JavaScript strings. + * + * Generated from protobuf enum JS_STRING = 1; + */ + const JS_STRING = 1; + /** + * Use JavaScript numbers. + * + * Generated from protobuf enum JS_NUMBER = 2; + */ + const JS_NUMBER = 2; + + private static $valueToName = [ + self::JS_NORMAL => 'JS_NORMAL', + self::JS_STRING => 'JS_STRING', + self::JS_NUMBER => 'JS_NUMBER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(JSType::class, \Google\Protobuf\Internal\FieldOptions_JSType::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions_CType.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions_CType.php new file mode 100644 index 00000000..4d18783e --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FieldOptions_CType.php @@ -0,0 +1,16 @@ +package = $package; + } + + public function getPackage() + { + return $this->package; + } + + public function getMessageType() + { + return $this->message_type; + } + + public function addMessageType($desc) + { + $this->message_type[] = $desc; + } + + public function getEnumType() + { + return $this->enum_type; + } + + public function addEnumType($desc) + { + $this->enum_type[]= $desc; + } + + public static function buildFromProto($proto) + { + $file = new FileDescriptor(); + $file->setPackage($proto->getPackage()); + foreach ($proto->getMessageType() as $message_proto) { + $file->addMessageType(Descriptor::buildFromProto( + $message_proto, $proto, "")); + } + foreach ($proto->getEnumType() as $enum_proto) { + $file->addEnumType( + EnumDescriptor::buildFromProto( + $enum_proto, + $proto, + "")); + } + return $file; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FileDescriptorProto.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FileDescriptorProto.php new file mode 100644 index 00000000..435bd5fb --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FileDescriptorProto.php @@ -0,0 +1,485 @@ +google.protobuf.FileDescriptorProto + */ +class FileDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * file name, relative to root of source tree + * + * Generated from protobuf field optional string name = 1; + */ + protected $name = null; + /** + * e.g. "foo", "foo.bar", etc. + * + * Generated from protobuf field optional string package = 2; + */ + protected $package = null; + /** + * Names of files imported by this file. + * + * Generated from protobuf field repeated string dependency = 3; + */ + private $dependency; + /** + * Indexes of the public imported files in the dependency list above. + * + * Generated from protobuf field repeated int32 public_dependency = 10; + */ + private $public_dependency; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + * + * Generated from protobuf field repeated int32 weak_dependency = 11; + */ + private $weak_dependency; + /** + * All top-level definitions in this file. + * + * Generated from protobuf field repeated .google.protobuf.DescriptorProto message_type = 4; + */ + private $message_type; + /** + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + */ + private $enum_type; + /** + * Generated from protobuf field repeated .google.protobuf.ServiceDescriptorProto service = 6; + */ + private $service; + /** + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 7; + */ + private $extension; + /** + * Generated from protobuf field optional .google.protobuf.FileOptions options = 8; + */ + protected $options = null; + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + * + * Generated from protobuf field optional .google.protobuf.SourceCodeInfo source_code_info = 9; + */ + protected $source_code_info = null; + /** + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + * + * Generated from protobuf field optional string syntax = 12; + */ + protected $syntax = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * file name, relative to root of source tree + * @type string $package + * e.g. "foo", "foo.bar", etc. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $dependency + * Names of files imported by this file. + * @type int[]|\Google\Protobuf\Internal\RepeatedField $public_dependency + * Indexes of the public imported files in the dependency list above. + * @type int[]|\Google\Protobuf\Internal\RepeatedField $weak_dependency + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + * @type \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $message_type + * All top-level definitions in this file. + * @type \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $enum_type + * @type \Google\Protobuf\Internal\ServiceDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $service + * @type \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $extension + * @type \Google\Protobuf\Internal\FileOptions $options + * @type \Google\Protobuf\Internal\SourceCodeInfo $source_code_info + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + * @type string $syntax + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * file name, relative to root of source tree + * + * Generated from protobuf field optional string name = 1; + * @return string + */ + public function getName() + { + return isset($this->name) ? $this->name : ''; + } + + public function hasName() + { + return isset($this->name); + } + + public function clearName() + { + unset($this->name); + } + + /** + * file name, relative to root of source tree + * + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * e.g. "foo", "foo.bar", etc. + * + * Generated from protobuf field optional string package = 2; + * @return string + */ + public function getPackage() + { + return isset($this->package) ? $this->package : ''; + } + + public function hasPackage() + { + return isset($this->package); + } + + public function clearPackage() + { + unset($this->package); + } + + /** + * e.g. "foo", "foo.bar", etc. + * + * Generated from protobuf field optional string package = 2; + * @param string $var + * @return $this + */ + public function setPackage($var) + { + GPBUtil::checkString($var, True); + $this->package = $var; + + return $this; + } + + /** + * Names of files imported by this file. + * + * Generated from protobuf field repeated string dependency = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDependency() + { + return $this->dependency; + } + + /** + * Names of files imported by this file. + * + * Generated from protobuf field repeated string dependency = 3; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDependency($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->dependency = $arr; + + return $this; + } + + /** + * Indexes of the public imported files in the dependency list above. + * + * Generated from protobuf field repeated int32 public_dependency = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPublicDependency() + { + return $this->public_dependency; + } + + /** + * Indexes of the public imported files in the dependency list above. + * + * Generated from protobuf field repeated int32 public_dependency = 10; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPublicDependency($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->public_dependency = $arr; + + return $this; + } + + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + * + * Generated from protobuf field repeated int32 weak_dependency = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWeakDependency() + { + return $this->weak_dependency; + } + + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + * + * Generated from protobuf field repeated int32 weak_dependency = 11; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWeakDependency($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->weak_dependency = $arr; + + return $this; + } + + /** + * All top-level definitions in this file. + * + * Generated from protobuf field repeated .google.protobuf.DescriptorProto message_type = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMessageType() + { + return $this->message_type; + } + + /** + * All top-level definitions in this file. + * + * Generated from protobuf field repeated .google.protobuf.DescriptorProto message_type = 4; + * @param \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMessageType($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); + $this->message_type = $arr; + + return $this; + } + + /** + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEnumType() + { + return $this->enum_type; + } + + /** + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + * @param \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEnumType($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); + $this->enum_type = $arr; + + return $this; + } + + /** + * Generated from protobuf field repeated .google.protobuf.ServiceDescriptorProto service = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getService() + { + return $this->service; + } + + /** + * Generated from protobuf field repeated .google.protobuf.ServiceDescriptorProto service = 6; + * @param \Google\Protobuf\Internal\ServiceDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setService($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\ServiceDescriptorProto::class); + $this->service = $arr; + + return $this; + } + + /** + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExtension() + { + return $this->extension; + } + + /** + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 7; + * @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExtension($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); + $this->extension = $arr; + + return $this; + } + + /** + * Generated from protobuf field optional .google.protobuf.FileOptions options = 8; + * @return \Google\Protobuf\Internal\FileOptions|null + */ + public function getOptions() + { + return $this->options; + } + + public function hasOptions() + { + return isset($this->options); + } + + public function clearOptions() + { + unset($this->options); + } + + /** + * Generated from protobuf field optional .google.protobuf.FileOptions options = 8; + * @param \Google\Protobuf\Internal\FileOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FileOptions::class); + $this->options = $var; + + return $this; + } + + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + * + * Generated from protobuf field optional .google.protobuf.SourceCodeInfo source_code_info = 9; + * @return \Google\Protobuf\Internal\SourceCodeInfo|null + */ + public function getSourceCodeInfo() + { + return $this->source_code_info; + } + + public function hasSourceCodeInfo() + { + return isset($this->source_code_info); + } + + public function clearSourceCodeInfo() + { + unset($this->source_code_info); + } + + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + * + * Generated from protobuf field optional .google.protobuf.SourceCodeInfo source_code_info = 9; + * @param \Google\Protobuf\Internal\SourceCodeInfo $var + * @return $this + */ + public function setSourceCodeInfo($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\SourceCodeInfo::class); + $this->source_code_info = $var; + + return $this; + } + + /** + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + * + * Generated from protobuf field optional string syntax = 12; + * @return string + */ + public function getSyntax() + { + return isset($this->syntax) ? $this->syntax : ''; + } + + public function hasSyntax() + { + return isset($this->syntax); + } + + public function clearSyntax() + { + unset($this->syntax); + } + + /** + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + * + * Generated from protobuf field optional string syntax = 12; + * @param string $var + * @return $this + */ + public function setSyntax($var) + { + GPBUtil::checkString($var, True); + $this->syntax = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FileDescriptorSet.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FileDescriptorSet.php new file mode 100644 index 00000000..794e6347 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FileDescriptorSet.php @@ -0,0 +1,63 @@ +google.protobuf.FileDescriptorSet + */ +class FileDescriptorSet extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated .google.protobuf.FileDescriptorProto file = 1; + */ + private $file; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Internal\FileDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $file + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field repeated .google.protobuf.FileDescriptorProto file = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFile() + { + return $this->file; + } + + /** + * Generated from protobuf field repeated .google.protobuf.FileDescriptorProto file = 1; + * @param \Google\Protobuf\Internal\FileDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFile($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FileDescriptorProto::class); + $this->file = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FileOptions.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FileOptions.php new file mode 100644 index 00000000..3f2c3a4d --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FileOptions.php @@ -0,0 +1,1106 @@ +google.protobuf.FileOptions + */ +class FileOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + * + * Generated from protobuf field optional string java_package = 1; + */ + protected $java_package = null; + /** + * Controls the name of the wrapper Java class generated for the .proto file. + * That class will always contain the .proto file's getDescriptor() method as + * well as any top-level extensions defined in the .proto file. + * If java_multiple_files is disabled, then all the other classes from the + * .proto file will be nested inside the single wrapper outer class. + * + * Generated from protobuf field optional string java_outer_classname = 8; + */ + protected $java_outer_classname = null; + /** + * If enabled, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the wrapper class + * named by java_outer_classname. However, the wrapper class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + * + * Generated from protobuf field optional bool java_multiple_files = 10 [default = false]; + */ + protected $java_multiple_files = null; + /** + * This option does nothing. + * + * Generated from protobuf field optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + * @deprecated + */ + protected $java_generate_equals_and_hash = null; + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + * + * Generated from protobuf field optional bool java_string_check_utf8 = 27 [default = false]; + */ + protected $java_string_check_utf8 = null; + /** + * Generated from protobuf field optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + */ + protected $optimize_for = null; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + * + * Generated from protobuf field optional string go_package = 11; + */ + protected $go_package = null; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + * + * Generated from protobuf field optional bool cc_generic_services = 16 [default = false]; + */ + protected $cc_generic_services = null; + /** + * Generated from protobuf field optional bool java_generic_services = 17 [default = false]; + */ + protected $java_generic_services = null; + /** + * Generated from protobuf field optional bool py_generic_services = 18 [default = false]; + */ + protected $py_generic_services = null; + /** + * Generated from protobuf field optional bool php_generic_services = 42 [default = false]; + */ + protected $php_generic_services = null; + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + * + * Generated from protobuf field optional bool deprecated = 23 [default = false]; + */ + protected $deprecated = null; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + * + * Generated from protobuf field optional bool cc_enable_arenas = 31 [default = true]; + */ + protected $cc_enable_arenas = null; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + * + * Generated from protobuf field optional string objc_class_prefix = 36; + */ + protected $objc_class_prefix = null; + /** + * Namespace for generated classes; defaults to the package. + * + * Generated from protobuf field optional string csharp_namespace = 37; + */ + protected $csharp_namespace = null; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + * + * Generated from protobuf field optional string swift_prefix = 39; + */ + protected $swift_prefix = null; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + * + * Generated from protobuf field optional string php_class_prefix = 40; + */ + protected $php_class_prefix = null; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + * + * Generated from protobuf field optional string php_namespace = 41; + */ + protected $php_namespace = null; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + * + * Generated from protobuf field optional string php_metadata_namespace = 44; + */ + protected $php_metadata_namespace = null; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + * + * Generated from protobuf field optional string ruby_package = 45; + */ + protected $ruby_package = null; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $java_package + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + * @type string $java_outer_classname + * Controls the name of the wrapper Java class generated for the .proto file. + * That class will always contain the .proto file's getDescriptor() method as + * well as any top-level extensions defined in the .proto file. + * If java_multiple_files is disabled, then all the other classes from the + * .proto file will be nested inside the single wrapper outer class. + * @type bool $java_multiple_files + * If enabled, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the wrapper class + * named by java_outer_classname. However, the wrapper class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + * @type bool $java_generate_equals_and_hash + * This option does nothing. + * @type bool $java_string_check_utf8 + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + * @type int $optimize_for + * @type string $go_package + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + * @type bool $cc_generic_services + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + * @type bool $java_generic_services + * @type bool $py_generic_services + * @type bool $php_generic_services + * @type bool $deprecated + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + * @type bool $cc_enable_arenas + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + * @type string $objc_class_prefix + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + * @type string $csharp_namespace + * Namespace for generated classes; defaults to the package. + * @type string $swift_prefix + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + * @type string $php_class_prefix + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + * @type string $php_namespace + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + * @type string $php_metadata_namespace + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + * @type string $ruby_package + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + * + * Generated from protobuf field optional string java_package = 1; + * @return string + */ + public function getJavaPackage() + { + return isset($this->java_package) ? $this->java_package : ''; + } + + public function hasJavaPackage() + { + return isset($this->java_package); + } + + public function clearJavaPackage() + { + unset($this->java_package); + } + + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + * + * Generated from protobuf field optional string java_package = 1; + * @param string $var + * @return $this + */ + public function setJavaPackage($var) + { + GPBUtil::checkString($var, True); + $this->java_package = $var; + + return $this; + } + + /** + * Controls the name of the wrapper Java class generated for the .proto file. + * That class will always contain the .proto file's getDescriptor() method as + * well as any top-level extensions defined in the .proto file. + * If java_multiple_files is disabled, then all the other classes from the + * .proto file will be nested inside the single wrapper outer class. + * + * Generated from protobuf field optional string java_outer_classname = 8; + * @return string + */ + public function getJavaOuterClassname() + { + return isset($this->java_outer_classname) ? $this->java_outer_classname : ''; + } + + public function hasJavaOuterClassname() + { + return isset($this->java_outer_classname); + } + + public function clearJavaOuterClassname() + { + unset($this->java_outer_classname); + } + + /** + * Controls the name of the wrapper Java class generated for the .proto file. + * That class will always contain the .proto file's getDescriptor() method as + * well as any top-level extensions defined in the .proto file. + * If java_multiple_files is disabled, then all the other classes from the + * .proto file will be nested inside the single wrapper outer class. + * + * Generated from protobuf field optional string java_outer_classname = 8; + * @param string $var + * @return $this + */ + public function setJavaOuterClassname($var) + { + GPBUtil::checkString($var, True); + $this->java_outer_classname = $var; + + return $this; + } + + /** + * If enabled, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the wrapper class + * named by java_outer_classname. However, the wrapper class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + * + * Generated from protobuf field optional bool java_multiple_files = 10 [default = false]; + * @return bool + */ + public function getJavaMultipleFiles() + { + return isset($this->java_multiple_files) ? $this->java_multiple_files : false; + } + + public function hasJavaMultipleFiles() + { + return isset($this->java_multiple_files); + } + + public function clearJavaMultipleFiles() + { + unset($this->java_multiple_files); + } + + /** + * If enabled, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the wrapper class + * named by java_outer_classname. However, the wrapper class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + * + * Generated from protobuf field optional bool java_multiple_files = 10 [default = false]; + * @param bool $var + * @return $this + */ + public function setJavaMultipleFiles($var) + { + GPBUtil::checkBool($var); + $this->java_multiple_files = $var; + + return $this; + } + + /** + * This option does nothing. + * + * Generated from protobuf field optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + * @return bool + * @deprecated + */ + public function getJavaGenerateEqualsAndHash() + { + @trigger_error('java_generate_equals_and_hash is deprecated.', E_USER_DEPRECATED); + return isset($this->java_generate_equals_and_hash) ? $this->java_generate_equals_and_hash : false; + } + + public function hasJavaGenerateEqualsAndHash() + { + @trigger_error('java_generate_equals_and_hash is deprecated.', E_USER_DEPRECATED); + return isset($this->java_generate_equals_and_hash); + } + + public function clearJavaGenerateEqualsAndHash() + { + @trigger_error('java_generate_equals_and_hash is deprecated.', E_USER_DEPRECATED); + unset($this->java_generate_equals_and_hash); + } + + /** + * This option does nothing. + * + * Generated from protobuf field optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + * @param bool $var + * @return $this + * @deprecated + */ + public function setJavaGenerateEqualsAndHash($var) + { + @trigger_error('java_generate_equals_and_hash is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkBool($var); + $this->java_generate_equals_and_hash = $var; + + return $this; + } + + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + * + * Generated from protobuf field optional bool java_string_check_utf8 = 27 [default = false]; + * @return bool + */ + public function getJavaStringCheckUtf8() + { + return isset($this->java_string_check_utf8) ? $this->java_string_check_utf8 : false; + } + + public function hasJavaStringCheckUtf8() + { + return isset($this->java_string_check_utf8); + } + + public function clearJavaStringCheckUtf8() + { + unset($this->java_string_check_utf8); + } + + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + * + * Generated from protobuf field optional bool java_string_check_utf8 = 27 [default = false]; + * @param bool $var + * @return $this + */ + public function setJavaStringCheckUtf8($var) + { + GPBUtil::checkBool($var); + $this->java_string_check_utf8 = $var; + + return $this; + } + + /** + * Generated from protobuf field optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + * @return int + */ + public function getOptimizeFor() + { + return isset($this->optimize_for) ? $this->optimize_for : 0; + } + + public function hasOptimizeFor() + { + return isset($this->optimize_for); + } + + public function clearOptimizeFor() + { + unset($this->optimize_for); + } + + /** + * Generated from protobuf field optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + * @param int $var + * @return $this + */ + public function setOptimizeFor($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FileOptions\OptimizeMode::class); + $this->optimize_for = $var; + + return $this; + } + + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + * + * Generated from protobuf field optional string go_package = 11; + * @return string + */ + public function getGoPackage() + { + return isset($this->go_package) ? $this->go_package : ''; + } + + public function hasGoPackage() + { + return isset($this->go_package); + } + + public function clearGoPackage() + { + unset($this->go_package); + } + + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + * + * Generated from protobuf field optional string go_package = 11; + * @param string $var + * @return $this + */ + public function setGoPackage($var) + { + GPBUtil::checkString($var, True); + $this->go_package = $var; + + return $this; + } + + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + * + * Generated from protobuf field optional bool cc_generic_services = 16 [default = false]; + * @return bool + */ + public function getCcGenericServices() + { + return isset($this->cc_generic_services) ? $this->cc_generic_services : false; + } + + public function hasCcGenericServices() + { + return isset($this->cc_generic_services); + } + + public function clearCcGenericServices() + { + unset($this->cc_generic_services); + } + + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + * + * Generated from protobuf field optional bool cc_generic_services = 16 [default = false]; + * @param bool $var + * @return $this + */ + public function setCcGenericServices($var) + { + GPBUtil::checkBool($var); + $this->cc_generic_services = $var; + + return $this; + } + + /** + * Generated from protobuf field optional bool java_generic_services = 17 [default = false]; + * @return bool + */ + public function getJavaGenericServices() + { + return isset($this->java_generic_services) ? $this->java_generic_services : false; + } + + public function hasJavaGenericServices() + { + return isset($this->java_generic_services); + } + + public function clearJavaGenericServices() + { + unset($this->java_generic_services); + } + + /** + * Generated from protobuf field optional bool java_generic_services = 17 [default = false]; + * @param bool $var + * @return $this + */ + public function setJavaGenericServices($var) + { + GPBUtil::checkBool($var); + $this->java_generic_services = $var; + + return $this; + } + + /** + * Generated from protobuf field optional bool py_generic_services = 18 [default = false]; + * @return bool + */ + public function getPyGenericServices() + { + return isset($this->py_generic_services) ? $this->py_generic_services : false; + } + + public function hasPyGenericServices() + { + return isset($this->py_generic_services); + } + + public function clearPyGenericServices() + { + unset($this->py_generic_services); + } + + /** + * Generated from protobuf field optional bool py_generic_services = 18 [default = false]; + * @param bool $var + * @return $this + */ + public function setPyGenericServices($var) + { + GPBUtil::checkBool($var); + $this->py_generic_services = $var; + + return $this; + } + + /** + * Generated from protobuf field optional bool php_generic_services = 42 [default = false]; + * @return bool + */ + public function getPhpGenericServices() + { + return isset($this->php_generic_services) ? $this->php_generic_services : false; + } + + public function hasPhpGenericServices() + { + return isset($this->php_generic_services); + } + + public function clearPhpGenericServices() + { + unset($this->php_generic_services); + } + + /** + * Generated from protobuf field optional bool php_generic_services = 42 [default = false]; + * @param bool $var + * @return $this + */ + public function setPhpGenericServices($var) + { + GPBUtil::checkBool($var); + $this->php_generic_services = $var; + + return $this; + } + + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + * + * Generated from protobuf field optional bool deprecated = 23 [default = false]; + * @return bool + */ + public function getDeprecated() + { + return isset($this->deprecated) ? $this->deprecated : false; + } + + public function hasDeprecated() + { + return isset($this->deprecated); + } + + public function clearDeprecated() + { + unset($this->deprecated); + } + + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + * + * Generated from protobuf field optional bool deprecated = 23 [default = false]; + * @param bool $var + * @return $this + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + + return $this; + } + + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + * + * Generated from protobuf field optional bool cc_enable_arenas = 31 [default = true]; + * @return bool + */ + public function getCcEnableArenas() + { + return isset($this->cc_enable_arenas) ? $this->cc_enable_arenas : false; + } + + public function hasCcEnableArenas() + { + return isset($this->cc_enable_arenas); + } + + public function clearCcEnableArenas() + { + unset($this->cc_enable_arenas); + } + + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + * + * Generated from protobuf field optional bool cc_enable_arenas = 31 [default = true]; + * @param bool $var + * @return $this + */ + public function setCcEnableArenas($var) + { + GPBUtil::checkBool($var); + $this->cc_enable_arenas = $var; + + return $this; + } + + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + * + * Generated from protobuf field optional string objc_class_prefix = 36; + * @return string + */ + public function getObjcClassPrefix() + { + return isset($this->objc_class_prefix) ? $this->objc_class_prefix : ''; + } + + public function hasObjcClassPrefix() + { + return isset($this->objc_class_prefix); + } + + public function clearObjcClassPrefix() + { + unset($this->objc_class_prefix); + } + + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + * + * Generated from protobuf field optional string objc_class_prefix = 36; + * @param string $var + * @return $this + */ + public function setObjcClassPrefix($var) + { + GPBUtil::checkString($var, True); + $this->objc_class_prefix = $var; + + return $this; + } + + /** + * Namespace for generated classes; defaults to the package. + * + * Generated from protobuf field optional string csharp_namespace = 37; + * @return string + */ + public function getCsharpNamespace() + { + return isset($this->csharp_namespace) ? $this->csharp_namespace : ''; + } + + public function hasCsharpNamespace() + { + return isset($this->csharp_namespace); + } + + public function clearCsharpNamespace() + { + unset($this->csharp_namespace); + } + + /** + * Namespace for generated classes; defaults to the package. + * + * Generated from protobuf field optional string csharp_namespace = 37; + * @param string $var + * @return $this + */ + public function setCsharpNamespace($var) + { + GPBUtil::checkString($var, True); + $this->csharp_namespace = $var; + + return $this; + } + + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + * + * Generated from protobuf field optional string swift_prefix = 39; + * @return string + */ + public function getSwiftPrefix() + { + return isset($this->swift_prefix) ? $this->swift_prefix : ''; + } + + public function hasSwiftPrefix() + { + return isset($this->swift_prefix); + } + + public function clearSwiftPrefix() + { + unset($this->swift_prefix); + } + + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + * + * Generated from protobuf field optional string swift_prefix = 39; + * @param string $var + * @return $this + */ + public function setSwiftPrefix($var) + { + GPBUtil::checkString($var, True); + $this->swift_prefix = $var; + + return $this; + } + + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + * + * Generated from protobuf field optional string php_class_prefix = 40; + * @return string + */ + public function getPhpClassPrefix() + { + return isset($this->php_class_prefix) ? $this->php_class_prefix : ''; + } + + public function hasPhpClassPrefix() + { + return isset($this->php_class_prefix); + } + + public function clearPhpClassPrefix() + { + unset($this->php_class_prefix); + } + + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + * + * Generated from protobuf field optional string php_class_prefix = 40; + * @param string $var + * @return $this + */ + public function setPhpClassPrefix($var) + { + GPBUtil::checkString($var, True); + $this->php_class_prefix = $var; + + return $this; + } + + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + * + * Generated from protobuf field optional string php_namespace = 41; + * @return string + */ + public function getPhpNamespace() + { + return isset($this->php_namespace) ? $this->php_namespace : ''; + } + + public function hasPhpNamespace() + { + return isset($this->php_namespace); + } + + public function clearPhpNamespace() + { + unset($this->php_namespace); + } + + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + * + * Generated from protobuf field optional string php_namespace = 41; + * @param string $var + * @return $this + */ + public function setPhpNamespace($var) + { + GPBUtil::checkString($var, True); + $this->php_namespace = $var; + + return $this; + } + + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + * + * Generated from protobuf field optional string php_metadata_namespace = 44; + * @return string + */ + public function getPhpMetadataNamespace() + { + return isset($this->php_metadata_namespace) ? $this->php_metadata_namespace : ''; + } + + public function hasPhpMetadataNamespace() + { + return isset($this->php_metadata_namespace); + } + + public function clearPhpMetadataNamespace() + { + unset($this->php_metadata_namespace); + } + + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + * + * Generated from protobuf field optional string php_metadata_namespace = 44; + * @param string $var + * @return $this + */ + public function setPhpMetadataNamespace($var) + { + GPBUtil::checkString($var, True); + $this->php_metadata_namespace = $var; + + return $this; + } + + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + * + * Generated from protobuf field optional string ruby_package = 45; + * @return string + */ + public function getRubyPackage() + { + return isset($this->ruby_package) ? $this->ruby_package : ''; + } + + public function hasRubyPackage() + { + return isset($this->ruby_package); + } + + public function clearRubyPackage() + { + unset($this->ruby_package); + } + + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + * + * Generated from protobuf field optional string ruby_package = 45; + * @param string $var + * @return $this + */ + public function setRubyPackage($var) + { + GPBUtil::checkString($var, True); + $this->ruby_package = $var; + + return $this; + } + + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUninterpretedOption($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php new file mode 100644 index 00000000..0df27b53 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php @@ -0,0 +1,64 @@ +google.protobuf.FileOptions.OptimizeMode + */ +class OptimizeMode +{ + /** + * Generate complete code for parsing, serialization, + * + * Generated from protobuf enum SPEED = 1; + */ + const SPEED = 1; + /** + * etc. + * + * Generated from protobuf enum CODE_SIZE = 2; + */ + const CODE_SIZE = 2; + /** + * Generate code using MessageLite and the lite runtime. + * + * Generated from protobuf enum LITE_RUNTIME = 3; + */ + const LITE_RUNTIME = 3; + + private static $valueToName = [ + self::SPEED => 'SPEED', + self::CODE_SIZE => 'CODE_SIZE', + self::LITE_RUNTIME => 'LITE_RUNTIME', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OptimizeMode::class, \Google\Protobuf\Internal\FileOptions_OptimizeMode::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php new file mode 100644 index 00000000..8926e63b --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php @@ -0,0 +1,16 @@ +writeRaw("\"", 1); + $field_name = GPBJsonWire::formatFieldName($field); + $output->writeRaw($field_name, strlen($field_name)); + $output->writeRaw("\":", 2); + } + return static::serializeFieldValueToStream( + $value, + $field, + $output, + !$has_field_name); + } + + public static function serializeFieldValueToStream( + $values, + $field, + &$output, + $is_well_known = false) + { + if ($field->isMap()) { + $output->writeRaw("{", 1); + $first = true; + $map_entry = $field->getMessageType(); + $key_field = $map_entry->getFieldByNumber(1); + $value_field = $map_entry->getFieldByNumber(2); + + switch ($key_field->getType()) { + case GPBType::STRING: + case GPBType::SFIXED64: + case GPBType::INT64: + case GPBType::SINT64: + case GPBType::FIXED64: + case GPBType::UINT64: + $additional_quote = false; + break; + default: + $additional_quote = true; + } + + foreach ($values as $key => $value) { + if ($first) { + $first = false; + } else { + $output->writeRaw(",", 1); + } + if ($additional_quote) { + $output->writeRaw("\"", 1); + } + if (!static::serializeSingularFieldValueToStream( + $key, + $key_field, + $output, + $is_well_known)) { + return false; + } + if ($additional_quote) { + $output->writeRaw("\"", 1); + } + $output->writeRaw(":", 1); + if (!static::serializeSingularFieldValueToStream( + $value, + $value_field, + $output, + $is_well_known)) { + return false; + } + } + $output->writeRaw("}", 1); + return true; + } elseif ($field->isRepeated()) { + $output->writeRaw("[", 1); + $first = true; + foreach ($values as $value) { + if ($first) { + $first = false; + } else { + $output->writeRaw(",", 1); + } + if (!static::serializeSingularFieldValueToStream( + $value, + $field, + $output, + $is_well_known)) { + return false; + } + } + $output->writeRaw("]", 1); + return true; + } else { + return static::serializeSingularFieldValueToStream( + $values, + $field, + $output, + $is_well_known); + } + } + + private static function serializeSingularFieldValueToStream( + $value, + $field, + &$output, $is_well_known = false) + { + switch ($field->getType()) { + case GPBType::SFIXED32: + case GPBType::SINT32: + case GPBType::INT32: + $str_value = strval($value); + $output->writeRaw($str_value, strlen($str_value)); + break; + case GPBType::FIXED32: + case GPBType::UINT32: + if ($value < 0) { + $value = bcadd($value, "4294967296"); + } + $str_value = strval($value); + $output->writeRaw($str_value, strlen($str_value)); + break; + case GPBType::FIXED64: + case GPBType::UINT64: + if ($value < 0) { + $value = bcadd($value, "18446744073709551616"); + } + // Intentional fall through. + case GPBType::SFIXED64: + case GPBType::INT64: + case GPBType::SINT64: + $output->writeRaw("\"", 1); + $str_value = strval($value); + $output->writeRaw($str_value, strlen($str_value)); + $output->writeRaw("\"", 1); + break; + case GPBType::FLOAT: + if (is_nan($value)) { + $str_value = "\"NaN\""; + } elseif ($value === INF) { + $str_value = "\"Infinity\""; + } elseif ($value === -INF) { + $str_value = "\"-Infinity\""; + } else { + $str_value = sprintf("%.8g", $value); + } + $output->writeRaw($str_value, strlen($str_value)); + break; + case GPBType::DOUBLE: + if (is_nan($value)) { + $str_value = "\"NaN\""; + } elseif ($value === INF) { + $str_value = "\"Infinity\""; + } elseif ($value === -INF) { + $str_value = "\"-Infinity\""; + } else { + $str_value = sprintf("%.17g", $value); + } + $output->writeRaw($str_value, strlen($str_value)); + break; + case GPBType::ENUM: + $enum_desc = $field->getEnumType(); + if ($enum_desc->getClass() === "Google\Protobuf\NullValue") { + $output->writeRaw("null", 4); + break; + } + $enum_value_desc = $enum_desc->getValueByNumber($value); + if (!is_null($enum_value_desc)) { + $str_value = $enum_value_desc->getName(); + $output->writeRaw("\"", 1); + $output->writeRaw($str_value, strlen($str_value)); + $output->writeRaw("\"", 1); + } else { + $str_value = strval($value); + $output->writeRaw($str_value, strlen($str_value)); + } + break; + case GPBType::BOOL: + if ($value) { + $output->writeRaw("true", 4); + } else { + $output->writeRaw("false", 5); + } + break; + case GPBType::BYTES: + $bytes_value = base64_encode($value); + $output->writeRaw("\"", 1); + $output->writeRaw($bytes_value, strlen($bytes_value)); + $output->writeRaw("\"", 1); + break; + case GPBType::STRING: + $value = json_encode($value, JSON_UNESCAPED_UNICODE); + $output->writeRaw($value, strlen($value)); + break; + // case GPBType::GROUP: + // echo "GROUP\xA"; + // trigger_error("Not implemented.", E_ERROR); + // break; + case GPBType::MESSAGE: + $value->serializeToJsonStream($output); + break; + default: + user_error("Unsupported type."); + return false; + } + return true; + } + + private static function formatFieldName($field) + { + return $field->getJsonName(); + } + + // Used for escaping control chars in strings. + private static $k_control_char_limit = 0x20; + + private static function jsonNiceEscape($c) + { + switch ($c) { + case '"': return "\\\""; + case '\\': return "\\\\"; + case '/': return "\\/"; + case '\b': return "\\b"; + case '\f': return "\\f"; + case '\n': return "\\n"; + case '\r': return "\\r"; + case '\t': return "\\t"; + default: return NULL; + } + } + + private static function isJsonEscaped($c) + { + // See RFC 4627. + return $c < chr($k_control_char_limit) || $c === "\"" || $c === "\\"; + } + + public static function escapedJson($value) + { + $escaped_value = ""; + $unescaped_run = ""; + for ($i = 0; $i < strlen($value); $i++) { + $c = $value[$i]; + // Handle escaping. + if (static::isJsonEscaped($c)) { + // Use a "nice" escape, like \n, if one exists for this + // character. + $escape = static::jsonNiceEscape($c); + if (is_null($escape)) { + $escape = "\\u00" . bin2hex($c); + } + if ($unescaped_run !== "") { + $escaped_value .= $unescaped_run; + $unescaped_run = ""; + } + $escaped_value .= $escape; + } else { + if ($unescaped_run === "") { + $unescaped_run .= $c; + } + } + } + $escaped_value .= $unescaped_run; + return $escaped_value; + } + +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBLabel.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBLabel.php new file mode 100644 index 00000000..0fb23841 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBLabel.php @@ -0,0 +1,40 @@ + 0) { + $high = (int) bcsub($high, 4294967296); + } else { + $high = (int) $high; + } + if (bccomp($low, 2147483647) > 0) { + $low = (int) bcsub($low, 4294967296); + } else { + $low = (int) $low; + } + + if ($isNeg) { + $high = ~$high; + $low = ~$low; + $low++; + if (!$low) { + $high = (int)($high + 1); + } + } + + if ($trim) { + $high = 0; + } + } + + public static function checkString(&$var, $check_utf8) + { + if (is_array($var) || is_object($var)) { + throw new \InvalidArgumentException("Expect string."); + } + if (!is_string($var)) { + $var = strval($var); + } + if ($check_utf8 && !preg_match('//u', $var)) { + throw new \Exception("Expect utf-8 encoding."); + } + } + + public static function checkEnum(&$var) + { + static::checkInt32($var); + } + + public static function checkInt32(&$var) + { + if (is_numeric($var)) { + $var = intval($var); + } else { + throw new \Exception("Expect integer."); + } + } + + public static function checkUint32(&$var) + { + if (is_numeric($var)) { + if (PHP_INT_SIZE === 8) { + $var = intval($var); + $var |= ((-(($var >> 31) & 0x1)) & ~0xFFFFFFFF); + } else { + if (bccomp($var, 0x7FFFFFFF) > 0) { + $var = bcsub($var, "4294967296"); + } + $var = (int) $var; + } + } else { + throw new \Exception("Expect integer."); + } + } + + public static function checkInt64(&$var) + { + if (is_numeric($var)) { + if (PHP_INT_SIZE == 8) { + $var = intval($var); + } else { + if (is_float($var) || + is_integer($var) || + (is_string($var) && + bccomp($var, "9223372036854774784") < 0)) { + $var = number_format($var, 0, ".", ""); + } + } + } else { + throw new \Exception("Expect integer."); + } + } + + public static function checkUint64(&$var) + { + if (is_numeric($var)) { + if (PHP_INT_SIZE == 8) { + $var = intval($var); + } else { + $var = number_format($var, 0, ".", ""); + } + } else { + throw new \Exception("Expect integer."); + } + } + + public static function checkFloat(&$var) + { + if (is_float($var) || is_numeric($var)) { + $var = unpack("f", pack("f", $var))[1]; + } else { + throw new \Exception("Expect float."); + } + } + + public static function checkDouble(&$var) + { + if (is_float($var) || is_numeric($var)) { + $var = floatval($var); + } else { + throw new \Exception("Expect float."); + } + } + + public static function checkBool(&$var) + { + if (is_array($var) || is_object($var)) { + throw new \Exception("Expect boolean."); + } + $var = boolval($var); + } + + public static function checkMessage(&$var, $klass, $newClass = null) + { + if (!$var instanceof $klass && !is_null($var)) { + throw new \Exception("Expect $klass."); + } + } + + public static function checkRepeatedField(&$var, $type, $klass = null) + { + if (!$var instanceof RepeatedField && !is_array($var)) { + throw new \Exception("Expect array."); + } + if (is_array($var)) { + $tmp = new RepeatedField($type, $klass); + foreach ($var as $value) { + $tmp[] = $value; + } + return $tmp; + } else { + if ($var->getType() != $type) { + throw new \Exception( + "Expect repeated field of different type."); + } + if ($var->getType() === GPBType::MESSAGE && + $var->getClass() !== $klass && + $var->getLegacyClass() !== $klass) { + throw new \Exception( + "Expect repeated field of " . $klass . "."); + } + return $var; + } + } + + public static function checkMapField(&$var, $key_type, $value_type, $klass = null) + { + if (!$var instanceof MapField && !is_array($var)) { + throw new \Exception("Expect dict."); + } + if (is_array($var)) { + $tmp = new MapField($key_type, $value_type, $klass); + foreach ($var as $key => $value) { + $tmp[$key] = $value; + } + return $tmp; + } else { + if ($var->getKeyType() != $key_type) { + throw new \Exception("Expect map field of key type."); + } + if ($var->getValueType() != $value_type) { + throw new \Exception("Expect map field of value type."); + } + if ($var->getValueType() === GPBType::MESSAGE && + $var->getValueClass() !== $klass && + $var->getLegacyValueClass() !== $klass) { + throw new \Exception( + "Expect map field of " . $klass . "."); + } + return $var; + } + } + + public static function Int64($value) + { + return new Int64($value); + } + + public static function Uint64($value) + { + return new Uint64($value); + } + + public static function getClassNamePrefix( + $classname, + $file_proto) + { + $option = $file_proto->getOptions(); + $prefix = is_null($option) ? "" : $option->getPhpClassPrefix(); + if ($prefix !== "") { + return $prefix; + } + + $reserved_words = array( + "abstract"=>0, "and"=>0, "array"=>0, "as"=>0, "break"=>0, + "callable"=>0, "case"=>0, "catch"=>0, "class"=>0, "clone"=>0, + "const"=>0, "continue"=>0, "declare"=>0, "default"=>0, "die"=>0, + "do"=>0, "echo"=>0, "else"=>0, "elseif"=>0, "empty"=>0, + "enddeclare"=>0, "endfor"=>0, "endforeach"=>0, "endif"=>0, + "endswitch"=>0, "endwhile"=>0, "eval"=>0, "exit"=>0, "extends"=>0, + "final"=>0, "finally"=>0, "fn"=>0, "for"=>0, "foreach"=>0, + "function"=>0, "global"=>0, "goto"=>0, "if"=>0, "implements"=>0, + "include"=>0, "include_once"=>0, "instanceof"=>0, "insteadof"=>0, + "interface"=>0, "isset"=>0, "list"=>0, "match"=>0, "namespace"=>0, + "new"=>0, "or"=>0, "print"=>0, "private"=>0, "protected"=>0, + "public"=>0, "require"=>0, "require_once"=>0, "return"=>0, + "static"=>0, "switch"=>0, "throw"=>0, "trait"=>0, "try"=>0, + "unset"=>0, "use"=>0, "var"=>0, "while"=>0, "xor"=>0, "yield"=>0, + "int"=>0, "float"=>0, "bool"=>0, "string"=>0, "true"=>0, "false"=>0, + "null"=>0, "void"=>0, "iterable"=>0 + ); + + if (array_key_exists(strtolower($classname), $reserved_words)) { + if ($file_proto->getPackage() === "google.protobuf") { + return "GPB"; + } else { + return "PB"; + } + } + + return ""; + } + + public static function getLegacyClassNameWithoutPackage( + $name, + $file_proto) + { + $classname = implode('_', explode('.', $name)); + return static::getClassNamePrefix($classname, $file_proto) . $classname; + } + + public static function getClassNameWithoutPackage( + $name, + $file_proto) + { + $parts = explode('.', $name); + foreach ($parts as $i => $part) { + $parts[$i] = static::getClassNamePrefix($parts[$i], $file_proto) . $parts[$i]; + } + return implode('\\', $parts); + } + + public static function getFullClassName( + $proto, + $containing, + $file_proto, + &$message_name_without_package, + &$classname, + &$legacy_classname, + &$fullname) + { + // Full name needs to start with '.'. + $message_name_without_package = $proto->getName(); + if ($containing !== "") { + $message_name_without_package = + $containing . "." . $message_name_without_package; + } + + $package = $file_proto->getPackage(); + if ($package === "") { + $fullname = $message_name_without_package; + } else { + $fullname = $package . "." . $message_name_without_package; + } + + $class_name_without_package = + static::getClassNameWithoutPackage($message_name_without_package, $file_proto); + $legacy_class_name_without_package = + static::getLegacyClassNameWithoutPackage( + $message_name_without_package, $file_proto); + + $option = $file_proto->getOptions(); + if (!is_null($option) && $option->hasPhpNamespace()) { + $namespace = $option->getPhpNamespace(); + if ($namespace !== "") { + $classname = $namespace . "\\" . $class_name_without_package; + $legacy_classname = + $namespace . "\\" . $legacy_class_name_without_package; + return; + } else { + $classname = $class_name_without_package; + $legacy_classname = $legacy_class_name_without_package; + return; + } + } + + if ($package === "") { + $classname = $class_name_without_package; + $legacy_classname = $legacy_class_name_without_package; + } else { + $parts = array_map('ucwords', explode('.', $package)); + foreach ($parts as $i => $part) { + $parts[$i] = self::getClassNamePrefix($part, $file_proto).$part; + } + $classname = + implode('\\', $parts) . + "\\".self::getClassNamePrefix($class_name_without_package,$file_proto). + $class_name_without_package; + $legacy_classname = + implode('\\', array_map('ucwords', explode('.', $package))). + "\\".$legacy_class_name_without_package; + } + } + + public static function combineInt32ToInt64($high, $low) + { + $isNeg = $high < 0; + if ($isNeg) { + $high = ~$high; + $low = ~$low; + $low++; + if (!$low) { + $high = (int) ($high + 1); + } + } + $result = bcadd(bcmul($high, 4294967296), $low); + if ($low < 0) { + $result = bcadd($result, 4294967296); + } + if ($isNeg) { + $result = bcsub(0, $result); + } + return $result; + } + + public static function parseTimestamp($timestamp) + { + // prevent parsing timestamps containing with the non-existent year "0000" + // DateTime::createFromFormat parses without failing but as a nonsensical date + if (substr($timestamp, 0, 4) === "0000") { + throw new \Exception("Year cannot be zero."); + } + // prevent parsing timestamps ending with a lowercase z + if (substr($timestamp, -1, 1) === "z") { + throw new \Exception("Timezone cannot be a lowercase z."); + } + + $nanoseconds = 0; + $periodIndex = strpos($timestamp, "."); + if ($periodIndex !== false) { + $nanosecondsLength = 0; + // find the next non-numeric character in the timestamp to calculate + // the length of the nanoseconds text + for ($i = $periodIndex + 1, $length = strlen($timestamp); $i < $length; $i++) { + if (!is_numeric($timestamp[$i])) { + $nanosecondsLength = $i - ($periodIndex + 1); + break; + } + } + if ($nanosecondsLength % 3 !== 0) { + throw new \Exception("Nanoseconds must be disible by 3."); + } + if ($nanosecondsLength > 9) { + throw new \Exception("Nanoseconds must be in the range of 0 to 999,999,999 nanoseconds."); + } + if ($nanosecondsLength > 0) { + $nanoseconds = substr($timestamp, $periodIndex + 1, $nanosecondsLength); + $nanoseconds = intval($nanoseconds); + + // remove the nanoseconds and preceding period from the timestamp + $date = substr($timestamp, 0, $periodIndex); + $timezone = substr($timestamp, $periodIndex + $nanosecondsLength + 1); + $timestamp = $date.$timezone; + } + } + + $date = \DateTime::createFromFormat(\DateTime::RFC3339, $timestamp, new \DateTimeZone("UTC")); + if ($date === false) { + throw new \Exception("Invalid RFC 3339 timestamp."); + } + + $value = new \Google\Protobuf\Timestamp(); + $seconds = $date->format("U"); + $value->setSeconds($seconds); + $value->setNanos($nanoseconds); + return $value; + } + + public static function formatTimestamp($value) + { + if (bccomp($value->getSeconds(), "253402300800") != -1) { + throw new GPBDecodeException("Duration number too large."); + } + if (bccomp($value->getSeconds(), "-62135596801") != 1) { + throw new GPBDecodeException("Duration number too small."); + } + $nanoseconds = static::getNanosecondsForTimestamp($value->getNanos()); + if (!empty($nanoseconds)) { + $nanoseconds = ".".$nanoseconds; + } + $date = new \DateTime('@'.$value->getSeconds(), new \DateTimeZone("UTC")); + return $date->format("Y-m-d\TH:i:s".$nanoseconds."\Z"); + } + + public static function parseDuration($value) + { + if (strlen($value) < 2 || substr($value, -1) !== "s") { + throw new GPBDecodeException("Missing s after duration string"); + } + $number = substr($value, 0, -1); + if (bccomp($number, "315576000001") != -1) { + throw new GPBDecodeException("Duration number too large."); + } + if (bccomp($number, "-315576000001") != 1) { + throw new GPBDecodeException("Duration number too small."); + } + $pos = strrpos($number, "."); + if ($pos !== false) { + $seconds = substr($number, 0, $pos); + if (bccomp($seconds, 0) < 0) { + $nanos = bcmul("0" . substr($number, $pos), -1000000000); + } else { + $nanos = bcmul("0" . substr($number, $pos), 1000000000); + } + } else { + $seconds = $number; + $nanos = 0; + } + $duration = new Duration(); + $duration->setSeconds($seconds); + $duration->setNanos($nanos); + return $duration; + } + + public static function formatDuration($value) + { + if (bccomp($value->getSeconds(), '315576000001') != -1) { + throw new GPBDecodeException('Duration number too large.'); + } + if (bccomp($value->getSeconds(), '-315576000001') != 1) { + throw new GPBDecodeException('Duration number too small.'); + } + + $nanos = $value->getNanos(); + if ($nanos === 0) { + return (string) $value->getSeconds(); + } + + if ($nanos % 1000000 === 0) { + $digits = 3; + } elseif ($nanos % 1000 === 0) { + $digits = 6; + } else { + $digits = 9; + } + + $nanos = bcdiv($nanos, '1000000000', $digits); + return bcadd($value->getSeconds(), $nanos, $digits); + } + + public static function parseFieldMask($paths_string) + { + $field_mask = new FieldMask(); + if (strlen($paths_string) === 0) { + return $field_mask; + } + $path_strings = explode(",", $paths_string); + $paths = $field_mask->getPaths(); + foreach($path_strings as &$path_string) { + $field_strings = explode(".", $path_string); + foreach($field_strings as &$field_string) { + $field_string = camel2underscore($field_string); + } + $path_string = implode(".", $field_strings); + $paths[] = $path_string; + } + return $field_mask; + } + + public static function formatFieldMask($field_mask) + { + $converted_paths = []; + foreach($field_mask->getPaths() as $path) { + $fields = explode('.', $path); + $converted_path = []; + foreach ($fields as $field) { + $segments = explode('_', $field); + $start = true; + $converted_segments = ""; + foreach($segments as $segment) { + if (!$start) { + $converted = ucfirst($segment); + } else { + $converted = $segment; + $start = false; + } + $converted_segments .= $converted; + } + $converted_path []= $converted_segments; + } + $converted_path = implode(".", $converted_path); + $converted_paths []= $converted_path; + } + return implode(",", $converted_paths); + } + + public static function getNanosecondsForTimestamp($nanoseconds) + { + if ($nanoseconds == 0) { + return ''; + } + if ($nanoseconds % static::NANOS_PER_MILLISECOND == 0) { + return sprintf('%03d', $nanoseconds / static::NANOS_PER_MILLISECOND); + } + if ($nanoseconds % static::NANOS_PER_MICROSECOND == 0) { + return sprintf('%06d', $nanoseconds / static::NANOS_PER_MICROSECOND); + } + return sprintf('%09d', $nanoseconds); + } + + public static function hasSpecialJsonMapping($msg) + { + return is_a($msg, 'Google\Protobuf\Any') || + is_a($msg, "Google\Protobuf\ListValue") || + is_a($msg, "Google\Protobuf\Struct") || + is_a($msg, "Google\Protobuf\Value") || + is_a($msg, "Google\Protobuf\Duration") || + is_a($msg, "Google\Protobuf\Timestamp") || + is_a($msg, "Google\Protobuf\FieldMask") || + static::hasJsonValue($msg); + } + + public static function hasJsonValue($msg) + { + return is_a($msg, "Google\Protobuf\DoubleValue") || + is_a($msg, "Google\Protobuf\FloatValue") || + is_a($msg, "Google\Protobuf\Int64Value") || + is_a($msg, "Google\Protobuf\UInt64Value") || + is_a($msg, "Google\Protobuf\Int32Value") || + is_a($msg, "Google\Protobuf\UInt32Value") || + is_a($msg, "Google\Protobuf\BoolValue") || + is_a($msg, "Google\Protobuf\StringValue") || + is_a($msg, "Google\Protobuf\BytesValue"); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBWire.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBWire.php new file mode 100644 index 00000000..29569530 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBWire.php @@ -0,0 +1,622 @@ +> self::TAG_TYPE_BITS) & 0x1fffffff; + } + + public static function getTagWireType($tag) + { + return $tag & 0x7; + } + + public static function getWireType($type) + { + switch ($type) { + case GPBType::FLOAT: + case GPBType::FIXED32: + case GPBType::SFIXED32: + return self::WIRETYPE_FIXED32; + case GPBType::DOUBLE: + case GPBType::FIXED64: + case GPBType::SFIXED64: + return self::WIRETYPE_FIXED64; + case GPBType::UINT32: + case GPBType::UINT64: + case GPBType::INT32: + case GPBType::INT64: + case GPBType::SINT32: + case GPBType::SINT64: + case GPBType::ENUM: + case GPBType::BOOL: + return self::WIRETYPE_VARINT; + case GPBType::STRING: + case GPBType::BYTES: + case GPBType::MESSAGE: + return self::WIRETYPE_LENGTH_DELIMITED; + case GPBType::GROUP: + user_error("Unsupported type."); + return 0; + default: + user_error("Unsupported type."); + return 0; + } + } + + // ZigZag Transform: Encodes signed integers so that they can be effectively + // used with varint encoding. + // + // varint operates on unsigned integers, encoding smaller numbers into fewer + // bytes. If you try to use it on a signed integer, it will treat this + // number as a very large unsigned integer, which means that even small + // signed numbers like -1 will take the maximum number of bytes (10) to + // encode. zigZagEncode() maps signed integers to unsigned in such a way + // that those with a small absolute value will have smaller encoded values, + // making them appropriate for encoding using varint. + // + // int32 -> uint32 + // ------------------------- + // 0 -> 0 + // -1 -> 1 + // 1 -> 2 + // -2 -> 3 + // ... -> ... + // 2147483647 -> 4294967294 + // -2147483648 -> 4294967295 + // + // >> encode >> + // << decode << + public static function zigZagEncode32($int32) + { + if (PHP_INT_SIZE == 8) { + $trim_int32 = $int32 & 0xFFFFFFFF; + return (($trim_int32 << 1) ^ ($int32 << 32 >> 63)) & 0xFFFFFFFF; + } else { + return ($int32 << 1) ^ ($int32 >> 31); + } + } + + public static function zigZagDecode32($uint32) + { + // Fill high 32 bits. + if (PHP_INT_SIZE === 8) { + $uint32 |= ($uint32 & 0xFFFFFFFF); + } + + $int32 = (($uint32 >> 1) & 0x7FFFFFFF) ^ (-($uint32 & 1)); + + return $int32; + } + + public static function zigZagEncode64($int64) + { + if (PHP_INT_SIZE == 4) { + if (bccomp($int64, 0) >= 0) { + return bcmul($int64, 2); + } else { + return bcsub(bcmul(bcsub(0, $int64), 2), 1); + } + } else { + return ($int64 << 1) ^ ($int64 >> 63); + } + } + + public static function zigZagDecode64($uint64) + { + if (PHP_INT_SIZE == 4) { + if (bcmod($uint64, 2) == 0) { + return bcdiv($uint64, 2, 0); + } else { + return bcsub(0, bcdiv(bcadd($uint64, 1), 2, 0)); + } + } else { + return (($uint64 >> 1) & 0x7FFFFFFFFFFFFFFF) ^ (-($uint64 & 1)); + } + } + + public static function readInt32(&$input, &$value) + { + return $input->readVarint32($value); + } + + public static function readInt64(&$input, &$value) + { + $success = $input->readVarint64($value); + if (PHP_INT_SIZE == 4 && bccomp($value, "9223372036854775807") > 0) { + $value = bcsub($value, "18446744073709551616"); + } + return $success; + } + + public static function readUint32(&$input, &$value) + { + return self::readInt32($input, $value); + } + + public static function readUint64(&$input, &$value) + { + return self::readInt64($input, $value); + } + + public static function readSint32(&$input, &$value) + { + if (!$input->readVarint32($value)) { + return false; + } + $value = GPBWire::zigZagDecode32($value); + return true; + } + + public static function readSint64(&$input, &$value) + { + if (!$input->readVarint64($value)) { + return false; + } + $value = GPBWire::zigZagDecode64($value); + return true; + } + + public static function readFixed32(&$input, &$value) + { + return $input->readLittleEndian32($value); + } + + public static function readFixed64(&$input, &$value) + { + return $input->readLittleEndian64($value); + } + + public static function readSfixed32(&$input, &$value) + { + if (!self::readFixed32($input, $value)) { + return false; + } + if (PHP_INT_SIZE === 8) { + $value |= (-($value >> 31) << 32); + } + return true; + } + + public static function readSfixed64(&$input, &$value) + { + $success = $input->readLittleEndian64($value); + if (PHP_INT_SIZE == 4 && bccomp($value, "9223372036854775807") > 0) { + $value = bcsub($value, "18446744073709551616"); + } + return $success; + } + + public static function readFloat(&$input, &$value) + { + $data = null; + if (!$input->readRaw(4, $data)) { + return false; + } + $value = unpack('f', $data)[1]; + return true; + } + + public static function readDouble(&$input, &$value) + { + $data = null; + if (!$input->readRaw(8, $data)) { + return false; + } + $value = unpack('d', $data)[1]; + return true; + } + + public static function readBool(&$input, &$value) + { + if (!$input->readVarint64($value)) { + return false; + } + if ($value == 0) { + $value = false; + } else { + $value = true; + } + return true; + } + + public static function readString(&$input, &$value) + { + $length = 0; + return $input->readVarintSizeAsInt($length) && $input->readRaw($length, $value); + } + + public static function readMessage(&$input, &$message) + { + $length = 0; + if (!$input->readVarintSizeAsInt($length)) { + return false; + } + $old_limit = 0; + $recursion_limit = 0; + $input->incrementRecursionDepthAndPushLimit( + $length, + $old_limit, + $recursion_limit); + if ($recursion_limit < 0 || !$message->parseFromStream($input)) { + return false; + } + return $input->decrementRecursionDepthAndPopLimit($old_limit); + } + + public static function writeTag(&$output, $tag) + { + return $output->writeTag($tag); + } + + public static function writeInt32(&$output, $value) + { + return $output->writeVarint32($value, false); + } + + public static function writeInt64(&$output, $value) + { + return $output->writeVarint64($value); + } + + public static function writeUint32(&$output, $value) + { + return $output->writeVarint32($value, true); + } + + public static function writeUint64(&$output, $value) + { + return $output->writeVarint64($value); + } + + public static function writeSint32(&$output, $value) + { + $value = GPBWire::zigZagEncode32($value); + return $output->writeVarint32($value, true); + } + + public static function writeSint64(&$output, $value) + { + $value = GPBWire::zigZagEncode64($value); + return $output->writeVarint64($value); + } + + public static function writeFixed32(&$output, $value) + { + return $output->writeLittleEndian32($value); + } + + public static function writeFixed64(&$output, $value) + { + return $output->writeLittleEndian64($value); + } + + public static function writeSfixed32(&$output, $value) + { + return $output->writeLittleEndian32($value); + } + + public static function writeSfixed64(&$output, $value) + { + return $output->writeLittleEndian64($value); + } + + public static function writeBool(&$output, $value) + { + if ($value) { + return $output->writeVarint32(1, true); + } else { + return $output->writeVarint32(0, true); + } + } + + public static function writeFloat(&$output, $value) + { + $data = pack("f", $value); + return $output->writeRaw($data, 4); + } + + public static function writeDouble(&$output, $value) + { + $data = pack("d", $value); + return $output->writeRaw($data, 8); + } + + public static function writeString(&$output, $value) + { + return self::writeBytes($output, $value); + } + + public static function writeBytes(&$output, $value) + { + $size = strlen($value); + if (!$output->writeVarint32($size, true)) { + return false; + } + return $output->writeRaw($value, $size); + } + + public static function writeMessage(&$output, $value) + { + $size = $value->byteSize(); + if (!$output->writeVarint32($size, true)) { + return false; + } + return $value->serializeToStream($output); + } + + public static function makeTag($number, $type) + { + return ($number << 3) | self::getWireType($type); + } + + public static function tagSize($field) + { + $tag = self::makeTag($field->getNumber(), $field->getType()); + return self::varint32Size($tag); + } + + public static function varint32Size($value, $sign_extended = false) + { + if ($value < 0) { + if ($sign_extended) { + return 10; + } else { + return 5; + } + } + if ($value < (1 << 7)) { + return 1; + } + if ($value < (1 << 14)) { + return 2; + } + if ($value < (1 << 21)) { + return 3; + } + if ($value < (1 << 28)) { + return 4; + } + return 5; + } + + public static function sint32Size($value) + { + $value = self::zigZagEncode32($value); + return self::varint32Size($value); + } + + public static function sint64Size($value) + { + $value = self::zigZagEncode64($value); + return self::varint64Size($value); + } + + public static function varint64Size($value) + { + if (PHP_INT_SIZE == 4) { + if (bccomp($value, 0) < 0 || + bccomp($value, "9223372036854775807") > 0) { + return 10; + } + if (bccomp($value, 1 << 7) < 0) { + return 1; + } + if (bccomp($value, 1 << 14) < 0) { + return 2; + } + if (bccomp($value, 1 << 21) < 0) { + return 3; + } + if (bccomp($value, 1 << 28) < 0) { + return 4; + } + if (bccomp($value, '34359738368') < 0) { + return 5; + } + if (bccomp($value, '4398046511104') < 0) { + return 6; + } + if (bccomp($value, '562949953421312') < 0) { + return 7; + } + if (bccomp($value, '72057594037927936') < 0) { + return 8; + } + return 9; + } else { + if ($value < 0) { + return 10; + } + if ($value < (1 << 7)) { + return 1; + } + if ($value < (1 << 14)) { + return 2; + } + if ($value < (1 << 21)) { + return 3; + } + if ($value < (1 << 28)) { + return 4; + } + if ($value < (1 << 35)) { + return 5; + } + if ($value < (1 << 42)) { + return 6; + } + if ($value < (1 << 49)) { + return 7; + } + if ($value < (1 << 56)) { + return 8; + } + return 9; + } + } + + public static function serializeFieldToStream( + $value, + $field, + $need_tag, + &$output) + { + if ($need_tag) { + if (!GPBWire::writeTag( + $output, + self::makeTag( + $field->getNumber(), + $field->getType()))) { + return false; + } + } + switch ($field->getType()) { + case GPBType::DOUBLE: + if (!GPBWire::writeDouble($output, $value)) { + return false; + } + break; + case GPBType::FLOAT: + if (!GPBWire::writeFloat($output, $value)) { + return false; + } + break; + case GPBType::INT64: + if (!GPBWire::writeInt64($output, $value)) { + return false; + } + break; + case GPBType::UINT64: + if (!GPBWire::writeUint64($output, $value)) { + return false; + } + break; + case GPBType::INT32: + if (!GPBWire::writeInt32($output, $value)) { + return false; + } + break; + case GPBType::FIXED32: + if (!GPBWire::writeFixed32($output, $value)) { + return false; + } + break; + case GPBType::FIXED64: + if (!GPBWire::writeFixed64($output, $value)) { + return false; + } + break; + case GPBType::BOOL: + if (!GPBWire::writeBool($output, $value)) { + return false; + } + break; + case GPBType::STRING: + if (!GPBWire::writeString($output, $value)) { + return false; + } + break; + // case GPBType::GROUP: + // echo "GROUP\xA"; + // trigger_error("Not implemented.", E_ERROR); + // break; + case GPBType::MESSAGE: + if (!GPBWire::writeMessage($output, $value)) { + return false; + } + break; + case GPBType::BYTES: + if (!GPBWire::writeBytes($output, $value)) { + return false; + } + break; + case GPBType::UINT32: + if (PHP_INT_SIZE === 8 && $value < 0) { + $value += 4294967296; + } + if (!GPBWire::writeUint32($output, $value)) { + return false; + } + break; + case GPBType::ENUM: + if (!GPBWire::writeInt32($output, $value)) { + return false; + } + break; + case GPBType::SFIXED32: + if (!GPBWire::writeSfixed32($output, $value)) { + return false; + } + break; + case GPBType::SFIXED64: + if (!GPBWire::writeSfixed64($output, $value)) { + return false; + } + break; + case GPBType::SINT32: + if (!GPBWire::writeSint32($output, $value)) { + return false; + } + break; + case GPBType::SINT64: + if (!GPBWire::writeSint64($output, $value)) { + return false; + } + break; + default: + user_error("Unsupported type."); + return false; + } + + return true; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBWireType.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBWireType.php new file mode 100644 index 00000000..c1ad370e --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBWireType.php @@ -0,0 +1,43 @@ +google.protobuf.GeneratedCodeInfo + */ +class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message +{ + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + * + * Generated from protobuf field repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + */ + private $annotation; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation[]|\Google\Protobuf\Internal\RepeatedField $annotation + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + * + * Generated from protobuf field repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAnnotation() + { + return $this->annotation; + } + + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + * + * Generated from protobuf field repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + * @param \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAnnotation($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation::class); + $this->annotation = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php new file mode 100644 index 00000000..0b043d06 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php @@ -0,0 +1,218 @@ +google.protobuf.GeneratedCodeInfo.Annotation + */ +class Annotation extends \Google\Protobuf\Internal\Message +{ + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + * + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + */ + private $path; + /** + * Identifies the filesystem path to the original source .proto. + * + * Generated from protobuf field optional string source_file = 2; + */ + protected $source_file = null; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + * + * Generated from protobuf field optional int32 begin = 3; + */ + protected $begin = null; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + * + * Generated from protobuf field optional int32 end = 4; + */ + protected $end = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int[]|\Google\Protobuf\Internal\RepeatedField $path + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + * @type string $source_file + * Identifies the filesystem path to the original source .proto. + * @type int $begin + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + * @type int $end + * Identifies the ending offset in bytes in the generated code that + * relates to the identified offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + * + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPath() + { + return $this->path; + } + + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + * + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPath($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->path = $arr; + + return $this; + } + + /** + * Identifies the filesystem path to the original source .proto. + * + * Generated from protobuf field optional string source_file = 2; + * @return string + */ + public function getSourceFile() + { + return isset($this->source_file) ? $this->source_file : ''; + } + + public function hasSourceFile() + { + return isset($this->source_file); + } + + public function clearSourceFile() + { + unset($this->source_file); + } + + /** + * Identifies the filesystem path to the original source .proto. + * + * Generated from protobuf field optional string source_file = 2; + * @param string $var + * @return $this + */ + public function setSourceFile($var) + { + GPBUtil::checkString($var, True); + $this->source_file = $var; + + return $this; + } + + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + * + * Generated from protobuf field optional int32 begin = 3; + * @return int + */ + public function getBegin() + { + return isset($this->begin) ? $this->begin : 0; + } + + public function hasBegin() + { + return isset($this->begin); + } + + public function clearBegin() + { + unset($this->begin); + } + + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + * + * Generated from protobuf field optional int32 begin = 3; + * @param int $var + * @return $this + */ + public function setBegin($var) + { + GPBUtil::checkInt32($var); + $this->begin = $var; + + return $this; + } + + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + * + * Generated from protobuf field optional int32 end = 4; + * @return int + */ + public function getEnd() + { + return isset($this->end) ? $this->end : 0; + } + + public function hasEnd() + { + return isset($this->end); + } + + public function clearEnd() + { + unset($this->end); + } + + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + * + * Generated from protobuf field optional int32 end = 4; + * @param int $var + * @return $this + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Annotation::class, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php new file mode 100644 index 00000000..e36f1e57 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php @@ -0,0 +1,16 @@ +getPublicDescriptor(); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php new file mode 100644 index 00000000..ed5d1660 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php @@ -0,0 +1,43 @@ +public_desc; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/MapEntry.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/MapEntry.php new file mode 100644 index 00000000..e89481f0 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/MapEntry.php @@ -0,0 +1,71 @@ +getFieldByNumber(2); + if ($value_field->getType() == GPBType::MESSAGE) { + $klass = $value_field->getMessageType()->getClass(); + $value = new $klass; + $this->setValue($value); + } + } + + public function setKey($key) { + $this->key = $key; + } + + public function getKey() { + return $this->key; + } + + public function setValue($value) { + $this->value = $value; + } + + public function getValue() { + return $this->value; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/MapField.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/MapField.php new file mode 100644 index 00000000..719fb350 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/MapField.php @@ -0,0 +1,290 @@ +container = []; + $this->key_type = $key_type; + $this->value_type = $value_type; + $this->klass = $klass; + + if ($this->value_type == GPBType::MESSAGE) { + $pool = DescriptorPool::getGeneratedPool(); + $desc = $pool->getDescriptorByClassName($klass); + if ($desc == NULL) { + new $klass; // No msg class instance has been created before. + $desc = $pool->getDescriptorByClassName($klass); + } + $this->klass = $desc->getClass(); + $this->legacy_klass = $desc->getLegacyClass(); + } + } + + /** + * @ignore + */ + public function getKeyType() + { + return $this->key_type; + } + + /** + * @ignore + */ + public function getValueType() + { + return $this->value_type; + } + + /** + * @ignore + */ + public function getValueClass() + { + return $this->klass; + } + + /** + * @ignore + */ + public function getLegacyValueClass() + { + return $this->legacy_klass; + } + + /** + * Return the element at the given key. + * + * This will also be called for: $ele = $arr[$key] + * + * @param int|bool|string $key The key of the element to be fetched. + * @return object The stored element at given key. + * @throws \ErrorException Invalid type for index. + * @throws \ErrorException Non-existing index. + */ + public function offsetGet($key) + { + return $this->container[$key]; + } + + /** + * Assign the element at the given key. + * + * This will also be called for: $arr[$key] = $value + * + * @param object $key The key of the element to be fetched. + * @param object $value The element to be assigned. + * @return void + * @throws \ErrorException Invalid type for key. + * @throws \ErrorException Invalid type for value. + * @throws \ErrorException Non-existing key. + */ + public function offsetSet($key, $value) + { + $this->checkKey($this->key_type, $key); + + switch ($this->value_type) { + case GPBType::SFIXED32: + case GPBType::SINT32: + case GPBType::INT32: + case GPBType::ENUM: + GPBUtil::checkInt32($value); + break; + case GPBType::FIXED32: + case GPBType::UINT32: + GPBUtil::checkUint32($value); + break; + case GPBType::SFIXED64: + case GPBType::SINT64: + case GPBType::INT64: + GPBUtil::checkInt64($value); + break; + case GPBType::FIXED64: + case GPBType::UINT64: + GPBUtil::checkUint64($value); + break; + case GPBType::FLOAT: + GPBUtil::checkFloat($value); + break; + case GPBType::DOUBLE: + GPBUtil::checkDouble($value); + break; + case GPBType::BOOL: + GPBUtil::checkBool($value); + break; + case GPBType::STRING: + GPBUtil::checkString($value, true); + break; + case GPBType::MESSAGE: + if (is_null($value)) { + trigger_error("Map element cannot be null.", E_USER_ERROR); + } + GPBUtil::checkMessage($value, $this->klass); + break; + default: + break; + } + + $this->container[$key] = $value; + } + + /** + * Remove the element at the given key. + * + * This will also be called for: unset($arr) + * + * @param object $key The key of the element to be removed. + * @return void + * @throws \ErrorException Invalid type for key. + */ + public function offsetUnset($key) + { + $this->checkKey($this->key_type, $key); + unset($this->container[$key]); + } + + /** + * Check the existence of the element at the given key. + * + * This will also be called for: isset($arr) + * + * @param object $key The key of the element to be removed. + * @return bool True if the element at the given key exists. + * @throws \ErrorException Invalid type for key. + */ + public function offsetExists($key) + { + $this->checkKey($this->key_type, $key); + return isset($this->container[$key]); + } + + /** + * @ignore + */ + public function getIterator() + { + return new MapFieldIter($this->container, $this->key_type); + } + + /** + * Return the number of stored elements. + * + * This will also be called for: count($arr) + * + * @return integer The number of stored elements. + */ + public function count() + { + return count($this->container); + } + + /** + * @ignore + */ + private function checkKey($key_type, &$key) + { + switch ($key_type) { + case GPBType::SFIXED32: + case GPBType::SINT32: + case GPBType::INT32: + GPBUtil::checkInt32($key); + break; + case GPBType::FIXED32: + case GPBType::UINT32: + GPBUtil::checkUint32($key); + break; + case GPBType::SFIXED64: + case GPBType::SINT64: + case GPBType::INT64: + GPBUtil::checkInt64($key); + break; + case GPBType::FIXED64: + case GPBType::UINT64: + GPBUtil::checkUint64($key); + break; + case GPBType::BOOL: + GPBUtil::checkBool($key); + break; + case GPBType::STRING: + GPBUtil::checkString($key, true); + break; + default: + trigger_error( + "Given type cannot be map key.", + E_USER_ERROR); + break; + } + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/MapFieldIter.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/MapFieldIter.php new file mode 100644 index 00000000..4e18005e --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/MapFieldIter.php @@ -0,0 +1,134 @@ +container = $container; + $this->key_type = $key_type; + } + + /** + * Reset the status of the iterator + * + * @return void + */ + public function rewind() + { + return reset($this->container); + } + + /** + * Return the element at the current position. + * + * @return object The element at the current position. + */ + public function current() + { + return current($this->container); + } + + /** + * Return the current key. + * + * @return object The current key. + */ + public function key() + { + $key = key($this->container); + switch ($this->key_type) { + case GPBType::INT64: + case GPBType::UINT64: + case GPBType::FIXED64: + case GPBType::SFIXED64: + case GPBType::SINT64: + if (PHP_INT_SIZE === 8) { + return $key; + } + // Intentionally fall through + case GPBType::STRING: + // PHP associative array stores int string as int for key. + return strval($key); + case GPBType::BOOL: + // PHP associative array stores bool as integer for key. + return boolval($key); + default: + return $key; + } + } + + /** + * Move to the next position. + * + * @return void + */ + public function next() + { + return next($this->container); + } + + /** + * Check whether there are more elements to iterate. + * + * @return bool True if there are more elements to iterate. + */ + public function valid() + { + return key($this->container) !== null; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php new file mode 100644 index 00000000..19b48f0b --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php @@ -0,0 +1,2034 @@ +initWithDescriptor($data); + } else { + $this->initWithGeneratedPool(); + if (is_array($data)) { + $this->mergeFromArray($data); + } else if (!empty($data)) { + throw new \InvalidArgumentException( + 'Message constructor must be an array or null.' + ); + } + } + } + + /** + * @ignore + */ + private function initWithGeneratedPool() + { + $pool = DescriptorPool::getGeneratedPool(); + $this->desc = $pool->getDescriptorByClassName(get_class($this)); + if (is_null($this->desc)) { + throw new \InvalidArgumentException( + get_class($this) ." is not found in descriptor pool. " . + 'Only generated classes may derive from Message.'); + } + foreach ($this->desc->getField() as $field) { + $setter = $field->getSetter(); + if ($field->isMap()) { + $message_type = $field->getMessageType(); + $key_field = $message_type->getFieldByNumber(1); + $value_field = $message_type->getFieldByNumber(2); + switch ($value_field->getType()) { + case GPBType::MESSAGE: + case GPBType::GROUP: + $map_field = new MapField( + $key_field->getType(), + $value_field->getType(), + $value_field->getMessageType()->getClass()); + $this->$setter($map_field); + break; + case GPBType::ENUM: + $map_field = new MapField( + $key_field->getType(), + $value_field->getType(), + $value_field->getEnumType()->getClass()); + $this->$setter($map_field); + break; + default: + $map_field = new MapField( + $key_field->getType(), + $value_field->getType()); + $this->$setter($map_field); + break; + } + } else if ($field->getLabel() === GPBLabel::REPEATED) { + switch ($field->getType()) { + case GPBType::MESSAGE: + case GPBType::GROUP: + $repeated_field = new RepeatedField( + $field->getType(), + $field->getMessageType()->getClass()); + $this->$setter($repeated_field); + break; + case GPBType::ENUM: + $repeated_field = new RepeatedField( + $field->getType(), + $field->getEnumType()->getClass()); + $this->$setter($repeated_field); + break; + default: + $repeated_field = new RepeatedField($field->getType()); + $this->$setter($repeated_field); + break; + } + } else if ($field->getOneofIndex() !== -1) { + $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()]; + $oneof_name = $oneof->getName(); + $this->$oneof_name = new OneofField($oneof); + } else if ($field->getLabel() === GPBLabel::OPTIONAL && + PHP_INT_SIZE == 4) { + switch ($field->getType()) { + case GPBType::INT64: + case GPBType::UINT64: + case GPBType::FIXED64: + case GPBType::SFIXED64: + case GPBType::SINT64: + $this->$setter("0"); + } + } + } + } + + /** + * @ignore + */ + private function initWithDescriptor(Descriptor $desc) + { + $this->desc = $desc; + foreach ($desc->getField() as $field) { + $setter = $field->getSetter(); + $defaultValue = $this->defaultValue($field); + $this->$setter($defaultValue); + } + } + + protected function readWrapperValue($member) + { + $field = $this->desc->getFieldByName($member); + $oneof_index = $field->getOneofIndex(); + if ($oneof_index === -1) { + $wrapper = $this->$member; + } else { + $wrapper = $this->readOneof($field->getNumber()); + } + + if (is_null($wrapper)) { + return NULL; + } else { + return $wrapper->getValue(); + } + } + + protected function writeWrapperValue($member, $value) + { + $field = $this->desc->getFieldByName($member); + $wrapped_value = $value; + if (!is_null($value)) { + $desc = $field->getMessageType(); + $klass = $desc->getClass(); + $wrapped_value = new $klass; + $wrapped_value->setValue($value); + } + + $oneof_index = $field->getOneofIndex(); + if ($oneof_index === -1) { + $this->$member = $wrapped_value; + } else { + $this->writeOneof($field->getNumber(), $wrapped_value); + } + } + + protected function readOneof($number) + { + $field = $this->desc->getFieldByNumber($number); + $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()]; + $oneof_name = $oneof->getName(); + $oneof_field = $this->$oneof_name; + if ($number === $oneof_field->getNumber()) { + return $oneof_field->getValue(); + } else { + return $this->defaultValue($field); + } + } + + protected function hasOneof($number) + { + $field = $this->desc->getFieldByNumber($number); + $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()]; + $oneof_name = $oneof->getName(); + $oneof_field = $this->$oneof_name; + return $number === $oneof_field->getNumber(); + } + + protected function writeOneof($number, $value) + { + $field = $this->desc->getFieldByNumber($number); + $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()]; + $oneof_name = $oneof->getName(); + if ($value === null) { + $this->$oneof_name = new OneofField($oneof); + } else { + $oneof_field = $this->$oneof_name; + $oneof_field->setValue($value); + $oneof_field->setFieldName($field->getName()); + $oneof_field->setNumber($number); + } + } + + protected function whichOneof($oneof_name) + { + $oneof_field = $this->$oneof_name; + $number = $oneof_field->getNumber(); + if ($number == 0) { + return ""; + } + $field = $this->desc->getFieldByNumber($number); + return $field->getName(); + } + + /** + * @ignore + */ + private function defaultValue($field) + { + $value = null; + + switch ($field->getType()) { + case GPBType::DOUBLE: + case GPBType::FLOAT: + return 0.0; + case GPBType::UINT32: + case GPBType::INT32: + case GPBType::FIXED32: + case GPBType::SFIXED32: + case GPBType::SINT32: + case GPBType::ENUM: + return 0; + case GPBType::INT64: + case GPBType::UINT64: + case GPBType::FIXED64: + case GPBType::SFIXED64: + case GPBType::SINT64: + if (PHP_INT_SIZE === 4) { + return '0'; + } else { + return 0; + } + case GPBType::BOOL: + return false; + case GPBType::STRING: + case GPBType::BYTES: + return ""; + case GPBType::GROUP: + case GPBType::MESSAGE: + return null; + default: + user_error("Unsupported type."); + return false; + } + } + + /** + * @ignore + */ + private function skipField($input, $tag) + { + $number = GPBWire::getTagFieldNumber($tag); + if ($number === 0) { + throw new GPBDecodeException("Illegal field number zero."); + } + + $start = $input->current(); + switch (GPBWire::getTagWireType($tag)) { + case GPBWireType::VARINT: + $uint64 = 0; + if (!$input->readVarint64($uint64)) { + throw new GPBDecodeException( + "Unexpected EOF inside varint."); + } + break; + case GPBWireType::FIXED64: + $uint64 = 0; + if (!$input->readLittleEndian64($uint64)) { + throw new GPBDecodeException( + "Unexpected EOF inside fixed64."); + } + break; + case GPBWireType::FIXED32: + $uint32 = 0; + if (!$input->readLittleEndian32($uint32)) { + throw new GPBDecodeException( + "Unexpected EOF inside fixed32."); + } + break; + case GPBWireType::LENGTH_DELIMITED: + $length = 0; + if (!$input->readVarint32($length)) { + throw new GPBDecodeException( + "Unexpected EOF inside length."); + } + $data = NULL; + if (!$input->readRaw($length, $data)) { + throw new GPBDecodeException( + "Unexpected EOF inside length delimited data."); + } + break; + case GPBWireType::START_GROUP: + case GPBWireType::END_GROUP: + throw new GPBDecodeException("Unexpected wire type."); + default: + throw new GPBDecodeException("Unexpected wire type."); + } + $end = $input->current(); + + $bytes = str_repeat(chr(0), CodedOutputStream::MAX_VARINT64_BYTES); + $size = CodedOutputStream::writeVarintToArray($tag, $bytes, true); + $this->unknown .= substr($bytes, 0, $size) . $input->substr($start, $end); + } + + /** + * @ignore + */ + private static function parseFieldFromStreamNoTag($input, $field, &$value) + { + switch ($field->getType()) { + case GPBType::DOUBLE: + if (!GPBWire::readDouble($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside double field."); + } + break; + case GPBType::FLOAT: + if (!GPBWire::readFloat($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside float field."); + } + break; + case GPBType::INT64: + if (!GPBWire::readInt64($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside int64 field."); + } + break; + case GPBType::UINT64: + if (!GPBWire::readUint64($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside uint64 field."); + } + break; + case GPBType::INT32: + if (!GPBWire::readInt32($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside int32 field."); + } + break; + case GPBType::FIXED64: + if (!GPBWire::readFixed64($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside fixed64 field."); + } + break; + case GPBType::FIXED32: + if (!GPBWire::readFixed32($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside fixed32 field."); + } + break; + case GPBType::BOOL: + if (!GPBWire::readBool($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside bool field."); + } + break; + case GPBType::STRING: + // TODO(teboring): Add utf-8 check. + if (!GPBWire::readString($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside string field."); + } + break; + case GPBType::GROUP: + trigger_error("Not implemented.", E_ERROR); + break; + case GPBType::MESSAGE: + if ($field->isMap()) { + $value = new MapEntry($field->getMessageType()); + } else { + $klass = $field->getMessageType()->getClass(); + $value = new $klass; + } + if (!GPBWire::readMessage($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside message."); + } + break; + case GPBType::BYTES: + if (!GPBWire::readString($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside bytes field."); + } + break; + case GPBType::UINT32: + if (!GPBWire::readUint32($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside uint32 field."); + } + break; + case GPBType::ENUM: + // TODO(teboring): Check unknown enum value. + if (!GPBWire::readInt32($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside enum field."); + } + break; + case GPBType::SFIXED32: + if (!GPBWire::readSfixed32($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside sfixed32 field."); + } + break; + case GPBType::SFIXED64: + if (!GPBWire::readSfixed64($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside sfixed64 field."); + } + break; + case GPBType::SINT32: + if (!GPBWire::readSint32($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside sint32 field."); + } + break; + case GPBType::SINT64: + if (!GPBWire::readSint64($input, $value)) { + throw new GPBDecodeException( + "Unexpected EOF inside sint64 field."); + } + break; + default: + user_error("Unsupported type."); + return false; + } + return true; + } + + /** + * @ignore + */ + private function parseFieldFromStream($tag, $input, $field) + { + $value = null; + + if (is_null($field)) { + $value_format = GPBWire::UNKNOWN; + } elseif (GPBWire::getTagWireType($tag) === + GPBWire::getWireType($field->getType())) { + $value_format = GPBWire::NORMAL_FORMAT; + } elseif ($field->isPackable() && + GPBWire::getTagWireType($tag) === + GPBWire::WIRETYPE_LENGTH_DELIMITED) { + $value_format = GPBWire::PACKED_FORMAT; + } else { + // the wire type doesn't match. Put it in our unknown field set. + $value_format = GPBWire::UNKNOWN; + } + + if ($value_format === GPBWire::UNKNOWN) { + $this->skipField($input, $tag); + return; + } elseif ($value_format === GPBWire::NORMAL_FORMAT) { + self::parseFieldFromStreamNoTag($input, $field, $value); + } elseif ($value_format === GPBWire::PACKED_FORMAT) { + $length = 0; + if (!GPBWire::readInt32($input, $length)) { + throw new GPBDecodeException( + "Unexpected EOF inside packed length."); + } + $limit = $input->pushLimit($length); + $getter = $field->getGetter(); + while ($input->bytesUntilLimit() > 0) { + self::parseFieldFromStreamNoTag($input, $field, $value); + $this->appendHelper($field, $value); + } + $input->popLimit($limit); + return; + } else { + return; + } + + if ($field->isMap()) { + $this->kvUpdateHelper($field, $value->getKey(), $value->getValue()); + } else if ($field->isRepeated()) { + $this->appendHelper($field, $value); + } else { + $setter = $field->getSetter(); + $this->$setter($value); + } + } + + /** + * Clear all containing fields. + * @return null. + */ + public function clear() + { + $this->unknown = ""; + foreach ($this->desc->getField() as $field) { + $setter = $field->getSetter(); + if ($field->isMap()) { + $message_type = $field->getMessageType(); + $key_field = $message_type->getFieldByNumber(1); + $value_field = $message_type->getFieldByNumber(2); + switch ($value_field->getType()) { + case GPBType::MESSAGE: + case GPBType::GROUP: + $map_field = new MapField( + $key_field->getType(), + $value_field->getType(), + $value_field->getMessageType()->getClass()); + $this->$setter($map_field); + break; + case GPBType::ENUM: + $map_field = new MapField( + $key_field->getType(), + $value_field->getType(), + $value_field->getEnumType()->getClass()); + $this->$setter($map_field); + break; + default: + $map_field = new MapField( + $key_field->getType(), + $value_field->getType()); + $this->$setter($map_field); + break; + } + } else if ($field->getLabel() === GPBLabel::REPEATED) { + switch ($field->getType()) { + case GPBType::MESSAGE: + case GPBType::GROUP: + $repeated_field = new RepeatedField( + $field->getType(), + $field->getMessageType()->getClass()); + $this->$setter($repeated_field); + break; + case GPBType::ENUM: + $repeated_field = new RepeatedField( + $field->getType(), + $field->getEnumType()->getClass()); + $this->$setter($repeated_field); + break; + default: + $repeated_field = new RepeatedField($field->getType()); + $this->$setter($repeated_field); + break; + } + } else if ($field->getOneofIndex() !== -1) { + $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()]; + $oneof_name = $oneof->getName(); + $this->$oneof_name = new OneofField($oneof); + } else if ($field->getLabel() === GPBLabel::OPTIONAL) { + switch ($field->getType()) { + case GPBType::DOUBLE : + case GPBType::FLOAT : + $this->$setter(0.0); + break; + case GPBType::INT32 : + case GPBType::FIXED32 : + case GPBType::UINT32 : + case GPBType::SFIXED32 : + case GPBType::SINT32 : + case GPBType::ENUM : + $this->$setter(0); + break; + case GPBType::BOOL : + $this->$setter(false); + break; + case GPBType::STRING : + case GPBType::BYTES : + $this->$setter(""); + break; + case GPBType::GROUP : + case GPBType::MESSAGE : + $null = null; + $this->$setter($null); + break; + } + if (PHP_INT_SIZE == 4) { + switch ($field->getType()) { + case GPBType::INT64: + case GPBType::UINT64: + case GPBType::FIXED64: + case GPBType::SFIXED64: + case GPBType::SINT64: + $this->$setter("0"); + } + } else { + switch ($field->getType()) { + case GPBType::INT64: + case GPBType::UINT64: + case GPBType::FIXED64: + case GPBType::SFIXED64: + case GPBType::SINT64: + $this->$setter(0); + } + } + } + } + } + + /** + * Clear all unknown fields previously parsed. + * @return null. + */ + public function discardUnknownFields() + { + $this->unknown = ""; + foreach ($this->desc->getField() as $field) { + if ($field->getType() != GPBType::MESSAGE) { + continue; + } + if ($field->isMap()) { + $value_field = $field->getMessageType()->getFieldByNumber(2); + if ($value_field->getType() != GPBType::MESSAGE) { + continue; + } + $getter = $field->getGetter(); + $map = $this->$getter(); + foreach ($map as $key => $value) { + $value->discardUnknownFields(); + } + } else if ($field->getLabel() === GPBLabel::REPEATED) { + $getter = $field->getGetter(); + $arr = $this->$getter(); + foreach ($arr as $sub) { + $sub->discardUnknownFields(); + } + } else if ($field->getLabel() === GPBLabel::OPTIONAL) { + $getter = $field->getGetter(); + $sub = $this->$getter(); + if (!is_null($sub)) { + $sub->discardUnknownFields(); + } + } + } + } + + /** + * Merges the contents of the specified message into current message. + * + * This method merges the contents of the specified message into the + * current message. Singular fields that are set in the specified message + * overwrite the corresponding fields in the current message. Repeated + * fields are appended. Map fields key-value pairs are overwritten. + * Singular/Oneof sub-messages are recursively merged. All overwritten + * sub-messages are deep-copied. + * + * @param object $msg Protobuf message to be merged from. + * @return null. + */ + public function mergeFrom($msg) + { + if (get_class($this) !== get_class($msg)) { + user_error("Cannot merge messages with different class."); + return; + } + + foreach ($this->desc->getField() as $field) { + $setter = $field->getSetter(); + $getter = $field->getGetter(); + if ($field->isMap()) { + if (count($msg->$getter()) != 0) { + $value_field = $field->getMessageType()->getFieldByNumber(2); + foreach ($msg->$getter() as $key => $value) { + if ($value_field->getType() == GPBType::MESSAGE) { + $klass = $value_field->getMessageType()->getClass(); + $copy = new $klass; + $copy->mergeFrom($value); + + $this->kvUpdateHelper($field, $key, $copy); + } else { + $this->kvUpdateHelper($field, $key, $value); + } + } + } + } else if ($field->getLabel() === GPBLabel::REPEATED) { + if (count($msg->$getter()) != 0) { + foreach ($msg->$getter() as $tmp) { + if ($field->getType() == GPBType::MESSAGE) { + $klass = $field->getMessageType()->getClass(); + $copy = new $klass; + $copy->mergeFrom($tmp); + $this->appendHelper($field, $copy); + } else { + $this->appendHelper($field, $tmp); + } + } + } + } else if ($field->getLabel() === GPBLabel::OPTIONAL) { + if($msg->$getter() !== $this->defaultValue($field)) { + $tmp = $msg->$getter(); + if ($field->getType() == GPBType::MESSAGE) { + if (is_null($this->$getter())) { + $klass = $field->getMessageType()->getClass(); + $new_msg = new $klass; + $this->$setter($new_msg); + } + $this->$getter()->mergeFrom($tmp); + } else { + $this->$setter($tmp); + } + } + } + } + } + + /** + * Parses a protocol buffer contained in a string. + * + * This function takes a string in the (non-human-readable) binary wire + * format, matching the encoding output by serializeToString(). + * See mergeFrom() for merging behavior, if the field is already set in the + * specified message. + * + * @param string $data Binary protobuf data. + * @return null. + * @throws \Exception Invalid data. + */ + public function mergeFromString($data) + { + $input = new CodedInputStream($data); + $this->parseFromStream($input); + } + + /** + * Parses a json string to protobuf message. + * + * This function takes a string in the json wire format, matching the + * encoding output by serializeToJsonString(). + * See mergeFrom() for merging behavior, if the field is already set in the + * specified message. + * + * @param string $data Json protobuf data. + * @return null. + * @throws \Exception Invalid data. + */ + public function mergeFromJsonString($data, $ignore_unknown = false) + { + $input = new RawInputStream($data); + $this->parseFromJsonStream($input, $ignore_unknown); + } + + /** + * @ignore + */ + public function parseFromStream($input) + { + while (true) { + $tag = $input->readTag(); + // End of input. This is a valid place to end, so return true. + if ($tag === 0) { + return true; + } + + $number = GPBWire::getTagFieldNumber($tag); + $field = $this->desc->getFieldByNumber($number); + + $this->parseFieldFromStream($tag, $input, $field); + } + } + + private function convertJsonValueToProtoValue( + $value, + $field, + $ignore_unknown, + $is_map_key = false) + { + switch ($field->getType()) { + case GPBType::MESSAGE: + $klass = $field->getMessageType()->getClass(); + $submsg = new $klass; + + if (is_a($submsg, "Google\Protobuf\Duration")) { + if (is_null($value)) { + return $this->defaultValue($field); + } else if (!is_string($value)) { + throw new GPBDecodeException("Expect string."); + } + return GPBUtil::parseDuration($value); + } else if ($field->isTimestamp()) { + if (is_null($value)) { + return $this->defaultValue($field); + } else if (!is_string($value)) { + throw new GPBDecodeException("Expect string."); + } + try { + $timestamp = GPBUtil::parseTimestamp($value); + } catch (\Exception $e) { + throw new GPBDecodeException( + "Invalid RFC 3339 timestamp: ".$e->getMessage()); + } + + $submsg->setSeconds($timestamp->getSeconds()); + $submsg->setNanos($timestamp->getNanos()); + } else if (is_a($submsg, "Google\Protobuf\FieldMask")) { + if (is_null($value)) { + return $this->defaultValue($field); + } + try { + return GPBUtil::parseFieldMask($value); + } catch (\Exception $e) { + throw new GPBDecodeException( + "Invalid FieldMask: ".$e->getMessage()); + } + } else { + if (is_null($value) && + !is_a($submsg, "Google\Protobuf\Value")) { + return $this->defaultValue($field); + } + if (GPBUtil::hasSpecialJsonMapping($submsg)) { + } elseif (!is_object($value) && !is_array($value)) { + throw new GPBDecodeException("Expect message."); + } + $submsg->mergeFromJsonArray($value, $ignore_unknown); + } + return $submsg; + case GPBType::ENUM: + if (is_null($value)) { + return $this->defaultValue($field); + } + if (is_integer($value)) { + return $value; + } + $enum_value = $field->getEnumType()->getValueByName($value); + if (!is_null($enum_value)) { + return $enum_value->getNumber(); + } else if ($ignore_unknown) { + return $this->defaultValue($field); + } else { + throw new GPBDecodeException( + "Enum field only accepts integer or enum value name"); + } + case GPBType::STRING: + if (is_null($value)) { + return $this->defaultValue($field); + } + if (is_numeric($value)) { + return strval($value); + } + if (!is_string($value)) { + throw new GPBDecodeException( + "String field only accepts string value"); + } + return $value; + case GPBType::BYTES: + if (is_null($value)) { + return $this->defaultValue($field); + } + if (!is_string($value)) { + throw new GPBDecodeException( + "Byte field only accepts string value"); + } + $proto_value = base64_decode($value, true); + if ($proto_value === false) { + throw new GPBDecodeException("Invalid base64 characters"); + } + return $proto_value; + case GPBType::BOOL: + if (is_null($value)) { + return $this->defaultValue($field); + } + if ($is_map_key) { + if ($value === "true") { + return true; + } + if ($value === "false") { + return false; + } + throw new GPBDecodeException( + "Bool field only accepts bool value"); + } + if (!is_bool($value)) { + throw new GPBDecodeException( + "Bool field only accepts bool value"); + } + return $value; + case GPBType::FLOAT: + case GPBType::DOUBLE: + if (is_null($value)) { + return $this->defaultValue($field); + } + if ($value === "Infinity") { + return INF; + } + if ($value === "-Infinity") { + return -INF; + } + if ($value === "NaN") { + return NAN; + } + return $value; + case GPBType::INT32: + case GPBType::SINT32: + case GPBType::SFIXED32: + if (is_null($value)) { + return $this->defaultValue($field); + } + if (!is_numeric($value)) { + throw new GPBDecodeException( + "Invalid data type for int32 field"); + } + if (is_string($value) && trim($value) !== $value) { + throw new GPBDecodeException( + "Invalid data type for int32 field"); + } + if (bccomp($value, "2147483647") > 0) { + throw new GPBDecodeException( + "Int32 too large"); + } + if (bccomp($value, "-2147483648") < 0) { + throw new GPBDecodeException( + "Int32 too small"); + } + return $value; + case GPBType::UINT32: + case GPBType::FIXED32: + if (is_null($value)) { + return $this->defaultValue($field); + } + if (!is_numeric($value)) { + throw new GPBDecodeException( + "Invalid data type for uint32 field"); + } + if (is_string($value) && trim($value) !== $value) { + throw new GPBDecodeException( + "Invalid data type for int32 field"); + } + if (bccomp($value, 4294967295) > 0) { + throw new GPBDecodeException( + "Uint32 too large"); + } + return $value; + case GPBType::INT64: + case GPBType::SINT64: + case GPBType::SFIXED64: + if (is_null($value)) { + return $this->defaultValue($field); + } + if (!is_numeric($value)) { + throw new GPBDecodeException( + "Invalid data type for int64 field"); + } + if (is_string($value) && trim($value) !== $value) { + throw new GPBDecodeException( + "Invalid data type for int64 field"); + } + if (bccomp($value, "9223372036854775807") > 0) { + throw new GPBDecodeException( + "Int64 too large"); + } + if (bccomp($value, "-9223372036854775808") < 0) { + throw new GPBDecodeException( + "Int64 too small"); + } + return $value; + case GPBType::UINT64: + case GPBType::FIXED64: + if (is_null($value)) { + return $this->defaultValue($field); + } + if (!is_numeric($value)) { + throw new GPBDecodeException( + "Invalid data type for int64 field"); + } + if (is_string($value) && trim($value) !== $value) { + throw new GPBDecodeException( + "Invalid data type for int64 field"); + } + if (bccomp($value, "18446744073709551615") > 0) { + throw new GPBDecodeException( + "Uint64 too large"); + } + if (bccomp($value, "9223372036854775807") > 0) { + $value = bcsub($value, "18446744073709551616"); + } + return $value; + default: + return $value; + } + } + + /** + * Populates the message from a user-supplied PHP array. Array keys + * correspond to Message properties and nested message properties. + * + * Example: + * ``` + * $message->mergeFromArray([ + * 'name' => 'This is a message name', + * 'interval' => [ + * 'startTime' => time() - 60, + * 'endTime' => time(), + * ] + * ]); + * ``` + * + * This method will trigger an error if it is passed data that cannot + * be converted to the correct type. For example, a StringValue field + * must receive data that is either a string or a StringValue object. + * + * @param array $array An array containing message properties and values. + * @return null. + */ + protected function mergeFromArray(array $array) + { + // Just call the setters for the field names + foreach ($array as $key => $value) { + $field = $this->desc->getFieldByName($key); + if (is_null($field)) { + throw new \UnexpectedValueException( + 'Invalid message property: ' . $key); + } + $setter = $field->getSetter(); + if ($field->isMap()) { + $valueField = $field->getMessageType()->getFieldByName('value'); + if (!is_null($valueField) && $valueField->isWrapperType()) { + self::normalizeArrayElementsToMessageType($value, $valueField->getMessageType()->getClass()); + } + } elseif ($field->isWrapperType()) { + $class = $field->getMessageType()->getClass(); + if ($field->isRepeated()) { + self::normalizeArrayElementsToMessageType($value, $class); + } else { + self::normalizeToMessageType($value, $class); + } + } + $this->$setter($value); + } + } + + /** + * Tries to normalize the elements in $value into a provided protobuf + * wrapper type $class. If $value is any type other than array, we do + * not do any conversion, and instead rely on the existing protobuf + * type checking. If $value is an array, we process each element and + * try to convert it to an instance of $class. + * + * @param mixed $value The array of values to normalize. + * @param string $class The expected wrapper class name + */ + private static function normalizeArrayElementsToMessageType(&$value, $class) + { + if (!is_array($value)) { + // In the case that $value is not an array, we do not want to + // attempt any conversion. Note that this includes the cases + // when $value is a RepeatedField of MapField. In those cases, + // we do not need to convert the elements, as they should + // already be the correct types. + return; + } else { + // Normalize each element in the array. + foreach ($value as $key => &$elementValue) { + self::normalizeToMessageType($elementValue, $class); + } + } + } + + /** + * Tries to normalize $value into a provided protobuf wrapper type $class. + * If $value is any type other than an object, we attempt to construct an + * instance of $class and assign $value to it using the setValue method + * shared by all wrapper types. + * + * This method will raise an error if it receives a type that cannot be + * assigned to the wrapper type via setValue. + * + * @param mixed $value The value to normalize. + * @param string $class The expected wrapper class name + */ + private static function normalizeToMessageType(&$value, $class) + { + if (is_null($value) || is_object($value)) { + // This handles the case that $value is an instance of $class. We + // choose not to do any more strict checking here, relying on the + // existing type checking done by GPBUtil. + return; + } else { + // Try to instantiate $class and set the value + try { + $msg = new $class; + $msg->setValue($value); + $value = $msg; + return; + } catch (\Exception $exception) { + trigger_error( + "Error normalizing value to type '$class': " . $exception->getMessage(), + E_USER_ERROR + ); + } + } + } + + protected function mergeFromJsonArray($array, $ignore_unknown) + { + if (is_a($this, "Google\Protobuf\Any")) { + $this->clear(); + $this->setTypeUrl($array["@type"]); + $msg = $this->unpack(); + if (GPBUtil::hasSpecialJsonMapping($msg)) { + $msg->mergeFromJsonArray($array["value"], $ignore_unknown); + } else { + unset($array["@type"]); + $msg->mergeFromJsonArray($array, $ignore_unknown); + } + $this->setValue($msg->serializeToString()); + return; + } + if (is_a($this, "Google\Protobuf\DoubleValue") || + is_a($this, "Google\Protobuf\FloatValue") || + is_a($this, "Google\Protobuf\Int64Value") || + is_a($this, "Google\Protobuf\UInt64Value") || + is_a($this, "Google\Protobuf\Int32Value") || + is_a($this, "Google\Protobuf\UInt32Value") || + is_a($this, "Google\Protobuf\BoolValue") || + is_a($this, "Google\Protobuf\StringValue")) { + $this->setValue($array); + return; + } + if (is_a($this, "Google\Protobuf\BytesValue")) { + $this->setValue(base64_decode($array)); + return; + } + if (is_a($this, "Google\Protobuf\Duration")) { + $this->mergeFrom(GPBUtil::parseDuration($array)); + return; + } + if (is_a($this, "Google\Protobuf\FieldMask")) { + $this->mergeFrom(GPBUtil::parseFieldMask($array)); + return; + } + if (is_a($this, "Google\Protobuf\Timestamp")) { + $this->mergeFrom(GPBUtil::parseTimestamp($array)); + return; + } + if (is_a($this, "Google\Protobuf\Struct")) { + $fields = $this->getFields(); + foreach($array as $key => $value) { + $v = new Value(); + $v->mergeFromJsonArray($value, $ignore_unknown); + $fields[$key] = $v; + } + return; + } + if (is_a($this, "Google\Protobuf\Value")) { + if (is_bool($array)) { + $this->setBoolValue($array); + } elseif (is_string($array)) { + $this->setStringValue($array); + } elseif (is_null($array)) { + $this->setNullValue(0); + } elseif (is_double($array) || is_integer($array)) { + $this->setNumberValue($array); + } elseif (is_array($array)) { + if (array_values($array) !== $array) { + // Associative array + $struct_value = $this->getStructValue(); + if (is_null($struct_value)) { + $struct_value = new Struct(); + $this->setStructValue($struct_value); + } + foreach ($array as $key => $v) { + $value = new Value(); + $value->mergeFromJsonArray($v, $ignore_unknown); + $values = $struct_value->getFields(); + $values[$key]= $value; + } + } else { + // Array + $list_value = $this->getListValue(); + if (is_null($list_value)) { + $list_value = new ListValue(); + $this->setListValue($list_value); + } + foreach ($array as $v) { + $value = new Value(); + $value->mergeFromJsonArray($v, $ignore_unknown); + $values = $list_value->getValues(); + $values[]= $value; + } + } + } else { + throw new GPBDecodeException("Invalid type for Value."); + } + return; + } + $this->mergeFromArrayJsonImpl($array, $ignore_unknown); + } + + private function mergeFromArrayJsonImpl($array, $ignore_unknown) + { + foreach ($array as $key => $value) { + $field = $this->desc->getFieldByJsonName($key); + if (is_null($field)) { + $field = $this->desc->getFieldByName($key); + if (is_null($field)) { + if ($ignore_unknown) { + continue; + } else { + throw new GPBDecodeException( + $key . ' is unknown.' + ); + } + } + } + if ($field->isMap()) { + if (is_null($value)) { + continue; + } + $key_field = $field->getMessageType()->getFieldByNumber(1); + $value_field = $field->getMessageType()->getFieldByNumber(2); + foreach ($value as $tmp_key => $tmp_value) { + if (is_null($tmp_value)) { + throw new \Exception( + "Map value field element cannot be null."); + } + $proto_key = $this->convertJsonValueToProtoValue( + $tmp_key, + $key_field, + $ignore_unknown, + true); + $proto_value = $this->convertJsonValueToProtoValue( + $tmp_value, + $value_field, + $ignore_unknown); + self::kvUpdateHelper($field, $proto_key, $proto_value); + } + } else if ($field->isRepeated()) { + if (is_null($value)) { + continue; + } + foreach ($value as $tmp) { + if (is_null($tmp)) { + throw new \Exception( + "Repeated field elements cannot be null."); + } + $proto_value = $this->convertJsonValueToProtoValue( + $tmp, + $field, + $ignore_unknown); + self::appendHelper($field, $proto_value); + } + } else { + $setter = $field->getSetter(); + $proto_value = $this->convertJsonValueToProtoValue( + $value, + $field, + $ignore_unknown); + if ($field->getType() === GPBType::MESSAGE) { + if (is_null($proto_value)) { + continue; + } + $getter = $field->getGetter(); + $submsg = $this->$getter(); + if (!is_null($submsg)) { + $submsg->mergeFrom($proto_value); + continue; + } + } + $this->$setter($proto_value); + } + } + } + + /** + * @ignore + */ + public function parseFromJsonStream($input, $ignore_unknown) + { + $array = json_decode($input->getData(), true, 512, JSON_BIGINT_AS_STRING); + if ($this instanceof \Google\Protobuf\ListValue) { + $array = ["values"=>$array]; + } + if (is_null($array)) { + if ($this instanceof \Google\Protobuf\Value) { + $this->setNullValue(\Google\Protobuf\NullValue::NULL_VALUE); + return; + } else { + throw new GPBDecodeException( + "Cannot decode json string: " . $input->getData()); + } + } + try { + $this->mergeFromJsonArray($array, $ignore_unknown); + } catch (\Exception $e) { + throw new GPBDecodeException($e->getMessage()); + } + } + + /** + * @ignore + */ + private function serializeSingularFieldToStream($field, &$output) + { + if (!$this->existField($field)) { + return true; + } + $getter = $field->getGetter(); + $value = $this->$getter(); + if (!GPBWire::serializeFieldToStream($value, $field, true, $output)) { + return false; + } + return true; + } + + /** + * @ignore + */ + private function serializeRepeatedFieldToStream($field, &$output) + { + $getter = $field->getGetter(); + $values = $this->$getter(); + $count = count($values); + if ($count === 0) { + return true; + } + + $packed = $field->getPacked(); + if ($packed) { + if (!GPBWire::writeTag( + $output, + GPBWire::makeTag($field->getNumber(), GPBType::STRING))) { + return false; + } + $size = 0; + foreach ($values as $value) { + $size += $this->fieldDataOnlyByteSize($field, $value); + } + if (!$output->writeVarint32($size, true)) { + return false; + } + } + + foreach ($values as $value) { + if (!GPBWire::serializeFieldToStream( + $value, + $field, + !$packed, + $output)) { + return false; + } + } + return true; + } + + /** + * @ignore + */ + private function serializeMapFieldToStream($field, $output) + { + $getter = $field->getGetter(); + $values = $this->$getter(); + $count = count($values); + if ($count === 0) { + return true; + } + + foreach ($values as $key => $value) { + $map_entry = new MapEntry($field->getMessageType()); + $map_entry->setKey($key); + $map_entry->setValue($value); + if (!GPBWire::serializeFieldToStream( + $map_entry, + $field, + true, + $output)) { + return false; + } + } + return true; + } + + /** + * @ignore + */ + private function serializeFieldToStream(&$output, $field) + { + if ($field->isMap()) { + return $this->serializeMapFieldToStream($field, $output); + } elseif ($field->isRepeated()) { + return $this->serializeRepeatedFieldToStream($field, $output); + } else { + return $this->serializeSingularFieldToStream($field, $output); + } + } + + /** + * @ignore + */ + private function serializeFieldToJsonStream(&$output, $field) + { + $getter = $field->getGetter(); + $values = $this->$getter(); + return GPBJsonWire::serializeFieldToStream( + $values, $field, $output, !GPBUtil::hasSpecialJsonMapping($this)); + } + + /** + * @ignore + */ + public function serializeToStream(&$output) + { + $fields = $this->desc->getField(); + foreach ($fields as $field) { + if (!$this->serializeFieldToStream($output, $field)) { + return false; + } + } + $output->writeRaw($this->unknown, strlen($this->unknown)); + return true; + } + + /** + * @ignore + */ + public function serializeToJsonStream(&$output) + { + if (is_a($this, 'Google\Protobuf\Any')) { + $output->writeRaw("{", 1); + $type_field = $this->desc->getFieldByNumber(1); + $value_msg = $this->unpack(); + + // Serialize type url. + $output->writeRaw("\"@type\":", 8); + $output->writeRaw("\"", 1); + $output->writeRaw($this->getTypeUrl(), strlen($this->getTypeUrl())); + $output->writeRaw("\"", 1); + + // Serialize value + if (GPBUtil::hasSpecialJsonMapping($value_msg)) { + $output->writeRaw(",\"value\":", 9); + $value_msg->serializeToJsonStream($output); + } else { + $value_fields = $value_msg->desc->getField(); + foreach ($value_fields as $field) { + if ($value_msg->existField($field)) { + $output->writeRaw(",", 1); + if (!$value_msg->serializeFieldToJsonStream($output, $field)) { + return false; + } + } + } + } + + $output->writeRaw("}", 1); + } elseif (is_a($this, 'Google\Protobuf\FieldMask')) { + $field_mask = GPBUtil::formatFieldMask($this); + $output->writeRaw("\"", 1); + $output->writeRaw($field_mask, strlen($field_mask)); + $output->writeRaw("\"", 1); + } elseif (is_a($this, 'Google\Protobuf\Duration')) { + $duration = GPBUtil::formatDuration($this) . "s"; + $output->writeRaw("\"", 1); + $output->writeRaw($duration, strlen($duration)); + $output->writeRaw("\"", 1); + } elseif (get_class($this) === 'Google\Protobuf\Timestamp') { + $timestamp = GPBUtil::formatTimestamp($this); + $timestamp = json_encode($timestamp); + $output->writeRaw($timestamp, strlen($timestamp)); + } elseif (get_class($this) === 'Google\Protobuf\ListValue') { + $field = $this->desc->getField()[1]; + if (!$this->existField($field)) { + $output->writeRaw("[]", 2); + } else { + if (!$this->serializeFieldToJsonStream($output, $field)) { + return false; + } + } + } elseif (get_class($this) === 'Google\Protobuf\Struct') { + $field = $this->desc->getField()[1]; + if (!$this->existField($field)) { + $output->writeRaw("{}", 2); + } else { + if (!$this->serializeFieldToJsonStream($output, $field)) { + return false; + } + } + } else { + if (!GPBUtil::hasSpecialJsonMapping($this)) { + $output->writeRaw("{", 1); + } + $fields = $this->desc->getField(); + $first = true; + foreach ($fields as $field) { + if ($this->existField($field) || + GPBUtil::hasJsonValue($this)) { + if ($first) { + $first = false; + } else { + $output->writeRaw(",", 1); + } + if (!$this->serializeFieldToJsonStream($output, $field)) { + return false; + } + } + } + if (!GPBUtil::hasSpecialJsonMapping($this)) { + $output->writeRaw("}", 1); + } + } + return true; + } + + /** + * Serialize the message to string. + * @return string Serialized binary protobuf data. + */ + public function serializeToString() + { + $output = new CodedOutputStream($this->byteSize()); + $this->serializeToStream($output); + return $output->getData(); + } + + /** + * Serialize the message to json string. + * @return string Serialized json protobuf data. + */ + public function serializeToJsonString() + { + $output = new CodedOutputStream($this->jsonByteSize()); + $this->serializeToJsonStream($output); + return $output->getData(); + } + + /** + * @ignore + */ + private function existField($field) + { + $getter = $field->getGetter(); + $hazzer = "has" . substr($getter, 3); + + if (method_exists($this, $hazzer)) { + return $this->$hazzer(); + } else if ($field->getOneofIndex() !== -1) { + // For old generated code, which does not have hazzers for oneof + // fields. + $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()]; + $oneof_name = $oneof->getName(); + return $this->$oneof_name->getNumber() === $field->getNumber(); + } + + $values = $this->$getter(); + if ($field->isMap()) { + return count($values) !== 0; + } elseif ($field->isRepeated()) { + return count($values) !== 0; + } else { + return $values !== $this->defaultValue($field); + } + } + + /** + * @ignore + */ + private function repeatedFieldDataOnlyByteSize($field) + { + $size = 0; + + $getter = $field->getGetter(); + $values = $this->$getter(); + $count = count($values); + if ($count !== 0) { + $size += $count * GPBWire::tagSize($field); + foreach ($values as $value) { + $size += $this->singularFieldDataOnlyByteSize($field); + } + } + } + + /** + * @ignore + */ + private function fieldDataOnlyByteSize($field, $value) + { + $size = 0; + + switch ($field->getType()) { + case GPBType::BOOL: + $size += 1; + break; + case GPBType::FLOAT: + case GPBType::FIXED32: + case GPBType::SFIXED32: + $size += 4; + break; + case GPBType::DOUBLE: + case GPBType::FIXED64: + case GPBType::SFIXED64: + $size += 8; + break; + case GPBType::INT32: + case GPBType::ENUM: + $size += GPBWire::varint32Size($value, true); + break; + case GPBType::UINT32: + $size += GPBWire::varint32Size($value); + break; + case GPBType::UINT64: + case GPBType::INT64: + $size += GPBWire::varint64Size($value); + break; + case GPBType::SINT32: + $size += GPBWire::sint32Size($value); + break; + case GPBType::SINT64: + $size += GPBWire::sint64Size($value); + break; + case GPBType::STRING: + case GPBType::BYTES: + $size += strlen($value); + $size += GPBWire::varint32Size($size); + break; + case GPBType::MESSAGE: + $size += $value->byteSize(); + $size += GPBWire::varint32Size($size); + break; + case GPBType::GROUP: + // TODO(teboring): Add support. + user_error("Unsupported type."); + break; + default: + user_error("Unsupported type."); + return 0; + } + + return $size; + } + + /** + * @ignore + */ + private function fieldDataOnlyJsonByteSize($field, $value) + { + $size = 0; + + switch ($field->getType()) { + case GPBType::SFIXED32: + case GPBType::SINT32: + case GPBType::INT32: + $size += strlen(strval($value)); + break; + case GPBType::FIXED32: + case GPBType::UINT32: + if ($value < 0) { + $value = bcadd($value, "4294967296"); + } + $size += strlen(strval($value)); + break; + case GPBType::FIXED64: + case GPBType::UINT64: + if ($value < 0) { + $value = bcadd($value, "18446744073709551616"); + } + // Intentional fall through. + case GPBType::SFIXED64: + case GPBType::INT64: + case GPBType::SINT64: + $size += 2; // size for "" + $size += strlen(strval($value)); + break; + case GPBType::FLOAT: + if (is_nan($value)) { + $size += strlen("NaN") + 2; + } elseif ($value === INF) { + $size += strlen("Infinity") + 2; + } elseif ($value === -INF) { + $size += strlen("-Infinity") + 2; + } else { + $size += strlen(sprintf("%.8g", $value)); + } + break; + case GPBType::DOUBLE: + if (is_nan($value)) { + $size += strlen("NaN") + 2; + } elseif ($value === INF) { + $size += strlen("Infinity") + 2; + } elseif ($value === -INF) { + $size += strlen("-Infinity") + 2; + } else { + $size += strlen(sprintf("%.17g", $value)); + } + break; + case GPBType::ENUM: + $enum_desc = $field->getEnumType(); + if ($enum_desc->getClass() === "Google\Protobuf\NullValue") { + $size += 4; + break; + } + $enum_value_desc = $enum_desc->getValueByNumber($value); + if (!is_null($enum_value_desc)) { + $size += 2; // size for "" + $size += strlen($enum_value_desc->getName()); + } else { + $str_value = strval($value); + $size += strlen($str_value); + } + break; + case GPBType::BOOL: + if ($value) { + $size += 4; + } else { + $size += 5; + } + break; + case GPBType::STRING: + $value = json_encode($value, JSON_UNESCAPED_UNICODE); + $size += strlen($value); + break; + case GPBType::BYTES: + # if (is_a($this, "Google\Protobuf\BytesValue")) { + # $size += strlen(json_encode($value)); + # } else { + # $size += strlen(base64_encode($value)); + # $size += 2; // size for \"\" + # } + $size += strlen(base64_encode($value)); + $size += 2; // size for \"\" + break; + case GPBType::MESSAGE: + $size += $value->jsonByteSize(); + break; +# case GPBType::GROUP: +# // TODO(teboring): Add support. +# user_error("Unsupported type."); +# break; + default: + user_error("Unsupported type " . $field->getType()); + return 0; + } + + return $size; + } + + /** + * @ignore + */ + private function fieldByteSize($field) + { + $size = 0; + if ($field->isMap()) { + $getter = $field->getGetter(); + $values = $this->$getter(); + $count = count($values); + if ($count !== 0) { + $size += $count * GPBWire::tagSize($field); + $message_type = $field->getMessageType(); + $key_field = $message_type->getFieldByNumber(1); + $value_field = $message_type->getFieldByNumber(2); + foreach ($values as $key => $value) { + $data_size = 0; + if ($key != $this->defaultValue($key_field)) { + $data_size += $this->fieldDataOnlyByteSize( + $key_field, + $key); + $data_size += GPBWire::tagSize($key_field); + } + if ($value != $this->defaultValue($value_field)) { + $data_size += $this->fieldDataOnlyByteSize( + $value_field, + $value); + $data_size += GPBWire::tagSize($value_field); + } + $size += GPBWire::varint32Size($data_size) + $data_size; + } + } + } elseif ($field->isRepeated()) { + $getter = $field->getGetter(); + $values = $this->$getter(); + $count = count($values); + if ($count !== 0) { + if ($field->getPacked()) { + $data_size = 0; + foreach ($values as $value) { + $data_size += $this->fieldDataOnlyByteSize($field, $value); + } + $size += GPBWire::tagSize($field); + $size += GPBWire::varint32Size($data_size); + $size += $data_size; + } else { + $size += $count * GPBWire::tagSize($field); + foreach ($values as $value) { + $size += $this->fieldDataOnlyByteSize($field, $value); + } + } + } + } elseif ($this->existField($field)) { + $size += GPBWire::tagSize($field); + $getter = $field->getGetter(); + $value = $this->$getter(); + $size += $this->fieldDataOnlyByteSize($field, $value); + } + return $size; + } + + /** + * @ignore + */ + private function fieldJsonByteSize($field) + { + $size = 0; + + if ($field->isMap()) { + $getter = $field->getGetter(); + $values = $this->$getter(); + $count = count($values); + if ($count !== 0) { + if (!GPBUtil::hasSpecialJsonMapping($this)) { + $size += 3; // size for "\"\":". + $size += strlen($field->getJsonName()); // size for field name + } + $size += 2; // size for "{}". + $size += $count - 1; // size for commas + $getter = $field->getGetter(); + $map_entry = $field->getMessageType(); + $key_field = $map_entry->getFieldByNumber(1); + $value_field = $map_entry->getFieldByNumber(2); + switch ($key_field->getType()) { + case GPBType::STRING: + case GPBType::SFIXED64: + case GPBType::INT64: + case GPBType::SINT64: + case GPBType::FIXED64: + case GPBType::UINT64: + $additional_quote = false; + break; + default: + $additional_quote = true; + } + foreach ($values as $key => $value) { + if ($additional_quote) { + $size += 2; // size for "" + } + $size += $this->fieldDataOnlyJsonByteSize($key_field, $key); + $size += $this->fieldDataOnlyJsonByteSize($value_field, $value); + $size += 1; // size for : + } + } + } elseif ($field->isRepeated()) { + $getter = $field->getGetter(); + $values = $this->$getter(); + $count = count($values); + if ($count !== 0) { + if (!GPBUtil::hasSpecialJsonMapping($this)) { + $size += 3; // size for "\"\":". + $size += strlen($field->getJsonName()); // size for field name + } + $size += 2; // size for "[]". + $size += $count - 1; // size for commas + $getter = $field->getGetter(); + foreach ($values as $value) { + $size += $this->fieldDataOnlyJsonByteSize($field, $value); + } + } + } elseif ($this->existField($field) || GPBUtil::hasJsonValue($this)) { + if (!GPBUtil::hasSpecialJsonMapping($this)) { + $size += 3; // size for "\"\":". + $size += strlen($field->getJsonName()); // size for field name + } + $getter = $field->getGetter(); + $value = $this->$getter(); + $size += $this->fieldDataOnlyJsonByteSize($field, $value); + } + return $size; + } + + /** + * @ignore + */ + public function byteSize() + { + $size = 0; + + $fields = $this->desc->getField(); + foreach ($fields as $field) { + $size += $this->fieldByteSize($field); + } + $size += strlen($this->unknown); + return $size; + } + + private function appendHelper($field, $append_value) + { + $getter = $field->getGetter(); + $setter = $field->getSetter(); + + $field_arr_value = $this->$getter(); + $field_arr_value[] = $append_value; + + if (!is_object($field_arr_value)) { + $this->$setter($field_arr_value); + } + } + + private function kvUpdateHelper($field, $update_key, $update_value) + { + $getter = $field->getGetter(); + $setter = $field->getSetter(); + + $field_arr_value = $this->$getter(); + $field_arr_value[$update_key] = $update_value; + + if (!is_object($field_arr_value)) { + $this->$setter($field_arr_value); + } + } + + /** + * @ignore + */ + public function jsonByteSize() + { + $size = 0; + if (is_a($this, 'Google\Protobuf\Any')) { + // Size for "{}". + $size += 2; + + // Size for "\"@type\":". + $size += 8; + + // Size for url. +2 for "" /. + $size += strlen($this->getTypeUrl()) + 2; + + $value_msg = $this->unpack(); + if (GPBUtil::hasSpecialJsonMapping($value_msg)) { + // Size for "\",value\":". + $size += 9; + $size += $value_msg->jsonByteSize(); + } else { + // Size for value. +1 for comma, -2 for "{}". + $size += $value_msg->jsonByteSize() -1; + } + } elseif (get_class($this) === 'Google\Protobuf\FieldMask') { + $field_mask = GPBUtil::formatFieldMask($this); + $size += strlen($field_mask) + 2; // 2 for "" + } elseif (get_class($this) === 'Google\Protobuf\Duration') { + $duration = GPBUtil::formatDuration($this) . "s"; + $size += strlen($duration) + 2; // 2 for "" + } elseif (get_class($this) === 'Google\Protobuf\Timestamp') { + $timestamp = GPBUtil::formatTimestamp($this); + $timestamp = json_encode($timestamp); + $size += strlen($timestamp); + } elseif (get_class($this) === 'Google\Protobuf\ListValue') { + $field = $this->desc->getField()[1]; + if ($this->existField($field)) { + $field_size = $this->fieldJsonByteSize($field); + $size += $field_size; + } else { + // Size for "[]". + $size += 2; + } + } elseif (get_class($this) === 'Google\Protobuf\Struct') { + $field = $this->desc->getField()[1]; + if ($this->existField($field)) { + $field_size = $this->fieldJsonByteSize($field); + $size += $field_size; + } else { + // Size for "{}". + $size += 2; + } + } else { + if (!GPBUtil::hasSpecialJsonMapping($this)) { + // Size for "{}". + $size += 2; + } + + $fields = $this->desc->getField(); + $count = 0; + foreach ($fields as $field) { + $field_size = $this->fieldJsonByteSize($field); + $size += $field_size; + if ($field_size != 0) { + $count++; + } + } + // size for comma + $size += $count > 0 ? ($count - 1) : 0; + } + return $size; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/MessageBuilderContext.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/MessageBuilderContext.php new file mode 100644 index 00000000..2724d267 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/MessageBuilderContext.php @@ -0,0 +1,120 @@ +descriptor = new Descriptor(); + $this->descriptor->setFullName($full_name); + $this->descriptor->setClass($klass); + $this->pool = $pool; + } + + private function getFieldDescriptor($name, $label, $type, + $number, $type_name = null) + { + $field = new FieldDescriptor(); + $field->setName($name); + $camel_name = implode('', array_map('ucwords', explode('_', $name))); + $field->setGetter('get' . $camel_name); + $field->setSetter('set' . $camel_name); + $field->setType($type); + $field->setNumber($number); + $field->setLabel($label); + + // At this time, the message/enum type may have not been added to pool. + // So we use the type name as place holder and will replace it with the + // actual descriptor in cross building. + switch ($type) { + case GPBType::MESSAGE: + $field->setMessageType($type_name); + break; + case GPBType::ENUM: + $field->setEnumType($type_name); + break; + default: + break; + } + + return $field; + } + + public function optional($name, $type, $number, $type_name = null) + { + $this->descriptor->addField($this->getFieldDescriptor( + $name, + GPBLabel::OPTIONAL, + $type, + $number, + $type_name)); + return $this; + } + + public function repeated($name, $type, $number, $type_name = null) + { + $this->descriptor->addField($this->getFieldDescriptor( + $name, + GPBLabel::REPEATED, + $type, + $number, + $type_name)); + return $this; + } + + public function required($name, $type, $number, $type_name = null) + { + $this->descriptor->addField($this->getFieldDescriptor( + $name, + GPBLabel::REQUIRED, + $type, + $number, + $type_name)); + return $this; + } + + public function finalizeToPool() + { + $this->pool->addDescriptor($this->descriptor); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/MessageOptions.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/MessageOptions.php new file mode 100644 index 00000000..2f4e3cb7 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/MessageOptions.php @@ -0,0 +1,387 @@ +google.protobuf.MessageOptions + */ +class MessageOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + * + * Generated from protobuf field optional bool message_set_wire_format = 1 [default = false]; + */ + protected $message_set_wire_format = null; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + * + * Generated from protobuf field optional bool no_standard_descriptor_accessor = 2 [default = false]; + */ + protected $no_standard_descriptor_accessor = null; + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + * + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + */ + protected $deprecated = null; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + * + * Generated from protobuf field optional bool map_entry = 7; + */ + protected $map_entry = null; + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $message_set_wire_format + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + * @type bool $no_standard_descriptor_accessor + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + * @type bool $deprecated + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + * @type bool $map_entry + * Whether the message is an automatically generated map entry type for the + * maps field. + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option + * The parser stores options it doesn't recognize here. See above. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + * + * Generated from protobuf field optional bool message_set_wire_format = 1 [default = false]; + * @return bool + */ + public function getMessageSetWireFormat() + { + return isset($this->message_set_wire_format) ? $this->message_set_wire_format : false; + } + + public function hasMessageSetWireFormat() + { + return isset($this->message_set_wire_format); + } + + public function clearMessageSetWireFormat() + { + unset($this->message_set_wire_format); + } + + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + * + * Generated from protobuf field optional bool message_set_wire_format = 1 [default = false]; + * @param bool $var + * @return $this + */ + public function setMessageSetWireFormat($var) + { + GPBUtil::checkBool($var); + $this->message_set_wire_format = $var; + + return $this; + } + + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + * + * Generated from protobuf field optional bool no_standard_descriptor_accessor = 2 [default = false]; + * @return bool + */ + public function getNoStandardDescriptorAccessor() + { + return isset($this->no_standard_descriptor_accessor) ? $this->no_standard_descriptor_accessor : false; + } + + public function hasNoStandardDescriptorAccessor() + { + return isset($this->no_standard_descriptor_accessor); + } + + public function clearNoStandardDescriptorAccessor() + { + unset($this->no_standard_descriptor_accessor); + } + + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + * + * Generated from protobuf field optional bool no_standard_descriptor_accessor = 2 [default = false]; + * @param bool $var + * @return $this + */ + public function setNoStandardDescriptorAccessor($var) + { + GPBUtil::checkBool($var); + $this->no_standard_descriptor_accessor = $var; + + return $this; + } + + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + * + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + * @return bool + */ + public function getDeprecated() + { + return isset($this->deprecated) ? $this->deprecated : false; + } + + public function hasDeprecated() + { + return isset($this->deprecated); + } + + public function clearDeprecated() + { + unset($this->deprecated); + } + + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + * + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + * @param bool $var + * @return $this + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + + return $this; + } + + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + * + * Generated from protobuf field optional bool map_entry = 7; + * @return bool + */ + public function getMapEntry() + { + return isset($this->map_entry) ? $this->map_entry : false; + } + + public function hasMapEntry() + { + return isset($this->map_entry); + } + + public function clearMapEntry() + { + unset($this->map_entry); + } + + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + * + * Generated from protobuf field optional bool map_entry = 7; + * @param bool $var + * @return $this + */ + public function setMapEntry($var) + { + GPBUtil::checkBool($var); + $this->map_entry = $var; + + return $this; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUninterpretedOption($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/MethodDescriptorProto.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/MethodDescriptorProto.php new file mode 100644 index 00000000..96efb02d --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/MethodDescriptorProto.php @@ -0,0 +1,282 @@ +google.protobuf.MethodDescriptorProto + */ +class MethodDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field optional string name = 1; + */ + protected $name = null; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + * + * Generated from protobuf field optional string input_type = 2; + */ + protected $input_type = null; + /** + * Generated from protobuf field optional string output_type = 3; + */ + protected $output_type = null; + /** + * Generated from protobuf field optional .google.protobuf.MethodOptions options = 4; + */ + protected $options = null; + /** + * Identifies if client streams multiple client messages + * + * Generated from protobuf field optional bool client_streaming = 5 [default = false]; + */ + protected $client_streaming = null; + /** + * Identifies if server streams multiple server messages + * + * Generated from protobuf field optional bool server_streaming = 6 [default = false]; + */ + protected $server_streaming = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type string $input_type + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + * @type string $output_type + * @type \Google\Protobuf\Internal\MethodOptions $options + * @type bool $client_streaming + * Identifies if client streams multiple client messages + * @type bool $server_streaming + * Identifies if server streams multiple server messages + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field optional string name = 1; + * @return string + */ + public function getName() + { + return isset($this->name) ? $this->name : ''; + } + + public function hasName() + { + return isset($this->name); + } + + public function clearName() + { + unset($this->name); + } + + /** + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + * + * Generated from protobuf field optional string input_type = 2; + * @return string + */ + public function getInputType() + { + return isset($this->input_type) ? $this->input_type : ''; + } + + public function hasInputType() + { + return isset($this->input_type); + } + + public function clearInputType() + { + unset($this->input_type); + } + + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + * + * Generated from protobuf field optional string input_type = 2; + * @param string $var + * @return $this + */ + public function setInputType($var) + { + GPBUtil::checkString($var, True); + $this->input_type = $var; + + return $this; + } + + /** + * Generated from protobuf field optional string output_type = 3; + * @return string + */ + public function getOutputType() + { + return isset($this->output_type) ? $this->output_type : ''; + } + + public function hasOutputType() + { + return isset($this->output_type); + } + + public function clearOutputType() + { + unset($this->output_type); + } + + /** + * Generated from protobuf field optional string output_type = 3; + * @param string $var + * @return $this + */ + public function setOutputType($var) + { + GPBUtil::checkString($var, True); + $this->output_type = $var; + + return $this; + } + + /** + * Generated from protobuf field optional .google.protobuf.MethodOptions options = 4; + * @return \Google\Protobuf\Internal\MethodOptions|null + */ + public function getOptions() + { + return $this->options; + } + + public function hasOptions() + { + return isset($this->options); + } + + public function clearOptions() + { + unset($this->options); + } + + /** + * Generated from protobuf field optional .google.protobuf.MethodOptions options = 4; + * @param \Google\Protobuf\Internal\MethodOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\MethodOptions::class); + $this->options = $var; + + return $this; + } + + /** + * Identifies if client streams multiple client messages + * + * Generated from protobuf field optional bool client_streaming = 5 [default = false]; + * @return bool + */ + public function getClientStreaming() + { + return isset($this->client_streaming) ? $this->client_streaming : false; + } + + public function hasClientStreaming() + { + return isset($this->client_streaming); + } + + public function clearClientStreaming() + { + unset($this->client_streaming); + } + + /** + * Identifies if client streams multiple client messages + * + * Generated from protobuf field optional bool client_streaming = 5 [default = false]; + * @param bool $var + * @return $this + */ + public function setClientStreaming($var) + { + GPBUtil::checkBool($var); + $this->client_streaming = $var; + + return $this; + } + + /** + * Identifies if server streams multiple server messages + * + * Generated from protobuf field optional bool server_streaming = 6 [default = false]; + * @return bool + */ + public function getServerStreaming() + { + return isset($this->server_streaming) ? $this->server_streaming : false; + } + + public function hasServerStreaming() + { + return isset($this->server_streaming); + } + + public function clearServerStreaming() + { + unset($this->server_streaming); + } + + /** + * Identifies if server streams multiple server messages + * + * Generated from protobuf field optional bool server_streaming = 6 [default = false]; + * @param bool $var + * @return $this + */ + public function setServerStreaming($var) + { + GPBUtil::checkBool($var); + $this->server_streaming = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/MethodOptions.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/MethodOptions.php new file mode 100644 index 00000000..a4595b74 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/MethodOptions.php @@ -0,0 +1,160 @@ +google.protobuf.MethodOptions + */ +class MethodOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + * + * Generated from protobuf field optional bool deprecated = 33 [default = false]; + */ + protected $deprecated = null; + /** + * Generated from protobuf field optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + */ + protected $idempotency_level = null; + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $deprecated + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + * @type int $idempotency_level + * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option + * The parser stores options it doesn't recognize here. See above. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + * + * Generated from protobuf field optional bool deprecated = 33 [default = false]; + * @return bool + */ + public function getDeprecated() + { + return isset($this->deprecated) ? $this->deprecated : false; + } + + public function hasDeprecated() + { + return isset($this->deprecated); + } + + public function clearDeprecated() + { + unset($this->deprecated); + } + + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + * + * Generated from protobuf field optional bool deprecated = 33 [default = false]; + * @param bool $var + * @return $this + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + + return $this; + } + + /** + * Generated from protobuf field optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + * @return int + */ + public function getIdempotencyLevel() + { + return isset($this->idempotency_level) ? $this->idempotency_level : 0; + } + + public function hasIdempotencyLevel() + { + return isset($this->idempotency_level); + } + + public function clearIdempotencyLevel() + { + unset($this->idempotency_level); + } + + /** + * Generated from protobuf field optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + * @param int $var + * @return $this + */ + public function setIdempotencyLevel($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\MethodOptions\IdempotencyLevel::class); + $this->idempotency_level = $var; + + return $this; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUninterpretedOption($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php new file mode 100644 index 00000000..ce3c062c --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php @@ -0,0 +1,64 @@ +google.protobuf.MethodOptions.IdempotencyLevel + */ +class IdempotencyLevel +{ + /** + * Generated from protobuf enum IDEMPOTENCY_UNKNOWN = 0; + */ + const IDEMPOTENCY_UNKNOWN = 0; + /** + * implies idempotent + * + * Generated from protobuf enum NO_SIDE_EFFECTS = 1; + */ + const NO_SIDE_EFFECTS = 1; + /** + * idempotent, but may have side effects + * + * Generated from protobuf enum IDEMPOTENT = 2; + */ + const IDEMPOTENT = 2; + + private static $valueToName = [ + self::IDEMPOTENCY_UNKNOWN => 'IDEMPOTENCY_UNKNOWN', + self::NO_SIDE_EFFECTS => 'NO_SIDE_EFFECTS', + self::IDEMPOTENT => 'IDEMPOTENT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IdempotencyLevel::class, \Google\Protobuf\Internal\MethodOptions_IdempotencyLevel::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php new file mode 100644 index 00000000..a2913114 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php @@ -0,0 +1,16 @@ +public_desc = new \Google\Protobuf\OneofDescriptor($this); + } + + public function setName($name) + { + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function addField(FieldDescriptor $field) + { + $this->fields[] = $field; + } + + public function getFields() + { + return $this->fields; + } + + public static function buildFromProto($oneof_proto, $desc, $index) + { + $oneof = new OneofDescriptor(); + $oneof->setName($oneof_proto->getName()); + foreach ($desc->getField() as $field) { + if ($field->getOneofIndex() == $index) { + $oneof->addField($field); + } + } + return $oneof; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/OneofDescriptorProto.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/OneofDescriptorProto.php new file mode 100644 index 00000000..3cb9f25c --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/OneofDescriptorProto.php @@ -0,0 +1,109 @@ +google.protobuf.OneofDescriptorProto + */ +class OneofDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field optional string name = 1; + */ + protected $name = null; + /** + * Generated from protobuf field optional .google.protobuf.OneofOptions options = 2; + */ + protected $options = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type \Google\Protobuf\Internal\OneofOptions $options + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field optional string name = 1; + * @return string + */ + public function getName() + { + return isset($this->name) ? $this->name : ''; + } + + public function hasName() + { + return isset($this->name); + } + + public function clearName() + { + unset($this->name); + } + + /** + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Generated from protobuf field optional .google.protobuf.OneofOptions options = 2; + * @return \Google\Protobuf\Internal\OneofOptions|null + */ + public function getOptions() + { + return $this->options; + } + + public function hasOptions() + { + return isset($this->options); + } + + public function clearOptions() + { + unset($this->options); + } + + /** + * Generated from protobuf field optional .google.protobuf.OneofOptions options = 2; + * @param \Google\Protobuf\Internal\OneofOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\OneofOptions::class); + $this->options = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/OneofField.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/OneofField.php new file mode 100644 index 00000000..2c689e83 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/OneofField.php @@ -0,0 +1,77 @@ +desc = $desc; + } + + public function setValue($value) + { + $this->value = $value; + } + + public function getValue() + { + return $this->value; + } + + public function setFieldName($field_name) + { + $this->field_name = $field_name; + } + + public function getFieldName() + { + return $this->field_name; + } + + public function setNumber($number) + { + $this->number = $number; + } + + public function getNumber() + { + return $this->number; + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/OneofOptions.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/OneofOptions.php new file mode 100644 index 00000000..8dde8f3b --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/OneofOptions.php @@ -0,0 +1,67 @@ +google.protobuf.OneofOptions + */ +class OneofOptions extends \Google\Protobuf\Internal\Message +{ + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option + * The parser stores options it doesn't recognize here. See above. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUninterpretedOption($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/RawInputStream.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/RawInputStream.php new file mode 100644 index 00000000..4e7ed5cb --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/RawInputStream.php @@ -0,0 +1,50 @@ +buffer = $buffer; + } + + public function getData() + { + return $this->buffer; + } + +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/RepeatedField.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/RepeatedField.php new file mode 100644 index 00000000..c0331ff3 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/RepeatedField.php @@ -0,0 +1,257 @@ +container = []; + $this->type = $type; + if ($this->type == GPBType::MESSAGE) { + $pool = DescriptorPool::getGeneratedPool(); + $desc = $pool->getDescriptorByClassName($klass); + if ($desc == NULL) { + new $klass; // No msg class instance has been created before. + $desc = $pool->getDescriptorByClassName($klass); + } + $this->klass = $desc->getClass(); + $this->legacy_klass = $desc->getLegacyClass(); + } + } + + /** + * @ignore + */ + public function getType() + { + return $this->type; + } + + /** + * @ignore + */ + public function getClass() + { + return $this->klass; + } + + /** + * @ignore + */ + public function getLegacyClass() + { + return $this->legacy_klass; + } + + /** + * Return the element at the given index. + * + * This will also be called for: $ele = $arr[0] + * + * @param integer $offset The index of the element to be fetched. + * @return object The stored element at given index. + * @throws \ErrorException Invalid type for index. + * @throws \ErrorException Non-existing index. + */ + public function offsetGet($offset) + { + return $this->container[$offset]; + } + + /** + * Assign the element at the given index. + * + * This will also be called for: $arr []= $ele and $arr[0] = ele + * + * @param integer $offset The index of the element to be assigned. + * @param object $value The element to be assigned. + * @return void + * @throws \ErrorException Invalid type for index. + * @throws \ErrorException Non-existing index. + * @throws \ErrorException Incorrect type of the element. + */ + public function offsetSet($offset, $value) + { + switch ($this->type) { + case GPBType::SFIXED32: + case GPBType::SINT32: + case GPBType::INT32: + case GPBType::ENUM: + GPBUtil::checkInt32($value); + break; + case GPBType::FIXED32: + case GPBType::UINT32: + GPBUtil::checkUint32($value); + break; + case GPBType::SFIXED64: + case GPBType::SINT64: + case GPBType::INT64: + GPBUtil::checkInt64($value); + break; + case GPBType::FIXED64: + case GPBType::UINT64: + GPBUtil::checkUint64($value); + break; + case GPBType::FLOAT: + GPBUtil::checkFloat($value); + break; + case GPBType::DOUBLE: + GPBUtil::checkDouble($value); + break; + case GPBType::BOOL: + GPBUtil::checkBool($value); + break; + case GPBType::BYTES: + GPBUtil::checkString($value, false); + break; + case GPBType::STRING: + GPBUtil::checkString($value, true); + break; + case GPBType::MESSAGE: + if (is_null($value)) { + throw new \TypeError("RepeatedField element cannot be null."); + } + GPBUtil::checkMessage($value, $this->klass); + break; + default: + break; + } + if (is_null($offset)) { + $this->container[] = $value; + } else { + $count = count($this->container); + if (!is_numeric($offset) || $offset < 0 || $offset >= $count) { + trigger_error( + "Cannot modify element at the given index", + E_USER_ERROR); + return; + } + $this->container[$offset] = $value; + } + } + + /** + * Remove the element at the given index. + * + * This will also be called for: unset($arr) + * + * @param integer $offset The index of the element to be removed. + * @return void + * @throws \ErrorException Invalid type for index. + * @throws \ErrorException The element to be removed is not at the end of the + * RepeatedField. + */ + public function offsetUnset($offset) + { + $count = count($this->container); + if (!is_numeric($offset) || $count === 0 || $offset !== $count - 1) { + trigger_error( + "Cannot remove element at the given index", + E_USER_ERROR); + return; + } + array_pop($this->container); + } + + /** + * Check the existence of the element at the given index. + * + * This will also be called for: isset($arr) + * + * @param integer $offset The index of the element to be removed. + * @return bool True if the element at the given offset exists. + * @throws \ErrorException Invalid type for index. + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * @ignore + */ + public function getIterator() + { + return new RepeatedFieldIter($this->container); + } + + /** + * Return the number of stored elements. + * + * This will also be called for: count($arr) + * + * @return integer The number of stored elements. + */ + public function count() + { + return count($this->container); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/RepeatedFieldIter.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/RepeatedFieldIter.php new file mode 100644 index 00000000..2b6f8230 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/RepeatedFieldIter.php @@ -0,0 +1,118 @@ +position = 0; + $this->container = $container; + } + + /** + * Reset the status of the iterator + * + * @return void + */ + public function rewind() + { + $this->position = 0; + } + + /** + * Return the element at the current position. + * + * @return object The element at the current position. + */ + public function current() + { + return $this->container[$this->position]; + } + + /** + * Return the current position. + * + * @return integer The current position. + */ + public function key() + { + return $this->position; + } + + /** + * Move to the next position. + * + * @return void + */ + public function next() + { + ++$this->position; + } + + /** + * Check whether there are more elements to iterate. + * + * @return bool True if there are more elements to iterate. + */ + public function valid() + { + return isset($this->container[$this->position]); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/ServiceDescriptorProto.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/ServiceDescriptorProto.php new file mode 100644 index 00000000..c5112476 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/ServiceDescriptorProto.php @@ -0,0 +1,136 @@ +google.protobuf.ServiceDescriptorProto + */ +class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field optional string name = 1; + */ + protected $name = null; + /** + * Generated from protobuf field repeated .google.protobuf.MethodDescriptorProto method = 2; + */ + private $method; + /** + * Generated from protobuf field optional .google.protobuf.ServiceOptions options = 3; + */ + protected $options = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type \Google\Protobuf\Internal\MethodDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $method + * @type \Google\Protobuf\Internal\ServiceOptions $options + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field optional string name = 1; + * @return string + */ + public function getName() + { + return isset($this->name) ? $this->name : ''; + } + + public function hasName() + { + return isset($this->name); + } + + public function clearName() + { + unset($this->name); + } + + /** + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated .google.protobuf.MethodDescriptorProto method = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMethod() + { + return $this->method; + } + + /** + * Generated from protobuf field repeated .google.protobuf.MethodDescriptorProto method = 2; + * @param \Google\Protobuf\Internal\MethodDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMethod($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\MethodDescriptorProto::class); + $this->method = $arr; + + return $this; + } + + /** + * Generated from protobuf field optional .google.protobuf.ServiceOptions options = 3; + * @return \Google\Protobuf\Internal\ServiceOptions|null + */ + public function getOptions() + { + return $this->options; + } + + public function hasOptions() + { + return isset($this->options); + } + + public function clearOptions() + { + unset($this->options); + } + + /** + * Generated from protobuf field optional .google.protobuf.ServiceOptions options = 3; + * @param \Google\Protobuf\Internal\ServiceOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\ServiceOptions::class); + $this->options = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/ServiceOptions.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/ServiceOptions.php new file mode 100644 index 00000000..d15a36ae --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/ServiceOptions.php @@ -0,0 +1,123 @@ +google.protobuf.ServiceOptions + */ +class ServiceOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + * + * Generated from protobuf field optional bool deprecated = 33 [default = false]; + */ + protected $deprecated = null; + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $deprecated + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option + * The parser stores options it doesn't recognize here. See above. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + * + * Generated from protobuf field optional bool deprecated = 33 [default = false]; + * @return bool + */ + public function getDeprecated() + { + return isset($this->deprecated) ? $this->deprecated : false; + } + + public function hasDeprecated() + { + return isset($this->deprecated); + } + + public function clearDeprecated() + { + unset($this->deprecated); + } + + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + * + * Generated from protobuf field optional bool deprecated = 33 [default = false]; + * @param bool $var + * @return $this + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + + return $this; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUninterpretedOption($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/SourceCodeInfo.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/SourceCodeInfo.php new file mode 100644 index 00000000..1c572e75 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/SourceCodeInfo.php @@ -0,0 +1,230 @@ +google.protobuf.SourceCodeInfo + */ +class SourceCodeInfo extends \Google\Protobuf\Internal\Message +{ + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + * + * Generated from protobuf field repeated .google.protobuf.SourceCodeInfo.Location location = 1; + */ + private $location; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Internal\SourceCodeInfo\Location[]|\Google\Protobuf\Internal\RepeatedField $location + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + * + * Generated from protobuf field repeated .google.protobuf.SourceCodeInfo.Location location = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLocation() + { + return $this->location; + } + + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + * + * Generated from protobuf field repeated .google.protobuf.SourceCodeInfo.Location location = 1; + * @param \Google\Protobuf\Internal\SourceCodeInfo\Location[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLocation($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo\Location::class); + $this->location = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php new file mode 100644 index 00000000..c4cc667e --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php @@ -0,0 +1,448 @@ +google.protobuf.SourceCodeInfo.Location + */ +class Location extends \Google\Protobuf\Internal\Message +{ + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + * + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + */ + private $path; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + * + * Generated from protobuf field repeated int32 span = 2 [packed = true]; + */ + private $span; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * Examples: + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * // Detached comment for corge paragraph 2. + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. */ + * /* Block comment attached to + * * grault. */ + * optional int32 grault = 6; + * // ignored detached comments. + * + * Generated from protobuf field optional string leading_comments = 3; + */ + protected $leading_comments = null; + /** + * Generated from protobuf field optional string trailing_comments = 4; + */ + protected $trailing_comments = null; + /** + * Generated from protobuf field repeated string leading_detached_comments = 6; + */ + private $leading_detached_comments; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int[]|\Google\Protobuf\Internal\RepeatedField $path + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + * @type int[]|\Google\Protobuf\Internal\RepeatedField $span + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + * @type string $leading_comments + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * Examples: + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * // Detached comment for corge paragraph 2. + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. */ + * /* Block comment attached to + * * grault. */ + * optional int32 grault = 6; + * // ignored detached comments. + * @type string $trailing_comments + * @type string[]|\Google\Protobuf\Internal\RepeatedField $leading_detached_comments + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + * + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPath() + { + return $this->path; + } + + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + * + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPath($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->path = $arr; + + return $this; + } + + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + * + * Generated from protobuf field repeated int32 span = 2 [packed = true]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSpan() + { + return $this->span; + } + + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + * + * Generated from protobuf field repeated int32 span = 2 [packed = true]; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSpan($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->span = $arr; + + return $this; + } + + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * Examples: + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * // Detached comment for corge paragraph 2. + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. */ + * /* Block comment attached to + * * grault. */ + * optional int32 grault = 6; + * // ignored detached comments. + * + * Generated from protobuf field optional string leading_comments = 3; + * @return string + */ + public function getLeadingComments() + { + return isset($this->leading_comments) ? $this->leading_comments : ''; + } + + public function hasLeadingComments() + { + return isset($this->leading_comments); + } + + public function clearLeadingComments() + { + unset($this->leading_comments); + } + + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * Examples: + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * // Detached comment for corge paragraph 2. + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. */ + * /* Block comment attached to + * * grault. */ + * optional int32 grault = 6; + * // ignored detached comments. + * + * Generated from protobuf field optional string leading_comments = 3; + * @param string $var + * @return $this + */ + public function setLeadingComments($var) + { + GPBUtil::checkString($var, True); + $this->leading_comments = $var; + + return $this; + } + + /** + * Generated from protobuf field optional string trailing_comments = 4; + * @return string + */ + public function getTrailingComments() + { + return isset($this->trailing_comments) ? $this->trailing_comments : ''; + } + + public function hasTrailingComments() + { + return isset($this->trailing_comments); + } + + public function clearTrailingComments() + { + unset($this->trailing_comments); + } + + /** + * Generated from protobuf field optional string trailing_comments = 4; + * @param string $var + * @return $this + */ + public function setTrailingComments($var) + { + GPBUtil::checkString($var, True); + $this->trailing_comments = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated string leading_detached_comments = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLeadingDetachedComments() + { + return $this->leading_detached_comments; + } + + /** + * Generated from protobuf field repeated string leading_detached_comments = 6; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLeadingDetachedComments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->leading_detached_comments = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Location::class, \Google\Protobuf\Internal\SourceCodeInfo_Location::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php new file mode 100644 index 00000000..1346492d --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php @@ -0,0 +1,16 @@ +seconds = $datetime->getTimestamp(); + $this->nanos = 1000 * $datetime->format('u'); + } + + /** + * Converts Timestamp to PHP DateTime. + * + * @return \DateTime $datetime + */ + public function toDateTime() + { + $time = sprintf('%s.%06d', $this->seconds, $this->nanos / 1000); + return \DateTime::createFromFormat('U.u', $time); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/UninterpretedOption.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/UninterpretedOption.php new file mode 100644 index 00000000..a2aae3e0 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/UninterpretedOption.php @@ -0,0 +1,300 @@ +google.protobuf.UninterpretedOption + */ +class UninterpretedOption extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + */ + private $name; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + * + * Generated from protobuf field optional string identifier_value = 3; + */ + protected $identifier_value = null; + /** + * Generated from protobuf field optional uint64 positive_int_value = 4; + */ + protected $positive_int_value = null; + /** + * Generated from protobuf field optional int64 negative_int_value = 5; + */ + protected $negative_int_value = null; + /** + * Generated from protobuf field optional double double_value = 6; + */ + protected $double_value = null; + /** + * Generated from protobuf field optional bytes string_value = 7; + */ + protected $string_value = null; + /** + * Generated from protobuf field optional string aggregate_value = 8; + */ + protected $aggregate_value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Internal\UninterpretedOption\NamePart[]|\Google\Protobuf\Internal\RepeatedField $name + * @type string $identifier_value + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + * @type int|string $positive_int_value + * @type int|string $negative_int_value + * @type float $double_value + * @type string $string_value + * @type string $aggregate_value + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getName() + { + return $this->name; + } + + /** + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + * @param \Google\Protobuf\Internal\UninterpretedOption\NamePart[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setName($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption\NamePart::class); + $this->name = $arr; + + return $this; + } + + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + * + * Generated from protobuf field optional string identifier_value = 3; + * @return string + */ + public function getIdentifierValue() + { + return isset($this->identifier_value) ? $this->identifier_value : ''; + } + + public function hasIdentifierValue() + { + return isset($this->identifier_value); + } + + public function clearIdentifierValue() + { + unset($this->identifier_value); + } + + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + * + * Generated from protobuf field optional string identifier_value = 3; + * @param string $var + * @return $this + */ + public function setIdentifierValue($var) + { + GPBUtil::checkString($var, True); + $this->identifier_value = $var; + + return $this; + } + + /** + * Generated from protobuf field optional uint64 positive_int_value = 4; + * @return int|string + */ + public function getPositiveIntValue() + { + return isset($this->positive_int_value) ? $this->positive_int_value : 0; + } + + public function hasPositiveIntValue() + { + return isset($this->positive_int_value); + } + + public function clearPositiveIntValue() + { + unset($this->positive_int_value); + } + + /** + * Generated from protobuf field optional uint64 positive_int_value = 4; + * @param int|string $var + * @return $this + */ + public function setPositiveIntValue($var) + { + GPBUtil::checkUint64($var); + $this->positive_int_value = $var; + + return $this; + } + + /** + * Generated from protobuf field optional int64 negative_int_value = 5; + * @return int|string + */ + public function getNegativeIntValue() + { + return isset($this->negative_int_value) ? $this->negative_int_value : 0; + } + + public function hasNegativeIntValue() + { + return isset($this->negative_int_value); + } + + public function clearNegativeIntValue() + { + unset($this->negative_int_value); + } + + /** + * Generated from protobuf field optional int64 negative_int_value = 5; + * @param int|string $var + * @return $this + */ + public function setNegativeIntValue($var) + { + GPBUtil::checkInt64($var); + $this->negative_int_value = $var; + + return $this; + } + + /** + * Generated from protobuf field optional double double_value = 6; + * @return float + */ + public function getDoubleValue() + { + return isset($this->double_value) ? $this->double_value : 0.0; + } + + public function hasDoubleValue() + { + return isset($this->double_value); + } + + public function clearDoubleValue() + { + unset($this->double_value); + } + + /** + * Generated from protobuf field optional double double_value = 6; + * @param float $var + * @return $this + */ + public function setDoubleValue($var) + { + GPBUtil::checkDouble($var); + $this->double_value = $var; + + return $this; + } + + /** + * Generated from protobuf field optional bytes string_value = 7; + * @return string + */ + public function getStringValue() + { + return isset($this->string_value) ? $this->string_value : ''; + } + + public function hasStringValue() + { + return isset($this->string_value); + } + + public function clearStringValue() + { + unset($this->string_value); + } + + /** + * Generated from protobuf field optional bytes string_value = 7; + * @param string $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkString($var, False); + $this->string_value = $var; + + return $this; + } + + /** + * Generated from protobuf field optional string aggregate_value = 8; + * @return string + */ + public function getAggregateValue() + { + return isset($this->aggregate_value) ? $this->aggregate_value : ''; + } + + public function hasAggregateValue() + { + return isset($this->aggregate_value); + } + + public function clearAggregateValue() + { + unset($this->aggregate_value); + } + + /** + * Generated from protobuf field optional string aggregate_value = 8; + * @param string $var + * @return $this + */ + public function setAggregateValue($var) + { + GPBUtil::checkString($var, True); + $this->aggregate_value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php new file mode 100644 index 00000000..6212d1e4 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php @@ -0,0 +1,116 @@ +google.protobuf.UninterpretedOption.NamePart + */ +class NamePart extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field required string name_part = 1; + */ + protected $name_part = null; + /** + * Generated from protobuf field required bool is_extension = 2; + */ + protected $is_extension = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name_part + * @type bool $is_extension + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field required string name_part = 1; + * @return string + */ + public function getNamePart() + { + return isset($this->name_part) ? $this->name_part : ''; + } + + public function hasNamePart() + { + return isset($this->name_part); + } + + public function clearNamePart() + { + unset($this->name_part); + } + + /** + * Generated from protobuf field required string name_part = 1; + * @param string $var + * @return $this + */ + public function setNamePart($var) + { + GPBUtil::checkString($var, True); + $this->name_part = $var; + + return $this; + } + + /** + * Generated from protobuf field required bool is_extension = 2; + * @return bool + */ + public function getIsExtension() + { + return isset($this->is_extension) ? $this->is_extension : false; + } + + public function hasIsExtension() + { + return isset($this->is_extension); + } + + public function clearIsExtension() + { + unset($this->is_extension); + } + + /** + * Generated from protobuf field required bool is_extension = 2; + * @param bool $var + * @return $this + */ + public function setIsExtension($var) + { + GPBUtil::checkBool($var); + $this->is_extension = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NamePart::class, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class); + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php b/vendor/google/protobuf/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php new file mode 100644 index 00000000..9750eb01 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php @@ -0,0 +1,16 @@ +google.protobuf.ListValue + */ +class ListValue extends \Google\Protobuf\Internal\Message +{ + /** + * Repeated field of dynamically typed values. + * + * Generated from protobuf field repeated .google.protobuf.Value values = 1; + */ + private $values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Value[]|\Google\Protobuf\Internal\RepeatedField $values + * Repeated field of dynamically typed values. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Struct::initOnce(); + parent::__construct($data); + } + + /** + * Repeated field of dynamically typed values. + * + * Generated from protobuf field repeated .google.protobuf.Value values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * Repeated field of dynamically typed values. + * + * Generated from protobuf field repeated .google.protobuf.Value values = 1; + * @param \Google\Protobuf\Value[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class); + $this->values = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Method.php b/vendor/google/protobuf/src/Google/Protobuf/Method.php new file mode 100644 index 00000000..2755baa0 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Method.php @@ -0,0 +1,271 @@ +google.protobuf.Method + */ +class Method extends \Google\Protobuf\Internal\Message +{ + /** + * The simple name of this method. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * A URL of the input message type. + * + * Generated from protobuf field string request_type_url = 2; + */ + protected $request_type_url = ''; + /** + * If true, the request is streamed. + * + * Generated from protobuf field bool request_streaming = 3; + */ + protected $request_streaming = false; + /** + * The URL of the output message type. + * + * Generated from protobuf field string response_type_url = 4; + */ + protected $response_type_url = ''; + /** + * If true, the response is streamed. + * + * Generated from protobuf field bool response_streaming = 5; + */ + protected $response_streaming = false; + /** + * Any metadata attached to the method. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 6; + */ + private $options; + /** + * The source syntax of this method. + * + * Generated from protobuf field .google.protobuf.Syntax syntax = 7; + */ + protected $syntax = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The simple name of this method. + * @type string $request_type_url + * A URL of the input message type. + * @type bool $request_streaming + * If true, the request is streamed. + * @type string $response_type_url + * The URL of the output message type. + * @type bool $response_streaming + * If true, the response is streamed. + * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options + * Any metadata attached to the method. + * @type int $syntax + * The source syntax of this method. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Api::initOnce(); + parent::__construct($data); + } + + /** + * The simple name of this method. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The simple name of this method. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A URL of the input message type. + * + * Generated from protobuf field string request_type_url = 2; + * @return string + */ + public function getRequestTypeUrl() + { + return $this->request_type_url; + } + + /** + * A URL of the input message type. + * + * Generated from protobuf field string request_type_url = 2; + * @param string $var + * @return $this + */ + public function setRequestTypeUrl($var) + { + GPBUtil::checkString($var, True); + $this->request_type_url = $var; + + return $this; + } + + /** + * If true, the request is streamed. + * + * Generated from protobuf field bool request_streaming = 3; + * @return bool + */ + public function getRequestStreaming() + { + return $this->request_streaming; + } + + /** + * If true, the request is streamed. + * + * Generated from protobuf field bool request_streaming = 3; + * @param bool $var + * @return $this + */ + public function setRequestStreaming($var) + { + GPBUtil::checkBool($var); + $this->request_streaming = $var; + + return $this; + } + + /** + * The URL of the output message type. + * + * Generated from protobuf field string response_type_url = 4; + * @return string + */ + public function getResponseTypeUrl() + { + return $this->response_type_url; + } + + /** + * The URL of the output message type. + * + * Generated from protobuf field string response_type_url = 4; + * @param string $var + * @return $this + */ + public function setResponseTypeUrl($var) + { + GPBUtil::checkString($var, True); + $this->response_type_url = $var; + + return $this; + } + + /** + * If true, the response is streamed. + * + * Generated from protobuf field bool response_streaming = 5; + * @return bool + */ + public function getResponseStreaming() + { + return $this->response_streaming; + } + + /** + * If true, the response is streamed. + * + * Generated from protobuf field bool response_streaming = 5; + * @param bool $var + * @return $this + */ + public function setResponseStreaming($var) + { + GPBUtil::checkBool($var); + $this->response_streaming = $var; + + return $this; + } + + /** + * Any metadata attached to the method. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOptions() + { + return $this->options; + } + + /** + * Any metadata attached to the method. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 6; + * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class); + $this->options = $arr; + + return $this; + } + + /** + * The source syntax of this method. + * + * Generated from protobuf field .google.protobuf.Syntax syntax = 7; + * @return int + */ + public function getSyntax() + { + return $this->syntax; + } + + /** + * The source syntax of this method. + * + * Generated from protobuf field .google.protobuf.Syntax syntax = 7; + * @param int $var + * @return $this + */ + public function setSyntax($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class); + $this->syntax = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Mixin.php b/vendor/google/protobuf/src/Google/Protobuf/Mixin.php new file mode 100644 index 00000000..4f7bf844 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Mixin.php @@ -0,0 +1,166 @@ +google.protobuf.Mixin + */ +class Mixin extends \Google\Protobuf\Internal\Message +{ + /** + * The fully qualified name of the interface which is included. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * If non-empty specifies a path under which inherited HTTP paths + * are rooted. + * + * Generated from protobuf field string root = 2; + */ + protected $root = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The fully qualified name of the interface which is included. + * @type string $root + * If non-empty specifies a path under which inherited HTTP paths + * are rooted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Api::initOnce(); + parent::__construct($data); + } + + /** + * The fully qualified name of the interface which is included. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The fully qualified name of the interface which is included. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * If non-empty specifies a path under which inherited HTTP paths + * are rooted. + * + * Generated from protobuf field string root = 2; + * @return string + */ + public function getRoot() + { + return $this->root; + } + + /** + * If non-empty specifies a path under which inherited HTTP paths + * are rooted. + * + * Generated from protobuf field string root = 2; + * @param string $var + * @return $this + */ + public function setRoot($var) + { + GPBUtil::checkString($var, True); + $this->root = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/NullValue.php b/vendor/google/protobuf/src/Google/Protobuf/NullValue.php new file mode 100644 index 00000000..61569f8a --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/NullValue.php @@ -0,0 +1,49 @@ +google.protobuf.NullValue + */ +class NullValue +{ + /** + * Null value. + * + * Generated from protobuf enum NULL_VALUE = 0; + */ + const NULL_VALUE = 0; + + private static $valueToName = [ + self::NULL_VALUE => 'NULL_VALUE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/OneofDescriptor.php b/vendor/google/protobuf/src/Google/Protobuf/OneofDescriptor.php new file mode 100644 index 00000000..92b4e279 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/OneofDescriptor.php @@ -0,0 +1,80 @@ +internal_desc = $internal_desc; + } + + /** + * @return string The name of the oneof + */ + public function getName() + { + return $this->internal_desc->getName(); + } + + /** + * @param int $index Must be >= 0 and < getFieldCount() + * @return FieldDescriptor + */ + public function getField($index) + { + return $this->getPublicDescriptor($this->internal_desc->getFields()[$index]); + } + + /** + * @return int Number of fields in the oneof + */ + public function getFieldCount() + { + return count($this->internal_desc->getFields()); + } + + public function isSynthetic() + { + return $this->internal_desc->isSynthetic(); + } +} diff --git a/vendor/google/protobuf/src/Google/Protobuf/Option.php b/vendor/google/protobuf/src/Google/Protobuf/Option.php new file mode 100644 index 00000000..31249e51 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Option.php @@ -0,0 +1,136 @@ +google.protobuf.Option + */ +class Option extends \Google\Protobuf\Internal\Message +{ + /** + * The option's name. For protobuf built-in options (options defined in + * descriptor.proto), this is the short name. For example, `"map_entry"`. + * For custom options, it should be the fully-qualified name. For example, + * `"google.api.http"`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The option's value packed in an Any message. If the value is a primitive, + * the corresponding wrapper type defined in google/protobuf/wrappers.proto + * should be used. If the value is an enum, it should be stored as an int32 + * value using the google.protobuf.Int32Value type. + * + * Generated from protobuf field .google.protobuf.Any value = 2; + */ + protected $value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The option's name. For protobuf built-in options (options defined in + * descriptor.proto), this is the short name. For example, `"map_entry"`. + * For custom options, it should be the fully-qualified name. For example, + * `"google.api.http"`. + * @type \Google\Protobuf\Any $value + * The option's value packed in an Any message. If the value is a primitive, + * the corresponding wrapper type defined in google/protobuf/wrappers.proto + * should be used. If the value is an enum, it should be stored as an int32 + * value using the google.protobuf.Int32Value type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Type::initOnce(); + parent::__construct($data); + } + + /** + * The option's name. For protobuf built-in options (options defined in + * descriptor.proto), this is the short name. For example, `"map_entry"`. + * For custom options, it should be the fully-qualified name. For example, + * `"google.api.http"`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The option's name. For protobuf built-in options (options defined in + * descriptor.proto), this is the short name. For example, `"map_entry"`. + * For custom options, it should be the fully-qualified name. For example, + * `"google.api.http"`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The option's value packed in an Any message. If the value is a primitive, + * the corresponding wrapper type defined in google/protobuf/wrappers.proto + * should be used. If the value is an enum, it should be stored as an int32 + * value using the google.protobuf.Int32Value type. + * + * Generated from protobuf field .google.protobuf.Any value = 2; + * @return \Google\Protobuf\Any|null + */ + public function getValue() + { + return $this->value; + } + + public function hasValue() + { + return isset($this->value); + } + + public function clearValue() + { + unset($this->value); + } + + /** + * The option's value packed in an Any message. If the value is a primitive, + * the corresponding wrapper type defined in google/protobuf/wrappers.proto + * should be used. If the value is an enum, it should be stored as an int32 + * value using the google.protobuf.Int32Value type. + * + * Generated from protobuf field .google.protobuf.Any value = 2; + * @param \Google\Protobuf\Any $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/SourceContext.php b/vendor/google/protobuf/src/Google/Protobuf/SourceContext.php new file mode 100644 index 00000000..8b3ea112 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/SourceContext.php @@ -0,0 +1,72 @@ +google.protobuf.SourceContext + */ +class SourceContext extends \Google\Protobuf\Internal\Message +{ + /** + * The path-qualified name of the .proto file that contained the associated + * protobuf element. For example: `"google/protobuf/source_context.proto"`. + * + * Generated from protobuf field string file_name = 1; + */ + protected $file_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $file_name + * The path-qualified name of the .proto file that contained the associated + * protobuf element. For example: `"google/protobuf/source_context.proto"`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\SourceContext::initOnce(); + parent::__construct($data); + } + + /** + * The path-qualified name of the .proto file that contained the associated + * protobuf element. For example: `"google/protobuf/source_context.proto"`. + * + * Generated from protobuf field string file_name = 1; + * @return string + */ + public function getFileName() + { + return $this->file_name; + } + + /** + * The path-qualified name of the .proto file that contained the associated + * protobuf element. For example: `"google/protobuf/source_context.proto"`. + * + * Generated from protobuf field string file_name = 1; + * @param string $var + * @return $this + */ + public function setFileName($var) + { + GPBUtil::checkString($var, True); + $this->file_name = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/StringValue.php b/vendor/google/protobuf/src/Google/Protobuf/StringValue.php new file mode 100644 index 00000000..ad98316b --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/StringValue.php @@ -0,0 +1,68 @@ +google.protobuf.StringValue + */ +class StringValue extends \Google\Protobuf\Internal\Message +{ + /** + * The string value. + * + * Generated from protobuf field string value = 1; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $value + * The string value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); + parent::__construct($data); + } + + /** + * The string value. + * + * Generated from protobuf field string value = 1; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The string value. + * + * Generated from protobuf field string value = 1; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Struct.php b/vendor/google/protobuf/src/Google/Protobuf/Struct.php new file mode 100644 index 00000000..0456541c --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Struct.php @@ -0,0 +1,73 @@ +google.protobuf.Struct + */ +class Struct extends \Google\Protobuf\Internal\Message +{ + /** + * Unordered map of dynamically typed values. + * + * Generated from protobuf field map fields = 1; + */ + private $fields; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\MapField $fields + * Unordered map of dynamically typed values. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Struct::initOnce(); + parent::__construct($data); + } + + /** + * Unordered map of dynamically typed values. + * + * Generated from protobuf field map fields = 1; + * @return \Google\Protobuf\Internal\MapField + */ + public function getFields() + { + return $this->fields; + } + + /** + * Unordered map of dynamically typed values. + * + * Generated from protobuf field map fields = 1; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setFields($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class); + $this->fields = $arr; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Syntax.php b/vendor/google/protobuf/src/Google/Protobuf/Syntax.php new file mode 100644 index 00000000..10952bfd --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Syntax.php @@ -0,0 +1,54 @@ +google.protobuf.Syntax + */ +class Syntax +{ + /** + * Syntax `proto2`. + * + * Generated from protobuf enum SYNTAX_PROTO2 = 0; + */ + const SYNTAX_PROTO2 = 0; + /** + * Syntax `proto3`. + * + * Generated from protobuf enum SYNTAX_PROTO3 = 1; + */ + const SYNTAX_PROTO3 = 1; + + private static $valueToName = [ + self::SYNTAX_PROTO2 => 'SYNTAX_PROTO2', + self::SYNTAX_PROTO3 => 'SYNTAX_PROTO3', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Timestamp.php b/vendor/google/protobuf/src/Google/Protobuf/Timestamp.php new file mode 100644 index 00000000..a12f4852 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Timestamp.php @@ -0,0 +1,186 @@ +google.protobuf.Timestamp + */ +class Timestamp extends \Google\Protobuf\Internal\TimestampBase +{ + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + * + * Generated from protobuf field int64 seconds = 1; + */ + protected $seconds = 0; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + * + * Generated from protobuf field int32 nanos = 2; + */ + protected $nanos = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $seconds + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + * @type int $nanos + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Timestamp::initOnce(); + parent::__construct($data); + } + + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + * + * Generated from protobuf field int64 seconds = 1; + * @return int|string + */ + public function getSeconds() + { + return $this->seconds; + } + + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + * + * Generated from protobuf field int64 seconds = 1; + * @param int|string $var + * @return $this + */ + public function setSeconds($var) + { + GPBUtil::checkInt64($var); + $this->seconds = $var; + + return $this; + } + + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + * + * Generated from protobuf field int32 nanos = 2; + * @return int + */ + public function getNanos() + { + return $this->nanos; + } + + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + * + * Generated from protobuf field int32 nanos = 2; + * @param int $var + * @return $this + */ + public function setNanos($var) + { + GPBUtil::checkInt32($var); + $this->nanos = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Type.php b/vendor/google/protobuf/src/Google/Protobuf/Type.php new file mode 100644 index 00000000..41b9e360 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Type.php @@ -0,0 +1,247 @@ +google.protobuf.Type + */ +class Type extends \Google\Protobuf\Internal\Message +{ + /** + * The fully qualified message name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The list of fields. + * + * Generated from protobuf field repeated .google.protobuf.Field fields = 2; + */ + private $fields; + /** + * The list of types appearing in `oneof` definitions in this type. + * + * Generated from protobuf field repeated string oneofs = 3; + */ + private $oneofs; + /** + * The protocol buffer options. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 4; + */ + private $options; + /** + * The source context. + * + * Generated from protobuf field .google.protobuf.SourceContext source_context = 5; + */ + protected $source_context = null; + /** + * The source syntax. + * + * Generated from protobuf field .google.protobuf.Syntax syntax = 6; + */ + protected $syntax = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The fully qualified message name. + * @type \Google\Protobuf\Field[]|\Google\Protobuf\Internal\RepeatedField $fields + * The list of fields. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $oneofs + * The list of types appearing in `oneof` definitions in this type. + * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options + * The protocol buffer options. + * @type \Google\Protobuf\SourceContext $source_context + * The source context. + * @type int $syntax + * The source syntax. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Type::initOnce(); + parent::__construct($data); + } + + /** + * The fully qualified message name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The fully qualified message name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The list of fields. + * + * Generated from protobuf field repeated .google.protobuf.Field fields = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFields() + { + return $this->fields; + } + + /** + * The list of fields. + * + * Generated from protobuf field repeated .google.protobuf.Field fields = 2; + * @param \Google\Protobuf\Field[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFields($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Field::class); + $this->fields = $arr; + + return $this; + } + + /** + * The list of types appearing in `oneof` definitions in this type. + * + * Generated from protobuf field repeated string oneofs = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOneofs() + { + return $this->oneofs; + } + + /** + * The list of types appearing in `oneof` definitions in this type. + * + * Generated from protobuf field repeated string oneofs = 3; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOneofs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->oneofs = $arr; + + return $this; + } + + /** + * The protocol buffer options. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOptions() + { + return $this->options; + } + + /** + * The protocol buffer options. + * + * Generated from protobuf field repeated .google.protobuf.Option options = 4; + * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class); + $this->options = $arr; + + return $this; + } + + /** + * The source context. + * + * Generated from protobuf field .google.protobuf.SourceContext source_context = 5; + * @return \Google\Protobuf\SourceContext|null + */ + public function getSourceContext() + { + return $this->source_context; + } + + public function hasSourceContext() + { + return isset($this->source_context); + } + + public function clearSourceContext() + { + unset($this->source_context); + } + + /** + * The source context. + * + * Generated from protobuf field .google.protobuf.SourceContext source_context = 5; + * @param \Google\Protobuf\SourceContext $var + * @return $this + */ + public function setSourceContext($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\SourceContext::class); + $this->source_context = $var; + + return $this; + } + + /** + * The source syntax. + * + * Generated from protobuf field .google.protobuf.Syntax syntax = 6; + * @return int + */ + public function getSyntax() + { + return $this->syntax; + } + + /** + * The source syntax. + * + * Generated from protobuf field .google.protobuf.Syntax syntax = 6; + * @param int $var + * @return $this + */ + public function setSyntax($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class); + $this->syntax = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/UInt32Value.php b/vendor/google/protobuf/src/Google/Protobuf/UInt32Value.php new file mode 100644 index 00000000..ae5fc5b4 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/UInt32Value.php @@ -0,0 +1,68 @@ +google.protobuf.UInt32Value + */ +class UInt32Value extends \Google\Protobuf\Internal\Message +{ + /** + * The uint32 value. + * + * Generated from protobuf field uint32 value = 1; + */ + protected $value = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $value + * The uint32 value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); + parent::__construct($data); + } + + /** + * The uint32 value. + * + * Generated from protobuf field uint32 value = 1; + * @return int + */ + public function getValue() + { + return $this->value; + } + + /** + * The uint32 value. + * + * Generated from protobuf field uint32 value = 1; + * @param int $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkUint32($var); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/UInt64Value.php b/vendor/google/protobuf/src/Google/Protobuf/UInt64Value.php new file mode 100644 index 00000000..aa968672 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/UInt64Value.php @@ -0,0 +1,68 @@ +google.protobuf.UInt64Value + */ +class UInt64Value extends \Google\Protobuf\Internal\Message +{ + /** + * The uint64 value. + * + * Generated from protobuf field uint64 value = 1; + */ + protected $value = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $value + * The uint64 value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); + parent::__construct($data); + } + + /** + * The uint64 value. + * + * Generated from protobuf field uint64 value = 1; + * @return int|string + */ + public function getValue() + { + return $this->value; + } + + /** + * The uint64 value. + * + * Generated from protobuf field uint64 value = 1; + * @param int|string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkUint64($var); + $this->value = $var; + + return $this; + } + +} + diff --git a/vendor/google/protobuf/src/Google/Protobuf/Value.php b/vendor/google/protobuf/src/Google/Protobuf/Value.php new file mode 100644 index 00000000..dcc0bdf7 --- /dev/null +++ b/vendor/google/protobuf/src/Google/Protobuf/Value.php @@ -0,0 +1,244 @@ +google.protobuf.Value + */ +class Value extends \Google\Protobuf\Internal\Message +{ + protected $kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $null_value + * Represents a null value. + * @type float $number_value + * Represents a double value. + * @type string $string_value + * Represents a string value. + * @type bool $bool_value + * Represents a boolean value. + * @type \Google\Protobuf\Struct $struct_value + * Represents a structured value. + * @type \Google\Protobuf\ListValue $list_value + * Represents a repeated `Value`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Struct::initOnce(); + parent::__construct($data); + } + + /** + * Represents a null value. + * + * Generated from protobuf field .google.protobuf.NullValue null_value = 1; + * @return int + */ + public function getNullValue() + { + return $this->readOneof(1); + } + + public function hasNullValue() + { + return $this->hasOneof(1); + } + + /** + * Represents a null value. + * + * Generated from protobuf field .google.protobuf.NullValue null_value = 1; + * @param int $var + * @return $this + */ + public function setNullValue($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\NullValue::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Represents a double value. + * + * Generated from protobuf field double number_value = 2; + * @return float + */ + public function getNumberValue() + { + return $this->readOneof(2); + } + + public function hasNumberValue() + { + return $this->hasOneof(2); + } + + /** + * Represents a double value. + * + * Generated from protobuf field double number_value = 2; + * @param float $var + * @return $this + */ + public function setNumberValue($var) + { + GPBUtil::checkDouble($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Represents a string value. + * + * Generated from protobuf field string string_value = 3; + * @return string + */ + public function getStringValue() + { + return $this->readOneof(3); + } + + public function hasStringValue() + { + return $this->hasOneof(3); + } + + /** + * Represents a string value. + * + * Generated from protobuf field string string_value = 3; + * @param string $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Represents a boolean value. + * + * Generated from protobuf field bool bool_value = 4; + * @return bool + */ + public function getBoolValue() + { + return $this->readOneof(4); + } + + public function hasBoolValue() + { + return $this->hasOneof(4); + } + + /** + * Represents a boolean value. + * + * Generated from protobuf field bool bool_value = 4; + * @param bool $var + * @return $this + */ + public function setBoolValue($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Represents a structured value. + * + * Generated from protobuf field .google.protobuf.Struct struct_value = 5; + * @return \Google\Protobuf\Struct|null + */ + public function getStructValue() + { + return $this->readOneof(5); + } + + public function hasStructValue() + { + return $this->hasOneof(5); + } + + /** + * Represents a structured value. + * + * Generated from protobuf field .google.protobuf.Struct struct_value = 5; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setStructValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Represents a repeated `Value`. + * + * Generated from protobuf field .google.protobuf.ListValue list_value = 6; + * @return \Google\Protobuf\ListValue|null + */ + public function getListValue() + { + return $this->readOneof(6); + } + + public function hasListValue() + { + return $this->hasOneof(6); + } + + /** + * Represents a repeated `Value`. + * + * Generated from protobuf field .google.protobuf.ListValue list_value = 6; + * @param \Google\Protobuf\ListValue $var + * @return $this + */ + public function setListValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * @return string + */ + public function getKind() + { + return $this->whichOneof("kind"); + } + +} + diff --git a/vendor/google/protobuf/src/phpdoc.dist.xml b/vendor/google/protobuf/src/phpdoc.dist.xml new file mode 100644 index 00000000..dd313025 --- /dev/null +++ b/vendor/google/protobuf/src/phpdoc.dist.xml @@ -0,0 +1,15 @@ + + + + + doc + + + doc + + + Google/Protobuf/Internal/MapField.php + Google/Protobuf/Internal/Message.php + Google/Protobuf/Internal/RepeatedField.php + + diff --git a/vendor/grpc/grpc/LICENSE b/vendor/grpc/grpc/LICENSE new file mode 100644 index 00000000..8dada3ed --- /dev/null +++ b/vendor/grpc/grpc/LICENSE @@ -0,0 +1,201 @@ + 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/grpc/grpc/MAINTAINERS.md b/vendor/grpc/grpc/MAINTAINERS.md new file mode 100644 index 00000000..975a6943 --- /dev/null +++ b/vendor/grpc/grpc/MAINTAINERS.md @@ -0,0 +1,16 @@ +This page lists all active maintainers of this repository. If you were a +maintainer and would like to add your name to the Emeritus list, please send us a +PR. + +See [GOVERNANCE.md](https://github.com/grpc/grpc-community/blob/master/governance.md) +for governance guidelines and how to become a maintainer. +See [CONTRIBUTING.md](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md) +for general contribution guidelines. + +## Maintainers (in alphabetical order) +- [stanley-cheung](https://github.com/stanley-cheung), Google Inc. +- [wenbozhu](https://github.com/wenbozhu), Google Inc. +- [zhouyihaiding](https://github.com/zhouyihaiding), Google Inc. + +## Emeritus Maintainers (in alphabetical order) +- [murgatroid99](https://github.com/murgatroid99), Google Inc. diff --git a/vendor/grpc/grpc/README.md b/vendor/grpc/grpc/README.md new file mode 100644 index 00000000..293c27b0 --- /dev/null +++ b/vendor/grpc/grpc/README.md @@ -0,0 +1,9 @@ +# gRPC PHP Client Library + +This repository contains only PHP files to support Composer installation. + +This repository is a mirror of [gRPC](https://github.com/grpc/grpc). Any support +requests, bug reports, or development contributions should be directed to +that project. + +To install gRPC for PHP, please see https://github.com/grpc/grpc/tree/master/src/php diff --git a/vendor/grpc/grpc/composer.json b/vendor/grpc/grpc/composer.json new file mode 100644 index 00000000..bf91659e --- /dev/null +++ b/vendor/grpc/grpc/composer.json @@ -0,0 +1,24 @@ +{ + "name": "grpc/grpc", + "type": "library", + "description": "gRPC library for PHP", + "keywords": ["rpc"], + "homepage": "https://grpc.io", + "license": "Apache-2.0", + "version": "1.42.0", + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "google/auth": "^v1.3.0" + }, + "suggest": { + "ext-protobuf": "For better performance, install the protobuf C extension.", + "google/protobuf": "To get started using grpc quickly, install the native protobuf library." + }, + "autoload": { + "psr-4": { + "Grpc\\": "src/lib/" + } + } +} diff --git a/vendor/grpc/grpc/etc/roots.pem b/vendor/grpc/grpc/etc/roots.pem new file mode 100644 index 00000000..e5c84fae --- /dev/null +++ b/vendor/grpc/grpc/etc/roots.pem @@ -0,0 +1,4337 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Issuer: CN=GlobalSign Root CA O=GlobalSign nv-sa OU=Root CA +# Subject: CN=GlobalSign Root CA O=GlobalSign nv-sa OU=Root CA +# Label: "GlobalSign Root CA" +# Serial: 4835703278459707669005204 +# MD5 Fingerprint: 3e:45:52:15:09:51:92:e1:b7:5d:37:9f:b1:87:29:8a +# SHA1 Fingerprint: b1:bc:96:8b:d4:f4:9d:62:2a:a8:9a:81:f2:15:01:52:a4:1d:82:9c +# SHA256 Fingerprint: eb:d4:10:40:e4:bb:3e:c7:42:c9:e3:81:d3:1e:f2:a4:1a:48:b6:68:5c:96:e7:ce:f3:c1:df:6c:d4:33:1c:99 +-----BEGIN CERTIFICATE----- +MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG +A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv +b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw +MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i +YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT +aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ +jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp +xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp +1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG +snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ +U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8 +9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E +BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B +AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz +yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE +38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP +AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad +DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME +HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A== +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R2 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R2 +# Label: "GlobalSign Root CA - R2" +# Serial: 4835703278459682885658125 +# MD5 Fingerprint: 94:14:77:7e:3e:5e:fd:8f:30:bd:41:b0:cf:e7:d0:30 +# SHA1 Fingerprint: 75:e0:ab:b6:13:85:12:27:1c:04:f8:5f:dd:de:38:e4:b7:24:2e:fe +# SHA256 Fingerprint: ca:42:dd:41:74:5f:d0:b8:1e:b9:02:36:2c:f9:d8:bf:71:9d:a1:bd:1b:1e:fc:94:6f:5b:4c:99:f4:2c:1b:9e +-----BEGIN CERTIFICATE----- +MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G +A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp +Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1 +MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG +A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL +v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8 +eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq +tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd +C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa +zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB +mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH +V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n +bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG +3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs +J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO +291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS +ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd +AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7 +TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg== +-----END CERTIFICATE----- + +# Issuer: CN=Entrust.net Certification Authority (2048) O=Entrust.net OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/(c) 1999 Entrust.net Limited +# Subject: CN=Entrust.net Certification Authority (2048) O=Entrust.net OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/(c) 1999 Entrust.net Limited +# Label: "Entrust.net Premium 2048 Secure Server CA" +# Serial: 946069240 +# MD5 Fingerprint: ee:29:31:bc:32:7e:9a:e6:e8:b5:f7:51:b4:34:71:90 +# SHA1 Fingerprint: 50:30:06:09:1d:97:d4:f5:ae:39:f7:cb:e7:92:7d:7d:65:2d:34:31 +# SHA256 Fingerprint: 6d:c4:71:72:e0:1c:bc:b0:bf:62:58:0d:89:5f:e2:b8:ac:9a:d4:f8:73:80:1e:0c:10:b9:c8:37:d2:1e:b1:77 +-----BEGIN CERTIFICATE----- +MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML +RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp +bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5 +IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0yOTA3 +MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 +LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp +YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG +A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq +K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe +sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX +MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT +XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/ +HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH +4QIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV +HQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJKoZIhvcNAQEFBQADggEBADub +j1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPyT/4xmf3IDExo +U8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf +zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5b +u/8j72gZyxKTJ1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+ +bYQLCIt+jerXmCHG8+c8eS9enNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/Er +fF6adulZkMV8gzURZVE= +-----END CERTIFICATE----- + +# Issuer: CN=Baltimore CyberTrust Root O=Baltimore OU=CyberTrust +# Subject: CN=Baltimore CyberTrust Root O=Baltimore OU=CyberTrust +# Label: "Baltimore CyberTrust Root" +# Serial: 33554617 +# MD5 Fingerprint: ac:b6:94:a5:9c:17:e0:d7:91:52:9b:b1:97:06:a6:e4 +# SHA1 Fingerprint: d4:de:20:d0:5e:66:fc:53:fe:1a:50:88:2c:78:db:28:52:ca:e4:74 +# SHA256 Fingerprint: 16:af:57:a9:f6:76:b0:ab:12:60:95:aa:5e:ba:de:f2:2a:b3:11:19:d6:44:ac:95:cd:4b:93:db:f3:f2:6a:eb +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ +RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD +VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX +DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y +ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy +VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr +mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr +IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK +mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu +XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy +dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye +jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1 +BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3 +DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92 +9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx +jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0 +Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz +ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS +R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp +-----END CERTIFICATE----- + +# Issuer: CN=Entrust Root Certification Authority O=Entrust, Inc. OU=www.entrust.net/CPS is incorporated by reference/(c) 2006 Entrust, Inc. +# Subject: CN=Entrust Root Certification Authority O=Entrust, Inc. OU=www.entrust.net/CPS is incorporated by reference/(c) 2006 Entrust, Inc. +# Label: "Entrust Root Certification Authority" +# Serial: 1164660820 +# MD5 Fingerprint: d6:a5:c3:ed:5d:dd:3e:00:c1:3d:87:92:1f:1d:3f:e4 +# SHA1 Fingerprint: b3:1e:b1:b7:40:e3:6c:84:02:da:dc:37:d4:4d:f5:d4:67:49:52:f9 +# SHA256 Fingerprint: 73:c1:76:43:4f:1b:c6:d5:ad:f4:5b:0e:76:e7:27:28:7c:8d:e5:76:16:c1:e6:e6:14:1a:2b:2c:bc:7d:8e:4c +-----BEGIN CERTIFICATE----- +MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC +VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0 +Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW +KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl +cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw +NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw +NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy +ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV +BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo +Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4 +4LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9 +KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI +rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi +94DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB +sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi +gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo +kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE +vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA +A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t +O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua +AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP +9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/ +eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m +0vdXcDazv/wor3ElhVsT/h5/WrQ8 +-----END CERTIFICATE----- + +# Issuer: CN=AAA Certificate Services O=Comodo CA Limited +# Subject: CN=AAA Certificate Services O=Comodo CA Limited +# Label: "Comodo AAA Services root" +# Serial: 1 +# MD5 Fingerprint: 49:79:04:b0:eb:87:19:ac:47:b0:bc:11:51:9b:74:d0 +# SHA1 Fingerprint: d1:eb:23:a4:6d:17:d6:8f:d9:25:64:c2:f1:f1:60:17:64:d8:e3:49 +# SHA256 Fingerprint: d7:a7:a0:fb:5d:7e:27:31:d7:71:e9:48:4e:bc:de:f7:1d:5f:0c:3e:0a:29:48:78:2b:c8:3e:e0:ea:69:9e:f4 +-----BEGIN CERTIFICATE----- +MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb +MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow +GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj +YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL +MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE +BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM +GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua +BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe +3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4 +YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR +rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm +ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU +oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF +MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v +QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t +b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF +AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q +GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz +Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2 +G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi +l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3 +smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 2 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 2 O=QuoVadis Limited +# Label: "QuoVadis Root CA 2" +# Serial: 1289 +# MD5 Fingerprint: 5e:39:7b:dd:f8:ba:ec:82:e9:ac:62:ba:0c:54:00:2b +# SHA1 Fingerprint: ca:3a:fb:cf:12:40:36:4b:44:b2:16:20:88:80:48:39:19:93:7c:f7 +# SHA256 Fingerprint: 85:a0:dd:7d:d7:20:ad:b7:ff:05:f8:3d:54:2b:20:9d:c7:ff:45:28:f7:d6:77:b1:83:89:fe:a5:e5:c4:9e:86 +-----BEGIN CERTIFICATE----- +MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x +GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv +b3QgQ0EgMjAeFw0wNjExMjQxODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNV +BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W +YWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCa +GMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6XJxg +Fyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55J +WpzmM+Yklvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bB +rrcCaoF6qUWD4gXmuVbBlDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp ++ARz8un+XJiM9XOva7R+zdRcAitMOeGylZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1 +ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt66/3FsvbzSUr5R/7mp/i +Ucw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1JdxnwQ5hYIiz +PtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og +/zOhD7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UH +oycR7hYQe7xFSkyyBNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuI +yV77zGHcizN300QyNQliBJIWENieJ0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1Ud +EwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBQahGK8SEwzJQTU7tD2 +A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGUa6FJpEcwRTEL +MAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT +ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2f +BluornFdLwUvZ+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzn +g/iN/Ae42l9NLmeyhP3ZRPx3UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2Bl +fF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodmVjB3pjd4M1IQWK4/YY7yarHvGH5K +WWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK+JDSV6IZUaUtl0Ha +B0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrWIozc +hLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPR +TUIZ3Ph1WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWD +mbA4CD/pXvk1B+TJYm5Xf6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0Z +ohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y +4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8VCLAAVBpQ570su9t+Oza +8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 3 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 3 O=QuoVadis Limited +# Label: "QuoVadis Root CA 3" +# Serial: 1478 +# MD5 Fingerprint: 31:85:3c:62:94:97:63:b9:aa:fd:89:4e:af:6f:e0:cf +# SHA1 Fingerprint: 1f:49:14:f7:d8:74:95:1d:dd:ae:02:c0:be:fd:3a:2d:82:75:51:85 +# SHA256 Fingerprint: 18:f1:fc:7f:20:5d:f8:ad:dd:eb:7f:e0:07:dd:57:e3:af:37:5a:9c:4d:8d:73:54:6b:f4:f1:fe:d1:e1:8d:35 +-----BEGIN CERTIFICATE----- +MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x +GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv +b3QgQ0EgMzAeFw0wNjExMjQxOTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNV +BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W +YWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDM +V0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNggDhoB +4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUr +H556VOijKTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd +8lyyBTNvijbO0BNO/79KDDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9Cabwv +vWhDFlaJKjdhkf2mrk7AyxRllDdLkgbvBNDInIjbC3uBr7E9KsRlOni27tyAsdLT +mZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwpp5ijJUMv7/FfJuGITfhe +btfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8nT8KKdjc +T5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDt +WAEXMJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZ +c6tsgLjoC2SToJyMGf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A +4iLItLRkT9a6fUg+qGkM17uGcclzuD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYD +VR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHTBgkrBgEEAb5YAAMwgcUwgZMG +CCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmljYXRlIGNvbnN0 +aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0 +aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVu +dC4wLQYIKwYBBQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2Nw +czALBgNVHQ8EBAMCAQYwHQYDVR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4G +A1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4ywLQoUmkRzBFMQswCQYDVQQGEwJC +TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UEAxMSUXVvVmFkaXMg +Um9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZVqyM0 +7ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSem +d1o417+shvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd ++LJ2w/w4E6oM3kJpK27zPOuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B +4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadN +t54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp8kokUvd0/bpO5qgdAm6x +DYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBCbjPsMZ57 +k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6s +zHXug/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0j +Wy10QJLZYxkNc91pvGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeT +mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK +4SVhM7JZG+Ju1zdXtg2pEto= +-----END CERTIFICATE----- + +# Issuer: O=SECOM Trust.net OU=Security Communication RootCA1 +# Subject: O=SECOM Trust.net OU=Security Communication RootCA1 +# Label: "Security Communication Root CA" +# Serial: 0 +# MD5 Fingerprint: f1:bc:63:6a:54:e0:b5:27:f5:cd:e7:1a:e3:4d:6e:4a +# SHA1 Fingerprint: 36:b1:2b:49:f9:81:9e:d7:4c:9e:bc:38:0f:c6:56:8f:5d:ac:b2:f7 +# SHA256 Fingerprint: e7:5e:72:ed:9f:56:0e:ec:6e:b4:80:00:73:a4:3f:c3:ad:19:19:5a:39:22:82:01:78:95:97:4a:99:02:6b:6c +-----BEGIN CERTIFICATE----- +MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEY +MBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21t +dW5pY2F0aW9uIFJvb3RDQTEwHhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5 +WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYD +VQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw8yl8 +9f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJ +DKaVv0uMDPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9 +Ms+k2Y7CI9eNqPPYJayX5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/N +QV3Is00qVUarH9oe4kA92819uZKAnDfdDJZkndwi92SL32HeFZRSFaB9UslLqCHJ +xrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2JChzAgMBAAGjPzA9MB0G +A1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYwDwYDVR0T +AQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vG +kl3g0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfr +Uj94nK9NrvjVT8+amCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5 +Bw+SUEmK3TGXX8npN6o7WWWXlDLJs58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJU +JRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ6rBK+1YWc26sTfcioU+tHXot +RSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAiFL39vmwLAw== +-----END CERTIFICATE----- + +# Issuer: CN=XRamp Global Certification Authority O=XRamp Security Services Inc OU=www.xrampsecurity.com +# Subject: CN=XRamp Global Certification Authority O=XRamp Security Services Inc OU=www.xrampsecurity.com +# Label: "XRamp Global CA Root" +# Serial: 107108908803651509692980124233745014957 +# MD5 Fingerprint: a1:0b:44:b3:ca:10:d8:00:6e:9d:0f:d8:0f:92:0a:d1 +# SHA1 Fingerprint: b8:01:86:d1:eb:9c:86:a5:41:04:cf:30:54:f3:4c:52:b7:e5:58:c6 +# SHA256 Fingerprint: ce:cd:dc:90:50:99:d8:da:df:c5:b1:d2:09:b7:37:cb:e2:c1:8c:fb:2c:10:c0:ff:0b:cf:0d:32:86:fc:1a:a2 +-----BEGIN CERTIFICATE----- +MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB +gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk +MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY +UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx +NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3 +dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2Vy +dmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS6 +38eMpSe2OAtp87ZOqCwuIR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCP +KZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMxfoArtYzAQDsRhtDLooY2YKTVMIJt2W7Q +DxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FEzG+gSqmUsE3a56k0enI4 +qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqsAxcZZPRa +JSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNVi +PvryxS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0P +BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASs +jVy16bYbMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0 +eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQEwDQYJKoZIhvcNAQEFBQAD +ggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc/Kh4ZzXxHfAR +vbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt +qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLa +IR9NmXmd4c8nnxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSy +i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ +O+7ETPTsJ3xCwnR8gooJybQDJbw= +-----END CERTIFICATE----- + +# Issuer: O=The Go Daddy Group, Inc. OU=Go Daddy Class 2 Certification Authority +# Subject: O=The Go Daddy Group, Inc. OU=Go Daddy Class 2 Certification Authority +# Label: "Go Daddy Class 2 CA" +# Serial: 0 +# MD5 Fingerprint: 91:de:06:25:ab:da:fd:32:17:0c:bb:25:17:2a:84:67 +# SHA1 Fingerprint: 27:96:ba:e6:3f:18:01:e2:77:26:1b:a0:d7:77:70:02:8f:20:ee:e4 +# SHA256 Fingerprint: c3:84:6b:f2:4b:9e:93:ca:64:27:4c:0e:c6:7c:1e:cc:5e:02:4f:fc:ac:d2:d7:40:19:35:0e:81:fe:54:6a:e4 +-----BEGIN CERTIFICATE----- +MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh +MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE +YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3 +MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo +ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg +MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN +ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA +PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w +wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi +EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY +avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+ +YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE +sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h +/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5 +IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD +ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy +OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P +TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ +HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER +dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf +ReYNnyicsbkqWletNw+vHX/bvZ8= +-----END CERTIFICATE----- + +# Issuer: O=Starfield Technologies, Inc. OU=Starfield Class 2 Certification Authority +# Subject: O=Starfield Technologies, Inc. OU=Starfield Class 2 Certification Authority +# Label: "Starfield Class 2 CA" +# Serial: 0 +# MD5 Fingerprint: 32:4a:4b:bb:c8:63:69:9b:be:74:9a:c6:dd:1d:46:24 +# SHA1 Fingerprint: ad:7e:1c:28:b0:64:ef:8f:60:03:40:20:14:c3:d0:e3:37:0e:b5:8a +# SHA256 Fingerprint: 14:65:fa:20:53:97:b8:76:fa:a6:f0:a9:95:8e:55:90:e4:0f:cc:7f:aa:4f:b7:c2:c8:67:75:21:fb:5f:b6:58 +-----BEGIN CERTIFICATE----- +MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl +MCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMp +U3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQw +NjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBoMQswCQYDVQQGEwJVUzElMCMGA1UE +ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZp +ZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqGSIb3 +DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf +8MOh2tTYbitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN ++lq2cwQlZut3f+dZxkqZJRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0 +X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVmepsZGD3/cVE8MC5fvj13c7JdBmzDI1aa +K4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSNF4Azbl5KXZnJHoe0nRrA +1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HFMIHCMB0G +A1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fR +zt0fhvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0 +YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBD +bGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8w +DQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGsafPzWdqbAYcaT1epoXkJKtv3 +L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLMPUxA2IGvd56D +eruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl +xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynp +VSJYACPq4xJDKVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEY +WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q= +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Assured ID Root CA O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Assured ID Root CA O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Assured ID Root CA" +# Serial: 17154717934120587862167794914071425081 +# MD5 Fingerprint: 87:ce:0b:7b:2a:0e:49:00:e1:58:71:9b:37:a8:93:72 +# SHA1 Fingerprint: 05:63:b8:63:0d:62:d7:5a:bb:c8:ab:1e:4b:df:b5:a8:99:b2:4d:43 +# SHA256 Fingerprint: 3e:90:99:b5:01:5e:8f:48:6c:00:bc:ea:9d:11:1e:e7:21:fa:ba:35:5a:89:bc:f1:df:69:56:1e:3d:c6:32:5c +-----BEGIN CERTIFICATE----- +MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv +b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl +cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c +JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP +mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+ +wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4 +VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/ +AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB +AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW +BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun +pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC +dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf +fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm +NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx +H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe ++o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Global Root CA O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Global Root CA O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Global Root CA" +# Serial: 10944719598952040374951832963794454346 +# MD5 Fingerprint: 79:e4:a9:84:0d:7d:3a:96:d7:c0:4f:e2:43:4c:89:2e +# SHA1 Fingerprint: a8:98:5d:3a:65:e5:e5:c4:b2:d7:d6:6d:40:c6:dd:2f:b1:9c:54:36 +# SHA256 Fingerprint: 43:48:a0:e9:44:4c:78:cb:26:5e:05:8d:5e:89:44:b4:d8:4f:96:62:bd:26:db:25:7f:89:34:a4:43:c7:01:61 +-----BEGIN CERTIFICATE----- +MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD +QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT +MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j +b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB +CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 +nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt +43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P +T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 +gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR +TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw +DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr +hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg +06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF +PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls +YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk +CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert High Assurance EV Root CA O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert High Assurance EV Root CA O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert High Assurance EV Root CA" +# Serial: 3553400076410547919724730734378100087 +# MD5 Fingerprint: d4:74:de:57:5c:39:b2:d3:9c:85:83:c5:c0:65:49:8a +# SHA1 Fingerprint: 5f:b7:ee:06:33:e2:59:db:ad:0c:4c:9a:e6:d3:8f:1a:61:c7:dc:25 +# SHA256 Fingerprint: 74:31:e5:f4:c3:c1:ce:46:90:77:4f:0b:61:e0:54:40:88:3b:a9:a0:1e:d0:0b:a6:ab:d7:80:6e:d3:b1:18:cf +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j +ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL +MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3 +LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug +RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm ++9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW +PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM +xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB +Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3 +hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg +EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA +FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec +nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z +eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF +hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2 +Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe +vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep ++OkuE6N36B9K +-----END CERTIFICATE----- + +# Issuer: CN=SwissSign Gold CA - G2 O=SwissSign AG +# Subject: CN=SwissSign Gold CA - G2 O=SwissSign AG +# Label: "SwissSign Gold CA - G2" +# Serial: 13492815561806991280 +# MD5 Fingerprint: 24:77:d9:a8:91:d1:3b:fa:88:2d:c2:ff:f8:cd:33:93 +# SHA1 Fingerprint: d8:c5:38:8a:b7:30:1b:1b:6e:d4:7a:e6:45:25:3a:6f:9f:1a:27:61 +# SHA256 Fingerprint: 62:dd:0b:e9:b9:f5:0a:16:3e:a0:f8:e7:5c:05:3b:1e:ca:57:ea:55:c8:68:8f:64:7c:68:81:f2:c8:35:7b:95 +-----BEGIN CERTIFICATE----- +MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV +BAYTAkNIMRUwEwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2ln +biBHb2xkIENBIC0gRzIwHhcNMDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBF +MQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMR8wHQYDVQQDExZT +d2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC +CgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUqt2/8 +76LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+ +bbqBHH5CjCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c +6bM8K8vzARO/Ws/BtQpgvd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqE +emA8atufK+ze3gE/bk3lUIbLtK/tREDFylqM2tIrfKjuvqblCqoOpd8FUrdVxyJd +MmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvRAiTysybUa9oEVeXBCsdt +MDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuendjIj3o02y +MszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69y +FGkOpeUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPi +aG59je883WX0XaxR7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxM +gI93e2CaHt+28kgeDrpOVG2Y4OGiGqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCB +qTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUWyV7 +lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64OfPAeGZe6Drn +8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov +L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe6 +45R88a7A3hfm5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczO +UYrHUDFu4Up+GC9pWbY9ZIEr44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5 +O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOfMke6UiI0HTJ6CVanfCU2qT1L2sCC +bwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6mGu6uLftIdxf+u+yv +GPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxpmo/a +77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCC +hdiDyyJkvC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid3 +92qgQmwLOM7XdVAyksLfKzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEpp +Ld6leNcG2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+w +ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt +Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ +-----END CERTIFICATE----- + +# Issuer: CN=SwissSign Silver CA - G2 O=SwissSign AG +# Subject: CN=SwissSign Silver CA - G2 O=SwissSign AG +# Label: "SwissSign Silver CA - G2" +# Serial: 5700383053117599563 +# MD5 Fingerprint: e0:06:a1:c9:7d:cf:c9:fc:0d:c0:56:75:96:d8:62:13 +# SHA1 Fingerprint: 9b:aa:e5:9f:56:ee:21:cb:43:5a:be:25:93:df:a7:f0:40:d1:1d:cb +# SHA256 Fingerprint: be:6c:4d:a2:bb:b9:ba:59:b6:f3:93:97:68:37:42:46:c3:c0:05:99:3f:a9:8f:02:0d:1d:ed:be:d4:8a:81:d5 +-----BEGIN CERTIFICATE----- +MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UE +BhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWdu +IFNpbHZlciBDQSAtIEcyMB4XDTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0Nlow +RzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMY +U3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A +MIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644N0Mv +Fz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7br +YT7QbNHm+/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieF +nbAVlDLaYQ1HTWBCrpJH6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH +6ATK72oxh9TAtvmUcXtnZLi2kUpCe2UuMGoM9ZDulebyzYLs2aFK7PayS+VFheZt +eJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5hqAaEuSh6XzjZG6k4sIN/ +c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5FZGkECwJ +MoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRH +HTBsROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTf +jNFusB3hB48IHpmccelM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb6 +5i/4z3GcRm25xBWNOHkDRUjvxF3XCO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOB +rDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU +F6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRBtjpbO8tFnb0c +wpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0 +cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIB +AHPGgeAn0i0P4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShp +WJHckRE1qTodvBqlYJ7YH39FkWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9 +xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L3XWgwF15kIwb4FDm3jH+mHtwX6WQ +2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx/uNncqCxv1yL5PqZ +IseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFaDGi8 +aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2X +em1ZqSqPe97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQR +dAtq/gsD/KNVV4n+SsuuWxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/ +OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJDIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+ +hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ubDgEj8Z+7fNzcbBGXJbLy +tGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u +-----END CERTIFICATE----- + +# Issuer: CN=SecureTrust CA O=SecureTrust Corporation +# Subject: CN=SecureTrust CA O=SecureTrust Corporation +# Label: "SecureTrust CA" +# Serial: 17199774589125277788362757014266862032 +# MD5 Fingerprint: dc:32:c3:a7:6d:25:57:c7:68:09:9d:ea:2d:a9:a2:d1 +# SHA1 Fingerprint: 87:82:c6:c3:04:35:3b:cf:d2:96:92:d2:59:3e:7d:44:d9:34:ff:11 +# SHA256 Fingerprint: f1:c1:b5:0a:e5:a2:0d:d8:03:0e:c9:f6:bc:24:82:3d:d3:67:b5:25:57:59:b4:e7:1b:61:fc:e9:f7:37:5d:73 +-----BEGIN CERTIFICATE----- +MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI +MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x +FzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz +MTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv +cnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz +Zum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO +0gMdA+9tDWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIao +wW8xQmxSPmjL8xk037uHGFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj +7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b01k/unK8RCSc43Oz969XL0Imnal0ugBS +8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmHursCAwEAAaOBnTCBmjAT +BgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB +/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCeg +JYYjaHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGC +NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3 +6Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/ +3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm +D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS +CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR +3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE= +-----END CERTIFICATE----- + +# Issuer: CN=Secure Global CA O=SecureTrust Corporation +# Subject: CN=Secure Global CA O=SecureTrust Corporation +# Label: "Secure Global CA" +# Serial: 9751836167731051554232119481456978597 +# MD5 Fingerprint: cf:f4:27:0d:d4:ed:dc:65:16:49:6d:3d:da:bf:6e:de +# SHA1 Fingerprint: 3a:44:73:5a:e5:81:90:1f:24:86:61:46:1e:3b:9c:c4:5f:f5:3a:1b +# SHA256 Fingerprint: 42:00:f5:04:3a:c8:59:0e:bb:52:7d:20:9e:d1:50:30:29:fb:cb:d4:1c:a1:b5:06:ec:27:f1:5a:de:7d:ac:69 +-----BEGIN CERTIFICATE----- +MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBK +MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x +GTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkx +MjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3Qg +Q29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jxYDiJ +iQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa +/FHtaMbQbqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJ +jnIFHovdRIWCQtBJwB1g8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnI +HmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYVHDGA76oYa8J719rO+TMg1fW9ajMtgQT7 +sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi0XPnj3pDAgMBAAGjgZ0w +gZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCsw +KaAnoCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsG +AQQBgjcVAQQDAgEAMA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0L +URYD7xh8yOOvaliTFGCRsoTciE6+OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXO +H0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cnCDpOGR86p1hcF895P4vkp9Mm +I50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/53CYNv6ZHdAbY +iNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc +f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW +-----END CERTIFICATE----- + +# Issuer: CN=COMODO Certification Authority O=COMODO CA Limited +# Subject: CN=COMODO Certification Authority O=COMODO CA Limited +# Label: "COMODO Certification Authority" +# Serial: 104350513648249232941998508985834464573 +# MD5 Fingerprint: 5c:48:dc:f7:42:72:ec:56:94:6d:1c:cc:71:35:80:75 +# SHA1 Fingerprint: 66:31:bf:9e:f7:4f:9e:b6:c9:d5:a6:0c:ba:6a:be:d1:f7:bd:ef:7b +# SHA256 Fingerprint: 0c:2c:d6:3d:f7:80:6f:a3:99:ed:e8:09:11:6b:57:5b:f8:79:89:f0:65:18:f9:80:8c:86:05:03:17:8b:af:66 +-----BEGIN CERTIFICATE----- +MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCB +gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G +A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV +BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw +MDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3Jl +YXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01P +RE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3 +UcEbVASY06m/weaKXTuH+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI +2GqGd0S7WWaXUF601CxwRM/aN5VCaTwwxHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8 +Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV4EajcNxo2f8ESIl33rXp ++2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA1KGzqSX+ +DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5O +nKVIrLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW +/zAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6g +PKA6hjhodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9u +QXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOCAQEAPpiem/Yb6dc5t3iuHXIY +SdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CPOGEIqB6BCsAv +IC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ +RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4 +zJVSk/BwJVmcIGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5dd +BA6+C4OmF4O5MBKgxTMVBbkN+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IB +ZQ== +-----END CERTIFICATE----- + +# Issuer: CN=Network Solutions Certificate Authority O=Network Solutions L.L.C. +# Subject: CN=Network Solutions Certificate Authority O=Network Solutions L.L.C. +# Label: "Network Solutions Certificate Authority" +# Serial: 116697915152937497490437556386812487904 +# MD5 Fingerprint: d3:f3:a6:16:c0:fa:6b:1d:59:b1:2d:96:4d:0e:11:2e +# SHA1 Fingerprint: 74:f8:a3:c3:ef:e7:b3:90:06:4b:83:90:3c:21:64:60:20:e5:df:ce +# SHA256 Fingerprint: 15:f0:ba:00:a3:ac:7a:f3:ac:88:4c:07:2b:10:11:a0:77:bd:77:c0:97:f4:01:64:b2:f8:59:8a:bd:83:86:0c +-----BEGIN CERTIFICATE----- +MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBi +MQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu +MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3Jp +dHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMxMjM1OTU5WjBiMQswCQYDVQQGEwJV +UzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydO +ZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwz +c7MEL7xxjOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPP +OCwGJgl6cvf6UDL4wpPTaaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rl +mGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXTcrA/vGp97Eh/jcOrqnErU2lBUzS1sLnF +BgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc/Qzpf14Dl847ABSHJ3A4 +qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMBAAGjgZcw +gZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIB +BjAPBgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwu +bmV0c29sc3NsLmNvbS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3Jp +dHkuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc8 +6fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q4LqILPxFzBiwmZVRDuwduIj/ +h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/GGUsyfJj4akH +/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv +wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHN +pGxlaKFJdlxDydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey +-----END CERTIFICATE----- + +# Issuer: CN=COMODO ECC Certification Authority O=COMODO CA Limited +# Subject: CN=COMODO ECC Certification Authority O=COMODO CA Limited +# Label: "COMODO ECC Certification Authority" +# Serial: 41578283867086692638256921589707938090 +# MD5 Fingerprint: 7c:62:ff:74:9d:31:53:5e:68:4a:d5:78:aa:1e:bf:23 +# SHA1 Fingerprint: 9f:74:4e:9f:2b:4d:ba:ec:0f:31:2c:50:b6:56:3b:8e:2d:93:c3:11 +# SHA256 Fingerprint: 17:93:92:7a:06:14:54:97:89:ad:ce:2f:8f:34:f7:f0:b6:6d:0f:3a:e3:a3:b8:4d:21:ec:15:db:ba:4f:ad:c7 +-----BEGIN CERTIFICATE----- +MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTEL +MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE +BxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMT +IkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwMzA2MDAw +MDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdy +ZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09N +T0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSR +FtSrYpn1PlILBs5BAH+X4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0J +cfRK9ChQtP6IHG4/bC8vCVlbpVsLM5niwz2J+Wos77LTBumjQjBAMB0GA1UdDgQW +BBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ +BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VGFAkK+qDm +fQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdv +GDeAU/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY= +-----END CERTIFICATE----- + +# Issuer: CN=Certigna O=Dhimyotis +# Subject: CN=Certigna O=Dhimyotis +# Label: "Certigna" +# Serial: 18364802974209362175 +# MD5 Fingerprint: ab:57:a6:5b:7d:42:82:19:b5:d8:58:26:28:5e:fd:ff +# SHA1 Fingerprint: b1:2e:13:63:45:86:a4:6f:1a:b2:60:68:37:58:2d:c4:ac:fd:94:97 +# SHA256 Fingerprint: e3:b6:a2:db:2e:d7:ce:48:84:2f:7a:c5:32:41:c7:b7:1d:54:14:4b:fb:40:c1:1f:3f:1d:0b:42:f5:ee:a1:2d +-----BEGIN CERTIFICATE----- +MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNV +BAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4X +DTA3MDYyOTE1MTMwNVoXDTI3MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQ +BgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwIQ2VydGlnbmEwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7qXOEm7RFHYeGifBZ4 +QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyHGxny +gQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbw +zBfsV1/pogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q +130yGLMLLGq/jj8UEYkgDncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2 +JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKfIrjxwo1p3Po6WAbfAgMBAAGjgbwwgbkw +DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQtCRZvgHyUtVF9lo53BEw +ZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJBgNVBAYT +AkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzj +AQ/JSP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG +9w0BAQUFAAOCAQEAhQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8h +bV6lUmPOEvjvKtpv6zf+EwLHyzs+ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFnc +fca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1kluPBS1xp81HlDQwY9qcEQCYsuu +HWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY1gkIl2PlwS6w +t0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw +WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== +-----END CERTIFICATE----- + +# Issuer: CN=Cybertrust Global Root O=Cybertrust, Inc +# Subject: CN=Cybertrust Global Root O=Cybertrust, Inc +# Label: "Cybertrust Global Root" +# Serial: 4835703278459682877484360 +# MD5 Fingerprint: 72:e4:4a:87:e3:69:40:80:77:ea:bc:e3:f4:ff:f0:e1 +# SHA1 Fingerprint: 5f:43:e5:b1:bf:f8:78:8c:ac:1c:c7:ca:4a:9a:c6:22:2b:cc:34:c6 +# SHA256 Fingerprint: 96:0a:df:00:63:e9:63:56:75:0c:29:65:dd:0a:08:67:da:0b:9c:bd:6e:77:71:4a:ea:fb:23:49:ab:39:3d:a3 +-----BEGIN CERTIFICATE----- +MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYG +A1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2Jh +bCBSb290MB4XDTA2MTIxNTA4MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UE +ChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBS +b290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+Mi8vRRQZhP/8NN5 +7CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW0ozS +J8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2y +HLtgwEZLAfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iP +t3sMpTjr3kfb1V05/Iin89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNz +FtApD0mpSPCzqrdsxacwOUBdrsTiXSZT8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAY +XSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/ +MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2MDSgMqAw +hi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3Js +MB8GA1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUA +A4IBAQBW7wojoFROlZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMj +Wqd8BfP9IjsO0QbE2zZMcwSO5bAi5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUx +XOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2hO0j9n0Hq0V+09+zv+mKts2o +omcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+TX3EJIrduPuoc +A06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW +WL1WMRJOEcgh4LMRkWXbtKaIOM5V +-----END CERTIFICATE----- + +# Issuer: O=Chunghwa Telecom Co., Ltd. OU=ePKI Root Certification Authority +# Subject: O=Chunghwa Telecom Co., Ltd. OU=ePKI Root Certification Authority +# Label: "ePKI Root Certification Authority" +# Serial: 28956088682735189655030529057352760477 +# MD5 Fingerprint: 1b:2e:00:ca:26:06:90:3d:ad:fe:6f:15:68:d3:6b:b3 +# SHA1 Fingerprint: 67:65:0d:f1:7e:8e:7e:5b:82:40:a4:f4:56:4b:cf:e2:3d:69:c6:f0 +# SHA256 Fingerprint: c0:a6:f4:dc:63:a2:4b:fd:cf:54:ef:2a:6a:08:2a:0a:72:de:35:80:3e:2f:f5:ff:52:7a:e5:d8:72:06:df:d5 +-----BEGIN CERTIFICATE----- +MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBe +MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 +ZC4xKjAoBgNVBAsMIWVQS0kgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe +Fw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMxMjdaMF4xCzAJBgNVBAYTAlRXMSMw +IQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEqMCgGA1UECwwhZVBL +SSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAH +SyZbCUNsIZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAh +ijHyl3SJCRImHJ7K2RKilTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3X +DZoTM1PRYfl61dd4s5oz9wCGzh1NlDivqOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1 +TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX12ruOzjjK9SXDrkb5wdJ +fzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0OWQqraffA +sgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uU +WH1+ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLS +nT0IFaUQAS2zMnaolQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pH +dmX2Os+PYhcZewoozRrSgx4hxyy/vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJip +NiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXiZo1jDiVN1Rmy5nk3pyKdVDEC +AwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/QkqiMAwGA1UdEwQF +MAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH +ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGB +uvl2ICO1J2B01GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6Yl +PwZpVnPDimZI+ymBV3QGypzqKOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkP +JXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdVxrsStZf0X4OFunHB2WyBEXYKCrC/ +gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEPNXubrjlpC2JgQCA2 +j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+rGNm6 +5ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUB +o2M3IUxExJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS +/jQ6fbjpKdx2qcgw+BRxgMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2z +Gp1iro2C6pSe3VkQw63d4k3jMdXH7OjysP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTE +W9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmODBCEIZ43ygknQW/2xzQ+D +hNQ+IIX3Sj0rnP0qCglN6oH4EZw= +-----END CERTIFICATE----- + +# Issuer: O=certSIGN OU=certSIGN ROOT CA +# Subject: O=certSIGN OU=certSIGN ROOT CA +# Label: "certSIGN ROOT CA" +# Serial: 35210227249154 +# MD5 Fingerprint: 18:98:c0:d6:e9:3a:fc:f9:b0:f5:0c:f7:4b:01:44:17 +# SHA1 Fingerprint: fa:b7:ee:36:97:26:62:fb:2d:b0:2a:f6:bf:03:fd:e8:7c:4b:2f:9b +# SHA256 Fingerprint: ea:a9:62:c4:fa:4a:6b:af:eb:e4:15:19:6d:35:1c:cd:88:8d:4f:53:f3:fa:8a:e6:d7:c4:66:a9:4e:60:42:bb +-----BEGIN CERTIFICATE----- +MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYT +AlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBD +QTAeFw0wNjA3MDQxNzIwMDRaFw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJP +MREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTCC +ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7IJUqOtdu0KBuqV5Do +0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHHrfAQ +UySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5d +RdY4zTW2ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQ +OA7+j0xbm0bqQfWwCHTD0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwv +JoIQ4uNllAoEwF73XVv4EOLQunpL+943AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08C +AwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAcYwHQYDVR0O +BBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IBAQA+0hyJ +LjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecY +MnQ8SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ +44gx+FkagQnIl6Z0x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6I +Jd1hJyMctTEHBDa0GpC9oHRxUIltvBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNw +i/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7NzTogVZ96edhBiIL5VaZVDADlN +9u6wWk5JRFRYX0KD +-----END CERTIFICATE----- + +# Issuer: CN=NetLock Arany (Class Gold) Főtanúsítvány O=NetLock Kft. OU=Tanúsítványkiadók (Certification Services) +# Subject: CN=NetLock Arany (Class Gold) Főtanúsítvány O=NetLock Kft. OU=Tanúsítványkiadók (Certification Services) +# Label: "NetLock Arany (Class Gold) Főtanúsítvány" +# Serial: 80544274841616 +# MD5 Fingerprint: c5:a1:b7:ff:73:dd:d6:d7:34:32:18:df:fc:3c:ad:88 +# SHA1 Fingerprint: 06:08:3f:59:3f:15:a1:04:a0:69:a4:6b:a9:03:d0:06:b7:97:09:91 +# SHA256 Fingerprint: 6c:61:da:c3:a2:de:f0:31:50:6b:e0:36:d2:a6:fe:40:19:94:fb:d1:3d:f9:c8:d4:66:59:92:74:c4:46:ec:98 +-----BEGIN CERTIFICATE----- +MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQG +EwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3 +MDUGA1UECwwuVGFuw7pzw610dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNl +cnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBBcmFueSAoQ2xhc3MgR29sZCkgRsWR +dGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgxMjA2MTUwODIxWjCB +pzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxOZXRM +b2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlm +aWNhdGlvbiBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNz +IEdvbGQpIEbFkXRhbsO6c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAxCRec75LbRTDofTjl5Bu0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrT +lF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw/HpYzY6b7cNGbIRwXdrz +AZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAkH3B5r9s5 +VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRG +ILdwfzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2 +BJtr+UBdADTHLpl1neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAG +AQH/AgEEMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2M +U9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwWqZw8UQCgwBEIBaeZ5m8BiFRh +bvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTtaYtOUZcTh5m2C ++C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC +bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2F +uLjbvrW5KfnaNwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2 +XjG4Kvte9nHfRCaexOYNkbQudZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= +-----END CERTIFICATE----- + +# Issuer: CN=Hongkong Post Root CA 1 O=Hongkong Post +# Subject: CN=Hongkong Post Root CA 1 O=Hongkong Post +# Label: "Hongkong Post Root CA 1" +# Serial: 1000 +# MD5 Fingerprint: a8:0d:6f:39:78:b9:43:6d:77:42:6d:98:5a:cc:23:ca +# SHA1 Fingerprint: d6:da:a8:20:8d:09:d2:15:4d:24:b5:2f:cb:34:6e:b2:58:b2:8a:58 +# SHA256 Fingerprint: f9:e6:7d:33:6c:51:00:2a:c0:54:c6:32:02:2d:66:dd:a2:e7:e3:ff:f1:0a:d0:61:ed:31:d8:bb:b4:10:cf:b2 +-----BEGIN CERTIFICATE----- +MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsx +FjAUBgNVBAoTDUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3Qg +Um9vdCBDQSAxMB4XDTAzMDUxNTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkG +A1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdr +b25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1ApzQ +jVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEn +PzlTCeqrauh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjh +ZY4bXSNmO7ilMlHIhqqhqZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9 +nnV0ttgCXjqQesBCNnLsak3c78QA3xMYV18meMjWCnl3v/evt3a5pQuEF10Q6m/h +q5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNVHRMBAf8ECDAGAQH/AgED +MA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7ih9legYsC +mEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI3 +7piol7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clB +oiMBdDhViw+5LmeiIAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJs +EhTkYY2sEJCehFC78JZvRZ+K88psT/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpO +fMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilTc4afU9hDDl3WY4JxHYB0yvbi +AmvZWg== +-----END CERTIFICATE----- + +# Issuer: CN=SecureSign RootCA11 O=Japan Certification Services, Inc. +# Subject: CN=SecureSign RootCA11 O=Japan Certification Services, Inc. +# Label: "SecureSign RootCA11" +# Serial: 1 +# MD5 Fingerprint: b7:52:74:e2:92:b4:80:93:f2:75:e4:cc:d7:f2:ea:26 +# SHA1 Fingerprint: 3b:c4:9f:48:f8:f3:73:a0:9c:1e:bd:f8:5b:b1:c3:65:c7:d8:11:b3 +# SHA256 Fingerprint: bf:0f:ee:fb:9e:3a:58:1a:d5:f9:e9:db:75:89:98:57:43:d2:61:08:5c:4d:31:4f:6f:5d:72:59:aa:42:16:12 +-----BEGIN CERTIFICATE----- +MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDEr +MCkGA1UEChMiSmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoG +A1UEAxMTU2VjdXJlU2lnbiBSb290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0 +MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSswKQYDVQQKEyJKYXBhbiBDZXJ0aWZp +Y2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1cmVTaWduIFJvb3RD +QTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvLTJsz +i1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8 +h9uuywGOwvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOV +MdrAG/LuYpmGYz+/3ZMqg6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9 +UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rPO7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni +8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitAbpSACW22s293bzUIUPsC +h8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZXt94wDgYD +VR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEB +AKChOBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xm +KbabfSVSSUOrTC4rbnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQ +X5Ucv+2rIrVls4W6ng+4reV6G4pQOh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWr +QbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01y8hSyn+B/tlr0/cR7SXf+Of5 +pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061lgeLKBObjBmN +QSdJQO7e5iNEOdyhIta6A/I= +-----END CERTIFICATE----- + +# Issuer: CN=Microsec e-Szigno Root CA 2009 O=Microsec Ltd. +# Subject: CN=Microsec e-Szigno Root CA 2009 O=Microsec Ltd. +# Label: "Microsec e-Szigno Root CA 2009" +# Serial: 14014712776195784473 +# MD5 Fingerprint: f8:49:f4:03:bc:44:2d:83:be:48:69:7d:29:64:fc:b1 +# SHA1 Fingerprint: 89:df:74:fe:5c:f4:0f:4a:80:f9:e3:37:7d:54:da:91:e1:01:31:8e +# SHA256 Fingerprint: 3c:5f:81:fe:a5:fa:b8:2c:64:bf:a2:ea:ec:af:cd:e8:e0:77:fc:86:20:a7:ca:e5:37:16:3d:f3:6e:db:f3:78 +-----BEGIN CERTIFICATE----- +MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD +VQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0 +ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0G +CSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTAeFw0wOTA2MTYxMTMwMThaFw0y +OTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3Qx +FjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3pp +Z25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o +dTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvP +kd6mJviZpWNwrZuuyjNAfW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tc +cbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG0IMZfcChEhyVbUr02MelTTMuhTlAdX4U +fIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKApxn1ntxVUwOXewdI/5n7 +N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm1HxdrtbC +xkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1 ++rUCAwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G +A1UdDgQWBBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPM +Pcu1SCOhGnqmKrs0aDAbBgNVHREEFDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqG +SIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0olZMEyL/azXm4Q5DwpL7v8u8h +mLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfXI/OMn74dseGk +ddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775 +tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c +2Pm2G2JwCz02yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5t +HMN1Rq41Bab2XD0h7lbwyYIiLXpUq3DDfSJlgnCW +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3 +# Label: "GlobalSign Root CA - R3" +# Serial: 4835703278459759426209954 +# MD5 Fingerprint: c5:df:b8:49:ca:05:13:55:ee:2d:ba:1a:c3:3e:b0:28 +# SHA1 Fingerprint: d6:9b:56:11:48:f0:1c:77:c5:45:78:c1:09:26:df:5b:85:69:76:ad +# SHA256 Fingerprint: cb:b5:22:d7:b7:f1:27:ad:6a:01:13:86:5b:df:1c:d4:10:2e:7d:07:59:af:63:5a:7c:f4:72:0d:c9:63:c5:3b +-----BEGIN CERTIFICATE----- +MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G +A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp +Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4 +MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG +A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8 +RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT +gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm +KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd +QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ +XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw +DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o +LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU +RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp +jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK +6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX +mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs +Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH +WD9f +-----END CERTIFICATE----- + +# Issuer: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 +# Subject: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 +# Label: "Autoridad de Certificacion Firmaprofesional CIF A62634068" +# Serial: 6047274297262753887 +# MD5 Fingerprint: 73:3a:74:7a:ec:bb:a3:96:a6:c2:e4:e2:c8:9b:c0:c3 +# SHA1 Fingerprint: ae:c5:fb:3f:c8:e1:bf:c4:e5:4f:03:07:5a:9a:e8:00:b7:f7:b6:fa +# SHA256 Fingerprint: 04:04:80:28:bf:1f:28:64:d4:8f:9a:d4:d8:32:94:36:6a:82:88:56:55:3f:3b:14:30:3f:90:14:7f:5d:40:ef +-----BEGIN CERTIFICATE----- +MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UE +BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h +cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEy +MzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg +Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9 +thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM +cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG +L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i +NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h +X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b +m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy +Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja +EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T +KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF +6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh +OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNHDhpkLzCBpgYD +VR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp +cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBv +ACAAZABlACAAbABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBl +AGwAbwBuAGEAIAAwADgAMAAxADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF +661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx51tkljYyGOylMnfX40S2wBEqgLk9 +am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qkR71kMrv2JYSiJ0L1 +ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaPT481 +PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS +3a/DTg4fJl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5k +SeTy36LssUzAKh3ntLFlosS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF +3dvd6qJ2gHN99ZwExEWN57kci57q13XRcrHedUTnQn3iV2t93Jm8PYMo6oCTjcVM +ZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoRsaS8I8nkvof/uZS2+F0g +StRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTDKCOM/icz +Q0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQB +jLMi6Et8Vcad+qMUu2WFbm5PEn4KPJ2V +-----END CERTIFICATE----- + +# Issuer: CN=Izenpe.com O=IZENPE S.A. +# Subject: CN=Izenpe.com O=IZENPE S.A. +# Label: "Izenpe.com" +# Serial: 917563065490389241595536686991402621 +# MD5 Fingerprint: a6:b0:cd:85:80:da:5c:50:34:a3:39:90:2f:55:67:73 +# SHA1 Fingerprint: 2f:78:3d:25:52:18:a7:4a:65:39:71:b5:2c:a2:9c:45:15:6f:e9:19 +# SHA256 Fingerprint: 25:30:cc:8e:98:32:15:02:ba:d9:6f:9b:1f:ba:1b:09:9e:2d:29:9e:0f:45:48:bb:91:4f:36:3b:c0:d4:53:1f +-----BEGIN CERTIFICATE----- +MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4 +MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6 +ZW5wZS5jb20wHhcNMDcxMjEzMTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYD +VQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5j +b20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ03rKDx6sp4boFmVq +scIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAKClaO +xdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6H +LmYRY2xU+zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFX +uaOKmMPsOzTFlUFpfnXCPCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQD +yCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxTOTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+ +JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbKF7jJeodWLBoBHmy+E60Q +rLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK0GqfvEyN +BjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8L +hij+0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIB +QFqNeb+Lz0vPqhbBleStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+ +HMh3/1uaD7euBUbl8agW7EekFwIDAQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2lu +Zm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+SVpFTlBFIFMuQS4gLSBDSUYg +QTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBGNjIgUzgxQzBB +BgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx +MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AQYwHQYDVR0OBBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUA +A4ICAQB4pgwWSp9MiDrAyw6lFn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWb +laQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbgakEyrkgPH7UIBzg/YsfqikuFgba56 +awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8qhT/AQKM6WfxZSzwo +JNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Csg1lw +LDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCT +VyvehQP5aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGk +LhObNA5me0mrZJfQRsN5nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJb +UjWumDqtujWTI6cfSN01RpiyEGjkpTHCClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/ +QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZoQ0iy2+tzJOeRf1SktoA+ +naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1ZWrOZyGls +QyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw== +-----END CERTIFICATE----- + +# Issuer: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc. +# Subject: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc. +# Label: "Go Daddy Root Certificate Authority - G2" +# Serial: 0 +# MD5 Fingerprint: 80:3a:bc:22:c1:e6:fb:8d:9b:3b:27:4a:32:1b:9a:01 +# SHA1 Fingerprint: 47:be:ab:c9:22:ea:e8:0e:78:78:34:62:a7:9f:45:c2:54:fd:e6:8b +# SHA256 Fingerprint: 45:14:0b:32:47:eb:9c:c8:c5:b4:f0:d7:b5:30:91:f7:32:92:08:9e:6e:5a:63:e2:74:9d:d3:ac:a9:19:8e:da +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx +EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT +EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp +ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz +NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH +EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE +AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw +DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD +E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH +/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy +DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh +GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR +tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA +AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE +FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX +WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu +9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr +gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo +2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO +LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI +4uJEvlz36hz1 +-----END CERTIFICATE----- + +# Issuer: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc. +# Subject: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc. +# Label: "Starfield Root Certificate Authority - G2" +# Serial: 0 +# MD5 Fingerprint: d6:39:81:c6:52:7e:96:69:fc:fc:ca:66:ed:05:f2:96 +# SHA1 Fingerprint: b5:1c:06:7c:ee:2b:0c:3d:f8:55:ab:2d:92:f4:fe:39:d4:e7:0f:0e +# SHA256 Fingerprint: 2c:e1:cb:0b:f9:d2:f9:e1:02:99:3f:be:21:51:52:c3:b2:dd:0c:ab:de:1c:68:e5:31:9b:83:91:54:db:b7:f5 +-----BEGIN CERTIFICATE----- +MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx +EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT +HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs +ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAw +MFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6 +b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj +aG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZp +Y2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAL3twQP89o/8ArFvW59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMg +nLRJdzIpVv257IzdIvpy3Cdhl+72WoTsbhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1 +HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNkN3mSwOxGXn/hbVNMYq/N +Hwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7NfZTD4p7dN +dloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0 +HZbUJtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO +BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0G +CSqGSIb3DQEBCwUAA4IBAQARWfolTwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjU +sHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx4mcujJUDJi5DnUox9g61DLu3 +4jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUwF5okxBDgBPfg +8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K +pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1 +mMpYjn0q7pBZc2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0 +-----END CERTIFICATE----- + +# Issuer: CN=Starfield Services Root Certificate Authority - G2 O=Starfield Technologies, Inc. +# Subject: CN=Starfield Services Root Certificate Authority - G2 O=Starfield Technologies, Inc. +# Label: "Starfield Services Root Certificate Authority - G2" +# Serial: 0 +# MD5 Fingerprint: 17:35:74:af:7b:61:1c:eb:f4:f9:3c:e2:ee:40:f9:a2 +# SHA1 Fingerprint: 92:5a:8f:8d:2c:6d:04:e0:66:5f:59:6a:ff:22:d8:63:e8:25:6f:3f +# SHA256 Fingerprint: 56:8d:69:05:a2:c8:87:08:a4:b3:02:51:90:ed:cf:ed:b1:97:4a:60:6a:13:c6:e5:29:0f:cb:2a:e6:3e:da:b5 +-----BEGIN CERTIFICATE----- +MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMx +EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT +HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVs +ZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5 +MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNVBAYTAlVTMRAwDgYD +VQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFy +ZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2Vy +dmljZXMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20p +OsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm2 +8xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4PahHQUw2eeBGg6345AWh1K +Ts9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLPLJGmpufe +hRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk +6mFBrMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAw +DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+q +AdcwKziIorhtSpzyEZGDMA0GCSqGSIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMI +bw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPPE95Dz+I0swSdHynVv/heyNXB +ve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTyxQGjhdByPq1z +qwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd +iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn +0q23KXB56jzaYyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCN +sSi6 +-----END CERTIFICATE----- + +# Issuer: CN=AffirmTrust Commercial O=AffirmTrust +# Subject: CN=AffirmTrust Commercial O=AffirmTrust +# Label: "AffirmTrust Commercial" +# Serial: 8608355977964138876 +# MD5 Fingerprint: 82:92:ba:5b:ef:cd:8a:6f:a6:3d:55:f9:84:f6:d6:b7 +# SHA1 Fingerprint: f9:b5:b6:32:45:5f:9c:be:ec:57:5f:80:dc:e9:6e:2c:c7:b2:78:b7 +# SHA256 Fingerprint: 03:76:ab:1d:54:c5:f9:80:3c:e4:b2:e2:01:a0:ee:7e:ef:7b:57:b6:36:e8:a9:3c:9b:8d:48:60:c9:6f:5f:a7 +-----BEGIN CERTIFICATE----- +MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UE +BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz +dCBDb21tZXJjaWFsMB4XDTEwMDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDEL +MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp +cm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6EqdbDuKP +Hx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yr +ba0F8PrVC8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPAL +MeIrJmqbTFeurCA+ukV6BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1 +yHp52UKqK39c/s4mT6NmgTWvRLpUHhwwMmWd5jyTXlBOeuM61G7MGvv50jeuJCqr +VwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNVHQ4EFgQUnZPGU4teyq8/ +nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ +KoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYG +XUPGhi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNj +vbz4YYCanrHOQnDiqX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivt +Z8SOyUOyXGsViQK8YvxO8rUzqrJv0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9g +N53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0khsUlHRUe072o0EclNmsxZt9YC +nlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8= +-----END CERTIFICATE----- + +# Issuer: CN=AffirmTrust Networking O=AffirmTrust +# Subject: CN=AffirmTrust Networking O=AffirmTrust +# Label: "AffirmTrust Networking" +# Serial: 8957382827206547757 +# MD5 Fingerprint: 42:65:ca:be:01:9a:9a:4c:a9:8c:41:49:cd:c0:d5:7f +# SHA1 Fingerprint: 29:36:21:02:8b:20:ed:02:f5:66:c5:32:d1:d6:ed:90:9f:45:00:2f +# SHA256 Fingerprint: 0a:81:ec:5a:92:97:77:f1:45:90:4a:f3:8d:5d:50:9f:66:b5:e2:c5:8f:cd:b5:31:05:8b:0e:17:f3:f0:b4:1b +-----BEGIN CERTIFICATE----- +MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UE +BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz +dCBOZXR3b3JraW5nMB4XDTEwMDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDEL +MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp +cm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SEHi3y +YJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbua +kCNrmreIdIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRL +QESxG9fhwoXA3hA/Pe24/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp +6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gbh+0t+nvujArjqWaJGctB+d1ENmHP4ndG +yH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNVHQ4EFgQUBx/S55zawm6i +QLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ +KoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfO +tDIuUFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzu +QY0x2+c06lkh1QF612S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZ +Lgo/bNjR9eUJtGxUAArgFU2HdW23WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4u +olu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9/ZFvgrG+CJPbFEfxojfHRZ48 +x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s= +-----END CERTIFICATE----- + +# Issuer: CN=AffirmTrust Premium O=AffirmTrust +# Subject: CN=AffirmTrust Premium O=AffirmTrust +# Label: "AffirmTrust Premium" +# Serial: 7893706540734352110 +# MD5 Fingerprint: c4:5d:0e:48:b6:ac:28:30:4e:0a:bc:f9:38:16:87:57 +# SHA1 Fingerprint: d8:a6:33:2c:e0:03:6f:b1:85:f6:63:4f:7d:6a:06:65:26:32:28:27 +# SHA256 Fingerprint: 70:a7:3f:7f:37:6b:60:07:42:48:90:45:34:b1:14:82:d5:bf:0e:69:8e:cc:49:8d:f5:25:77:eb:f2:e9:3b:9a +-----BEGIN CERTIFICATE----- +MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UE +BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVz +dCBQcmVtaXVtMB4XDTEwMDEyOTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkG +A1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1U +cnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxBLf +qV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtnBKAQ +JG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ ++jjeRFcV5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrS +s8PhaJyJ+HoAVt70VZVs+7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5 +HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmdGPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d7 +70O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5Rp9EixAqnOEhss/n/fauG +V+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NIS+LI+H+S +qHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S +5u046uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4Ia +C1nEWTJ3s7xgaVY5/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TX +OwF0lkLgAOIua+rF7nKsu7/+6qqo+Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYE +FJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ +BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByvMiPIs0laUZx2 +KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg +Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B +8OWycvpEgjNC6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQ +MKSOyARiqcTtNd56l+0OOF6SL5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc +0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK+4w1IX2COPKpVJEZNZOUbWo6xbLQ +u4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmVBtWVyuEklut89pMF +u+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFgIxpH +YoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8 +GKa1qF60g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaO +RtGdFNrHF+QFlozEJLUbzxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6e +KeC2uAloGRwYQw== +-----END CERTIFICATE----- + +# Issuer: CN=AffirmTrust Premium ECC O=AffirmTrust +# Subject: CN=AffirmTrust Premium ECC O=AffirmTrust +# Label: "AffirmTrust Premium ECC" +# Serial: 8401224907861490260 +# MD5 Fingerprint: 64:b0:09:55:cf:b1:d5:99:e2:be:13:ab:a6:5d:ea:4d +# SHA1 Fingerprint: b8:23:6b:00:2f:1d:16:86:53:01:55:6c:11:a4:37:ca:eb:ff:c3:bb +# SHA256 Fingerprint: bd:71:fd:f6:da:97:e4:cf:62:d1:64:7a:dd:25:81:b0:7d:79:ad:f8:39:7e:b4:ec:ba:9c:5e:84:88:82:14:23 +-----BEGIN CERTIFICATE----- +MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMC +VVMxFDASBgNVBAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQ +cmVtaXVtIEVDQzAeFw0xMDAxMjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJ +BgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1UcnVzdDEgMB4GA1UEAwwXQWZmaXJt +VHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQNMF4bFZ0D +0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQN8O9 +ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G +A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G +A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs +aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I +flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ== +-----END CERTIFICATE----- + +# Issuer: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority +# Subject: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority +# Label: "Certum Trusted Network CA" +# Serial: 279744 +# MD5 Fingerprint: d5:e9:81:40:c5:18:69:fc:46:2c:89:75:62:0f:aa:78 +# SHA1 Fingerprint: 07:e0:32:e0:20:b7:2c:3f:19:2f:06:28:a2:59:3a:19:a7:0f:06:9e +# SHA256 Fingerprint: 5c:58:46:8d:55:f5:8e:49:7e:74:39:82:d2:b5:00:10:b6:d1:65:37:4a:cf:83:a7:d4:a3:2d:b7:68:c4:40:8e +-----BEGIN CERTIFICATE----- +MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBM +MSIwIAYDVQQKExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5D +ZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBU +cnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIyMTIwNzM3WhcNMjkxMjMxMTIwNzM3 +WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMg +Uy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSIw +IAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rH +UV+rpDKmYYe2bg+G0jACl/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LM +TXPb865Px1bVWqeWifrzq2jUI4ZZJ88JJ7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVU +BBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4fOQtf/WsX+sWn7Et0brM +kUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0cvW0QM8x +AcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNV +HQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15y +sHhE49wcrwn9I0j6vSrEuVUEtRCjjSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfL +I9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1mS1FhIrlQgnXdAIv94nYmem8 +J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5ajZt3hrvJBW8qY +VoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI +03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= +-----END CERTIFICATE----- + +# Issuer: CN=TWCA Root Certification Authority O=TAIWAN-CA OU=Root CA +# Subject: CN=TWCA Root Certification Authority O=TAIWAN-CA OU=Root CA +# Label: "TWCA Root Certification Authority" +# Serial: 1 +# MD5 Fingerprint: aa:08:8f:f6:f9:7b:b7:f2:b1:a7:1e:9b:ea:ea:bd:79 +# SHA1 Fingerprint: cf:9e:87:6d:d3:eb:fc:42:26:97:a3:b5:a3:7a:a0:76:a9:06:23:48 +# SHA256 Fingerprint: bf:d8:8f:e1:10:1c:41:ae:3e:80:1b:f8:be:56:35:0e:e9:ba:d1:a6:b9:bd:51:5e:dc:5c:6d:5b:87:11:ac:44 +-----BEGIN CERTIFICATE----- +MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzES +MBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFU +V0NBIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMz +WhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJVEFJV0FO +LUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlm +aWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB +AQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFE +AcK0HMMxQhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HH +K3XLfJ+utdGdIzdjp9xCoi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeX +RfwZVzsrb+RH9JlF/h3x+JejiB03HFyP4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/z +rX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1ry+UPizgN7gr8/g+YnzAx +3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkq +hkiG9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeC +MErJk/9q56YAf4lCmtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdls +XebQ79NqZp4VKIV66IIArB6nCWlWQtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62D +lhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVYT0bf+215WfKEIlKuD8z7fDvn +aspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocnyYh0igzyXxfkZ +YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw== +-----END CERTIFICATE----- + +# Issuer: O=SECOM Trust Systems CO.,LTD. OU=Security Communication RootCA2 +# Subject: O=SECOM Trust Systems CO.,LTD. OU=Security Communication RootCA2 +# Label: "Security Communication RootCA2" +# Serial: 0 +# MD5 Fingerprint: 6c:39:7d:a4:0e:55:59:b2:3f:d6:41:b1:12:50:de:43 +# SHA1 Fingerprint: 5f:3b:8c:f2:f8:10:b3:7d:78:b4:ce:ec:19:19:c3:73:34:b9:c7:74 +# SHA256 Fingerprint: 51:3b:2c:ec:b8:10:d4:cd:e5:dd:85:39:1a:df:c6:c2:dd:60:d8:7b:b7:36:d2:b5:21:48:4a:a4:7a:0e:be:f6 +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDEl +MCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMe +U2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoX +DTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRy +dXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3VyaXR5IENvbW11bmlj +YXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANAV +OVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGr +zbl+dp+++T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVM +VAX3NuRFg3sUZdbcDE3R3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQ +hNBqyjoGADdH5H5XTz+L62e4iKrFvlNVspHEfbmwhRkGeC7bYRr6hfVKkaHnFtWO +ojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1KEOtOghY6rCcMU/Gt1SSw +awNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8QIH4D5cs +OPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 +DQEBCwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpF +coJxDjrSzG+ntKEju/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXc +okgfGT+Ok+vx+hfuzU7jBBJV1uXk3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8 +t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6qtnRGEmyR7jTV7JqR50S+kDFy +1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29mvVXIwAHIRc/ +SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 +-----END CERTIFICATE----- + +# Issuer: CN=EC-ACC O=Agencia Catalana de Certificacio (NIF Q-0801176-I) OU=Serveis Publics de Certificacio/Vegeu https://www.catcert.net/verarrel (c)03/Jerarquia Entitats de Certificacio Catalanes +# Subject: CN=EC-ACC O=Agencia Catalana de Certificacio (NIF Q-0801176-I) OU=Serveis Publics de Certificacio/Vegeu https://www.catcert.net/verarrel (c)03/Jerarquia Entitats de Certificacio Catalanes +# Label: "EC-ACC" +# Serial: -23701579247955709139626555126524820479 +# MD5 Fingerprint: eb:f5:9d:29:0d:61:f9:42:1f:7c:c2:ba:6d:e3:15:09 +# SHA1 Fingerprint: 28:90:3a:63:5b:52:80:fa:e6:77:4c:0b:6d:a7:d6:ba:a6:4a:f2:e8 +# SHA256 Fingerprint: 88:49:7f:01:60:2f:31:54:24:6a:e2:8c:4d:5a:ef:10:f1:d8:7e:bb:76:62:6f:4a:e0:b7:f9:5b:a7:96:87:99 +-----BEGIN CERTIFICATE----- +MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB +8zELMAkGA1UEBhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2Vy +dGlmaWNhY2lvIChOSUYgUS0wODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1 +YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYDVQQLEyxWZWdldSBodHRwczovL3d3 +dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UECxMsSmVyYXJxdWlh +IEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMTBkVD +LUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQG +EwJFUzE7MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8g +KE5JRiBRLTA4MDExNzYtSSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBD +ZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZlZ2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQu +bmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJhcnF1aWEgRW50aXRhdHMg +ZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUNDMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R +85iKw5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm +4CgPukLjbo73FCeTae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaV +HMf5NLWUhdWZXqBIoH7nF2W4onW4HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNd +QlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0aE9jD2z3Il3rucO2n5nzbcc8t +lGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw0JDnJwIDAQAB +o4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E +BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4 +opvpXY0wfwYDVR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBo +dHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidW +ZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAwDQYJKoZIhvcN +AQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJlF7W2u++AVtd0x7Y +/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNaAl6k +SBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhy +Rp/7SNVel+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOS +Agu+TGbrIP65y7WZf+a2E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xl +nJ2lYJU6Un/10asIbvPuW/mIPX64b24D5EI= +-----END CERTIFICATE----- + +# Issuer: CN=Hellenic Academic and Research Institutions RootCA 2011 O=Hellenic Academic and Research Institutions Cert. Authority +# Subject: CN=Hellenic Academic and Research Institutions RootCA 2011 O=Hellenic Academic and Research Institutions Cert. Authority +# Label: "Hellenic Academic and Research Institutions RootCA 2011" +# Serial: 0 +# MD5 Fingerprint: 73:9f:4c:4b:73:5b:79:e9:fa:ba:1c:ef:6e:cb:d5:c9 +# SHA1 Fingerprint: fe:45:65:9b:79:03:5b:98:a1:61:b5:51:2e:ac:da:58:09:48:22:4d +# SHA256 Fingerprint: bc:10:4f:15:a4:8b:e7:09:dc:a5:42:a7:e1:d4:b9:df:6f:05:45:27:e8:02:ea:a9:2d:59:54:44:25:8a:fe:71 +-----BEGIN CERTIFICATE----- +MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1Ix +RDBCBgNVBAoTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1 +dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1p +YyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIFJvb3RDQSAyMDExMB4XDTExMTIw +NjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYTAkdSMUQwQgYDVQQK +EztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIENl +cnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl +c2VhcmNoIEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEB +BQADggEPADCCAQoCggEBAKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPz +dYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJ +fel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa71HFK9+WXesyHgLacEns +bgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u8yBRQlqD +75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSP +FEDH3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNV +HRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp +5dgTBCPuQSUwRwYDVR0eBEAwPqA8MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQu +b3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQub3JnMA0GCSqGSIb3DQEBBQUA +A4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVtXdMiKahsog2p +6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8 +TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7 +dIsXRSZMFpGD/md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8Acys +Nnq/onN694/BtZqhFLKPM58N7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXI +l7WdmplNsDz4SgCbZN2fOUvRJ9e4 +-----END CERTIFICATE----- + +# Issuer: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967 +# Subject: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967 +# Label: "Actalis Authentication Root CA" +# Serial: 6271844772424770508 +# MD5 Fingerprint: 69:c1:0d:4f:07:a3:1b:c3:fe:56:3d:04:bc:11:f6:a6 +# SHA1 Fingerprint: f3:73:b3:87:06:5a:28:84:8a:f2:f3:4a:ce:19:2b:dd:c7:8e:9c:ac +# SHA256 Fingerprint: 55:92:60:84:ec:96:3a:64:b9:6e:2a:be:01:ce:0b:a8:6a:64:fb:fe:bc:c7:aa:b5:af:c1:55:b3:7f:d7:60:66 +-----BEGIN CERTIFICATE----- +MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UE +BhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8w +MzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290 +IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDkyMjExMjIwMlowazELMAkGA1UEBhMC +SVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1 +ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENB +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNv +UTufClrJwkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX +4ay8IMKx4INRimlNAJZaby/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9 +KK3giq0itFZljoZUj5NDKd45RnijMCO6zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/ +gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1fYVEiVRvjRuPjPdA1Yprb +rxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2oxgkg4YQ +51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2F +be8lEfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxe +KF+w6D9Fz8+vm2/7hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4F +v6MGn8i1zeQf1xcGDXqVdFUNaBr8EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbn +fpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5jF66CyCU3nuDuP/jVo23Eek7 +jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLYiDrIn3hm7Ynz +ezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt +ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQAL +e3KHwGCmSUyIWOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70 +jsNjLiNmsGe+b7bAEzlgqqI0JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDz +WochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKxK3JCaKygvU5a2hi/a5iB0P2avl4V +SM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+Xlff1ANATIGk0k9j +pwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC4yyX +X04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+Ok +fcvHlXHo2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7R +K4X9p2jIugErsWx0Hbhzlefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btU +ZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXemOR/qnuOf0GZvBeyqdn6/axag67XH/JJU +LysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9vwGYT7JZVEc+NHt4bVaT +LnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg== +-----END CERTIFICATE----- + +# Issuer: CN=Buypass Class 2 Root CA O=Buypass AS-983163327 +# Subject: CN=Buypass Class 2 Root CA O=Buypass AS-983163327 +# Label: "Buypass Class 2 Root CA" +# Serial: 2 +# MD5 Fingerprint: 46:a7:d2:fe:45:fb:64:5a:a8:59:90:9b:78:44:9b:29 +# SHA1 Fingerprint: 49:0a:75:74:de:87:0a:47:fe:58:ee:f6:c7:6b:eb:c6:0b:12:40:99 +# SHA256 Fingerprint: 9a:11:40:25:19:7c:5b:b9:5d:94:e6:3d:55:cd:43:79:08:47:b6:46:b2:3c:df:11:ad:a4:a0:0e:ff:15:fb:48 +-----BEGIN CERTIFICATE----- +MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd +MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg +Q2xhc3MgMiBSb290IENBMB4XDTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1ow +TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw +HgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB +BQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1g1Lr +6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPV +L4O2fuPn9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC91 +1K2GScuVr1QGbNgGE41b/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHx +MlAQTn/0hpPshNOOvEu/XAFOBz3cFIqUCqTqc/sLUegTBxj6DvEr0VQVfTzh97QZ +QmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeffawrbD02TTqigzXsu8lkB +arcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgIzRFo1clr +Us3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLi +FRhnBkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRS +P/TizPJhk9H9Z2vXUq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN +9SG9dKpN6nIDSdvHXx1iY8f93ZHsM+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxP +AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMmAd+BikoL1Rpzz +uvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAU18h +9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s +A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3t +OluwlN5E40EIosHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo ++fsicdl9sz1Gv7SEr5AcD48Saq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7 +KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYdDnkM/crqJIByw5c/8nerQyIKx+u2 +DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWDLfJ6v9r9jv6ly0Us +H8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0oyLQ +I+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK7 +5t98biGCwWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h +3PFaTWwyI0PurKju7koSCTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPz +Y11aWOIv4x3kqdbQCtCev9eBCfHJxyYNrJgWVqA= +-----END CERTIFICATE----- + +# Issuer: CN=Buypass Class 3 Root CA O=Buypass AS-983163327 +# Subject: CN=Buypass Class 3 Root CA O=Buypass AS-983163327 +# Label: "Buypass Class 3 Root CA" +# Serial: 2 +# MD5 Fingerprint: 3d:3b:18:9e:2c:64:5a:e8:d5:88:ce:0e:f9:37:c2:ec +# SHA1 Fingerprint: da:fa:f7:fa:66:84:ec:06:8f:14:50:bd:c7:c2:81:a5:bc:a9:64:57 +# SHA256 Fingerprint: ed:f7:eb:bc:a2:7a:2a:38:4d:38:7b:7d:40:10:c6:66:e2:ed:b4:84:3e:4c:29:b4:ae:1d:5b:93:32:e6:b2:4d +-----BEGIN CERTIFICATE----- +MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd +MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg +Q2xhc3MgMyBSb290IENBMB4XDTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFow +TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw +HgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB +BQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRHsJ8Y +ZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3E +N3coTRiR5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9 +tznDDgFHmV0ST9tD+leh7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX +0DJq1l1sDPGzbjniazEuOQAnFN44wOwZZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c +/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH2xc519woe2v1n/MuwU8X +KhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV/afmiSTY +zIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvS +O1UQRwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D +34xFMFbG02SrZvPAXpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgP +K9Dx2hzLabjKSWJtyNBjYt1gD1iqj6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3 +AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFEe4zf/lb+74suwv +Tg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAACAj +QTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV +cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXS +IGrs/CIBKM+GuIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2 +HJLw5QY33KbmkJs4j1xrG0aGQ0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsa +O5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8ZORK15FTAaggiG6cX0S5y2CBNOxv +033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2KSb12tjE8nVhz36u +dmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz6MkE +kbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg41 +3OEMXbugUZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvD +u79leNKGef9JOxqDDPDeeOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq +4/g7u9xN12TyUb7mqqta6THuBrxzvxNiCp/HuZc= +-----END CERTIFICATE----- + +# Issuer: CN=T-TeleSec GlobalRoot Class 3 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center +# Subject: CN=T-TeleSec GlobalRoot Class 3 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center +# Label: "T-TeleSec GlobalRoot Class 3" +# Serial: 1 +# MD5 Fingerprint: ca:fb:40:a8:4e:39:92:8a:1d:fe:8e:2f:c4:27:ea:ef +# SHA1 Fingerprint: 55:a6:72:3e:cb:f2:ec:cd:c3:23:74:70:19:9d:2a:be:11:e3:81:d1 +# SHA256 Fingerprint: fd:73:da:d3:1c:64:4f:f1:b4:3b:ef:0c:cd:da:96:71:0b:9c:d9:87:5e:ca:7e:31:70:7a:f3:e9:6d:52:2b:bd +-----BEGIN CERTIFICATE----- +MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx +KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd +BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl +YyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgxMDAxMTAyOTU2WhcNMzMxMDAxMjM1 +OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy +aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 +ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN +8ELg63iIVl6bmlQdTQyK9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/ +RLyTPWGrTs0NvvAgJ1gORH8EGoel15YUNpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4 +hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZFiP0Zf3WHHx+xGwpzJFu5 +ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W0eDrXltM +EnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGj +QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1 +A/d2O2GCahKqGFPrAyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOy +WL6ukK2YJ5f+AbGwUgC4TeQbIXQbfsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ +1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzTucpH9sry9uetuUg/vBa3wW30 +6gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7hP0HHRwA11fXT +91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml +e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4p +TpPDpFQUWw== +-----END CERTIFICATE----- + +# Issuer: CN=D-TRUST Root Class 3 CA 2 2009 O=D-Trust GmbH +# Subject: CN=D-TRUST Root Class 3 CA 2 2009 O=D-Trust GmbH +# Label: "D-TRUST Root Class 3 CA 2 2009" +# Serial: 623603 +# MD5 Fingerprint: cd:e0:25:69:8d:47:ac:9c:89:35:90:f7:fd:51:3d:2f +# SHA1 Fingerprint: 58:e8:ab:b0:36:15:33:fb:80:f7:9b:1b:6d:29:d3:ff:8d:5f:00:f0 +# SHA256 Fingerprint: 49:e7:a4:42:ac:f0:ea:62:87:05:00:54:b5:25:64:b6:50:e4:f4:9e:42:e3:48:d6:aa:38:e0:39:e9:57:b1:c1 +-----BEGIN CERTIFICATE----- +MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRF +MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBD +bGFzcyAzIENBIDIgMjAwOTAeFw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NTha +ME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMM +HkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIwDQYJKoZIhvcNAQEB +BQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOADER03 +UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42 +tSHKXzlABF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9R +ySPocq60vFYJfxLLHLGvKZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsM +lFqVlNpQmvH/pStmMaTJOKDfHR+4CS7zp+hnUquVH+BGPtikw8paxTGA6Eian5Rp +/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUCAwEAAaOCARowggEWMA8G +A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ4PGEMA4G +A1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVj +dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUy +MENBJTIwMiUyMDIwMDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRl +cmV2b2NhdGlvbmxpc3QwQ6BBoD+GPWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3Js +L2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAwOS5jcmwwDQYJKoZIhvcNAQEL +BQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm2H6NMLVwMeni +acfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0 +o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4K +zCUqNQT4YJEVdT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8 +PIWmawomDeCTmGCufsYkl4phX5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3Y +Johw1+qRzT65ysCQblrGXnRl11z+o+I= +-----END CERTIFICATE----- + +# Issuer: CN=D-TRUST Root Class 3 CA 2 EV 2009 O=D-Trust GmbH +# Subject: CN=D-TRUST Root Class 3 CA 2 EV 2009 O=D-Trust GmbH +# Label: "D-TRUST Root Class 3 CA 2 EV 2009" +# Serial: 623604 +# MD5 Fingerprint: aa:c6:43:2c:5e:2d:cd:c4:34:c0:50:4f:11:02:4f:b6 +# SHA1 Fingerprint: 96:c9:1b:0b:95:b4:10:98:42:fa:d0:d8:22:79:fe:60:fa:b9:16:83 +# SHA256 Fingerprint: ee:c5:49:6b:98:8c:e9:86:25:b9:34:09:2e:ec:29:08:be:d0:b0:f3:16:c2:d4:73:0c:84:ea:f1:f3:d3:48:81 +-----BEGIN CERTIFICATE----- +MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRF +MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBD +bGFzcyAzIENBIDIgRVYgMjAwOTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUw +NDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNV +BAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAwOTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfSegpn +ljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM0 +3TP1YtHhzRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6Z +qQTMFexgaDbtCHu39b+T7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lR +p75mpoo6Kr3HGrHhFPC+Oh25z1uxav60sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8 +HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure3511H3a6UCAwEAAaOCASQw +ggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyvcop9Ntea +HNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFw +Oi8vZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xh +c3MlMjAzJTIwQ0ElMjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1E +RT9jZXJ0aWZpY2F0ZXJldm9jYXRpb25saXN0MEagRKBChkBodHRwOi8vd3d3LmQt +dHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xhc3NfM19jYV8yX2V2XzIwMDku +Y3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+PPoeUSbrh/Yp +3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05 +nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNF +CSuGdXzfX2lXANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7na +xpeG0ILD5EJt/rDiZE4OJudANCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqX +KVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVvw9y4AyHqnxbxLFS1 +-----END CERTIFICATE----- + +# Issuer: CN=CA Disig Root R2 O=Disig a.s. +# Subject: CN=CA Disig Root R2 O=Disig a.s. +# Label: "CA Disig Root R2" +# Serial: 10572350602393338211 +# MD5 Fingerprint: 26:01:fb:d8:27:a7:17:9a:45:54:38:1a:43:01:3b:03 +# SHA1 Fingerprint: b5:61:eb:ea:a4:de:e4:25:4b:69:1a:98:a5:57:47:c2:34:c7:d9:71 +# SHA256 Fingerprint: e2:3d:4a:03:6d:7b:70:e9:f5:95:b1:42:20:79:d2:b9:1e:df:bb:1f:b6:51:a0:63:3e:aa:8a:9d:c5:f8:07:03 +-----BEGIN CERTIFICATE----- +MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV +BAYTAlNLMRMwEQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMu +MRkwFwYDVQQDExBDQSBEaXNpZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQy +MDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sxEzARBgNVBAcTCkJyYXRpc2xhdmEx +EzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERpc2lnIFJvb3QgUjIw +ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbCw3Oe +NcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNH +PWSb6WiaxswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3I +x2ymrdMxp7zo5eFm1tL7A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbe +QTg06ov80egEFGEtQX6sx3dOy1FU+16SGBsEWmjGycT6txOgmLcRK7fWV8x8nhfR +yyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqVg8NTEQxzHQuyRpDRQjrO +QG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa5Beny912 +H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJ +QfYEkoopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUD +i/ZnWejBBhG93c+AAk9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORs +nLMOPReisjQS1n6yqEm70XooQL6iFh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1 +rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud +DwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5uQu0wDQYJKoZI +hvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM +tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqf +GopTpti72TVVsRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkb +lvdhuDvEK7Z4bLQjb/D907JedR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka ++elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W81k/BfDxujRNt+3vrMNDcTa/F1bal +TFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjxmHHEt38OFdAlab0i +nSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01utI3 +gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18Dr +G5gPcFw0sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3Os +zMOl6W8KjptlwlCFtaOgUxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8x +L4ysEr3vQCj8KWefshNPZiTEUxnpHikV7+ZtsH8tZ/3zbBt1RqPlShfppNcL +-----END CERTIFICATE----- + +# Issuer: CN=ACCVRAIZ1 O=ACCV OU=PKIACCV +# Subject: CN=ACCVRAIZ1 O=ACCV OU=PKIACCV +# Label: "ACCVRAIZ1" +# Serial: 6828503384748696800 +# MD5 Fingerprint: d0:a0:5a:ee:05:b6:09:94:21:a1:7d:f1:b2:29:82:02 +# SHA1 Fingerprint: 93:05:7a:88:15:c6:4f:ce:88:2f:fa:91:16:52:28:78:bc:53:64:17 +# SHA256 Fingerprint: 9a:6e:c0:12:e1:a7:da:9d:be:34:19:4d:47:8a:d7:c0:db:18:22:fb:07:1d:f1:29:81:49:6e:d1:04:38:41:13 +-----BEGIN CERTIFICATE----- +MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UE +AwwJQUNDVlJBSVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQsw +CQYDVQQGEwJFUzAeFw0xMTA1MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQ +BgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwHUEtJQUNDVjENMAsGA1UECgwEQUND +VjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCb +qau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gMjmoY +HtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWo +G2ioPej0RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpA +lHPrzg5XPAOBOp0KoVdDaaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhr +IA8wKFSVf+DuzgpmndFALW4ir50awQUZ0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/ +0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDGWuzndN9wrqODJerWx5eH +k6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs78yM2x/47 +4KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMO +m3WR5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpa +cXpkatcnYGMN285J9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPl +uUsXQA+xtrn13k/c4LOsOxFwYIRKQ26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYI +KwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRwOi8vd3d3LmFjY3YuZXMvZmls +ZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEuY3J0MB8GCCsG +AQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2 +VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeT +VfZW6oHlNsyMHj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIG +CCsGAQUFBwICMIIBFB6CARAAQQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUA +cgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBhAO0AegAgAGQAZQAgAGwAYQAgAEEA +QwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUAYwBuAG8AbABvAGcA +7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBjAHQA +cgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAA +QwBQAFMAIABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUA +czAwBggrBgEFBQcCARYkaHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2Mu +aHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRt +aW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2MV9kZXIuY3JsMA4GA1Ud +DwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZIhvcNAQEF +BQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdp +D70ER9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gU +JyCpZET/LtZ1qmxNYEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+m +AM/EKXMRNt6GGT6d7hmKG9Ww7Y49nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepD +vV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJTS+xJlsndQAJxGJ3KQhfnlms +tn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3sCPdK6jT2iWH +7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h +I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szA +h1xA2syVP1XgNce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xF +d3+YJ5oyXSrjhO7FmGYvliAd3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2H +pPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3pEfbRD0tVNEYqi4Y7 +-----END CERTIFICATE----- + +# Issuer: CN=TWCA Global Root CA O=TAIWAN-CA OU=Root CA +# Subject: CN=TWCA Global Root CA O=TAIWAN-CA OU=Root CA +# Label: "TWCA Global Root CA" +# Serial: 3262 +# MD5 Fingerprint: f9:03:7e:cf:e6:9e:3c:73:7a:2a:90:07:69:ff:2b:96 +# SHA1 Fingerprint: 9c:bb:48:53:f6:a4:f6:d3:52:a4:e8:32:52:55:60:13:f5:ad:af:65 +# SHA256 Fingerprint: 59:76:90:07:f7:68:5d:0f:cd:50:87:2f:9f:95:d5:75:5a:5b:2b:45:7d:81:f3:69:2b:61:0a:98:67:2f:0e:1b +-----BEGIN CERTIFICATE----- +MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcx +EjAQBgNVBAoTCVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMT +VFdDQSBHbG9iYWwgUm9vdCBDQTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5 +NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQKEwlUQUlXQU4tQ0ExEDAOBgNVBAsT +B1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3QgQ0EwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2CnJfF +10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz +0ALfUPZVr2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfCh +MBwqoJimFb3u/Rk28OKRQ4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbH +zIh1HrtsBv+baz4X7GGqcXzGHaL3SekVtTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc +46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1WKKD+u4ZqyPpcC1jcxkt2 +yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99sy2sbZCi +laLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYP +oA/pyJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQA +BDzfuBSO6N+pjWxnkjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcE +qYSjMq+u7msXi7Kx/mzhkIyIqJdIzshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm +4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB +/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6gcFGn90xHNcgL +1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn +LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WF +H6vPNOw/KP4M8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNo +RI2T9GRwoD2dKAXDOXC4Ynsg/eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+ +nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlglPx4mI88k1HtQJAH32RjJMtOcQWh +15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryPA9gK8kxkRr05YuWW +6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3mi4TW +nsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5j +wa19hAM8EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWz +aGHQRiapIVJpLesux+t3zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmy +KwbQBM0= +-----END CERTIFICATE----- + +# Issuer: CN=TeliaSonera Root CA v1 O=TeliaSonera +# Subject: CN=TeliaSonera Root CA v1 O=TeliaSonera +# Label: "TeliaSonera Root CA v1" +# Serial: 199041966741090107964904287217786801558 +# MD5 Fingerprint: 37:41:49:1b:18:56:9a:26:f5:ad:c2:66:fb:40:a5:4c +# SHA1 Fingerprint: 43:13:bb:96:f1:d5:86:9b:c1:4e:6a:92:f6:cf:f6:34:69:87:82:37 +# SHA256 Fingerprint: dd:69:36:fe:21:f8:f0:77:c1:23:a1:a5:21:c1:22:24:f7:22:55:b7:3e:03:a7:26:06:93:e8:a2:4b:0f:a3:89 +-----BEGIN CERTIFICATE----- +MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAw +NzEUMBIGA1UECgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJv +b3QgQ0EgdjEwHhcNMDcxMDE4MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYD +VQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwWVGVsaWFTb25lcmEgUm9vdCBDQSB2 +MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+6yfwIaPzaSZVfp3F +VRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA3GV1 +7CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+X +Z75Ljo1kB1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+ +/jXh7VB7qTCNGdMJjmhnXb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs +81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxHoLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkm +dtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3F0fUTPHSiXk+TT2YqGHe +Oh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJoWjiUIMu +sDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4 +pgd7gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fs +slESl1MpWtTwEhDcTwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQ +arMCpgKIv7NHfirZ1fpoeDVNAgMBAAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYD +VR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qWDNXr+nuqF+gTEjANBgkqhkiG +9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNmzqjMDfz1mgbl +dxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx +0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1Tj +TQpgcmLNkQfWpb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBed +Y2gea+zDTYa4EzAvXUYNR0PVG6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7 +Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpcc41teyWRyu5FrgZLAMzTsVlQ2jqI +OylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOTJsjrDNYmiLbAJM+7 +vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2qReW +t88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcn +HL/EVlP6Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVx +SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= +-----END CERTIFICATE----- + +# Issuer: CN=E-Tugra Certification Authority O=E-Tuğra EBG Bilişim Teknolojileri ve Hizmetleri A.Ş. OU=E-Tugra Sertifikasyon Merkezi +# Subject: CN=E-Tugra Certification Authority O=E-Tuğra EBG Bilişim Teknolojileri ve Hizmetleri A.Ş. OU=E-Tugra Sertifikasyon Merkezi +# Label: "E-Tugra Certification Authority" +# Serial: 7667447206703254355 +# MD5 Fingerprint: b8:a1:03:63:b0:bd:21:71:70:8a:6f:13:3a:bb:79:49 +# SHA1 Fingerprint: 51:c6:e7:08:49:06:6e:f3:92:d4:5c:a0:0d:6d:a3:62:8f:c3:52:39 +# SHA256 Fingerprint: b0:bf:d5:2b:b0:d7:d9:bd:92:bf:5d:4d:c1:3d:a2:55:c0:2c:54:2f:37:83:65:ea:89:39:11:f5:5e:55:f2:3c +-----BEGIN CERTIFICATE----- +MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNV +BAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBC +aWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNV +BAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQDDB9FLVR1 +Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMwNTEyMDk0OFoXDTIz +MDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExQDA+ +BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhp +em1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN +ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4vU/kwVRHoViVF56C/UY +B4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vdhQd2h8y/L5VMzH2nPbxH +D5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5KCKpbknSF +Q9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEo +q1+gElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3D +k14opz8n8Y4e0ypQBaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcH +fC425lAcP9tDJMW/hkd5s3kc91r0E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsut +dEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gzrt48Ue7LE3wBf4QOXVGUnhMM +ti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAqjqFGOjGY5RH8 +zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn +rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUX +U8u3Zg5mTPj5dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6 +Jyr+zE7S6E5UMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5 +XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQAF +Nzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAKkEh47U6YA5n+KGCR +HTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jOXKqY +GwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c +77NCR807VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3 ++GbHeJAAFS6LrVE1Uweoa2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WK +vJUawSg5TB9D0pH0clmKuVb8P7Sd2nCcdlqMQ1DujjByTd//SffGqWfZbawCEeI6 +FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEVKV0jq9BgoRJP3vQXzTLl +yb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gTDx4JnW2P +AJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpD +y4Q08ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8d +NL/+I5c30jn6PQ0GC7TbO6Orb1wdtn7os4I07QZcJA== +-----END CERTIFICATE----- + +# Issuer: CN=T-TeleSec GlobalRoot Class 2 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center +# Subject: CN=T-TeleSec GlobalRoot Class 2 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center +# Label: "T-TeleSec GlobalRoot Class 2" +# Serial: 1 +# MD5 Fingerprint: 2b:9b:9e:e4:7b:6c:1f:00:72:1a:cc:c1:77:79:df:6a +# SHA1 Fingerprint: 59:0d:2d:7d:88:4f:40:2e:61:7e:a5:62:32:17:65:cf:17:d8:94:e9 +# SHA256 Fingerprint: 91:e2:f5:78:8d:58:10:eb:a7:ba:58:73:7d:e1:54:8a:8e:ca:cd:01:45:98:bc:0b:14:3e:04:1b:17:05:25:52 +-----BEGIN CERTIFICATE----- +MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx +KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd +BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl +YyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgxMDAxMTA0MDE0WhcNMzMxMDAxMjM1 +OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy +aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 +ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUd +AqSzm1nzHoqvNK38DcLZSBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiC +FoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/FvudocP05l03Sx5iRUKrERLMjfTlH6VJi +1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx9702cu+fjOlbpSD8DT6Iavq +jnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGVWOHAD3bZ +wI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGj +QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/ +WSA2AHmgoCJrjNXyYdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhy +NsZt+U2e+iKo4YFWz827n+qrkRk4r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPAC +uvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNfvNoBYimipidx5joifsFvHZVw +IEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR3p1m0IvVVGb6 +g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN +9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlP +BSeOE6Fuwg== +-----END CERTIFICATE----- + +# Issuer: CN=Atos TrustedRoot 2011 O=Atos +# Subject: CN=Atos TrustedRoot 2011 O=Atos +# Label: "Atos TrustedRoot 2011" +# Serial: 6643877497813316402 +# MD5 Fingerprint: ae:b9:c4:32:4b:ac:7f:5d:66:cc:77:94:bb:2a:77:56 +# SHA1 Fingerprint: 2b:b1:f5:3e:55:0c:1d:c5:f1:d4:e6:b7:6a:46:4b:55:06:02:ac:21 +# SHA256 Fingerprint: f3:56:be:a2:44:b7:a9:1e:b3:5d:53:ca:9a:d7:86:4a:ce:01:8e:2d:35:d5:f8:f9:6d:df:68:a6:f4:1a:a4:74 +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UE +AwwVQXRvcyBUcnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQG +EwJERTAeFw0xMTA3MDcxNDU4MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMM +FUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsGA1UECgwEQXRvczELMAkGA1UEBhMC +REUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVhTuXbyo7LjvPpvMp +Nb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr54rM +VD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+ +SZFhyBH+DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ +4J7sVaE3IqKHBAUsR320HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0L +cp2AMBYHlT8oDv3FdU9T1nSatCQujgKRz3bFmx5VdJx4IbHwLfELn8LVlhgf8FQi +eowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7Rl+lwrrw7GWzbITAPBgNV +HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZbNshMBgG +A1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3 +DQEBCwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8j +vZfza1zv7v1Apt+hk6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kP +DpFrdRbhIfzYJsdHt6bPWHJxfrrhTZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pc +maHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a961qn8FYiqTxlVMYVqL2Gns2D +lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv +KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 1 G3 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 1 G3 O=QuoVadis Limited +# Label: "QuoVadis Root CA 1 G3" +# Serial: 687049649626669250736271037606554624078720034195 +# MD5 Fingerprint: a4:bc:5b:3f:fe:37:9a:fa:64:f0:e2:fa:05:3d:0b:ab +# SHA1 Fingerprint: 1b:8e:ea:57:96:29:1a:c9:39:ea:b8:0a:81:1a:73:73:c0:93:79:67 +# SHA256 Fingerprint: 8a:86:6f:d1:b2:76:b5:7e:57:8e:92:1c:65:82:8a:2b:ed:58:e9:f2:f2:88:05:41:34:b7:f1:f4:bf:c9:cc:74 +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQEL +BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc +BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00 +MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM +aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEgRzMwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakEPBtV +wedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWe +rNrwU8lmPNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF341 +68Xfuw6cwI2H44g4hWf6Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh +4Pw5qlPafX7PGglTvF0FBM+hSo+LdoINofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXp +UhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/lg6AnhF4EwfWQvTA9xO+o +abw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV7qJZjqlc +3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/G +KubX9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSt +hfbZxbGL0eUQMk1fiyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KO +Tk0k+17kBL5yG6YnLUlamXrXXAkgt3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOt +zCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +BjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZIhvcNAQELBQAD +ggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC +MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2 +cDMT/uFPpiN3GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUN +qXsCHKnQO18LwIE6PWThv6ctTr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5 +YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP+V04ikkwj+3x6xn0dxoxGE1nVGwv +b2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh3jRJjehZrJ3ydlo2 +8hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fawx/k +NSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNj +ZgKAvQU6O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhp +q1467HxpvMc7hU6eFbm0FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFt +nh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOVhMJKzRwuJIczYOXD +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 2 G3 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 2 G3 O=QuoVadis Limited +# Label: "QuoVadis Root CA 2 G3" +# Serial: 390156079458959257446133169266079962026824725800 +# MD5 Fingerprint: af:0c:86:6e:bf:40:2d:7f:0b:3e:12:50:ba:12:3d:06 +# SHA1 Fingerprint: 09:3c:61:f3:8b:8b:dc:7d:55:df:75:38:02:05:00:e1:25:f5:c8:36 +# SHA256 Fingerprint: 8f:e4:fb:0a:f9:3a:4d:0d:67:db:0b:eb:b2:3e:37:c7:1b:f3:25:dc:bc:dd:24:0e:a0:4d:af:58:b4:7e:18:40 +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQEL +BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc +BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00 +MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM +aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIgRzMwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFhZiFf +qq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMW +n4rjyduYNM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ym +c5GQYaYDFCDy54ejiK2toIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+ +O7q414AB+6XrW7PFXmAqMaCvN+ggOp+oMiwMzAkd056OXbxMmO7FGmh77FOm6RQ1 +o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+lV0POKa2Mq1W/xPtbAd0j +IaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZoL1NesNKq +IcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz +8eQQsSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43eh +vNURG3YBZwjgQQvD6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l +7ZizlWNof/k19N+IxWA1ksB8aRxhlRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALG +cC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +BjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZIhvcNAQELBQAD +ggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66 +AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RC +roijQ1h5fq7KpVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0Ga +W/ZZGYjeVYg3UQt4XAoeo0L9x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4n +lv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgzdWqTHBLmYF5vHX/JHyPLhGGfHoJE ++V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6XU/IyAgkwo1jwDQHV +csaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+NwmNtd +dbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNg +KCLjsZWDzYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeM +HVOyToV7BjjHLPj4sHKNJeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4 +WSr2Rz0ZiC3oheGe7IUIarFsNMkd7EgrO3jtZsSOeWmD3n+M +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 3 G3 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 3 G3 O=QuoVadis Limited +# Label: "QuoVadis Root CA 3 G3" +# Serial: 268090761170461462463995952157327242137089239581 +# MD5 Fingerprint: df:7d:b9:ad:54:6f:68:a1:df:89:57:03:97:43:b0:d7 +# SHA1 Fingerprint: 48:12:bd:92:3c:a8:c4:39:06:e7:30:6d:27:96:e6:a4:cf:22:2e:7d +# SHA256 Fingerprint: 88:ef:81:de:20:2e:b0:18:45:2e:43:f8:64:72:5c:ea:5f:bd:1f:c2:d9:d2:05:73:07:09:c5:d8:b8:69:0f:46 +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQEL +BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc +BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00 +MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM +aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMgRzMwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286IxSR +/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNu +FoM7pmRLMon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXR +U7Ox7sWTaYI+FrUoRqHe6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+c +ra1AdHkrAj80//ogaX3T7mH1urPnMNA3I4ZyYUUpSFlob3emLoG+B01vr87ERROR +FHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3UVDmrJqMz6nWB2i3ND0/k +A9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f75li59wzw +eyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634Ryl +sSqiMd5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBp +VzgeAVuNVejH38DMdyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0Q +A4XN8f+MFrXBsj6IbGB/kE+V9/YtrQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ +ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +BjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZIhvcNAQELBQAD +ggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px +KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnI +FUBhynLWcKzSt/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5Wvv +oxXqA/4Ti2Tk08HS6IT7SdEQTXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFg +u/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9DuDcpmvJRPpq3t/O5jrFc/ZSXPsoaP +0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGibIh6BJpsQBJFxwAYf +3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmDhPbl +8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+ +DhcI00iX0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HN +PlopNLk9hM6xZdRZkZFWdSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ +ywaZWWDYWGWVjUTR939+J399roD1B0y2PpxxVJkES/1Y+Zj0 +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Assured ID Root G2 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Assured ID Root G2 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Assured ID Root G2" +# Serial: 15385348160840213938643033620894905419 +# MD5 Fingerprint: 92:38:b9:f8:63:24:82:65:2c:57:33:e6:fe:81:8f:9d +# SHA1 Fingerprint: a1:4b:48:d9:43:ee:0a:0e:40:90:4f:3c:e0:a4:c0:91:93:51:5d:3f +# SHA256 Fingerprint: 7d:05:eb:b6:82:33:9f:8c:94:51:ee:09:4e:eb:fe:fa:79:53:a1:14:ed:b2:f4:49:49:45:2f:ab:7d:2f:c1:85 +-----BEGIN CERTIFICATE----- +MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBl +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv +b3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl +cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSA +n61UQbVH35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4Htecc +biJVMWWXvdMX0h5i89vqbFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9Hp +EgjAALAcKxHad3A2m67OeYfcgnDmCXRwVWmvo2ifv922ebPynXApVfSr/5Vh88lA +bx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OPYLfykqGxvYmJHzDNw6Yu +YjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+RnlTGNAgMB +AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQW +BBTOw0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPI +QW5pJ6d1Ee88hjZv0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I +0jJmwYrA8y8678Dj1JGG0VDjA9tzd29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4Gni +lmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAWhsI6yLETcDbYz+70CjTVW0z9 +B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0MjomZmWzwPDCv +ON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo +IhNzbM8m9Yop5w== +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Assured ID Root G3 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Assured ID Root G3 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Assured ID Root G3" +# Serial: 15459312981008553731928384953135426796 +# MD5 Fingerprint: 7c:7f:65:31:0c:81:df:8d:ba:3e:99:e2:5c:ad:6e:fb +# SHA1 Fingerprint: f5:17:a2:4f:9a:48:c6:c9:f8:a2:00:26:9f:dc:0f:48:2c:ab:30:89 +# SHA256 Fingerprint: 7e:37:cb:8b:4c:47:09:0c:ab:36:55:1b:a6:f4:5d:b8:40:68:0f:ba:16:6a:95:2d:b1:00:71:7f:43:05:3f:c2 +-----BEGIN CERTIFICATE----- +MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQsw +CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu +ZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3Qg +RzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQGEwJV +UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu +Y29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQBgcq +hkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJf +Zn4f5dwbRXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17Q +RSAPWXYQ1qAk8C3eNvJsKTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ +BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgFUaFNN6KDec6NHSrkhDAKBggqhkjOPQQD +AwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5FyYZ5eEJJZVrmDxxDnOOlY +JjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy1vUhZscv +6pZjamVFkpUBtA== +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Global Root G2" +# Serial: 4293743540046975378534879503202253541 +# MD5 Fingerprint: e4:a6:8a:c8:54:ac:52:42:46:0a:fd:72:48:1b:2a:44 +# SHA1 Fingerprint: df:3c:24:f9:bf:d6:66:76:1b:26:80:73:fe:06:d1:cc:8d:4f:82:a4 +# SHA256 Fingerprint: cb:3c:cb:b7:60:31:e5:e0:13:8f:8d:d3:9a:23:f9:de:47:ff:c3:5e:43:c1:14:4c:ea:27:d4:6a:5a:b1:cb:5f +-----BEGIN CERTIFICATE----- +MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBh +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH +MjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVT +MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j +b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI +2/Ou8jqJkTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx +1x7e/dfgy5SDN67sH0NO3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQ +q2EGnI/yuum06ZIya7XzV+hdG82MHauVBJVJ8zUtluNJbd134/tJS7SsVQepj5Wz +tCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyMUNGPHgm+F6HmIcr9g+UQ +vIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQABo0IwQDAP +BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV +5uNu5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY +1Yl9PMWLSn/pvtsrF9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4 +NeF22d+mQrvHRAiGfzZ0JFrabA0UWTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NG +Fdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBHQRFXGU7Aj64GxJUTFy8bJZ91 +8rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/iyK5S9kJRaTe +pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl +MrY= +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Global Root G3" +# Serial: 7089244469030293291760083333884364146 +# MD5 Fingerprint: f5:5d:a4:50:a5:fb:28:7e:1e:0f:0d:cc:96:57:56:ca +# SHA1 Fingerprint: 7e:04:de:89:6a:3e:66:6d:00:e6:87:d3:3f:fa:d9:3b:e8:3d:34:9e +# SHA256 Fingerprint: 31:ad:66:48:f8:10:41:38:c7:38:f3:9e:a4:32:01:33:39:3e:3a:18:cc:02:29:6e:f9:7c:2a:c9:ef:67:31:d0 +-----BEGIN CERTIFICATE----- +MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQsw +CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu +ZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAe +Fw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVTMRUw +EwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20x +IDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0CAQYF +K4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FG +fp4tn+6OYwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPO +Z9wj/wMco+I+o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAd +BgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNpYim8S8YwCgYIKoZIzj0EAwMDaAAwZQIx +AK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y3maTD/HMsQmP3Wyr+mt/ +oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8 +sycX +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Trusted Root G4 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Trusted Root G4 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Trusted Root G4" +# Serial: 7451500558977370777930084869016614236 +# MD5 Fingerprint: 78:f2:fc:aa:60:1f:2f:b4:eb:c9:37:ba:53:2e:75:49 +# SHA1 Fingerprint: dd:fb:16:cd:49:31:c9:73:a2:03:7d:3f:c8:3a:4d:7d:77:5d:05:e4 +# SHA256 Fingerprint: 55:2f:7b:dc:f1:a7:af:9e:6c:e6:72:01:7f:4f:12:ab:f7:72:40:c7:8e:76:1a:c2:03:d1:d9:d2:0a:c8:99:88 +-----BEGIN CERTIFICATE----- +MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBi +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3Qg +RzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBiMQswCQYDVQQGEwJV +UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu +Y29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3y +ithZwuEppz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1If +xp4VpX6+n6lXFllVcq9ok3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDV +ySAdYyktzuxeTsiT+CFhmzTrBcZe7FsavOvJz82sNEBfsXpm7nfISKhmV1efVFiO +DCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGYQJB5w3jHtrHEtWoYOAMQ +jdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6MUSaM0C/ +CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCi +EhtmmnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADM +fRyVw4/3IbKyEbe7f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QY +uKZ3AeEPlAwhHbJUKSWJbOUOUlFHdL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXK +chYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8oR7FwI+isX4KJpn15GkvmB0t +9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +hjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD +ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2 +SV1EY+CtnJYYZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd ++SeuMIW59mdNOj6PWTkiU0TryF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWc +fFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy7zBZLq7gcfJW5GqXb5JQbZaNaHqa +sjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iahixTXTBmyUEFxPT9N +cCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN5r5N +0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie +4u1Ki7wb/UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mI +r/OSmbaz5mEP0oUA51Aa5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1 +/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tKG48BtieVU+i2iW1bvGjUI+iLUaJW+fCm +gKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP82Z+ +-----END CERTIFICATE----- + +# Issuer: CN=COMODO RSA Certification Authority O=COMODO CA Limited +# Subject: CN=COMODO RSA Certification Authority O=COMODO CA Limited +# Label: "COMODO RSA Certification Authority" +# Serial: 101909084537582093308941363524873193117 +# MD5 Fingerprint: 1b:31:b0:71:40:36:cc:14:36:91:ad:c4:3e:fd:ec:18 +# SHA1 Fingerprint: af:e5:d2:44:a8:d1:19:42:30:ff:47:9f:e2:f8:97:bb:cd:7a:8c:b4 +# SHA256 Fingerprint: 52:f0:e1:c4:e5:8e:c6:29:29:1b:60:31:7f:07:46:71:b8:5d:7e:a8:0d:5b:07:27:34:63:53:4b:32:b4:02:34 +-----BEGIN CERTIFICATE----- +MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCB +hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G +A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV +BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMTE5 +MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgT +EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR +Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR +6FSS0gpWsawNJN3Fz0RndJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8X +pz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZFGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC +9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+5eNu/Nio5JIk2kNrYrhV +/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pGx8cgoLEf +Zd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z ++pUX2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7w +qP/0uK3pN/u6uPQLOvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZah +SL0896+1DSJMwBGB7FY79tOi4lu3sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVIC +u9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+CGCe01a60y1Dma/RMhnEw6abf +Fobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5WdYgGq/yapiq +crxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E +FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB +/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvl +wFTPoCWOAvn9sKIN9SCYPBMtrFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM +4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+nq6PK7o9mfjYcwlYRm6mnPTXJ9OV +2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSgtZx8jb8uk2Intzna +FxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwWsRqZ +CuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiK +boHGhfKppC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmcke +jkk9u+UJueBPSZI9FoJAzMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yL +S0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHqZJx64SIDqZxubw5lT2yHh17zbqD5daWb +QOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk527RH89elWsn2/x20Kk4yl +0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7ILaZRfyHB +NVOFBkpdn627G190 +-----END CERTIFICATE----- + +# Issuer: CN=USERTrust RSA Certification Authority O=The USERTRUST Network +# Subject: CN=USERTrust RSA Certification Authority O=The USERTRUST Network +# Label: "USERTrust RSA Certification Authority" +# Serial: 2645093764781058787591871645665788717 +# MD5 Fingerprint: 1b:fe:69:d1:91:b7:19:33:a3:72:a8:0f:e1:55:e5:b5 +# SHA1 Fingerprint: 2b:8f:1b:57:33:0d:bb:a2:d0:7a:6c:51:f7:0e:e9:0d:da:b9:ad:8e +# SHA256 Fingerprint: e7:93:c9:b0:2f:d8:aa:13:e2:1c:31:22:8a:cc:b0:81:19:64:3b:74:9c:89:89:64:b1:74:6d:46:c3:d4:cb:d2 +-----BEGIN CERTIFICATE----- +MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCB +iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl +cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV +BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAw +MjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNV +BAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU +aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2Vy +dGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK +AoICAQCAEmUXNg7D2wiz0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B +3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2jY0K2dvKpOyuR+OJv0OwWIJAJPuLodMkY +tJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFnRghRy4YUVD+8M/5+bJz/ +Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O+T23LLb2 +VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT +79uq/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6 +c0Plfg6lZrEpfDKEY1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmT +Yo61Zs8liM2EuLE/pDkP2QKe6xJMlXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97l +c6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8yexDJtC/QV9AqURE9JnnV4ee +UB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+eLf8ZxXhyVeE +Hg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd +BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8G +A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPF +Up/L+M+ZBn8b2kMVn54CVVeWFPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KO +VWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ7l8wXEskEVX/JJpuXior7gtNn3/3 +ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQEg9zKC7F4iRO/Fjs +8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM8WcR +iQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYze +Sf7dNXGiFSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZ +XHlKYC6SQK5MNyosycdiyA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/ +qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9cJ2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRB +VXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGwsAvgnEzDHNb842m1R0aB +L6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gxQ+6IHdfG +jjxDah2nGN59PRbxYvnKkKj9 +-----END CERTIFICATE----- + +# Issuer: CN=USERTrust ECC Certification Authority O=The USERTRUST Network +# Subject: CN=USERTrust ECC Certification Authority O=The USERTRUST Network +# Label: "USERTrust ECC Certification Authority" +# Serial: 123013823720199481456569720443997572134 +# MD5 Fingerprint: fa:68:bc:d9:b5:7f:ad:fd:c9:1d:06:83:28:cc:24:c1 +# SHA1 Fingerprint: d1:cb:ca:5d:b2:d5:2a:7f:69:3b:67:4d:e5:f0:5a:1d:0c:95:7d:f0 +# SHA256 Fingerprint: 4f:f4:60:d5:4b:9c:86:da:bf:bc:fc:57:12:e0:40:0d:2b:ed:3f:bc:4d:4f:bd:aa:86:e0:6a:dc:d2:a9:ad:7a +-----BEGIN CERTIFICATE----- +MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDEL +MAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNl +eSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMT +JVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMjAx +MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgT +Ck5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVUaGUg +VVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlm +aWNhdGlvbiBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqflo +I+d61SRvU8Za2EurxtW20eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinng +o4N+LZfQYcTxmdwlkWOrfzCjtHDix6EznPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0G +A1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNVHQ8BAf8EBAMCAQYwDwYD +VR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBBHU6+4WMB +zzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbW +RNZu9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg= +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R4 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R4 +# Label: "GlobalSign ECC Root CA - R4" +# Serial: 14367148294922964480859022125800977897474 +# MD5 Fingerprint: 20:f0:27:68:d1:7e:a0:9d:0e:e6:2a:ca:df:5c:89:8e +# SHA1 Fingerprint: 69:69:56:2e:40:80:f4:24:a1:e7:19:9f:14:ba:f3:ee:58:ab:6a:bb +# SHA256 Fingerprint: be:c9:49:11:c2:95:56:76:db:6c:0a:55:09:86:d7:6e:3b:a0:05:66:7c:44:2c:97:62:b4:fb:b7:73:de:22:8c +-----BEGIN CERTIFICATE----- +MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEk +MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpH +bG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoX +DTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBD +QSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWdu +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprlOQcJ +FspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAw +DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61F +uOJAf/sKbvu+M8k8o4TVMAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGX +kPoUVy0D7O48027KqGx2vKLeuwIgJ6iFJzWbVsaj8kfSt24bAgAXqmemFZHe+pTs +ewv4n4Q= +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R5 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R5 +# Label: "GlobalSign ECC Root CA - R5" +# Serial: 32785792099990507226680698011560947931244 +# MD5 Fingerprint: 9f:ad:3b:1c:02:1e:8a:ba:17:74:38:81:0c:a2:bc:08 +# SHA1 Fingerprint: 1f:24:c6:30:cd:a4:18:ef:20:69:ff:ad:4f:dd:5f:46:3a:1b:69:aa +# SHA256 Fingerprint: 17:9f:bc:14:8a:3d:d0:0f:d2:4e:a1:34:58:cc:43:bf:a7:f5:9c:81:82:d7:83:a5:13:f6:eb:ec:10:0c:89:24 +-----BEGIN CERTIFICATE----- +MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEk +MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpH +bG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoX +DTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBD +QSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWdu +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6SFkc +8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8ke +hOvRnkmSh5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD +VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYI +KoZIzj0EAwMDaAAwZQIxAOVpEslu28YxuglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg +515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7yFz9SO8NdCKoCOJuxUnO +xwy8p2Fp8fc74SrL+SvzZpA3 +-----END CERTIFICATE----- + +# Issuer: CN=Staat der Nederlanden EV Root CA O=Staat der Nederlanden +# Subject: CN=Staat der Nederlanden EV Root CA O=Staat der Nederlanden +# Label: "Staat der Nederlanden EV Root CA" +# Serial: 10000013 +# MD5 Fingerprint: fc:06:af:7b:e8:1a:f1:9a:b4:e8:d2:70:1f:c0:f5:ba +# SHA1 Fingerprint: 76:e2:7e:c1:4f:db:82:c1:c0:a6:75:b5:05:be:3d:29:b4:ed:db:bb +# SHA256 Fingerprint: 4d:24:91:41:4c:fe:95:67:46:ec:4c:ef:a6:cf:6f:72:e2:8a:13:29:43:2f:9d:8a:90:7a:c4:cb:5d:ad:c1:5a +-----BEGIN CERTIFICATE----- +MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJO +TDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFh +dCBkZXIgTmVkZXJsYW5kZW4gRVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0y +MjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5MMR4wHAYDVQQKDBVTdGFhdCBkZXIg +TmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRlcmxhbmRlbiBFViBS +b290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkkSzrS +M4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nC +UiY4iKTWO0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3d +Z//BYY1jTw+bbRcwJu+r0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46p +rfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13l +pJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gVXJrm0w912fxBmJc+qiXb +j5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr08C+eKxC +KFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS +/ZbV0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0X +cgOPvZuM5l5Tnrmd74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH +1vI4gnPah1vlPNOePqc7nvQDs/nxfRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrP +px9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB +/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwaivsnuL8wbqg7 +MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI +eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u +2dfOWBfoqSmuc0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHS +v4ilf0X8rLiltTMMgsT7B/Zq5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTC +wPTxGfARKbalGAKb12NMcIxHowNDXLldRqANb/9Zjr7dn3LDWyvfjFvO5QxGbJKy +CqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tNf1zuacpzEPuKqf2e +vTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi5Dp6 +Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIa +Gl6I6lD4WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeL +eG9QgkRQP2YGiqtDhFZKDyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8 +FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGyeUN51q1veieQA6TqJIc/2b3Z6fJfUEkc +7uzXLg== +-----END CERTIFICATE----- + +# Issuer: CN=IdenTrust Commercial Root CA 1 O=IdenTrust +# Subject: CN=IdenTrust Commercial Root CA 1 O=IdenTrust +# Label: "IdenTrust Commercial Root CA 1" +# Serial: 13298821034946342390520003877796839426 +# MD5 Fingerprint: b3:3e:77:73:75:ee:a0:d3:e3:7e:49:63:49:59:bb:c7 +# SHA1 Fingerprint: df:71:7e:aa:4a:d9:4e:c9:55:84:99:60:2d:48:de:5f:bc:f0:3a:25 +# SHA256 Fingerprint: 5d:56:49:9b:e4:d2:e0:8b:cf:ca:d0:8a:3e:38:72:3d:50:50:3b:de:70:69:48:e4:2f:55:60:30:19:e5:28:ae +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBK +MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVu +VHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQw +MTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScw +JQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ldhNlT +3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU ++ehcCuz/mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gp +S0l4PJNgiCL8mdo2yMKi1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1 +bVoE/c40yiTcdCMbXTMTEl3EASX2MN0CXZ/g1Ue9tOsbobtJSdifWwLziuQkkORi +T0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl3ZBWzvurpWCdxJ35UrCL +vYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzyNeVJSQjK +Vsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZK +dHzVWYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHT +c+XvvqDtMwt0viAgxGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hv +l7yTmvmcEpB4eoCHFddydJxVdHixuuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5N +iGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB +/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZIhvcNAQELBQAD +ggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH +6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwt +LRvM7Kqas6pgghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93 +nAbowacYXVKV7cndJZ5t+qntozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3 ++wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmVYjzlVYA211QC//G5Xc7UI2/YRYRK +W2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUXfeu+h1sXIFRRk0pT +AwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/rokTLq +l1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG +4iZZRHUe2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZ +mUlO+KWA2yUPHGNiiskzZ2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A +7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7RcGzM7vRX+Bi6hG6H +-----END CERTIFICATE----- + +# Issuer: CN=IdenTrust Public Sector Root CA 1 O=IdenTrust +# Subject: CN=IdenTrust Public Sector Root CA 1 O=IdenTrust +# Label: "IdenTrust Public Sector Root CA 1" +# Serial: 13298821034946342390521976156843933698 +# MD5 Fingerprint: 37:06:a5:b0:fc:89:9d:ba:f4:6b:8c:1a:64:cd:d5:ba +# SHA1 Fingerprint: ba:29:41:60:77:98:3f:f4:f3:ef:f2:31:05:3b:2e:ea:6d:4d:45:fd +# SHA256 Fingerprint: 30:d0:89:5a:9a:44:8a:26:20:91:63:55:22:d1:f5:20:10:b5:86:7a:ca:e1:2c:78:ef:95:8f:d4:f4:38:9f:2f +-----BEGIN CERTIFICATE----- +MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBN +MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVu +VHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcN +MzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0 +MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTyP4o7 +ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGy +RBb06tD6Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlS +bdsHyo+1W/CD80/HLaXIrcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF +/YTLNiCBWS2ab21ISGHKTN9T0a9SvESfqy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R +3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoSmJxZZoY+rfGwyj4GD3vw +EUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFnol57plzy +9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9V +GxyhLrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ +2fjXctscvG29ZV/viDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsV +WaFHVCkugyhfHMKiq3IXAAaOReyL4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gD +W/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ +BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMwDQYJKoZIhvcN +AQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj +t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHV +DRDtfULAj+7AmgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9 +TaDKQGXSc3z1i9kKlT/YPyNtGtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8G +lwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFtm6/n6J91eEyrRjuazr8FGF1NFTwW +mhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMxNRF4eKLg6TCMf4Df +WN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4Mhn5 ++bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJ +tshquDDIajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhA +GaQdp/lLQzfcaFpPz+vCZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv +8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ3Wl9af0AVqW3rLatt8o+Ae+c +-----END CERTIFICATE----- + +# Issuer: CN=Entrust Root Certification Authority - G2 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2009 Entrust, Inc. - for authorized use only +# Subject: CN=Entrust Root Certification Authority - G2 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2009 Entrust, Inc. - for authorized use only +# Label: "Entrust Root Certification Authority - G2" +# Serial: 1246989352 +# MD5 Fingerprint: 4b:e2:c9:91:96:65:0c:f4:0e:5a:93:92:a0:0a:fe:b2 +# SHA1 Fingerprint: 8c:f4:27:fd:79:0c:3a:d1:66:06:8d:e8:1e:57:ef:bb:93:22:72:d4 +# SHA256 Fingerprint: 43:df:57:74:b0:3e:7f:ef:5f:e4:0d:93:1a:7b:ed:f1:bb:2e:6b:42:73:8c:4e:6d:38:41:10:3d:3a:a7:f3:39 +-----BEGIN CERTIFICATE----- +MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMC +VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50 +cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3Qs +IEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVz +dCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwHhcNMDkwNzA3MTcy +NTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVu +dHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwt +dGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0 +aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK +AoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP/vaCeb9zYQYKpSfYs1/T +RU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXzHHfV1IWN +cCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hW +wcKUs/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1 +U1+cPvQXLOZprE4yTGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0 +jaWvYkxN4FisZDQSA/i2jZRjJKRxAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAP +BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ60B7vfec7aVHUbI2fkBJmqzAN +BgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5ZiXMRrEPR9RP/ +jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ +Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v +1fN2D807iDginWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4R +nAuknZoh8/CbCzB428Hch0P+vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmH +VHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xOe4pIb4tF9g== +-----END CERTIFICATE----- + +# Issuer: CN=Entrust Root Certification Authority - EC1 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2012 Entrust, Inc. - for authorized use only +# Subject: CN=Entrust Root Certification Authority - EC1 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2012 Entrust, Inc. - for authorized use only +# Label: "Entrust Root Certification Authority - EC1" +# Serial: 51543124481930649114116133369 +# MD5 Fingerprint: b6:7e:1d:f0:58:c5:49:6c:24:3b:3d:ed:98:18:ed:bc +# SHA1 Fingerprint: 20:d8:06:40:df:9b:25:f5:12:25:3a:11:ea:f7:59:8a:eb:14:b5:47 +# SHA256 Fingerprint: 02:ed:0e:b2:8c:14:da:45:16:5c:56:67:91:70:0d:64:51:d7:fb:56:f0:b2:ab:1d:3b:8e:b0:70:e5:6e:df:f5 +-----BEGIN CERTIFICATE----- +MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkG +A1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3 +d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVu +dHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEzMDEGA1UEAxMq +RW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRUMxMB4XDTEy +MTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYwFAYD +VQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0 +L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0g +Zm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBD +ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEVDMTB2MBAGByqGSM49AgEGBSuBBAAi +A2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHyAsWfoPZb1YsGGYZPUxBt +ByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef9eNi1KlH +Bz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O +BBYEFLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVC +R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX +hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G +-----END CERTIFICATE----- + +# Issuer: CN=CFCA EV ROOT O=China Financial Certification Authority +# Subject: CN=CFCA EV ROOT O=China Financial Certification Authority +# Label: "CFCA EV ROOT" +# Serial: 407555286 +# MD5 Fingerprint: 74:e1:b6:ed:26:7a:7a:44:30:33:94:ab:7b:27:81:30 +# SHA1 Fingerprint: e2:b8:29:4b:55:84:ab:6b:58:c2:90:46:6c:ac:3f:b8:39:8f:84:83 +# SHA256 Fingerprint: 5c:c3:d7:8e:4e:1d:5e:45:54:7a:04:e6:87:3e:64:f9:0c:f9:53:6d:1c:cc:2e:f8:00:f3:55:c4:c5:fd:70:fd +-----BEGIN CERTIFICATE----- +MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJD +TjEwMC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9y +aXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkx +MjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEwMC4GA1UECgwnQ2hpbmEgRmluYW5j +aWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJP +T1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnVBU03 +sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpL +TIpTUnrD7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5 +/ZOkVIBMUtRSqy5J35DNuF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp +7hZZLDRJGqgG16iI0gNyejLi6mhNbiyWZXvKWfry4t3uMCz7zEasxGPrb382KzRz +EpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7xzbh72fROdOXW3NiGUgt +hxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9fpy25IGvP +a931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqot +aK8KgWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNg +TnYGmE69g60dWIolhdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfV +PKPtl8MeNPo4+QgO48BdK4PRVmrJtqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hv +cWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAfBgNVHSMEGDAWgBTj/i39KNAL +tbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAd +BgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB +ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObT +ej/tUxPQ4i9qecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdL +jOztUmCypAbqTuv0axn96/Ua4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBS +ESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sGE5uPhnEFtC+NiWYzKXZUmhH4J/qy +P5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfXBDrDMlI1Dlb4pd19 +xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjnaH9d +Ci77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN +5mydLIhyPDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe +/v5WOaHIz16eGWRGENoXkbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+Z +AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ +5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su +-----END CERTIFICATE----- + +# Issuer: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed +# Subject: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed +# Label: "OISTE WISeKey Global Root GB CA" +# Serial: 157768595616588414422159278966750757568 +# MD5 Fingerprint: a4:eb:b9:61:28:2e:b7:2f:98:b0:35:26:90:99:51:1d +# SHA1 Fingerprint: 0f:f9:40:76:18:d3:d7:6a:4b:98:f0:a8:35:9e:0c:fd:27:ac:cc:ed +# SHA256 Fingerprint: 6b:9c:08:e8:6e:b0:f7:67:cf:ad:65:cd:98:b6:21:49:e5:49:4a:67:f5:84:5e:7b:d1:ed:01:9f:27:b8:6b:d6 +-----BEGIN CERTIFICATE----- +MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBt +MQswCQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUg +Rm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9i +YWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAwMzJaFw0zOTEyMDExNTEwMzFaMG0x +CzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBG +b3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh +bCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3 +HEokKtaXscriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGx +WuR51jIjK+FTzJlFXHtPrby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX +1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNk +u7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4oQnc/nSMbsrY9gBQHTC5P +99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvgGUpuuy9r +M2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUB +BAMCAQAwDQYJKoZIhvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrgh +cViXfa43FK8+5/ea4n32cZiZBKpDdHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5 +gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0VQreUGdNZtGn//3ZwLWoo4rO +ZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEuiHZeeevJuQHHf +aPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic +Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM= +-----END CERTIFICATE----- + +# Issuer: CN=SZAFIR ROOT CA2 O=Krajowa Izba Rozliczeniowa S.A. +# Subject: CN=SZAFIR ROOT CA2 O=Krajowa Izba Rozliczeniowa S.A. +# Label: "SZAFIR ROOT CA2" +# Serial: 357043034767186914217277344587386743377558296292 +# MD5 Fingerprint: 11:64:c1:89:b0:24:b1:8c:b1:07:7e:89:9e:51:9e:99 +# SHA1 Fingerprint: e2:52:fa:95:3f:ed:db:24:60:bd:6e:28:f3:9c:cc:cf:5e:b3:3f:de +# SHA256 Fingerprint: a1:33:9d:33:28:1a:0b:56:e5:57:d3:d3:2b:1c:e7:f9:36:7e:b0:94:bd:5f:a7:2a:7e:50:04:c8:de:d7:ca:fe +-----BEGIN CERTIFICATE----- +MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQEL +BQAwUTELMAkGA1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6 +ZW5pb3dhIFMuQS4xGDAWBgNVBAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkw +NzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJBgNVBAYTAlBMMSgwJgYDVQQKDB9L +cmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYDVQQDDA9TWkFGSVIg +Uk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5QqEvN +QLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT +3PSQ1hNKDJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw +3gAeqDRHu5rr/gsUvTaE2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr6 +3fE9biCloBK0TXC5ztdyO4mTp4CEHCdJckm1/zuVnsHMyAHs6A6KCpbns6aH5db5 +BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwiieDhZNRnvDF5YTy7ykHN +XGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD +AgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsF +AAOCAQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw +8PRBEew/R40/cof5O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOG +nXkZ7/e7DDWQw4rtTw/1zBLZpD67oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCP +oky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul4+vJhaAlIDf7js4MNIThPIGy +d05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6+/NNIxuZMzSg +LvWpCz/UXeHPhJ/iGcJfitYgHuNztw== +-----END CERTIFICATE----- + +# Issuer: CN=Certum Trusted Network CA 2 O=Unizeto Technologies S.A. OU=Certum Certification Authority +# Subject: CN=Certum Trusted Network CA 2 O=Unizeto Technologies S.A. OU=Certum Certification Authority +# Label: "Certum Trusted Network CA 2" +# Serial: 44979900017204383099463764357512596969 +# MD5 Fingerprint: 6d:46:9e:d9:25:6d:08:23:5b:5e:74:7d:1e:27:db:f2 +# SHA1 Fingerprint: d3:dd:48:3e:2b:bf:4c:05:e8:af:10:f5:fa:76:26:cf:d3:dc:30:92 +# SHA256 Fingerprint: b6:76:f2:ed:da:e8:77:5c:d3:6c:b0:f6:3c:d1:d4:60:39:61:f4:9e:62:65:ba:01:3a:2f:03:07:b6:d0:b8:04 +-----BEGIN CERTIFICATE----- +MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCB +gDELMAkGA1UEBhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMu +QS4xJzAlBgNVBAsTHkNlcnR1bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIG +A1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29yayBDQSAyMCIYDzIwMTExMDA2MDgz +OTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQTDEiMCAGA1UEChMZ +VW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3 +b3JrIENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWA +DGSdhhuWZGc/IjoedQF97/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn +0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+oCgCXhVqqndwpyeI1B+twTUrWwbNWuKFB +OJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40bRr5HMNUuctHFY9rnY3lE +fktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2puTRZCr+E +Sv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1m +o130GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02i +sx7QBlrd9pPPV3WZ9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOW +OZV7bIBaTxNyxtd9KXpEulKkKtVBRgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgez +Tv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pyehizKV/Ma5ciSixqClnrDvFAS +adgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vMBhBgu4M1t15n +3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD +AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMC +AQYwDQYJKoZIhvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQ +F/xlhMcQSZDe28cmk4gmb3DWAl45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTf +CVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuAL55MYIR4PSFk1vtBHxgP58l1cb29 +XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMoclm2q8KMZiYcdywm +djWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tMpkT/ +WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jb +AoJnwTnbw3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksq +P/ujmv5zMnHCnsZy4YpoJ/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Ko +b7a6bINDd82Kkhehnlt4Fj1F4jNy3eFmypnTycUm/Q1oBEauttmbjL4ZvrHG8hnj +XALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLXis7VmFxWlgPF7ncGNf/P +5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7zAYspsbi +DrW5viSP +-----END CERTIFICATE----- + +# Issuer: CN=Hellenic Academic and Research Institutions RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority +# Subject: CN=Hellenic Academic and Research Institutions RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority +# Label: "Hellenic Academic and Research Institutions RootCA 2015" +# Serial: 0 +# MD5 Fingerprint: ca:ff:e2:db:03:d9:cb:4b:e9:0f:ad:84:fd:7b:18:ce +# SHA1 Fingerprint: 01:0c:06:95:a6:98:19:14:ff:bf:5f:c6:b0:b6:95:ea:29:e9:12:a6 +# SHA256 Fingerprint: a0:40:92:9a:02:ce:53:b4:ac:f4:f2:ff:c6:98:1c:e4:49:6f:75:5e:6d:45:fe:0b:2a:69:2b:cd:52:52:3f:36 +-----BEGIN CERTIFICATE----- +MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1Ix +DzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5k +IFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMT +N0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9v +dENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAxMTIxWjCBpjELMAkG +A1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNh +ZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkx +QDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1 +dGlvbnMgUm9vdENBIDIwMTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC +AQDC+Kk/G4n8PDwEXT2QNrCROnk8ZlrvbTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA +4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+ehiGsxr/CL0BgzuNtFajT0 +AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+6PAQZe10 +4S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06C +ojXdFPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV +9Cz82XBST3i4vTwri5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrD +gfgXy5I2XdGj2HUb4Ysn6npIQf1FGQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6 +Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2fu/Z8VFRfS0myGlZYeCsargq +NhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9muiNX6hME6wGko +LfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc +Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNV +HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVd +ctA4GGqd83EkVAswDQYJKoZIhvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0I +XtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+D1hYc2Ryx+hFjtyp8iY/xnmMsVMI +M4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrMd/K4kPFox/la/vot +9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+yd+2V +Z5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/ea +j8GsGsVn82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnh +X9izjFk0WaSrT2y7HxjbdavYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQ +l033DlZdwJVqwjbDG2jJ9SrcR5q+ss7FJej6A7na+RZukYT1HCjI/CbM1xyQVqdf +bzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVtJ94Cj8rDtSvK6evIIVM4 +pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGaJI7ZjnHK +e7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0 +vm9qp/UsQu0yrbYhnr68 +-----END CERTIFICATE----- + +# Issuer: CN=Hellenic Academic and Research Institutions ECC RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority +# Subject: CN=Hellenic Academic and Research Institutions ECC RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority +# Label: "Hellenic Academic and Research Institutions ECC RootCA 2015" +# Serial: 0 +# MD5 Fingerprint: 81:e5:b4:17:eb:c2:f5:e1:4b:0d:41:7b:49:92:fe:ef +# SHA1 Fingerprint: 9f:f1:71:8d:92:d5:9a:f3:7d:74:97:b4:bc:6f:84:68:0b:ba:b6:66 +# SHA256 Fingerprint: 44:b5:45:aa:8a:25:e6:5a:73:ca:15:dc:27:fc:36:d2:4c:1c:b9:95:3a:06:65:39:b1:15:82:dc:48:7b:48:33 +-----BEGIN CERTIFICATE----- +MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzAN +BgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl +c2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hl +bGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgRUNDIFJv +b3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEwMzcxMlowgaoxCzAJ +BgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmljIEFj +YWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5 +MUQwQgYDVQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0 +dXRpb25zIEVDQyBSb290Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKg +QehLgoRc4vgxEZmGZE4JJS+dQS8KrjVPdJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJa +jq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoKVlp8aQuqgAkkbH7BRqNC +MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLQi +C4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaep +lSTAGiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7Sof +TUwJCA3sS61kFyjndc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR +-----END CERTIFICATE----- + +# Issuer: CN=ISRG Root X1 O=Internet Security Research Group +# Subject: CN=ISRG Root X1 O=Internet Security Research Group +# Label: "ISRG Root X1" +# Serial: 172886928669790476064670243504169061120 +# MD5 Fingerprint: 0c:d2:f9:e0:da:17:73:e9:ed:86:4d:a5:e3:70:e7:4e +# SHA1 Fingerprint: ca:bd:2a:79:a1:07:6a:31:f2:1d:25:36:35:cb:03:9d:43:29:a5:e8 +# SHA256 Fingerprint: 96:bc:ec:06:26:49:76:f3:74:60:77:9a:cf:28:c5:a7:cf:e8:a3:c0:aa:e1:1a:8f:fc:ee:05:c0:bd:df:08:c6 +-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw +TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh +cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 +WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu +ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY +MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc +h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ +0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U +A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW +T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH +B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC +B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv +KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn +OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn +jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw +qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI +rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq +hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL +ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ +3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK +NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 +ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur +TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC +jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc +oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq +4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA +mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d +emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= +-----END CERTIFICATE----- + +# Issuer: O=FNMT-RCM OU=AC RAIZ FNMT-RCM +# Subject: O=FNMT-RCM OU=AC RAIZ FNMT-RCM +# Label: "AC RAIZ FNMT-RCM" +# Serial: 485876308206448804701554682760554759 +# MD5 Fingerprint: e2:09:04:b4:d3:bd:d1:a0:14:fd:1a:d2:47:c4:57:1d +# SHA1 Fingerprint: ec:50:35:07:b2:15:c4:95:62:19:e2:a8:9a:5b:42:99:2c:4c:2c:20 +# SHA256 Fingerprint: eb:c5:57:0c:29:01:8c:4d:67:b1:aa:12:7b:af:12:f7:03:b4:61:1e:bc:17:b7:da:b5:57:38:94:17:9b:93:fa +-----BEGIN CERTIFICATE----- +MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsx +CzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJ +WiBGTk1ULVJDTTAeFw0wODEwMjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJ +BgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBG +Tk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALpxgHpMhm5/ +yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcfqQgf +BBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAz +WHFctPVrbtQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxF +tBDXaEAUwED653cXeuYLj2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z +374jNUUeAlz+taibmSXaXvMiwzn15Cou08YfxGyqxRxqAQVKL9LFwag0Jl1mpdIC +IfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mwWsXmo8RZZUc1g16p6DUL +mbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnTtOmlcYF7 +wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peS +MKGJ47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2 +ZSysV4999AeU14ECll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMet +UqIJ5G+GR4of6ygnXYMgrwTJbFaai0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUw +AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFPd9xf3E6Jobd2Sn9R2gzL+H +YJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1odHRwOi8vd3d3 +LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD +nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1 +RXxlDPiyN8+sD8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYM +LVN0V2Ue1bLdI4E7pWYjJ2cJj+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf +77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrTQfv6MooqtyuGC2mDOL7Nii4LcK2N +JpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW+YJF1DngoABd15jm +fZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7Ixjp +6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp +1txyM/1d8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B +9kiABdcPUXmsEKvU7ANm5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wok +RqEIr9baRRmW1FMdW4R58MD3R++Lj8UGrp1MYp3/RgT408m2ECVAdf4WqslKYIYv +uu8wd+RU4riEmViAqhOLUTpPSPaLtrM= +-----END CERTIFICATE----- + +# Issuer: CN=Amazon Root CA 1 O=Amazon +# Subject: CN=Amazon Root CA 1 O=Amazon +# Label: "Amazon Root CA 1" +# Serial: 143266978916655856878034712317230054538369994 +# MD5 Fingerprint: 43:c6:bf:ae:ec:fe:ad:2f:18:c6:88:68:30:fc:c8:e6 +# SHA1 Fingerprint: 8d:a7:f9:65:ec:5e:fc:37:91:0f:1c:6e:59:fd:c1:cc:6a:6e:de:16 +# SHA256 Fingerprint: 8e:cd:e6:88:4f:3d:87:b1:12:5b:a3:1a:c3:fc:b1:3d:70:16:de:7f:57:cc:90:4f:e1:cb:97:c6:ae:98:19:6e +-----BEGIN CERTIFICATE----- +MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF +ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 +b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL +MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv +b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj +ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM +9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw +IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6 +VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L +93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm +jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA +A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI +U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs +N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv +o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU +5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy +rqXRfboQnoZsG4q5WTP468SQvvG5 +-----END CERTIFICATE----- + +# Issuer: CN=Amazon Root CA 2 O=Amazon +# Subject: CN=Amazon Root CA 2 O=Amazon +# Label: "Amazon Root CA 2" +# Serial: 143266982885963551818349160658925006970653239 +# MD5 Fingerprint: c8:e5:8d:ce:a8:42:e2:7a:c0:2a:5c:7c:9e:26:bf:66 +# SHA1 Fingerprint: 5a:8c:ef:45:d7:a6:98:59:76:7a:8c:8b:44:96:b5:78:cf:47:4b:1a +# SHA256 Fingerprint: 1b:a5:b2:aa:8c:65:40:1a:82:96:01:18:f8:0b:ec:4f:62:30:4d:83:ce:c4:71:3a:19:c3:9c:01:1e:a4:6d:b4 +-----BEGIN CERTIFICATE----- +MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwF +ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 +b24gUm9vdCBDQSAyMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTEL +MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv +b3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK2Wny2cSkxK +gXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4kHbZ +W0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg +1dKmSYXpN+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K +8nu+NQWpEjTj82R0Yiw9AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r +2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvdfLC6HM783k81ds8P+HgfajZRRidhW+me +z/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAExkv8LV/SasrlX6avvDXbR +8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSSbtqDT6Zj +mUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz +7Mt0Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6 ++XUyo05f7O0oYtlNc/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI +0u1ufm8/0i2BWSlmy5A5lREedCf+3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMB +Af8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSwDPBMMPQFWAJI/TPlUq9LhONm +UjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oAA7CXDpO8Wqj2 +LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY ++gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kS +k5Nrp+gvU5LEYFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl +7uxMMne0nxrpS10gxdr9HIcWxkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygm +btmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQgj9sAq+uEjonljYE1x2igGOpm/Hl +urR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbWaQbLU8uz/mtBzUF+ +fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoVYh63 +n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE +76KlXIx3KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H +9jVlpNMKVv/1F2Rs76giJUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT +4PsJYGw= +-----END CERTIFICATE----- + +# Issuer: CN=Amazon Root CA 3 O=Amazon +# Subject: CN=Amazon Root CA 3 O=Amazon +# Label: "Amazon Root CA 3" +# Serial: 143266986699090766294700635381230934788665930 +# MD5 Fingerprint: a0:d4:ef:0b:f7:b5:d8:49:95:2a:ec:f5:c4:fc:81:87 +# SHA1 Fingerprint: 0d:44:dd:8c:3c:8c:1a:1a:58:75:64:81:e9:0f:2e:2a:ff:b3:d2:6e +# SHA256 Fingerprint: 18:ce:6c:fe:7b:f1:4e:60:b2:e3:47:b8:df:e8:68:cb:31:d0:2e:bb:3a:da:27:15:69:f5:03:43:b4:6d:b3:a4 +-----BEGIN CERTIFICATE----- +MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5 +MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g +Um9vdCBDQSAzMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG +A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg +Q0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZBf8ANm+gBG1bG8lKl +ui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjrZt6j +QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSr +ttvXBp43rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkr +BqWTrBqYaGFy+uGh0PsceGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteM +YyRIHN8wfdVoOw== +-----END CERTIFICATE----- + +# Issuer: CN=Amazon Root CA 4 O=Amazon +# Subject: CN=Amazon Root CA 4 O=Amazon +# Label: "Amazon Root CA 4" +# Serial: 143266989758080763974105200630763877849284878 +# MD5 Fingerprint: 89:bc:27:d5:eb:17:8d:06:6a:69:d5:fd:89:47:b4:cd +# SHA1 Fingerprint: f6:10:84:07:d6:f8:bb:67:98:0c:c2:e2:44:c2:eb:ae:1c:ef:63:be +# SHA256 Fingerprint: e3:5d:28:41:9e:d0:20:25:cf:a6:90:38:cd:62:39:62:45:8d:a5:c6:95:fb:de:a3:c2:2b:0b:fb:25:89:70:92 +-----BEGIN CERTIFICATE----- +MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5 +MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g +Um9vdCBDQSA0MB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG +A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg +Q0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN/sGKe0uoe0ZLY7Bi +9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri83Bk +M6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB +/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WB +MAoGCCqGSM49BAMDA2gAMGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlw +CkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1AE47xDqUEpHJWEadIRNyp4iciuRMStuW +1KyLa2tJElMzrdfkviT8tQp21KW8EA== +-----END CERTIFICATE----- + +# Issuer: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM +# Subject: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM +# Label: "TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1" +# Serial: 1 +# MD5 Fingerprint: dc:00:81:dc:69:2f:3e:2f:b0:3b:f6:3d:5a:91:8e:49 +# SHA1 Fingerprint: 31:43:64:9b:ec:ce:27:ec:ed:3a:3f:0b:8f:0d:e4:e8:91:dd:ee:ca +# SHA256 Fingerprint: 46:ed:c3:68:90:46:d5:3a:45:3f:b3:10:4a:b8:0d:ca:ec:65:8b:26:60:ea:16:29:dd:7e:86:79:90:64:87:16 +-----BEGIN CERTIFICATE----- +MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIx +GDAWBgNVBAcTD0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxp +bXNlbCB2ZSBUZWtub2xvamlrIEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0w +KwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24gTWVya2V6aSAtIEthbXUgU00xNjA0 +BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRpZmlrYXNpIC0gU3Vy +dW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYDVQQG +EwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXll +IEJpbGltc2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklU +QUsxLTArBgNVBAsTJEthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBT +TTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11IFNNIFNTTCBLb2sgU2VydGlmaWthc2kg +LSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr3UwM6q7 +a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y86Ij5iySr +LqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INr +N3wcwv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2X +YacQuFWQfw4tJzh03+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/ +iSIzL+aFCr2lqBs23tPcLG07xxO9WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4f +AJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQUZT/HiobGPN08VFw1+DrtUgxH +V8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL +BQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh +AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPf +IPP54+M638yclNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4 +lzwDGrpDxpa5RXI4s6ehlj2Re37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c +8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0jq5Rm+K37DwhuJi1/FwcJsoz7UMCf +lo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM= +-----END CERTIFICATE----- + +# Issuer: CN=GDCA TrustAUTH R5 ROOT O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. +# Subject: CN=GDCA TrustAUTH R5 ROOT O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. +# Label: "GDCA TrustAUTH R5 ROOT" +# Serial: 9009899650740120186 +# MD5 Fingerprint: 63:cc:d9:3d:34:35:5c:6f:53:a3:e2:08:70:48:1f:b4 +# SHA1 Fingerprint: 0f:36:38:5b:81:1a:25:c3:9b:31:4e:83:ca:e9:34:66:70:cc:74:b4 +# SHA256 Fingerprint: bf:ff:8f:d0:44:33:48:7d:6a:8a:a6:0c:1a:29:76:7a:9f:c2:bb:b0:5e:42:0f:71:3a:13:b9:92:89:1d:38:93 +-----BEGIN CERTIFICATE----- +MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UE +BhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ +IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0 +MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVowYjELMAkGA1UEBhMCQ04xMjAwBgNV +BAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8w +HQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJj +Dp6L3TQsAlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBj +TnnEt1u9ol2x8kECK62pOqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+u +KU49tm7srsHwJ5uu4/Ts765/94Y9cnrrpftZTqfrlYwiOXnhLQiPzLyRuEH3FMEj +qcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ9Cy5WmYqsBebnh52nUpm +MUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQxXABZG12 +ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloP +zgsMR6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3Gk +L30SgLdTMEZeS1SZD2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeC +jGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4oR24qoAATILnsn8JuLwwoC8N9VKejveSswoA +HQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx9hoh49pwBiFYFIeFd3mqgnkC +AwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlRMA8GA1UdEwEB +/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg +p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZm +DRd9FBUb1Ov9H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5 +COmSdI31R9KrO9b7eGZONn356ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ry +L3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd+PwyvzeG5LuOmCd+uh8W4XAR8gPf +JWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQHtZa37dG/OaG+svg +IHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBDF8Io +2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV +09tL7ECQ8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQ +XR4EzzffHqhmsYzmIGrv/EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrq +T8p+ck0LcIymSLumoRT2+1hEmRSuqguTaaApJUqlyyvdimYHFngVV3Eb7PVHhPOe +MTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g== +-----END CERTIFICATE----- + +# Issuer: CN=TrustCor RootCert CA-1 O=TrustCor Systems S. de R.L. OU=TrustCor Certificate Authority +# Subject: CN=TrustCor RootCert CA-1 O=TrustCor Systems S. de R.L. OU=TrustCor Certificate Authority +# Label: "TrustCor RootCert CA-1" +# Serial: 15752444095811006489 +# MD5 Fingerprint: 6e:85:f1:dc:1a:00:d3:22:d5:b2:b2:ac:6b:37:05:45 +# SHA1 Fingerprint: ff:bd:cd:e7:82:c8:43:5e:3c:6f:26:86:5c:ca:a8:3a:45:5b:c3:0a +# SHA256 Fingerprint: d4:0e:9c:86:cd:8f:e4:68:c1:77:69:59:f4:9e:a7:74:fa:54:86:84:b6:c4:06:f3:90:92:61:f4:dc:e2:57:5c +-----BEGIN CERTIFICATE----- +MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYD +VQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEk +MCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U +cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29y +IFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkxMjMxMTcyMzE2WjCB +pDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFuYW1h +IENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUG +A1UECwweVHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZU +cnVzdENvciBSb290Q2VydCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEAv463leLCJhJrMxnHQFgKq1mqjQCj/IDHUHuO1CAmujIS2CNUSSUQIpid +RtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4pQa81QBeCQryJ3pS/C3V +seq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0JEsq1pme +9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CV +EY4hgLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorW +hnAbJN7+KIor0Gqw/Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/ +DeOxCbeKyKsZn3MzUOcwHwYDVR0jBBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcw +DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQAD +ggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5mDo4Nvu7Zp5I +/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf +ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZ +yonnMlo2HD6CqFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djts +L1Ac59v2Z3kf9YKVmgenFK+P3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdN +zl/HHk484IkzlQsPpTLWPFp5LBk= +-----END CERTIFICATE----- + +# Issuer: CN=TrustCor RootCert CA-2 O=TrustCor Systems S. de R.L. OU=TrustCor Certificate Authority +# Subject: CN=TrustCor RootCert CA-2 O=TrustCor Systems S. de R.L. OU=TrustCor Certificate Authority +# Label: "TrustCor RootCert CA-2" +# Serial: 2711694510199101698 +# MD5 Fingerprint: a2:e1:f8:18:0b:ba:45:d5:c7:41:2a:bb:37:52:45:64 +# SHA1 Fingerprint: b8:be:6d:cb:56:f1:55:b9:63:d4:12:ca:4e:06:34:c7:94:b2:1c:c0 +# SHA256 Fingerprint: 07:53:e9:40:37:8c:1b:d5:e3:83:6e:39:5d:ae:a5:cb:83:9e:50:46:f1:bd:0e:ae:19:51:cf:10:fe:c7:c9:65 +-----BEGIN CERTIFICATE----- +MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNV +BAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQw +IgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRy +dXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0eTEfMB0GA1UEAwwWVHJ1c3RDb3Ig +Um9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEyMzExNzI2MzlaMIGk +MQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEg +Q2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYD +VQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRy +dXN0Q29yIFJvb3RDZXJ0IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK +AoICAQCnIG7CKqJiJJWQdsg4foDSq8GbZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+ +QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9NkRvRUqdw6VC0xK5mC8tkq +1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1oYxOdqHp +2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nK +DOObXUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hape +az6LMvYHL1cEksr1/p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF +3wP+TfSvPd9cW436cOGlfifHhi5qjxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88 +oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQPeSghYA2FFn3XVDjxklb9tTNM +g9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+CtgrKAmrhQhJ8Z3 +mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh +8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAd +BgNVHQ4EFgQU2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6U +nrybPZx9mCAZ5YwwYrIwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYw +DQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/hOsh80QA9z+LqBrWyOrsGS2h60COX +dKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnpkpfbsEZC89NiqpX+ +MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv2wnL +/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RX +CI/hOWB3S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYa +ZH9bDTMJBzN7Bj8RpFxwPIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW +2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dvDDqPys/cA8GiCcjl/YBeyGBCARsaU1q7 +N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYURpFHmygk71dSTlxCnKr3 +Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANExdqtvArB +As8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp +5KeXRKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu +1uwJ +-----END CERTIFICATE----- + +# Issuer: CN=TrustCor ECA-1 O=TrustCor Systems S. de R.L. OU=TrustCor Certificate Authority +# Subject: CN=TrustCor ECA-1 O=TrustCor Systems S. de R.L. OU=TrustCor Certificate Authority +# Label: "TrustCor ECA-1" +# Serial: 9548242946988625984 +# MD5 Fingerprint: 27:92:23:1d:0a:f5:40:7c:e9:e6:6b:9d:d8:f5:e7:6c +# SHA1 Fingerprint: 58:d1:df:95:95:67:6b:63:c0:f0:5b:1c:17:4d:8b:84:0b:c8:78:bd +# SHA256 Fingerprint: 5a:88:5d:b1:9c:01:d9:12:c5:75:93:88:93:8c:af:bb:df:03:1a:b2:d4:8e:91:ee:15:58:9b:42:97:1d:03:9c +-----BEGIN CERTIFICATE----- +MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYD +VQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEk +MCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U +cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxFzAVBgNVBAMMDlRydXN0Q29y +IEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3MjgwN1owgZwxCzAJBgNV +BAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQw +IgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRy +dXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3Ig +RUNBLTEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb +3w9U73NjKYKtR8aja+3+XzP4Q1HpGjORMRegdMTUpwHmspI+ap3tDvl0mEDTPwOA +BoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23xFUfJ3zSCNV2HykVh0A5 +3ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmcp0yJF4Ou +owReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/ +wZ0+fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZF +ZtS6mFjBAgMBAAGjYzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAf +BgNVHSMEGDAWgBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/ +MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAQEABT41XBVwm8nHc2Fv +civUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u/ukZMjgDfxT2 +AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F +hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50 +soIipX1TH0XsJ5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BI +WJZpTdwHjFGTot+fDz2LYLSCjaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1Wi +tJ/X5g== +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com Root Certification Authority RSA O=SSL Corporation +# Subject: CN=SSL.com Root Certification Authority RSA O=SSL Corporation +# Label: "SSL.com Root Certification Authority RSA" +# Serial: 8875640296558310041 +# MD5 Fingerprint: 86:69:12:c0:70:f1:ec:ac:ac:c2:d5:bc:a5:5b:a1:29 +# SHA1 Fingerprint: b7:ab:33:08:d1:ea:44:77:ba:14:80:12:5a:6f:bd:a9:36:49:0c:bb +# SHA256 Fingerprint: 85:66:6a:56:2e:e0:be:5c:e9:25:c1:d8:89:0a:6f:76:a8:7e:c1:6d:4d:7d:5f:29:ea:74:19:cf:20:12:3b:69 +-----BEGIN CERTIFICATE----- +MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UE +BhMCVVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQK +DA9TU0wgQ29ycG9yYXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYwMjEyMTczOTM5WhcNNDEwMjEyMTcz +OTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hv +dXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv +bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcN +AQEBBQADggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2R +xFdHaxh3a3by/ZPkPQ/CFp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aX +qhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcC +C52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/geoeOy3ZExqysdBP+lSgQ3 +6YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkpk8zruFvh +/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrF +YD3ZfBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93E +JNyAKoFBbZQ+yODJgUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVc +US4cK38acijnALXRdMbX5J+tB5O2UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8 +ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi81xtZPCvM8hnIk2snYxnP/Okm ++Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4sbE6x/c+cCbqi +M+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV +HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4G +A1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGV +cpNxJK1ok1iOMq8bs3AD/CUrdIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBc +Hadm47GUBwwyOabqG7B52B2ccETjit3E+ZUfijhDPwGFpUenPUayvOUiaPd7nNgs +PgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAslu1OJD7OAUN5F7kR/ +q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjqerQ0 +cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jr +a6x+3uxjMxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90I +H37hVZkLId6Tngr75qNJvTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/Y +K9f1JmzJBjSWFupwWRoyeXkLtoh/D1JIPb9s2KJELtFOt3JY04kTlf5Eq/jXixtu +nLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406ywKBjYZC6VWg3dGq2ktuf +oYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NIWuuA8ShY +Ic2wBlX7Jz9TkHCpBB5XJ7k= +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com Root Certification Authority ECC O=SSL Corporation +# Subject: CN=SSL.com Root Certification Authority ECC O=SSL Corporation +# Label: "SSL.com Root Certification Authority ECC" +# Serial: 8495723813297216424 +# MD5 Fingerprint: 2e:da:e4:39:7f:9c:8f:37:d1:70:9f:26:17:51:3a:8e +# SHA1 Fingerprint: c3:19:7c:39:24:e6:54:af:1b:c4:ab:20:95:7a:e2:c3:0e:13:02:6a +# SHA256 Fingerprint: 34:17:bb:06:cc:60:07:da:1b:96:1c:92:0b:8a:b4:ce:3f:ad:82:0e:4a:a3:0b:9a:cb:c4:a7:4e:bd:ce:bc:65 +-----BEGIN CERTIFICATE----- +MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMC +VVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9T +U0wgQ29ycG9yYXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0 +aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEyMTgxNDAzWhcNNDEwMjEyMTgxNDAz +WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hvdXN0 +b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNvbSBS +b290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB +BAAiA2IABEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI +7Z4INcgn64mMU1jrYor+8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPg +CemB+vNH06NjMGEwHQYDVR0OBBYEFILRhXMw5zUE044CkvvlpNHEIejNMA8GA1Ud +EwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTTjgKS++Wk0cQh6M0wDgYD +VR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCWe+0F+S8T +kdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+ +gA0z5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com EV Root Certification Authority RSA R2 O=SSL Corporation +# Subject: CN=SSL.com EV Root Certification Authority RSA R2 O=SSL Corporation +# Label: "SSL.com EV Root Certification Authority RSA R2" +# Serial: 6248227494352943350 +# MD5 Fingerprint: e1:1e:31:58:1a:ae:54:53:02:f6:17:6a:11:7b:4d:95 +# SHA1 Fingerprint: 74:3a:f0:52:9b:d0:32:a0:f4:4a:83:cd:d4:ba:a9:7b:7c:2e:c4:9a +# SHA256 Fingerprint: 2e:7b:f1:6c:c2:24:85:a7:bb:e2:aa:86:96:75:07:61:b0:ae:39:be:3b:2f:e9:d0:cc:6d:4e:f7:34:91:42:5c +-----BEGIN CERTIFICATE----- +MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNV +BAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UE +CgwPU1NMIENvcnBvcmF0aW9uMTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2Vy +dGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMB4XDTE3MDUzMTE4MTQzN1oXDTQy +MDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4G +A1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYDVQQD +DC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvq +M0fNTPl9fb69LT3w23jhhqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssuf +OePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7wcXHswxzpY6IXFJ3vG2fThVUCAtZJycxa +4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTOZw+oz12WGQvE43LrrdF9 +HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+B6KjBSYR +aZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcA +b9ZhCBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQ +Gp8hLH94t2S42Oim9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQV +PWKchjgGAGYS5Fl2WlPAApiiECtoRHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMO +pgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+SlmJuwgUHfbSguPvuUCYHBBXtSu +UDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48+qvWBkofZ6aY +MBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV +HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa4 +9QaAJadz20ZpqJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBW +s47LCp1Jjr+kxJG7ZhcFUZh1++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5 +Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nxY/hoLVUE0fKNsKTPvDxeH3jnpaAg +cLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2GguDKBAdRUNf/ktUM +79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDzOFSz +/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXt +ll9ldDz7CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEm +Kf7GUmG6sXP/wwyc5WxqlD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKK +QbNmC1r7fSOl8hqw/96bg5Qu0T/fkreRrwU7ZcegbLHNYhLDkBvjJc40vG93drEQ +w/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1hlMYegouCRw2n5H9gooi +S9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX9hwJ1C07 +mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w== +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com EV Root Certification Authority ECC O=SSL Corporation +# Subject: CN=SSL.com EV Root Certification Authority ECC O=SSL Corporation +# Label: "SSL.com EV Root Certification Authority ECC" +# Serial: 3182246526754555285 +# MD5 Fingerprint: 59:53:22:65:83:42:01:54:c0:ce:42:b9:5a:7c:f2:90 +# SHA1 Fingerprint: 4c:dd:51:a3:d1:f5:20:32:14:b0:c6:c5:32:23:03:91:c7:46:42:6d +# SHA256 Fingerprint: 22:a2:c1:f7:bd:ed:70:4c:c1:e7:01:b5:f4:08:c3:10:88:0f:e9:56:b5:de:2a:4a:44:f9:9c:87:3a:25:a7:c8 +-----BEGIN CERTIFICATE----- +MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMC +VVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9T +U0wgQ29ycG9yYXRpb24xNDAyBgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEyMTgxNTIzWhcNNDEwMjEyMTgx +NTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hv +dXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NMLmNv +bSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49 +AgEGBSuBBAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMA +VIbc/R/fALhBYlzccBYy3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1Kthku +WnBaBu2+8KGwytAJKaNjMGEwHQYDVR0OBBYEFFvKXuXe0oGqzagtZFG22XKbl+ZP +MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe5d7SgarNqC1kUbbZcpuX +5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJN+vp1RPZ +ytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZg +h5Mmm7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg== +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R6 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R6 +# Label: "GlobalSign Root CA - R6" +# Serial: 1417766617973444989252670301619537 +# MD5 Fingerprint: 4f:dd:07:e4:d4:22:64:39:1e:0c:37:42:ea:d1:c6:ae +# SHA1 Fingerprint: 80:94:64:0e:b5:a7:a1:ca:11:9c:1f:dd:d5:9f:81:02:63:a7:fb:d1 +# SHA256 Fingerprint: 2c:ab:ea:fe:37:d0:6c:a2:2a:ba:73:91:c0:03:3d:25:98:29:52:c4:53:64:73:49:76:3a:3a:b5:ad:6c:cf:69 +-----BEGIN CERTIFICATE----- +MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEg +MB4GA1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2Jh +bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQx +MjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSNjET +MBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCAiIwDQYJ +KoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQssgrRI +xutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1k +ZguSgMpE3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxD +aNc9PIrFsmbVkJq3MQbFvuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJw +LnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqMPKq0pPbzlUoSB239jLKJz9CgYXfIWHSw +1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+azayOeSsJDa38O+2HBNX +k7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05OWgtH8wY2 +SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/h +bguyCLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4n +WUx2OVvq+aWh2IMP0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpY +rZxCRXluDocZXFSxZba/jJvcE+kNb7gu3GduyYsRtYQUigAZcIN5kZeR1Bonvzce +MgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTAD +AQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNVHSMEGDAWgBSu +bAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN +nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGt +Ixg93eFyRJa0lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr61 +55wsTLxDKZmOMNOsIeDjHfrYBzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLj +vUYAGm0CuiVdjaExUd1URhxN25mW7xocBFymFe944Hn+Xds+qkxV/ZoVqW/hpvvf +cDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr3TsTjxKM4kEaSHpz +oHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB10jZp +nOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfs +pA9MRf/TuTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+v +JJUEeKgDu+6B5dpffItKoZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R +8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+tJDfLRVpOoERIyNiwmcUVhAn21klJwGW4 +5hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA= +-----END CERTIFICATE----- + +# Issuer: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed +# Subject: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed +# Label: "OISTE WISeKey Global Root GC CA" +# Serial: 44084345621038548146064804565436152554 +# MD5 Fingerprint: a9:d6:b9:2d:2f:93:64:f8:a5:69:ca:91:e9:68:07:23 +# SHA1 Fingerprint: e0:11:84:5e:34:de:be:88:81:b9:9c:f6:16:26:d1:96:1f:c3:b9:31 +# SHA256 Fingerprint: 85:60:f9:1c:36:24:da:ba:95:70:b5:fe:a0:db:e3:6f:f1:1a:83:23:be:94:86:85:4f:b3:f3:4a:55:71:19:8d +-----BEGIN CERTIFICATE----- +MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQsw +CQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91 +bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwg +Um9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRaFw00MjA1MDkwOTU4MzNaMG0xCzAJ +BgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBGb3Vu +ZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2JhbCBS +b290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4ni +eUqjFqdrVCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4W +p2OQ0jnUsYd4XxiWD1AbNTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8E +BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7T +rYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0EAwMDaAAwZQIwJsdpW9zV +57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtkAjEA2zQg +Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9 +-----END CERTIFICATE----- + +# Issuer: CN=GTS Root R1 O=Google Trust Services LLC +# Subject: CN=GTS Root R1 O=Google Trust Services LLC +# Label: "GTS Root R1" +# Serial: 146587175971765017618439757810265552097 +# MD5 Fingerprint: 82:1a:ef:d4:d2:4a:f2:9f:e2:3d:97:06:14:70:72:85 +# SHA1 Fingerprint: e1:c9:50:e6:ef:22:f8:4c:56:45:72:8b:92:20:60:d7:d5:a7:a3:e8 +# SHA256 Fingerprint: 2a:57:54:71:e3:13:40:bc:21:58:1c:bd:2c:f1:3e:15:84:63:20:3e:ce:94:bc:f9:d3:cc:19:6b:f0:9a:54:72 +-----BEGIN CERTIFICATE----- +MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBH +MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExM +QzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIy +MDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNl +cnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaM +f/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vX +mX7wCl7raKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7 +zUjwTcLCeoiKu7rPWRnWr4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0P +fyblqAj+lug8aJRT7oM6iCsVlgmy4HqMLnXWnOunVmSPlk9orj2XwoSPwLxAwAtc +vfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk9+aCEI3oncKKiPo4 +Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zqkUsp +zBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOO +Rc92wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYW +k70paDPvOmbsB4om3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+ +DVrNVjzRlwW5y0vtOUucxD/SVRNuJLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgF +lQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV +HQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQADggIBADiW +Cu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1 +d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6Z +XPYfcX3v73svfuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZR +gyFmxhE+885H7pwoHyXa/6xmld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3 +d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9bgsiG1eGZbYwE8na6SfZu6W0eX6Dv +J4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq4BjFbkerQUIpm/Zg +DdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWErtXvM ++SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyy +F62ARPBopY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9 +SQ98POyDGCBDTtWTurQ0sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdws +E3PYJ/HQcu51OyLemGhmW/HGY0dVHLqlCFF1pkgl +-----END CERTIFICATE----- + +# Issuer: CN=GTS Root R2 O=Google Trust Services LLC +# Subject: CN=GTS Root R2 O=Google Trust Services LLC +# Label: "GTS Root R2" +# Serial: 146587176055767053814479386953112547951 +# MD5 Fingerprint: 44:ed:9a:0e:a4:09:3b:00:f2:ae:4c:a3:c6:61:b0:8b +# SHA1 Fingerprint: d2:73:96:2a:2a:5e:39:9f:73:3f:e1:c7:1e:64:3f:03:38:34:fc:4d +# SHA256 Fingerprint: c4:5d:7b:b0:8e:6d:67:e6:2e:42:35:11:0b:56:4e:5f:78:fd:92:ef:05:8c:84:0a:ea:4e:64:55:d7:58:5c:60 +-----BEGIN CERTIFICATE----- +MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBH +MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExM +QzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIy +MDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNl +cnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3Lv +CvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3Kg +GjSY6Dlo7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9Bu +XvAuMC6C/Pq8tBcKSOWIm8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOd +re7kRXuJVfeKH2JShBKzwkCX44ofR5GmdFrS+LFjKBC4swm4VndAoiaYecb+3yXu +PuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7MkogwTZq9TwtImoS1 +mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJGr61K +8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqj +x5RWIr9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsR +nTKaG73VululycslaVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0 +kzCqgc7dGtxRcw1PcOnlthYhGXmy5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9Ok +twIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV +HQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQADggIBALZp +8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT +vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiT +z9D2PGcDFWEJ+YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiA +pJiS4wGWAqoC7o87xdFtCjMwc3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvb +pxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3DaWsYDQvTtN6LwG1BUSw7YhN4ZKJmB +R64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5rn/WkhLx3+WuXrD5R +RaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56GtmwfuNmsk +0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC +5AwiWVIQ7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiF +izoHCBy69Y9Vmhh1fuXsgWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLn +yOd/xCxgXS/Dr55FBcOEArf9LAhST4Ldo/DUhgkC +-----END CERTIFICATE----- + +# Issuer: CN=GTS Root R3 O=Google Trust Services LLC +# Subject: CN=GTS Root R3 O=Google Trust Services LLC +# Label: "GTS Root R3" +# Serial: 146587176140553309517047991083707763997 +# MD5 Fingerprint: 1a:79:5b:6b:04:52:9c:5d:c7:74:33:1b:25:9a:f9:25 +# SHA1 Fingerprint: 30:d4:24:6f:07:ff:db:91:89:8a:0b:e9:49:66:11:eb:8c:5e:46:e5 +# SHA256 Fingerprint: 15:d5:b8:77:46:19:ea:7d:54:ce:1c:a6:d0:b0:c4:03:e0:37:a9:17:f1:31:e8:a0:4e:1e:6b:7a:71:ba:bc:e5 +-----BEGIN CERTIFICATE----- +MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQsw +CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU +MBIGA1UEAxMLR1RTIFJvb3QgUjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw +MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp +Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout +736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2A +DDL24CejQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud +DgQWBBTB8Sa6oC2uhYHP0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFuk +fCPAlaUs3L6JbyO5o91lAFJekazInXJ0glMLfalAvWhgxeG4VDvBNhcl2MG9AjEA +njWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOaKaqW04MjyaR7YbPMAuhd +-----END CERTIFICATE----- + +# Issuer: CN=GTS Root R4 O=Google Trust Services LLC +# Subject: CN=GTS Root R4 O=Google Trust Services LLC +# Label: "GTS Root R4" +# Serial: 146587176229350439916519468929765261721 +# MD5 Fingerprint: 5d:b6:6a:c4:60:17:24:6a:1a:99:a8:4b:ee:5e:b4:26 +# SHA1 Fingerprint: 2a:1d:60:27:d9:4a:b1:0a:1c:4d:91:5c:cd:33:a0:cb:3e:2d:54:cb +# SHA256 Fingerprint: 71:cc:a5:39:1f:9e:79:4b:04:80:25:30:b3:63:e1:21:da:8a:30:43:bb:26:66:2f:ea:4d:ca:7f:c9:51:a4:bd +-----BEGIN CERTIFICATE----- +MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQsw +CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU +MBIGA1UEAxMLR1RTIFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw +MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp +Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzu +hXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/l +xKvRHYqjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud +DgQWBBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0 +CMRw3J5QdCHojXohw0+WbhXRIjVhLfoIN+4Zba3bssx9BzT1YBkstTTZbyACMANx +sbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11xzPKwTdb+mciUqXWi4w== +-----END CERTIFICATE----- + +# Issuer: CN=UCA Global G2 Root O=UniTrust +# Subject: CN=UCA Global G2 Root O=UniTrust +# Label: "UCA Global G2 Root" +# Serial: 124779693093741543919145257850076631279 +# MD5 Fingerprint: 80:fe:f0:c4:4a:f0:5c:62:32:9f:1c:ba:78:a9:50:f8 +# SHA1 Fingerprint: 28:f9:78:16:19:7a:ff:18:25:18:aa:44:fe:c1:a0:ce:5c:b6:4c:8a +# SHA256 Fingerprint: 9b:ea:11:c9:76:fe:01:47:64:c1:be:56:a6:f9:14:b5:a5:60:31:7a:bd:99:88:39:33:82:e5:16:1a:a0:49:3c +-----BEGIN CERTIFICATE----- +MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9 +MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBH +bG9iYWwgRzIgUm9vdDAeFw0xNjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0x +CzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlUcnVzdDEbMBkGA1UEAwwSVUNBIEds +b2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxeYr +b3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmToni9 +kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzm +VHqUwCoV8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/R +VogvGjqNO7uCEeBHANBSh6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDc +C/Vkw85DvG1xudLeJ1uK6NjGruFZfc8oLTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIj +tm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/R+zvWr9LesGtOxdQXGLY +D0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBeKW4bHAyv +j5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6Dl +NaBa4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6 +iIis7nCs+dwp4wwcOxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznP +O6Q0ibd5Ei9Hxeepl2n8pndntd978XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/ +BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFIHEjMz15DD/pQwIX4wV +ZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo5sOASD0Ee/oj +L3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5 +1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl +1qnN3e92mI0ADs0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oU +b3n09tDh05S60FdRvScFDcH9yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LV +PtateJLbXDzz2K36uGt/xDYotgIVilQsnLAXc47QN6MUPJiVAAwpBVueSUmxX8fj +y88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHojhJi6IjMtX9Gl8Cb +EGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZkbxqg +DMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI ++Vg7RE+xygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGy +YiGqhkCyLmTTX8jjfhFnRR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bX +UB+K+wb1whnw0A== +-----END CERTIFICATE----- + +# Issuer: CN=UCA Extended Validation Root O=UniTrust +# Subject: CN=UCA Extended Validation Root O=UniTrust +# Label: "UCA Extended Validation Root" +# Serial: 106100277556486529736699587978573607008 +# MD5 Fingerprint: a1:f3:5f:43:c6:34:9b:da:bf:8c:7e:05:53:ad:96:e2 +# SHA1 Fingerprint: a3:a1:b0:6f:24:61:23:4a:e3:36:a5:c2:37:fc:a6:ff:dd:f0:d7:3a +# SHA256 Fingerprint: d4:3a:f9:b3:54:73:75:5c:96:84:fc:06:d7:d8:cb:70:ee:5c:28:e7:73:fb:29:4e:b4:1e:e7:17:22:92:4d:24 +-----BEGIN CERTIFICATE----- +MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBH +MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBF +eHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMx +MDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNV +BAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrsiWog +D4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvS +sPGP2KxFRv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aop +O2z6+I9tTcg1367r3CTueUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dk +sHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR59mzLC52LqGj3n5qiAno8geK+LLNEOfi +c0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH0mK1lTnj8/FtDw5lhIpj +VMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KRel7sFsLz +KuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/ +TuDvB0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41G +sx2VYVdWf6/wFlthWG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs +1+lvK9JKBZP8nm9rZ/+I8U6laUpSNwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQD +fwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS3H5aBZ8eNJr34RQwDwYDVR0T +AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBADaN +l8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR +ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQ +VBcZEhrxH9cMaVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5 +c6sq1WnIeJEmMX3ixzDx/BR4dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp +4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb+7lsq+KePRXBOy5nAliRn+/4Qh8s +t2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOWF3sGPjLtx7dCvHaj +2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwiGpWO +vpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2C +xR9GUeOcGMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmx +cmtpzyKEC2IPrNkZAJSidjzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbM +fjKaiJUINlK73nZfdklJrX+9ZSCyycErdhh2n1ax +-----END CERTIFICATE----- + +# Issuer: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 +# Subject: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 +# Label: "Certigna Root CA" +# Serial: 269714418870597844693661054334862075617 +# MD5 Fingerprint: 0e:5c:30:62:27:eb:5b:bc:d7:ae:62:ba:e9:d5:df:77 +# SHA1 Fingerprint: 2d:0d:52:14:ff:9e:ad:99:24:01:74:20:47:6e:6c:85:27:27:f5:43 +# SHA256 Fingerprint: d4:8d:3d:23:ee:db:50:a4:59:e5:51:97:60:1c:27:77:4b:9d:7b:18:c9:4d:5a:05:95:11:a1:02:50:b9:31:68 +-----BEGIN CERTIFICATE----- +MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAw +WjELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAw +MiA0ODE0NjMwODEwMDAzNjEZMBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0x +MzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjdaMFoxCzAJBgNVBAYTAkZSMRIwEAYD +VQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYzMDgxMDAwMzYxGTAX +BgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw +ggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sO +ty3tRQgXstmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9M +CiBtnyN6tMbaLOQdLNyzKNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPu +I9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8JXrJhFwLrN1CTivngqIkicuQstDuI7pm +TLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16XdG+RCYyKfHx9WzMfgIh +C59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq4NYKpkDf +ePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3Yz +IoejwpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWT +Co/1VTp2lc5ZmIoJlXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1k +JWumIWmbat10TWuXekG9qxf5kBdIjzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5 +hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp//TBt2dzhauH8XwIDAQABo4IB +GjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE +FBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of +1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczov +L3d3d3cuY2VydGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilo +dHRwOi8vY3JsLmNlcnRpZ25hLmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYr +aHR0cDovL2NybC5kaGlteW90aXMuY29tL2NlcnRpZ25hcm9vdGNhLmNybDANBgkq +hkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOItOoldaDgvUSILSo3L +6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxPTGRG +HVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH6 +0BGM+RFq7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncB +lA2c5uk5jR+mUYyZDDl34bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdi +o2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1 +gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS6Cvu5zHbugRqh5jnxV/v +faci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaYtlu3zM63 +Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayh +jWZSaX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw +3kAP+HwV96LOPNdeE4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0= +-----END CERTIFICATE----- + +# Issuer: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI +# Subject: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI +# Label: "emSign Root CA - G1" +# Serial: 235931866688319308814040 +# MD5 Fingerprint: 9c:42:84:57:dd:cb:0b:a7:2e:95:ad:b6:f3:da:bc:ac +# SHA1 Fingerprint: 8a:c7:ad:8f:73:ac:4e:c1:b5:75:4d:a5:40:f4:fc:cf:7c:b5:8e:8c +# SHA256 Fingerprint: 40:f6:af:03:46:a9:9a:a1:cd:1d:55:5a:4e:9c:ce:62:c7:f9:63:46:03:ee:40:66:15:83:3d:c8:c8:d0:03:67 +-----BEGIN CERTIFICATE----- +MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYD +VQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBU +ZWNobm9sb2dpZXMgTGltaXRlZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBH +MTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgxODMwMDBaMGcxCzAJBgNVBAYTAklO +MRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVkaHJhIFRlY2hub2xv +Z2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQz +f2N4aLTNLnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO +8oG0x5ZOrRkVUkr+PHB1cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aq +d7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHWDV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhM +tTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ6DqS0hdW5TUaQBw+jSzt +Od9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrHhQIDAQAB +o0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQD +AgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31x +PaOfG1vR2vjTnGs2vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjM +wiI/aTvFthUvozXGaCocV685743QNcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6d +GNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q+Mri/Tm3R7nrft8EI6/6nAYH +6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeihU80Bv2noWgby +RQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx +iN66zB+Afko= +-----END CERTIFICATE----- + +# Issuer: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI +# Subject: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI +# Label: "emSign ECC Root CA - G3" +# Serial: 287880440101571086945156 +# MD5 Fingerprint: ce:0b:72:d1:9f:88:8e:d0:50:03:e8:e3:b8:8b:67:40 +# SHA1 Fingerprint: 30:43:fa:4f:f2:57:dc:a0:c3:80:ee:2e:58:ea:78:b2:3f:e6:bb:c1 +# SHA256 Fingerprint: 86:a1:ec:ba:08:9c:4a:8d:3b:be:27:34:c6:12:ba:34:1d:81:3e:04:3c:f9:e8:a8:62:cd:5c:57:a3:6b:be:6b +-----BEGIN CERTIFICATE----- +MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQG +EwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNo +bm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g +RzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4MTgzMDAwWjBrMQswCQYDVQQGEwJJ +TjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9s +b2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMw +djAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0 +WXTsuwYc58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xyS +fvalY8L1X44uT6EYGQIrMgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuB +zhccLikenEhjQjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggq +hkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+DCBeQyh+KTOgNG3qxrdWB +CUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7jHvrZQnD ++JbNR6iC8hZVdyR+EhCVBCyj +-----END CERTIFICATE----- + +# Issuer: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI +# Subject: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI +# Label: "emSign Root CA - C1" +# Serial: 825510296613316004955058 +# MD5 Fingerprint: d8:e3:5d:01:21:fa:78:5a:b0:df:ba:d2:ee:2a:5f:68 +# SHA1 Fingerprint: e7:2e:f1:df:fc:b2:09:28:cf:5d:d4:d5:67:37:b1:51:cb:86:4f:01 +# SHA256 Fingerprint: 12:56:09:aa:30:1d:a0:a2:49:b9:7a:82:39:cb:6a:34:21:6f:44:dc:ac:9f:39:54:b1:42:92:f2:e8:c8:60:8f +-----BEGIN CERTIFICATE----- +MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkG +A1UEBhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEg +SW5jMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAw +MFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln +biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNpZ24gUm9v +dCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+upufGZ +BczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZ +HdPIWoU/Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH +3DspVpNqs8FqOp099cGXOFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvH +GPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4VI5b2P/AgNBbeCsbEBEV5f6f9vtKppa+c +xSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleoomslMuoaJuvimUnzYnu3Yy1 +aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+XJGFehiq +TbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL +BQADggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87 +/kOXSTKZEhVb3xEp/6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4 +kqNPEjE2NuLe/gDEo2APJ62gsIq1NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrG +YQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9wC68AivTxEDkigcxHpvOJpkT ++xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQBmIMMMAVSKeo +WXzhriKi4gp6D/piq1JM4fHfyr6DDUI= +-----END CERTIFICATE----- + +# Issuer: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI +# Subject: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI +# Label: "emSign ECC Root CA - C3" +# Serial: 582948710642506000014504 +# MD5 Fingerprint: 3e:53:b3:a3:81:ee:d7:10:f8:d3:b0:1d:17:92:f5:d5 +# SHA1 Fingerprint: b6:af:43:c2:9b:81:53:7d:f6:ef:6b:c3:1f:1f:60:15:0c:ee:48:66 +# SHA256 Fingerprint: bc:4d:80:9b:15:18:9d:78:db:3e:1d:8c:f4:f9:72:6a:79:5d:a1:64:3c:a5:f1:35:8e:1d:db:0e:dc:0d:7e:b3 +-----BEGIN CERTIFICATE----- +MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQG +EwJVUzETMBEGA1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMx +IDAeBgNVBAMTF2VtU2lnbiBFQ0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAw +MFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln +biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQDExdlbVNpZ24gRUND +IFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd6bci +MK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4Ojavti +sIGJAnB9SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0O +BBYEFPtaSNCAIEDyqOkAB2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB +Af8EBTADAQH/MAoGCCqGSM49BAMDA2gAMGUCMQC02C8Cif22TGK6Q04ThHK1rt0c +3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwUZOR8loMRnLDRWmFLpg9J +0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ== +-----END CERTIFICATE----- + +# Issuer: CN=Hongkong Post Root CA 3 O=Hongkong Post +# Subject: CN=Hongkong Post Root CA 3 O=Hongkong Post +# Label: "Hongkong Post Root CA 3" +# Serial: 46170865288971385588281144162979347873371282084 +# MD5 Fingerprint: 11:fc:9f:bd:73:30:02:8a:fd:3f:f3:58:b9:cb:20:f0 +# SHA1 Fingerprint: 58:a2:d0:ec:20:52:81:5b:c1:f3:f8:64:02:24:4e:c2:8e:02:4b:02 +# SHA256 Fingerprint: 5a:2f:c0:3f:0c:83:b0:90:bb:fa:40:60:4b:09:88:44:6c:76:36:18:3d:f9:84:6e:17:10:1a:44:7f:b8:ef:d6 +-----BEGIN CERTIFICATE----- +MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQEL +BQAwbzELMAkGA1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJ +SG9uZyBLb25nMRYwFAYDVQQKEw1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25n +a29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2MDMwMjI5NDZaFw00MjA2MDMwMjI5 +NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtvbmcxEjAQBgNVBAcT +CUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMXSG9u +Z2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK +AoICAQCziNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFO +dem1p+/l6TWZ5Mwc50tfjTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mI +VoBc+L0sPOFMV4i707mV78vH9toxdCim5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV +9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOesL4jpNrcyCse2m5FHomY +2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj0mRiikKY +vLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+Tt +bNe/JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZb +x39ri1UbSsUgYT2uy1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+ +l2oBlKN8W4UdKjk60FSh0Tlxnf0h+bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YK +TE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsGxVd7GYYKecsAyVKvQv83j+Gj +Hno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwIDAQABo2MwYTAP +BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e +i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEw +DQYJKoZIhvcNAQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG +7BJ8dNVI0lkUmcDrudHr9EgwW62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCk +MpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWldy8joRTnU+kLBEUx3XZL7av9YROXr +gZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov+BS5gLNdTaqX4fnk +GMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDceqFS +3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJm +Ozj/2ZQw9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+ +l6mc1X5VTMbeRRAc6uk7nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6c +JfTzPV4e0hz5sy229zdcxsshTrD3mUcYhcErulWuBurQB7Lcq9CClnXO0lD+mefP +L5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB60PZ2Pierc+xYw5F9KBa +LJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fqdBb9HxEG +mpv0 +-----END CERTIFICATE----- + +# Issuer: CN=Entrust Root Certification Authority - G4 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2015 Entrust, Inc. - for authorized use only +# Subject: CN=Entrust Root Certification Authority - G4 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2015 Entrust, Inc. - for authorized use only +# Label: "Entrust Root Certification Authority - G4" +# Serial: 289383649854506086828220374796556676440 +# MD5 Fingerprint: 89:53:f1:83:23:b7:7c:8e:05:f1:8c:71:38:4e:1f:88 +# SHA1 Fingerprint: 14:88:4e:86:26:37:b0:26:af:59:62:5c:40:77:ec:35:29:ba:96:01 +# SHA256 Fingerprint: db:35:17:d1:f6:73:2a:2d:5a:b9:7c:53:3e:c7:07:79:ee:32:70:a6:2f:b4:ac:42:38:37:24:60:e6:f0:1e:88 +-----BEGIN CERTIFICATE----- +MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAw +gb4xCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQL +Ex9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykg +MjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAw +BgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0 +MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYTAlVT +MRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1 +c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJ +bmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3Qg +Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0MIICIjANBgkqhkiG9w0B +AQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3DumSXbcr3DbVZwbPLqGgZ +2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV3imz/f3E +T+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j +5pds8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAM +C1rlLAHGVK/XqsEQe9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73T +DtTUXm6Hnmo9RR3RXRv06QqsYJn7ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNX +wbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5XxNMhIWNlUpEbsZmOeX7m640A +2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV7rtNOzK+mndm +nqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8 +dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwl +N4y6mACXi0mWHv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNj +c0kCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD +VR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9nMA0GCSqGSIb3DQEBCwUAA4ICAQAS +5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4QjbRaZIxowLByQzTS +Gwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht7LGr +hFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/ +B7NTeLUKYvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uI +AeV8KEsD+UmDfLJ/fOPtjqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbw +H5Lk6rWS02FREAutp9lfx1/cH6NcjKF+m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+ +b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKWRGhXxNUzzxkvFMSUHHuk +2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjAJOgc47Ol +IQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk +5F6G+TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuY +n/PIjhs4ViFqUZPTkcpG2om3PVODLAgfi49T3f+sHw== +-----END CERTIFICATE----- + +# Issuer: CN=Microsoft ECC Root Certificate Authority 2017 O=Microsoft Corporation +# Subject: CN=Microsoft ECC Root Certificate Authority 2017 O=Microsoft Corporation +# Label: "Microsoft ECC Root Certificate Authority 2017" +# Serial: 136839042543790627607696632466672567020 +# MD5 Fingerprint: dd:a1:03:e6:4a:93:10:d1:bf:f0:19:42:cb:fe:ed:67 +# SHA1 Fingerprint: 99:9a:64:c3:7f:f4:7d:9f:ab:95:f1:47:69:89:14:60:ee:c4:c3:c5 +# SHA256 Fingerprint: 35:8d:f3:9d:76:4a:f9:e1:b7:66:e9:c9:72:df:35:2e:e1:5c:fa:c2:27:af:6a:d1:d7:0e:8e:4a:6e:dc:ba:02 +-----BEGIN CERTIFICATE----- +MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQsw +CQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYD +VQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIw +MTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4MjMxNjA0WjBlMQswCQYDVQQGEwJV +UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNy +b3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQBgcq +hkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZR +ogPZnZH6thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYb +hGBKia/teQ87zvH2RPUBeMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8E +BTADAQH/MB0GA1UdDgQWBBTIy5lycFIM+Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3 +FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlfXu5gKcs68tvWMoQZP3zV +L8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaReNtUjGUB +iudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M= +-----END CERTIFICATE----- + +# Issuer: CN=Microsoft RSA Root Certificate Authority 2017 O=Microsoft Corporation +# Subject: CN=Microsoft RSA Root Certificate Authority 2017 O=Microsoft Corporation +# Label: "Microsoft RSA Root Certificate Authority 2017" +# Serial: 40975477897264996090493496164228220339 +# MD5 Fingerprint: 10:ff:00:ff:cf:c9:f8:c7:7a:c0:ee:35:8e:c9:0f:47 +# SHA1 Fingerprint: 73:a5:e6:4a:3b:ff:83:16:ff:0e:dc:cc:61:8a:90:6e:4e:ae:4d:74 +# SHA256 Fingerprint: c7:41:f7:0f:4b:2a:8d:88:bf:2e:71:c1:41:22:ef:53:ef:10:eb:a0:cf:a5:e6:4c:fa:20:f4:18:85:30:73:e0 +-----BEGIN CERTIFICATE----- +MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBl +MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw +NAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 +IDIwMTcwHhcNMTkxMjE4MjI1MTIyWhcNNDIwNzE4MjMwMDIzWjBlMQswCQYDVQQG +EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1N +aWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wplZEWCpW9R2LBifOZ +Nt9GkMml7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xztokLaCLeX0 +ZdDMbRnMlfl7rEqUrQ7eS0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1 +HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw71VdyvD/IybLeS2v4I2wDwAW9lcfNcztm +gGTjGqwu+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+dkC0zVJhUXAoP8XFWvLJ +jEm7FFtNyP9nTUwSlq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49FyGcohJUc +aDDv70ngNXtk55iwlNpNhTs+VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaG +YaRSMLl6IE9vDzhTyzMMEyuP1pq9KsgtsRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6 +W6IYZVcSn2i51BVrlMRpIpj0M+Dt+VGOQVDJNE92kKz8OMHY4Xu54+OU4UZpyw4K +UGsTuqwPN1q3ErWQgR5WrlcihtnJ0tHXUeOrO8ZV/R4O03QK0dqq6mm4lyiPSMQH ++FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJClTUFLkqqNfs+avNJVgyeY+Q +W5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/ +BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGC +NxUBBAMCAQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZC +LgLNFgVZJ8og6Lq46BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OC +gMNPOsduET/m4xaRhPtthH80dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6 +tZRGrox/2KJQJWVggEbbMwSubLWYdFQl3JPk+ONVFT24bcMKpBLBaYVu32TxU5nh +SnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbLwVaZOjex/2kskZGT4d9Mozd2 +TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7o7P4NHmJweDyAmH3 +pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5TkshGsRGR +xpl/j8nWZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiApp +GWSZI1b7rCoucL5mxAyE7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9 +dOLITzNy4ZQ5bb0Sr74MTnB8G2+NszKTc0QWbej09+CVgI+WXTik9KveCjCHk9hN +AHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D5KbvtwEwXlGjefVwaaZB +RA+GsCyRxj3qrg+E +-----END CERTIFICATE----- + +# Issuer: CN=e-Szigno Root CA 2017 O=Microsec Ltd. +# Subject: CN=e-Szigno Root CA 2017 O=Microsec Ltd. +# Label: "e-Szigno Root CA 2017" +# Serial: 411379200276854331539784714 +# MD5 Fingerprint: de:1f:f6:9e:84:ae:a7:b4:21:ce:1e:58:7d:d1:84:98 +# SHA1 Fingerprint: 89:d4:83:03:4f:9e:9a:48:80:5f:72:37:d4:a9:a6:ef:cb:7c:1f:d1 +# SHA256 Fingerprint: be:b0:0b:30:83:9b:9b:c3:2c:32:e4:44:79:05:95:06:41:f2:64:21:b1:5e:d0:89:19:8b:51:8a:e2:ea:1b:99 +-----BEGIN CERTIFICATE----- +MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNV +BAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRk +LjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJv +b3QgQ0EgMjAxNzAeFw0xNzA4MjIxMjA3MDZaFw00MjA4MjIxMjA3MDZaMHExCzAJ +BgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMg +THRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25v +IFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJbcPYrYsHtv +xie+RJCxs1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9oMrWGQd+H +Wyx7xf58etqjYzBhMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G +A1UdDgQWBBSHERUI0arBeAyxr87GyZDvvzAEwDAfBgNVHSMEGDAWgBSHERUI0arB +eAyxr87GyZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEAtVfd14pVCzbhhkT61Nlo +jbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxOsvxyqltZ ++efcMQ== +-----END CERTIFICATE----- + +# Issuer: O=CERTSIGN SA OU=certSIGN ROOT CA G2 +# Subject: O=CERTSIGN SA OU=certSIGN ROOT CA G2 +# Label: "certSIGN Root CA G2" +# Serial: 313609486401300475190 +# MD5 Fingerprint: 8c:f1:75:8a:c6:19:cf:94:b7:f7:65:20:87:c3:97:c7 +# SHA1 Fingerprint: 26:f9:93:b4:ed:3d:28:27:b0:b9:4b:a7:e9:15:1d:a3:8d:92:e5:32 +# SHA256 Fingerprint: 65:7c:fe:2f:a7:3f:aa:38:46:25:71:f3:32:a2:36:3a:46:fc:e7:02:09:51:71:07:02:cd:fb:b6:ee:da:33:05 +-----BEGIN CERTIFICATE----- +MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNV +BAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04g +Uk9PVCBDQSBHMjAeFw0xNzAyMDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJ +BgNVBAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJ +R04gUk9PVCBDQSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDF +dRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC46+CjobXXo9X69MhWf05N0Iw +vlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UPHULlj88F0+7cDBrZ +uIt4ImfkabBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTECMYmzPhp +n+Sc8CnTXPnGFiWeI8MgwT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKs +cpc/I1mbySKEwQdPzH/iV8oScLumZfNpdWO9lfsbl83kqK/20U6o2YpxJM02PbyW +xPFsqa7lzw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91QqhngLjYl/rNUssuHLoPj1P +rCy7Lobio3aP5ZMqz6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732jcZZroiF +DsGJ6x9nxUWO/203Nit4ZoORUSs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fx +DTvf95xhszWYijqy7DwaNz9+j5LP2RIUZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgy +LcsUDFDYg2WD7rlcz8sFWkz6GZdr1l0T08JcVLwyc6B49fFtHsufpaafItzRUZ6C +eWRgKRM+o/1Pcmqr4tTluCRVLERLiohEnMqE0yo7AgMBAAGjQjBAMA8GA1UdEwEB +/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSCIS1mxteg4BXrzkwJ +d8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOBywaK8SJJ6ejq +kX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UC +b6741jH/JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQl +qiCA2ClV9+BB/AYm/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0 +OJD7uNGzcgbJceaBxXntC6Z58hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+c +NywRtYK3qq4kNFtyDGkNzVmf9nGvnAvRCjj5BiKDUyUM/FHE5r7iOZULJK2v0ZXk +ltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9o4JFWklWatKcsWMy5WHgUyIO +pwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq2LxndD0UF/tUSxfj +03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55CJD2AhZk +PuXaTH4MNMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE +1LlSVHJ7liXMvGnjSG4N0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MX +QRBdJ3NghVdJIgc= +-----END CERTIFICATE----- + +# Issuer: CN=Trustwave Global Certification Authority O=Trustwave Holdings, Inc. +# Subject: CN=Trustwave Global Certification Authority O=Trustwave Holdings, Inc. +# Label: "Trustwave Global Certification Authority" +# Serial: 1846098327275375458322922162 +# MD5 Fingerprint: f8:1c:18:2d:2f:ba:5f:6d:a1:6c:bc:c7:ab:91:c7:0e +# SHA1 Fingerprint: 2f:8f:36:4f:e1:58:97:44:21:59:87:a5:2a:9a:d0:69:95:26:7f:b5 +# SHA256 Fingerprint: 97:55:20:15:f5:dd:fc:3c:87:88:c0:06:94:45:55:40:88:94:45:00:84:f1:00:86:70:86:bc:1a:2b:b5:8d:c8 +-----BEGIN CERTIFICATE----- +MIIF2jCCA8KgAwIBAgIMBfcOhtpJ80Y1LrqyMA0GCSqGSIb3DQEBCwUAMIGIMQsw +CQYDVQQGEwJVUzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28x +ITAfBgNVBAoMGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1 +c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMx +OTM0MTJaFw00MjA4MjMxOTM0MTJaMIGIMQswCQYDVQQGEwJVUzERMA8GA1UECAwI +SWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2ZSBI +b2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB +ALldUShLPDeS0YLOvR29zd24q88KPuFd5dyqCblXAj7mY2Hf8g+CY66j96xz0Xzn +swuvCAAJWX/NKSqIk4cXGIDtiLK0thAfLdZfVaITXdHG6wZWiYj+rDKd/VzDBcdu +7oaJuogDnXIhhpCujwOl3J+IKMujkkkP7NAP4m1ET4BqstTnoApTAbqOl5F2brz8 +1Ws25kCI1nsvXwXoLG0R8+eyvpJETNKXpP7ScoFDB5zpET71ixpZfR9oWN0EACyW +80OzfpgZdNmcc9kYvkHHNHnZ9GLCQ7mzJ7Aiy/k9UscwR7PJPrhq4ufogXBeQotP +JqX+OsIgbrv4Fo7NDKm0G2x2EOFYeUY+VM6AqFcJNykbmROPDMjWLBz7BegIlT1l +RtzuzWniTY+HKE40Cz7PFNm73bZQmq131BnW2hqIyE4bJ3XYsgjxroMwuREOzYfw +hI0Vcnyh78zyiGG69Gm7DIwLdVcEuE4qFC49DxweMqZiNu5m4iK4BUBjECLzMx10 +coos9TkpoNPnG4CELcU9402x/RpvumUHO1jsQkUm+9jaJXLE9gCxInm943xZYkqc +BW89zubWR2OZxiRvchLIrH+QtAuRcOi35hYQcRfO3gZPSEF9NUqjifLJS3tBEW1n +twiYTOURGa5CgNz7kAXU+FDKvuStx8KU1xad5hePrzb7AgMBAAGjQjBAMA8GA1Ud +EwEB/wQFMAMBAf8wHQYDVR0OBBYEFJngGWcNYtt2s9o9uFvo/ULSMQ6HMA4GA1Ud +DwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAmHNw4rDT7TnsTGDZqRKGFx6W +0OhUKDtkLSGm+J1WE2pIPU/HPinbbViDVD2HfSMF1OQc3Og4ZYbFdada2zUFvXfe +uyk3QAUHw5RSn8pk3fEbK9xGChACMf1KaA0HZJDmHvUqoai7PF35owgLEQzxPy0Q +lG/+4jSHg9bP5Rs1bdID4bANqKCqRieCNqcVtgimQlRXtpla4gt5kNdXElE1GYhB +aCXUNxeEFfsBctyV3lImIJgm4nb1J2/6ADtKYdkNy1GTKv0WBpanI5ojSP5RvbbE +sLFUzt5sQa0WZ37b/TjNuThOssFgy50X31ieemKyJo90lZvkWx3SD92YHJtZuSPT +MaCm/zjdzyBP6VhWOmfD0faZmZ26NraAL4hHT4a/RDqA5Dccprrql5gR0IRiR2Qe +qu5AvzSxnI9O4fKSTx+O856X3vOmeWqJcU9LJxdI/uz0UA9PSX3MReO9ekDFQdxh +VicGaeVyQYHTtgGJoC86cnn+OjC/QezHYj6RS8fZMXZC+fc8Y+wmjHMMfRod6qh8 +h6jCJ3zhM0EPz8/8AKAigJ5Kp28AsEFFtyLKaEjFQqKu3R3y4G5OBVixwJAWKqQ9 +EEC+j2Jjg6mcgn0tAumDMHzLJ8n9HmYAsC7TIS+OMxZsmO0QqAfWzJPP29FpHOTK +yeC2nOnOcXHebD8WpHk= +-----END CERTIFICATE----- + +# Issuer: CN=Trustwave Global ECC P256 Certification Authority O=Trustwave Holdings, Inc. +# Subject: CN=Trustwave Global ECC P256 Certification Authority O=Trustwave Holdings, Inc. +# Label: "Trustwave Global ECC P256 Certification Authority" +# Serial: 4151900041497450638097112925 +# MD5 Fingerprint: 5b:44:e3:8d:5d:36:86:26:e8:0d:05:d2:59:a7:83:54 +# SHA1 Fingerprint: b4:90:82:dd:45:0c:be:8b:5b:b1:66:d3:e2:a4:08:26:cd:ed:42:cf +# SHA256 Fingerprint: 94:5b:bc:82:5e:a5:54:f4:89:d1:fd:51:a7:3d:df:2e:a6:24:ac:70:19:a0:52:05:22:5c:22:a7:8c:cf:a8:b4 +-----BEGIN CERTIFICATE----- +MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYD +VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf +BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3 +YXZlIEdsb2JhbCBFQ0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x +NzA4MjMxOTM1MTBaFw00MjA4MjMxOTM1MTBaMIGRMQswCQYDVQQGEwJVUzERMA8G +A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0 +d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF +Q0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTBZMBMGByqGSM49AgEGCCqG +SM49AwEHA0IABH77bOYj43MyCMpg5lOcunSNGLB4kFKA3TjASh3RqMyTpJcGOMoN +FWLGjgEqZZ2q3zSRLoHB5DOSMcT9CTqmP62jQzBBMA8GA1UdEwEB/wQFMAMBAf8w +DwYDVR0PAQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt0UrrdaVKEJmzsaGLSvcw +CgYIKoZIzj0EAwIDRwAwRAIgB+ZU2g6gWrKuEZ+Hxbb/ad4lvvigtwjzRM4q3wgh +DDcCIC0mA6AFvWvR9lz4ZcyGbbOcNEhjhAnFjXca4syc4XR7 +-----END CERTIFICATE----- + +# Issuer: CN=Trustwave Global ECC P384 Certification Authority O=Trustwave Holdings, Inc. +# Subject: CN=Trustwave Global ECC P384 Certification Authority O=Trustwave Holdings, Inc. +# Label: "Trustwave Global ECC P384 Certification Authority" +# Serial: 2704997926503831671788816187 +# MD5 Fingerprint: ea:cf:60:c4:3b:b9:15:29:40:a1:97:ed:78:27:93:d6 +# SHA1 Fingerprint: e7:f3:a3:c8:cf:6f:c3:04:2e:6d:0e:67:32:c5:9e:68:95:0d:5e:d2 +# SHA256 Fingerprint: 55:90:38:59:c8:c0:c3:eb:b8:75:9e:ce:4e:25:57:22:5f:f5:75:8b:bd:38:eb:d4:82:76:60:1e:1b:d5:80:97 +-----BEGIN CERTIFICATE----- +MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYD +VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf +BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3 +YXZlIEdsb2JhbCBFQ0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x +NzA4MjMxOTM2NDNaFw00MjA4MjMxOTM2NDNaMIGRMQswCQYDVQQGEwJVUzERMA8G +A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0 +d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF +Q0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTB2MBAGByqGSM49AgEGBSuB +BAAiA2IABGvaDXU1CDFHBa5FmVXxERMuSvgQMSOjfoPTfygIOiYaOs+Xgh+AtycJ +j9GOMMQKmw6sWASr9zZ9lCOkmwqKi6vr/TklZvFe/oyujUF5nQlgziip04pt89ZF +1PKYhDhloKNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNVHQ8BAf8EBQMDBwYAMB0G +A1UdDgQWBBRVqYSJ0sEyvRjLbKYHTsjnnb6CkDAKBggqhkjOPQQDAwNnADBkAjA3 +AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsC +MGclCrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVu +Sw== +-----END CERTIFICATE----- + +# Issuer: CN=NAVER Global Root Certification Authority O=NAVER BUSINESS PLATFORM Corp. +# Subject: CN=NAVER Global Root Certification Authority O=NAVER BUSINESS PLATFORM Corp. +# Label: "NAVER Global Root Certification Authority" +# Serial: 9013692873798656336226253319739695165984492813 +# MD5 Fingerprint: c8:7e:41:f6:25:3b:f5:09:b3:17:e8:46:3d:bf:d0:9b +# SHA1 Fingerprint: 8f:6b:f2:a9:27:4a:da:14:a0:c4:f4:8e:61:27:f9:c0:1e:78:5d:d1 +# SHA256 Fingerprint: 88:f4:38:dc:f8:ff:d1:fa:8f:42:91:15:ff:e5:f8:2a:e1:e0:6e:0c:70:c3:75:fa:ad:71:7b:34:a4:9e:72:65 +-----BEGIN CERTIFICATE----- +MIIFojCCA4qgAwIBAgIUAZQwHqIL3fXFMyqxQ0Rx+NZQTQ0wDQYJKoZIhvcNAQEM +BQAwaTELMAkGA1UEBhMCS1IxJjAkBgNVBAoMHU5BVkVSIEJVU0lORVNTIFBMQVRG +T1JNIENvcnAuMTIwMAYDVQQDDClOQVZFUiBHbG9iYWwgUm9vdCBDZXJ0aWZpY2F0 +aW9uIEF1dGhvcml0eTAeFw0xNzA4MTgwODU4NDJaFw0zNzA4MTgyMzU5NTlaMGkx +CzAJBgNVBAYTAktSMSYwJAYDVQQKDB1OQVZFUiBCVVNJTkVTUyBQTEFURk9STSBD +b3JwLjEyMDAGA1UEAwwpTkFWRVIgR2xvYmFsIFJvb3QgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC21PGTXLVA +iQqrDZBbUGOukJR0F0Vy1ntlWilLp1agS7gvQnXp2XskWjFlqxcX0TM62RHcQDaH +38dq6SZeWYp34+hInDEW+j6RscrJo+KfziFTowI2MMtSAuXaMl3Dxeb57hHHi8lE +HoSTGEq0n+USZGnQJoViAbbJAh2+g1G7XNr4rRVqmfeSVPc0W+m/6imBEtRTkZaz +kVrd/pBzKPswRrXKCAfHcXLJZtM0l/aM9BhK4dA9WkW2aacp+yPOiNgSnABIqKYP +szuSjXEOdMWLyEz59JuOuDxp7W87UC9Y7cSw0BwbagzivESq2M0UXZR4Yb8Obtoq +vC8MC3GmsxY/nOb5zJ9TNeIDoKAYv7vxvvTWjIcNQvcGufFt7QSUqP620wbGQGHf +nZ3zVHbOUzoBppJB7ASjjw2i1QnK1sua8e9DXcCrpUHPXFNwcMmIpi3Ua2FzUCaG +YQ5fG8Ir4ozVu53BA0K6lNpfqbDKzE0K70dpAy8i+/Eozr9dUGWokG2zdLAIx6yo +0es+nPxdGoMuK8u180SdOqcXYZaicdNwlhVNt0xz7hlcxVs+Qf6sdWA7G2POAN3a +CJBitOUt7kinaxeZVL6HSuOpXgRM6xBtVNbv8ejyYhbLgGvtPe31HzClrkvJE+2K +AQHJuFFYwGY6sWZLxNUxAmLpdIQM201GLQIDAQABo0IwQDAdBgNVHQ4EFgQU0p+I +36HNLL3s9TsBAZMzJ7LrYEswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMB +Af8wDQYJKoZIhvcNAQEMBQADggIBADLKgLOdPVQG3dLSLvCkASELZ0jKbY7gyKoN +qo0hV4/GPnrK21HUUrPUloSlWGB/5QuOH/XcChWB5Tu2tyIvCZwTFrFsDDUIbatj +cu3cvuzHV+YwIHHW1xDBE1UBjCpD5EHxzzp6U5LOogMFDTjfArsQLtk70pt6wKGm ++LUx5vR1yblTmXVHIloUFcd4G7ad6Qz4G3bxhYTeodoS76TiEJd6eN4MUZeoIUCL +hr0N8F5OSza7OyAfikJW4Qsav3vQIkMsRIz75Sq0bBwcupTgE34h5prCy8VCZLQe +lHsIJchxzIdFV4XTnyliIoNRlwAYl3dqmJLJfGBs32x9SuRwTMKeuB330DTHD8z7 +p/8Dvq1wkNoL3chtl1+afwkyQf3NosxabUzyqkn+Zvjp2DXrDige7kgvOtB5CTh8 +piKCk5XQA76+AqAF3SAi428diDRgxuYKuQl1C/AH6GmWNcf7I4GOODm4RStDeKLR +LBT/DShycpWbXgnbiUSYqqFJu3FS8r/2/yehNq+4tneI3TqkbZs0kNwUXTC/t+sX +5Ie3cdCh13cV1ELX8vMxmV2b3RZtP+oGI/hGoiLtk/bdmuYqh7GYVPEi92tF4+KO +dh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmgkpzNNIaRkPpkUZ3+/uul +9XXeifdy +-----END CERTIFICATE----- + +# Issuer: CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS O=FNMT-RCM OU=Ceres +# Subject: CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS O=FNMT-RCM OU=Ceres +# Label: "AC RAIZ FNMT-RCM SERVIDORES SEGUROS" +# Serial: 131542671362353147877283741781055151509 +# MD5 Fingerprint: 19:36:9c:52:03:2f:d2:d1:bb:23:cc:dd:1e:12:55:bb +# SHA1 Fingerprint: 62:ff:d9:9e:c0:65:0d:03:ce:75:93:d2:ed:3f:2d:32:c9:e3:e5:4a +# SHA256 Fingerprint: 55:41:53:b1:3d:2c:f9:dd:b7:53:bf:be:1a:4e:0a:e0:8d:0a:a4:18:70:58:fe:60:a2:b8:62:b2:e4:b8:7b:cb +-----BEGIN CERTIFICATE----- +MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQsw +CQYDVQQGEwJFUzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgw +FgYDVQRhDA9WQVRFUy1RMjgyNjAwNEoxLDAqBgNVBAMMI0FDIFJBSVogRk5NVC1S +Q00gU0VSVklET1JFUyBTRUdVUk9TMB4XDTE4MTIyMDA5MzczM1oXDTQzMTIyMDA5 +MzczM1oweDELMAkGA1UEBhMCRVMxETAPBgNVBAoMCEZOTVQtUkNNMQ4wDAYDVQQL +DAVDZXJlczEYMBYGA1UEYQwPVkFURVMtUTI4MjYwMDRKMSwwKgYDVQQDDCNBQyBS +QUlaIEZOTVQtUkNNIFNFUlZJRE9SRVMgU0VHVVJPUzB2MBAGByqGSM49AgEGBSuB +BAAiA2IABPa6V1PIyqvfNkpSIeSX0oNnnvBlUdBeh8dHsVnyV0ebAAKTRBdp20LH +sbI6GA60XYyzZl2hNPk2LEnb80b8s0RpRBNm/dfF/a82Tc4DTQdxz69qBdKiQ1oK +Um8BA06Oi6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD +VR0OBBYEFAG5L++/EYZg8k/QQW6rcx/n0m5JMAoGCCqGSM49BAMDA2kAMGYCMQCu +SuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoDzBOQn5IC +MQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJy +v+c= +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign Root R46 O=GlobalSign nv-sa +# Subject: CN=GlobalSign Root R46 O=GlobalSign nv-sa +# Label: "GlobalSign Root R46" +# Serial: 1552617688466950547958867513931858518042577 +# MD5 Fingerprint: c4:14:30:e4:fa:66:43:94:2a:6a:1b:24:5f:19:d0:ef +# SHA1 Fingerprint: 53:a2:b0:4b:ca:6b:d6:45:e6:39:8a:8e:c4:0d:d2:bf:77:c3:a2:90 +# SHA256 Fingerprint: 4f:a3:12:6d:8d:3a:11:d1:c4:85:5a:4f:80:7c:ba:d6:cf:91:9d:3a:5a:88:b0:3b:ea:2c:63:72:d9:3c:40:c9 +-----BEGIN CERTIFICATE----- +MIIFWjCCA0KgAwIBAgISEdK7udcjGJ5AXwqdLdDfJWfRMA0GCSqGSIb3DQEBDAUA +MEYxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYD +VQQDExNHbG9iYWxTaWduIFJvb3QgUjQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMy +MDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYt +c2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQCsrHQy6LNl5brtQyYdpokNRbopiLKkHWPd08EsCVeJ +OaFV6Wc0dwxu5FUdUiXSE2te4R2pt32JMl8Nnp8semNgQB+msLZ4j5lUlghYruQG +vGIFAha/r6gjA7aUD7xubMLL1aa7DOn2wQL7Id5m3RerdELv8HQvJfTqa1VbkNud +316HCkD7rRlr+/fKYIje2sGP1q7Vf9Q8g+7XFkyDRTNrJ9CG0Bwta/OrffGFqfUo +0q3v84RLHIf8E6M6cqJaESvWJ3En7YEtbWaBkoe0G1h6zD8K+kZPTXhc+CtI4wSE +y132tGqzZfxCnlEmIyDLPRT5ge1lFgBPGmSXZgjPjHvjK8Cd+RTyG/FWaha/LIWF +zXg4mutCagI0GIMXTpRW+LaCtfOW3T3zvn8gdz57GSNrLNRyc0NXfeD412lPFzYE ++cCQYDdF3uYM2HSNrpyibXRdQr4G9dlkbgIQrImwTDsHTUB+JMWKmIJ5jqSngiCN +I/onccnfxkF0oE32kRbcRoxfKWMxWXEM2G/CtjJ9++ZdU6Z+Ffy7dXxd7Pj2Fxzs +x2sZy/N78CsHpdlseVR2bJ0cpm4O6XkMqCNqo98bMDGfsVR7/mrLZqrcZdCinkqa +ByFrgY/bxFn63iLABJzjqls2k+g9vXqhnQt2sQvHnf3PmKgGwvgqo6GDoLclcqUC +4wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV +HQ4EFgQUA1yrc4GHqMywptWU4jaWSf8FmSwwDQYJKoZIhvcNAQEMBQADggIBAHx4 +7PYCLLtbfpIrXTncvtgdokIzTfnvpCo7RGkerNlFo048p9gkUbJUHJNOxO97k4Vg +JuoJSOD1u8fpaNK7ajFxzHmuEajwmf3lH7wvqMxX63bEIaZHU1VNaL8FpO7XJqti +2kM3S+LGteWygxk6x9PbTZ4IevPuzz5i+6zoYMzRx6Fcg0XERczzF2sUyQQCPtIk +pnnpHs6i58FZFZ8d4kuaPp92CC1r2LpXFNqD6v6MVenQTqnMdzGxRBF6XLE+0xRF +FRhiJBPSy03OXIPBNvIQtQ6IbbjhVp+J3pZmOUdkLG5NrmJ7v2B0GbhWrJKsFjLt +rWhV/pi60zTe9Mlhww6G9kuEYO4Ne7UyWHmRVSyBQ7N0H3qqJZ4d16GLuc1CLgSk +ZoNNiTW2bKg2SnkheCLQQrzRQDGQob4Ez8pn7fXwgNNgyYMqIgXQBztSvwyeqiv5 +u+YfjyW6hY0XHgL+XVAEV8/+LbzvXMAaq7afJMbfc2hIkCwU9D9SGuTSyxTDYWnP +4vkYxboznxSjBF25cfe1lNj2M8FawTSLfJvdkzrnE6JwYZ+vj+vYxXX4M2bUdGc6 +N3ec592kD3ZDZopD8p/7DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3 +vouXsXgxT7PntgMTzlSdriVZzH81Xwj3QEUxeCp6 +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign Root E46 O=GlobalSign nv-sa +# Subject: CN=GlobalSign Root E46 O=GlobalSign nv-sa +# Label: "GlobalSign Root E46" +# Serial: 1552617690338932563915843282459653771421763 +# MD5 Fingerprint: b5:b8:66:ed:de:08:83:e3:c9:e2:01:34:06:ac:51:6f +# SHA1 Fingerprint: 39:b4:6c:d5:fe:80:06:eb:e2:2f:4a:bb:08:33:a0:af:db:b9:dd:84 +# SHA256 Fingerprint: cb:b9:c4:4d:84:b8:04:3e:10:50:ea:31:a6:9f:51:49:55:d7:bf:d2:e2:c6:b4:93:01:01:9a:d6:1d:9f:50:58 +-----BEGIN CERTIFICATE----- +MIICCzCCAZGgAwIBAgISEdK7ujNu1LzmJGjFDYQdmOhDMAoGCCqGSM49BAMDMEYx +CzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQD +ExNHbG9iYWxTaWduIFJvb3QgRTQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAw +MDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2Ex +HDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAAScDrHPt+ieUnd1NPqlRqetMhkytAepJ8qUuwzSChDH2omwlwxwEwkBjtjq +R+q+soArzfwoDdusvKSGN+1wCAB16pMLey5SnCNoIwZD7JIvU4Tb+0cUB+hflGdd +yXqBPCCjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud +DgQWBBQxCpCPtsad0kRLgLWi5h+xEk8blTAKBggqhkjOPQQDAwNoADBlAjEA31SQ +7Zvvi5QCkxeCmb6zniz2C5GMn0oUsfZkvLtoURMMA/cVi4RguYv/Uo7njLwcAjA8 ++RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+CAezNIm8BZ/3Hobui3A= +-----END CERTIFICATE----- + +# Issuer: CN=GLOBALTRUST 2020 O=e-commerce monitoring GmbH +# Subject: CN=GLOBALTRUST 2020 O=e-commerce monitoring GmbH +# Label: "GLOBALTRUST 2020" +# Serial: 109160994242082918454945253 +# MD5 Fingerprint: 8a:c7:6f:cb:6d:e3:cc:a2:f1:7c:83:fa:0e:78:d7:e8 +# SHA1 Fingerprint: d0:67:c1:13:51:01:0c:aa:d0:c7:6a:65:37:31:16:26:4f:53:71:a2 +# SHA256 Fingerprint: 9a:29:6a:51:82:d1:d4:51:a2:e3:7f:43:9b:74:da:af:a2:67:52:33:29:f9:0f:9a:0d:20:07:c3:34:e2:3c:9a +-----BEGIN CERTIFICATE----- +MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkG +A1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkw +FwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMB4XDTIwMDIxMDAwMDAwMFoXDTQwMDYx +MDAwMDAwMFowTTELMAkGA1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9u +aXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMIICIjANBgkq +hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAri5WrRsc7/aVj6B3GyvTY4+ETUWiD59b +RatZe1E0+eyLinjF3WuvvcTfk0Uev5E4C64OFudBc/jbu9G4UeDLgztzOG53ig9Z +YybNpyrOVPu44sB8R85gfD+yc/LAGbaKkoc1DZAoouQVBGM+uq/ufF7MpotQsjj3 +QWPKzv9pj2gOlTblzLmMCcpL3TGQlsjMH/1WljTbjhzqLL6FLmPdqqmV0/0plRPw +yJiT2S0WR5ARg6I6IqIoV6Lr/sCMKKCmfecqQjuCgGOlYx8ZzHyyZqjC0203b+J+ +BlHZRYQfEs4kUmSFC0iAToexIiIwquuuvuAC4EDosEKAA1GqtH6qRNdDYfOiaxaJ +SaSjpCuKAsR49GiKweR6NrFvG5Ybd0mN1MkGco/PU+PcF4UgStyYJ9ORJitHHmkH +r96i5OTUawuzXnzUJIBHKWk7buis/UDr2O1xcSvy6Fgd60GXIsUf1DnQJ4+H4xj0 +4KlGDfV0OoIu0G4skaMxXDtG6nsEEFZegB31pWXogvziB4xiRfUg3kZwhqG8k9Me +dKZssCz3AwyIDMvUclOGvGBG85hqwvG/Q/lwIHfKN0F5VVJjjVsSn8VoxIidrPIw +q7ejMZdnrY8XD2zHc+0klGvIg5rQmjdJBKuxFshsSUktq6HQjJLyQUp5ISXbY9e2 +nKd+Qmn7OmMCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AQYwHQYDVR0OBBYEFNwuH9FhN3nkq9XVsxJxaD1qaJwiMB8GA1UdIwQYMBaAFNwu +H9FhN3nkq9XVsxJxaD1qaJwiMA0GCSqGSIb3DQEBCwUAA4ICAQCR8EICaEDuw2jA +VC/f7GLDw56KoDEoqoOOpFaWEhCGVrqXctJUMHytGdUdaG/7FELYjQ7ztdGl4wJC +XtzoRlgHNQIw4Lx0SsFDKv/bGtCwr2zD/cuz9X9tAy5ZVp0tLTWMstZDFyySCstd +6IwPS3BD0IL/qMy/pJTAvoe9iuOTe8aPmxadJ2W8esVCgmxcB9CpwYhgROmYhRZf ++I/KARDOJcP5YBugxZfD0yyIMaK9MOzQ0MAS8cE54+X1+NZK3TTN+2/BT+MAi1bi +kvcoskJ3ciNnxz8RFbLEAwW+uxF7Cr+obuf/WEPPm2eggAe2HcqtbepBEX4tdJP7 +wry+UUTF72glJ4DjyKDUEuzZpTcdN3y0kcra1LGWge9oXHYQSa9+pTeAsRxSvTOB +TI/53WXZFM2KJVj04sWDpQmQ1GwUY7VA3+vA/MRYfg0UFodUJ25W5HCEuGwyEn6C +MUO+1918oa2u1qsgEu8KwxCMSZY13At1XrFP1U80DhEgB3VDRemjEdqso5nCtnkn +4rnvyOL2NSl6dPrFf4IFYqYK6miyeUcGbvJXqBUzxvd4Sj1Ce2t+/vdG6tHrju+I +aFvowdlxfv1k7/9nR4hYJS8+hge9+6jlgqispdNpQ80xiEmEU5LAsTkbOYMBMMTy +qfrQA71yN2BWHzZ8vTmR9W0Nv3vXkg== +-----END CERTIFICATE----- + +# Issuer: CN=ANF Secure Server Root CA O=ANF Autoridad de Certificacion OU=ANF CA Raiz +# Subject: CN=ANF Secure Server Root CA O=ANF Autoridad de Certificacion OU=ANF CA Raiz +# Label: "ANF Secure Server Root CA" +# Serial: 996390341000653745 +# MD5 Fingerprint: 26:a6:44:5a:d9:af:4e:2f:b2:1d:b6:65:b0:4e:e8:96 +# SHA1 Fingerprint: 5b:6e:68:d0:cc:15:b6:a0:5f:1e:c1:5f:ae:02:fc:6b:2f:5d:6f:74 +# SHA256 Fingerprint: fb:8f:ec:75:91:69:b9:10:6b:1e:51:16:44:c6:18:c5:13:04:37:3f:6c:06:43:08:8d:8b:ef:fd:1b:99:75:99 +-----BEGIN CERTIFICATE----- +MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNV +BAUTCUc2MzI4NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlk +YWQgZGUgQ2VydGlmaWNhY2lvbjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNV +BAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3QgQ0EwHhcNMTkwOTA0MTAwMDM4WhcN +MzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEwMQswCQYDVQQGEwJF +UzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQwEgYD +VQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9v +dCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCj +cqQZAZ2cC4Ffc0m6p6zzBE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9q +yGFOtibBTI3/TO80sh9l2Ll49a2pcbnvT1gdpd50IJeh7WhM3pIXS7yr/2WanvtH +2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcvB2VSAKduyK9o7PQUlrZX +H1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXsezx76W0OL +zc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyR +p1RMVwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQz +W7i1o0TJrH93PB0j7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/ +SiOL9V8BY9KHcyi1Swr1+KuCLH5zJTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJn +LNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe8TZBAQIvfXOn3kLMTOmJDVb3 +n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVOHj1tyRRM4y5B +u8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj +o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC +AgEATh65isagmD9uw2nAalxJUqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L +9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzxj6ptBZNscsdW699QIyjlRRA96Gej +rw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDtdD+4E5UGUcjohybK +pFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM5gf0 +vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjq +OknkJjCb5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ +/zo1PqVUSlJZS2Db7v54EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ9 +2zg/LFis6ELhDtjTO0wugumDLmsx2d1Hhk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI ++PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGyg77FGr8H6lnco4g175x2 +MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3r5+qPeoo +tt7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw= +-----END CERTIFICATE----- + +# Issuer: CN=Certum EC-384 CA O=Asseco Data Systems S.A. OU=Certum Certification Authority +# Subject: CN=Certum EC-384 CA O=Asseco Data Systems S.A. OU=Certum Certification Authority +# Label: "Certum EC-384 CA" +# Serial: 160250656287871593594747141429395092468 +# MD5 Fingerprint: b6:65:b3:96:60:97:12:a1:ec:4e:e1:3d:a3:c6:c9:f1 +# SHA1 Fingerprint: f3:3e:78:3c:ac:df:f4:a2:cc:ac:67:55:69:56:d7:e5:16:3c:e1:ed +# SHA256 Fingerprint: 6b:32:80:85:62:53:18:aa:50:d1:73:c9:8d:8b:da:09:d5:7e:27:41:3d:11:4c:f7:87:a0:f5:d0:6c:03:0c:f6 +-----BEGIN CERTIFICATE----- +MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQsw +CQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScw +JQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMT +EENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2MDcyNDU0WhcNNDMwMzI2MDcyNDU0 +WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBT +LkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAX +BgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATE +KI6rGFtqvm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7Tm +Fy8as10CW4kjPMIRBSqniBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68Kj +QjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI0GZnQkdjrzife81r1HfS+8 +EF9LMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNoADBlAjADVS2m5hjEfO/J +UG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0QoSZ/6vn +nvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k= +-----END CERTIFICATE----- + +# Issuer: CN=Certum Trusted Root CA O=Asseco Data Systems S.A. OU=Certum Certification Authority +# Subject: CN=Certum Trusted Root CA O=Asseco Data Systems S.A. OU=Certum Certification Authority +# Label: "Certum Trusted Root CA" +# Serial: 40870380103424195783807378461123655149 +# MD5 Fingerprint: 51:e1:c2:e7:fe:4c:84:af:59:0e:2f:f4:54:6f:ea:29 +# SHA1 Fingerprint: c8:83:44:c0:18:ae:9f:cc:f1:87:b7:8f:22:d1:c5:d7:45:84:ba:e5 +# SHA256 Fingerprint: fe:76:96:57:38:55:77:3e:37:a9:5e:7a:d4:d9:cc:96:c3:01:57:c1:5d:31:76:5b:a9:b1:57:04:e1:ae:78:fd +-----BEGIN CERTIFICATE----- +MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6 +MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEu +MScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHzAdBgNV +BAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwHhcNMTgwMzE2MTIxMDEzWhcNNDMw +MzE2MTIxMDEzWjB6MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEg +U3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRo +b3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQDRLY67tzbqbTeRn06TpwXkKQMlzhyC93yZ +n0EGze2jusDbCSzBfN8pfktlL5On1AFrAygYo9idBcEq2EXxkd7fO9CAAozPOA/q +p1x4EaTByIVcJdPTsuclzxFUl6s1wB52HO8AU5853BSlLCIls3Jy/I2z5T4IHhQq +NwuIPMqw9MjCoa68wb4pZ1Xi/K1ZXP69VyywkI3C7Te2fJmItdUDmj0VDT06qKhF +8JVOJVkdzZhpu9PMMsmN74H+rX2Ju7pgE8pllWeg8xn2A1bUatMn4qGtg/BKEiJ3 +HAVz4hlxQsDsdUaakFjgao4rpUYwBI4Zshfjvqm6f1bxJAPXsiEodg42MEx51UGa +mqi4NboMOvJEGyCI98Ul1z3G4z5D3Yf+xOr1Uz5MZf87Sst4WmsXXw3Hw09Omiqi +7VdNIuJGmj8PkTQkfVXjjJU30xrwCSss0smNtA0Aq2cpKNgB9RkEth2+dv5yXMSF +ytKAQd8FqKPVhJBPC/PgP5sZ0jeJP/J7UhyM9uH3PAeXjA6iWYEMspA90+NZRu0P +qafegGtaqge2Gcu8V/OXIXoMsSt0Puvap2ctTMSYnjYJdmZm/Bo/6khUHL4wvYBQ +v3y1zgD2DGHZ5yQD4OMBgQ692IU0iL2yNqh7XAjlRICMb/gv1SHKHRzQ+8S1h9E6 +Tsd2tTVItQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSM+xx1 +vALTn04uSNn5YFSqxLNP+jAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQAD +ggIBAEii1QALLtA/vBzVtVRJHlpr9OTy4EA34MwUe7nJ+jW1dReTagVphZzNTxl4 +WxmB82M+w85bj/UvXgF2Ez8sALnNllI5SW0ETsXpD4YN4fqzX4IS8TrOZgYkNCvo +zMrnadyHncI013nR03e4qllY/p0m+jiGPp2Kh2RX5Rc64vmNueMzeMGQ2Ljdt4NR +5MTMI9UGfOZR0800McD2RrsLrfw9EAUqO0qRJe6M1ISHgCq8CYyqOhNf6DR5UMEQ +GfnTKB7U0VEwKbOukGfWHwpjscWpxkIxYxeU72nLL/qMFH3EQxiJ2fAyQOaA4kZf +5ePBAFmo+eggvIksDkc0C+pXwlM2/KfUrzHN/gLldfq5Jwn58/U7yn2fqSLLiMmq +0Uc9NneoWWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7D +P78v3DSk+yshzWePS/Tj6tQ/50+6uaWTRRxmHyH6ZF5v4HaUMst19W7l9o/HuKTM +qJZ9ZPskWkoDbGs4xugDQ5r3V7mzKWmTOPQD8rv7gmsHINFSH5pkAnuYZttcTVoP +0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZckbxJF0WddCajJFdr60qZf +E2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb +-----END CERTIFICATE----- + +# Issuer: CN=TunTrust Root CA O=Agence Nationale de Certification Electronique +# Subject: CN=TunTrust Root CA O=Agence Nationale de Certification Electronique +# Label: "TunTrust Root CA" +# Serial: 108534058042236574382096126452369648152337120275 +# MD5 Fingerprint: 85:13:b9:90:5b:36:5c:b6:5e:b8:5a:f8:e0:31:57:b4 +# SHA1 Fingerprint: cf:e9:70:84:0f:e0:73:0f:9d:f6:0c:7f:2c:4b:ee:20:46:34:9c:bb +# SHA256 Fingerprint: 2e:44:10:2a:b5:8c:b8:54:19:45:1c:8e:19:d9:ac:f3:66:2c:af:bc:61:4b:6a:53:96:0a:30:f7:d0:e2:eb:41 +-----BEGIN CERTIFICATE----- +MIIFszCCA5ugAwIBAgIUEwLV4kBMkkaGFmddtLu7sms+/BMwDQYJKoZIhvcNAQEL +BQAwYTELMAkGA1UEBhMCVE4xNzA1BgNVBAoMLkFnZW5jZSBOYXRpb25hbGUgZGUg +Q2VydGlmaWNhdGlvbiBFbGVjdHJvbmlxdWUxGTAXBgNVBAMMEFR1blRydXN0IFJv +b3QgQ0EwHhcNMTkwNDI2MDg1NzU2WhcNNDQwNDI2MDg1NzU2WjBhMQswCQYDVQQG +EwJUTjE3MDUGA1UECgwuQWdlbmNlIE5hdGlvbmFsZSBkZSBDZXJ0aWZpY2F0aW9u +IEVsZWN0cm9uaXF1ZTEZMBcGA1UEAwwQVHVuVHJ1c3QgUm9vdCBDQTCCAiIwDQYJ +KoZIhvcNAQEBBQADggIPADCCAgoCggIBAMPN0/y9BFPdDCA61YguBUtB9YOCfvdZ +n56eY+hz2vYGqU8ftPkLHzmMmiDQfgbU7DTZhrx1W4eI8NLZ1KMKsmwb60ksPqxd +2JQDoOw05TDENX37Jk0bbjBU2PWARZw5rZzJJQRNmpA+TkBuimvNKWfGzC3gdOgF +VwpIUPp6Q9p+7FuaDmJ2/uqdHYVy7BG7NegfJ7/Boce7SBbdVtfMTqDhuazb1YMZ +GoXRlJfXyqNlC/M4+QKu3fZnz8k/9YosRxqZbwUN/dAdgjH8KcwAWJeRTIAAHDOF +li/LQcKLEITDCSSJH7UP2dl3RxiSlGBcx5kDPP73lad9UKGAwqmDrViWVSHbhlnU +r8a83YFuB9tgYv7sEG7aaAH0gxupPqJbI9dkxt/con3YS7qC0lH4Zr8GRuR5KiY2 +eY8fTpkdso8MDhz/yV3A/ZAQprE38806JG60hZC/gLkMjNWb1sjxVj8agIl6qeIb +MlEsPvLfe/ZdeikZjuXIvTZxi11Mwh0/rViizz1wTaZQmCXcI/m4WEEIcb9PuISg +jwBUFfyRbVinljvrS5YnzWuioYasDXxU5mZMZl+QviGaAkYt5IPCgLnPSz7ofzwB +7I9ezX/SKEIBlYrilz0QIX32nRzFNKHsLA4KUiwSVXAkPcvCFDVDXSdOvsC9qnyW +5/yeYa1E0wCXAgMBAAGjYzBhMB0GA1UdDgQWBBQGmpsfU33x9aTI04Y+oXNZtPdE +ITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFAaamx9TffH1pMjThj6hc1m0 +90QhMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAqgVutt0Vyb+z +xiD2BkewhpMl0425yAA/l/VSJ4hxyXT968pk21vvHl26v9Hr7lxpuhbI87mP0zYu +QEkHDVneixCwSQXi/5E/S7fdAo74gShczNxtr18UnH1YeA32gAm56Q6XKRm4t+v4 +FstVEuTGfbvE7Pi1HE4+Z7/FXxttbUcoqgRYYdZ2vyJ/0Adqp2RT8JeNnYA/u8EH +22Wv5psymsNUk8QcCMNE+3tjEUPRahphanltkE8pjkcFwRJpadbGNjHh/PqAulxP +xOu3Mqz4dWEX1xAZufHSCe96Qp1bWgvUxpVOKs7/B9dPfhgGiPEZtdmYu65xxBzn +dFlY7wyJz4sfdZMaBBSSSFCp61cpABbjNhzI+L/wM9VBD8TMPN3pM0MBkRArHtG5 +Xc0yGYuPjCB31yLEQtyEFpslbei0VXF/sHyz03FJuc9SpAQ/3D2gu68zngowYI7b +nV2UqL1g52KAdoGDDIzMMEZJ4gzSqK/rYXHv5yJiqfdcZGyfFoxnNidF9Ql7v/YQ +CvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9zZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZH +u/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3rAZ3r2OvEhJn7wAzMMujj +d9qDRIueVSjAi1jTkD5OGwDxFa2DK5o= +-----END CERTIFICATE----- + +# Issuer: CN=HARICA TLS RSA Root CA 2021 O=Hellenic Academic and Research Institutions CA +# Subject: CN=HARICA TLS RSA Root CA 2021 O=Hellenic Academic and Research Institutions CA +# Label: "HARICA TLS RSA Root CA 2021" +# Serial: 76817823531813593706434026085292783742 +# MD5 Fingerprint: 65:47:9b:58:86:dd:2c:f0:fc:a2:84:1f:1e:96:c4:91 +# SHA1 Fingerprint: 02:2d:05:82:fa:88:ce:14:0c:06:79:de:7f:14:10:e9:45:d7:a5:6d +# SHA256 Fingerprint: d9:5d:0e:8e:da:79:52:5b:f9:be:b1:1b:14:d2:10:0d:32:94:98:5f:0c:62:d9:fa:bd:9c:d9:99:ec:cb:7b:1d +-----BEGIN CERTIFICATE----- +MIIFpDCCA4ygAwIBAgIQOcqTHO9D88aOk8f0ZIk4fjANBgkqhkiG9w0BAQsFADBs +MQswCQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl +c2VhcmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBSU0Eg +Um9vdCBDQSAyMDIxMB4XDTIxMDIxOTEwNTUzOFoXDTQ1MDIxMzEwNTUzN1owbDEL +MAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl +YXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgUlNBIFJv +b3QgQ0EgMjAyMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIvC569l +mwVnlskNJLnQDmT8zuIkGCyEf3dRywQRNrhe7Wlxp57kJQmXZ8FHws+RFjZiPTgE +4VGC/6zStGndLuwRo0Xua2s7TL+MjaQenRG56Tj5eg4MmOIjHdFOY9TnuEFE+2uv +a9of08WRiFukiZLRgeaMOVig1mlDqa2YUlhu2wr7a89o+uOkXjpFc5gH6l8Cct4M +pbOfrqkdtx2z/IpZ525yZa31MJQjB/OCFks1mJxTuy/K5FrZx40d/JiZ+yykgmvw +Kh+OC19xXFyuQnspiYHLA6OZyoieC0AJQTPb5lh6/a6ZcMBaD9YThnEvdmn8kN3b +LW7R8pv1GmuebxWMevBLKKAiOIAkbDakO/IwkfN4E8/BPzWr8R0RI7VDIp4BkrcY +AuUR0YLbFQDMYTfBKnya4dC6s1BG7oKsnTH4+yPiAwBIcKMJJnkVU2DzOFytOOqB +AGMUuTNe3QvboEUHGjMJ+E20pwKmafTCWQWIZYVWrkvL4N48fS0ayOn7H6NhStYq +E613TBoYm5EPWNgGVMWX+Ko/IIqmhaZ39qb8HOLubpQzKoNQhArlT4b4UEV4AIHr +W2jjJo3Me1xR9BQsQL4aYB16cmEdH2MtiKrOokWQCPxrvrNQKlr9qEgYRtaQQJKQ +CoReaDH46+0N0x3GfZkYVVYnZS6NRcUk7M7jAgMBAAGjQjBAMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFApII6ZgpJIKM+qTW8VX6iVNvRLuMA4GA1UdDwEB/wQE +AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAPpBIqm5iFSVmewzVjIuJndftTgfvnNAU +X15QvWiWkKQUEapobQk1OUAJ2vQJLDSle1mESSmXdMgHHkdt8s4cUCbjnj1AUz/3 +f5Z2EMVGpdAgS1D0NTsY9FVqQRtHBmg8uwkIYtlfVUKqrFOFrJVWNlar5AWMxaja +H6NpvVMPxP/cyuN+8kyIhkdGGvMA9YCRotxDQpSbIPDRzbLrLFPCU3hKTwSUQZqP +JzLB5UkZv/HywouoCjkxKLR9YjYsTewfM7Z+d21+UPCfDtcRj88YxeMn/ibvBZ3P +zzfF0HvaO7AWhAw6k9a+F9sPPg4ZeAnHqQJyIkv3N3a6dcSFA1pj1bF1BcK5vZSt +jBWZp5N99sXzqnTPBIWUmAD04vnKJGW/4GKvyMX6ssmeVkjaef2WdhW+o45WxLM0 +/L5H9MG0qPzVMIho7suuyWPEdr6sOBjhXlzPrjoiUevRi7PzKzMHVIf6tLITe7pT +BGIBnfHAT+7hOtSLIBD6Alfm78ELt5BGnBkpjNxvoEppaZS3JGWg/6w/zgH7IS79 +aPib8qXPMThcFarmlwDB31qlpzmq6YR/PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YW +xw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnnkf3/W9b3raYvAwtt41dU +63ZTGI0RmLo= +-----END CERTIFICATE----- + +# Issuer: CN=HARICA TLS ECC Root CA 2021 O=Hellenic Academic and Research Institutions CA +# Subject: CN=HARICA TLS ECC Root CA 2021 O=Hellenic Academic and Research Institutions CA +# Label: "HARICA TLS ECC Root CA 2021" +# Serial: 137515985548005187474074462014555733966 +# MD5 Fingerprint: ae:f7:4c:e5:66:35:d1:b7:9b:8c:22:93:74:d3:4b:b0 +# SHA1 Fingerprint: bc:b0:c1:9d:e9:98:92:70:19:38:57:e9:8d:a7:b4:5d:6e:ee:01:48 +# SHA256 Fingerprint: 3f:99:cc:47:4a:cf:ce:4d:fe:d5:87:94:66:5e:47:8d:15:47:73:9f:2e:78:0f:1b:b4:ca:9b:13:30:97:d4:01 +-----BEGIN CERTIFICATE----- +MIICVDCCAdugAwIBAgIQZ3SdjXfYO2rbIvT/WeK/zjAKBggqhkjOPQQDAzBsMQsw +CQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2Vh +cmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBFQ0MgUm9v +dCBDQSAyMDIxMB4XDTIxMDIxOTExMDExMFoXDTQ1MDIxMzExMDEwOVowbDELMAkG +A1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj +aCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgRUNDIFJvb3Qg +Q0EgMjAyMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDgI/rGgltJ6rK9JOtDA4MM7 +KKrxcm1lAEeIhPyaJmuqS7psBAqIXhfyVYf8MLA04jRYVxqEU+kw2anylnTDUR9Y +STHMmE5gEYd103KUkE+bECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQD +AgGGMAoGCCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAircJRQO9gcS3ujwLEXQNw +SaSS6sUUiHCm0w2wqsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/QwCZ61IygN +nxS2PFOiTAZpffpskcYqSUXm7LcT4Tps +-----END CERTIFICATE----- diff --git a/vendor/grpc/grpc/src/lib/AbstractCall.php b/vendor/grpc/grpc/src/lib/AbstractCall.php new file mode 100644 index 00000000..d1a186ad --- /dev/null +++ b/vendor/grpc/grpc/src/lib/AbstractCall.php @@ -0,0 +1,147 @@ +add($delta); + } else { + $deadline = Timeval::infFuture(); + } + $this->call = new Call($channel, $method, $deadline); + $this->deserialize = $deserialize; + $this->metadata = null; + $this->trailing_metadata = null; + if (array_key_exists('call_credentials_callback', $options) && + is_callable($call_credentials_callback = + $options['call_credentials_callback']) + ) { + $call_credentials = CallCredentials::createFromPlugin( + $call_credentials_callback + ); + $this->call->setCredentials($call_credentials); + } + } + + /** + * @return mixed The metadata sent by the server + */ + public function getMetadata() + { + return $this->metadata; + } + + /** + * @return mixed The trailing metadata sent by the server + */ + public function getTrailingMetadata() + { + return $this->trailing_metadata; + } + + /** + * @return string The URI of the endpoint + */ + public function getPeer() + { + return $this->call->getPeer(); + } + + /** + * Cancels the call. + */ + public function cancel() + { + $this->call->cancel(); + } + + /** + * Serialize a message to the protobuf binary format. + * + * @param mixed $data The Protobuf message + * + * @return string The protobuf binary format + */ + protected function _serializeMessage($data) + { + // Proto3 implementation + return $data->serializeToString(); + } + + /** + * Deserialize a response value to an object. + * + * @param string $value The binary value to deserialize + * + * @return mixed The deserialized value + */ + protected function _deserializeResponse($value) + { + if ($value === null) { + return; + } + list($className, $deserializeFunc) = $this->deserialize; + $obj = new $className(); + $obj->mergeFromString($value); + return $obj; + } + + /** + * Set the CallCredentials for the underlying Call. + * + * @param CallCredentials $call_credentials The CallCredentials object + */ + public function setCallCredentials($call_credentials) + { + $this->call->setCredentials($call_credentials); + } +} diff --git a/vendor/grpc/grpc/src/lib/BaseStub.php b/vendor/grpc/grpc/src/lib/BaseStub.php new file mode 100644 index 00000000..cb44ef63 --- /dev/null +++ b/vendor/grpc/grpc/src/lib/BaseStub.php @@ -0,0 +1,618 @@ +hostname = $hostname; + $this->update_metadata = null; + if (isset($opts['update_metadata'])) { + if (is_callable($opts['update_metadata'])) { + $this->update_metadata = $opts['update_metadata']; + } + unset($opts['update_metadata']); + } + if (!empty($opts['grpc.ssl_target_name_override'])) { + $this->hostname_override = $opts['grpc.ssl_target_name_override']; + } + if (isset($opts['grpc_call_invoker'])) { + $this->call_invoker = $opts['grpc_call_invoker']; + unset($opts['grpc_call_invoker']); + $channel_opts = $this->updateOpts($opts); + // If the grpc_call_invoker is defined, use the channel created by the call invoker. + $this->channel = $this->call_invoker->createChannelFactory($hostname, $channel_opts); + return; + } + $this->call_invoker = new DefaultCallInvoker(); + if ($channel) { + if (!is_a($channel, 'Grpc\Channel') && + !is_a($channel, 'Grpc\Internal\InterceptorChannel')) { + throw new \Exception('The channel argument is not a Channel object '. + 'or an InterceptorChannel object created by '. + 'Interceptor::intercept($channel, Interceptor|Interceptor[] $interceptors)'); + } + $this->channel = $channel; + return; + } + + $this->channel = static::getDefaultChannel($hostname, $opts); + } + + private static function updateOpts($opts) { + if (!empty($opts['grpc.primary_user_agent'])) { + $opts['grpc.primary_user_agent'] .= ' '; + } else { + $opts['grpc.primary_user_agent'] = ''; + } + if (defined('\Grpc\VERSION')) { + $version_str = \Grpc\VERSION; + } else { + if (!file_exists($composerFile = __DIR__.'/../../composer.json')) { + // for grpc/grpc-php subpackage + $composerFile = __DIR__.'/../composer.json'; + } + $package_config = json_decode(file_get_contents($composerFile), true); + $version_str = $package_config['version']; + } + $opts['grpc.primary_user_agent'] .= 'grpc-php/'.$version_str; + if (!array_key_exists('credentials', $opts)) { + throw new \Exception("The opts['credentials'] key is now ". + 'required. Please see one of the '. + 'ChannelCredentials::create methods'); + } + return $opts; + } + + /** + * Creates and returns the default Channel + * + * @param array $opts Channel constructor options + * + * @return Channel The channel + */ + public static function getDefaultChannel($hostname, array $opts) + { + $channel_opts = self::updateOpts($opts); + return new Channel($hostname, $opts); + } + + /** + * @return string The URI of the endpoint + */ + public function getTarget() + { + return $this->channel->getTarget(); + } + + /** + * @param bool $try_to_connect (optional) + * + * @return int The grpc connectivity state + */ + public function getConnectivityState($try_to_connect = false) + { + return $this->channel->getConnectivityState($try_to_connect); + } + + /** + * @param int $timeout in microseconds + * + * @return bool true if channel is ready + * @throw Exception if channel is in FATAL_ERROR state + */ + public function waitForReady($timeout) + { + $new_state = $this->getConnectivityState(true); + if ($this->_checkConnectivityState($new_state)) { + return true; + } + + $now = Timeval::now(); + $delta = new Timeval($timeout); + $deadline = $now->add($delta); + + while ($this->channel->watchConnectivityState($new_state, $deadline)) { + // state has changed before deadline + $new_state = $this->getConnectivityState(); + if ($this->_checkConnectivityState($new_state)) { + return true; + } + } + // deadline has passed + $new_state = $this->getConnectivityState(); + + return $this->_checkConnectivityState($new_state); + } + + /** + * Close the communication channel associated with this stub. + */ + public function close() + { + $this->channel->close(); + } + + /** + * @param $new_state Connect state + * + * @return bool true if state is CHANNEL_READY + * @throw Exception if state is CHANNEL_FATAL_FAILURE + */ + private function _checkConnectivityState($new_state) + { + if ($new_state == \Grpc\CHANNEL_READY) { + return true; + } + if ($new_state == \Grpc\CHANNEL_FATAL_FAILURE) { + throw new \Exception('Failed to connect to server'); + } + + return false; + } + + /** + * constructs the auth uri for the jwt. + * + * @param string $method The method string + * + * @return string The URL string + */ + private function _get_jwt_aud_uri($method) + { + // TODO(jtattermusch): This is not the correct implementation + // of extracting JWT "aud" claim. We should rely on + // grpc_metadata_credentials_plugin which + // also provides the correct value of "aud" claim + // in the grpc_auth_metadata_context.service_url field. + // Trying to do the construction of "aud" field ourselves + // is bad. + $last_slash_idx = strrpos($method, '/'); + if ($last_slash_idx === false) { + throw new \InvalidArgumentException( + 'service name must have a slash' + ); + } + $service_name = substr($method, 0, $last_slash_idx); + + if ($this->hostname_override) { + $hostname = $this->hostname_override; + } else { + $hostname = $this->hostname; + } + + // Remove the port if it is 443 + // See https://github.com/grpc/grpc/blob/07c9f7a36b2a0d34fcffebc85649cf3b8c339b5d/src/core/lib/security/transport/client_auth_filter.cc#L205 + if ((strlen($hostname) > 4) && (substr($hostname, -4) === ":443")) { + $hostname = substr($hostname, 0, -4); + } + + return 'https://'.$hostname.$service_name; + } + + /** + * validate and normalize the metadata array. + * + * @param array $metadata The metadata map + * + * @return array $metadata Validated and key-normalized metadata map + * @throw InvalidArgumentException if key contains invalid characters + */ + private function _validate_and_normalize_metadata($metadata) + { + $metadata_copy = []; + foreach ($metadata as $key => $value) { + if (!preg_match('/^[.A-Za-z\d_-]+$/', $key)) { + throw new \InvalidArgumentException( + 'Metadata keys must be nonempty strings containing only '. + 'alphanumeric characters, hyphens, underscores and dots' + ); + } + $metadata_copy[strtolower($key)] = $value; + } + + return $metadata_copy; + } + + /** + * Create a function which can be used to create UnaryCall + * + * @param Channel|InterceptorChannel $channel + * @param callable $deserialize A function that deserializes the response + * + * @return \Closure + */ + private function _GrpcUnaryUnary($channel) + { + return function ($method, + $argument, + $deserialize, + array $metadata = [], + array $options = []) use ($channel) { + $call = $this->call_invoker->UnaryCall( + $channel, + $method, + $deserialize, + $options + ); + $jwt_aud_uri = $this->_get_jwt_aud_uri($method); + if (is_callable($this->update_metadata)) { + $metadata = call_user_func( + $this->update_metadata, + $metadata, + $jwt_aud_uri + ); + } + $metadata = $this->_validate_and_normalize_metadata( + $metadata + ); + $call->start($argument, $metadata, $options); + return $call; + }; + } + + /** + * Create a function which can be used to create ServerStreamingCall + * + * @param Channel|InterceptorChannel $channel + * @param callable $deserialize A function that deserializes the response + * + * @return \Closure + */ + private function _GrpcStreamUnary($channel) + { + return function ($method, + $deserialize, + array $metadata = [], + array $options = []) use ($channel) { + $call = $this->call_invoker->ClientStreamingCall( + $channel, + $method, + $deserialize, + $options + ); + $jwt_aud_uri = $this->_get_jwt_aud_uri($method); + if (is_callable($this->update_metadata)) { + $metadata = call_user_func( + $this->update_metadata, + $metadata, + $jwt_aud_uri + ); + } + $metadata = $this->_validate_and_normalize_metadata( + $metadata + ); + $call->start($metadata); + return $call; + }; + } + + /** + * Create a function which can be used to create ClientStreamingCall + * + * @param Channel|InterceptorChannel $channel + * @param callable $deserialize A function that deserializes the response + * + * @return \Closure + */ + private function _GrpcUnaryStream($channel) + { + return function ($method, + $argument, + $deserialize, + array $metadata = [], + array $options = []) use ($channel) { + $call = $this->call_invoker->ServerStreamingCall( + $channel, + $method, + $deserialize, + $options + ); + $jwt_aud_uri = $this->_get_jwt_aud_uri($method); + if (is_callable($this->update_metadata)) { + $metadata = call_user_func( + $this->update_metadata, + $metadata, + $jwt_aud_uri + ); + } + $metadata = $this->_validate_and_normalize_metadata( + $metadata + ); + $call->start($argument, $metadata, $options); + return $call; + }; + } + + /** + * Create a function which can be used to create BidiStreamingCall + * + * @param Channel|InterceptorChannel $channel + * @param callable $deserialize A function that deserializes the response + * + * @return \Closure + */ + private function _GrpcStreamStream($channel) + { + return function ($method, + $deserialize, + array $metadata = [], + array $options = []) use ($channel) { + $call = $this->call_invoker->BidiStreamingCall( + $channel, + $method, + $deserialize, + $options + ); + $jwt_aud_uri = $this->_get_jwt_aud_uri($method); + if (is_callable($this->update_metadata)) { + $metadata = call_user_func( + $this->update_metadata, + $metadata, + $jwt_aud_uri + ); + } + $metadata = $this->_validate_and_normalize_metadata( + $metadata + ); + $call->start($metadata); + + return $call; + }; + } + + /** + * Create a function which can be used to create UnaryCall + * + * @param Channel|InterceptorChannel $channel + * @param callable $deserialize A function that deserializes the response + * + * @return \Closure + */ + private function _UnaryUnaryCallFactory($channel) + { + if (is_a($channel, 'Grpc\Internal\InterceptorChannel')) { + return function ($method, + $argument, + $deserialize, + array $metadata = [], + array $options = []) use ($channel) { + return $channel->getInterceptor()->interceptUnaryUnary( + $method, + $argument, + $deserialize, + $this->_UnaryUnaryCallFactory($channel->getNext()), + $metadata, + $options + ); + }; + } + return $this->_GrpcUnaryUnary($channel); + } + + /** + * Create a function which can be used to create ServerStreamingCall + * + * @param Channel|InterceptorChannel $channel + * @param callable $deserialize A function that deserializes the response + * + * @return \Closure + */ + private function _UnaryStreamCallFactory($channel) + { + if (is_a($channel, 'Grpc\Internal\InterceptorChannel')) { + return function ($method, + $argument, + $deserialize, + array $metadata = [], + array $options = []) use ($channel) { + return $channel->getInterceptor()->interceptUnaryStream( + $method, + $argument, + $deserialize, + $this->_UnaryStreamCallFactory($channel->getNext()), + $metadata, + $options + ); + }; + } + return $this->_GrpcUnaryStream($channel); + } + + /** + * Create a function which can be used to create ClientStreamingCall + * + * @param Channel|InterceptorChannel $channel + * @param callable $deserialize A function that deserializes the response + * + * @return \Closure + */ + private function _StreamUnaryCallFactory($channel) + { + if (is_a($channel, 'Grpc\Internal\InterceptorChannel')) { + return function ($method, + $deserialize, + array $metadata = [], + array $options = []) use ($channel) { + return $channel->getInterceptor()->interceptStreamUnary( + $method, + $deserialize, + $this->_StreamUnaryCallFactory($channel->getNext()), + $metadata, + $options + ); + }; + } + return $this->_GrpcStreamUnary($channel); + } + + /** + * Create a function which can be used to create BidiStreamingCall + * + * @param Channel|InterceptorChannel $channel + * @param callable $deserialize A function that deserializes the response + * + * @return \Closure + */ + private function _StreamStreamCallFactory($channel) + { + if (is_a($channel, 'Grpc\Internal\InterceptorChannel')) { + return function ($method, + $deserialize, + array $metadata = [], + array $options = []) use ($channel) { + return $channel->getInterceptor()->interceptStreamStream( + $method, + $deserialize, + $this->_StreamStreamCallFactory($channel->getNext()), + $metadata, + $options + ); + }; + } + return $this->_GrpcStreamStream($channel); + } + + /* This class is intended to be subclassed by generated code, so + * all functions begin with "_" to avoid name collisions. */ + /** + * Call a remote method that takes a single argument and has a + * single output. + * + * @param string $method The name of the method to call + * @param mixed $argument The argument to the method + * @param callable $deserialize A function that deserializes the response + * @param array $metadata A metadata map to send to the server + * (optional) + * @param array $options An array of options (optional) + * + * @return UnaryCall The active call object + */ + protected function _simpleRequest( + $method, + $argument, + $deserialize, + array $metadata = [], + array $options = [] + ) { + $call_factory = $this->_UnaryUnaryCallFactory($this->channel); + $call = $call_factory($method, $argument, $deserialize, $metadata, $options); + return $call; + } + + /** + * Call a remote method that takes a stream of arguments and has a single + * output. + * + * @param string $method The name of the method to call + * @param callable $deserialize A function that deserializes the response + * @param array $metadata A metadata map to send to the server + * (optional) + * @param array $options An array of options (optional) + * + * @return ClientStreamingCall The active call object + */ + protected function _clientStreamRequest( + $method, + $deserialize, + array $metadata = [], + array $options = [] + ) { + $call_factory = $this->_StreamUnaryCallFactory($this->channel); + $call = $call_factory($method, $deserialize, $metadata, $options); + return $call; + } + + /** + * Call a remote method that takes a single argument and returns a stream + * of responses. + * + * @param string $method The name of the method to call + * @param mixed $argument The argument to the method + * @param callable $deserialize A function that deserializes the responses + * @param array $metadata A metadata map to send to the server + * (optional) + * @param array $options An array of options (optional) + * + * @return ServerStreamingCall The active call object + */ + protected function _serverStreamRequest( + $method, + $argument, + $deserialize, + array $metadata = [], + array $options = [] + ) { + $call_factory = $this->_UnaryStreamCallFactory($this->channel); + $call = $call_factory($method, $argument, $deserialize, $metadata, $options); + return $call; + } + + /** + * Call a remote method with messages streaming in both directions. + * + * @param string $method The name of the method to call + * @param callable $deserialize A function that deserializes the responses + * @param array $metadata A metadata map to send to the server + * (optional) + * @param array $options An array of options (optional) + * + * @return BidiStreamingCall The active call object + */ + protected function _bidiRequest( + $method, + $deserialize, + array $metadata = [], + array $options = [] + ) { + $call_factory = $this->_StreamStreamCallFactory($this->channel); + $call = $call_factory($method, $deserialize, $metadata, $options); + return $call; + } +} diff --git a/vendor/grpc/grpc/src/lib/BidiStreamingCall.php b/vendor/grpc/grpc/src/lib/BidiStreamingCall.php new file mode 100644 index 00000000..be79c5de --- /dev/null +++ b/vendor/grpc/grpc/src/lib/BidiStreamingCall.php @@ -0,0 +1,105 @@ +call->startBatch([ + OP_SEND_INITIAL_METADATA => $metadata, + ]); + } + + /** + * Reads the next value from the server. + * + * @return mixed The next value from the server, or null if there is none + */ + public function read() + { + $batch = [OP_RECV_MESSAGE => true]; + if ($this->metadata === null) { + $batch[OP_RECV_INITIAL_METADATA] = true; + } + $read_event = $this->call->startBatch($batch); + if ($this->metadata === null) { + $this->metadata = $read_event->metadata; + } + + return $this->_deserializeResponse($read_event->message); + } + + /** + * Write a single message to the server. This cannot be called after + * writesDone is called. + * + * @param ByteBuffer $data The data to write + * @param array $options An array of options, possible keys: + * 'flags' => a number (optional) + */ + public function write($data, array $options = []) + { + $message_array = ['message' => $this->_serializeMessage($data)]; + if (array_key_exists('flags', $options)) { + $message_array['flags'] = $options['flags']; + } + $this->call->startBatch([ + OP_SEND_MESSAGE => $message_array, + ]); + } + + /** + * Indicate that no more writes will be sent. + */ + public function writesDone() + { + $this->call->startBatch([ + OP_SEND_CLOSE_FROM_CLIENT => true, + ]); + } + + /** + * Wait for the server to send the status, and return it. + * + * @return \stdClass The status object, with integer $code, string + * $details, and array $metadata members + */ + public function getStatus() + { + $status_event = $this->call->startBatch([ + OP_RECV_STATUS_ON_CLIENT => true, + ]); + + $this->trailing_metadata = $status_event->status->metadata; + + return $status_event->status; + } +} diff --git a/vendor/grpc/grpc/src/lib/CallInvoker.php b/vendor/grpc/grpc/src/lib/CallInvoker.php new file mode 100644 index 00000000..aacd54e8 --- /dev/null +++ b/vendor/grpc/grpc/src/lib/CallInvoker.php @@ -0,0 +1,32 @@ +call->startBatch([ + OP_SEND_INITIAL_METADATA => $metadata, + ]); + } + + /** + * Write a single message to the server. This cannot be called after + * wait is called. + * + * @param ByteBuffer $data The data to write + * @param array $options An array of options, possible keys: + * 'flags' => a number (optional) + */ + public function write($data, array $options = []) + { + $message_array = ['message' => $this->_serializeMessage($data)]; + if (array_key_exists('flags', $options)) { + $message_array['flags'] = $options['flags']; + } + $this->call->startBatch([ + OP_SEND_MESSAGE => $message_array, + ]); + } + + /** + * Wait for the server to respond with data and a status. + * + * @return array [response data, status] + */ + public function wait() + { + $event = $this->call->startBatch([ + OP_SEND_CLOSE_FROM_CLIENT => true, + OP_RECV_INITIAL_METADATA => true, + OP_RECV_MESSAGE => true, + OP_RECV_STATUS_ON_CLIENT => true, + ]); + $this->metadata = $event->metadata; + + $status = $event->status; + $this->trailing_metadata = $status->metadata; + + return [$this->_deserializeResponse($event->message), $status]; + } +} diff --git a/vendor/grpc/grpc/src/lib/DefaultCallInvoker.php b/vendor/grpc/grpc/src/lib/DefaultCallInvoker.php new file mode 100644 index 00000000..217dafa8 --- /dev/null +++ b/vendor/grpc/grpc/src/lib/DefaultCallInvoker.php @@ -0,0 +1,46 @@ += 0; $i--) { + $channel = new Internal\InterceptorChannel($channel, $interceptors[$i]); + } + } else { + $channel = new Internal\InterceptorChannel($channel, $interceptors); + } + return $channel; + } +} + diff --git a/vendor/grpc/grpc/src/lib/Internal/InterceptorChannel.php b/vendor/grpc/grpc/src/lib/Internal/InterceptorChannel.php new file mode 100644 index 00000000..2f85c35f --- /dev/null +++ b/vendor/grpc/grpc/src/lib/Internal/InterceptorChannel.php @@ -0,0 +1,76 @@ +interceptor = $interceptor; + $this->next = $channel; + } + + public function getNext() + { + return $this->next; + } + + public function getInterceptor() + { + return $this->interceptor; + } + + public function getTarget() + { + return $this->getNext()->getTarget(); + } + + public function watchConnectivityState($new_state, $deadline) + { + return $this->getNext()->watchConnectivityState($new_state, $deadline); + } + + public function getConnectivityState($try_to_connect = false) + { + return $this->getNext()->getConnectivityState($try_to_connect); + } + + public function close() + { + return $this->getNext()->close(); + } +} diff --git a/vendor/grpc/grpc/src/lib/MethodDescriptor.php b/vendor/grpc/grpc/src/lib/MethodDescriptor.php new file mode 100644 index 00000000..c0faf75a --- /dev/null +++ b/vendor/grpc/grpc/src/lib/MethodDescriptor.php @@ -0,0 +1,52 @@ +service = $service; + $this->method_name = $method_name; + $this->request_type = $request_type; + $this->call_type = $call_type; + } + + public const UNARY_CALL = 0; + public const SERVER_STREAMING_CALL = 1; + public const CLIENT_STREAMING_CALL = 2; + public const BIDI_STREAMING_CALL = 3; + + public $service; + public $method_name; + public $request_type; + public $call_type; +} diff --git a/vendor/grpc/grpc/src/lib/RpcServer.php b/vendor/grpc/grpc/src/lib/RpcServer.php new file mode 100644 index 00000000..c631e58f --- /dev/null +++ b/vendor/grpc/grpc/src/lib/RpcServer.php @@ -0,0 +1,151 @@ + => MethodDescriptor ] + private $paths_map = []; + + private function waitForNextEvent() + { + return $this->requestCall(); + } + + /** + * Add a service to this server + * + * @param Object $service The service to be added + */ + public function handle($service) + { + $methodDescriptors = $service->getMethodDescriptors(); + $exist_methods = array_intersect_key($this->paths_map, $methodDescriptors); + if (!empty($exist_methods)) { + fwrite(STDERR, "WARNING: " . 'override already registered methods: ' . + implode(', ', array_keys($exist_methods)) . PHP_EOL); + } + + $this->paths_map = array_merge($this->paths_map, $methodDescriptors); + return $this->paths_map; + } + + public function run() + { + $this->start(); + while (true) try { + // This blocks until the server receives a request + $event = $this->waitForNextEvent(); + + $full_path = $event->method; + $context = new ServerContext($event); + $server_writer = new ServerCallWriter($event->call, $context); + + if (!array_key_exists($full_path, $this->paths_map)) { + $context->setStatus(Status::unimplemented()); + $server_writer->finish(); + continue; + }; + + $method_desc = $this->paths_map[$full_path]; + $server_reader = new ServerCallReader( + $event->call, + $method_desc->request_type + ); + + try { + $this->processCall( + $method_desc, + $server_reader, + $server_writer, + $context + ); + } catch (\Exception $e) { + $context->setStatus(Status::status( + STATUS_INTERNAL, + $e->getMessage() + )); + $server_writer->finish(); + } + } catch (\Exception $e) { + fwrite(STDERR, "ERROR: " . $e->getMessage() . PHP_EOL); + exit(1); + } + } + + private function processCall( + MethodDescriptor $method_desc, + ServerCallReader $server_reader, + ServerCallWriter $server_writer, + ServerContext $context + ) { + // Dispatch to actual server logic + switch ($method_desc->call_type) { + case MethodDescriptor::UNARY_CALL: + $request = $server_reader->read(); + $response = + call_user_func( + array($method_desc->service, $method_desc->method_name), + $request ?? new $method_desc->request_type, + $context + ); + $server_writer->finish($response); + break; + case MethodDescriptor::SERVER_STREAMING_CALL: + $request = $server_reader->read(); + call_user_func( + array($method_desc->service, $method_desc->method_name), + $request ?? new $method_desc->request_type, + $server_writer, + $context + ); + break; + case MethodDescriptor::CLIENT_STREAMING_CALL: + $response = call_user_func( + array($method_desc->service, $method_desc->method_name), + $server_reader, + $context + ); + $server_writer->finish($response); + break; + case MethodDescriptor::BIDI_STREAMING_CALL: + call_user_func( + array($method_desc->service, $method_desc->method_name), + $server_reader, + $server_writer, + $context + ); + break; + default: + throw new \Exception(); + } + } +} diff --git a/vendor/grpc/grpc/src/lib/ServerCallReader.php b/vendor/grpc/grpc/src/lib/ServerCallReader.php new file mode 100644 index 00000000..a886448a --- /dev/null +++ b/vendor/grpc/grpc/src/lib/ServerCallReader.php @@ -0,0 +1,52 @@ +call_ = $call; + $this->request_type_ = $request_type; + } + + public function read() + { + $event = $this->call_->startBatch([ + OP_RECV_MESSAGE => true, + ]); + if ($event->message === null) { + return null; + } + $data = new $this->request_type_; + $data->mergeFromString($event->message); + return $data; + } + + private $call_; + private $request_type_; +} diff --git a/vendor/grpc/grpc/src/lib/ServerCallWriter.php b/vendor/grpc/grpc/src/lib/ServerCallWriter.php new file mode 100644 index 00000000..aceb20c3 --- /dev/null +++ b/vendor/grpc/grpc/src/lib/ServerCallWriter.php @@ -0,0 +1,109 @@ +call_ = $call; + $this->serverContext_ = $serverContext; + } + + public function start( + $data = null, + array $options = [] + ) { + $batch = []; + $this->addSendInitialMetadataOpIfNotSent( + $batch, + $this->serverContext_->initialMetadata() + ); + $this->addSendMessageOpIfHasData($batch, $data, $options); + $this->call_->startBatch($batch); + } + + public function write( + $data, + array $options = [] + ) { + $batch = []; + $this->addSendInitialMetadataOpIfNotSent( + $batch, + $this->serverContext_->initialMetadata() + ); + $this->addSendMessageOpIfHasData($batch, $data, $options); + $this->call_->startBatch($batch); + } + + public function finish( + $data = null, + array $options = [] + ) { + $batch = [ + OP_SEND_STATUS_FROM_SERVER => + $this->serverContext_->status() ?? Status::ok(), + OP_RECV_CLOSE_ON_SERVER => true, + ]; + $this->addSendInitialMetadataOpIfNotSent( + $batch, + $this->serverContext_->initialMetadata() + ); + $this->addSendMessageOpIfHasData($batch, $data, $options); + $this->call_->startBatch($batch); + } + + //////////////////////////// + + private function addSendInitialMetadataOpIfNotSent( + array &$batch, + array $initialMetadata = null + ) { + if (!$this->initialMetadataSent_) { + $batch[OP_SEND_INITIAL_METADATA] = $initialMetadata ?? []; + $this->initialMetadataSent_ = true; + } + } + + private function addSendMessageOpIfHasData( + array &$batch, + $data = null, + array $options = [] + ) { + if ($data) { + $message_array = ['message' => $data->serializeToString()]; + if (array_key_exists('flags', $options)) { + $message_array['flags'] = $options['flags']; + } + $batch[OP_SEND_MESSAGE] = $message_array; + } + } + + private $call_; + private $initialMetadataSent_ = false; + private $serverContext_; +} diff --git a/vendor/grpc/grpc/src/lib/ServerContext.php b/vendor/grpc/grpc/src/lib/ServerContext.php new file mode 100644 index 00000000..104250ea --- /dev/null +++ b/vendor/grpc/grpc/src/lib/ServerContext.php @@ -0,0 +1,76 @@ +event = $event; + } + + public function clientMetadata() + { + return $this->event->metadata; + } + public function deadline() + { + return $this->event->absolute_deadline; + } + public function host() + { + return $this->event->host; + } + public function method() + { + return $this->event->method; + } + + public function setInitialMetadata($initialMetadata) + { + $this->initialMetadata_ = $initialMetadata; + } + + public function initialMetadata() + { + return $this->initialMetadata_; + } + + public function setStatus($status) + { + $this->status_ = $status; + } + + public function status() + { + return $this->status_; + } + + private $event; + private $initialMetadata_; + private $status_; +} diff --git a/vendor/grpc/grpc/src/lib/ServerStreamingCall.php b/vendor/grpc/grpc/src/lib/ServerStreamingCall.php new file mode 100644 index 00000000..f8fddfea --- /dev/null +++ b/vendor/grpc/grpc/src/lib/ServerStreamingCall.php @@ -0,0 +1,100 @@ + a number (optional) + */ + public function start($data, array $metadata = [], array $options = []) + { + $message_array = ['message' => $this->_serializeMessage($data)]; + if (array_key_exists('flags', $options)) { + $message_array['flags'] = $options['flags']; + } + $this->call->startBatch([ + OP_SEND_INITIAL_METADATA => $metadata, + OP_SEND_MESSAGE => $message_array, + OP_SEND_CLOSE_FROM_CLIENT => true, + ]); + } + + /** + * @return mixed An iterator of response values + */ + public function responses() + { + $batch = [OP_RECV_MESSAGE => true]; + if ($this->metadata === null) { + $batch[OP_RECV_INITIAL_METADATA] = true; + } + $read_event = $this->call->startBatch($batch); + if ($this->metadata === null) { + $this->metadata = $read_event->metadata; + } + $response = $read_event->message; + while ($response !== null) { + yield $this->_deserializeResponse($response); + $response = $this->call->startBatch([ + OP_RECV_MESSAGE => true, + ])->message; + } + } + + /** + * Wait for the server to send the status, and return it. + * + * @return \stdClass The status object, with integer $code, string + * $details, and array $metadata members + */ + public function getStatus() + { + $status_event = $this->call->startBatch([ + OP_RECV_STATUS_ON_CLIENT => true, + ]); + + $this->trailing_metadata = $status_event->status->metadata; + + return $status_event->status; + } + + /** + * @return mixed The metadata sent by the server + */ + public function getMetadata() + { + if ($this->metadata === null) { + $event = $this->call->startBatch([OP_RECV_INITIAL_METADATA => true]); + $this->metadata = $event->metadata; + } + return $this->metadata; + } +} diff --git a/vendor/grpc/grpc/src/lib/Status.php b/vendor/grpc/grpc/src/lib/Status.php new file mode 100644 index 00000000..add208f6 --- /dev/null +++ b/vendor/grpc/grpc/src/lib/Status.php @@ -0,0 +1,55 @@ + $code, + 'details' => $details, + ]; + if ($metadata) { + $status['metadata'] = $metadata; + } + return $status; + } + + public static function ok(array $metadata = null): array + { + return Status::status(STATUS_OK, 'OK', $metadata); + } + public static function unimplemented(): array + { + return Status::status(STATUS_UNIMPLEMENTED, 'UNIMPLEMENTED'); + } +} diff --git a/vendor/grpc/grpc/src/lib/UnaryCall.php b/vendor/grpc/grpc/src/lib/UnaryCall.php new file mode 100644 index 00000000..e8496492 --- /dev/null +++ b/vendor/grpc/grpc/src/lib/UnaryCall.php @@ -0,0 +1,85 @@ + a number (optional) + */ + public function start($data, array $metadata = [], array $options = []) + { + $message_array = ['message' => $this->_serializeMessage($data)]; + if (isset($options['flags'])) { + $message_array['flags'] = $options['flags']; + } + $this->call->startBatch([ + OP_SEND_INITIAL_METADATA => $metadata, + OP_SEND_MESSAGE => $message_array, + OP_SEND_CLOSE_FROM_CLIENT => true, + ]); + } + + /** + * Wait for the server to respond with data and a status. + * + * @return array [response data, status] + */ + public function wait() + { + $batch = [ + OP_RECV_MESSAGE => true, + OP_RECV_STATUS_ON_CLIENT => true, + ]; + if ($this->metadata === null) { + $batch[OP_RECV_INITIAL_METADATA] = true; + } + $event = $this->call->startBatch($batch); + if ($this->metadata === null) { + $this->metadata = $event->metadata; + } + $status = $event->status; + $this->trailing_metadata = $status->metadata; + + return [$this->_deserializeResponse($event->message), $status]; + } + + /** + * @return mixed The metadata sent by the server + */ + public function getMetadata() + { + if ($this->metadata === null) { + $event = $this->call->startBatch([OP_RECV_INITIAL_METADATA => true]); + $this->metadata = $event->metadata; + } + return $this->metadata; + } +} diff --git a/vendor/guzzlehttp/guzzle/CHANGELOG.md b/vendor/guzzlehttp/guzzle/CHANGELOG.md new file mode 100644 index 00000000..b278efca --- /dev/null +++ b/vendor/guzzlehttp/guzzle/CHANGELOG.md @@ -0,0 +1,1490 @@ +# Change Log + +Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version. + +## 7.4.1 - 2021-12-06 + +### Changed + +- Replaced implicit URI to string coercion [#2946](https://github.com/guzzle/guzzle/pull/2946) +- Allow `symfony/deprecation-contracts` version 3 [#2961](https://github.com/guzzle/guzzle/pull/2961) + +### Fixed + +- Only close curl handle if it's done [#2950](https://github.com/guzzle/guzzle/pull/2950) + +## 7.4.0 - 2021-10-18 + +### Added + +- Support PHP 8.1 [#2929](https://github.com/guzzle/guzzle/pull/2929), [#2939](https://github.com/guzzle/guzzle/pull/2939) +- Support `psr/log` version 2 and 3 [#2943](https://github.com/guzzle/guzzle/pull/2943) + +### Fixed + +- Make sure we always call `restore_error_handler()` [#2915](https://github.com/guzzle/guzzle/pull/2915) +- Fix progress parameter type compatibility between the cURL and stream handlers [#2936](https://github.com/guzzle/guzzle/pull/2936) +- Throw `InvalidArgumentException` when an incorrect `headers` array is provided [#2916](https://github.com/guzzle/guzzle/pull/2916), [#2942](https://github.com/guzzle/guzzle/pull/2942) + +### Changed + +- Be more strict with types [#2914](https://github.com/guzzle/guzzle/pull/2914), [#2917](https://github.com/guzzle/guzzle/pull/2917), [#2919](https://github.com/guzzle/guzzle/pull/2919), [#2945](https://github.com/guzzle/guzzle/pull/2945) + +## 7.3.0 - 2021-03-23 + +### Added + +- Support for DER and P12 certificates [#2413](https://github.com/guzzle/guzzle/pull/2413) +- Support the cURL (http://) scheme for StreamHandler proxies [#2850](https://github.com/guzzle/guzzle/pull/2850) +- Support for `guzzlehttp/psr7:^2.0` [#2878](https://github.com/guzzle/guzzle/pull/2878) + +### Fixed + +- Handle exceptions on invalid header consistently between PHP versions and handlers [#2872](https://github.com/guzzle/guzzle/pull/2872) + +## 7.2.0 - 2020-10-10 + +### Added + +- Support for PHP 8 [#2712](https://github.com/guzzle/guzzle/pull/2712), [#2715](https://github.com/guzzle/guzzle/pull/2715), [#2789](https://github.com/guzzle/guzzle/pull/2789) +- Support passing a body summarizer to the http errors middleware [#2795](https://github.com/guzzle/guzzle/pull/2795) + +### Fixed + +- Handle exceptions during response creation [#2591](https://github.com/guzzle/guzzle/pull/2591) +- Fix CURLOPT_ENCODING not to be overwritten [#2595](https://github.com/guzzle/guzzle/pull/2595) +- Make sure the Request always has a body object [#2804](https://github.com/guzzle/guzzle/pull/2804) + +### Changed + +- The `TooManyRedirectsException` has a response [#2660](https://github.com/guzzle/guzzle/pull/2660) +- Avoid "functions" from dependencies [#2712](https://github.com/guzzle/guzzle/pull/2712) + +### Deprecated + +- Using environment variable GUZZLE_CURL_SELECT_TIMEOUT [#2786](https://github.com/guzzle/guzzle/pull/2786) + +## 7.1.1 - 2020-09-30 + +### Fixed + +- Incorrect EOF detection for response body streams on Windows. + +### Changed + +- We dont connect curl `sink` on HEAD requests. +- Removed some PHP 5 workarounds + +## 7.1.0 - 2020-09-22 + +### Added + +- `GuzzleHttp\MessageFormatterInterface` + +### Fixed + +- Fixed issue that caused cookies with no value not to be stored. +- On redirects, we allow all safe methods like GET, HEAD and OPTIONS. +- Fixed logging on empty responses. +- Make sure MessageFormatter::format returns string + +### Deprecated + +- All functions in `GuzzleHttp` has been deprecated. Use static methods on `Utils` instead. +- `ClientInterface::getConfig()` +- `Client::getConfig()` +- `Client::__call()` +- `Utils::defaultCaBundle()` +- `CurlFactory::LOW_CURL_VERSION_NUMBER` + +## 7.0.1 - 2020-06-27 + +* Fix multiply defined functions fatal error [#2699](https://github.com/guzzle/guzzle/pull/2699) + +## 7.0.0 - 2020-06-27 + +No changes since 7.0.0-rc1. + +## 7.0.0-rc1 - 2020-06-15 + +### Changed + +* Use error level for logging errors in Middleware [#2629](https://github.com/guzzle/guzzle/pull/2629) +* Disabled IDN support by default and require ext-intl to use it [#2675](https://github.com/guzzle/guzzle/pull/2675) + +## 7.0.0-beta2 - 2020-05-25 + +### Added + +* Using `Utils` class instead of functions in the `GuzzleHttp` namespace. [#2546](https://github.com/guzzle/guzzle/pull/2546) +* `ClientInterface::MAJOR_VERSION` [#2583](https://github.com/guzzle/guzzle/pull/2583) + +### Changed + +* Avoid the `getenv` function when unsafe [#2531](https://github.com/guzzle/guzzle/pull/2531) +* Added real client methods [#2529](https://github.com/guzzle/guzzle/pull/2529) +* Avoid functions due to global install conflicts [#2546](https://github.com/guzzle/guzzle/pull/2546) +* Use Symfony intl-idn polyfill [#2550](https://github.com/guzzle/guzzle/pull/2550) +* Adding methods for HTTP verbs like `Client::get()`, `Client::head()`, `Client::patch()` etc [#2529](https://github.com/guzzle/guzzle/pull/2529) +* `ConnectException` extends `TransferException` [#2541](https://github.com/guzzle/guzzle/pull/2541) +* Updated the default User Agent to "GuzzleHttp/7" [#2654](https://github.com/guzzle/guzzle/pull/2654) + +### Fixed + +* Various intl icu issues [#2626](https://github.com/guzzle/guzzle/pull/2626) + +### Removed + +* Pool option `pool_size` [#2528](https://github.com/guzzle/guzzle/pull/2528) + +## 7.0.0-beta1 - 2019-12-30 + +The diff might look very big but 95% of Guzzle users will be able to upgrade without modification. +Please see [the upgrade document](UPGRADING.md) that describes all BC breaking changes. + +### Added + +* Implement PSR-18 and dropped PHP 5 support [#2421](https://github.com/guzzle/guzzle/pull/2421) [#2474](https://github.com/guzzle/guzzle/pull/2474) +* PHP 7 types [#2442](https://github.com/guzzle/guzzle/pull/2442) [#2449](https://github.com/guzzle/guzzle/pull/2449) [#2466](https://github.com/guzzle/guzzle/pull/2466) [#2497](https://github.com/guzzle/guzzle/pull/2497) [#2499](https://github.com/guzzle/guzzle/pull/2499) +* IDN support for redirects [2424](https://github.com/guzzle/guzzle/pull/2424) + +### Changed + +* Dont allow passing null as third argument to `BadResponseException::__construct()` [#2427](https://github.com/guzzle/guzzle/pull/2427) +* Use SAPI constant instead of method call [#2450](https://github.com/guzzle/guzzle/pull/2450) +* Use native function invocation [#2444](https://github.com/guzzle/guzzle/pull/2444) +* Better defaults for PHP installations with old ICU lib [2454](https://github.com/guzzle/guzzle/pull/2454) +* Added visibility to all constants [#2462](https://github.com/guzzle/guzzle/pull/2462) +* Dont allow passing `null` as URI to `Client::request()` and `Client::requestAsync()` [#2461](https://github.com/guzzle/guzzle/pull/2461) +* Widen the exception argument to throwable [#2495](https://github.com/guzzle/guzzle/pull/2495) + +### Fixed + +* Logging when Promise rejected with a string [#2311](https://github.com/guzzle/guzzle/pull/2311) + +### Removed + +* Class `SeekException` [#2162](https://github.com/guzzle/guzzle/pull/2162) +* `RequestException::getResponseBodySummary()` [#2425](https://github.com/guzzle/guzzle/pull/2425) +* `CookieJar::getCookieValue()` [#2433](https://github.com/guzzle/guzzle/pull/2433) +* `uri_template()` and `UriTemplate` [#2440](https://github.com/guzzle/guzzle/pull/2440) +* Request options `save_to` and `exceptions` [#2464](https://github.com/guzzle/guzzle/pull/2464) + +## 6.5.2 - 2019-12-23 + +* idn_to_ascii() fix for old PHP versions [#2489](https://github.com/guzzle/guzzle/pull/2489) + +## 6.5.1 - 2019-12-21 + +* Better defaults for PHP installations with old ICU lib [#2454](https://github.com/guzzle/guzzle/pull/2454) +* IDN support for redirects [#2424](https://github.com/guzzle/guzzle/pull/2424) + +## 6.5.0 - 2019-12-07 + +* Improvement: Added support for reset internal queue in MockHandler. [#2143](https://github.com/guzzle/guzzle/pull/2143) +* Improvement: Added support to pass arbitrary options to `curl_multi_init`. [#2287](https://github.com/guzzle/guzzle/pull/2287) +* Fix: Gracefully handle passing `null` to the `header` option. [#2132](https://github.com/guzzle/guzzle/pull/2132) +* Fix: `RetryMiddleware` did not do exponential delay between retires due unit mismatch. [#2132](https://github.com/guzzle/guzzle/pull/2132) +* Fix: Prevent undefined offset when using array for ssl_key options. [#2348](https://github.com/guzzle/guzzle/pull/2348) +* Deprecated `ClientInterface::VERSION` + +## 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 https://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: https://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 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 https://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/LICENSE b/vendor/guzzlehttp/guzzle/LICENSE new file mode 100644 index 00000000..fd2375d8 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/LICENSE @@ -0,0 +1,27 @@ +The MIT License (MIT) + +Copyright (c) 2011 Michael Dowling +Copyright (c) 2012 Jeremy Lindblom +Copyright (c) 2014 Graham Campbell +Copyright (c) 2015 Márk Sági-Kazár +Copyright (c) 2015 Tobias Schultze +Copyright (c) 2016 Tobias Nyholm +Copyright (c) 2016 George Mponos + +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 new file mode 100644 index 00000000..0025aa7a --- /dev/null +++ b/vendor/guzzlehttp/guzzle/README.md @@ -0,0 +1,94 @@ +![Guzzle](.github/logo.png?raw=true) + +# 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/github/workflow/status/guzzle/guzzle/CI?label=ci%20build&style=flat-square)](https://github.com/guzzle/guzzle/actions?query=workflow%3ACI) +[![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. +- Supports PSR-18 allowing interoperability between other PSR-18 HTTP Clients. +- 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 + +We use GitHub issues only to discuss bugs and new features. For support please refer to: + +- [Documentation](http://guzzlephp.org/) +- [Stack Overflow](http://stackoverflow.com/questions/tagged/guzzle) +- [#guzzle](https://app.slack.com/client/T0D2S9JCT/CE6UAAKL4) channel on [PHP-HTTP Slack](http://slack.httplug.io/) +- [Gitter](https://gitter.im/guzzle/guzzle) + + +## Installing Guzzle + +The recommended way to install Guzzle is through +[Composer](https://getcomposer.org/). + +```bash +composer require guzzlehttp/guzzle +``` + + +## 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 | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >= 5.4 | +| 6.x | Security fixes | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >= 5.5 | +| 7.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v7][guzzle-7-repo] | [v7][guzzle-7-docs] | Yes | >= 7.2 | + +[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/tree/6.5 +[guzzle-7-repo]: https://github.com/guzzle/guzzle +[guzzle-3-docs]: http://guzzle3.readthedocs.org +[guzzle-5-docs]: http://docs.guzzlephp.org/en/5.3/ +[guzzle-6-docs]: http://docs.guzzlephp.org/en/6.5/ +[guzzle-7-docs]: http://docs.guzzlephp.org/en/latest/ + + +## Security + +If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/guzzle/security/policy) for more information. + +## License + +Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. + +## For Enterprise + +Available as part of the Tidelift Subscription + +The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-guzzle?utm_source=packagist-guzzlehttp-guzzle&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/vendor/guzzlehttp/guzzle/UPGRADING.md b/vendor/guzzlehttp/guzzle/UPGRADING.md new file mode 100644 index 00000000..45417a7e --- /dev/null +++ b/vendor/guzzlehttp/guzzle/UPGRADING.md @@ -0,0 +1,1253 @@ +Guzzle Upgrade Guide +==================== + +6.0 to 7.0 +---------- + +In order to take advantage of the new features of PHP, Guzzle dropped the support +of PHP 5. The minimum supported PHP version is now PHP 7.2. Type hints and return +types for functions and methods have been added wherever possible. + +Please make sure: +- You are calling a function or a method with the correct type. +- If you extend a class of Guzzle; update all signatures on methods you override. + +#### Other backwards compatibility breaking changes + +- Class `GuzzleHttp\UriTemplate` is removed. +- Class `GuzzleHttp\Exception\SeekException` is removed. +- Classes `GuzzleHttp\Exception\BadResponseException`, `GuzzleHttp\Exception\ClientException`, + `GuzzleHttp\Exception\ServerException` can no longer be initialized with an empty + Response as argument. +- Class `GuzzleHttp\Exception\ConnectException` now extends `GuzzleHttp\Exception\TransferException` + instead of `GuzzleHttp\Exception\RequestException`. +- Function `GuzzleHttp\Exception\ConnectException::getResponse()` is removed. +- Function `GuzzleHttp\Exception\ConnectException::hasResponse()` is removed. +- Constant `GuzzleHttp\ClientInterface::VERSION` is removed. Added `GuzzleHttp\ClientInterface::MAJOR_VERSION` instead. +- Function `GuzzleHttp\Exception\RequestException::getResponseBodySummary` is removed. + Use `\GuzzleHttp\Psr7\get_message_body_summary` as an alternative. +- Function `GuzzleHttp\Cookie\CookieJar::getCookieValue` is removed. +- Request option `exception` is removed. Please use `http_errors`. +- Request option `save_to` is removed. Please use `sink`. +- Pool option `pool_size` is removed. Please use `concurrency`. +- We now look for environment variables in the `$_SERVER` super global, due to thread safety issues with `getenv`. We continue to fallback to `getenv` in CLI environments, for maximum compatibility. +- The `get`, `head`, `put`, `post`, `patch`, `delete`, `getAsync`, `headAsync`, `putAsync`, `postAsync`, `patchAsync`, and `deleteAsync` methods are now implemented as genuine methods on `GuzzleHttp\Client`, with strong typing. The original `__call` implementation remains unchanged for now, for maximum backwards compatibility, but won't be invoked under normal operation. +- The `log` middleware will log the errors with level `error` instead of `notice` +- Support for international domain names (IDN) is now disabled by default, and enabling it requires installing ext-intl, linked against a modern version of the C library (ICU 4.6 or higher). + +#### Native functions calls + +All internal native functions calls of Guzzle are now prefixed with a slash. This +change makes it impossible for method overloading by other libraries or applications. +Example: + +```php +// Before: +curl_version(); + +// After: +\curl_version(); +``` + +For the full diff you can check [here](https://github.com/guzzle/guzzle/compare/6.5.4..master). + +5.0 to 6.0 +---------- + +Guzzle now uses [PSR-7](https://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](https://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 https://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 new file mode 100644 index 00000000..2549f78b --- /dev/null +++ b/vendor/guzzlehttp/guzzle/composer.json @@ -0,0 +1,98 @@ +{ + "name": "guzzlehttp/guzzle", + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "framework", + "http", + "rest", + "web service", + "curl", + "client", + "HTTP client", + "PSR-7", + "PSR-18" + ], + "license": "MIT", + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "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": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "require": { + "php": "^7.2.5 || ^8.0", + "ext-json": "*", + "guzzlehttp/promises": "^1.5", + "guzzlehttp/psr7": "^1.8.3 || ^2.1", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "ext-curl": "*", + "bamarni/composer-bin-plugin": "^1.4.1", + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.5.5 || ^9.3.5", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "config": { + "preferred-install": "dist", + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "7.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\": "tests/" + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/BodySummarizer.php b/vendor/guzzlehttp/guzzle/src/BodySummarizer.php new file mode 100644 index 00000000..6eca94ef --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/BodySummarizer.php @@ -0,0 +1,28 @@ +truncateAt = $truncateAt; + } + + /** + * Returns a summarized message body. + */ + public function summarize(MessageInterface $message): ?string + { + return $this->truncateAt === null + ? \GuzzleHttp\Psr7\Message::bodySummary($message) + : \GuzzleHttp\Psr7\Message::bodySummary($message, $this->truncateAt); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/BodySummarizerInterface.php b/vendor/guzzlehttp/guzzle/src/BodySummarizerInterface.php new file mode 100644 index 00000000..3e02e036 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/BodySummarizerInterface.php @@ -0,0 +1,13 @@ + '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. + * 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\Utils::uriFor($config['base_uri']); + } + + $this->configureDefaults($config); + } + + /** + * @param string $method + * @param array $args + * + * @return PromiseInterface|ResponseInterface + * + * @deprecated Client::__call will be removed in guzzlehttp/guzzle:8.0. + */ + 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 = $args[1] ?? []; + + return \substr($method, -5) === 'Async' + ? $this->requestAsync(\substr($method, 0, -5), $uri, $opts) + : $this->request($method, $uri, $opts); + } + + /** + * Asynchronously send an HTTP request. + * + * @param array $options Request options to apply to the given + * request and to the transfer. See \GuzzleHttp\RequestOptions. + */ + public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface + { + // 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 + ); + } + + /** + * Send an HTTP request. + * + * @param array $options Request options to apply to the given + * request and to the transfer. See \GuzzleHttp\RequestOptions. + * + * @throws GuzzleException + */ + public function send(RequestInterface $request, array $options = []): ResponseInterface + { + $options[RequestOptions::SYNCHRONOUS] = true; + return $this->sendAsync($request, $options)->wait(); + } + + /** + * The HttpClient PSR (PSR-18) specify this method. + * + * @inheritDoc + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + $options[RequestOptions::SYNCHRONOUS] = true; + $options[RequestOptions::ALLOW_REDIRECTS] = false; + $options[RequestOptions::HTTP_ERRORS] = false; + + return $this->sendAsync($request, $options)->wait(); + } + + /** + * Create and send an asynchronous HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string $method HTTP method + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. + */ + public function requestAsync(string $method, $uri = '', array $options = []): PromiseInterface + { + $options = $this->prepareDefaults($options); + // Remove request modifying parameter because it can be done up-front. + $headers = $options['headers'] ?? []; + $body = $options['body'] ?? null; + $version = $options['version'] ?? '1.1'; + // Merge the URI into the base URI. + $uri = $this->buildUri(Psr7\Utils::uriFor($uri), $options); + if (\is_array($body)) { + throw $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); + } + + /** + * Create and send an HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string $method HTTP method. + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. + * + * @throws GuzzleException + */ + public function request(string $method, $uri = '', array $options = []): ResponseInterface + { + $options[RequestOptions::SYNCHRONOUS] = true; + return $this->requestAsync($method, $uri, $options)->wait(); + } + + /** + * Get a client configuration option. + * + * These options include default request options of the client, a "handler" + * (if utilized by the concrete client), and a "base_uri" if utilized by + * the concrete client. + * + * @param string|null $option The config option to retrieve. + * + * @return mixed + * + * @deprecated Client::getConfig will be removed in guzzlehttp/guzzle:8.0. + */ + public function getConfig(?string $option = null) + { + return $option === null + ? $this->config + : ($this->config[$option] ?? null); + } + + private function buildUri(UriInterface $uri, array $config): UriInterface + { + if (isset($config['base_uri'])) { + $uri = Psr7\UriResolver::resolve(Psr7\Utils::uriFor($config['base_uri']), $uri); + } + + if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) { + $idnOptions = ($config['idn_conversion'] === true) ? \IDNA_DEFAULT : $config['idn_conversion']; + $uri = Utils::idnUriConvert($uri, $idnOptions); + } + + return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri; + } + + /** + * Configures the default options for a client. + */ + private function configureDefaults(array $config): void + { + $defaults = [ + 'allow_redirects' => RedirectMiddleware::$defaultSettings, + 'http_errors' => true, + 'decode_content' => true, + 'verify' => true, + 'cookies' => false, + 'idn_conversion' => 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 === 'cli' && ($proxy = Utils::getenv('HTTP_PROXY'))) { + $defaults['proxy']['http'] = $proxy; + } + + if ($proxy = Utils::getenv('HTTPS_PROXY')) { + $defaults['proxy']['https'] = $proxy; + } + + if ($noProxy = Utils::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' => Utils::defaultUserAgent()]; + } 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'] = Utils::defaultUserAgent(); + } + } + + /** + * Merges default options into the array. + * + * @param array $options Options to modify by reference + */ + private function prepareDefaults(array $options): array + { + $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'] = []; + 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 array $options See \GuzzleHttp\RequestOptions. + */ + private function transfer(RequestInterface $request, array $options): PromiseInterface + { + $request = $this->applyOptions($request, $options); + /** @var HandlerStack $handler */ + $handler = $options['handler']; + + try { + return P\Create::promiseFor($handler($request, $options)); + } catch (\Exception $e) { + return P\Create::rejectionFor($e); + } + } + + /** + * Applies the array of request options to a request. + */ + private function applyOptions(RequestInterface $request, array &$options): RequestInterface + { + $modify = [ + 'set_headers' => [], + ]; + + if (isset($options['headers'])) { + if (array_keys($options['headers']) === range(0, count($options['headers']) - 1)) { + throw new InvalidArgumentException('The headers array must have header name as keys.'); + } + $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\Utils::caselessRemove(['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'] = Utils::jsonEncode($options['json']); + unset($options['json']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['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\Utils::caselessRemove(['Accept-Encoding'], $options['_conditional']); + $modify['set_headers']['Accept-Encoding'] = $options['decode_content']; + } + + if (isset($options['body'])) { + if (\is_array($options['body'])) { + throw $this->invalidBody(); + } + $modify['body'] = Psr7\Utils::streamFor($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\Utils::caselessRemove(['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, '', '&', \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\Utils::modifyRequest($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\Utils::caselessRemove(['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\Utils::modifyRequest($request, $modify); + // Don't pass this internal value along to middleware/handlers. + unset($options['_conditional']); + } + + return $request; + } + + /** + * Return an InvalidArgumentException with pre-set message. + */ + private function invalidBody(): InvalidArgumentException + { + return new InvalidArgumentException('Passing in the "body" request ' + . 'option as an array to send a request is not supported. ' + . '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 new file mode 100644 index 00000000..6aaee61a --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/ClientInterface.php @@ -0,0 +1,84 @@ +request('GET', $uri, $options); + } + + /** + * Create and send an HTTP HEAD request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function head($uri, array $options = []): ResponseInterface + { + return $this->request('HEAD', $uri, $options); + } + + /** + * Create and send an HTTP PUT request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function put($uri, array $options = []): ResponseInterface + { + return $this->request('PUT', $uri, $options); + } + + /** + * Create and send an HTTP POST request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function post($uri, array $options = []): ResponseInterface + { + return $this->request('POST', $uri, $options); + } + + /** + * Create and send an HTTP PATCH request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function patch($uri, array $options = []): ResponseInterface + { + return $this->request('PATCH', $uri, $options); + } + + /** + * Create and send an HTTP DELETE request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function delete($uri, array $options = []): ResponseInterface + { + return $this->request('DELETE', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string $method HTTP method + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + abstract public function requestAsync(string $method, $uri, array $options = []): PromiseInterface; + + /** + * Create and send an asynchronous HTTP GET request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function getAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('GET', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP HEAD request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function headAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('HEAD', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP PUT request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function putAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('PUT', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP POST request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function postAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('POST', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP PATCH request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function patchAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('PATCH', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP DELETE request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function deleteAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('DELETE', $uri, $options); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php new file mode 100644 index 00000000..d6757c65 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php @@ -0,0 +1,313 @@ +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 + */ + public static function fromArray(array $cookies, string $domain): self + { + $cookieJar = new self(); + foreach ($cookies as $name => $value) { + $cookieJar->setCookie(new SetCookie([ + 'Domain' => $domain, + 'Name' => $name, + 'Value' => $value, + 'Discard' => true + ])); + } + + return $cookieJar; + } + + /** + * 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 + */ + public static function shouldPersist(SetCookie $cookie, bool $allowSessionCookies = false): bool + { + 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(string $name): ?SetCookie + { + foreach ($this->cookies as $cookie) { + if ($cookie->getName() !== null && \strcasecmp($cookie->getName(), $name) === 0) { + return $cookie; + } + } + + return null; + } + + /** + * @inheritDoc + */ + public function toArray(): array + { + return \array_map(static function (SetCookie $cookie): array { + return $cookie->toArray(); + }, $this->getIterator()->getArrayCopy()); + } + + /** + * @inheritDoc + */ + public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void + { + if (!$domain) { + $this->cookies = []; + return; + } elseif (!$path) { + $this->cookies = \array_filter( + $this->cookies, + static function (SetCookie $cookie) use ($domain): bool { + return !$cookie->matchesDomain($domain); + } + ); + } elseif (!$name) { + $this->cookies = \array_filter( + $this->cookies, + static function (SetCookie $cookie) use ($path, $domain): bool { + return !($cookie->matchesPath($path) && + $cookie->matchesDomain($domain)); + } + ); + } else { + $this->cookies = \array_filter( + $this->cookies, + static function (SetCookie $cookie) use ($path, $domain, $name) { + return !($cookie->getName() == $name && + $cookie->matchesPath($path) && + $cookie->matchesDomain($domain)); + } + ); + } + } + + /** + * @inheritDoc + */ + public function clearSessionCookies(): void + { + $this->cookies = \array_filter( + $this->cookies, + static function (SetCookie $cookie): bool { + return !$cookie->getDiscard() && $cookie->getExpires(); + } + ); + } + + /** + * @inheritDoc + */ + public function setCookie(SetCookie $cookie): bool + { + // 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); + } + $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(): int + { + return \count($this->cookies); + } + + /** + * @return \ArrayIterator + */ + public function getIterator(): \ArrayIterator + { + return new \ArrayIterator(\array_values($this->cookies)); + } + + public function extractCookies(RequestInterface $request, ResponseInterface $response): void + { + 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 + */ + private function getCookiePathFromRequest(RequestInterface $request): string + { + $uriPath = $request->getUri()->getPath(); + if ('' === $uriPath) { + return '/'; + } + if (0 !== \strpos($uriPath, '/')) { + return '/'; + } + if ('/' === $uriPath) { + return '/'; + } + $lastSlashPos = \strrpos($uriPath, '/'); + if (0 === $lastSlashPos || false === $lastSlashPos) { + return '/'; + } + + return \substr($uriPath, 0, $lastSlashPos); + } + + public function withCookieHeader(RequestInterface $request): RequestInterface + { + $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. + */ + private function removeCookieIfEmpty(SetCookie $cookie): void + { + $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 new file mode 100644 index 00000000..7df374b5 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php @@ -0,0 +1,79 @@ + + */ +interface CookieJarInterface extends \Countable, \IteratorAggregate +{ + /** + * Create a request with added cookie headers. + * + * If no matching cookies are found in the cookie jar, then no Cookie + * header is added to the request and the same request is returned. + * + * @param RequestInterface $request Request object to modify. + * + * @return RequestInterface returns the modified request. + */ + public function withCookieHeader(RequestInterface $request): RequestInterface; + + /** + * Extract cookies from an HTTP response and store them in the CookieJar. + * + * @param RequestInterface $request Request that was sent + * @param ResponseInterface $response Response that was received + */ + public function extractCookies(RequestInterface $request, ResponseInterface $response): void; + + /** + * Sets a cookie in the cookie jar. + * + * @param SetCookie $cookie Cookie to set. + * + * @return bool Returns true on success or false on failure + */ + public function setCookie(SetCookie $cookie): bool; + + /** + * Remove cookies currently held in the cookie jar. + * + * Invoking this method without arguments will empty the whole cookie jar. + * If given a $domain argument only cookies belonging to that domain will + * be removed. If given a $domain and $path argument, cookies belonging to + * the specified path within that domain are removed. If given all three + * arguments, then the cookie with the specified name, path and domain is + * removed. + * + * @param string|null $domain Clears cookies matching a domain + * @param string|null $path Clears cookies matching a domain and path + * @param string|null $name Clears cookies matching a domain, path, and name + */ + public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void; + + /** + * Discard all sessions cookies. + * + * Removes cookies that don't have an expire field or a have a discard + * field set to true. To be called when the user agent shuts down according + * to RFC 2965. + */ + public function clearSessionCookies(): void; + + /** + * Converts the cookie jar to an array. + */ + public function toArray(): array; +} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php new file mode 100644 index 00000000..290236d5 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php @@ -0,0 +1,101 @@ +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(string $filename): void + { + $json = []; + /** @var SetCookie $cookie */ + foreach ($this as $cookie) { + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { + $json[] = $cookie->toArray(); + } + } + + $jsonStr = Utils::jsonEncode($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(string $filename): void + { + $json = \file_get_contents($filename); + if (false === $json) { + throw new \RuntimeException("Unable to load file {$filename}"); + } + if ($json === '') { + return; + } + + $data = Utils::jsonDecode($json, true); + if (\is_array($data)) { + foreach ($data as $cookie) { + $this->setCookie(new SetCookie($cookie)); + } + } elseif (\is_scalar($data) && !empty($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 new file mode 100644 index 00000000..5d51ca98 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php @@ -0,0 +1,77 @@ +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(): void + { + $json = []; + /** @var SetCookie $cookie */ + foreach ($this as $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(): void + { + 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 new file mode 100644 index 00000000..7c04034d --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php @@ -0,0 +1,444 @@ + 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 + */ + public static function fromString(string $cookie): self + { + // 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 (!isset($pieces[0]) || \strpos($pieces[0], '=') === false) { + 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 (!isset($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 = []) + { + /** @var array|null $replaced will be null in case of replace error */ + $replaced = \array_replace(self::$defaults, $data); + if ($replaced === null) { + throw new \InvalidArgumentException('Unable to replace the default values for the Cookie.'); + } + + $this->data = $replaced; + // 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 (null !== ($expires = $this->getExpires()) && !\is_numeric($expires)) { + $this->setExpires($expires); + } + } + + 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(): array + { + 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): void + { + if (!is_string($name)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Name'] = (string) $name; + } + + /** + * Get the cookie value. + * + * @return string|null + */ + public function getValue() + { + return $this->data['Value']; + } + + /** + * Set the cookie value. + * + * @param string $value Cookie value + */ + public function setValue($value): void + { + if (!is_string($value)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Value'] = (string) $value; + } + + /** + * Get the domain. + * + * @return string|null + */ + public function getDomain() + { + return $this->data['Domain']; + } + + /** + * Set the domain of the cookie. + * + * @param string|null $domain + */ + public function setDomain($domain): void + { + if (!is_string($domain) && null !== $domain) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Domain'] = null === $domain ? null : (string) $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): void + { + if (!is_string($path)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Path'] = (string) $path; + } + + /** + * Maximum lifetime of the cookie in seconds. + * + * @return int|null + */ + public function getMaxAge() + { + return null === $this->data['Max-Age'] ? null : (int) $this->data['Max-Age']; + } + + /** + * Set the max-age of the cookie. + * + * @param int|null $maxAge Max age of the cookie in seconds + */ + public function setMaxAge($maxAge): void + { + if (!is_int($maxAge) && null !== $maxAge) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an int or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Max-Age'] = $maxAge === null ? null : (int) $maxAge; + } + + /** + * The UNIX timestamp when the cookie Expires. + * + * @return string|int|null + */ + public function getExpires() + { + return $this->data['Expires']; + } + + /** + * Set the unix timestamp for which the cookie will expire. + * + * @param int|string|null $timestamp Unix timestamp or any English textual datetime description. + */ + public function setExpires($timestamp): void + { + if (!is_int($timestamp) && !is_string($timestamp) && null !== $timestamp) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an int, string or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Expires'] = null === $timestamp ? null : (\is_numeric($timestamp) ? (int) $timestamp : \strtotime((string) $timestamp)); + } + + /** + * Get whether or not this is a secure cookie. + * + * @return bool + */ + 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): void + { + if (!is_bool($secure)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Secure'] = (bool) $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): void + { + if (!is_bool($discard)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Discard'] = (bool) $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): void + { + if (!is_bool($httpOnly)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['HttpOnly'] = (bool) $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 + */ + public function matchesPath(string $requestPath): bool + { + $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 + */ + public function matchesDomain(string $domain): bool + { + $cookieDomain = $this->getDomain(); + if (null === $cookieDomain) { + return true; + } + + // Remove the leading '.' as per spec in RFC 6265. + // https://tools.ietf.org/html/rfc6265#section-5.2.3 + $cookieDomain = \ltrim($cookieDomain, '.'); + + // Domain not set or exact match. + if (!$cookieDomain || !\strcasecmp($domain, $cookieDomain)) { + return true; + } + + // Matching the subdomain according to RFC 6265. + // https://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. + */ + public function isExpired(): bool + { + 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() + { + $name = $this->getName(); + if ($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 null. 0 and empty string are valid. Empty strings + // are technically against RFC 6265, but known to happen in the wild. + $value = $this->getValue(); + if ($value === null) { + return 'The cookie value must not be empty'; + } + + // Domains must not be empty, but can be 0. "0" is not a valid internet + // domain, but may be used as server name in a private network. + $domain = $this->getDomain(); + if ($domain === null || $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 new file mode 100644 index 00000000..a80956c9 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php @@ -0,0 +1,39 @@ +request = $request; + $this->handlerContext = $handlerContext; + } + + /** + * Get the request that caused the exception + */ + public function getRequest(): RequestInterface + { + return $this->request; + } + + /** + * 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. + */ + public function getHandlerContext(): array + { + return $this->handlerContext; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php b/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php new file mode 100644 index 00000000..fa3ed699 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php @@ -0,0 +1,9 @@ +getStatusCode() : 0; + parent::__construct($message, $code, $previous); + $this->request = $request; + $this->response = $response; + $this->handlerContext = $handlerContext; + } + + /** + * Wrap non-RequestExceptions with a RequestException + */ + public static function wrapException(RequestInterface $request, \Throwable $e): RequestException + { + 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 sent + * @param ResponseInterface $response Response received + * @param \Throwable|null $previous Previous exception + * @param array $handlerContext Optional handler context + * @param BodySummarizerInterface|null $bodySummarizer Optional body summarizer + */ + public static function create( + RequestInterface $request, + ResponseInterface $response = null, + \Throwable $previous = null, + array $handlerContext = [], + BodySummarizerInterface $bodySummarizer = null + ): self { + if (!$response) { + return new self( + 'Error completing request', + $request, + null, + $previous, + $handlerContext + ); + } + + $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->__toString(), + $response->getStatusCode(), + $response->getReasonPhrase() + ); + + $summary = ($bodySummarizer ?? new BodySummarizer())->summarize($response); + + if ($summary !== null) { + $message .= ":\n{$summary}\n"; + } + + return new $className($message, $request, $response, $previous, $handlerContext); + } + + /** + * Obfuscates URI if there is a username and a password present + */ + private static function obfuscateUri(UriInterface $uri): UriInterface + { + $userInfo = $uri->getUserInfo(); + + if (false !== ($pos = \strpos($userInfo, ':'))) { + return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***'); + } + + return $uri; + } + + /** + * Get the request that caused the exception + */ + public function getRequest(): RequestInterface + { + return $this->request; + } + + /** + * Get the associated response + */ + public function getResponse(): ?ResponseInterface + { + return $this->response; + } + + /** + * Check if a response was received + */ + public function hasResponse(): bool + { + 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. + */ + public function getHandlerContext(): array + { + return $this->handlerContext; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php new file mode 100644 index 00000000..8055e067 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php @@ -0,0 +1,10 @@ +maxHandles = $maxHandles; + } + + public function create(RequestInterface $request, array $options): EasyHandle + { + 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): void + { + $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(RequestInterface, array): PromiseInterface $handler + * @param CurlFactoryInterface $factory Dictates how the handle is released + */ + public static function finish(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory): PromiseInterface + { + 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): void + { + $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 + ); + ($easy->options['on_stats'])($stats); + } + + /** + * @param callable(RequestInterface, array): PromiseInterface $handler + */ + private static function finishError(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory): PromiseInterface + { + // 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): PromiseInterface + { + 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 ($easy->createResponseException) { + return P\Create::rejectionFor( + new RequestException( + 'An error was encountered while creating the response', + $easy->request, + $easy->response, + $easy->createResponseException, + $ctx + ) + ); + } + + // If an exception was encountered during the onHeaders event, then + // return a rejected promise that wraps that exception. + if ($easy->onHeadersException) { + return P\Create::rejectionFor( + new RequestException( + 'An error was encountered during the on_headers event', + $easy->request, + $easy->response, + $easy->onHeadersException, + $ctx + ) + ); + } + + $message = \sprintf( + 'cURL error %s: %s (%s)', + $ctx['errno'], + $ctx['error'], + 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html' + ); + $uriString = (string) $easy->request->getUri(); + if ($uriString !== '' && false === \strpos($ctx['error'], $uriString)) { + $message .= \sprintf(' for %s', $uriString); + } + + // 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 P\Create::rejectionFor($error); + } + + /** + * @return array + */ + private function getDefaultConf(EasyHandle $easy): array + { + $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): void + { + $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 https://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): void + { + $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] = static 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): void + { + 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(string $name, array &$options): void + { + foreach (\array_keys($options['_headers']) as $key) { + if (!\strcasecmp($key, $name)) { + unset($options['_headers'][$key]); + return; + } + } + } + + private function applyHandlerOptions(EasyHandle $easy, array &$conf): void + { + $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']) === true && + ($verifyLink = \readlink($options['verify'])) !== false && + \is_dir($verifyLink) + ) + ) { + $conf[\CURLOPT_CAPATH] = $options['verify']; + } else { + $conf[\CURLOPT_CAINFO] = $options['verify']; + } + } + } + } + + if (!isset($options['curl'][\CURLOPT_ENCODING]) && !empty($options['decode_content'])) { + $accept = $easy->request->getHeaderLine('Accept-Encoding'); + if ($accept) { + $conf[\CURLOPT_ENCODING] = $accept; + } else { + // The empty string enables all available decoders and implicitly + // sets a matching 'Accept-Encoding' header. + $conf[\CURLOPT_ENCODING] = ''; + // But as the user did not specify any acceptable encodings we need + // to overwrite this implicit header with an empty one. + $conf[\CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; + } + } + + if (!isset($options['sink'])) { + // Use a default temp stream if no sink was set. + $options['sink'] = \GuzzleHttp\Psr7\Utils::tryFopen('php://temp', 'w+'); + } + $sink = $options['sink']; + if (!\is_string($sink)) { + $sink = \GuzzleHttp\Psr7\Utils::streamFor($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] = static function ($ch, $write) use ($sink): int { + return $sink->write($write); + }; + + $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']) || !Utils::isHostInNoProxy($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}"); + } + # OpenSSL (versions 0.9.3 and later) also support "P12" for PKCS#12-encoded files. + # see https://curl.se/libcurl/c/CURLOPT_SSLCERTTYPE.html + $ext = pathinfo($cert, \PATHINFO_EXTENSION); + if (preg_match('#^(der|p12)$#i', $ext)) { + $conf[\CURLOPT_SSLCERTTYPE] = strtoupper($ext); + } + $conf[\CURLOPT_SSLCERT] = $cert; + } + + if (isset($options['ssl_key'])) { + if (\is_array($options['ssl_key'])) { + if (\count($options['ssl_key']) === 2) { + [$sslKey, $conf[\CURLOPT_SSLKEYPASSWD]] = $options['ssl_key']; + } else { + [$sslKey] = $options['ssl_key']; + } + } + + $sslKey = $sslKey ?? $options['ssl_key']; + + 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] = static function ($resource, int $downloadSize, int $downloaded, int $uploadSize, int $uploaded) use ($progress) { + $progress($downloadSize, $downloaded, $uploadSize, $uploaded); + }; + } + + if (!empty($options['debug'])) { + $conf[\CURLOPT_STDERR] = Utils::debugResource($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. + * + * @param callable(RequestInterface, array): PromiseInterface $handler + */ + private static function retryFailedRewind(callable $handler, EasyHandle $easy, array $ctx): PromiseInterface + { + 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): callable + { + 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 static function ($ch, $h) use ( + $onHeaders, + $easy, + &$startingResponse + ) { + $value = \trim($h); + if ($value === '') { + $startingResponse = true; + try { + $easy->createResponse(); + } catch (\Exception $e) { + $easy->createResponseException = $e; + return -1; + } + 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 new file mode 100644 index 00000000..fe57ed5d --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php @@ -0,0 +1,25 @@ +factory = $options['handle_factory'] + ?? new CurlFactory(3); + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + 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 new file mode 100644 index 00000000..9e2e4703 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php @@ -0,0 +1,261 @@ + An array of delay times, indexed by handle id in `addRequest`. + * + * @see CurlMultiHandler::addRequest + */ + private $delays = []; + + /** + * @var array An associative array of CURLMOPT_* options and corresponding values for curl_multi_setopt() + */ + private $options = []; + + /** + * This handler accepts the following options: + * + * - handle_factory: An optional factory used to create curl handles + * - select_timeout: Optional timeout (in seconds) to block before timing + * out while selecting curl handles. Defaults to 1 second. + * - options: An associative array of CURLMOPT_* options and + * corresponding values for curl_multi_setopt() + */ + public function __construct(array $options = []) + { + $this->factory = $options['handle_factory'] ?? new CurlFactory(50); + + if (isset($options['select_timeout'])) { + $this->selectTimeout = $options['select_timeout']; + } elseif ($selectTimeout = Utils::getenv('GUZZLE_CURL_SELECT_TIMEOUT')) { + @trigger_error('Since guzzlehttp/guzzle 7.2.0: Using environment variable GUZZLE_CURL_SELECT_TIMEOUT is deprecated. Use option "select_timeout" instead.', \E_USER_DEPRECATED); + $this->selectTimeout = (int) $selectTimeout; + } else { + $this->selectTimeout = 1; + } + + $this->options = $options['options'] ?? []; + } + + /** + * @param string $name + * + * @return resource|\CurlMultiHandle + * + * @throws \BadMethodCallException when another field as `_mh` will be gotten + * @throws \RuntimeException when curl can not initialize a multi handle + */ + public function __get($name) + { + if ($name !== '_mh') { + throw new \BadMethodCallException("Can not get other property as '_mh'."); + } + + $multiHandle = \curl_multi_init(); + + if (false === $multiHandle) { + throw new \RuntimeException('Can not initialize curl multi handle.'); + } + + $this->_mh = $multiHandle; + + foreach ($this->options as $option => $value) { + // A warning is raised in case of a wrong option. + curl_multi_setopt($this->_mh, $option, $value); + } + + return $this->_mh; + } + + public function __destruct() + { + if (isset($this->_mh)) { + \curl_multi_close($this->_mh); + unset($this->_mh); + } + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + $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(): void + { + // Add any delayed handles if needed. + if ($this->delays) { + $currentTime = Utils::currentTime(); + 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\Utils::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(): void + { + $queue = P\Utils::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): void + { + $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] = Utils::currentTime() + ($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): bool + { + if (!is_int($id)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an integer to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + // 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(): void + { + while ($done = \curl_multi_info_read($this->_mh)) { + if ($done['msg'] !== \CURLMSG_DONE) { + // if it's not done, then it would be premature to remove the handle. ref https://github.com/guzzle/guzzle/pull/2892#issuecomment-945150216 + continue; + } + $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(): int + { + $currentTime = Utils::currentTime(); + $nextTime = \PHP_INT_MAX; + foreach ($this->delays as $time) { + if ($time < $nextTime) { + $nextTime = $time; + } + } + + return ((int) \max(0, $nextTime - $currentTime)) * 1000000; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php new file mode 100644 index 00000000..224344d7 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php @@ -0,0 +1,112 @@ +headers); + + $normalizedKeys = Utils::normalizeHeaderKeys($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( + $status, + $headers, + $this->sink, + $ver, + $reason + ); + } + + /** + * @param string $name + * + * @return void + * + * @throws \BadMethodCallException + */ + 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/HeaderProcessor.php b/vendor/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php new file mode 100644 index 00000000..a0988845 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php @@ -0,0 +1,42 @@ +|null $queue The parameters to be passed to the append function, as an indexed array. + * @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled. + * @param callable|null $onRejected Callback to invoke when the return value is rejected. + */ + public function __construct(array $queue = null, callable $onFulfilled = null, callable $onRejected = null) + { + $this->onFulfilled = $onFulfilled; + $this->onRejected = $onRejected; + + if ($queue) { + // array_values included for BC + $this->append(...array_values($queue)); + } + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + if (!$this->queue) { + throw new \OutOfBoundsException('Mock queue is empty'); + } + + if (isset($options['delay']) && \is_numeric($options['delay'])) { + \usleep((int) $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 = $response($request, $options); + } + + $response = $response instanceof \Throwable + ? P\Create::rejectionFor($response) + : P\Create::promiseFor($response); + + return $response->then( + function (?ResponseInterface $value) use ($request, $options) { + $this->invokeStats($request, $options, $value); + if ($this->onFulfilled) { + ($this->onFulfilled)($value); + } + + if ($value !== null && 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 StreamInterface) { + $sink->write($contents); + } + } + + return $value; + }, + function ($reason) use ($request, $options) { + $this->invokeStats($request, $options, null, $reason); + if ($this->onRejected) { + ($this->onRejected)($reason); + } + return P\Create::rejectionFor($reason); + } + ); + } + + /** + * Adds one or more variadic requests, exceptions, callables, or promises + * to the queue. + * + * @param mixed ...$values + */ + public function append(...$values): void + { + foreach ($values as $value) { + if ($value instanceof ResponseInterface + || $value instanceof \Throwable + || $value instanceof PromiseInterface + || \is_callable($value) + ) { + $this->queue[] = $value; + } else { + throw new \TypeError('Expected a Response, Promise, Throwable or callable. Found ' . Utils::describeType($value)); + } + } + } + + /** + * Get the last received request. + */ + public function getLastRequest(): ?RequestInterface + { + return $this->lastRequest; + } + + /** + * Get the last received request options. + */ + public function getLastOptions(): array + { + return $this->lastOptions; + } + + /** + * Returns the number of remaining items in the queue. + */ + public function count(): int + { + return \count($this->queue); + } + + public function reset(): void + { + $this->queue = []; + } + + /** + * @param mixed $reason Promise or reason. + */ + private function invokeStats( + RequestInterface $request, + array $options, + ResponseInterface $response = null, + $reason = null + ): void { + if (isset($options['on_stats'])) { + $transferTime = $options['transfer_time'] ?? 0; + $stats = new TransferStats($request, $response, $transferTime, $reason); + ($options['on_stats'])($stats); + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php b/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php new file mode 100644 index 00000000..f045b526 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php @@ -0,0 +1,51 @@ +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 (false !== \strpos($message, 'getaddrinfo') // DNS lookup failed + || false !== \strpos($message, 'Connection refused') + || false !== \strpos($message, "couldn't connect to host") // error on HHVM + || false !== \strpos($message, "connection attempt failed") + ) { + $e = new ConnectException($e->getMessage(), $request, $e); + } else { + $e = RequestException::wrapException($request, $e); + } + $this->invokeStats($options, $request, $startTime, null, $e); + + return P\Create::rejectionFor($e); + } + } + + private function invokeStats( + array $options, + RequestInterface $request, + ?float $startTime, + ResponseInterface $response = null, + \Throwable $error = null + ): void { + if (isset($options['on_stats'])) { + $stats = new TransferStats($request, $response, Utils::currentTime() - $startTime, $error, []); + ($options['on_stats'])($stats); + } + } + + /** + * @param resource $stream + */ + private function createResponse(RequestInterface $request, array $options, $stream, ?float $startTime): PromiseInterface + { + $hdrs = $this->lastHeaders; + $this->lastHeaders = []; + + try { + [$ver, $status, $reason, $headers] = HeaderProcessor::parseHeaders($hdrs); + } catch (\Exception $e) { + return P\Create::rejectionFor( + new RequestException('An error was encountered while creating the response', $request, null, $e) + ); + } + + [$stream, $headers] = $this->checkDecode($options, $headers, $stream); + $stream = Psr7\Utils::streamFor($stream); + $sink = $stream; + + if (\strcasecmp('HEAD', $request->getMethod())) { + $sink = $this->createSink($stream, $options); + } + + try { + $response = new Psr7\Response($status, $headers, $sink, $ver, $reason); + } catch (\Exception $e) { + return P\Create::rejectionFor( + new RequestException('An error was encountered while creating the response', $request, null, $e) + ); + } + + if (isset($options['on_headers'])) { + try { + $options['on_headers']($response); + } catch (\Exception $e) { + return P\Create::rejectionFor( + new RequestException('An error was encountered during the on_headers event', $request, $response, $e) + ); + } + } + + // 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): StreamInterface + { + if (!empty($options['stream'])) { + return $stream; + } + + $sink = $options['sink'] ?? Psr7\Utils::tryFopen('php://temp', 'r+'); + + return \is_string($sink) ? new Psr7\LazyOpenStream($sink, 'w+') : Psr7\Utils::streamFor($sink); + } + + /** + * @param resource $stream + */ + private function checkDecode(array $options, array $headers, $stream): array + { + // Automatically decode responses when instructed. + if (!empty($options['decode_content'])) { + $normalizedKeys = Utils::normalizeHeaderKeys($headers); + if (isset($normalizedKeys['content-encoding'])) { + $encoding = $headers[$normalizedKeys['content-encoding']]; + if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') { + $stream = new Psr7\InflateStream(Psr7\Utils::streamFor($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 string $contentLength Header specifying the amount of + * data to read. + * + * @throws \RuntimeException when the sink option is invalid. + */ + private function drain(StreamInterface $source, StreamInterface $sink, string $contentLength): StreamInterface + { + // 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\Utils::copyToStream( + $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 = []; + \set_error_handler(static function ($_, $msg, $file, $line) use (&$errors): bool { + $errors[] = [ + 'message' => $msg, + 'file' => $file, + 'line' => $line + ]; + return true; + }); + + try { + $resource = $callback(); + } finally { + \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; + } + + /** + * @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'][2]) && 'ntlm' === $options['auth'][2]) { + throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler'); + } + + $uri = $this->resolveHost($request, $options); + + $contextResource = $this->createResource( + static function () use ($context, $params) { + return \stream_context_create($context, $params); + } + ); + + return $this->createResource( + function () use ($uri, &$http_response_header, $contextResource, $context, $options, $request) { + $resource = @\fopen((string) $uri, 'r', false, $contextResource); + $this->lastHeaders = $http_response_header; + + if (false === $resource) { + throw new ConnectException(sprintf('Connection refused for URI %s', $uri), $request, null, $context); + } + + 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): UriInterface + { + $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 (false === $records || !isset($records[0]['ip'])) { + throw new ConnectException(\sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request); + } + return $uri->withHost($records[0]['ip']); + } + if ('v6' === $options['force_ip_resolve']) { + $records = \dns_get_record($uri->getHost(), \DNS_AAAA); + if (false === $records || !isset($records[0]['ipv6'])) { + throw new ConnectException(\sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request); + } + return $uri->withHost('[' . $records[0]['ipv6'] . ']'); + } + } + + return $uri; + } + + private function getDefaultContext(RequestInterface $request): array + { + $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; + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_proxy(RequestInterface $request, array &$options, $value, array &$params): void + { + $uri = null; + + if (!\is_array($value)) { + $uri = $value; + } else { + $scheme = $request->getUri()->getScheme(); + if (isset($value[$scheme])) { + if (!isset($value['no']) || !Utils::isHostInNoProxy($request->getUri()->getHost(), $value['no'])) { + $uri = $value[$scheme]; + } + } + } + + if (!$uri) { + return; + } + + $parsed = $this->parse_proxy($uri); + $options['http']['proxy'] = $parsed['proxy']; + + if ($parsed['auth']) { + if (!isset($options['http']['header'])) { + $options['http']['header'] = []; + } + $options['http']['header'] .= "\r\nProxy-Authorization: {$parsed['auth']}"; + } + } + + /** + * Parses the given proxy URL to make it compatible with the format PHP's stream context expects. + */ + private function parse_proxy(string $url): array + { + $parsed = \parse_url($url); + + if ($parsed !== false && isset($parsed['scheme']) && $parsed['scheme'] === 'http') { + if (isset($parsed['host']) && isset($parsed['port'])) { + $auth = null; + if (isset($parsed['user']) && isset($parsed['pass'])) { + $auth = \base64_encode("{$parsed['user']}:{$parsed['pass']}"); + } + + return [ + 'proxy' => "tcp://{$parsed['host']}:{$parsed['port']}", + 'auth' => $auth ? "Basic {$auth}" : null, + ]; + } + } + + // Return proxy as-is. + return [ + 'proxy' => $url, + 'auth' => null, + ]; + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_timeout(RequestInterface $request, array &$options, $value, array &$params): void + { + if ($value > 0) { + $options['http']['timeout'] = $value; + } + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_verify(RequestInterface $request, array &$options, $value, array &$params): void + { + if ($value === false) { + $options['ssl']['verify_peer'] = false; + $options['ssl']['verify_peer_name'] = false; + + return; + } + + if (\is_string($value)) { + $options['ssl']['cafile'] = $value; + if (!\file_exists($value)) { + throw new \RuntimeException("SSL CA bundle not found: $value"); + } + } elseif ($value !== true) { + throw new \InvalidArgumentException('Invalid verify request option'); + } + + $options['ssl']['verify_peer'] = true; + $options['ssl']['verify_peer_name'] = true; + $options['ssl']['allow_self_signed'] = false; + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_cert(RequestInterface $request, array &$options, $value, array &$params): void + { + 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; + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_progress(RequestInterface $request, array &$options, $value, array &$params): void + { + self::addNotification( + $params, + static function ($code, $a, $b, $c, $transferred, $total) use ($value) { + if ($code == \STREAM_NOTIFY_PROGRESS) { + // The upload progress cannot be determined. Use 0 for cURL compatibility: + // https://curl.se/libcurl/c/CURLOPT_PROGRESSFUNCTION.html + $value($total, $transferred, 0, 0); + } + } + ); + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_debug(RequestInterface $request, array &$options, $value, array &$params): void + { + 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 = Utils::debugResource($value); + $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment(''); + self::addNotification( + $params, + static function (int $code, ...$passed) use ($ident, $value, $map, $args): void { + \fprintf($value, '<%s> [%s] ', $ident, $map[$code]); + foreach (\array_filter($passed) as $i => $v) { + \fwrite($value, $args[$i] . ': "' . $v . '" '); + } + \fwrite($value, "\n"); + } + ); + } + + private static function addNotification(array &$params, callable $notify): void + { + // Wrap the existing function if needed. + if (!isset($params['notification'])) { + $params['notification'] = $notify; + } else { + $params['notification'] = self::callArray([ + $params['notification'], + $notify + ]); + } + } + + private static function callArray(array $functions): callable + { + return static function (...$args) use ($functions) { + foreach ($functions as $fn) { + $fn(...$args); + } + }; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/HandlerStack.php b/vendor/guzzlehttp/guzzle/src/HandlerStack.php new file mode 100644 index 00000000..e0a1d119 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/HandlerStack.php @@ -0,0 +1,275 @@ +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(RequestInterface, array): PromiseInterface)|null $handler Underlying HTTP handler. + */ + public function __construct(callable $handler = null) + { + $this->handler = $handler; + } + + /** + * Invokes the handler stack as a composed handler + * + * @return ResponseInterface|PromiseInterface + */ + 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 !== null) { + $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(RequestInterface, array): PromiseInterface $handler Accepts a request and array of options and + * returns a Promise. + */ + public function setHandler(callable $handler): void + { + $this->handler = $handler; + $this->cached = null; + } + + /** + * Returns true if the builder has a handler. + */ + public function hasHandler(): bool + { + return $this->handler !== null ; + } + + /** + * Unshift a middleware to the bottom of the stack. + * + * @param callable(callable): callable $middleware Middleware function + * @param string $name Name to register for this middleware. + */ + public function unshift(callable $middleware, ?string $name = null): void + { + \array_unshift($this->stack, [$middleware, $name]); + $this->cached = null; + } + + /** + * Push a middleware to the top of the stack. + * + * @param callable(callable): callable $middleware Middleware function + * @param string $name Name to register for this middleware. + */ + public function push(callable $middleware, string $name = ''): void + { + $this->stack[] = [$middleware, $name]; + $this->cached = null; + } + + /** + * Add a middleware before another middleware by name. + * + * @param string $findName Middleware to find + * @param callable(callable): callable $middleware Middleware function + * @param string $withName Name to register for this middleware. + */ + public function before(string $findName, callable $middleware, string $withName = ''): void + { + $this->splice($findName, $withName, $middleware, true); + } + + /** + * Add a middleware after another middleware by name. + * + * @param string $findName Middleware to find + * @param callable(callable): callable $middleware Middleware function + * @param string $withName Name to register for this middleware. + */ + public function after(string $findName, callable $middleware, string $withName = ''): void + { + $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): void + { + if (!is_string($remove) && !is_callable($remove)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a callable or string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->cached = null; + $idx = \is_callable($remove) ? 0 : 1; + $this->stack = \array_values(\array_filter( + $this->stack, + static function ($tuple) use ($idx, $remove) { + return $tuple[$idx] !== $remove; + } + )); + } + + /** + * Compose the middleware and handler into a single callable function. + * + * @return callable(RequestInterface, array): PromiseInterface + */ + public function resolve(): callable + { + if ($this->cached === null) { + if (($prev = $this->handler) === null) { + throw new \LogicException('No handler has been specified'); + } + + foreach (\array_reverse($this->stack) as $fn) { + /** @var callable(RequestInterface, array): PromiseInterface $prev */ + $prev = $fn[0]($prev); + } + + $this->cached = $prev; + } + + return $this->cached; + } + + private function findByName(string $name): int + { + 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. + */ + private function splice(string $findName, string $withName, callable $middleware, bool $before): void + { + $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 callable|string $fn Function to write as a string. + */ + private function debugCallable($fn): string + { + 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]}'])"; + } + + /** @var object $fn */ + return 'callable(' . \spl_object_hash($fn) . ')'; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/MessageFormatter.php b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php new file mode 100644 index 00000000..da499547 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php @@ -0,0 +1,198 @@ +>>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}"; + public 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(?string $template = self::CLF) + { + $this->template = $template ?: self::CLF; + } + + /** + * Returns a formatted message string. + * + * @param RequestInterface $request Request that was sent + * @param ResponseInterface|null $response Response that was received + * @param \Throwable|null $error Exception that was received + */ + public function format(RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $error = null): string + { + $cache = []; + + /** @var string */ + 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\Message::toString($request); + break; + case 'response': + $result = $response ? Psr7\Message::toString($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()->__toString(); + break; + case 'res_body': + if (!$response instanceof ResponseInterface) { + $result = 'NULL'; + break; + } + + $body = $response->getBody(); + + if (!$body->isSeekable()) { + $result = 'RESPONSE_NOT_LOGGEABLE'; + break; + } + + $result = $response->getBody()->__toString(); + 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()->__toString(); + 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 + ); + } + + /** + * Get headers from message as string + */ + private function headers(MessageInterface $message): string + { + $result = ''; + foreach ($message->getHeaders() as $name => $values) { + $result .= $name . ': ' . \implode(', ', $values) . "\r\n"; + } + + return \trim($result); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/MessageFormatterInterface.php b/vendor/guzzlehttp/guzzle/src/MessageFormatterInterface.php new file mode 100644 index 00000000..a39ac248 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/MessageFormatterInterface.php @@ -0,0 +1,18 @@ +withCookieHeader($request); + return $handler($request, $options) + ->then( + static function (ResponseInterface $response) use ($cookieJar, $request): ResponseInterface { + $cookieJar->extractCookies($request, $response); + return $response; + } + ); + }; + }; + } + + /** + * Middleware that throws exceptions for 4xx or 5xx responses when the + * "http_errors" request option is set to true. + * + * @param BodySummarizerInterface|null $bodySummarizer The body summarizer to use in exception messages. + * + * @return callable(callable): callable Returns a function that accepts the next handler. + */ + public static function httpErrors(BodySummarizerInterface $bodySummarizer = null): callable + { + return static function (callable $handler) use ($bodySummarizer): callable { + return static function ($request, array $options) use ($handler, $bodySummarizer) { + if (empty($options['http_errors'])) { + return $handler($request, $options); + } + return $handler($request, $options)->then( + static function (ResponseInterface $response) use ($request, $bodySummarizer) { + $code = $response->getStatusCode(); + if ($code < 400) { + return $response; + } + throw RequestException::create($request, $response, null, [], $bodySummarizer); + } + ); + }; + }; + } + + /** + * Middleware that pushes history data to an ArrayAccess container. + * + * @param array|\ArrayAccess $container Container to hold the history (by reference). + * + * @return callable(callable): callable Returns a function that accepts the next handler. + * + * @throws \InvalidArgumentException if container is not an array or ArrayAccess. + */ + public static function history(&$container): callable + { + if (!\is_array($container) && !$container instanceof \ArrayAccess) { + throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess'); + } + + return static function (callable $handler) use (&$container): callable { + return static function (RequestInterface $request, array $options) use ($handler, &$container) { + return $handler($request, $options)->then( + static function ($value) use ($request, &$container, $options) { + $container[] = [ + 'request' => $request, + 'response' => $value, + 'error' => null, + 'options' => $options + ]; + return $value; + }, + static function ($reason) use ($request, &$container, $options) { + $container[] = [ + 'request' => $request, + 'response' => null, + 'error' => $reason, + 'options' => $options + ]; + return P\Create::rejectionFor($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): callable + { + return static function (callable $handler) use ($before, $after): callable { + return static function (RequestInterface $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(): callable + { + return static function (callable $handler): RedirectMiddleware { + 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): callable + { + return static function (callable $handler) use ($decider, $delay): RetryMiddleware { + return new RetryMiddleware($decider, $handler, $delay); + }; + } + + /** + * Middleware that logs requests, responses, and errors using a message + * formatter. + * + * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests. + * + * @param LoggerInterface $logger Logs messages. + * @param MessageFormatterInterface|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, $formatter, string $logLevel = 'info'): callable + { + // To be compatible with Guzzle 7.1.x we need to allow users to pass a MessageFormatter + if (!$formatter instanceof MessageFormatter && !$formatter instanceof MessageFormatterInterface) { + throw new \LogicException(sprintf('Argument 2 to %s::log() must be of type %s', self::class, MessageFormatterInterface::class)); + } + + return static function (callable $handler) use ($logger, $formatter, $logLevel): callable { + return static function (RequestInterface $request, array $options = []) use ($handler, $logger, $formatter, $logLevel) { + return $handler($request, $options)->then( + static function ($response) use ($logger, $request, $formatter, $logLevel): ResponseInterface { + $message = $formatter->format($request, $response); + $logger->log($logLevel, $message); + return $response; + }, + static function ($reason) use ($logger, $request, $formatter): PromiseInterface { + $response = $reason instanceof RequestException ? $reason->getResponse() : null; + $message = $formatter->format($request, $response, P\Create::exceptionFor($reason)); + $logger->error($message); + return P\Create::rejectionFor($reason); + } + ); + }; + }; + } + + /** + * This middleware adds a default content-type if possible, a default + * content-length or transfer-encoding header, and the expect header. + */ + public static function prepareBody(): callable + { + return static function (callable $handler): PrepareBodyMiddleware { + 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. + */ + public static function mapRequest(callable $fn): callable + { + return static function (callable $handler) use ($fn): callable { + return static function (RequestInterface $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. + */ + public static function mapResponse(callable $fn): callable + { + return static function (callable $handler) use ($fn): callable { + return static function (RequestInterface $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 new file mode 100644 index 00000000..6277c61f --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Pool.php @@ -0,0 +1,125 @@ + $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); + } + + /** + * Get promise + */ + public function promise(): PromiseInterface + { + 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 = []): array + { + $res = []; + self::cmpCallback($options, 'fulfilled', $res); + self::cmpCallback($options, 'rejected', $res); + $pool = new static($client, $requests, $options); + $pool->promise()->wait(); + \ksort($res); + + return $res; + } + + /** + * Execute callback(s) + */ + private static function cmpCallback(array &$options, string $name, array &$results): void + { + if (!isset($options[$name])) { + $options[$name] = static function ($v, $k) use (&$results) { + $results[$k] = $v; + }; + } else { + $currentFn = $options[$name]; + $options[$name] = static 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 new file mode 100644 index 00000000..7ca62833 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php @@ -0,0 +1,104 @@ +nextHandler = $nextHandler; + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + $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 (is_string($uri) && $type = Psr7\MimeType::fromFilename($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\Utils::modifyRequest($request, $modify), $options); + } + + /** + * Add expect header + */ + private function addExpectHeader(RequestInterface $request, array $options, array &$modify): void + { + // Determine if the Expect header should be used + if ($request->hasHeader('Expect')) { + return; + } + + $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 new file mode 100644 index 00000000..1dd38614 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php @@ -0,0 +1,216 @@ + 5, + 'protocols' => ['http', 'https'], + 'strict' => false, + 'referer' => false, + 'track_redirects' => false, + ]; + + /** + * @var callable(RequestInterface, array): PromiseInterface + */ + private $nextHandler; + + /** + * @param callable(RequestInterface, array): PromiseInterface $nextHandler Next handler to invoke. + */ + public function __construct(callable $nextHandler) + { + $this->nextHandler = $nextHandler; + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + $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); + }); + } + + /** + * @return ResponseInterface|PromiseInterface + */ + public function checkRedirect(RequestInterface $request, array $options, ResponseInterface $response) + { + if (\strpos((string) $response->getStatusCode(), '3') !== 0 + || !$response->hasHeader('Location') + ) { + return $response; + } + + $this->guardMax($request, $response, $options); + $nextRequest = $this->modifyRequest($request, $options, $response); + + if (isset($options['allow_redirects']['on_redirect'])) { + ($options['allow_redirects']['on_redirect'])( + $request, + $response, + $nextRequest->getUri() + ); + } + + $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; + } + + /** + * Enable tracking on promise. + */ + private function withTracking(PromiseInterface $promise, string $uri, int $statusCode): PromiseInterface + { + return $promise->then( + static 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, (string) $statusCode); + + return $response->withHeader(self::HISTORY_HEADER, $historyHeader) + ->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader); + } + ); + } + + /** + * Check for too many redirects + * + * @throws TooManyRedirectsException Too many redirects. + */ + private function guardMax(RequestInterface $request, ResponseInterface $response, array &$options): void + { + $current = $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, $response); + } + } + + public function modifyRequest(RequestInterface $request, array $options, ResponseInterface $response): RequestInterface + { + // 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 && !$options['allow_redirects']['strict']) + ) { + $safeMethods = ['GET', 'HEAD', 'OPTIONS']; + $requestMethod = $request->getMethod(); + + $modify['method'] = in_array($requestMethod, $safeMethods) ? $requestMethod : 'GET'; + $modify['body'] = ''; + } + + $uri = $this->redirectUri($request, $response, $protocols); + if (isset($options['idn_conversion']) && ($options['idn_conversion'] !== false)) { + $idnOptions = ($options['idn_conversion'] === true) ? \IDNA_DEFAULT : $options['idn_conversion']; + $uri = Utils::idnUriConvert($uri, $idnOptions); + } + + $modify['uri'] = $uri; + Psr7\Message::rewindBody($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\Utils::modifyRequest($request, $modify); + } + + /** + * Set the appropriate URL on the request based on the location header + */ + private function redirectUri(RequestInterface $request, ResponseInterface $response, array $protocols): UriInterface + { + $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 new file mode 100644 index 00000000..20b31bc2 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/RequestOptions.php @@ -0,0 +1,264 @@ +decider = $decider; + $this->nextHandler = $nextHandler; + $this->delay = $delay ?: __CLASS__ . '::exponentialDelay'; + } + + /** + * Default exponential backoff delay function. + * + * @return int milliseconds. + */ + public static function exponentialDelay(int $retries): int + { + return (int) \pow(2, $retries - 1) * 1000; + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + if (!isset($options['retries'])) { + $options['retries'] = 0; + } + + $fn = $this->nextHandler; + return $fn($request, $options) + ->then( + $this->onFulfilled($request, $options), + $this->onRejected($request, $options) + ); + } + + /** + * Execute fulfilled closure + */ + private function onFulfilled(RequestInterface $request, array $options): callable + { + return function ($value) use ($request, $options) { + if (!($this->decider)( + $options['retries'], + $request, + $value, + null + )) { + return $value; + } + return $this->doRetry($request, $options, $value); + }; + } + + /** + * Execute rejected closure + */ + private function onRejected(RequestInterface $req, array $options): callable + { + return function ($reason) use ($req, $options) { + if (!($this->decider)( + $options['retries'], + $req, + null, + $reason + )) { + return P\Create::rejectionFor($reason); + } + return $this->doRetry($req, $options); + }; + } + + private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null): PromiseInterface + { + $options['delay'] = ($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 new file mode 100644 index 00000000..93fa334c --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/TransferStats.php @@ -0,0 +1,133 @@ +request = $request; + $this->response = $response; + $this->transferTime = $transferTime; + $this->handlerErrorData = $handlerErrorData; + $this->handlerStats = $handlerStats; + } + + public function getRequest(): RequestInterface + { + return $this->request; + } + + /** + * Returns the response that was received (if any). + */ + public function getResponse(): ?ResponseInterface + { + return $this->response; + } + + /** + * Returns true if a response was received. + */ + public function hasResponse(): bool + { + 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. + */ + public function getEffectiveUri(): UriInterface + { + return $this->request->getUri(); + } + + /** + * Get the estimated time the request was being transferred by the handler. + * + * @return float|null Time in seconds. + */ + public function getTransferTime(): ?float + { + return $this->transferTime; + } + + /** + * Gets an array of all of the handler specific transfer data. + */ + public function getHandlerStats(): array + { + 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(string $stat) + { + return $this->handlerStats[$stat] ?? null; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Utils.php b/vendor/guzzlehttp/guzzle/src/Utils.php new file mode 100644 index 00000000..91591da2 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Utils.php @@ -0,0 +1,382 @@ +getHost()) { + $asciiHost = self::idnToAsci($uri->getHost(), $options, $info); + if ($asciiHost === false) { + $errorBitSet = $info['errors'] ?? 0; + + $errorConstants = array_filter(array_keys(get_defined_constants()), static function (string $name): bool { + return substr($name, 0, 11) === 'IDNA_ERROR_'; + }); + + $errors = []; + foreach ($errorConstants as $errorConstant) { + if ($errorBitSet & constant($errorConstant)) { + $errors[] = $errorConstant; + } + } + + $errorMessage = 'IDN conversion failed'; + if ($errors) { + $errorMessage .= ' (errors: ' . implode(', ', $errors) . ')'; + } + + throw new InvalidArgumentException($errorMessage); + } + if ($uri->getHost() !== $asciiHost) { + // Replace URI only if the ASCII version is different + $uri = $uri->withHost($asciiHost); + } + } + + return $uri; + } + + /** + * @internal + */ + public static function getenv(string $name): ?string + { + if (isset($_SERVER[$name])) { + return (string) $_SERVER[$name]; + } + + if (\PHP_SAPI === 'cli' && ($value = \getenv($name)) !== false && $value !== null) { + return (string) $value; + } + + return null; + } + + /** + * @return string|false + */ + private static function idnToAsci(string $domain, int $options, ?array &$info = []) + { + if (\function_exists('idn_to_ascii') && \defined('INTL_IDNA_VARIANT_UTS46')) { + return \idn_to_ascii($domain, $options, \INTL_IDNA_VARIANT_UTS46, $info); + } + + throw new \Error('ext-idn or symfony/polyfill-intl-idn not loaded or too old'); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/functions.php b/vendor/guzzlehttp/guzzle/src/functions.php new file mode 100644 index 00000000..a70d2cbf --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/functions.php @@ -0,0 +1,167 @@ + +Copyright (c) 2015 Graham Campbell +Copyright (c) 2017 Tobias Schultze +Copyright (c) 2020 Tobias Nyholm + +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 new file mode 100644 index 00000000..8d5b3ef9 --- /dev/null +++ b/vendor/guzzlehttp/promises/Makefile @@ -0,0 +1,13 @@ +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 new file mode 100644 index 00000000..c175fec7 --- /dev/null +++ b/vendor/guzzlehttp/promises/README.md @@ -0,0 +1,547 @@ +# 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::of()`. + + +# 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; + +$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\Utils::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" +``` + + +## Upgrading from Function API + +A static API was first introduced in 1.4.0, in order to mitigate problems with functions conflicting between global and local copies of the package. The function API will be removed in 2.0.0. A migration table has been provided here for your convenience: + +| Original Function | Replacement Method | +|----------------|----------------| +| `queue` | `Utils::queue` | +| `task` | `Utils::task` | +| `promise_for` | `Create::promiseFor` | +| `rejection_for` | `Create::rejectionFor` | +| `exception_for` | `Create::exceptionFor` | +| `iter_for` | `Create::iterFor` | +| `inspect` | `Utils::inspect` | +| `inspect_all` | `Utils::inspectAll` | +| `unwrap` | `Utils::unwrap` | +| `all` | `Utils::all` | +| `some` | `Utils::some` | +| `any` | `Utils::any` | +| `settle` | `Utils::settle` | +| `each` | `Each::of` | +| `each_limit` | `Each::ofLimit` | +| `each_limit_all` | `Each::ofLimitAll` | +| `!is_fulfilled` | `Is::pending` | +| `is_fulfilled` | `Is::fulfilled` | +| `is_rejected` | `Is::rejected` | +| `is_settled` | `Is::settled` | +| `coroutine` | `Coroutine::of` | + + +## Security + +If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/promises/security/policy) for more information. + +## License + +Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. + +## For Enterprise + +Available as part of the Tidelift Subscription + +The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-promises?utm_source=packagist-guzzlehttp-promises&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/vendor/guzzlehttp/promises/composer.json b/vendor/guzzlehttp/promises/composer.json new file mode 100644 index 00000000..c959fb32 --- /dev/null +++ b/vendor/guzzlehttp/promises/composer.json @@ -0,0 +1,58 @@ +{ + "name": "guzzlehttp/promises", + "description": "Guzzle promises library", + "keywords": ["promise"], + "license": "MIT", + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "require": { + "php": ">=5.5" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4 || ^5.1" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": ["src/functions_include.php"] + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Promise\\Tests\\": "tests/" + } + }, + "scripts": { + "test": "vendor/bin/simple-phpunit", + "test-ci": "vendor/bin/simple-phpunit --coverage-text" + }, + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "config": { + "preferred-install": "dist", + "sort-packages": true + } +} diff --git a/vendor/guzzlehttp/promises/src/AggregateException.php b/vendor/guzzlehttp/promises/src/AggregateException.php new file mode 100644 index 00000000..d2b5712b --- /dev/null +++ b/vendor/guzzlehttp/promises/src/AggregateException.php @@ -0,0 +1,17 @@ +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(); + } + }); + try { + $this->nextCoroutine($this->generator->current()); + } catch (\Exception $exception) { + $this->result->reject($exception); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } + + /** + * Create a new coroutine. + * + * @return self + */ + public static function of(callable $generatorFn) + { + return new self($generatorFn); + } + + 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 = Create::promiseFor($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(Create::exceptionFor($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/Create.php b/vendor/guzzlehttp/promises/src/Create.php new file mode 100644 index 00000000..8d038e9c --- /dev/null +++ b/vendor/guzzlehttp/promises/src/Create.php @@ -0,0 +1,84 @@ +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 + */ + public static function rejectionFor($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 + */ + public static function exceptionFor($reason) + { + if ($reason instanceof \Exception || $reason instanceof \Throwable) { + return $reason; + } + + return new RejectionException($reason); + } + + /** + * Returns an iterator for the given value. + * + * @param mixed $value + * + * @return \Iterator + */ + public static function iterFor($value) + { + if ($value instanceof \Iterator) { + return $value; + } + + if (is_array($value)) { + return new \ArrayIterator($value); + } + + return new \ArrayIterator([$value]); + } +} diff --git a/vendor/guzzlehttp/promises/src/Each.php b/vendor/guzzlehttp/promises/src/Each.php new file mode 100644 index 00000000..1dda3549 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/Each.php @@ -0,0 +1,90 @@ + $onFulfilled, + 'rejected' => $onRejected + ]))->promise(); + } + + /** + * Like of, 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 + */ + public static function ofLimit( + $iterable, + $concurrency, + callable $onFulfilled = null, + callable $onRejected = null + ) { + return (new EachPromise($iterable, [ + 'fulfilled' => $onFulfilled, + 'rejected' => $onRejected, + 'concurrency' => $concurrency + ]))->promise(); + } + + /** + * Like 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 + */ + public static function ofLimitAll( + $iterable, + $concurrency, + callable $onFulfilled = null + ) { + return each_limit( + $iterable, + $concurrency, + $onFulfilled, + function ($reason, $idx, PromiseInterface $aggregate) { + $aggregate->reject($reason); + } + ); + } +} diff --git a/vendor/guzzlehttp/promises/src/EachPromise.php b/vendor/guzzlehttp/promises/src/EachPromise.php new file mode 100644 index 00000000..38ecb59b --- /dev/null +++ b/vendor/guzzlehttp/promises/src/EachPromise.php @@ -0,0 +1,255 @@ +iterable = Create::iterFor($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']; + } + } + + /** @psalm-suppress InvalidNullableReturnType */ + public function promise() + { + if ($this->aggregate) { + return $this->aggregate; + } + + try { + $this->createPromise(); + /** @psalm-assert Promise $this->aggregate */ + $this->iterable->rewind(); + $this->refillPending(); + } catch (\Throwable $e) { + /** + * @psalm-suppress NullReference + * @phpstan-ignore-next-line + */ + $this->aggregate->reject($e); + } catch (\Exception $e) { + /** + * @psalm-suppress NullReference + * @phpstan-ignore-next-line + */ + $this->aggregate->reject($e); + } + + /** + * @psalm-suppress NullableReturnStatement + * @phpstan-ignore-next-line + */ + return $this->aggregate; + } + + private function createPromise() + { + $this->mutex = false; + $this->aggregate = new Promise(function () { + if ($this->checkIfFinished()) { + return; + } + reset($this->pending); + // 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 (Is::settled($this->aggregate)) { + return; + } + } + }); + + // Clear the references when the promise is resolved. + $clearFn = function () { + $this->iterable = $this->concurrency = $this->pending = null; + $this->onFulfilled = $this->onRejected = null; + $this->nextPendingIndex = 0; + }; + + $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 = Create::promiseFor($this->iterable->current()); + $key = $this->iterable->key(); + + // Iterable keys may not be unique, so we use a counter to + // guarantee uniqueness + $idx = $this->nextPendingIndex++; + + $this->pending[$idx] = $promise->then( + function ($value) use ($idx, $key) { + if ($this->onFulfilled) { + call_user_func( + $this->onFulfilled, + $value, + $key, + $this->aggregate + ); + } + $this->step($idx); + }, + function ($reason) use ($idx, $key) { + if ($this->onRejected) { + call_user_func( + $this->onRejected, + $reason, + $key, + $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 (Is::settled($this->aggregate)) { + 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 new file mode 100644 index 00000000..98f72a62 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/FulfilledPromise.php @@ -0,0 +1,84 @@ +value = $value; + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + // Return itself if there is no onFulfilled function. + if (!$onFulfilled) { + return $this; + } + + $queue = Utils::queue(); + $p = new Promise([$queue, 'run']); + $value = $this->value; + $queue->add(static function () use ($p, $value, $onFulfilled) { + if (Is::pending($p)) { + 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/Is.php b/vendor/guzzlehttp/promises/src/Is.php new file mode 100644 index 00000000..c3ed8d01 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/Is.php @@ -0,0 +1,46 @@ +getState() === PromiseInterface::PENDING; + } + + /** + * Returns true if a promise is fulfilled or rejected. + * + * @return bool + */ + public static function settled(PromiseInterface $promise) + { + return $promise->getState() !== PromiseInterface::PENDING; + } + + /** + * Returns true if a promise is fulfilled. + * + * @return bool + */ + public static function fulfilled(PromiseInterface $promise) + { + return $promise->getState() === PromiseInterface::FULFILLED; + } + + /** + * Returns true if a promise is rejected. + * + * @return bool + */ + public static function rejected(PromiseInterface $promise) + { + return $promise->getState() === PromiseInterface::REJECTED; + } +} diff --git a/vendor/guzzlehttp/promises/src/Promise.php b/vendor/guzzlehttp/promises/src/Promise.php new file mode 100644 index 00000000..75939057 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/Promise.php @@ -0,0 +1,278 @@ +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) { + $promise = Create::promiseFor($this->result); + return $onFulfilled ? $promise->then($onFulfilled) : $promise; + } + + // It's either cancelled or rejected, so return a rejected promise + // and immediately invoke any callbacks. + $rejection = Create::rejectionFor($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(); + + if ($this->result instanceof PromiseInterface) { + return $this->result->wait($unwrap); + } + if ($unwrap) { + if ($this->state === self::FULFILLED) { + return $this->result; + } + // It's rejected so "unwrap" and throw an exception. + throw Create::exceptionFor($this->result); + } + } + + 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. + /** @psalm-suppress RedundantCondition */ + 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 (!is_object($value) || !method_exists($value, 'then')) { + $id = $state === self::FULFILLED ? 1 : 2; + // It's a success, so resolve the handlers in the queue. + Utils::queue()->add(static function () use ($id, $value, $handlers) { + foreach ($handlers as $handler) { + self::callHandler($id, $value, $handler); + } + }); + } elseif ($value instanceof Promise && Is::pending($value)) { + // 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). + */ + 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 (Is::settled($promise)) { + return; + } + + try { + if (isset($handler[$index])) { + /* + * If $f throws an exception, then $handler will be in the exception + * stack trace. Since $handler contains a reference to the callable + * itself we get a circular reference. We clear the $handler + * here to avoid that memory leak. + */ + $f = $handler[$index]; + unset($handler); + $promise->resolve($f($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 no 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.'); + } + + Utils::queue()->run(); + + /** @psalm-suppress RedundantCondition */ + 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) { + do { + $result->waitIfPending(); + $result = $result->result; + } while ($result instanceof Promise); + + if ($result instanceof PromiseInterface) { + $result->wait(false); + } + } + } +} diff --git a/vendor/guzzlehttp/promises/src/PromiseInterface.php b/vendor/guzzlehttp/promises/src/PromiseInterface.php new file mode 100644 index 00000000..e5983314 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/PromiseInterface.php @@ -0,0 +1,97 @@ +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 = Utils::queue(); + $reason = $this->reason; + $p = new Promise([$queue, 'run']); + $queue->add(static function () use ($p, $reason, $onRejected) { + if (Is::pending($p)) { + 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 Create::exceptionFor($this->reason); + } + + return null; + } + + 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 new file mode 100644 index 00000000..e2f13770 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/RejectionException.php @@ -0,0 +1,48 @@ +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 new file mode 100644 index 00000000..f0fba2c5 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/TaskQueue.php @@ -0,0 +1,67 @@ +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() + { + while ($task = array_shift($this->queue)) { + /** @var callable $task */ + $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 new file mode 100644 index 00000000..723d4d54 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/TaskQueueInterface.php @@ -0,0 +1,24 @@ + + * while ($eventLoop->isRunning()) { + * GuzzleHttp\Promise\Utils::queue()->run(); + * } + * + * + * @param TaskQueueInterface $assign Optionally specify a new queue instance. + * + * @return TaskQueueInterface + */ + public static 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 + */ + public static function task(callable $task) + { + $queue = self::queue(); + $promise = new Promise([$queue, 'run']); + $queue->add(function () use ($task, $promise) { + try { + if (Is::pending($promise)) { + $promise->resolve($task()); + } + } catch (\Throwable $e) { + $promise->reject($e); + } catch (\Exception $e) { + $promise->reject($e); + } + }); + + return $promise; + } + + /** + * 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 + */ + public static 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. + * + * @see inspect for the inspection state array format. + * + * @param PromiseInterface[] $promises Traversable of promises to wait upon. + * + * @return array + */ + public static function inspectAll($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 iterable $promises Iterable of PromiseInterface objects to wait on. + * + * @return array + * + * @throws \Exception on error + * @throws \Throwable on error in PHP >=7 + */ + public static 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. + * @param bool $recursive If true, resolves new promises that might have been added to the stack during its own resolution. + * + * @return PromiseInterface + */ + public static function all($promises, $recursive = false) + { + $results = []; + $promise = Each::of( + $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; + }); + + if (true === $recursive) { + $promise = $promise->then(function ($results) use ($recursive, &$promises) { + foreach ($promises as $promise) { + if (Is::pending($promise)) { + return self::all($promises, $recursive); + } + } + return $results; + }); + } + + return $promise; + } + + /** + * 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 promise is rejected with a {@see 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 + */ + public static function some($count, $promises) + { + $results = []; + $rejections = []; + + return Each::of( + $promises, + function ($value, $idx, PromiseInterface $p) use (&$results, $count) { + if (Is::settled($p)) { + 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 + */ + public static function any($promises) + { + return self::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. + * + * @see inspect for the inspection state array format. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ + public static function settle($promises) + { + $results = []; + + return Each::of( + $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; + }); + } +} diff --git a/vendor/guzzlehttp/promises/src/functions.php b/vendor/guzzlehttp/promises/src/functions.php new file mode 100644 index 00000000..c03d39d0 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/functions.php @@ -0,0 +1,363 @@ + + * while ($eventLoop->isRunning()) { + * GuzzleHttp\Promise\queue()->run(); + * } + * + * + * @param TaskQueueInterface $assign Optionally specify a new queue instance. + * + * @return TaskQueueInterface + * + * @deprecated queue will be removed in guzzlehttp/promises:2.0. Use Utils::queue instead. + */ +function queue(TaskQueueInterface $assign = null) +{ + return Utils::queue($assign); +} + +/** + * 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 + * + * @deprecated task will be removed in guzzlehttp/promises:2.0. Use Utils::task instead. + */ +function task(callable $task) +{ + return Utils::task($task); +} + +/** + * Creates a promise for a value if the value is not a promise. + * + * @param mixed $value Promise or value. + * + * @return PromiseInterface + * + * @deprecated promise_for will be removed in guzzlehttp/promises:2.0. Use Create::promiseFor instead. + */ +function promise_for($value) +{ + return Create::promiseFor($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 + * + * @deprecated rejection_for will be removed in guzzlehttp/promises:2.0. Use Create::rejectionFor instead. + */ +function rejection_for($reason) +{ + return Create::rejectionFor($reason); +} + +/** + * Create an exception for a rejected promise value. + * + * @param mixed $reason + * + * @return \Exception|\Throwable + * + * @deprecated exception_for will be removed in guzzlehttp/promises:2.0. Use Create::exceptionFor instead. + */ +function exception_for($reason) +{ + return Create::exceptionFor($reason); +} + +/** + * Returns an iterator for the given value. + * + * @param mixed $value + * + * @return \Iterator + * + * @deprecated iter_for will be removed in guzzlehttp/promises:2.0. Use Create::iterFor instead. + */ +function iter_for($value) +{ + return Create::iterFor($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 + * + * @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspect instead. + */ +function inspect(PromiseInterface $promise) +{ + return Utils::inspect($promise); +} + +/** + * Waits on all of the provided promises, but does not unwrap rejected promises + * as thrown exception. + * + * Returns an array of inspection state arrays. + * + * @see inspect for the inspection state array format. + * + * @param PromiseInterface[] $promises Traversable of promises to wait upon. + * + * @return array + * + * @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspectAll instead. + */ +function inspect_all($promises) +{ + return Utils::inspectAll($promises); +} + +/** + * 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 iterable $promises Iterable of PromiseInterface objects to wait on. + * + * @return array + * + * @throws \Exception on error + * @throws \Throwable on error in PHP >=7 + * + * @deprecated unwrap will be removed in guzzlehttp/promises:2.0. Use Utils::unwrap instead. + */ +function unwrap($promises) +{ + return Utils::unwrap($promises); +} + +/** + * 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. + * @param bool $recursive If true, resolves new promises that might have been added to the stack during its own resolution. + * + * @return PromiseInterface + * + * @deprecated all will be removed in guzzlehttp/promises:2.0. Use Utils::all instead. + */ +function all($promises, $recursive = false) +{ + return Utils::all($promises, $recursive); +} + +/** + * 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 promise is rejected with a {@see 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 + * + * @deprecated some will be removed in guzzlehttp/promises:2.0. Use Utils::some instead. + */ +function some($count, $promises) +{ + return Utils::some($count, $promises); +} + +/** + * 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 + * + * @deprecated any will be removed in guzzlehttp/promises:2.0. Use Utils::any instead. + */ +function any($promises) +{ + return Utils::any($promises); +} + +/** + * 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. + * + * @see inspect for the inspection state array format. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + * + * @deprecated settle will be removed in guzzlehttp/promises:2.0. Use Utils::settle instead. + */ +function settle($promises) +{ + return Utils::settle($promises); +} + +/** + * 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 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 if needed. + * + * @param mixed $iterable Iterator or array to iterate over. + * @param callable $onFulfilled + * @param callable $onRejected + * + * @return PromiseInterface + * + * @deprecated each will be removed in guzzlehttp/promises:2.0. Use Each::of instead. + */ +function each( + $iterable, + callable $onFulfilled = null, + callable $onRejected = null +) { + return Each::of($iterable, $onFulfilled, $onRejected); +} + +/** + * 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 + * + * @deprecated each_limit will be removed in guzzlehttp/promises:2.0. Use Each::ofLimit instead. + */ +function each_limit( + $iterable, + $concurrency, + callable $onFulfilled = null, + callable $onRejected = null +) { + return Each::ofLimit($iterable, $concurrency, $onFulfilled, $onRejected); +} + +/** + * 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 + * + * @deprecated each_limit_all will be removed in guzzlehttp/promises:2.0. Use Each::ofLimitAll instead. + */ +function each_limit_all( + $iterable, + $concurrency, + callable $onFulfilled = null +) { + return Each::ofLimitAll($iterable, $concurrency, $onFulfilled); +} + +/** + * Returns true if a promise is fulfilled. + * + * @return bool + * + * @deprecated is_fulfilled will be removed in guzzlehttp/promises:2.0. Use Is::fulfilled instead. + */ +function is_fulfilled(PromiseInterface $promise) +{ + return Is::fulfilled($promise); +} + +/** + * Returns true if a promise is rejected. + * + * @return bool + * + * @deprecated is_rejected will be removed in guzzlehttp/promises:2.0. Use Is::rejected instead. + */ +function is_rejected(PromiseInterface $promise) +{ + return Is::rejected($promise); +} + +/** + * Returns true if a promise is fulfilled or rejected. + * + * @return bool + * + * @deprecated is_settled will be removed in guzzlehttp/promises:2.0. Use Is::settled instead. + */ +function is_settled(PromiseInterface $promise) +{ + return Is::settled($promise); +} + +/** + * Create a new coroutine. + * + * @see Coroutine + * + * @return PromiseInterface + * + * @deprecated coroutine will be removed in guzzlehttp/promises:2.0. Use Coroutine::of instead. + */ +function coroutine(callable $generatorFn) +{ + return Coroutine::of($generatorFn); +} diff --git a/vendor/guzzlehttp/promises/src/functions_include.php b/vendor/guzzlehttp/promises/src/functions_include.php new file mode 100644 index 00000000..34cd1710 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/functions_include.php @@ -0,0 +1,6 @@ +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` + + + +[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 new file mode 100644 index 00000000..51c7ec81 --- /dev/null +++ b/vendor/guzzlehttp/psr7/LICENSE @@ -0,0 +1,26 @@ +The MIT License (MIT) + +Copyright (c) 2015 Michael Dowling +Copyright (c) 2015 Márk Sági-Kazár +Copyright (c) 2015 Graham Campbell +Copyright (c) 2016 Tobias Schultze +Copyright (c) 2016 George Mponos +Copyright (c) 2018 Tobias Nyholm + +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 new file mode 100644 index 00000000..ed81c927 --- /dev/null +++ b/vendor/guzzlehttp/psr7/README.md @@ -0,0 +1,823 @@ +# 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. + +![CI](https://github.com/guzzle/psr7/workflows/CI/badge.svg) +![Static analysis](https://github.com/guzzle/psr7/workflows/Static%20analysis/badge.svg) + + +# 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\Utils::streamFor('abc, '); +$b = Psr7\Utils::streamFor('123.'); +$composed = new Psr7\AppendStream([$a, $b]); + +$composed->addStream(Psr7\Utils::streamFor(' 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\Utils::streamFor(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\Utils::streamFor(); + +// 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\Utils::streamFor('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 zlib (HTTP deflate, RFC1950) or gzipped (RFC1952) content. + +This stream decorator 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\Utils::streamFor(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\Utils::streamFor('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\Utils::streamFor('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\Utils::streamFor('hello!'); +$resource = StreamWrapper::getResource($stream); +echo fread($resource, 6); // outputs hello! +``` + + +# Static API + +There are various static methods available under the `GuzzleHttp\Psr7` namespace. + + +## `GuzzleHttp\Psr7\Message::toString` + +`public static function toString(MessageInterface $message): string` + +Returns the string representation of an HTTP message. + +```php +$request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com'); +echo GuzzleHttp\Psr7\Message::toString($request); +``` + + +## `GuzzleHttp\Psr7\Message::bodySummary` + +`public static function bodySummary(MessageInterface $message, int $truncateAt = 120): string|null` + +Get a short summary of the message body. + +Will return `null` if the response is not printable. + + +## `GuzzleHttp\Psr7\Message::rewindBody` + +`public static function rewindBody(MessageInterface $message): void` + +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`. + + +## `GuzzleHttp\Psr7\Message::parseMessage` + +`public static function parseMessage(string $message): array` + +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. + + +## `GuzzleHttp\Psr7\Message::parseRequestUri` + +`public static function parseRequestUri(string $path, array $headers): string` + +Constructs a URI for an HTTP request message. + + +## `GuzzleHttp\Psr7\Message::parseRequest` + +`public static function parseRequest(string $message): Request` + +Parses a request message string into a request object. + + +## `GuzzleHttp\Psr7\Message::parseResponse` + +`public static function parseResponse(string $message): Response` + +Parses a response message string into a response object. + + +## `GuzzleHttp\Psr7\Header::parse` + +`public static function parse(string|array $header): array` + +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. + + +## `GuzzleHttp\Psr7\Header::normalize` + +`public static function normalize(string|array $header): array` + +Converts an array of header values that may contain comma separated +headers into an array of headers with no comma separated values. + + +## `GuzzleHttp\Psr7\Query::parse` + +`public static function parse(string $str, int|bool $urlEncoding = true): array` + +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'])`. + + +## `GuzzleHttp\Psr7\Query::build` + +`public static function build(array $params, int|false $encoding = PHP_QUERY_RFC3986): string` + +Build a query string from an array of key value pairs. + +This function can use the return value of `parse()` to build a query +string. This function does not modify the provided keys when an array is +encountered (like `http_build_query()` would). + + +## `GuzzleHttp\Psr7\Utils::caselessRemove` + +`public static function caselessRemove(iterable $keys, $keys, array $data): array` + +Remove the items given by the keys, case insensitively from the data. + + +## `GuzzleHttp\Psr7\Utils::copyToStream` + +`public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1): void` + +Copy the contents of a stream into another stream until the given number +of bytes have been read. + + +## `GuzzleHttp\Psr7\Utils::copyToString` + +`public static function copyToString(StreamInterface $stream, int $maxLen = -1): string` + +Copy the contents of a stream into a string until the given number of +bytes have been read. + + +## `GuzzleHttp\Psr7\Utils::hash` + +`public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = false): string` + +Calculate a hash of a stream. + +This method reads the entire stream to calculate a rolling hash, based on +PHP's `hash_init` functions. + + +## `GuzzleHttp\Psr7\Utils::modifyRequest` + +`public static function modifyRequest(RequestInterface $request, array $changes): RequestInterface` + +Clone and modify a request with the given changes. + +This method is useful for reducing the number of clones needed to mutate +a message. + +- 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. + + +## `GuzzleHttp\Psr7\Utils::readLine` + +`public static function readLine(StreamInterface $stream, int $maxLength = null): string` + +Read a line from the stream up to the maximum allowed buffer length. + + +## `GuzzleHttp\Psr7\Utils::streamFor` + +`public static function streamFor(resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource = '', array $options = []): StreamInterface` + +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\Utils::streamFor('foo'); +$stream = GuzzleHttp\Psr7\Utils::streamFor(fopen('/path/to/file', 'r')); + +$generator = function ($bytes) { + for ($i = 0; $i < $bytes; $i++) { + yield ' '; + } +} + +$stream = GuzzleHttp\Psr7\Utils::streamFor($generator(100)); +``` + + +## `GuzzleHttp\Psr7\Utils::tryFopen` + +`public static function tryFopen(string $filename, string $mode): resource` + +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. + + +## `GuzzleHttp\Psr7\Utils::uriFor` + +`public static function uriFor(string|UriInterface $uri): UriInterface` + +Returns a UriInterface for the given value. + +This function accepts a string or UriInterface and returns a +UriInterface for the given value. If the value is already a +UriInterface, it is returned as-is. + + +## `GuzzleHttp\Psr7\MimeType::fromFilename` + +`public static function fromFilename(string $filename): string|null` + +Determines the mimetype of a file by looking at its extension. + + +## `GuzzleHttp\Psr7\MimeType::fromExtension` + +`public static function fromExtension(string $extension): string|null` + +Maps a file extensions to a mimetype. + + +## Upgrading from Function API + +The static API was first introduced in 1.7.0, in order to mitigate problems with functions conflicting between global and local copies of the package. The function API was removed in 2.0.0. A migration table has been provided here for your convenience: + +| Original Function | Replacement Method | +|----------------|----------------| +| `str` | `Message::toString` | +| `uri_for` | `Utils::uriFor` | +| `stream_for` | `Utils::streamFor` | +| `parse_header` | `Header::parse` | +| `normalize_header` | `Header::normalize` | +| `modify_request` | `Utils::modifyRequest` | +| `rewind_body` | `Message::rewindBody` | +| `try_fopen` | `Utils::tryFopen` | +| `copy_to_string` | `Utils::copyToString` | +| `copy_to_stream` | `Utils::copyToStream` | +| `hash` | `Utils::hash` | +| `readline` | `Utils::readLine` | +| `parse_request` | `Message::parseRequest` | +| `parse_response` | `Message::parseResponse` | +| `parse_query` | `Query::parse` | +| `build_query` | `Query::build` | +| `mimetype_from_filename` | `MimeType::fromFilename` | +| `mimetype_from_extension` | `MimeType::fromExtension` | +| `_parse_message` | `Message::parseMessage` | +| `_parse_request_uri` | `Message::parseRequestUri` | +| `get_message_body_summary` | `Message::bodySummary` | +| `_caseless_remove` | `Utils::caselessRemove` | + + +# 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. + + +## Security + +If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/psr7/security/policy) for more information. + +## License + +Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. + +## For Enterprise + +Available as part of the Tidelift Subscription + +The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-psr7?utm_source=packagist-guzzlehttp-psr7&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/vendor/guzzlehttp/psr7/composer.json b/vendor/guzzlehttp/psr7/composer.json new file mode 100644 index 00000000..885aa1da --- /dev/null +++ b/vendor/guzzlehttp/psr7/composer.json @@ -0,0 +1,89 @@ +{ + "name": "guzzlehttp/psr7", + "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": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.8 || ^9.3.10" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\Psr7\\": "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "config": { + "preferred-install": "dist", + "sort-packages": true + } +} diff --git a/vendor/guzzlehttp/psr7/src/AppendStream.php b/vendor/guzzlehttp/psr7/src/AppendStream.php new file mode 100644 index 00000000..967925f3 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/AppendStream.php @@ -0,0 +1,249 @@ +addStream($stream); + } + } + + public function __toString(): string + { + try { + $this->rewind(); + return $this->getContents(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + 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): void + { + 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(): string + { + return Utils::copyToString($this); + } + + /** + * Closes each attached stream. + */ + public function close(): void + { + $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. + */ + public function detach() + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->detach(); + } + + $this->streams = []; + + return null; + } + + public function tell(): int + { + 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. + */ + public function getSize(): ?int + { + $size = 0; + + foreach ($this->streams as $stream) { + $s = $stream->getSize(); + if ($s === null) { + return null; + } + $size += $s; + } + + return $size; + } + + public function eof(): bool + { + return !$this->streams || + ($this->current >= count($this->streams) - 1 && + $this->streams[$this->current]->eof()); + } + + public function rewind(): void + { + $this->seek(0); + } + + /** + * Attempts to seek to the given position. Only supports SEEK_SET. + */ + public function seek($offset, $whence = SEEK_SET): void + { + 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. + */ + public function read($length): string + { + $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); + + if ($result === '') { + $progressToNext = true; + continue; + } + + $buffer .= $result; + $remaining = $length - strlen($buffer); + } + + $this->pos += strlen($buffer); + + return $buffer; + } + + public function isReadable(): bool + { + return true; + } + + public function isWritable(): bool + { + return false; + } + + public function isSeekable(): bool + { + return $this->seekable; + } + + public function write($string): int + { + throw new \RuntimeException('Cannot write to an AppendStream'); + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + return $key ? null : []; + } +} diff --git a/vendor/guzzlehttp/psr7/src/BufferStream.php b/vendor/guzzlehttp/psr7/src/BufferStream.php new file mode 100644 index 00000000..21be8c0a --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/BufferStream.php @@ -0,0 +1,149 @@ +hwm = $hwm; + } + + public function __toString(): string + { + return $this->getContents(); + } + + public function getContents(): string + { + $buffer = $this->buffer; + $this->buffer = ''; + + return $buffer; + } + + public function close(): void + { + $this->buffer = ''; + } + + public function detach() + { + $this->close(); + + return null; + } + + public function getSize(): ?int + { + return strlen($this->buffer); + } + + public function isReadable(): bool + { + return true; + } + + public function isWritable(): bool + { + return true; + } + + public function isSeekable(): bool + { + return false; + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + throw new \RuntimeException('Cannot seek a BufferStream'); + } + + public function eof(): bool + { + return strlen($this->buffer) === 0; + } + + public function tell(): int + { + throw new \RuntimeException('Cannot determine the position of a BufferStream'); + } + + /** + * Reads data from the buffer. + */ + public function read($length): string + { + $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): int + { + $this->buffer .= $string; + + if (strlen($this->buffer) >= $this->hwm) { + return 0; + } + + return strlen($string); + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + 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 new file mode 100644 index 00000000..7a70ee94 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/CachingStream.php @@ -0,0 +1,148 @@ +remoteStream = $stream; + $this->stream = $target ?: new Stream(Utils::tryFopen('php://temp', 'r+')); + } + + public function getSize(): ?int + { + $remoteSize = $this->remoteStream->getSize(); + + if (null === $remoteSize) { + return null; + } + + return max($this->stream->getSize(), $remoteSize); + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + 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): string + { + // 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): int + { + // 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(): bool + { + return $this->stream->eof() && $this->remoteStream->eof(); + } + + /** + * Close both the remote stream and buffer stream + */ + public function close(): void + { + $this->remoteStream->close(); + $this->stream->close(); + } + + private function cacheEntireStream(): int + { + $target = new FnStream(['write' => 'strlen']); + Utils::copyToStream($this, $target); + + return $this->tell(); + } +} diff --git a/vendor/guzzlehttp/psr7/src/DroppingStream.php b/vendor/guzzlehttp/psr7/src/DroppingStream.php new file mode 100644 index 00000000..d78070ae --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/DroppingStream.php @@ -0,0 +1,46 @@ +stream = $stream; + $this->maxLength = $maxLength; + } + + public function write($string): int + { + $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/Exception/MalformedUriException.php b/vendor/guzzlehttp/psr7/src/Exception/MalformedUriException.php new file mode 100644 index 00000000..3a084779 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Exception/MalformedUriException.php @@ -0,0 +1,14 @@ + */ + private $methods; + + /** + * @param array $methods Hash of method name to a callable. + */ + public function __construct(array $methods) + { + $this->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(string $name): void + { + 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(): void + { + 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) { + /** @var callable $callable */ + $callable = [$stream, $diff]; + $methods[$diff] = $callable; + } + + return new self($methods); + } + + public function __toString(): string + { + try { + return call_user_func($this->_fn___toString); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; + } + } + + public function close(): void + { + call_user_func($this->_fn_close); + } + + public function detach() + { + return call_user_func($this->_fn_detach); + } + + public function getSize(): ?int + { + return call_user_func($this->_fn_getSize); + } + + public function tell(): int + { + return call_user_func($this->_fn_tell); + } + + public function eof(): bool + { + return call_user_func($this->_fn_eof); + } + + public function isSeekable(): bool + { + return call_user_func($this->_fn_isSeekable); + } + + public function rewind(): void + { + call_user_func($this->_fn_rewind); + } + + public function seek($offset, $whence = SEEK_SET): void + { + call_user_func($this->_fn_seek, $offset, $whence); + } + + public function isWritable(): bool + { + return call_user_func($this->_fn_isWritable); + } + + public function write($string): int + { + return call_user_func($this->_fn_write, $string); + } + + public function isReadable(): bool + { + return call_user_func($this->_fn_isReadable); + } + + public function read($length): string + { + return call_user_func($this->_fn_read, $length); + } + + public function getContents(): string + { + return call_user_func($this->_fn_getContents); + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + return call_user_func($this->_fn_getMetadata, $key); + } +} diff --git a/vendor/guzzlehttp/psr7/src/Header.php b/vendor/guzzlehttp/psr7/src/Header.php new file mode 100644 index 00000000..0e79a71a --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Header.php @@ -0,0 +1,69 @@ +]+>|[^=]+/', $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. + */ + public static function normalize($header): array + { + 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; + } +} diff --git a/vendor/guzzlehttp/psr7/src/HttpFactory.php b/vendor/guzzlehttp/psr7/src/HttpFactory.php new file mode 100644 index 00000000..30be222f --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/HttpFactory.php @@ -0,0 +1,100 @@ +getSize(); + } + + return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType); + } + + public function createStream(string $content = ''): StreamInterface + { + return Utils::streamFor($content); + } + + public function createStreamFromFile(string $file, string $mode = 'r'): StreamInterface + { + try { + $resource = Utils::tryFopen($file, $mode); + } catch (\RuntimeException $e) { + if ('' === $mode || false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], true)) { + throw new \InvalidArgumentException(sprintf('Invalid file opening mode "%s"', $mode), 0, $e); + } + + throw $e; + } + + return Utils::streamFor($resource); + } + + public function createStreamFromResource($resource): StreamInterface + { + return Utils::streamFor($resource); + } + + public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface + { + if (empty($method)) { + if (!empty($serverParams['REQUEST_METHOD'])) { + $method = $serverParams['REQUEST_METHOD']; + } else { + throw new \InvalidArgumentException('Cannot determine HTTP method'); + } + } + + return new ServerRequest($method, $uri, [], null, '1.1', $serverParams); + } + + public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface + { + return new Response($code, [], null, '1.1', $reasonPhrase); + } + + public function createRequest(string $method, $uri): RequestInterface + { + return new Request($method, $uri); + } + + public function createUri(string $uri = ''): UriInterface + { + return new Uri($uri); + } +} diff --git a/vendor/guzzlehttp/psr7/src/InflateStream.php b/vendor/guzzlehttp/psr7/src/InflateStream.php new file mode 100644 index 00000000..8e3cf171 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/InflateStream.php @@ -0,0 +1,34 @@ + 15 + 32]); + $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/LazyOpenStream.php b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php new file mode 100644 index 00000000..6b604296 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php @@ -0,0 +1,40 @@ +filename = $filename; + $this->mode = $mode; + } + + /** + * Creates the underlying stream lazily when required. + */ + protected function createStream(): StreamInterface + { + return Utils::streamFor(Utils::tryFopen($this->filename, $this->mode)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/LimitStream.php b/vendor/guzzlehttp/psr7/src/LimitStream.php new file mode 100644 index 00000000..9762d38a --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/LimitStream.php @@ -0,0 +1,154 @@ +stream = $stream; + $this->setLimit($limit); + $this->setOffset($offset); + } + + public function eof(): bool + { + // 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 + */ + public function getSize(): ?int + { + 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 + */ + public function seek($offset, $whence = SEEK_SET): void + { + 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() + */ + public function tell(): int + { + 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(int $offset): void + { + $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(int $limit): void + { + $this->limit = $limit; + } + + public function read($length): string + { + 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/Message.php b/vendor/guzzlehttp/psr7/src/Message.php new file mode 100644 index 00000000..9b825b30 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Message.php @@ -0,0 +1,242 @@ +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) { + if (strtolower($name) === 'set-cookie') { + foreach ($values as $value) { + $msg .= "\r\n{$name}: " . $value; + } + } else { + $msg .= "\r\n{$name}: " . implode(', ', $values); + } + } + + return "{$msg}\r\n\r\n" . $message->getBody(); + } + + /** + * 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 + */ + public static function bodySummary(MessageInterface $message, int $truncateAt = 120): ?string + { + $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]/u', $summary)) { + return null; + } + + return $summary; + } + + /** + * 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 + */ + public static function rewindBody(MessageInterface $message): void + { + $body = $message->getBody(); + + if ($body->tell()) { + $body->rewind(); + } + } + + /** + * 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. + */ + public static function parseMessage(string $message): array + { + 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'); + } + + [$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'); + } + + [$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). + */ + public static function parseRequestUri(string $path, array $headers): string + { + $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, '/'); + } + + /** + * Parses a request message string into a request object. + * + * @param string $message Request message string. + */ + public static function parseRequest(string $message): RequestInterface + { + $data = self::parseMessage($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] === '/' ? self::parseRequestUri($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. + */ + public static function parseResponse(string $message): ResponseInterface + { + $data = self::parseMessage($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( + (int) $parts[1], + $data['headers'], + $data['body'], + explode('/', $parts[0])[1], + $parts[2] ?? null + ); + } +} diff --git a/vendor/guzzlehttp/psr7/src/MessageTrait.php b/vendor/guzzlehttp/psr7/src/MessageTrait.php new file mode 100644 index 00000000..503c280b --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -0,0 +1,235 @@ + Map of all registered headers, as original name => 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|null */ + private $stream; + + public function getProtocolVersion(): string + { + return $this->protocol; + } + + public function withProtocolVersion($version): MessageInterface + { + if ($this->protocol === $version) { + return $this; + } + + $new = clone $this; + $new->protocol = $version; + return $new; + } + + public function getHeaders(): array + { + return $this->headers; + } + + public function hasHeader($header): bool + { + return isset($this->headerNames[strtolower($header)]); + } + + public function getHeader($header): array + { + $header = strtolower($header); + + if (!isset($this->headerNames[$header])) { + return []; + } + + $header = $this->headerNames[$header]; + + return $this->headers[$header]; + } + + public function getHeaderLine($header): string + { + return implode(', ', $this->getHeader($header)); + } + + public function withHeader($header, $value): MessageInterface + { + $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): MessageInterface + { + $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): MessageInterface + { + $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(): StreamInterface + { + if (!$this->stream) { + $this->stream = Utils::streamFor(''); + } + + return $this->stream; + } + + public function withBody(StreamInterface $body): MessageInterface + { + if ($body === $this->stream) { + return $this; + } + + $new = clone $this; + $new->stream = $body; + return $new; + } + + /** + * @param array $headers + */ + private function setHeaders(array $headers): void + { + $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; + } + } + } + + /** + * @param mixed $value + * + * @return string[] + */ + private function normalizeHeaderValue($value): array + { + 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 mixed[] $values Header values + * + * @return string[] Trimmed header values + * + * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 + */ + private function trimHeaderValues(array $values): array + { + 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"); + }, array_values($values)); + } + + /** + * @see https://tools.ietf.org/html/rfc7230#section-3.2 + * + * @param mixed $header + */ + private function assertHeader($header): void + { + 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 (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $header)) { + throw new \InvalidArgumentException( + sprintf( + '"%s" is not valid header name', + $header + ) + ); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/MimeType.php b/vendor/guzzlehttp/psr7/src/MimeType.php new file mode 100644 index 00000000..dfa94251 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MimeType.php @@ -0,0 +1,130 @@ + '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', + ]; + + /** + * Determines the mimetype of a file by looking at its extension. + */ + public static function fromFilename(string $filename): ?string + { + return self::fromExtension(pathinfo($filename, PATHINFO_EXTENSION)); + } + + /** + * Maps a file extensions to a mimetype. + * + * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types + */ + public static function fromExtension(string $extension): ?string + { + return self::MIME_TYPES[strtolower($extension)] ?? null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/MultipartStream.php b/vendor/guzzlehttp/psr7/src/MultipartStream.php new file mode 100644 index 00000000..f76d7c61 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MultipartStream.php @@ -0,0 +1,153 @@ +boundary = $boundary ?: sha1(uniqid('', true)); + $this->stream = $this->createStream($elements); + } + + public function getBoundary(): string + { + return $this->boundary; + } + + public function isWritable(): bool + { + return false; + } + + /** + * Get the headers needed before transferring the content of a POST file + * + * @param array $headers + */ + private function getHeaders(array $headers): string + { + $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 = []): StreamInterface + { + $stream = new AppendStream(); + + foreach ($elements as $element) { + $this->addElement($stream, $element); + } + + // Add the trailing boundary with CRLF + $stream->addStream(Utils::streamFor("--{$this->boundary}--\r\n")); + + return $stream; + } + + private function addElement(AppendStream $stream, array $element): void + { + foreach (['contents', 'name'] as $key) { + if (!array_key_exists($key, $element)) { + throw new \InvalidArgumentException("A '{$key}' key is required"); + } + } + + $element['contents'] = Utils::streamFor($element['contents']); + + if (empty($element['filename'])) { + $uri = $element['contents']->getMetadata('uri'); + if (substr($uri, 0, 6) !== 'php://') { + $element['filename'] = $uri; + } + } + + [$body, $headers] = $this->createElement( + $element['name'], + $element['contents'], + $element['filename'] ?? null, + $element['headers'] ?? [] + ); + + $stream->addStream(Utils::streamFor($this->getHeaders($headers))); + $stream->addStream($body); + $stream->addStream(Utils::streamFor("\r\n")); + } + + private function createElement(string $name, StreamInterface $stream, ?string $filename, array $headers): array + { + // 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::fromFilename($filename)) { + $headers['Content-Type'] = $type; + } + } + + return [$stream, $headers]; + } + + private function getHeader(array $headers, string $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 new file mode 100644 index 00000000..99e25b9e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/NoSeekStream.php @@ -0,0 +1,25 @@ +source = $source; + $this->size = $options['size'] ?? null; + $this->metadata = $options['metadata'] ?? []; + $this->buffer = new BufferStream(); + } + + public function __toString(): string + { + try { + return Utils::copyToString($this); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; + } + } + + public function close(): void + { + $this->detach(); + } + + public function detach() + { + $this->tellPos = 0; + $this->source = null; + + return null; + } + + public function getSize(): ?int + { + return $this->size; + } + + public function tell(): int + { + return $this->tellPos; + } + + public function eof(): bool + { + return $this->source === null; + } + + public function isSeekable(): bool + { + return false; + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + throw new \RuntimeException('Cannot seek a PumpStream'); + } + + public function isWritable(): bool + { + return false; + } + + public function write($string): int + { + throw new \RuntimeException('Cannot write to a PumpStream'); + } + + public function isReadable(): bool + { + return true; + } + + public function read($length): string + { + $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(): string + { + $result = ''; + while (!$this->eof()) { + $result .= $this->read(1000000); + } + + return $result; + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + if (!$key) { + return $this->metadata; + } + + return $this->metadata[$key] ?? null; + } + + private function pump(int $length): void + { + 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/Query.php b/vendor/guzzlehttp/psr7/src/Query.php new file mode 100644 index 00000000..4fd0ca96 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Query.php @@ -0,0 +1,113 @@ + '1', 'foo[b]' => '2'])`. + * + * @param string $str Query string to parse + * @param int|bool $urlEncoding How the query string is encoded + */ + public static function parse(string $str, $urlEncoding = true): array + { + $result = []; + + if ($str === '') { + return $result; + } + + if ($urlEncoding === true) { + $decoder = function ($value) { + return rawurldecode(str_replace('+', ' ', (string) $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()` 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. + */ + public static function build(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + 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((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? (int) $v : $v; + if ($v !== null) { + $qs .= '=' . $encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? (int) $vv : $vv; + if ($vv !== null) { + $qs .= '=' . $encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Request.php b/vendor/guzzlehttp/psr7/src/Request.php new file mode 100644 index 00000000..b17af66a --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Request.php @@ -0,0 +1,157 @@ + $headers Request headers + * @param string|resource|StreamInterface|null $body Request body + * @param string $version Protocol version + */ + public function __construct( + string $method, + $uri, + array $headers = [], + $body = null, + string $version = '1.1' + ) { + $this->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 = Utils::streamFor($body); + } + } + + public function getRequestTarget(): string + { + 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): RequestInterface + { + 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(): string + { + return $this->method; + } + + public function withMethod($method): RequestInterface + { + $this->assertMethod($method); + $new = clone $this; + $new->method = strtoupper($method); + return $new; + } + + public function getUri(): UriInterface + { + return $this->uri; + } + + public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface + { + 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(): void + { + $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; + } + + /** + * @param mixed $method + */ + private function assertMethod($method): void + { + 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 new file mode 100644 index 00000000..4c6ee6f0 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Response.php @@ -0,0 +1,160 @@ + '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', + 308 => 'Permanent 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', + 510 => 'Not Extended', + 511 => 'Network Authentication Required', + ]; + + /** @var string */ + private $reasonPhrase; + + /** @var int */ + private $statusCode; + + /** + * @param int $status Status code + * @param array $headers Response headers + * @param string|resource|StreamInterface|null $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( + int $status = 200, + array $headers = [], + $body = null, + string $version = '1.1', + string $reason = null + ) { + $this->assertStatusCodeRange($status); + + $this->statusCode = $status; + + if ($body !== '' && $body !== null) { + $this->stream = Utils::streamFor($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(): int + { + return $this->statusCode; + } + + public function getReasonPhrase(): string + { + return $this->reasonPhrase; + } + + public function withStatus($code, $reasonPhrase = ''): ResponseInterface + { + $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 = (string) $reasonPhrase; + return $new; + } + + /** + * @param mixed $statusCode + */ + private function assertStatusCodeIsInteger($statusCode): void + { + if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) { + throw new \InvalidArgumentException('Status code must be an integer value.'); + } + } + + private function assertStatusCodeRange(int $statusCode): void + { + 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 new file mode 100644 index 00000000..30224018 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Rfc7230.php @@ -0,0 +1,23 @@ +@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m"; + public const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; +} diff --git a/vendor/guzzlehttp/psr7/src/ServerRequest.php b/vendor/guzzlehttp/psr7/src/ServerRequest.php new file mode 100644 index 00000000..6ae3f9be --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/ServerRequest.php @@ -0,0 +1,344 @@ + $headers Request headers + * @param string|resource|StreamInterface|null $body Request body + * @param string $version Protocol version + * @param array $serverParams Typically the $_SERVER superglobal + */ + public function __construct( + string $method, + $uri, + array $headers = [], + $body = null, + string $version = '1.1', + array $serverParams = [] + ) { + $this->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 + */ + public static function normalizeFiles(array $files): array + { + $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 UploadedFileInterface|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. + * + * @return UploadedFileInterface[] + */ + private static function normalizeNestedFileSpec(array $files = []): array + { + $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 + */ + public static function fromGlobals(): ServerRequestInterface + { + $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(string $authority): array + { + $uri = 'http://' . $authority; + $parts = parse_url($uri); + if (false === $parts) { + return [null, null]; + } + + $host = $parts['host'] ?? null; + $port = $parts['port'] ?? null; + + return [$host, $port]; + } + + /** + * Get a Uri populated with values from $_SERVER. + */ + public static function getUriFromGlobals(): UriInterface + { + $uri = new Uri(''); + + $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'); + + $hasPort = false; + if (isset($_SERVER['HTTP_HOST'])) { + [$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; + } + + public function getServerParams(): array + { + return $this->serverParams; + } + + public function getUploadedFiles(): array + { + return $this->uploadedFiles; + } + + public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface + { + $new = clone $this; + $new->uploadedFiles = $uploadedFiles; + + return $new; + } + + public function getCookieParams(): array + { + return $this->cookieParams; + } + + public function withCookieParams(array $cookies): ServerRequestInterface + { + $new = clone $this; + $new->cookieParams = $cookies; + + return $new; + } + + public function getQueryParams(): array + { + return $this->queryParams; + } + + public function withQueryParams(array $query): ServerRequestInterface + { + $new = clone $this; + $new->queryParams = $query; + + return $new; + } + + /** + * {@inheritdoc} + * + * @return array|object|null + */ + public function getParsedBody() + { + return $this->parsedBody; + } + + public function withParsedBody($data): ServerRequestInterface + { + $new = clone $this; + $new->parsedBody = $data; + + return $new; + } + + public function getAttributes(): array + { + return $this->attributes; + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getAttribute($attribute, $default = null) + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $default; + } + + return $this->attributes[$attribute]; + } + + public function withAttribute($attribute, $value): ServerRequestInterface + { + $new = clone $this; + $new->attributes[$attribute] = $value; + + return $new; + } + + public function withoutAttribute($attribute): ServerRequestInterface + { + 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 new file mode 100644 index 00000000..d389427c --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Stream.php @@ -0,0 +1,279 @@ +size = $options['size']; + } + + $this->customMetadata = $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(): string + { + try { + if ($this->isSeekable()) { + $this->seek(0); + } + return $this->getContents(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; + } + } + + public function getContents(): string + { + 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(): void + { + 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(): ?int + { + 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 (is_array($stats) && isset($stats['size'])) { + $this->size = $stats['size']; + return $this->size; + } + + return null; + } + + public function isReadable(): bool + { + return $this->readable; + } + + public function isWritable(): bool + { + return $this->writable; + } + + public function isSeekable(): bool + { + return $this->seekable; + } + + public function eof(): bool + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + return feof($this->stream); + } + + public function tell(): int + { + 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(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + $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): string + { + 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): int + { + 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; + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + 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 $meta[$key] ?? null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php new file mode 100644 index 00000000..56d4104d --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php @@ -0,0 +1,155 @@ +stream = $stream; + } + + /** + * Magic method used to create a new stream if streams are not added in + * the constructor of a decorator (e.g., LazyOpenStream). + * + * @return StreamInterface + */ + public function __get(string $name) + { + if ($name === 'stream') { + $this->stream = $this->createStream(); + return $this->stream; + } + + throw new \UnexpectedValueException("$name not found on class"); + } + + public function __toString(): string + { + try { + if ($this->isSeekable()) { + $this->seek(0); + } + return $this->getContents(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; + } + } + + public function getContents(): string + { + return Utils::copyToString($this); + } + + /** + * Allow decorators to implement custom methods + * + * @return mixed + */ + public function __call(string $method, array $args) + { + /** @var callable $callable */ + $callable = [$this->stream, $method]; + $result = call_user_func_array($callable, $args); + + // Always return the wrapped object if the result is a return $this + return $result === $this->stream ? $this : $result; + } + + public function close(): void + { + $this->stream->close(); + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + return $this->stream->getMetadata($key); + } + + public function detach() + { + return $this->stream->detach(); + } + + public function getSize(): ?int + { + return $this->stream->getSize(); + } + + public function eof(): bool + { + return $this->stream->eof(); + } + + public function tell(): int + { + return $this->stream->tell(); + } + + public function isReadable(): bool + { + return $this->stream->isReadable(); + } + + public function isWritable(): bool + { + return $this->stream->isWritable(); + } + + public function isSeekable(): bool + { + return $this->stream->isSeekable(); + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + $this->stream->seek($offset, $whence); + } + + public function read($length): string + { + return $this->stream->read($length); + } + + public function write($string): int + { + return $this->stream->write($string); + } + + /** + * Implement in subclasses to dynamically create streams when requested. + * + * @throws \BadMethodCallException + */ + protected function createStream(): StreamInterface + { + throw new \BadMethodCallException('Not implemented'); + } +} diff --git a/vendor/guzzlehttp/psr7/src/StreamWrapper.php b/vendor/guzzlehttp/psr7/src/StreamWrapper.php new file mode 100644 index 00000000..2a934640 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/StreamWrapper.php @@ -0,0 +1,175 @@ +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, false, self::createStreamContext($stream)); + } + + /** + * Creates a stream context that can be used to open a stream as a php stream resource. + * + * @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(): void + { + if (!in_array('guzzle', stream_get_wrappers())) { + stream_wrapper_register('guzzle', __CLASS__); + } + } + + public function stream_open(string $path, string $mode, int $options, string &$opened_path = null): bool + { + $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(int $count): string + { + return $this->stream->read($count); + } + + public function stream_write(string $data): int + { + return $this->stream->write($data); + } + + public function stream_tell(): int + { + return $this->stream->tell(); + } + + public function stream_eof(): bool + { + return $this->stream->eof(); + } + + public function stream_seek(int $offset, int $whence): bool + { + $this->stream->seek($offset, $whence); + + return true; + } + + /** + * @return resource|false + */ + public function stream_cast(int $cast_as) + { + $stream = clone($this->stream); + $resource = $stream->detach(); + + return $resource ?? false; + } + + /** + * @return array + */ + public function stream_stat(): array + { + 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 + ]; + } + + /** + * @return array + */ + public function url_stat(string $path, int $flags): array + { + 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 new file mode 100644 index 00000000..b1521bcf --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UploadedFile.php @@ -0,0 +1,211 @@ +setError($errorStatus); + $this->size = $size; + $this->clientFilename = $clientFilename; + $this->clientMediaType = $clientMediaType; + + if ($this->isOk()) { + $this->setStreamOrFile($streamOrFile); + } + } + + /** + * Depending on the value set file or stream variable + * + * @param StreamInterface|string|resource $streamOrFile + * + * @throws InvalidArgumentException + */ + private function setStreamOrFile($streamOrFile): void + { + 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' + ); + } + } + + /** + * @throws InvalidArgumentException + */ + private function setError(int $error): void + { + if (false === in_array($error, UploadedFile::ERRORS, true)) { + throw new InvalidArgumentException( + 'Invalid error status for UploadedFile' + ); + } + + $this->error = $error; + } + + private function isStringNotEmpty($param): bool + { + return is_string($param) && false === empty($param); + } + + /** + * Return true if there is no upload error + */ + private function isOk(): bool + { + return $this->error === UPLOAD_ERR_OK; + } + + public function isMoved(): bool + { + return $this->moved; + } + + /** + * @throws RuntimeException if is moved or not ok + */ + private function validateActive(): void + { + 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'); + } + } + + public function getStream(): StreamInterface + { + $this->validateActive(); + + if ($this->stream instanceof StreamInterface) { + return $this->stream; + } + + /** @var string $file */ + $file = $this->file; + + return new LazyOpenStream($file, 'r+'); + } + + public function moveTo($targetPath): void + { + $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 === 'cli' + ? rename($this->file, $targetPath) + : move_uploaded_file($this->file, $targetPath); + } else { + Utils::copyToStream( + $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) + ); + } + } + + public function getSize(): ?int + { + return $this->size; + } + + public function getError(): int + { + return $this->error; + } + + public function getClientFilename(): ?string + { + return $this->clientFilename; + } + + public function getClientMediaType(): ?string + { + return $this->clientMediaType; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Uri.php b/vendor/guzzlehttp/psr7/src/Uri.php new file mode 100644 index 00000000..3898f783 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Uri.php @@ -0,0 +1,733 @@ + 80, + 'https' => 443, + 'ftp' => 21, + 'gopher' => 70, + 'nntp' => 119, + 'news' => 119, + 'telnet' => 23, + 'tn3270' => 23, + 'imap' => 143, + 'pop' => 110, + 'ldap' => 389, + ]; + + /** + * Unreserved characters for use in a regex. + * + * @link https://tools.ietf.org/html/rfc3986#section-2.3 + */ + private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~'; + + /** + * Sub-delims for use in a regex. + * + * @link https://tools.ietf.org/html/rfc3986#section-2.2 + */ + private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;='; + private const QUERY_SEPARATORS_REPLACEMENT = ['=' => '%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 = ''; + + /** @var string|null String representation */ + private $composedComponents; + + public function __construct(string $uri = '') + { + if ($uri !== '') { + $parts = self::parse($uri); + if ($parts === false) { + throw new MalformedUriException("Unable to parse URI: $uri"); + } + $this->applyParts($parts); + } + } + /** + * UTF-8 aware \parse_url() replacement. + * + * The internal function produces broken output for non ASCII domain names + * (IDN) when used with locales other than "C". + * + * On the other hand, cURL understands IDN correctly only when UTF-8 locale + * is configured ("C.UTF-8", "en_US.UTF-8", etc.). + * + * @see https://bugs.php.net/bug.php?id=52923 + * @see https://www.php.net/manual/en/function.parse-url.php#114817 + * @see https://curl.haxx.se/libcurl/c/CURLOPT_URL.html#ENCODING + * + * @return array|false + */ + private static function parse(string $url) + { + // If IPv6 + $prefix = ''; + if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) { + /** @var array{0:string, 1:string, 2:string} $matches */ + $prefix = $matches[1]; + $url = $matches[2]; + } + + /** @var string */ + $encodedUrl = preg_replace_callback( + '%[^:/@?&=#]+%usD', + static function ($matches) { + return urlencode($matches[0]); + }, + $url + ); + + $result = parse_url($prefix . $encodedUrl); + + if ($result === false) { + return false; + } + + return array_map('urldecode', $result); + } + + public function __toString(): string + { + if ($this->composedComponents === null) { + $this->composedComponents = self::composeComponents( + $this->scheme, + $this->getAuthority(), + $this->path, + $this->query, + $this->fragment + ); + } + + return $this->composedComponents; + } + + /** + * 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). + * + * @link https://tools.ietf.org/html/rfc3986#section-5.3 + */ + public static function composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment): string + { + $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. + */ + public static function isDefaultPort(UriInterface $uri): bool + { + return $uri->getPort() === null + || (isset(self::DEFAULT_PORTS[$uri->getScheme()]) && $uri->getPort() === self::DEFAULT_PORTS[$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' + * + * @see Uri::isNetworkPathReference + * @see Uri::isAbsolutePathReference + * @see Uri::isRelativePathReference + * @link https://tools.ietf.org/html/rfc3986#section-4 + */ + public static function isAbsolute(UriInterface $uri): bool + { + 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. + * + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isNetworkPathReference(UriInterface $uri): bool + { + 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. + * + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isAbsolutePathReference(UriInterface $uri): bool + { + 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. + * + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isRelativePathReference(UriInterface $uri): bool + { + 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 + * + * @link https://tools.ietf.org/html/rfc3986#section-4.4 + */ + public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool + { + 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() === ''; + } + + /** + * 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. + */ + public static function withoutQueryValue(UriInterface $uri, string $key): UriInterface + { + $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 + */ + public static function withQueryValue(UriInterface $uri, string $key, ?string $value): UriInterface + { + $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 + */ + public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface + { + $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); + + foreach ($keyValueArray as $key => $value) { + $result[] = self::generateQueryString((string) $key, $value !== null ? (string) $value : null); + } + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a URI from a hash of `parse_url` components. + * + * @link http://php.net/manual/en/function.parse-url.php + * + * @throws MalformedUriException If the components do not form a valid URI. + */ + public static function fromParts(array $parts): UriInterface + { + $uri = new self(); + $uri->applyParts($parts); + $uri->validateState(); + + return $uri; + } + + public function getScheme(): string + { + return $this->scheme; + } + + public function getAuthority(): string + { + $authority = $this->host; + if ($this->userInfo !== '') { + $authority = $this->userInfo . '@' . $authority; + } + + if ($this->port !== null) { + $authority .= ':' . $this->port; + } + + return $authority; + } + + public function getUserInfo(): string + { + return $this->userInfo; + } + + public function getHost(): string + { + return $this->host; + } + + public function getPort(): ?int + { + return $this->port; + } + + public function getPath(): string + { + return $this->path; + } + + public function getQuery(): string + { + return $this->query; + } + + public function getFragment(): string + { + return $this->fragment; + } + + public function withScheme($scheme): UriInterface + { + $scheme = $this->filterScheme($scheme); + + if ($this->scheme === $scheme) { + return $this; + } + + $new = clone $this; + $new->scheme = $scheme; + $new->composedComponents = null; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withUserInfo($user, $password = null): UriInterface + { + $info = $this->filterUserInfoComponent($user); + if ($password !== null) { + $info .= ':' . $this->filterUserInfoComponent($password); + } + + if ($this->userInfo === $info) { + return $this; + } + + $new = clone $this; + $new->userInfo = $info; + $new->composedComponents = null; + $new->validateState(); + + return $new; + } + + public function withHost($host): UriInterface + { + $host = $this->filterHost($host); + + if ($this->host === $host) { + return $this; + } + + $new = clone $this; + $new->host = $host; + $new->composedComponents = null; + $new->validateState(); + + return $new; + } + + public function withPort($port): UriInterface + { + $port = $this->filterPort($port); + + if ($this->port === $port) { + return $this; + } + + $new = clone $this; + $new->port = $port; + $new->composedComponents = null; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withPath($path): UriInterface + { + $path = $this->filterPath($path); + + if ($this->path === $path) { + return $this; + } + + $new = clone $this; + $new->path = $path; + $new->composedComponents = null; + $new->validateState(); + + return $new; + } + + public function withQuery($query): UriInterface + { + $query = $this->filterQueryAndFragment($query); + + if ($this->query === $query) { + return $this; + } + + $new = clone $this; + $new->query = $query; + $new->composedComponents = null; + + return $new; + } + + public function withFragment($fragment): UriInterface + { + $fragment = $this->filterQueryAndFragment($fragment); + + if ($this->fragment === $fragment) { + return $this; + } + + $new = clone $this; + $new->fragment = $fragment; + $new->composedComponents = null; + + return $new; + } + + /** + * Apply parse_url parts to a URI. + * + * @param array $parts Array of parse_url parts to apply. + */ + private function applyParts(array $parts): void + { + $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 mixed $scheme + * + * @throws \InvalidArgumentException If the scheme is invalid. + */ + private function filterScheme($scheme): string + { + if (!is_string($scheme)) { + throw new \InvalidArgumentException('Scheme must be a string'); + } + + return \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); + } + + /** + * @param mixed $component + * + * @throws \InvalidArgumentException If the user info is invalid. + */ + private function filterUserInfoComponent($component): string + { + if (!is_string($component)) { + throw new \InvalidArgumentException('User info must be a string'); + } + + return preg_replace_callback( + '/(?:[^%' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . ']+|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $component + ); + } + + /** + * @param mixed $host + * + * @throws \InvalidArgumentException If the host is invalid. + */ + private function filterHost($host): string + { + if (!is_string($host)) { + throw new \InvalidArgumentException('Host must be a string'); + } + + return \strtr($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); + } + + /** + * @param mixed $port + * + * @throws \InvalidArgumentException If the port is invalid. + */ + private function filterPort($port): ?int + { + 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 string[] $keys + * + * @return string[] + */ + private static function getFilteredQueryString(UriInterface $uri, array $keys): array + { + $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); + }); + } + + private static function generateQueryString(string $key, ?string $value): string + { + // 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::QUERY_SEPARATORS_REPLACEMENT); + + if ($value !== null) { + $queryString .= '=' . strtr($value, self::QUERY_SEPARATORS_REPLACEMENT); + } + + return $queryString; + } + + private function removeDefaultPort(): void + { + if ($this->port !== null && self::isDefaultPort($this)) { + $this->port = null; + } + } + + /** + * Filters the path of a URI + * + * @param mixed $path + * + * @throws \InvalidArgumentException If the path is invalid. + */ + private function filterPath($path): string + { + if (!is_string($path)) { + throw new \InvalidArgumentException('Path must be a string'); + } + + return preg_replace_callback( + '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $path + ); + } + + /** + * Filters the query string or fragment of a URI. + * + * @param mixed $str + * + * @throws \InvalidArgumentException If the query or fragment is invalid. + */ + private function filterQueryAndFragment($str): string + { + if (!is_string($str)) { + throw new \InvalidArgumentException('Query and fragment must be a string'); + } + + return preg_replace_callback( + '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $str + ); + } + + private function rawurlencodeMatchZero(array $match): string + { + return rawurlencode($match[0]); + } + + private function validateState(): void + { + 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 MalformedUriException('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 MalformedUriException('A relative URI must not have a path beginning with a segment containing a colon'); + } + } elseif (isset($this->path[0]) && $this->path[0] !== '/') { + throw new MalformedUriException('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 new file mode 100644 index 00000000..e12971ed --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriNormalizer.php @@ -0,0 +1,220 @@ +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 + * + * @link https://tools.ietf.org/html/rfc3986#section-6.1 + */ + public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, int $normalizations = self::PRESERVING_NORMALIZATIONS): bool + { + return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations); + } + + private static function capitalizePercentEncoding(UriInterface $uri): UriInterface + { + $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): UriInterface + { + $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 new file mode 100644 index 00000000..426e5c9a --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriResolver.php @@ -0,0 +1,211 @@ +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 + */ + public static function relativize(UriInterface $base, UriInterface $target): UriInterface + { + 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()); + /** @var string $lastSegment */ + $lastSegment = end($segments); + + return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment); + } + + return $emptyPathUri; + } + + private static function getRelativePath(UriInterface $base, UriInterface $target): string + { + $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/Utils.php b/vendor/guzzlehttp/psr7/src/Utils.php new file mode 100644 index 00000000..6cc04ee4 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Utils.php @@ -0,0 +1,412 @@ + $v) { + if (!is_string($k) || !in_array(strtolower($k), $keys)) { + $result[$k] = $v; + } + } + + return $result; + } + + /** + * 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. + */ + public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1): void + { + $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); + } + } + } + + /** + * 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. + * + * @throws \RuntimeException on error. + */ + public static function copyToString(StreamInterface $stream, int $maxLen = -1): string + { + $buffer = ''; + + if ($maxLen === -1) { + while (!$stream->eof()) { + $buf = $stream->read(1048576); + if ($buf === '') { + break; + } + $buffer .= $buf; + } + return $buffer; + } + + $len = 0; + while (!$stream->eof() && $len < $maxLen) { + $buf = $stream->read($maxLen - $len); + if ($buf === '') { + break; + } + $buffer .= $buf; + $len = strlen($buffer); + } + + return $buffer; + } + + /** + * Calculate a hash of a stream. + * + * This method reads the entire stream to calculate a rolling hash, based + * on PHP's `hash_init` functions. + * + * @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 + * + * @throws \RuntimeException on error. + */ + public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = false): string + { + $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; + } + + /** + * 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. + * + * @param RequestInterface $request Request to clone and modify. + * @param array $changes Changes to apply. + */ + public static function modifyRequest(RequestInterface $request, array $changes): RequestInterface + { + 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 = self::caselessRemove($changes['remove_headers'], $headers); + } + + if (!empty($changes['set_headers'])) { + $headers = self::caselessRemove(array_keys($changes['set_headers']), $headers); + $headers = $changes['set_headers'] + $headers; + } + + if (isset($changes['query'])) { + $uri = $uri->withQuery($changes['query']); + } + + if ($request instanceof ServerRequestInterface) { + $new = (new ServerRequest( + $changes['method'] ?? $request->getMethod(), + $uri, + $headers, + $changes['body'] ?? $request->getBody(), + $changes['version'] ?? $request->getProtocolVersion(), + $request->getServerParams() + )) + ->withParsedBody($request->getParsedBody()) + ->withQueryParams($request->getQueryParams()) + ->withCookieParams($request->getCookieParams()) + ->withUploadedFiles($request->getUploadedFiles()); + + foreach ($request->getAttributes() as $key => $value) { + $new = $new->withAttribute($key, $value); + } + + return $new; + } + + return new Request( + $changes['method'] ?? $request->getMethod(), + $uri, + $headers, + $changes['body'] ?? $request->getBody(), + $changes['version'] ?? $request->getProtocolVersion() + ); + } + + /** + * Read a line from the stream up to the maximum allowed buffer length. + * + * @param StreamInterface $stream Stream to read from + * @param int|null $maxLength Maximum buffer length + */ + public static function readLine(StreamInterface $stream, ?int $maxLength = null): string + { + $buffer = ''; + $size = 0; + + while (!$stream->eof()) { + if ('' === ($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; + } + + /** + * 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. + * + * @param resource|string|int|float|bool|StreamInterface|callable|\Iterator|null $resource Entity body data + * @param array{size?: int, metadata?: array} $options Additional options + * + * @throws \InvalidArgumentException if the $resource arg is not valid. + */ + public static function streamFor($resource = '', array $options = []): StreamInterface + { + if (is_scalar($resource)) { + $stream = self::tryFopen('php://temp', 'r+'); + if ($resource !== '') { + fwrite($stream, (string) $resource); + fseek($stream, 0); + } + return new Stream($stream, $options); + } + + switch (gettype($resource)) { + case 'resource': + /* + * The 'php://input' is a special stream with quirks and inconsistencies. + * We avoid using that stream by reading it into php://temp + */ + + /** @var resource $resource */ + if ((\stream_get_meta_data($resource)['uri'] ?? '') === 'php://input') { + $stream = self::tryFopen('php://temp', 'w+'); + fwrite($stream, stream_get_contents($resource)); + fseek($stream, 0); + $resource = $stream; + } + return new Stream($resource, $options); + case 'object': + /** @var object $resource */ + 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 self::streamFor((string) $resource, $options); + } + break; + case 'NULL': + return new Stream(self::tryFopen('php://temp', 'r+'), $options); + } + + if (is_callable($resource)) { + return new PumpStream($resource, $options); + } + + throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource)); + } + + /** + * 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 + */ + public static function tryFopen(string $filename, string $mode) + { + $ex = null; + set_error_handler(static function (int $errno, string $errstr) use ($filename, $mode, &$ex): bool { + $ex = new \RuntimeException(sprintf( + 'Unable to open "%s" using mode "%s": %s', + $filename, + $mode, + $errstr + )); + + return true; + }); + + try { + /** @var resource $handle */ + $handle = fopen($filename, $mode); + } catch (\Throwable $e) { + $ex = new \RuntimeException(sprintf( + 'Unable to open "%s" using mode "%s": %s', + $filename, + $mode, + $e->getMessage() + ), 0, $e); + } + + restore_error_handler(); + + if ($ex) { + /** @var $ex \RuntimeException */ + throw $ex; + } + + return $handle; + } + + /** + * Returns a UriInterface for the given value. + * + * This function accepts a string or 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 + * + * @throws \InvalidArgumentException + */ + public static function uriFor($uri): UriInterface + { + if ($uri instanceof UriInterface) { + return $uri; + } + + if (is_string($uri)) { + return new Uri($uri); + } + + throw new \InvalidArgumentException('URI must be a string or UriInterface'); + } +} diff --git a/vendor/guzzlehttp/psr7/vendor-bin/php-cs-fixer/composer.json b/vendor/guzzlehttp/psr7/vendor-bin/php-cs-fixer/composer.json new file mode 100644 index 00000000..d69a683b --- /dev/null +++ b/vendor/guzzlehttp/psr7/vendor-bin/php-cs-fixer/composer.json @@ -0,0 +1,9 @@ +{ + "require": { + "php": "^7.2.5 || ^8.0", + "friendsofphp/php-cs-fixer": "3.2.1" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/vendor/guzzlehttp/psr7/vendor-bin/phpstan/composer.json b/vendor/guzzlehttp/psr7/vendor-bin/phpstan/composer.json new file mode 100644 index 00000000..bfbc7273 --- /dev/null +++ b/vendor/guzzlehttp/psr7/vendor-bin/phpstan/composer.json @@ -0,0 +1,10 @@ +{ + "require": { + "php": "^7.2.5 || ^8.0", + "phpstan/phpstan": "0.12.81", + "phpstan/phpstan-deprecation-rules": "0.12.6" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/vendor/guzzlehttp/psr7/vendor-bin/psalm/composer.json b/vendor/guzzlehttp/psr7/vendor-bin/psalm/composer.json new file mode 100644 index 00000000..535a0797 --- /dev/null +++ b/vendor/guzzlehttp/psr7/vendor-bin/psalm/composer.json @@ -0,0 +1,9 @@ +{ + "require": { + "php": "^7.2.5 || ^8.0", + "psalm/phar": "4.6.2" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/vendor/hamcrest/hamcrest-php/.coveralls.yml b/vendor/hamcrest/hamcrest-php/.coveralls.yml new file mode 100644 index 00000000..f2f9ed58 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/.coveralls.yml @@ -0,0 +1 @@ +src_dir: hamcrest diff --git a/vendor/hamcrest/hamcrest-php/.github/workflows/tests.yml b/vendor/hamcrest/hamcrest-php/.github/workflows/tests.yml new file mode 100644 index 00000000..06255a1b --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/.github/workflows/tests.yml @@ -0,0 +1,38 @@ +name: tests + +on: + push: + pull_request: + +jobs: + tests: + + runs-on: ubuntu-latest + strategy: + matrix: + php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] + + name: PHP ${{ matrix.php }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: curl + tools: composer:v2 + coverage: none + + - name: Install PHP 7 dependencies + run: composer update --prefer-dist --no-interaction --no-progress + if: "matrix.php != '8.0'" + + - name: Install PHP 8 dependencies + run: composer update --prefer-dist --no-interaction --no-progress --ignore-platform-reqs + if: "matrix.php == '8.0'" + + - name: Execute tests + run: vendor/bin/phpunit -c tests/phpunit.xml.dist diff --git a/vendor/hamcrest/hamcrest-php/.gitignore b/vendor/hamcrest/hamcrest-php/.gitignore new file mode 100644 index 00000000..987e2a25 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/.gitignore @@ -0,0 +1,2 @@ +composer.lock +vendor diff --git a/vendor/hamcrest/hamcrest-php/.gush.yml b/vendor/hamcrest/hamcrest-php/.gush.yml new file mode 100644 index 00000000..b7c226d5 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/.gush.yml @@ -0,0 +1,7 @@ +adapter: github +issue_tracker: github +meta-header: "Copyright (c) 2009-2015 hamcrest.org" +table-pr: + fixed_tickets: ['Fixed Tickets', ''] + license: ['License', MIT] +base: master diff --git a/vendor/hamcrest/hamcrest-php/.travis.yml b/vendor/hamcrest/hamcrest-php/.travis.yml new file mode 100644 index 00000000..3b5651fa --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/.travis.yml @@ -0,0 +1,23 @@ +language: php + +dist: trusty + +matrix: + include: + - name: PHP 5.3 + php: 5.3 + dist: precise + - name: PHP 5.4 + php: 5.4 + - name: PHP 5.5 + php: 5.5 + - name: PHP 5.6 + php: 5.6 + - name: HHVM 3.18 + php: hhvm-3.18 + +install: + - travis_retry composer update --prefer-dist --no-progress + +script: + - vendor/bin/phpunit -c tests/phpunit.xml.dist diff --git a/vendor/hamcrest/hamcrest-php/CHANGES.txt b/vendor/hamcrest/hamcrest-php/CHANGES.txt new file mode 100644 index 00000000..bad8bcfe --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/CHANGES.txt @@ -0,0 +1,173 @@ +== Version 2.0.1: Released Jul 09 2020 == + +* Added support for PHP 8 + + +== Version 2.0: Released Feb 26 2016 == + +* Removed automatic loading of global functions + + +== Version 1.1.0: Released Feb 2 2012 == + +Issues Fixed: 121, 138, 147 + +* Added non-empty matchers to complement the emptiness-matching forms. + + - nonEmptyString() + - nonEmptyArray() + - nonEmptyTraversable() + +* Added ability to pass variable arguments to several array-based matcher + factory methods so they work like allOf() et al. + + - anArray() + - arrayContainingInAnyOrder(), containsInAnyOrder() + - arrayContaining(), contains() + - stringContainsInOrder() + +* Matchers that accept an array of matchers now also accept variable arguments. + Any non-matcher arguments are wrapped by IsEqual. + +* Added noneOf() as a shortcut for not(anyOf()). + + +== Version 1.0.0: Released Jan 20 2012 == + +Issues Fixed: 119, 136, 139, 141, 148, 149, 172 + +* Moved hamcrest.php into Hamcrest folder and renamed to Hamcrest.php. + This is more in line with PEAR packaging standards. + +* Renamed callable() to callableValue() for compatibility with PHP 5.4. + +* Added Hamcrest_Text_StringContainsIgnoringCase to assert using stripos(). + + assertThat('fOObAr', containsStringIgnoringCase('oba')); + assertThat('fOObAr', containsString('oba')->ignoringCase()); + +* Fixed Hamcrest_Core_IsInstanceOf to return false for native types. + +* Moved string-based matchers to Hamcrest_Text package. + StringContains, StringEndsWith, StringStartsWith, and SubstringMatcher + +* Hamcrest.php and Hamcrest_Matchers.php are now built from @factory doctags. + Added @factory doctag to every static factory method. + +* Hamcrest_Matchers and Hamcrest.php now import each matcher as-needed + and Hamcrest.php calls the matchers directly instead of Hamcrest_Matchers. + + +== Version 0.3.0: Released Jul 26 2010 == + +* Added running count to Hamcrest_MatcherAssert with methods to get and reset it. + This can be used by unit testing frameworks for reporting. + +* Added Hamcrest_Core_HasToString to assert return value of toString() or __toString(). + + assertThat($anObject, hasToString('foo')); + +* Added Hamcrest_Type_IsScalar to assert is_scalar(). + Matches values of type bool, int, float, double, and string. + + assertThat($count, scalarValue()); + assertThat('foo', scalarValue()); + +* Added Hamcrest_Collection package. + + - IsEmptyTraversable + - IsTraversableWithSize + + assertThat($iterator, emptyTraversable()); + assertThat($iterator, traversableWithSize(5)); + +* Added Hamcrest_Xml_HasXPath to assert XPath expressions or the content of nodes in an XML/HTML DOM. + + assertThat($dom, hasXPath('books/book/title')); + assertThat($dom, hasXPath('books/book[contains(title, "Alice")]', 3)); + assertThat($dom, hasXPath('books/book/title', 'Alice in Wonderland')); + assertThat($dom, hasXPath('count(books/book)', greaterThan(10))); + +* Added aliases to match the Java API. + + hasEntry() -> hasKeyValuePair() + hasValue() -> hasItemInArray() + contains() -> arrayContaining() + containsInAnyOrder() -> arrayContainingInAnyOrder() + +* Added optional subtype to Hamcrest_TypeSafeMatcher to enforce object class or resource type. + +* Hamcrest_TypeSafeDiagnosingMatcher now extends Hamcrest_TypeSafeMatcher. + + +== Version 0.2.0: Released Jul 14 2010 == + +Issues Fixed: 109, 111, 114, 115 + +* Description::appendValues() and appendValueList() accept Iterator and IteratorAggregate. [111] + BaseDescription::appendValue() handles IteratorAggregate. + +* assertThat() accepts a single boolean parameter and + wraps any non-Matcher third parameter with equalTo(). + +* Removed null return value from assertThat(). [114] + +* Fixed wrong variable name in contains(). [109] + +* Added Hamcrest_Core_IsSet to assert isset(). + + assertThat(array('foo' => 'bar'), set('foo')); + assertThat(array('foo' => 'bar'), notSet('bar')); + +* Added Hamcrest_Core_IsTypeOf to assert built-in types with gettype(). [115] + Types: array, boolean, double, integer, null, object, resource, and string. + Note that gettype() returns "double" for float values. + + assertThat($count, typeOf('integer')); + assertThat(3.14159, typeOf('double')); + assertThat(array('foo', 'bar'), typeOf('array')); + assertThat(new stdClass(), typeOf('object')); + +* Added type-specific matchers in new Hamcrest_Type package. + + - IsArray + - IsBoolean + - IsDouble (includes float values) + - IsInteger + - IsObject + - IsResource + - IsString + + assertThat($count, integerValue()); + assertThat(3.14159, floatValue()); + assertThat('foo', stringValue()); + +* Added Hamcrest_Type_IsNumeric to assert is_numeric(). + Matches values of type int and float/double or strings that are formatted as numbers. + + assertThat(5, numericValue()); + assertThat('-5e+3', numericValue()); + +* Added Hamcrest_Type_IsCallable to assert is_callable(). + + assertThat('preg_match', callable()); + assertThat(array('SomeClass', 'SomeMethod'), callable()); + assertThat(array($object, 'SomeMethod'), callable()); + assertThat($object, callable()); + assertThat(function ($x, $y) { return $x + $y; }, callable()); + +* Added Hamcrest_Text_MatchesPattern for regex matching with preg_match(). + + assertThat('foobar', matchesPattern('/o+b/')); + +* Added aliases: + - atLeast() for greaterThanOrEqualTo() + - atMost() for lessThanOrEqualTo() + + +== Version 0.1.0: Released Jul 7 2010 == + +* Created PEAR package + +* Core matchers + diff --git a/vendor/hamcrest/hamcrest-php/LICENSE.txt b/vendor/hamcrest/hamcrest-php/LICENSE.txt new file mode 100644 index 00000000..91cd329a --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/LICENSE.txt @@ -0,0 +1,27 @@ +BSD License + +Copyright (c) 2000-2014, www.hamcrest.org +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 Hamcrest 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 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/hamcrest/hamcrest-php/README.md b/vendor/hamcrest/hamcrest-php/README.md new file mode 100644 index 00000000..52e20413 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/README.md @@ -0,0 +1,488 @@ +This is the PHP port of Hamcrest Matchers +========================================= + +[![Build Status](https://travis-ci.org/hamcrest/hamcrest-php.png?branch=master)](https://travis-ci.org/hamcrest/hamcrest-php) + +Hamcrest is a matching library originally written for Java, but +subsequently ported to many other languages. hamcrest-php is the +official PHP port of Hamcrest and essentially follows a literal +translation of the original Java API for Hamcrest, with a few +Exceptions, mostly down to PHP language barriers: + + 1. `instanceOf($theClass)` is actually `anInstanceOf($theClass)` + + 2. `both(containsString('a'))->and(containsString('b'))` + is actually `both(containsString('a'))->andAlso(containsString('b'))` + + 3. `either(containsString('a'))->or(containsString('b'))` + is actually `either(containsString('a'))->orElse(containsString('b'))` + + 4. Unless it would be non-semantic for a matcher to do so, hamcrest-php + allows dynamic typing for it's input, in "the PHP way". Exception are + where semantics surrounding the type itself would suggest otherwise, + such as stringContains() and greaterThan(). + + 5. Several official matchers have not been ported because they don't + make sense or don't apply in PHP: + + - `typeCompatibleWith($theClass)` + - `eventFrom($source)` + - `hasProperty($name)` ** + - `samePropertyValuesAs($obj)` ** + + 6. When most of the collections matchers are finally ported, PHP-specific + aliases will probably be created due to a difference in naming + conventions between Java's Arrays, Collections, Sets and Maps compared + with PHP's Arrays. + +--- +** [Unless we consider POPO's (Plain Old PHP Objects) akin to JavaBeans] + - The POPO thing is a joke. Java devs coin the term POJO's (Plain Old + Java Objects). + + +Usage +----- + +Hamcrest matchers are easy to use as: + +```php +Hamcrest_MatcherAssert::assertThat('a', Hamcrest_Matchers::equalToIgnoringCase('A')); +``` + +Alternatively, you can use the global proxy-functions: + +```php +$result = true; +// with an identifier +assertThat("result should be true", $result, equalTo(true)); + +// without an identifier +assertThat($result, equalTo(true)); + +// evaluate a boolean expression +assertThat($result === true); + +// with syntactic sugar is() +assertThat(true, is(true)); +``` + +:warning: **NOTE:** the global proxy-functions aren't autoloaded by default, so you will need to load them first: + +```php +\Hamcrest\Util::registerGlobalFunctions(); +``` + +For brevity, all of the examples below use the proxy-functions. + + +Documentation +------------- +A tutorial can be found on the [Hamcrest site](https://code.google.com/archive/p/hamcrest/wikis/TutorialPHP.wiki). + + +Available Matchers +------------------ +* [Array](../master/README.md#array) +* [Collection](../master/README.md#collection) +* [Object](../master/README.md#object) +* [Numbers](../master/README.md#numbers) +* [Type checking](../master/README.md#type-checking) +* [XML](../master/README.md#xml) + + +### Array + +* `anArray` - evaluates an array +```php +assertThat([], anArray()); +``` + +* `hasItemInArray` - check if item exists in array +```php +$list = range(2, 7, 2); +$item = 4; +assertThat($list, hasItemInArray($item)); +``` + +* `hasValue` - alias of hasItemInArray + +* `arrayContainingInAnyOrder` - check if array contains elements in any order +```php +assertThat([2, 4, 6], arrayContainingInAnyOrder([6, 4, 2])); +assertThat([2, 4, 6], arrayContainingInAnyOrder([4, 2, 6])); +``` + +* `containsInAnyOrder` - alias of arrayContainingInAnyOrder + +* `arrayContaining` - An array with elements that match the given matchers in the same order. +```php +assertThat([2, 4, 6], arrayContaining([2, 4, 6])); +assertthat([2, 4, 6], not(arrayContaining([6, 4, 2]))); +``` + +* `contains` - check array in same order +```php +assertThat([2, 4, 6], contains([2, 4, 6])); +``` + +* `hasKeyInArray` - check if array has given key +```php +assertThat(['name'=> 'foobar'], hasKeyInArray('name')); +``` + +* `hasKey` - alias of hasKeyInArray + +* `hasKeyValuePair` - check if arary has given key, value pair +```php +assertThat(['name'=> 'foobar'], hasKeyValuePair('name', 'foobar')); +``` +* `hasEntry` - same as hasKeyValuePair + +* `arrayWithSize` - check array has given size +```php +assertthat([2, 4, 6], arrayWithSize(3)); +``` +* `emptyArray` - check if array is emtpy +```php +assertThat([], emptyArray()); +``` + +* `nonEmptyArray` +```php +assertThat([1], nonEmptyArray()); +``` + +### Collection + +* `emptyTraversable` - check if traversable is empty +```php +$empty_it = new EmptyIterator; +assertThat($empty_it, emptyTraversable()); +``` + +* `nonEmptyTraversable` - check if traversable isn't empty +```php +$non_empty_it = new ArrayIterator(range(1, 10)); +assertThat($non_empty_it, nonEmptyTraversable()); +a +``` + +* `traversableWithSize` +```php +$non_empty_it = new ArrayIterator(range(1, 10)); +assertThat($non_empty_it, traversableWithSize(count(range(1, 10)))); +` +``` + +### Core + +* `allOf` - Evaluates to true only if ALL of the passed in matchers evaluate to true. +```php +assertThat([2,4,6], allOf(hasValue(2), arrayWithSize(3))); +``` + +* `anyOf` - Evaluates to true if ANY of the passed in matchers evaluate to true. +```php +assertThat([2, 4, 6], anyOf(hasValue(8), hasValue(2))); +``` + +* `noneOf` - Evaluates to false if ANY of the passed in matchers evaluate to true. +```php +assertThat([2, 4, 6], noneOf(hasValue(1), hasValue(3))); +``` + +* `both` + `andAlso` - This is useful for fluently combining matchers that must both pass. +```php +assertThat([2, 4, 6], both(hasValue(2))->andAlso(hasValue(4))); +``` + +* `either` + `orElse` - This is useful for fluently combining matchers where either may pass, +```php +assertThat([2, 4, 6], either(hasValue(2))->orElse(hasValue(4))); +``` + +* `describedAs` - Wraps an existing matcher and overrides the description when it fails. +```php +$expected = "Dog"; +$found = null; +// this assertion would result error message as Expected: is not null but: was null +//assertThat("Expected {$expected}, got {$found}", $found, is(notNullValue())); +// and this assertion would result error message as Expected: Dog but: was null +//assertThat($found, describedAs($expected, notNullValue())); +``` + +* `everyItem` - A matcher to apply to every element in an array. +```php +assertThat([2, 4, 6], everyItem(notNullValue())); +``` + +* `hasItem` - check array has given item, it can take a matcher argument +```php +assertThat([2, 4, 6], hasItem(equalTo(2))); +``` + +* `hasItems` - check array has givem items, it can take multiple matcher as arguments +```php +assertThat([1, 3, 5], hasItems(equalTo(1), equalTo(3))); +``` + +### Object + +* `hasToString` - check `__toString` or `toString` method +```php +class Foo { + public $name = null; + + public function __toString() { + return "[Foo]Instance"; + } +} +$foo = new Foo; +assertThat($foo, hasToString(equalTo("[Foo]Instance"))); +``` + +* `equalTo` - compares two instances using comparison operator '==' +```php +$foo = new Foo; +$foo2 = new Foo; +assertThat($foo, equalTo($foo2)); +``` + +* `identicalTo` - compares two instances using identity operator '===' +```php +assertThat($foo, is(not(identicalTo($foo2)))); +``` + +* `anInstanceOf` - check instance is an instance|sub-class of given class +```php +assertThat($foo, anInstanceOf(Foo::class)); +``` + +* `any` - alias of `anInstanceOf` + +* `nullValue` check null +```php +assertThat(null, is(nullValue())); +``` + +* `notNullValue` check not null +```php +assertThat("", notNullValue()); +``` + +* `sameInstance` - check for same instance +```php +assertThat($foo, is(not(sameInstance($foo2)))); +assertThat($foo, is(sameInstance($foo))); +``` + +* `typeOf`- check type +```php +assertThat(1, typeOf("integer")); +``` + +* `notSet` - check if instance property is not set +```php +assertThat($foo, notSet("name")); +``` + +* `set` - check if instance property is set +```php +$foo->name = "bar"; +assertThat($foo, set("name")); +``` + +### Numbers + +* `closeTo` - check value close to a range +```php +assertThat(3, closeTo(3, 0.5)); +``` + +* `comparesEqualTo` - check with '==' +```php +assertThat(2, comparesEqualTo(2)); +``` + +* `greaterThan` - check '>' +``` +assertThat(2, greaterThan(1)); +``` + +* `greaterThanOrEqualTo` +```php +assertThat(2, greaterThanOrEqualTo(2)); +``` + +* `atLeast` - The value is >= given value +```php +assertThat(3, atLeast(2)); +``` +* `lessThan` +```php +assertThat(2, lessThan(3)); +``` + +* `lessThanOrEqualTo` +```php +assertThat(2, lessThanOrEqualTo(3)); +``` + +* `atMost` - The value is <= given value +```php +assertThat(2, atMost(3)); +``` + +### String + +* `emptyString` - check for empty string +```php +assertThat("", emptyString()); +``` + +* `isEmptyOrNullString` +```php +assertThat(null, isEmptyOrNullString()); +``` + +* `nullOrEmptyString` +```php +assertThat("", nullOrEmptyString()); +``` + +* `isNonEmptyString` +```php +assertThat("foo", isNonEmptyString()); +``` + +* `nonEmptyString` +```php +assertThat("foo", nonEmptyString()); +``` + +* `equalToIgnoringCase` +```php +assertThat("Foo", equalToIgnoringCase("foo")); +``` +* `equalToIgnoringWhiteSpace` +```php +assertThat(" Foo ", equalToIgnoringWhiteSpace("Foo")); +``` + +* `matchesPattern` - matches with regex pattern +```php +assertThat("foobarbaz", matchesPattern('/(foo)(bar)(baz)/')); +``` + +* `containsString` - check for substring +```php +assertThat("foobar", containsString("foo")); +``` + +* `containsStringIgnoringCase` +```php +assertThat("fooBar", containsStringIgnoringCase("bar")); +``` + +* `stringContainsInOrder` +```php +assertThat("foo", stringContainsInOrder("foo")); +``` + +* `endsWith` - check string that ends with given value +```php +assertThat("foo", endsWith("oo")); +``` + +* `startsWith` - check string that starts with given value +```php +assertThat("bar", startsWith("ba")); +``` + +### Type-checking + +* `arrayValue` - check array type +```php +assertThat([], arrayValue()); +``` + +* `booleanValue` +```php +assertThat(true, booleanValue()); +``` +* `boolValue` - alias of booleanValue + +* `callableValue` - check if value is callable +```php +$func = function () {}; +assertThat($func, callableValue()); +``` +* `doubleValue` +```php +assertThat(3.14, doubleValue()); +``` + +* `floatValue` +```php +assertThat(3.14, floatValue()); +``` + +* `integerValue` +```php +assertThat(1, integerValue()); +``` + +* `intValue` - alias of `integerValue` + +* `numericValue` - check if value is numeric +```php +assertThat("123", numericValue()); +``` + +* `objectValue` - check for object +```php +$obj = new stdClass; +assertThat($obj, objectValue()); +``` +* `anObject` +```php +assertThat($obj, anObject()); +``` + +* `resourceValue` - check resource type +```php +$fp = fopen("/tmp/foo", "w+"); +assertThat($fp, resourceValue()); +``` + +* `scalarValue` - check for scaler value +```php +assertThat(1, scalarValue()); +``` + +* `stringValue` +```php +assertThat("", stringValue()); +``` + +### XML + +* `hasXPath` - check xml with a xpath +```php +$xml = << + + 1 + + + 2 + + +XML; + +$doc = new DOMDocument; +$doc->loadXML($xml); +assertThat($doc, hasXPath("book", 2)); +``` + diff --git a/vendor/hamcrest/hamcrest-php/composer.json b/vendor/hamcrest/hamcrest-php/composer.json new file mode 100644 index 00000000..712ad965 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/composer.json @@ -0,0 +1,37 @@ +{ + "name": "hamcrest/hamcrest-php", + "type": "library", + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": ["test"], + "license": "BSD-3-Clause", + "authors": [ + ], + + "autoload": { + "classmap": ["hamcrest"] + }, + "autoload-dev": { + "classmap": ["tests", "generator"] + }, + + "require": { + "php": "^5.3|^7.0|^8.0" + }, + + "require-dev": { + "phpunit/php-file-iterator": "^1.4 || ^2.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" + }, + + "replace": { + "kodova/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "cordoval/hamcrest-php": "*" + }, + + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/FactoryCall.php b/vendor/hamcrest/hamcrest-php/generator/FactoryCall.php new file mode 100644 index 00000000..83965b2a --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/FactoryCall.php @@ -0,0 +1,41 @@ +method = $method; + $this->name = $name; + } + + public function getMethod() + { + return $this->method; + } + + public function getName() + { + return $this->name; + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/FactoryClass.php b/vendor/hamcrest/hamcrest-php/generator/FactoryClass.php new file mode 100644 index 00000000..a09cb73c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/FactoryClass.php @@ -0,0 +1,71 @@ +file = $file; + $this->reflector = $class; + $this->extractFactoryMethods(); + } + + public function extractFactoryMethods() + { + $this->methods = array(); + foreach ($this->getPublicStaticMethods() as $method) { + if ($method->isFactory()) { + $this->methods[] = $method; + } + } + } + + public function getPublicStaticMethods() + { + $methods = array(); + foreach ($this->reflector->getMethods(ReflectionMethod::IS_STATIC) as $method) { + if ($method->isPublic() && $method->getDeclaringClass() == $this->reflector) { + $methods[] = new FactoryMethod($this, $method); + } + } + return $methods; + } + + public function getFile() + { + return $this->file; + } + + public function getName() + { + return $this->reflector->name; + } + + public function isFactory() + { + return !empty($this->methods); + } + + public function getMethods() + { + return $this->methods; + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/FactoryFile.php b/vendor/hamcrest/hamcrest-php/generator/FactoryFile.php new file mode 100644 index 00000000..dd6109b1 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/FactoryFile.php @@ -0,0 +1,121 @@ +file = $file; + $this->indent = $indent; + } + + abstract public function addCall(FactoryCall $call); + + abstract public function build(); + + public function addFileHeader() + { + $this->code = ''; + $this->addPart('file_header'); + } + + public function addPart($name) + { + $this->addCode($this->readPart($name)); + } + + public function addCode($code) + { + $this->code .= $code; + } + + public function readPart($name) + { + return file_get_contents(__DIR__ . "/parts/$name.txt"); + } + + public function generateFactoryCall(FactoryCall $call) + { + $method = $call->getMethod(); + $code = $method->getComment($this->indent) . "\n"; + $code .= $this->generateDeclaration($call->getName(), $method); + $code .= $this->generateCall($method); + $code .= $this->generateClosing(); + return $code; + } + + public function generateDeclaration($name, FactoryMethod $method) + { + $code = $this->indent . $this->getDeclarationModifiers() + . 'function ' . $name . '(' + . $this->generateDeclarationArguments($method) + . ')' . "\n" . $this->indent . '{' . "\n"; + return $code; + } + + public function getDeclarationModifiers() + { + return ''; + } + + public function generateDeclarationArguments(FactoryMethod $method) + { + if ($method->acceptsVariableArguments()) { + return '/* args... */'; + } else { + return $method->getParameterDeclarations(); + } + } + + public function generateImport(FactoryMethod $method) + { + return $this->indent . self::INDENT . "require_once '" . $method->getClass()->getFile() . "';" . "\n"; + } + + public function generateCall(FactoryMethod $method) + { + $code = ''; + if ($method->acceptsVariableArguments()) { + $code .= $this->indent . self::INDENT . '$args = func_get_args();' . "\n"; + } + + $code .= $this->indent . self::INDENT . 'return '; + if ($method->acceptsVariableArguments()) { + $code .= 'call_user_func_array(array(\'' + . '\\' . $method->getClassName() . '\', \'' + . $method->getName() . '\'), $args);' . "\n"; + } else { + $code .= '\\' . $method->getClassName() . '::' + . $method->getName() . '(' + . $method->getParameterInvocations() . ');' . "\n"; + } + + return $code; + } + + public function generateClosing() + { + return $this->indent . '}' . "\n"; + } + + public function write() + { + file_put_contents($this->file, $this->code); + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/FactoryGenerator.php b/vendor/hamcrest/hamcrest-php/generator/FactoryGenerator.php new file mode 100644 index 00000000..242875a0 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/FactoryGenerator.php @@ -0,0 +1,124 @@ +path = $path; + $this->factoryFiles = array(); + } + + public function addFactoryFile(FactoryFile $factoryFile) + { + $this->factoryFiles[] = $factoryFile; + } + + public function generate() + { + $classes = $this->getClassesWithFactoryMethods(); + foreach ($classes as $class) { + foreach ($class->getMethods() as $method) { + foreach ($method->getCalls() as $call) { + foreach ($this->factoryFiles as $file) { + $file->addCall($call); + } + } + } + } + } + + public function write() + { + foreach ($this->factoryFiles as $file) { + $file->build(); + $file->write(); + } + } + + public function getClassesWithFactoryMethods() + { + $classes = array(); + $files = $this->getSortedFiles(); + foreach ($files as $file) { + $class = $this->getFactoryClass($file); + if ($class !== null) { + $classes[] = $class; + } + } + + return $classes; + } + + public function getSortedFiles() + { + $iter = $this->getFileIterator(); + $files = array(); + foreach ($iter as $file) { + $files[] = $file; + } + sort($files, SORT_STRING); + + return $files; + } + + private function getFileIterator() + { + $factoryClass = class_exists('File_Iterator_Factory') ? 'File_Iterator_Factory' : 'SebastianBergmann\FileIterator\Factory'; + + $factory = new $factoryClass(); + + return $factory->getFileIterator($this->path, '.php'); + } + + public function getFactoryClass($file) + { + $name = $this->getFactoryClassName($file); + if ($name !== null) { + require_once $file; + + if (class_exists($name)) { + $class = new FactoryClass(substr($file, strpos($file, 'Hamcrest/')), new ReflectionClass($name)); + if ($class->isFactory()) { + return $class; + } + } + } + + return null; + } + + public function getFactoryClassName($file) + { + $content = file_get_contents($file); + if (preg_match('/namespace\s+(.+);/', $content, $namespace) + && preg_match('/\n\s*class\s+(\w+)\s+extends\b/', $content, $className) + && preg_match('/@factory\b/', $content) + ) { + return $namespace[1] . '\\' . $className[1]; + } + + return null; + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/FactoryMethod.php b/vendor/hamcrest/hamcrest-php/generator/FactoryMethod.php new file mode 100644 index 00000000..8a05371b --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/FactoryMethod.php @@ -0,0 +1,231 @@ +class = $class; + $this->reflector = $reflector; + $this->extractCommentWithoutLeadingShashesAndStars(); + $this->extractFactoryNamesFromComment(); + $this->extractParameters(); + } + + public function extractCommentWithoutLeadingShashesAndStars() + { + $this->comment = explode("\n", $this->reflector->getDocComment()); + foreach ($this->comment as &$line) { + $line = preg_replace('#^\s*(/\\*+|\\*+/|\\*)\s?#', '', $line); + } + $this->trimLeadingBlankLinesFromComment(); + $this->trimTrailingBlankLinesFromComment(); + } + + public function trimLeadingBlankLinesFromComment() + { + while (count($this->comment) > 0) { + $line = array_shift($this->comment); + if (trim($line) != '') { + array_unshift($this->comment, $line); + break; + } + } + } + + public function trimTrailingBlankLinesFromComment() + { + while (count($this->comment) > 0) { + $line = array_pop($this->comment); + if (trim($line) != '') { + array_push($this->comment, $line); + break; + } + } + } + + public function extractFactoryNamesFromComment() + { + $this->calls = array(); + for ($i = 0; $i < count($this->comment); $i++) { + if ($this->extractFactoryNamesFromLine($this->comment[$i])) { + unset($this->comment[$i]); + } + } + $this->trimTrailingBlankLinesFromComment(); + } + + public function extractFactoryNamesFromLine($line) + { + if (preg_match('/^\s*@factory(\s+(.+))?$/', $line, $match)) { + $this->createCalls( + $this->extractFactoryNamesFromAnnotation( + isset($match[2]) ? trim($match[2]) : null + ) + ); + return true; + } + return false; + } + + public function extractFactoryNamesFromAnnotation($value) + { + $primaryName = $this->reflector->getName(); + if (empty($value)) { + return array($primaryName); + } + preg_match_all('/(\.{3}|-|[a-zA-Z_][a-zA-Z_0-9]*)/', $value, $match); + $names = $match[0]; + if (in_array('...', $names)) { + $this->isVarArgs = true; + } + if (!in_array('-', $names) && !in_array($primaryName, $names)) { + array_unshift($names, $primaryName); + } + return $names; + } + + public function createCalls(array $names) + { + $names = array_unique($names); + foreach ($names as $name) { + if ($name != '-' && $name != '...') { + $this->calls[] = new FactoryCall($this, $name); + } + } + } + + public function extractParameters() + { + $this->parameters = array(); + if (!$this->isVarArgs) { + foreach ($this->reflector->getParameters() as $parameter) { + $this->parameters[] = new FactoryParameter($this, $parameter); + } + } + } + + public function getParameterDeclarations() + { + if ($this->isVarArgs || !$this->hasParameters()) { + return ''; + } + $params = array(); + foreach ($this->parameters as /** @var $parameter FactoryParameter */ + $parameter) { + $params[] = $parameter->getDeclaration(); + } + return implode(', ', $params); + } + + public function getParameterInvocations() + { + if ($this->isVarArgs) { + return ''; + } + $params = array(); + foreach ($this->parameters as $parameter) { + $params[] = $parameter->getInvocation(); + } + return implode(', ', $params); + } + + + public function getClass() + { + return $this->class; + } + + public function getClassName() + { + return $this->class->getName(); + } + + public function getName() + { + return $this->reflector->name; + } + + public function isFactory() + { + return count($this->calls) > 0; + } + + public function getCalls() + { + return $this->calls; + } + + public function acceptsVariableArguments() + { + return $this->isVarArgs; + } + + public function hasParameters() + { + return !empty($this->parameters); + } + + public function getParameters() + { + return $this->parameters; + } + + public function getFullName() + { + return $this->getClassName() . '::' . $this->getName(); + } + + public function getCommentText() + { + return implode("\n", $this->comment); + } + + public function getComment($indent = '') + { + $comment = $indent . '/**'; + foreach ($this->comment as $line) { + $comment .= "\n" . rtrim($indent . ' * ' . $line); + } + $comment .= "\n" . $indent . ' */'; + return $comment; + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/FactoryParameter.php b/vendor/hamcrest/hamcrest-php/generator/FactoryParameter.php new file mode 100644 index 00000000..82b707ac --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/FactoryParameter.php @@ -0,0 +1,131 @@ +method = $method; + $this->reflector = $reflector; + } + + /** + * Compute the declaration code. + * + * @return string + */ + public function getDeclaration() + { + $code = $this->getTypeCode() . $this->getInvocation(); + + if ($this->reflector->isOptional()) { + $default = $this->reflector->getDefaultValue(); + if (is_null($default)) { + $default = 'null'; + } elseif (is_bool($default)) { + $default = $default ? 'true' : 'false'; + } elseif (is_string($default)) { + $default = "'" . $default . "'"; + } elseif (is_numeric($default)) { + $default = strval($default); + } elseif (is_array($default)) { + $default = 'array()'; + } else { + echo 'Warning: unknown default type for ' . $this->getMethod()->getFullName() . "\n"; + var_dump($default); + $default = 'null'; + } + $code .= ' = ' . $default; + } + return $code; + } + + /** + * Compute the type code for the paramater. + * + * @return string + */ + private function getTypeCode() + { + // Handle PHP 5 separately + if (PHP_VERSION_ID < 70000) { + if ($this->reflector->isArray()) { + return 'array'; + } + + $class = $this->reflector->getClass(); + + return $class ? sprintf('\\%s ', $class->getName()) : ''; + } + + if (!$this->reflector->hasType()) { + return ''; + } + + $type = $this->reflector->getType(); + $name = self::getQualifiedName($type); + + // PHP 7.1+ supports nullable types via a leading question mark + return (PHP_VERSION_ID >= 70100 && $type->allowsNull()) ? sprintf('?%s ', $name) : sprintf('%s ', $name); + } + + /** + * Compute qualified name for the given type. + * + * This function knows how to prefix class names with a leading slash and + * also how to handle PHP 8's union types. + * + * @param ReflectionType $type + * + * @return string + */ + private static function getQualifiedName(ReflectionType $type) + { + // PHP 8 union types can be recursively processed + if ($type instanceof ReflectionUnionType) { + return implode('|', array_map(function (ReflectionType $type) { + // The "self::" call within a Closure is fine here because this + // code will only ever be executed on PHP 7.0+ + return self::getQualifiedName($type); + }, $type->getTypes())); + } + + // PHP 7.0 doesn't have named types, but 7.1+ does + $name = $type instanceof ReflectionNamedType ? $type->getName() : (string) $type; + + return $type->isBuiltin() ? $name : sprintf('\\%s', $name); + } + + /** + * Compute the invocation code. + * + * @return string + */ + public function getInvocation() + { + return sprintf('$%s', $this->reflector->getName()); + } + + /** + * Compute the method name. + * + * @return string + */ + public function getMethod() + { + return $this->method; + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/GlobalFunctionFile.php b/vendor/hamcrest/hamcrest-php/generator/GlobalFunctionFile.php new file mode 100644 index 00000000..ec8b1b39 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/GlobalFunctionFile.php @@ -0,0 +1,42 @@ +functions = ''; + } + + public function addCall(FactoryCall $call) + { + $this->functions .= "\n" . $this->generateFactoryCall($call); + } + + public function build() + { + $this->addFileHeader(); + $this->addPart('functions_imports'); + $this->addPart('functions_header'); + $this->addCode($this->functions); + $this->addPart('functions_footer'); + } + + public function generateFactoryCall(FactoryCall $call) + { + $code = "if (!function_exists('{$call->getName()}')) {\n"; + $code.= parent::generateFactoryCall($call); + $code.= "}\n"; + + return $code; + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/StaticMethodFile.php b/vendor/hamcrest/hamcrest-php/generator/StaticMethodFile.php new file mode 100644 index 00000000..44cec02f --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/StaticMethodFile.php @@ -0,0 +1,38 @@ +methods = ''; + } + + public function addCall(FactoryCall $call) + { + $this->methods .= PHP_EOL . $this->generateFactoryCall($call); + } + + public function getDeclarationModifiers() + { + return 'public static '; + } + + public function build() + { + $this->addFileHeader(); + $this->addPart('matchers_imports'); + $this->addPart('matchers_header'); + $this->addCode($this->methods); + $this->addPart('matchers_footer'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/parts/file_header.txt b/vendor/hamcrest/hamcrest-php/generator/parts/file_header.txt new file mode 100644 index 00000000..7b352e44 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/parts/file_header.txt @@ -0,0 +1,7 @@ + + * //With an identifier + * assertThat("assertion identifier", $apple->flavour(), equalTo("tasty")); + * //Without an identifier + * assertThat($apple->flavour(), equalTo("tasty")); + * //Evaluating a boolean expression + * assertThat("some error", $a > $b); + * + */ + function assertThat() + { + $args = func_get_args(); + call_user_func_array( + array('Hamcrest\MatcherAssert', 'assertThat'), + $args + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/parts/functions_imports.txt b/vendor/hamcrest/hamcrest-php/generator/parts/functions_imports.txt new file mode 100644 index 00000000..e69de29b diff --git a/vendor/hamcrest/hamcrest-php/generator/parts/matchers_footer.txt b/vendor/hamcrest/hamcrest-php/generator/parts/matchers_footer.txt new file mode 100644 index 00000000..5c34318c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/parts/matchers_footer.txt @@ -0,0 +1 @@ +} diff --git a/vendor/hamcrest/hamcrest-php/generator/parts/matchers_header.txt b/vendor/hamcrest/hamcrest-php/generator/parts/matchers_header.txt new file mode 100644 index 00000000..4f8bb2b7 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/parts/matchers_header.txt @@ -0,0 +1,7 @@ + + +/** + * A series of static factories for all hamcrest matchers. + */ +class Matchers +{ diff --git a/vendor/hamcrest/hamcrest-php/generator/parts/matchers_imports.txt b/vendor/hamcrest/hamcrest-php/generator/parts/matchers_imports.txt new file mode 100644 index 00000000..7dd68495 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/parts/matchers_imports.txt @@ -0,0 +1,2 @@ + +namespace Hamcrest; \ No newline at end of file diff --git a/vendor/hamcrest/hamcrest-php/generator/run.php b/vendor/hamcrest/hamcrest-php/generator/run.php new file mode 100644 index 00000000..924d752f --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/run.php @@ -0,0 +1,37 @@ +addFactoryFile(new StaticMethodFile(STATIC_MATCHERS_FILE)); +$generator->addFactoryFile(new GlobalFunctionFile(GLOBAL_FUNCTIONS_FILE)); +$generator->generate(); +$generator->write(); diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php new file mode 100644 index 00000000..55a2dd8c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php @@ -0,0 +1,882 @@ + + * //With an identifier + * assertThat("assertion identifier", $apple->flavour(), equalTo("tasty")); + * //Without an identifier + * assertThat($apple->flavour(), equalTo("tasty")); + * //Evaluating a boolean expression + * assertThat("some error", $a > $b); + * + */ + function assertThat() + { + $args = func_get_args(); + call_user_func_array( + array('Hamcrest\MatcherAssert', 'assertThat'), + $args + ); + } +} + +if (!function_exists('anArray')) { + /** + * Evaluates to true only if each $matcher[$i] is satisfied by $array[$i]. + */ + function anArray(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Arrays\IsArray', 'anArray'), $args); + } +} + +if (!function_exists('hasItemInArray')) { + /** + * Evaluates to true if any item in an array satisfies the given matcher. + * + * @param mixed $item as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayContaining + */ + function hasItemInArray($item) + { + return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item); + } +} + +if (!function_exists('hasValue')) { + /** + * Evaluates to true if any item in an array satisfies the given matcher. + * + * @param mixed $item as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayContaining + */ + function hasValue($item) + { + return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item); + } +} + +if (!function_exists('arrayContainingInAnyOrder')) { + /** + * An array with elements that match the given matchers. + */ + function arrayContainingInAnyOrder(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args); + } +} + +if (!function_exists('containsInAnyOrder')) { + /** + * An array with elements that match the given matchers. + */ + function containsInAnyOrder(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args); + } +} + +if (!function_exists('arrayContaining')) { + /** + * An array with elements that match the given matchers in the same order. + */ + function arrayContaining(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args); + } +} + +if (!function_exists('contains')) { + /** + * An array with elements that match the given matchers in the same order. + */ + function contains(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args); + } +} + +if (!function_exists('hasKeyInArray')) { + /** + * Evaluates to true if any key in an array matches the given matcher. + * + * @param mixed $key as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayContainingKey + */ + function hasKeyInArray($key) + { + return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key); + } +} + +if (!function_exists('hasKey')) { + /** + * Evaluates to true if any key in an array matches the given matcher. + * + * @param mixed $key as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayContainingKey + */ + function hasKey($key) + { + return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key); + } +} + +if (!function_exists('hasKeyValuePair')) { + /** + * Test if an array has both an key and value in parity with each other. + */ + function hasKeyValuePair($key, $value) + { + return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value); + } +} + +if (!function_exists('hasEntry')) { + /** + * Test if an array has both an key and value in parity with each other. + */ + function hasEntry($key, $value) + { + return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value); + } +} + +if (!function_exists('arrayWithSize')) { + /** + * Does array size satisfy a given matcher? + * + * @param \Hamcrest\Matcher|int $size as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayWithSize + */ + function arrayWithSize($size) + { + return \Hamcrest\Arrays\IsArrayWithSize::arrayWithSize($size); + } +} + +if (!function_exists('emptyArray')) { + /** + * Matches an empty array. + */ + function emptyArray() + { + return \Hamcrest\Arrays\IsArrayWithSize::emptyArray(); + } +} + +if (!function_exists('nonEmptyArray')) { + /** + * Matches an empty array. + */ + function nonEmptyArray() + { + return \Hamcrest\Arrays\IsArrayWithSize::nonEmptyArray(); + } +} + +if (!function_exists('emptyTraversable')) { + /** + * Returns true if traversable is empty. + */ + function emptyTraversable() + { + return \Hamcrest\Collection\IsEmptyTraversable::emptyTraversable(); + } +} + +if (!function_exists('nonEmptyTraversable')) { + /** + * Returns true if traversable is not empty. + */ + function nonEmptyTraversable() + { + return \Hamcrest\Collection\IsEmptyTraversable::nonEmptyTraversable(); + } +} + +if (!function_exists('traversableWithSize')) { + /** + * Does traversable size satisfy a given matcher? + */ + function traversableWithSize($size) + { + return \Hamcrest\Collection\IsTraversableWithSize::traversableWithSize($size); + } +} + +if (!function_exists('allOf')) { + /** + * Evaluates to true only if ALL of the passed in matchers evaluate to true. + */ + function allOf(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\AllOf', 'allOf'), $args); + } +} + +if (!function_exists('anyOf')) { + /** + * Evaluates to true if ANY of the passed in matchers evaluate to true. + */ + function anyOf(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'anyOf'), $args); + } +} + +if (!function_exists('noneOf')) { + /** + * Evaluates to false if ANY of the passed in matchers evaluate to true. + */ + function noneOf(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'noneOf'), $args); + } +} + +if (!function_exists('both')) { + /** + * This is useful for fluently combining matchers that must both pass. + * For example: + *
+     *   assertThat($string, both(containsString("a"))->andAlso(containsString("b")));
+     * 
+ */ + function both(\Hamcrest\Matcher $matcher) + { + return \Hamcrest\Core\CombinableMatcher::both($matcher); + } +} + +if (!function_exists('either')) { + /** + * This is useful for fluently combining matchers where either may pass, + * for example: + *
+     *   assertThat($string, either(containsString("a"))->orElse(containsString("b")));
+     * 
+ */ + function either(\Hamcrest\Matcher $matcher) + { + return \Hamcrest\Core\CombinableMatcher::either($matcher); + } +} + +if (!function_exists('describedAs')) { + /** + * Wraps an existing matcher and overrides the description when it fails. + */ + function describedAs(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\DescribedAs', 'describedAs'), $args); + } +} + +if (!function_exists('everyItem')) { + /** + * @param Matcher $itemMatcher + * A matcher to apply to every element in an array. + * + * @return \Hamcrest\Core\Every + * Evaluates to TRUE for a collection in which every item matches $itemMatcher + */ + function everyItem(\Hamcrest\Matcher $itemMatcher) + { + return \Hamcrest\Core\Every::everyItem($itemMatcher); + } +} + +if (!function_exists('hasToString')) { + /** + * Does array size satisfy a given matcher? + */ + function hasToString($matcher) + { + return \Hamcrest\Core\HasToString::hasToString($matcher); + } +} + +if (!function_exists('is')) { + /** + * Decorates another Matcher, retaining the behavior but allowing tests + * to be slightly more expressive. + * + * For example: assertThat($cheese, equalTo($smelly)) + * vs. assertThat($cheese, is(equalTo($smelly))) + */ + function is($value) + { + return \Hamcrest\Core\Is::is($value); + } +} + +if (!function_exists('anything')) { + /** + * This matcher always evaluates to true. + * + * @param string $description A meaningful string used when describing itself. + * + * @return \Hamcrest\Core\IsAnything + */ + function anything($description = 'ANYTHING') + { + return \Hamcrest\Core\IsAnything::anything($description); + } +} + +if (!function_exists('hasItem')) { + /** + * Test if the value is an array containing this matcher. + * + * Example: + *
+     * assertThat(array('a', 'b'), hasItem(equalTo('b')));
+     * //Convenience defaults to equalTo()
+     * assertThat(array('a', 'b'), hasItem('b'));
+     * 
+ */ + function hasItem(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItem'), $args); + } +} + +if (!function_exists('hasItems')) { + /** + * Test if the value is an array containing elements that match all of these + * matchers. + * + * Example: + *
+     * assertThat(array('a', 'b', 'c'), hasItems(equalTo('a'), equalTo('b')));
+     * 
+ */ + function hasItems(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItems'), $args); + } +} + +if (!function_exists('equalTo')) { + /** + * Is the value equal to another value, as tested by the use of the "==" + * comparison operator? + */ + function equalTo($item) + { + return \Hamcrest\Core\IsEqual::equalTo($item); + } +} + +if (!function_exists('identicalTo')) { + /** + * Tests of the value is identical to $value as tested by the "===" operator. + */ + function identicalTo($value) + { + return \Hamcrest\Core\IsIdentical::identicalTo($value); + } +} + +if (!function_exists('anInstanceOf')) { + /** + * Is the value an instance of a particular type? + * This version assumes no relationship between the required type and + * the signature of the method that sets it up, for example in + * assertThat($anObject, anInstanceOf('Thing')); + */ + function anInstanceOf($theClass) + { + return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass); + } +} + +if (!function_exists('any')) { + /** + * Is the value an instance of a particular type? + * This version assumes no relationship between the required type and + * the signature of the method that sets it up, for example in + * assertThat($anObject, anInstanceOf('Thing')); + */ + function any($theClass) + { + return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass); + } +} + +if (!function_exists('not')) { + /** + * Matches if value does not match $value. + */ + function not($value) + { + return \Hamcrest\Core\IsNot::not($value); + } +} + +if (!function_exists('nullValue')) { + /** + * Matches if value is null. + */ + function nullValue() + { + return \Hamcrest\Core\IsNull::nullValue(); + } +} + +if (!function_exists('notNullValue')) { + /** + * Matches if value is not null. + */ + function notNullValue() + { + return \Hamcrest\Core\IsNull::notNullValue(); + } +} + +if (!function_exists('sameInstance')) { + /** + * Creates a new instance of IsSame. + * + * @param mixed $object + * The predicate evaluates to true only when the argument is + * this object. + * + * @return \Hamcrest\Core\IsSame + */ + function sameInstance($object) + { + return \Hamcrest\Core\IsSame::sameInstance($object); + } +} + +if (!function_exists('typeOf')) { + /** + * Is the value a particular built-in type? + */ + function typeOf($theType) + { + return \Hamcrest\Core\IsTypeOf::typeOf($theType); + } +} + +if (!function_exists('set')) { + /** + * Matches if value (class, object, or array) has named $property. + */ + function set($property) + { + return \Hamcrest\Core\Set::set($property); + } +} + +if (!function_exists('notSet')) { + /** + * Matches if value (class, object, or array) does not have named $property. + */ + function notSet($property) + { + return \Hamcrest\Core\Set::notSet($property); + } +} + +if (!function_exists('closeTo')) { + /** + * Matches if value is a number equal to $value within some range of + * acceptable error $delta. + */ + function closeTo($value, $delta) + { + return \Hamcrest\Number\IsCloseTo::closeTo($value, $delta); + } +} + +if (!function_exists('comparesEqualTo')) { + /** + * The value is not > $value, nor < $value. + */ + function comparesEqualTo($value) + { + return \Hamcrest\Number\OrderingComparison::comparesEqualTo($value); + } +} + +if (!function_exists('greaterThan')) { + /** + * The value is > $value. + */ + function greaterThan($value) + { + return \Hamcrest\Number\OrderingComparison::greaterThan($value); + } +} + +if (!function_exists('greaterThanOrEqualTo')) { + /** + * The value is >= $value. + */ + function greaterThanOrEqualTo($value) + { + return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value); + } +} + +if (!function_exists('atLeast')) { + /** + * The value is >= $value. + */ + function atLeast($value) + { + return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value); + } +} + +if (!function_exists('lessThan')) { + /** + * The value is < $value. + */ + function lessThan($value) + { + return \Hamcrest\Number\OrderingComparison::lessThan($value); + } +} + +if (!function_exists('lessThanOrEqualTo')) { + /** + * The value is <= $value. + */ + function lessThanOrEqualTo($value) + { + return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value); + } +} + +if (!function_exists('atMost')) { + /** + * The value is <= $value. + */ + function atMost($value) + { + return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value); + } +} + +if (!function_exists('isEmptyString')) { + /** + * Matches if value is a zero-length string. + */ + function isEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyString(); + } +} + +if (!function_exists('emptyString')) { + /** + * Matches if value is a zero-length string. + */ + function emptyString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyString(); + } +} + +if (!function_exists('isEmptyOrNullString')) { + /** + * Matches if value is null or a zero-length string. + */ + function isEmptyOrNullString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString(); + } +} + +if (!function_exists('nullOrEmptyString')) { + /** + * Matches if value is null or a zero-length string. + */ + function nullOrEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString(); + } +} + +if (!function_exists('isNonEmptyString')) { + /** + * Matches if value is a non-zero-length string. + */ + function isNonEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isNonEmptyString(); + } +} + +if (!function_exists('nonEmptyString')) { + /** + * Matches if value is a non-zero-length string. + */ + function nonEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isNonEmptyString(); + } +} + +if (!function_exists('equalToIgnoringCase')) { + /** + * Matches if value is a string equal to $string, regardless of the case. + */ + function equalToIgnoringCase($string) + { + return \Hamcrest\Text\IsEqualIgnoringCase::equalToIgnoringCase($string); + } +} + +if (!function_exists('equalToIgnoringWhiteSpace')) { + /** + * Matches if value is a string equal to $string, regardless of whitespace. + */ + function equalToIgnoringWhiteSpace($string) + { + return \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace($string); + } +} + +if (!function_exists('matchesPattern')) { + /** + * Matches if value is a string that matches regular expression $pattern. + */ + function matchesPattern($pattern) + { + return \Hamcrest\Text\MatchesPattern::matchesPattern($pattern); + } +} + +if (!function_exists('containsString')) { + /** + * Matches if value is a string that contains $substring. + */ + function containsString($substring) + { + return \Hamcrest\Text\StringContains::containsString($substring); + } +} + +if (!function_exists('containsStringIgnoringCase')) { + /** + * Matches if value is a string that contains $substring regardless of the case. + */ + function containsStringIgnoringCase($substring) + { + return \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase($substring); + } +} + +if (!function_exists('stringContainsInOrder')) { + /** + * Matches if value contains $substrings in a constrained order. + */ + function stringContainsInOrder(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Text\StringContainsInOrder', 'stringContainsInOrder'), $args); + } +} + +if (!function_exists('endsWith')) { + /** + * Matches if value is a string that ends with $substring. + */ + function endsWith($substring) + { + return \Hamcrest\Text\StringEndsWith::endsWith($substring); + } +} + +if (!function_exists('startsWith')) { + /** + * Matches if value is a string that starts with $substring. + */ + function startsWith($substring) + { + return \Hamcrest\Text\StringStartsWith::startsWith($substring); + } +} + +if (!function_exists('arrayValue')) { + /** + * Is the value an array? + */ + function arrayValue() + { + return \Hamcrest\Type\IsArray::arrayValue(); + } +} + +if (!function_exists('booleanValue')) { + /** + * Is the value a boolean? + */ + function booleanValue() + { + return \Hamcrest\Type\IsBoolean::booleanValue(); + } +} + +if (!function_exists('boolValue')) { + /** + * Is the value a boolean? + */ + function boolValue() + { + return \Hamcrest\Type\IsBoolean::booleanValue(); + } +} + +if (!function_exists('callableValue')) { + /** + * Is the value callable? + */ + function callableValue() + { + return \Hamcrest\Type\IsCallable::callableValue(); + } +} + +if (!function_exists('doubleValue')) { + /** + * Is the value a float/double? + */ + function doubleValue() + { + return \Hamcrest\Type\IsDouble::doubleValue(); + } +} + +if (!function_exists('floatValue')) { + /** + * Is the value a float/double? + */ + function floatValue() + { + return \Hamcrest\Type\IsDouble::doubleValue(); + } +} + +if (!function_exists('integerValue')) { + /** + * Is the value an integer? + */ + function integerValue() + { + return \Hamcrest\Type\IsInteger::integerValue(); + } +} + +if (!function_exists('intValue')) { + /** + * Is the value an integer? + */ + function intValue() + { + return \Hamcrest\Type\IsInteger::integerValue(); + } +} + +if (!function_exists('numericValue')) { + /** + * Is the value a numeric? + */ + function numericValue() + { + return \Hamcrest\Type\IsNumeric::numericValue(); + } +} + +if (!function_exists('objectValue')) { + /** + * Is the value an object? + */ + function objectValue() + { + return \Hamcrest\Type\IsObject::objectValue(); + } +} + +if (!function_exists('anObject')) { + /** + * Is the value an object? + */ + function anObject() + { + return \Hamcrest\Type\IsObject::objectValue(); + } +} + +if (!function_exists('resourceValue')) { + /** + * Is the value a resource? + */ + function resourceValue() + { + return \Hamcrest\Type\IsResource::resourceValue(); + } +} + +if (!function_exists('scalarValue')) { + /** + * Is the value a scalar (boolean, integer, double, or string)? + */ + function scalarValue() + { + return \Hamcrest\Type\IsScalar::scalarValue(); + } +} + +if (!function_exists('stringValue')) { + /** + * Is the value a string? + */ + function stringValue() + { + return \Hamcrest\Type\IsString::stringValue(); + } +} + +if (!function_exists('hasXPath')) { + /** + * Wraps $matcher with {@link Hamcrest\Core\IsEqual) + * if it's not a matcher and the XPath in count() + * if it's an integer. + */ + function hasXPath($xpath, $matcher = null) + { + return \Hamcrest\Xml\HasXPath::hasXPath($xpath, $matcher); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php new file mode 100644 index 00000000..9ea56970 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php @@ -0,0 +1,118 @@ +_elementMatchers = $elementMatchers; + } + + protected function matchesSafely($array) + { + if (array_keys($array) != array_keys($this->_elementMatchers)) { + return false; + } + + /** @var $matcher \Hamcrest\Matcher */ + foreach ($this->_elementMatchers as $k => $matcher) { + if (!$matcher->matches($array[$k])) { + return false; + } + } + + return true; + } + + protected function describeMismatchSafely($actual, Description $mismatchDescription) + { + if (count($actual) != count($this->_elementMatchers)) { + $mismatchDescription->appendText('array length was ' . count($actual)); + + return; + } elseif (array_keys($actual) != array_keys($this->_elementMatchers)) { + $mismatchDescription->appendText('array keys were ') + ->appendValueList( + $this->descriptionStart(), + $this->descriptionSeparator(), + $this->descriptionEnd(), + array_keys($actual) + ) + ; + + return; + } + + /** @var $matcher \Hamcrest\Matcher */ + foreach ($this->_elementMatchers as $k => $matcher) { + if (!$matcher->matches($actual[$k])) { + $mismatchDescription->appendText('element ')->appendValue($k) + ->appendText(' was ')->appendValue($actual[$k]); + + return; + } + } + } + + public function describeTo(Description $description) + { + $description->appendList( + $this->descriptionStart(), + $this->descriptionSeparator(), + $this->descriptionEnd(), + $this->_elementMatchers + ); + } + + /** + * Evaluates to true only if each $matcher[$i] is satisfied by $array[$i]. + * + * @factory ... + */ + public static function anArray(/* args... */) + { + $args = func_get_args(); + + return new self(Util::createMatcherArray($args)); + } + + // -- Protected Methods + + protected function descriptionStart() + { + return '['; + } + + protected function descriptionSeparator() + { + return ', '; + } + + protected function descriptionEnd() + { + return ']'; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php new file mode 100644 index 00000000..0e4a1eda --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php @@ -0,0 +1,63 @@ +_elementMatcher = $elementMatcher; + } + + protected function matchesSafely($array) + { + foreach ($array as $element) { + if ($this->_elementMatcher->matches($element)) { + return true; + } + } + + return false; + } + + protected function describeMismatchSafely($array, Description $mismatchDescription) + { + $mismatchDescription->appendText('was ')->appendValue($array); + } + + public function describeTo(Description $description) + { + $description + ->appendText('an array containing ') + ->appendDescriptionOf($this->_elementMatcher) + ; + } + + /** + * Evaluates to true if any item in an array satisfies the given matcher. + * + * @param mixed $item as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayContaining + * @factory hasValue + */ + public static function hasItemInArray($item) + { + return new self(Util::wrapValueWithIsEqual($item)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php new file mode 100644 index 00000000..9009026b --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php @@ -0,0 +1,59 @@ +_elementMatchers = $elementMatchers; + } + + protected function matchesSafelyWithDiagnosticDescription($array, Description $mismatchDescription) + { + $matching = new MatchingOnce($this->_elementMatchers, $mismatchDescription); + + foreach ($array as $element) { + if (!$matching->matches($element)) { + return false; + } + } + + return $matching->isFinished($array); + } + + public function describeTo(Description $description) + { + $description->appendList('[', ', ', ']', $this->_elementMatchers) + ->appendText(' in any order') + ; + } + + /** + * An array with elements that match the given matchers. + * + * @factory containsInAnyOrder ... + */ + public static function arrayContainingInAnyOrder(/* args... */) + { + $args = func_get_args(); + + return new self(Util::createMatcherArray($args)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php new file mode 100644 index 00000000..61157404 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php @@ -0,0 +1,57 @@ +_elementMatchers = $elementMatchers; + } + + protected function matchesSafelyWithDiagnosticDescription($array, Description $mismatchDescription) + { + $series = new SeriesMatchingOnce($this->_elementMatchers, $mismatchDescription); + + foreach ($array as $element) { + if (!$series->matches($element)) { + return false; + } + } + + return $series->isFinished(); + } + + public function describeTo(Description $description) + { + $description->appendList('[', ', ', ']', $this->_elementMatchers); + } + + /** + * An array with elements that match the given matchers in the same order. + * + * @factory contains ... + */ + public static function arrayContaining(/* args... */) + { + $args = func_get_args(); + + return new self(Util::createMatcherArray($args)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php new file mode 100644 index 00000000..523477e7 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php @@ -0,0 +1,75 @@ +_keyMatcher = $keyMatcher; + } + + protected function matchesSafely($array) + { + foreach ($array as $key => $element) { + if ($this->_keyMatcher->matches($key)) { + return true; + } + } + + return false; + } + + protected function describeMismatchSafely($array, Description $mismatchDescription) + { + //Not using appendValueList() so that keys can be shown + $mismatchDescription->appendText('array was ') + ->appendText('[') + ; + $loop = false; + foreach ($array as $key => $value) { + if ($loop) { + $mismatchDescription->appendText(', '); + } + $mismatchDescription->appendValue($key)->appendText(' => ')->appendValue($value); + $loop = true; + } + $mismatchDescription->appendText(']'); + } + + public function describeTo(Description $description) + { + $description + ->appendText('array with key ') + ->appendDescriptionOf($this->_keyMatcher) + ; + } + + /** + * Evaluates to true if any key in an array matches the given matcher. + * + * @param mixed $key as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayContainingKey + * @factory hasKey + */ + public static function hasKeyInArray($key) + { + return new self(Util::wrapValueWithIsEqual($key)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php new file mode 100644 index 00000000..9ac3eba8 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php @@ -0,0 +1,80 @@ +_keyMatcher = $keyMatcher; + $this->_valueMatcher = $valueMatcher; + } + + protected function matchesSafely($array) + { + foreach ($array as $key => $value) { + if ($this->_keyMatcher->matches($key) && $this->_valueMatcher->matches($value)) { + return true; + } + } + + return false; + } + + protected function describeMismatchSafely($array, Description $mismatchDescription) + { + //Not using appendValueList() so that keys can be shown + $mismatchDescription->appendText('array was ') + ->appendText('[') + ; + $loop = false; + foreach ($array as $key => $value) { + if ($loop) { + $mismatchDescription->appendText(', '); + } + $mismatchDescription->appendValue($key)->appendText(' => ')->appendValue($value); + $loop = true; + } + $mismatchDescription->appendText(']'); + } + + public function describeTo(Description $description) + { + $description->appendText('array containing [') + ->appendDescriptionOf($this->_keyMatcher) + ->appendText(' => ') + ->appendDescriptionOf($this->_valueMatcher) + ->appendText(']') + ; + } + + /** + * Test if an array has both an key and value in parity with each other. + * + * @factory hasEntry + */ + public static function hasKeyValuePair($key, $value) + { + return new self( + Util::wrapValueWithIsEqual($key), + Util::wrapValueWithIsEqual($value) + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayWithSize.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayWithSize.php new file mode 100644 index 00000000..074375ce --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayWithSize.php @@ -0,0 +1,73 @@ +_elementMatchers = $elementMatchers; + $this->_mismatchDescription = $mismatchDescription; + } + + public function matches($item) + { + return $this->_isNotSurplus($item) && $this->_isMatched($item); + } + + public function isFinished($items) + { + if (empty($this->_elementMatchers)) { + return true; + } + + $this->_mismatchDescription + ->appendText('No item matches: ')->appendList('', ', ', '', $this->_elementMatchers) + ->appendText(' in ')->appendValueList('[', ', ', ']', $items) + ; + + return false; + } + + // -- Private Methods + + private function _isNotSurplus($item) + { + if (empty($this->_elementMatchers)) { + $this->_mismatchDescription->appendText('Not matched: ')->appendValue($item); + + return false; + } + + return true; + } + + private function _isMatched($item) + { + /** @var $matcher \Hamcrest\Matcher */ + foreach ($this->_elementMatchers as $i => $matcher) { + if ($matcher->matches($item)) { + unset($this->_elementMatchers[$i]); + + return true; + } + } + + $this->_mismatchDescription->appendText('Not matched: ')->appendValue($item); + + return false; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php new file mode 100644 index 00000000..12a912d8 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php @@ -0,0 +1,75 @@ +_elementMatchers = $elementMatchers; + $this->_keys = array_keys($elementMatchers); + $this->_mismatchDescription = $mismatchDescription; + } + + public function matches($item) + { + return $this->_isNotSurplus($item) && $this->_isMatched($item); + } + + public function isFinished() + { + if (!empty($this->_elementMatchers)) { + $nextMatcher = current($this->_elementMatchers); + $this->_mismatchDescription->appendText('No item matched: ')->appendDescriptionOf($nextMatcher); + + return false; + } + + return true; + } + + // -- Private Methods + + private function _isNotSurplus($item) + { + if (empty($this->_elementMatchers)) { + $this->_mismatchDescription->appendText('Not matched: ')->appendValue($item); + + return false; + } + + return true; + } + + private function _isMatched($item) + { + $this->_nextMatchKey = array_shift($this->_keys); + $nextMatcher = array_shift($this->_elementMatchers); + + if (!$nextMatcher->matches($item)) { + $this->_describeMismatch($nextMatcher, $item); + + return false; + } + + return true; + } + + private function _describeMismatch(Matcher $matcher, $item) + { + $this->_mismatchDescription->appendText('item with key ' . $this->_nextMatchKey . ': '); + $matcher->describeMismatch($item, $this->_mismatchDescription); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/AssertionError.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/AssertionError.php new file mode 100644 index 00000000..3a2a0e7c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/AssertionError.php @@ -0,0 +1,10 @@ +append($text); + + return $this; + } + + public function appendDescriptionOf(SelfDescribing $value) + { + $value->describeTo($this); + + return $this; + } + + public function appendValue($value) + { + if (is_null($value)) { + $this->append('null'); + } elseif (is_string($value)) { + $this->_toPhpSyntax($value); + } elseif (is_float($value)) { + $this->append('<'); + $this->append($value); + $this->append('F>'); + } elseif (is_bool($value)) { + $this->append('<'); + $this->append($value ? 'true' : 'false'); + $this->append('>'); + } elseif (is_array($value) || $value instanceof \Iterator || $value instanceof \IteratorAggregate) { + $this->appendValueList('[', ', ', ']', $value); + } elseif (is_object($value) && !method_exists($value, '__toString')) { + $this->append('<'); + $this->append(get_class($value)); + $this->append('>'); + } else { + $this->append('<'); + $this->append($value); + $this->append('>'); + } + + return $this; + } + + public function appendValueList($start, $separator, $end, $values) + { + $list = array(); + foreach ($values as $v) { + $list[] = new SelfDescribingValue($v); + } + + $this->appendList($start, $separator, $end, $list); + + return $this; + } + + public function appendList($start, $separator, $end, $values) + { + $this->append($start); + + $separate = false; + + foreach ($values as $value) { + /*if (!($value instanceof Hamcrest\SelfDescribing)) { + $value = new Hamcrest\Internal\SelfDescribingValue($value); + }*/ + + if ($separate) { + $this->append($separator); + } + + $this->appendDescriptionOf($value); + + $separate = true; + } + + $this->append($end); + + return $this; + } + + // -- Protected Methods + + /** + * Append the String $str to the description. + */ + abstract protected function append($str); + + // -- Private Methods + + private function _toPhpSyntax($value) + { + $str = '"'; + for ($i = 0, $len = strlen($value); $i < $len; ++$i) { + switch ($value[$i]) { + case '"': + $str .= '\\"'; + break; + + case "\t": + $str .= '\\t'; + break; + + case "\r": + $str .= '\\r'; + break; + + case "\n": + $str .= '\\n'; + break; + + default: + $str .= $value[$i]; + } + } + $str .= '"'; + $this->append($str); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseMatcher.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseMatcher.php new file mode 100644 index 00000000..06055698 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseMatcher.php @@ -0,0 +1,30 @@ +appendText('was ')->appendValue($item); + } + + public function __toString() + { + return StringDescription::toString($this); + } + + public function __invoke() + { + return call_user_func_array(array($this, 'matches'), func_get_args()); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsEmptyTraversable.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsEmptyTraversable.php new file mode 100644 index 00000000..8ab58ea5 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsEmptyTraversable.php @@ -0,0 +1,71 @@ +_empty = $empty; + } + + public function matches($item) + { + if (!$item instanceof \Traversable) { + return false; + } + + foreach ($item as $value) { + return !$this->_empty; + } + + return $this->_empty; + } + + public function describeTo(Description $description) + { + $description->appendText($this->_empty ? 'an empty traversable' : 'a non-empty traversable'); + } + + /** + * Returns true if traversable is empty. + * + * @factory + */ + public static function emptyTraversable() + { + if (!self::$_INSTANCE) { + self::$_INSTANCE = new self; + } + + return self::$_INSTANCE; + } + + /** + * Returns true if traversable is not empty. + * + * @factory + */ + public static function nonEmptyTraversable() + { + if (!self::$_NOT_INSTANCE) { + self::$_NOT_INSTANCE = new self(false); + } + + return self::$_NOT_INSTANCE; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsTraversableWithSize.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsTraversableWithSize.php new file mode 100644 index 00000000..c95edc5c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsTraversableWithSize.php @@ -0,0 +1,47 @@ +false. + */ +class AllOf extends DiagnosingMatcher +{ + + private $_matchers; + + public function __construct(array $matchers) + { + Util::checkAllAreMatchers($matchers); + + $this->_matchers = $matchers; + } + + public function matchesWithDiagnosticDescription($item, Description $mismatchDescription) + { + /** @var $matcher \Hamcrest\Matcher */ + foreach ($this->_matchers as $matcher) { + if (!$matcher->matches($item)) { + $mismatchDescription->appendDescriptionOf($matcher)->appendText(' '); + $matcher->describeMismatch($item, $mismatchDescription); + + return false; + } + } + + return true; + } + + public function describeTo(Description $description) + { + $description->appendList('(', ' and ', ')', $this->_matchers); + } + + /** + * Evaluates to true only if ALL of the passed in matchers evaluate to true. + * + * @factory ... + */ + public static function allOf(/* args... */) + { + $args = func_get_args(); + + return new self(Util::createMatcherArray($args)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AnyOf.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AnyOf.php new file mode 100644 index 00000000..4504279f --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AnyOf.php @@ -0,0 +1,58 @@ +true. + */ +class AnyOf extends ShortcutCombination +{ + + public function __construct(array $matchers) + { + parent::__construct($matchers); + } + + public function matches($item) + { + return $this->matchesWithShortcut($item, true); + } + + public function describeTo(Description $description) + { + $this->describeToWithOperator($description, 'or'); + } + + /** + * Evaluates to true if ANY of the passed in matchers evaluate to true. + * + * @factory ... + */ + public static function anyOf(/* args... */) + { + $args = func_get_args(); + + return new self(Util::createMatcherArray($args)); + } + + /** + * Evaluates to false if ANY of the passed in matchers evaluate to true. + * + * @factory ... + */ + public static function noneOf(/* args... */) + { + $args = func_get_args(); + + return IsNot::not( + new self(Util::createMatcherArray($args)) + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/CombinableMatcher.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/CombinableMatcher.php new file mode 100644 index 00000000..e3b4aa78 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/CombinableMatcher.php @@ -0,0 +1,78 @@ +_matcher = $matcher; + } + + public function matches($item) + { + return $this->_matcher->matches($item); + } + + public function describeTo(Description $description) + { + $description->appendDescriptionOf($this->_matcher); + } + + /** Diversion from Hamcrest-Java... Logical "and" not permitted */ + public function andAlso(Matcher $other) + { + return new self(new AllOf($this->_templatedListWith($other))); + } + + /** Diversion from Hamcrest-Java... Logical "or" not permitted */ + public function orElse(Matcher $other) + { + return new self(new AnyOf($this->_templatedListWith($other))); + } + + /** + * This is useful for fluently combining matchers that must both pass. + * For example: + *
+     *   assertThat($string, both(containsString("a"))->andAlso(containsString("b")));
+     * 
+ * + * @factory + */ + public static function both(Matcher $matcher) + { + return new self($matcher); + } + + /** + * This is useful for fluently combining matchers where either may pass, + * for example: + *
+     *   assertThat($string, either(containsString("a"))->orElse(containsString("b")));
+     * 
+ * + * @factory + */ + public static function either(Matcher $matcher) + { + return new self($matcher); + } + + // -- Private Methods + + private function _templatedListWith(Matcher $other) + { + return array($this->_matcher, $other); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/DescribedAs.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/DescribedAs.php new file mode 100644 index 00000000..5b2583fa --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/DescribedAs.php @@ -0,0 +1,68 @@ +_descriptionTemplate = $descriptionTemplate; + $this->_matcher = $matcher; + $this->_values = $values; + } + + public function matches($item) + { + return $this->_matcher->matches($item); + } + + public function describeTo(Description $description) + { + $textStart = 0; + while (preg_match(self::ARG_PATTERN, $this->_descriptionTemplate, $matches, PREG_OFFSET_CAPTURE, $textStart)) { + $text = $matches[0][0]; + $index = $matches[1][0]; + $offset = $matches[0][1]; + + $description->appendText(substr($this->_descriptionTemplate, $textStart, $offset - $textStart)); + $description->appendValue($this->_values[$index]); + + $textStart = $offset + strlen($text); + } + + if ($textStart < strlen($this->_descriptionTemplate)) { + $description->appendText(substr($this->_descriptionTemplate, $textStart)); + } + } + + /** + * Wraps an existing matcher and overrides the description when it fails. + * + * @factory ... + */ + public static function describedAs(/* $description, Hamcrest\Matcher $matcher, $values... */) + { + $args = func_get_args(); + $description = array_shift($args); + $matcher = array_shift($args); + $values = $args; + + return new self($description, $matcher, $values); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Every.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Every.php new file mode 100644 index 00000000..d686f8da --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Every.php @@ -0,0 +1,56 @@ +_matcher = $matcher; + } + + protected function matchesSafelyWithDiagnosticDescription($items, Description $mismatchDescription) + { + foreach ($items as $item) { + if (!$this->_matcher->matches($item)) { + $mismatchDescription->appendText('an item '); + $this->_matcher->describeMismatch($item, $mismatchDescription); + + return false; + } + } + + return true; + } + + public function describeTo(Description $description) + { + $description->appendText('every item is ')->appendDescriptionOf($this->_matcher); + } + + /** + * @param Matcher $itemMatcher + * A matcher to apply to every element in an array. + * + * @return \Hamcrest\Core\Every + * Evaluates to TRUE for a collection in which every item matches $itemMatcher + * + * @factory + */ + public static function everyItem(Matcher $itemMatcher) + { + return new self($itemMatcher); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/HasToString.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/HasToString.php new file mode 100644 index 00000000..45bd9102 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/HasToString.php @@ -0,0 +1,56 @@ +toString(); + } + + return (string) $actual; + } + + /** + * Does array size satisfy a given matcher? + * + * @factory + */ + public static function hasToString($matcher) + { + return new self(Util::wrapValueWithIsEqual($matcher)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Is.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Is.php new file mode 100644 index 00000000..41266dc1 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Is.php @@ -0,0 +1,57 @@ +_matcher = $matcher; + } + + public function matches($arg) + { + return $this->_matcher->matches($arg); + } + + public function describeTo(Description $description) + { + $description->appendText('is ')->appendDescriptionOf($this->_matcher); + } + + public function describeMismatch($item, Description $mismatchDescription) + { + $this->_matcher->describeMismatch($item, $mismatchDescription); + } + + /** + * Decorates another Matcher, retaining the behavior but allowing tests + * to be slightly more expressive. + * + * For example: assertThat($cheese, equalTo($smelly)) + * vs. assertThat($cheese, is(equalTo($smelly))) + * + * @factory + */ + public static function is($value) + { + return new self(Util::wrapValueWithIsEqual($value)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsAnything.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsAnything.php new file mode 100644 index 00000000..f20e6c0d --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsAnything.php @@ -0,0 +1,45 @@ +true. + */ +class IsAnything extends BaseMatcher +{ + + private $_message; + + public function __construct($message = 'ANYTHING') + { + $this->_message = $message; + } + + public function matches($item) + { + return true; + } + + public function describeTo(Description $description) + { + $description->appendText($this->_message); + } + + /** + * This matcher always evaluates to true. + * + * @param string $description A meaningful string used when describing itself. + * + * @return \Hamcrest\Core\IsAnything + * @factory + */ + public static function anything($description = 'ANYTHING') + { + return new self($description); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsCollectionContaining.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsCollectionContaining.php new file mode 100644 index 00000000..5e60426d --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsCollectionContaining.php @@ -0,0 +1,93 @@ +_elementMatcher = $elementMatcher; + } + + protected function matchesSafely($items) + { + foreach ($items as $item) { + if ($this->_elementMatcher->matches($item)) { + return true; + } + } + + return false; + } + + protected function describeMismatchSafely($items, Description $mismatchDescription) + { + $mismatchDescription->appendText('was ')->appendValue($items); + } + + public function describeTo(Description $description) + { + $description + ->appendText('a collection containing ') + ->appendDescriptionOf($this->_elementMatcher) + ; + } + + /** + * Test if the value is an array containing this matcher. + * + * Example: + *
+     * assertThat(array('a', 'b'), hasItem(equalTo('b')));
+     * //Convenience defaults to equalTo()
+     * assertThat(array('a', 'b'), hasItem('b'));
+     * 
+ * + * @factory ... + */ + public static function hasItem() + { + $args = func_get_args(); + $firstArg = array_shift($args); + + return new self(Util::wrapValueWithIsEqual($firstArg)); + } + + /** + * Test if the value is an array containing elements that match all of these + * matchers. + * + * Example: + *
+     * assertThat(array('a', 'b', 'c'), hasItems(equalTo('a'), equalTo('b')));
+     * 
+ * + * @factory ... + */ + public static function hasItems(/* args... */) + { + $args = func_get_args(); + $matchers = array(); + + foreach ($args as $arg) { + $matchers[] = self::hasItem($arg); + } + + return AllOf::allOf($matchers); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsEqual.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsEqual.php new file mode 100644 index 00000000..523fba0b --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsEqual.php @@ -0,0 +1,44 @@ +_item = $item; + } + + public function matches($arg) + { + return (($arg == $this->_item) && ($this->_item == $arg)); + } + + public function describeTo(Description $description) + { + $description->appendValue($this->_item); + } + + /** + * Is the value equal to another value, as tested by the use of the "==" + * comparison operator? + * + * @factory + */ + public static function equalTo($item) + { + return new self($item); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsIdentical.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsIdentical.php new file mode 100644 index 00000000..28f7b36e --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsIdentical.php @@ -0,0 +1,38 @@ +_value = $value; + } + + public function describeTo(Description $description) + { + $description->appendValue($this->_value); + } + + /** + * Tests of the value is identical to $value as tested by the "===" operator. + * + * @factory + */ + public static function identicalTo($value) + { + return new self($value); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsInstanceOf.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsInstanceOf.php new file mode 100644 index 00000000..7a5c92a6 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsInstanceOf.php @@ -0,0 +1,67 @@ +_theClass = $theClass; + } + + protected function matchesWithDiagnosticDescription($item, Description $mismatchDescription) + { + if (!is_object($item)) { + $mismatchDescription->appendText('was ')->appendValue($item); + + return false; + } + + if (!($item instanceof $this->_theClass)) { + $mismatchDescription->appendText('[' . get_class($item) . '] ') + ->appendValue($item); + + return false; + } + + return true; + } + + public function describeTo(Description $description) + { + $description->appendText('an instance of ') + ->appendText($this->_theClass) + ; + } + + /** + * Is the value an instance of a particular type? + * This version assumes no relationship between the required type and + * the signature of the method that sets it up, for example in + * assertThat($anObject, anInstanceOf('Thing')); + * + * @factory any + */ + public static function anInstanceOf($theClass) + { + return new self($theClass); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNot.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNot.php new file mode 100644 index 00000000..167f0d06 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNot.php @@ -0,0 +1,44 @@ +_matcher = $matcher; + } + + public function matches($arg) + { + return !$this->_matcher->matches($arg); + } + + public function describeTo(Description $description) + { + $description->appendText('not ')->appendDescriptionOf($this->_matcher); + } + + /** + * Matches if value does not match $value. + * + * @factory + */ + public static function not($value) + { + return new self(Util::wrapValueWithIsEqual($value)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNull.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNull.php new file mode 100644 index 00000000..91a454c1 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNull.php @@ -0,0 +1,56 @@ +appendText('null'); + } + + /** + * Matches if value is null. + * + * @factory + */ + public static function nullValue() + { + if (!self::$_INSTANCE) { + self::$_INSTANCE = new self(); + } + + return self::$_INSTANCE; + } + + /** + * Matches if value is not null. + * + * @factory + */ + public static function notNullValue() + { + if (!self::$_NOT_INSTANCE) { + self::$_NOT_INSTANCE = IsNot::not(self::nullValue()); + } + + return self::$_NOT_INSTANCE; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsSame.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsSame.php new file mode 100644 index 00000000..81078705 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsSame.php @@ -0,0 +1,51 @@ +_object = $object; + } + + public function matches($object) + { + return ($object === $this->_object) && ($this->_object === $object); + } + + public function describeTo(Description $description) + { + $description->appendText('sameInstance(') + ->appendValue($this->_object) + ->appendText(')') + ; + } + + /** + * Creates a new instance of IsSame. + * + * @param mixed $object + * The predicate evaluates to true only when the argument is + * this object. + * + * @return \Hamcrest\Core\IsSame + * @factory + */ + public static function sameInstance($object) + { + return new self($object); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsTypeOf.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsTypeOf.php new file mode 100644 index 00000000..d24f0f94 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsTypeOf.php @@ -0,0 +1,71 @@ +_theType = strtolower($theType); + } + + public function matches($item) + { + return strtolower(gettype($item)) == $this->_theType; + } + + public function describeTo(Description $description) + { + $description->appendText(self::getTypeDescription($this->_theType)); + } + + public function describeMismatch($item, Description $description) + { + if ($item === null) { + $description->appendText('was null'); + } else { + $description->appendText('was ') + ->appendText(self::getTypeDescription(strtolower(gettype($item)))) + ->appendText(' ') + ->appendValue($item) + ; + } + } + + public static function getTypeDescription($type) + { + if ($type == 'null') { + return 'null'; + } + + return (strpos('aeiou', substr($type, 0, 1)) === false ? 'a ' : 'an ') + . $type; + } + + /** + * Is the value a particular built-in type? + * + * @factory + */ + public static function typeOf($theType) + { + return new self($theType); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Set.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Set.php new file mode 100644 index 00000000..cdc45d53 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Set.php @@ -0,0 +1,95 @@ + + * assertThat(array('a', 'b'), set('b')); + * assertThat($foo, set('bar')); + * assertThat('Server', notSet('defaultPort')); + * + * + * @todo Replace $property with a matcher and iterate all property names. + */ +class Set extends BaseMatcher +{ + + private $_property; + private $_not; + + public function __construct($property, $not = false) + { + $this->_property = $property; + $this->_not = $not; + } + + public function matches($item) + { + if ($item === null) { + return false; + } + $property = $this->_property; + if (is_array($item)) { + $result = isset($item[$property]); + } elseif (is_object($item)) { + $result = isset($item->$property); + } elseif (is_string($item)) { + $result = isset($item::$$property); + } else { + throw new \InvalidArgumentException('Must pass an object, array, or class name'); + } + + return $this->_not ? !$result : $result; + } + + public function describeTo(Description $description) + { + $description->appendText($this->_not ? 'unset property ' : 'set property ')->appendText($this->_property); + } + + public function describeMismatch($item, Description $description) + { + $value = ''; + if (!$this->_not) { + $description->appendText('was not set'); + } else { + $property = $this->_property; + if (is_array($item)) { + $value = $item[$property]; + } elseif (is_object($item)) { + $value = $item->$property; + } elseif (is_string($item)) { + $value = $item::$$property; + } + parent::describeMismatch($value, $description); + } + } + + /** + * Matches if value (class, object, or array) has named $property. + * + * @factory + */ + public static function set($property) + { + return new self($property); + } + + /** + * Matches if value (class, object, or array) does not have named $property. + * + * @factory + */ + public static function notSet($property) + { + return new self($property, true); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ShortcutCombination.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ShortcutCombination.php new file mode 100644 index 00000000..d93db74f --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ShortcutCombination.php @@ -0,0 +1,43 @@ + + */ + private $_matchers; + + public function __construct(array $matchers) + { + Util::checkAllAreMatchers($matchers); + + $this->_matchers = $matchers; + } + + protected function matchesWithShortcut($item, $shortcut) + { + /** @var $matcher \Hamcrest\Matcher */ + foreach ($this->_matchers as $matcher) { + if ($matcher->matches($item) == $shortcut) { + return $shortcut; + } + } + + return !$shortcut; + } + + public function describeToWithOperator(Description $description, $operator) + { + $description->appendList('(', ' ' . $operator . ' ', ')', $this->_matchers); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Description.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Description.php new file mode 100644 index 00000000..9a482dbf --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Description.php @@ -0,0 +1,70 @@ +matchesWithDiagnosticDescription($item, new NullDescription()); + } + + public function describeMismatch($item, Description $mismatchDescription) + { + $this->matchesWithDiagnosticDescription($item, $mismatchDescription); + } + + abstract protected function matchesWithDiagnosticDescription($item, Description $mismatchDescription); +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/FeatureMatcher.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/FeatureMatcher.php new file mode 100644 index 00000000..59f6cc73 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/FeatureMatcher.php @@ -0,0 +1,67 @@ +featureValueOf() in a subclass to pull out the feature to be + * matched against. + */ +abstract class FeatureMatcher extends TypeSafeDiagnosingMatcher +{ + + private $_subMatcher; + private $_featureDescription; + private $_featureName; + + /** + * Constructor. + * + * @param string $type + * @param string $subtype + * @param \Hamcrest\Matcher $subMatcher The matcher to apply to the feature + * @param string $featureDescription Descriptive text to use in describeTo + * @param string $featureName Identifying text for mismatch message + */ + public function __construct($type, $subtype, Matcher $subMatcher, $featureDescription, $featureName) + { + parent::__construct($type, $subtype); + + $this->_subMatcher = $subMatcher; + $this->_featureDescription = $featureDescription; + $this->_featureName = $featureName; + } + + /** + * Implement this to extract the interesting feature. + * + * @param mixed $actual the target object + * + * @return mixed the feature to be matched + */ + abstract protected function featureValueOf($actual); + + public function matchesSafelyWithDiagnosticDescription($actual, Description $mismatchDescription) + { + $featureValue = $this->featureValueOf($actual); + + if (!$this->_subMatcher->matches($featureValue)) { + $mismatchDescription->appendText($this->_featureName) + ->appendText(' was ')->appendValue($featureValue); + + return false; + } + + return true; + } + + final public function describeTo(Description $description) + { + $description->appendText($this->_featureDescription)->appendText(' ') + ->appendDescriptionOf($this->_subMatcher) + ; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Internal/SelfDescribingValue.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Internal/SelfDescribingValue.php new file mode 100644 index 00000000..995da71d --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Internal/SelfDescribingValue.php @@ -0,0 +1,27 @@ +_value = $value; + } + + public function describeTo(Description $description) + { + $description->appendValue($this->_value); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matcher.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matcher.php new file mode 100644 index 00000000..e5dcf093 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matcher.php @@ -0,0 +1,50 @@ + + * Matcher implementations should NOT directly implement this interface. + * Instead, extend the {@link Hamcrest\BaseMatcher} abstract class, + * which will ensure that the Matcher API can grow to support + * new features and remain compatible with all Matcher implementations. + *

+ * For easy access to common Matcher implementations, use the static factory + * methods in {@link Hamcrest\CoreMatchers}. + * + * @see Hamcrest\CoreMatchers + * @see Hamcrest\BaseMatcher + */ +interface Matcher extends SelfDescribing +{ + + /** + * Evaluates the matcher for argument $item. + * + * @param mixed $item the object against which the matcher is evaluated. + * + * @return boolean true if $item matches, + * otherwise false. + * + * @see Hamcrest\BaseMatcher + */ + public function matches($item); + + /** + * Generate a description of why the matcher has not accepted the item. + * The description will be part of a larger description of why a matching + * failed, so it should be concise. + * This method assumes that matches($item) is false, but + * will not check this. + * + * @param mixed $item The item that the Matcher has rejected. + * @param Description $description + * @return + */ + public function describeMismatch($item, Description $description); +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php new file mode 100644 index 00000000..d546dbee --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php @@ -0,0 +1,118 @@ + + * // With an identifier + * assertThat("apple flavour", $apple->flavour(), equalTo("tasty")); + * // Without an identifier + * assertThat($apple->flavour(), equalTo("tasty")); + * // Evaluating a boolean expression + * assertThat("some error", $a > $b); + * assertThat($a > $b); + * + */ + public static function assertThat(/* $args ... */) + { + $args = func_get_args(); + switch (count($args)) { + case 1: + self::$_count++; + if (!$args[0]) { + throw new AssertionError(); + } + break; + + case 2: + self::$_count++; + if ($args[1] instanceof Matcher) { + self::doAssert('', $args[0], $args[1]); + } elseif (!$args[1]) { + throw new AssertionError($args[0]); + } + break; + + case 3: + self::$_count++; + self::doAssert( + $args[0], + $args[1], + Util::wrapValueWithIsEqual($args[2]) + ); + break; + + default: + throw new \InvalidArgumentException('assertThat() requires one to three arguments'); + } + } + + /** + * Returns the number of assertions performed. + * + * @return int + */ + public static function getCount() + { + return self::$_count; + } + + /** + * Resets the number of assertions performed to zero. + */ + public static function resetCount() + { + self::$_count = 0; + } + + /** + * Performs the actual assertion logic. + * + * If $matcher doesn't match $actual, + * throws a {@link Hamcrest\AssertionError} with a description + * of the failure along with the optional $identifier. + * + * @param string $identifier added to the message upon failure + * @param mixed $actual value to compare against $matcher + * @param \Hamcrest\Matcher $matcher applied to $actual + * @throws AssertionError + */ + private static function doAssert($identifier, $actual, Matcher $matcher) + { + if (!$matcher->matches($actual)) { + $description = new StringDescription(); + if (!empty($identifier)) { + $description->appendText($identifier . PHP_EOL); + } + $description->appendText('Expected: ') + ->appendDescriptionOf($matcher) + ->appendText(PHP_EOL . ' but: '); + + $matcher->describeMismatch($actual, $description); + + throw new AssertionError((string) $description); + } + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matchers.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matchers.php new file mode 100644 index 00000000..23232e45 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matchers.php @@ -0,0 +1,713 @@ + + * assertThat($string, both(containsString("a"))->andAlso(containsString("b"))); + * + */ + public static function both(\Hamcrest\Matcher $matcher) + { + return \Hamcrest\Core\CombinableMatcher::both($matcher); + } + + /** + * This is useful for fluently combining matchers where either may pass, + * for example: + *

+     *   assertThat($string, either(containsString("a"))->orElse(containsString("b")));
+     * 
+ */ + public static function either(\Hamcrest\Matcher $matcher) + { + return \Hamcrest\Core\CombinableMatcher::either($matcher); + } + + /** + * Wraps an existing matcher and overrides the description when it fails. + */ + public static function describedAs(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\DescribedAs', 'describedAs'), $args); + } + + /** + * @param Matcher $itemMatcher + * A matcher to apply to every element in an array. + * + * @return \Hamcrest\Core\Every + * Evaluates to TRUE for a collection in which every item matches $itemMatcher + */ + public static function everyItem(\Hamcrest\Matcher $itemMatcher) + { + return \Hamcrest\Core\Every::everyItem($itemMatcher); + } + + /** + * Does array size satisfy a given matcher? + */ + public static function hasToString($matcher) + { + return \Hamcrest\Core\HasToString::hasToString($matcher); + } + + /** + * Decorates another Matcher, retaining the behavior but allowing tests + * to be slightly more expressive. + * + * For example: assertThat($cheese, equalTo($smelly)) + * vs. assertThat($cheese, is(equalTo($smelly))) + */ + public static function is($value) + { + return \Hamcrest\Core\Is::is($value); + } + + /** + * This matcher always evaluates to true. + * + * @param string $description A meaningful string used when describing itself. + * + * @return \Hamcrest\Core\IsAnything + */ + public static function anything($description = 'ANYTHING') + { + return \Hamcrest\Core\IsAnything::anything($description); + } + + /** + * Test if the value is an array containing this matcher. + * + * Example: + *
+     * assertThat(array('a', 'b'), hasItem(equalTo('b')));
+     * //Convenience defaults to equalTo()
+     * assertThat(array('a', 'b'), hasItem('b'));
+     * 
+ */ + public static function hasItem(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItem'), $args); + } + + /** + * Test if the value is an array containing elements that match all of these + * matchers. + * + * Example: + *
+     * assertThat(array('a', 'b', 'c'), hasItems(equalTo('a'), equalTo('b')));
+     * 
+ */ + public static function hasItems(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItems'), $args); + } + + /** + * Is the value equal to another value, as tested by the use of the "==" + * comparison operator? + */ + public static function equalTo($item) + { + return \Hamcrest\Core\IsEqual::equalTo($item); + } + + /** + * Tests of the value is identical to $value as tested by the "===" operator. + */ + public static function identicalTo($value) + { + return \Hamcrest\Core\IsIdentical::identicalTo($value); + } + + /** + * Is the value an instance of a particular type? + * This version assumes no relationship between the required type and + * the signature of the method that sets it up, for example in + * assertThat($anObject, anInstanceOf('Thing')); + */ + public static function anInstanceOf($theClass) + { + return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass); + } + + /** + * Is the value an instance of a particular type? + * This version assumes no relationship between the required type and + * the signature of the method that sets it up, for example in + * assertThat($anObject, anInstanceOf('Thing')); + */ + public static function any($theClass) + { + return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass); + } + + /** + * Matches if value does not match $value. + */ + public static function not($value) + { + return \Hamcrest\Core\IsNot::not($value); + } + + /** + * Matches if value is null. + */ + public static function nullValue() + { + return \Hamcrest\Core\IsNull::nullValue(); + } + + /** + * Matches if value is not null. + */ + public static function notNullValue() + { + return \Hamcrest\Core\IsNull::notNullValue(); + } + + /** + * Creates a new instance of IsSame. + * + * @param mixed $object + * The predicate evaluates to true only when the argument is + * this object. + * + * @return \Hamcrest\Core\IsSame + */ + public static function sameInstance($object) + { + return \Hamcrest\Core\IsSame::sameInstance($object); + } + + /** + * Is the value a particular built-in type? + */ + public static function typeOf($theType) + { + return \Hamcrest\Core\IsTypeOf::typeOf($theType); + } + + /** + * Matches if value (class, object, or array) has named $property. + */ + public static function set($property) + { + return \Hamcrest\Core\Set::set($property); + } + + /** + * Matches if value (class, object, or array) does not have named $property. + */ + public static function notSet($property) + { + return \Hamcrest\Core\Set::notSet($property); + } + + /** + * Matches if value is a number equal to $value within some range of + * acceptable error $delta. + */ + public static function closeTo($value, $delta) + { + return \Hamcrest\Number\IsCloseTo::closeTo($value, $delta); + } + + /** + * The value is not > $value, nor < $value. + */ + public static function comparesEqualTo($value) + { + return \Hamcrest\Number\OrderingComparison::comparesEqualTo($value); + } + + /** + * The value is > $value. + */ + public static function greaterThan($value) + { + return \Hamcrest\Number\OrderingComparison::greaterThan($value); + } + + /** + * The value is >= $value. + */ + public static function greaterThanOrEqualTo($value) + { + return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value); + } + + /** + * The value is >= $value. + */ + public static function atLeast($value) + { + return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value); + } + + /** + * The value is < $value. + */ + public static function lessThan($value) + { + return \Hamcrest\Number\OrderingComparison::lessThan($value); + } + + /** + * The value is <= $value. + */ + public static function lessThanOrEqualTo($value) + { + return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value); + } + + /** + * The value is <= $value. + */ + public static function atMost($value) + { + return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value); + } + + /** + * Matches if value is a zero-length string. + */ + public static function isEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyString(); + } + + /** + * Matches if value is a zero-length string. + */ + public static function emptyString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyString(); + } + + /** + * Matches if value is null or a zero-length string. + */ + public static function isEmptyOrNullString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString(); + } + + /** + * Matches if value is null or a zero-length string. + */ + public static function nullOrEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString(); + } + + /** + * Matches if value is a non-zero-length string. + */ + public static function isNonEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isNonEmptyString(); + } + + /** + * Matches if value is a non-zero-length string. + */ + public static function nonEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isNonEmptyString(); + } + + /** + * Matches if value is a string equal to $string, regardless of the case. + */ + public static function equalToIgnoringCase($string) + { + return \Hamcrest\Text\IsEqualIgnoringCase::equalToIgnoringCase($string); + } + + /** + * Matches if value is a string equal to $string, regardless of whitespace. + */ + public static function equalToIgnoringWhiteSpace($string) + { + return \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace($string); + } + + /** + * Matches if value is a string that matches regular expression $pattern. + */ + public static function matchesPattern($pattern) + { + return \Hamcrest\Text\MatchesPattern::matchesPattern($pattern); + } + + /** + * Matches if value is a string that contains $substring. + */ + public static function containsString($substring) + { + return \Hamcrest\Text\StringContains::containsString($substring); + } + + /** + * Matches if value is a string that contains $substring regardless of the case. + */ + public static function containsStringIgnoringCase($substring) + { + return \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase($substring); + } + + /** + * Matches if value contains $substrings in a constrained order. + */ + public static function stringContainsInOrder(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Text\StringContainsInOrder', 'stringContainsInOrder'), $args); + } + + /** + * Matches if value is a string that ends with $substring. + */ + public static function endsWith($substring) + { + return \Hamcrest\Text\StringEndsWith::endsWith($substring); + } + + /** + * Matches if value is a string that starts with $substring. + */ + public static function startsWith($substring) + { + return \Hamcrest\Text\StringStartsWith::startsWith($substring); + } + + /** + * Is the value an array? + */ + public static function arrayValue() + { + return \Hamcrest\Type\IsArray::arrayValue(); + } + + /** + * Is the value a boolean? + */ + public static function booleanValue() + { + return \Hamcrest\Type\IsBoolean::booleanValue(); + } + + /** + * Is the value a boolean? + */ + public static function boolValue() + { + return \Hamcrest\Type\IsBoolean::booleanValue(); + } + + /** + * Is the value callable? + */ + public static function callableValue() + { + return \Hamcrest\Type\IsCallable::callableValue(); + } + + /** + * Is the value a float/double? + */ + public static function doubleValue() + { + return \Hamcrest\Type\IsDouble::doubleValue(); + } + + /** + * Is the value a float/double? + */ + public static function floatValue() + { + return \Hamcrest\Type\IsDouble::doubleValue(); + } + + /** + * Is the value an integer? + */ + public static function integerValue() + { + return \Hamcrest\Type\IsInteger::integerValue(); + } + + /** + * Is the value an integer? + */ + public static function intValue() + { + return \Hamcrest\Type\IsInteger::integerValue(); + } + + /** + * Is the value a numeric? + */ + public static function numericValue() + { + return \Hamcrest\Type\IsNumeric::numericValue(); + } + + /** + * Is the value an object? + */ + public static function objectValue() + { + return \Hamcrest\Type\IsObject::objectValue(); + } + + /** + * Is the value an object? + */ + public static function anObject() + { + return \Hamcrest\Type\IsObject::objectValue(); + } + + /** + * Is the value a resource? + */ + public static function resourceValue() + { + return \Hamcrest\Type\IsResource::resourceValue(); + } + + /** + * Is the value a scalar (boolean, integer, double, or string)? + */ + public static function scalarValue() + { + return \Hamcrest\Type\IsScalar::scalarValue(); + } + + /** + * Is the value a string? + */ + public static function stringValue() + { + return \Hamcrest\Type\IsString::stringValue(); + } + + /** + * Wraps $matcher with {@link Hamcrest\Core\IsEqual) + * if it's not a matcher and the XPath in count() + * if it's an integer. + */ + public static function hasXPath($xpath, $matcher = null) + { + return \Hamcrest\Xml\HasXPath::hasXPath($xpath, $matcher); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/NullDescription.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/NullDescription.php new file mode 100644 index 00000000..aae8e461 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/NullDescription.php @@ -0,0 +1,43 @@ +_value = $value; + $this->_delta = $delta; + } + + protected function matchesSafely($item) + { + return $this->_actualDelta($item) <= 0.0; + } + + protected function describeMismatchSafely($item, Description $mismatchDescription) + { + $mismatchDescription->appendValue($item) + ->appendText(' differed by ') + ->appendValue($this->_actualDelta($item)) + ; + } + + public function describeTo(Description $description) + { + $description->appendText('a numeric value within ') + ->appendValue($this->_delta) + ->appendText(' of ') + ->appendValue($this->_value) + ; + } + + /** + * Matches if value is a number equal to $value within some range of + * acceptable error $delta. + * + * @factory + */ + public static function closeTo($value, $delta) + { + return new self($value, $delta); + } + + // -- Private Methods + + private function _actualDelta($item) + { + return (abs(($item - $this->_value)) - $this->_delta); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/OrderingComparison.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/OrderingComparison.php new file mode 100644 index 00000000..369d0cfa --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/OrderingComparison.php @@ -0,0 +1,132 @@ +_value = $value; + $this->_minCompare = $minCompare; + $this->_maxCompare = $maxCompare; + } + + protected function matchesSafely($other) + { + $compare = $this->_compare($this->_value, $other); + + return ($this->_minCompare <= $compare) && ($compare <= $this->_maxCompare); + } + + protected function describeMismatchSafely($item, Description $mismatchDescription) + { + $mismatchDescription + ->appendValue($item)->appendText(' was ') + ->appendText($this->_comparison($this->_compare($this->_value, $item))) + ->appendText(' ')->appendValue($this->_value) + ; + } + + public function describeTo(Description $description) + { + $description->appendText('a value ') + ->appendText($this->_comparison($this->_minCompare)) + ; + if ($this->_minCompare != $this->_maxCompare) { + $description->appendText(' or ') + ->appendText($this->_comparison($this->_maxCompare)) + ; + } + $description->appendText(' ')->appendValue($this->_value); + } + + /** + * The value is not > $value, nor < $value. + * + * @factory + */ + public static function comparesEqualTo($value) + { + return new self($value, 0, 0); + } + + /** + * The value is > $value. + * + * @factory + */ + public static function greaterThan($value) + { + return new self($value, -1, -1); + } + + /** + * The value is >= $value. + * + * @factory atLeast + */ + public static function greaterThanOrEqualTo($value) + { + return new self($value, -1, 0); + } + + /** + * The value is < $value. + * + * @factory + */ + public static function lessThan($value) + { + return new self($value, 1, 1); + } + + /** + * The value is <= $value. + * + * @factory atMost + */ + public static function lessThanOrEqualTo($value) + { + return new self($value, 0, 1); + } + + // -- Private Methods + + private function _compare($left, $right) + { + $a = $left; + $b = $right; + + if ($a < $b) { + return -1; + } elseif ($a == $b) { + return 0; + } else { + return 1; + } + } + + private function _comparison($compare) + { + if ($compare > 0) { + return 'less than'; + } elseif ($compare == 0) { + return 'equal to'; + } else { + return 'greater than'; + } + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/SelfDescribing.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/SelfDescribing.php new file mode 100644 index 00000000..872fdf9c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/SelfDescribing.php @@ -0,0 +1,23 @@ +_out = (string) $out; + } + + public function __toString() + { + return $this->_out; + } + + /** + * Return the description of a {@link Hamcrest\SelfDescribing} object as a + * String. + * + * @param \Hamcrest\SelfDescribing $selfDescribing + * The object to be described. + * + * @return string + * The description of the object. + */ + public static function toString(SelfDescribing $selfDescribing) + { + $self = new self(); + + return (string) $self->appendDescriptionOf($selfDescribing); + } + + /** + * Alias for {@link toString()}. + */ + public static function asString(SelfDescribing $selfDescribing) + { + return self::toString($selfDescribing); + } + + // -- Protected Methods + + protected function append($str) + { + $this->_out .= $str; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEmptyString.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEmptyString.php new file mode 100644 index 00000000..2ae61b96 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEmptyString.php @@ -0,0 +1,85 @@ +_empty = $empty; + } + + public function matches($item) + { + return $this->_empty + ? ($item === '') + : is_string($item) && $item !== ''; + } + + public function describeTo(Description $description) + { + $description->appendText($this->_empty ? 'an empty string' : 'a non-empty string'); + } + + /** + * Matches if value is a zero-length string. + * + * @factory emptyString + */ + public static function isEmptyString() + { + if (!self::$_INSTANCE) { + self::$_INSTANCE = new self(true); + } + + return self::$_INSTANCE; + } + + /** + * Matches if value is null or a zero-length string. + * + * @factory nullOrEmptyString + */ + public static function isEmptyOrNullString() + { + if (!self::$_NULL_OR_EMPTY_INSTANCE) { + self::$_NULL_OR_EMPTY_INSTANCE = AnyOf::anyOf( + IsNull::nullvalue(), + self::isEmptyString() + ); + } + + return self::$_NULL_OR_EMPTY_INSTANCE; + } + + /** + * Matches if value is a non-zero-length string. + * + * @factory nonEmptyString + */ + public static function isNonEmptyString() + { + if (!self::$_NOT_INSTANCE) { + self::$_NOT_INSTANCE = new self(false); + } + + return self::$_NOT_INSTANCE; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php new file mode 100644 index 00000000..3836a8c3 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php @@ -0,0 +1,52 @@ +_string = $string; + } + + protected function matchesSafely($item) + { + return strtolower($this->_string) === strtolower($item); + } + + protected function describeMismatchSafely($item, Description $mismatchDescription) + { + $mismatchDescription->appendText('was ')->appendText($item); + } + + public function describeTo(Description $description) + { + $description->appendText('equalToIgnoringCase(') + ->appendValue($this->_string) + ->appendText(')') + ; + } + + /** + * Matches if value is a string equal to $string, regardless of the case. + * + * @factory + */ + public static function equalToIgnoringCase($string) + { + return new self($string); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php new file mode 100644 index 00000000..853692b0 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php @@ -0,0 +1,66 @@ +_string = $string; + } + + protected function matchesSafely($item) + { + return (strtolower($this->_stripSpace($item)) + === strtolower($this->_stripSpace($this->_string))); + } + + protected function describeMismatchSafely($item, Description $mismatchDescription) + { + $mismatchDescription->appendText('was ')->appendText($item); + } + + public function describeTo(Description $description) + { + $description->appendText('equalToIgnoringWhiteSpace(') + ->appendValue($this->_string) + ->appendText(')') + ; + } + + /** + * Matches if value is a string equal to $string, regardless of whitespace. + * + * @factory + */ + public static function equalToIgnoringWhiteSpace($string) + { + return new self($string); + } + + // -- Private Methods + + private function _stripSpace($string) + { + $parts = preg_split("/[\r\n\t ]+/", $string); + foreach ($parts as $i => $part) { + $parts[$i] = trim($part, " \r\n\t"); + } + + return trim(implode(' ', $parts), " \r\n\t"); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/MatchesPattern.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/MatchesPattern.php new file mode 100644 index 00000000..fa0d68ee --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/MatchesPattern.php @@ -0,0 +1,40 @@ +_substring, (string) $item) >= 1; + } + + protected function relationship() + { + return 'matching'; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContains.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContains.php new file mode 100644 index 00000000..b92786b6 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContains.php @@ -0,0 +1,45 @@ +_substring); + } + + /** + * Matches if value is a string that contains $substring. + * + * @factory + */ + public static function containsString($substring) + { + return new self($substring); + } + + // -- Protected Methods + + protected function evalSubstringOf($item) + { + return (false !== strpos((string) $item, $this->_substring)); + } + + protected function relationship() + { + return 'containing'; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php new file mode 100644 index 00000000..69f37c25 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php @@ -0,0 +1,40 @@ +_substring)); + } + + protected function relationship() + { + return 'containing in any case'; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsInOrder.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsInOrder.php new file mode 100644 index 00000000..e75de65d --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsInOrder.php @@ -0,0 +1,66 @@ +_substrings = $substrings; + } + + protected function matchesSafely($item) + { + $fromIndex = 0; + + foreach ($this->_substrings as $substring) { + if (false === $fromIndex = strpos($item, $substring, $fromIndex)) { + return false; + } + } + + return true; + } + + protected function describeMismatchSafely($item, Description $mismatchDescription) + { + $mismatchDescription->appendText('was ')->appendText($item); + } + + public function describeTo(Description $description) + { + $description->appendText('a string containing ') + ->appendValueList('', ', ', '', $this->_substrings) + ->appendText(' in order') + ; + } + + /** + * Matches if value contains $substrings in a constrained order. + * + * @factory ... + */ + public static function stringContainsInOrder(/* args... */) + { + $args = func_get_args(); + + if (isset($args[0]) && is_array($args[0])) { + $args = $args[0]; + } + + return new self($args); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringEndsWith.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringEndsWith.php new file mode 100644 index 00000000..f802ee4d --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringEndsWith.php @@ -0,0 +1,40 @@ +_substring))) === $this->_substring); + } + + protected function relationship() + { + return 'ending with'; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringStartsWith.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringStartsWith.php new file mode 100644 index 00000000..79c95656 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringStartsWith.php @@ -0,0 +1,40 @@ +_substring)) === $this->_substring); + } + + protected function relationship() + { + return 'starting with'; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/SubstringMatcher.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/SubstringMatcher.php new file mode 100644 index 00000000..e560ad62 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/SubstringMatcher.php @@ -0,0 +1,45 @@ +_substring = $substring; + } + + protected function matchesSafely($item) + { + return $this->evalSubstringOf($item); + } + + protected function describeMismatchSafely($item, Description $mismatchDescription) + { + $mismatchDescription->appendText('was "')->appendText($item)->appendText('"'); + } + + public function describeTo(Description $description) + { + $description->appendText('a string ') + ->appendText($this->relationship()) + ->appendText(' ') + ->appendValue($this->_substring) + ; + } + + abstract protected function evalSubstringOf($string); + + abstract protected function relationship(); +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsArray.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsArray.php new file mode 100644 index 00000000..9179102f --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsArray.php @@ -0,0 +1,32 @@ +isHexadecimal($item)) { + return true; + } + + return is_numeric($item); + } + + /** + * Return if the string passed is a valid hexadecimal number. + * This check is necessary because PHP 7 doesn't recognize hexadecimal string as numeric anymore. + * + * @param mixed $item + * @return boolean + */ + private function isHexadecimal($item) + { + if (is_string($item) && preg_match('/^0x(.*)$/', $item, $matches)) { + return ctype_xdigit($matches[1]); + } + + return false; + } + + /** + * Is the value a numeric? + * + * @factory + */ + public static function numericValue() + { + return new self; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsObject.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsObject.php new file mode 100644 index 00000000..65918fcf --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsObject.php @@ -0,0 +1,32 @@ +matchesSafelyWithDiagnosticDescription($item, new NullDescription()); + } + + final public function describeMismatchSafely($item, Description $mismatchDescription) + { + $this->matchesSafelyWithDiagnosticDescription($item, $mismatchDescription); + } + + // -- Protected Methods + + /** + * Subclasses should implement these. The item will already have been checked for + * the specific type. + */ + abstract protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription); +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeMatcher.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeMatcher.php new file mode 100644 index 00000000..56e299a9 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeMatcher.php @@ -0,0 +1,107 @@ +_expectedType = $expectedType; + $this->_expectedSubtype = $expectedSubtype; + } + + final public function matches($item) + { + return $this->_isSafeType($item) && $this->matchesSafely($item); + } + + final public function describeMismatch($item, Description $mismatchDescription) + { + if (!$this->_isSafeType($item)) { + parent::describeMismatch($item, $mismatchDescription); + } else { + $this->describeMismatchSafely($item, $mismatchDescription); + } + } + + // -- Protected Methods + + /** + * The item will already have been checked for the specific type and subtype. + */ + abstract protected function matchesSafely($item); + + /** + * The item will already have been checked for the specific type and subtype. + */ + abstract protected function describeMismatchSafely($item, Description $mismatchDescription); + + // -- Private Methods + + private function _isSafeType($value) + { + switch ($this->_expectedType) { + + case self::TYPE_ANY: + return true; + + case self::TYPE_STRING: + return is_string($value) || is_numeric($value); + + case self::TYPE_NUMERIC: + return is_numeric($value) || is_string($value); + + case self::TYPE_ARRAY: + return is_array($value); + + case self::TYPE_OBJECT: + return is_object($value) + && ($this->_expectedSubtype === null + || $value instanceof $this->_expectedSubtype); + + case self::TYPE_RESOURCE: + return is_resource($value) + && ($this->_expectedSubtype === null + || get_resource_type($value) == $this->_expectedSubtype); + + case self::TYPE_BOOLEAN: + return true; + + default: + return true; + + } + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php new file mode 100644 index 00000000..169b0366 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php @@ -0,0 +1,76 @@ + all items are + */ + public static function createMatcherArray(array $items) + { + //Extract single array item + if (count($items) == 1 && is_array($items[0])) { + $items = $items[0]; + } + + //Replace non-matchers + foreach ($items as &$item) { + if (!($item instanceof Matcher)) { + $item = Core\IsEqual::equalTo($item); + } + } + + return $items; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php new file mode 100644 index 00000000..d9764e45 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php @@ -0,0 +1,195 @@ +_xpath = $xpath; + $this->_matcher = $matcher; + } + + /** + * Matches if the XPath matches against the DOM node and the matcher. + * + * @param string|\DOMNode $actual + * @param Description $mismatchDescription + * @return bool + */ + protected function matchesWithDiagnosticDescription($actual, Description $mismatchDescription) + { + if (is_string($actual)) { + $actual = $this->createDocument($actual); + } elseif (!$actual instanceof \DOMNode) { + $mismatchDescription->appendText('was ')->appendValue($actual); + + return false; + } + $result = $this->evaluate($actual); + if ($result instanceof \DOMNodeList) { + return $this->matchesContent($result, $mismatchDescription); + } else { + return $this->matchesExpression($result, $mismatchDescription); + } + } + + /** + * Creates and returns a DOMDocument from the given + * XML or HTML string. + * + * @param string $text + * @return \DOMDocument built from $text + * @throws \InvalidArgumentException if the document is not valid + */ + protected function createDocument($text) + { + $document = new \DOMDocument(); + if (preg_match('/^\s*<\?xml/', $text)) { + if (!@$document->loadXML($text)) { + throw new \InvalidArgumentException('Must pass a valid XML document'); + } + } else { + if (!@$document->loadHTML($text)) { + throw new \InvalidArgumentException('Must pass a valid HTML or XHTML document'); + } + } + + return $document; + } + + /** + * Applies the configured XPath to the DOM node and returns either + * the result if it's an expression or the node list if it's a query. + * + * @param \DOMNode $node context from which to issue query + * @return mixed result of expression or DOMNodeList from query + */ + protected function evaluate(\DOMNode $node) + { + if ($node instanceof \DOMDocument) { + $xpathDocument = new \DOMXPath($node); + + return $xpathDocument->evaluate($this->_xpath); + } else { + $xpathDocument = new \DOMXPath($node->ownerDocument); + + return $xpathDocument->evaluate($this->_xpath, $node); + } + } + + /** + * Matches if the list of nodes is not empty and the content of at least + * one node matches the configured matcher, if supplied. + * + * @param \DOMNodeList $nodes selected by the XPath query + * @param Description $mismatchDescription + * @return bool + */ + protected function matchesContent(\DOMNodeList $nodes, Description $mismatchDescription) + { + if ($nodes->length == 0) { + $mismatchDescription->appendText('XPath returned no results'); + } elseif ($this->_matcher === null) { + return true; + } else { + foreach ($nodes as $node) { + if ($this->_matcher->matches($node->textContent)) { + return true; + } + } + $content = array(); + foreach ($nodes as $node) { + $content[] = $node->textContent; + } + $mismatchDescription->appendText('XPath returned ') + ->appendValue($content); + } + + return false; + } + + /** + * Matches if the result of the XPath expression matches the configured + * matcher or evaluates to true if there is none. + * + * @param mixed $result result of the XPath expression + * @param Description $mismatchDescription + * @return bool + */ + protected function matchesExpression($result, Description $mismatchDescription) + { + if ($this->_matcher === null) { + if ($result) { + return true; + } + $mismatchDescription->appendText('XPath expression result was ') + ->appendValue($result); + } else { + if ($this->_matcher->matches($result)) { + return true; + } + $mismatchDescription->appendText('XPath expression result '); + $this->_matcher->describeMismatch($result, $mismatchDescription); + } + + return false; + } + + public function describeTo(Description $description) + { + $description->appendText('XML or HTML document with XPath "') + ->appendText($this->_xpath) + ->appendText('"'); + if ($this->_matcher !== null) { + $description->appendText(' '); + $this->_matcher->describeTo($description); + } + } + + /** + * Wraps $matcher with {@link Hamcrest\Core\IsEqual) + * if it's not a matcher and the XPath in count() + * if it's an integer. + * + * @factory + */ + public static function hasXPath($xpath, $matcher = null) + { + if ($matcher === null || $matcher instanceof Matcher) { + return new self($xpath, $matcher); + } elseif (is_int($matcher) && strpos($xpath, 'count(') !== 0) { + $xpath = 'count(' . $xpath . ')'; + } + + return new self($xpath, IsEqual::equalTo($matcher)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/AbstractMatcherTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/AbstractMatcherTest.php new file mode 100644 index 00000000..8a1fb2a9 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/AbstractMatcherTest.php @@ -0,0 +1,68 @@ +assertTrue($matcher->matches($arg), $message); + } + + public function assertDoesNotMatch(\Hamcrest\Matcher $matcher, $arg, $message) + { + $this->assertFalse($matcher->matches($arg), $message); + } + + public function assertDescription($expected, \Hamcrest\Matcher $matcher) + { + $description = new \Hamcrest\StringDescription(); + $description->appendDescriptionOf($matcher); + $this->assertEquals($expected, (string) $description, 'Expected description'); + } + + public function assertMismatchDescription($expected, \Hamcrest\Matcher $matcher, $arg) + { + $description = new \Hamcrest\StringDescription(); + $this->assertFalse( + $matcher->matches($arg), + 'Precondtion: Matcher should not match item' + ); + $matcher->describeMismatch($arg, $description); + $this->assertEquals( + $expected, + (string) $description, + 'Expected mismatch description' + ); + } + + public function testIsNullSafe() + { + //Should not generate any notices + $this->createMatcher()->matches(null); + $this->createMatcher()->describeMismatch( + null, + new \Hamcrest\NullDescription() + ); + } + + public function testCopesWithUnknownTypes() + { + //Should not generate any notices + $this->createMatcher()->matches(new UnknownType()); + $this->createMatcher()->describeMismatch( + new UnknownType(), + new NullDescription() + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInAnyOrderTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInAnyOrderTest.php new file mode 100644 index 00000000..45d9f138 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInAnyOrderTest.php @@ -0,0 +1,54 @@ +assertDescription('[<1>, <2>] in any order', containsInAnyOrder(array(1, 2))); + } + + public function testMatchesItemsInAnyOrder() + { + $this->assertMatches(containsInAnyOrder(array(1, 2, 3)), array(1, 2, 3), 'in order'); + $this->assertMatches(containsInAnyOrder(array(1, 2, 3)), array(3, 2, 1), 'out of order'); + $this->assertMatches(containsInAnyOrder(array(1)), array(1), 'single'); + } + + public function testAppliesMatchersInAnyOrder() + { + $this->assertMatches( + containsInAnyOrder(array(1, 2, 3)), + array(1, 2, 3), + 'in order' + ); + $this->assertMatches( + containsInAnyOrder(array(1, 2, 3)), + array(3, 2, 1), + 'out of order' + ); + $this->assertMatches( + containsInAnyOrder(array(1)), + array(1), + 'single' + ); + } + + public function testMismatchesItemsInAnyOrder() + { + $matcher = containsInAnyOrder(array(1, 2, 3)); + + $this->assertMismatchDescription('was null', $matcher, null); + $this->assertMismatchDescription('No item matches: <1>, <2>, <3> in []', $matcher, array()); + $this->assertMismatchDescription('No item matches: <2>, <3> in [<1>]', $matcher, array(1)); + $this->assertMismatchDescription('Not matched: <4>', $matcher, array(4, 3, 2, 1)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInOrderTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInOrderTest.php new file mode 100644 index 00000000..a9e4e5b0 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInOrderTest.php @@ -0,0 +1,48 @@ +assertDescription('[<1>, <2>]', arrayContaining(array(1, 2))); + } + + public function testMatchesItemsInOrder() + { + $this->assertMatches(arrayContaining(array(1, 2, 3)), array(1, 2, 3), 'in order'); + $this->assertMatches(arrayContaining(array(1)), array(1), 'single'); + } + + public function testAppliesMatchersInOrder() + { + $this->assertMatches( + arrayContaining(array(1, 2, 3)), + array(1, 2, 3), + 'in order' + ); + $this->assertMatches(arrayContaining(array(1)), array(1), 'single'); + } + + public function testMismatchesItemsInAnyOrder() + { + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('Broken on HHVM.'); + } + + $matcher = arrayContaining(array(1, 2, 3)); + $this->assertMismatchDescription('was null', $matcher, null); + $this->assertMismatchDescription('No item matched: <1>', $matcher, array()); + $this->assertMismatchDescription('No item matched: <2>', $matcher, array(1)); + $this->assertMismatchDescription('item with key 0: was <4>', $matcher, array(4, 3, 2, 1)); + $this->assertMismatchDescription('item with key 2: was <4>', $matcher, array(1, 2, 4)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyTest.php new file mode 100644 index 00000000..31770d8d --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyTest.php @@ -0,0 +1,62 @@ +1); + + $this->assertMatches(hasKey('a'), $array, 'Matches single key'); + } + + public function testMatchesArrayContainingKey() + { + $array = array('a'=>1, 'b'=>2, 'c'=>3); + + $this->assertMatches(hasKey('a'), $array, 'Matches a'); + $this->assertMatches(hasKey('c'), $array, 'Matches c'); + } + + public function testMatchesArrayContainingKeyWithIntegerKeys() + { + $array = array(1=>'A', 2=>'B'); + + assertThat($array, hasKey(1)); + } + + public function testMatchesArrayContainingKeyWithNumberKeys() + { + $array = array(1=>'A', 2=>'B'); + + assertThat($array, hasKey(1)); + + // very ugly version! + assertThat($array, IsArrayContainingKey::hasKeyInArray(2)); + } + + public function testHasReadableDescription() + { + $this->assertDescription('array with key "a"', hasKey('a')); + } + + public function testDoesNotMatchEmptyArray() + { + $this->assertMismatchDescription('array was []', hasKey('Foo'), array()); + } + + public function testDoesNotMatchArrayMissingKey() + { + $array = array('a'=>1, 'b'=>2, 'c'=>3); + + $this->assertMismatchDescription('array was ["a" => <1>, "b" => <2>, "c" => <3>]', hasKey('d'), $array); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyValuePairTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyValuePairTest.php new file mode 100644 index 00000000..a415f9f7 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyValuePairTest.php @@ -0,0 +1,36 @@ +1, 'b'=>2); + + $this->assertMatches(hasKeyValuePair(equalTo('a'), equalTo(1)), $array, 'matcherA'); + $this->assertMatches(hasKeyValuePair(equalTo('b'), equalTo(2)), $array, 'matcherB'); + $this->assertMismatchDescription( + 'array was ["a" => <1>, "b" => <2>]', + hasKeyValuePair(equalTo('c'), equalTo(3)), + $array + ); + } + + public function testDoesNotMatchNull() + { + $this->assertMismatchDescription('was null', hasKeyValuePair(anything(), anything()), null); + } + + public function testHasReadableDescription() + { + $this->assertDescription('array containing ["a" => <2>]', hasKeyValuePair(equalTo('a'), equalTo(2))); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingTest.php new file mode 100644 index 00000000..8d5bd810 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingTest.php @@ -0,0 +1,50 @@ +assertMatches( + hasItemInArray('a'), + array('a', 'b', 'c'), + "should matches array that contains 'a'" + ); + } + + public function testDoesNotMatchAnArrayThatDoesntContainAnElementMatchingTheGivenMatcher() + { + $this->assertDoesNotMatch( + hasItemInArray('a'), + array('b', 'c'), + "should not matches array that doesn't contain 'a'" + ); + $this->assertDoesNotMatch( + hasItemInArray('a'), + array(), + 'should not match empty array' + ); + } + + public function testDoesNotMatchNull() + { + $this->assertDoesNotMatch( + hasItemInArray('a'), + null, + 'should not match null' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('an array containing "a"', hasItemInArray('a')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayTest.php new file mode 100644 index 00000000..e4db53e7 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayTest.php @@ -0,0 +1,89 @@ +assertMatches( + anArray(array(equalTo('a'), equalTo('b'), equalTo('c'))), + array('a', 'b', 'c'), + 'should match array with matching elements' + ); + } + + public function testDoesNotMatchAnArrayWhenElementsDoNotMatch() + { + $this->assertDoesNotMatch( + anArray(array(equalTo('a'), equalTo('b'))), + array('b', 'c'), + 'should not match array with different elements' + ); + } + + public function testDoesNotMatchAnArrayOfDifferentSize() + { + $this->assertDoesNotMatch( + anArray(array(equalTo('a'), equalTo('b'))), + array('a', 'b', 'c'), + 'should not match larger array' + ); + $this->assertDoesNotMatch( + anArray(array(equalTo('a'), equalTo('b'))), + array('a'), + 'should not match smaller array' + ); + } + + public function testDoesNotMatchNull() + { + $this->assertDoesNotMatch( + anArray(array(equalTo('a'))), + null, + 'should not match null' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + '["a", "b"]', + anArray(array(equalTo('a'), equalTo('b'))) + ); + } + + public function testHasAReadableMismatchDescriptionWhenKeysDontMatch() + { + $this->assertMismatchDescription( + 'array keys were [<1>, <2>]', + anArray(array(equalTo('a'), equalTo('b'))), + array(1 => 'a', 2 => 'b') + ); + } + + public function testSupportsMatchesAssociativeArrays() + { + $this->assertMatches( + anArray(array('x'=>equalTo('a'), 'y'=>equalTo('b'), 'z'=>equalTo('c'))), + array('x'=>'a', 'y'=>'b', 'z'=>'c'), + 'should match associative array with matching elements' + ); + } + + public function testDoesNotMatchAnAssociativeArrayWhenKeysDoNotMatch() + { + $this->assertDoesNotMatch( + anArray(array('x'=>equalTo('a'), 'y'=>equalTo('b'))), + array('x'=>'b', 'z'=>'c'), + 'should not match array with different keys' + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayWithSizeTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayWithSizeTest.php new file mode 100644 index 00000000..8413c896 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayWithSizeTest.php @@ -0,0 +1,37 @@ +assertMatches(arrayWithSize(equalTo(3)), array(1, 2, 3), 'correct size'); + $this->assertDoesNotMatch(arrayWithSize(equalTo(2)), array(1, 2, 3), 'incorrect size'); + } + + public function testProvidesConvenientShortcutForArrayWithSizeEqualTo() + { + $this->assertMatches(arrayWithSize(3), array(1, 2, 3), 'correct size'); + $this->assertDoesNotMatch(arrayWithSize(2), array(1, 2, 3), 'incorrect size'); + } + + public function testEmptyArray() + { + $this->assertMatches(emptyArray(), array(), 'correct size'); + $this->assertDoesNotMatch(emptyArray(), array(1), 'incorrect size'); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('an array with size <3>', arrayWithSize(equalTo(3))); + $this->assertDescription('an empty array', emptyArray()); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/BaseMatcherTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/BaseMatcherTest.php new file mode 100644 index 00000000..833e2c3e --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/BaseMatcherTest.php @@ -0,0 +1,23 @@ +appendText('SOME DESCRIPTION'); + } + + public function testDescribesItselfWithToStringMethod() + { + $someMatcher = new \Hamcrest\SomeMatcher(); + $this->assertEquals('SOME DESCRIPTION', (string) $someMatcher); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsEmptyTraversableTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsEmptyTraversableTest.php new file mode 100644 index 00000000..2f15fb49 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsEmptyTraversableTest.php @@ -0,0 +1,77 @@ +assertMatches( + emptyTraversable(), + new \ArrayObject(array()), + 'an empty traversable' + ); + } + + public function testEmptyMatcherDoesNotMatchWhenNotEmpty() + { + $this->assertDoesNotMatch( + emptyTraversable(), + new \ArrayObject(array(1, 2, 3)), + 'a non-empty traversable' + ); + } + + public function testEmptyMatcherDoesNotMatchNull() + { + $this->assertDoesNotMatch( + emptyTraversable(), + null, + 'should not match null' + ); + } + + public function testEmptyMatcherHasAReadableDescription() + { + $this->assertDescription('an empty traversable', emptyTraversable()); + } + + public function testNonEmptyDoesNotMatchNull() + { + $this->assertDoesNotMatch( + nonEmptyTraversable(), + null, + 'should not match null' + ); + } + + public function testNonEmptyDoesNotMatchWhenEmpty() + { + $this->assertDoesNotMatch( + nonEmptyTraversable(), + new \ArrayObject(array()), + 'an empty traversable' + ); + } + + public function testNonEmptyMatchesWhenNotEmpty() + { + $this->assertMatches( + nonEmptyTraversable(), + new \ArrayObject(array(1, 2, 3)), + 'a non-empty traversable' + ); + } + + public function testNonEmptyNonEmptyMatcherHasAReadableDescription() + { + $this->assertDescription('a non-empty traversable', nonEmptyTraversable()); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsTraversableWithSizeTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsTraversableWithSizeTest.php new file mode 100644 index 00000000..c1c67a7a --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsTraversableWithSizeTest.php @@ -0,0 +1,57 @@ +assertMatches( + traversableWithSize(equalTo(3)), + new \ArrayObject(array(1, 2, 3)), + 'correct size' + ); + } + + public function testDoesNotMatchWhenSizeIsIncorrect() + { + $this->assertDoesNotMatch( + traversableWithSize(equalTo(2)), + new \ArrayObject(array(1, 2, 3)), + 'incorrect size' + ); + } + + public function testDoesNotMatchNull() + { + $this->assertDoesNotMatch( + traversableWithSize(3), + null, + 'should not match null' + ); + } + + public function testProvidesConvenientShortcutForTraversableWithSizeEqualTo() + { + $this->assertMatches( + traversableWithSize(3), + new \ArrayObject(array(1, 2, 3)), + 'correct size' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + 'a traversable with size <3>', + traversableWithSize(equalTo(3)) + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AllOfTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AllOfTest.php new file mode 100644 index 00000000..86b8c277 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AllOfTest.php @@ -0,0 +1,56 @@ +assertDescription( + '("good" and "bad" and "ugly")', + allOf('good', 'bad', 'ugly') + ); + } + + public function testMismatchDescriptionDescribesFirstFailingMatch() + { + $this->assertMismatchDescription( + '"good" was "bad"', + allOf('bad', 'good'), + 'bad' + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AnyOfTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AnyOfTest.php new file mode 100644 index 00000000..3d62b935 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AnyOfTest.php @@ -0,0 +1,79 @@ +assertDescription( + '("good" or "bad" or "ugly")', + anyOf('good', 'bad', 'ugly') + ); + } + + public function testNoneOfEvaluatesToTheLogicalDisjunctionOfTwoOtherMatchers() + { + assertThat('good', not(noneOf('bad', 'good'))); + assertThat('good', not(noneOf('good', 'good'))); + assertThat('good', not(noneOf('good', 'bad'))); + + assertThat('good', noneOf('bad', startsWith('b'))); + } + + public function testNoneOfEvaluatesToTheLogicalDisjunctionOfManyOtherMatchers() + { + assertThat('good', not(noneOf('bad', 'good', 'bad', 'bad', 'bad'))); + assertThat('good', noneOf('bad', 'bad', 'bad', 'bad', 'bad')); + } + + public function testNoneOfSupportsMixedTypes() + { + $combined = noneOf( + equalTo(new \Hamcrest\Core\SampleBaseClass('good')), + equalTo(new \Hamcrest\Core\SampleBaseClass('ugly')), + equalTo(new \Hamcrest\Core\SampleSubClass('good')) + ); + + assertThat(new \Hamcrest\Core\SampleSubClass('bad'), $combined); + } + + public function testNoneOfHasAReadableDescription() + { + $this->assertDescription( + 'not ("good" or "bad" or "ugly")', + noneOf('good', 'bad', 'ugly') + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/CombinableMatcherTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/CombinableMatcherTest.php new file mode 100644 index 00000000..463c7543 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/CombinableMatcherTest.php @@ -0,0 +1,59 @@ +_either_3_or_4 = \Hamcrest\Core\CombinableMatcher::either(equalTo(3))->orElse(equalTo(4)); + $this->_not_3_and_not_4 = \Hamcrest\Core\CombinableMatcher::both(not(equalTo(3)))->andAlso(not(equalTo(4))); + } + + protected function createMatcher() + { + return \Hamcrest\Core\CombinableMatcher::either(equalTo('irrelevant'))->orElse(equalTo('ignored')); + } + + public function testBothAcceptsAndRejects() + { + assertThat(2, $this->_not_3_and_not_4); + assertThat(3, not($this->_not_3_and_not_4)); + } + + public function testAcceptsAndRejectsThreeAnds() + { + $tripleAnd = $this->_not_3_and_not_4->andAlso(equalTo(2)); + assertThat(2, $tripleAnd); + assertThat(3, not($tripleAnd)); + } + + public function testBothDescribesItself() + { + $this->assertEquals('(not <3> and not <4>)', (string) $this->_not_3_and_not_4); + $this->assertMismatchDescription('was <3>', $this->_not_3_and_not_4, 3); + } + + public function testEitherAcceptsAndRejects() + { + assertThat(3, $this->_either_3_or_4); + assertThat(6, not($this->_either_3_or_4)); + } + + public function testAcceptsAndRejectsThreeOrs() + { + $orTriple = $this->_either_3_or_4->orElse(greaterThan(10)); + + assertThat(11, $orTriple); + assertThat(9, not($orTriple)); + } + + public function testEitherDescribesItself() + { + $this->assertEquals('(<3> or <4>)', (string) $this->_either_3_or_4); + $this->assertMismatchDescription('was <6>', $this->_either_3_or_4, 6); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/DescribedAsTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/DescribedAsTest.php new file mode 100644 index 00000000..673ab41e --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/DescribedAsTest.php @@ -0,0 +1,36 @@ +assertDescription('m1 description', $m1); + $this->assertDescription('m2 description', $m2); + } + + public function testAppendsValuesToDescription() + { + $m = describedAs('value 1 = %0, value 2 = %1', anything(), 33, 97); + + $this->assertDescription('value 1 = <33>, value 2 = <97>', $m); + } + + public function testDelegatesMatchingToAnotherMatcher() + { + $m1 = describedAs('irrelevant', anything()); + $m2 = describedAs('irrelevant', not(anything())); + + $this->assertTrue($m1->matches(new \stdClass())); + $this->assertFalse($m2->matches('hi')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/EveryTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/EveryTest.php new file mode 100644 index 00000000..5eb153c5 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/EveryTest.php @@ -0,0 +1,30 @@ +assertEquals('every item is a string containing "a"', (string) $each); + + $this->assertMismatchDescription('an item was "BbB"', $each, array('BbB')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/HasToStringTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/HasToStringTest.php new file mode 100644 index 00000000..e2e136dc --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/HasToStringTest.php @@ -0,0 +1,108 @@ +assertMatches( + hasToString(equalTo('php')), + new \Hamcrest\Core\PhpForm(), + 'correct __toString' + ); + $this->assertMatches( + hasToString(equalTo('java')), + new \Hamcrest\Core\JavaForm(), + 'correct toString' + ); + } + + public function testPicksJavaOverPhpToString() + { + $this->assertMatches( + hasToString(equalTo('java')), + new \Hamcrest\Core\BothForms(), + 'correct toString' + ); + } + + public function testDoesNotMatchWhenToStringDoesNotMatch() + { + $this->assertDoesNotMatch( + hasToString(equalTo('mismatch')), + new \Hamcrest\Core\PhpForm(), + 'incorrect __toString' + ); + $this->assertDoesNotMatch( + hasToString(equalTo('mismatch')), + new \Hamcrest\Core\JavaForm(), + 'incorrect toString' + ); + $this->assertDoesNotMatch( + hasToString(equalTo('mismatch')), + new \Hamcrest\Core\BothForms(), + 'incorrect __toString' + ); + } + + public function testDoesNotMatchNull() + { + $this->assertDoesNotMatch( + hasToString(equalTo('a')), + null, + 'should not match null' + ); + } + + public function testProvidesConvenientShortcutForTraversableWithSizeEqualTo() + { + $this->assertMatches( + hasToString(equalTo('php')), + new \Hamcrest\Core\PhpForm(), + 'correct __toString' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + 'an object with toString() "php"', + hasToString(equalTo('php')) + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsAnythingTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsAnythingTest.php new file mode 100644 index 00000000..f68032e5 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsAnythingTest.php @@ -0,0 +1,29 @@ +assertDescription('ANYTHING', anything()); + } + + public function testCanOverrideDescription() + { + $description = 'description'; + $this->assertDescription($description, anything($description)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsCollectionContainingTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsCollectionContainingTest.php new file mode 100644 index 00000000..a3929b54 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsCollectionContainingTest.php @@ -0,0 +1,91 @@ +assertMatches( + $itemMatcher, + array('a', 'b', 'c'), + "should match list that contains 'a'" + ); + } + + public function testDoesNotMatchCollectionThatDoesntContainAnElementMatchingTheGivenMatcher() + { + $matcher1 = hasItem(equalTo('a')); + $this->assertDoesNotMatch( + $matcher1, + array('b', 'c'), + "should not match list that doesn't contain 'a'" + ); + + $matcher2 = hasItem(equalTo('a')); + $this->assertDoesNotMatch( + $matcher2, + array(), + 'should not match the empty list' + ); + } + + public function testDoesNotMatchNull() + { + $this->assertDoesNotMatch( + hasItem(equalTo('a')), + null, + 'should not match null' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('a collection containing "a"', hasItem(equalTo('a'))); + } + + public function testMatchesAllItemsInCollection() + { + $matcher1 = hasItems(equalTo('a'), equalTo('b'), equalTo('c')); + $this->assertMatches( + $matcher1, + array('a', 'b', 'c'), + 'should match list containing all items' + ); + + $matcher2 = hasItems('a', 'b', 'c'); + $this->assertMatches( + $matcher2, + array('a', 'b', 'c'), + 'should match list containing all items (without matchers)' + ); + + $matcher3 = hasItems(equalTo('a'), equalTo('b'), equalTo('c')); + $this->assertMatches( + $matcher3, + array('c', 'b', 'a'), + 'should match list containing all items in any order' + ); + + $matcher4 = hasItems(equalTo('a'), equalTo('b'), equalTo('c')); + $this->assertMatches( + $matcher4, + array('e', 'c', 'b', 'a', 'd'), + 'should match list containing all items plus others' + ); + + $matcher5 = hasItems(equalTo('a'), equalTo('b'), equalTo('c')); + $this->assertDoesNotMatch( + $matcher5, + array('e', 'c', 'b', 'd'), // 'a' missing + 'should not match list unless it contains all items' + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsEqualTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsEqualTest.php new file mode 100644 index 00000000..73e3ff07 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsEqualTest.php @@ -0,0 +1,102 @@ +_arg = $arg; + } + + public function __toString() + { + return $this->_arg; + } +} + +class IsEqualTest extends \Hamcrest\AbstractMatcherTest +{ + + protected function createMatcher() + { + return \Hamcrest\Core\IsEqual::equalTo('irrelevant'); + } + + public function testComparesObjectsUsingEqualityOperator() + { + assertThat("hi", equalTo("hi")); + assertThat("bye", not(equalTo("hi"))); + + assertThat(1, equalTo(1)); + assertThat(1, not(equalTo(2))); + + assertThat("2", equalTo(2)); + } + + public function testCanCompareNullValues() + { + assertThat(null, equalTo(null)); + + assertThat(null, not(equalTo('hi'))); + assertThat('hi', not(equalTo(null))); + } + + public function testComparesTheElementsOfAnArray() + { + $s1 = array('a', 'b'); + $s2 = array('a', 'b'); + $s3 = array('c', 'd'); + $s4 = array('a', 'b', 'c', 'd'); + + assertThat($s1, equalTo($s1)); + assertThat($s2, equalTo($s1)); + assertThat($s3, not(equalTo($s1))); + assertThat($s4, not(equalTo($s1))); + } + + public function testComparesTheElementsOfAnArrayOfPrimitiveTypes() + { + $i1 = array(1, 2); + $i2 = array(1, 2); + $i3 = array(3, 4); + $i4 = array(1, 2, 3, 4); + + assertThat($i1, equalTo($i1)); + assertThat($i2, equalTo($i1)); + assertThat($i3, not(equalTo($i1))); + assertThat($i4, not(equalTo($i1))); + } + + public function testRecursivelyTestsElementsOfArrays() + { + $i1 = array(array(1, 2), array(3, 4)); + $i2 = array(array(1, 2), array(3, 4)); + $i3 = array(array(5, 6), array(7, 8)); + $i4 = array(array(1, 2, 3, 4), array(3, 4)); + + assertThat($i1, equalTo($i1)); + assertThat($i2, equalTo($i1)); + assertThat($i3, not(equalTo($i1))); + assertThat($i4, not(equalTo($i1))); + } + + public function testIncludesTheResultOfCallingToStringOnItsArgumentInTheDescription() + { + $argumentDescription = 'ARGUMENT DESCRIPTION'; + $argument = new \Hamcrest\Core\DummyToStringClass($argumentDescription); + $this->assertDescription('<' . $argumentDescription . '>', equalTo($argument)); + } + + public function testReturnsAnObviousDescriptionIfCreatedWithANestedMatcherByMistake() + { + $innerMatcher = equalTo('NestedMatcher'); + $this->assertDescription('<' . (string) $innerMatcher . '>', equalTo($innerMatcher)); + } + + public function testReturnsGoodDescriptionIfCreatedWithNullReference() + { + $this->assertDescription('null', equalTo(null)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsIdenticalTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsIdenticalTest.php new file mode 100644 index 00000000..9cc27946 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsIdenticalTest.php @@ -0,0 +1,30 @@ +assertDescription('"ARG"', identicalTo('ARG')); + } + + public function testReturnsReadableDescriptionFromToStringWhenInitialisedWithNull() + { + $this->assertDescription('null', identicalTo(null)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsInstanceOfTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsInstanceOfTest.php new file mode 100644 index 00000000..f74cfdb5 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsInstanceOfTest.php @@ -0,0 +1,51 @@ +_baseClassInstance = new \Hamcrest\Core\SampleBaseClass('good'); + $this->_subClassInstance = new \Hamcrest\Core\SampleSubClass('good'); + } + + protected function createMatcher() + { + return \Hamcrest\Core\IsInstanceOf::anInstanceOf('stdClass'); + } + + public function testEvaluatesToTrueIfArgumentIsInstanceOfASpecificClass() + { + assertThat($this->_baseClassInstance, anInstanceOf('Hamcrest\Core\SampleBaseClass')); + assertThat($this->_subClassInstance, anInstanceOf('Hamcrest\Core\SampleSubClass')); + assertThat(null, not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + assertThat(new \stdClass(), not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + } + + public function testEvaluatesToFalseIfArgumentIsNotAnObject() + { + assertThat(null, not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + assertThat(false, not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + assertThat(5, not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + assertThat('foo', not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + assertThat(array(1, 2, 3), not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('an instance of stdClass', anInstanceOf('stdClass')); + } + + public function testDecribesActualClassInMismatchMessage() + { + $this->assertMismatchDescription( + '[Hamcrest\Core\SampleBaseClass] ', + anInstanceOf('Hamcrest\Core\SampleSubClass'), + $this->_baseClassInstance + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNotTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNotTest.php new file mode 100644 index 00000000..09d4a652 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNotTest.php @@ -0,0 +1,31 @@ +assertMatches(not(equalTo('A')), 'B', 'should match'); + $this->assertDoesNotMatch(not(equalTo('B')), 'B', 'should not match'); + } + + public function testProvidesConvenientShortcutForNotEqualTo() + { + $this->assertMatches(not('A'), 'B', 'should match'); + $this->assertMatches(not('B'), 'A', 'should match'); + $this->assertDoesNotMatch(not('A'), 'A', 'should not match'); + $this->assertDoesNotMatch(not('B'), 'B', 'should not match'); + } + + public function testUsesDescriptionOfNegatedMatcherWithPrefix() + { + $this->assertDescription('not a value greater than <2>', not(greaterThan(2))); + $this->assertDescription('not "A"', not('A')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNullTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNullTest.php new file mode 100644 index 00000000..bfa42554 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNullTest.php @@ -0,0 +1,20 @@ +assertDescription('sameInstance("ARG")', sameInstance('ARG')); + } + + public function testReturnsReadableDescriptionFromToStringWhenInitialisedWithNull() + { + $this->assertDescription('sameInstance(null)', sameInstance(null)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTest.php new file mode 100644 index 00000000..bbd848b9 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTest.php @@ -0,0 +1,33 @@ +assertMatches(is(equalTo(true)), true, 'should match'); + $this->assertMatches(is(equalTo(false)), false, 'should match'); + $this->assertDoesNotMatch(is(equalTo(true)), false, 'should not match'); + $this->assertDoesNotMatch(is(equalTo(false)), true, 'should not match'); + } + + public function testGeneratesIsPrefixInDescription() + { + $this->assertDescription('is ', is(equalTo(true))); + } + + public function testProvidesConvenientShortcutForIsEqualTo() + { + $this->assertMatches(is('A'), 'A', 'should match'); + $this->assertMatches(is('B'), 'B', 'should match'); + $this->assertDoesNotMatch(is('A'), 'B', 'should not match'); + $this->assertDoesNotMatch(is('B'), 'A', 'should not match'); + $this->assertDescription('is "A"', is('A')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTypeOfTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTypeOfTest.php new file mode 100644 index 00000000..3f48dea7 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTypeOfTest.php @@ -0,0 +1,45 @@ +assertDescription('a double', typeOf('double')); + $this->assertDescription('an integer', typeOf('integer')); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', typeOf('boolean'), null); + $this->assertMismatchDescription('was an integer <5>', typeOf('float'), 5); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleBaseClass.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleBaseClass.php new file mode 100644 index 00000000..c953e7cd --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleBaseClass.php @@ -0,0 +1,18 @@ +_arg = $arg; + } + + public function __toString() + { + return $this->_arg; + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleSubClass.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleSubClass.php new file mode 100644 index 00000000..822f1b64 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleSubClass.php @@ -0,0 +1,6 @@ +_instanceProperty); + } + + protected function createMatcher() + { + return \Hamcrest\Core\Set::set('property_name'); + } + + public function testEvaluatesToTrueIfArrayPropertyIsSet() + { + assertThat(array('foo' => 'bar'), set('foo')); + } + + public function testNegatedEvaluatesToFalseIfArrayPropertyIsSet() + { + assertThat(array('foo' => 'bar'), not(notSet('foo'))); + } + + public function testEvaluatesToTrueIfClassPropertyIsSet() + { + self::$_classProperty = 'bar'; + assertThat('Hamcrest\Core\SetTest', set('_classProperty')); + } + + public function testNegatedEvaluatesToFalseIfClassPropertyIsSet() + { + self::$_classProperty = 'bar'; + assertThat('Hamcrest\Core\SetTest', not(notSet('_classProperty'))); + } + + public function testEvaluatesToTrueIfObjectPropertyIsSet() + { + $this->_instanceProperty = 'bar'; + assertThat($this, set('_instanceProperty')); + } + + public function testNegatedEvaluatesToFalseIfObjectPropertyIsSet() + { + $this->_instanceProperty = 'bar'; + assertThat($this, not(notSet('_instanceProperty'))); + } + + public function testEvaluatesToFalseIfArrayPropertyIsNotSet() + { + assertThat(array('foo' => 'bar'), not(set('baz'))); + } + + public function testNegatedEvaluatesToTrueIfArrayPropertyIsNotSet() + { + assertThat(array('foo' => 'bar'), notSet('baz')); + } + + public function testEvaluatesToFalseIfClassPropertyIsNotSet() + { + assertThat('Hamcrest\Core\SetTest', not(set('_classProperty'))); + } + + public function testNegatedEvaluatesToTrueIfClassPropertyIsNotSet() + { + assertThat('Hamcrest\Core\SetTest', notSet('_classProperty')); + } + + public function testEvaluatesToFalseIfObjectPropertyIsNotSet() + { + assertThat($this, not(set('_instanceProperty'))); + } + + public function testNegatedEvaluatesToTrueIfObjectPropertyIsNotSet() + { + assertThat($this, notSet('_instanceProperty')); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('set property foo', set('foo')); + $this->assertDescription('unset property bar', notSet('bar')); + } + + public function testDecribesPropertySettingInMismatchMessage() + { + $this->assertMismatchDescription( + 'was not set', + set('bar'), + array('foo' => 'bar') + ); + $this->assertMismatchDescription( + 'was "bar"', + notSet('foo'), + array('foo' => 'bar') + ); + self::$_classProperty = 'bar'; + $this->assertMismatchDescription( + 'was "bar"', + notSet('_classProperty'), + 'Hamcrest\Core\SetTest' + ); + $this->_instanceProperty = 'bar'; + $this->assertMismatchDescription( + 'was "bar"', + notSet('_instanceProperty'), + $this + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/FeatureMatcherTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/FeatureMatcherTest.php new file mode 100644 index 00000000..1b023049 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/FeatureMatcherTest.php @@ -0,0 +1,73 @@ +_result = $result; + } + public function getResult() + { + return $this->_result; + } +} + +/* Test-specific subclass only */ +class ResultMatcher extends \Hamcrest\FeatureMatcher +{ + public function __construct() + { + parent::__construct(self::TYPE_ANY, null, equalTo('bar'), 'Thingy with result', 'result'); + } + public function featureValueOf($actual) + { + if ($actual instanceof \Hamcrest\Thingy) { + return $actual->getResult(); + } + } +} + +class FeatureMatcherTest extends \Hamcrest\AbstractMatcherTest +{ + + private $_resultMatcher; + + protected function setUp() + { + $this->_resultMatcher = $this->_resultMatcher(); + } + + protected function createMatcher() + { + return $this->_resultMatcher(); + } + + public function testMatchesPartOfAnObject() + { + $this->assertMatches($this->_resultMatcher, new \Hamcrest\Thingy('bar'), 'feature'); + $this->assertDescription('Thingy with result "bar"', $this->_resultMatcher); + } + + public function testMismatchesPartOfAnObject() + { + $this->assertMismatchDescription( + 'result was "foo"', + $this->_resultMatcher, + new \Hamcrest\Thingy('foo') + ); + } + + public function testDoesNotGenerateNoticesForNull() + { + $this->assertMismatchDescription('result was null', $this->_resultMatcher, null); + } + + // -- Creation Methods + + private function _resultMatcher() + { + return new \Hamcrest\ResultMatcher(); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/InvokedMatcherTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/InvokedMatcherTest.php new file mode 100644 index 00000000..dfa77006 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/InvokedMatcherTest.php @@ -0,0 +1,31 @@ +matchAgainst = $matchAgainst; + } + + public function matches($item) + { + return $item == $this->matchAgainst; + } + +} + +class InvokedMatcherTest extends TestCase +{ + public function testInvokedMatchersCallMatches() + { + $sampleMatcher = new SampleInvokeMatcher('foo'); + + $this->assertTrue($sampleMatcher('foo')); + $this->assertFalse($sampleMatcher('bar')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/MatcherAssertTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/MatcherAssertTest.php new file mode 100644 index 00000000..dc12fba5 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/MatcherAssertTest.php @@ -0,0 +1,192 @@ +getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat(null); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat(''); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat(0); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat(0.0); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat(array()); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('', $ex->getMessage()); + } + self::assertEquals(6, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + + public function testAssertThatWithIdentifierAndTrueArgPasses() + { + \Hamcrest\MatcherAssert::assertThat('identifier', true); + \Hamcrest\MatcherAssert::assertThat('identifier', 'non-empty'); + \Hamcrest\MatcherAssert::assertThat('identifier', 1); + \Hamcrest\MatcherAssert::assertThat('identifier', 3.14159); + \Hamcrest\MatcherAssert::assertThat('identifier', array(true)); + self::assertEquals(5, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + + public function testAssertThatWithIdentifierAndFalseArgFails() + { + try { + \Hamcrest\MatcherAssert::assertThat('identifier', false); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('identifier', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat('identifier', null); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('identifier', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat('identifier', ''); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('identifier', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat('identifier', 0); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('identifier', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat('identifier', 0.0); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('identifier', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat('identifier', array()); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('identifier', $ex->getMessage()); + } + self::assertEquals(6, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + + public function testAssertThatWithActualValueAndMatcherArgsThatMatchPasses() + { + \Hamcrest\MatcherAssert::assertThat(true, is(true)); + self::assertEquals(1, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + + public function testAssertThatWithActualValueAndMatcherArgsThatDontMatchFails() + { + $expected = 'expected'; + $actual = 'actual'; + + $expectedMessage = + 'Expected: "expected"' . PHP_EOL . + ' but: was "actual"'; + + try { + \Hamcrest\MatcherAssert::assertThat($actual, equalTo($expected)); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals($expectedMessage, $ex->getMessage()); + self::assertEquals(1, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + } + + public function testAssertThatWithIdentifierAndActualValueAndMatcherArgsThatMatchPasses() + { + \Hamcrest\MatcherAssert::assertThat('identifier', true, is(true)); + self::assertEquals(1, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + + public function testAssertThatWithIdentifierAndActualValueAndMatcherArgsThatDontMatchFails() + { + $expected = 'expected'; + $actual = 'actual'; + + $expectedMessage = + 'identifier' . PHP_EOL . + 'Expected: "expected"' . PHP_EOL . + ' but: was "actual"'; + + try { + \Hamcrest\MatcherAssert::assertThat('identifier', $actual, equalTo($expected)); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals($expectedMessage, $ex->getMessage()); + self::assertEquals(1, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + } + + public function testAssertThatWithNoArgsThrowsErrorAndDoesntIncrementCount() + { + try { + \Hamcrest\MatcherAssert::assertThat(); + self::fail('expected invalid argument exception'); + } catch (\InvalidArgumentException $ex) { + self::assertEquals(0, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + } + + public function testAssertThatWithFourArgsThrowsErrorAndDoesntIncrementCount() + { + try { + \Hamcrest\MatcherAssert::assertThat(1, 2, 3, 4); + self::fail('expected invalid argument exception'); + } catch (\InvalidArgumentException $ex) { + self::assertEquals(0, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/IsCloseToTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/IsCloseToTest.php new file mode 100644 index 00000000..987d5526 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/IsCloseToTest.php @@ -0,0 +1,27 @@ +assertTrue($p->matches(1.0)); + $this->assertTrue($p->matches(0.5)); + $this->assertTrue($p->matches(1.5)); + + $this->assertDoesNotMatch($p, 2.0, 'too large'); + $this->assertMismatchDescription('<2F> differed by <0.5F>', $p, 2.0); + $this->assertDoesNotMatch($p, 0.0, 'number too small'); + $this->assertMismatchDescription('<0F> differed by <0.5F>', $p, 0.0); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/OrderingComparisonTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/OrderingComparisonTest.php new file mode 100644 index 00000000..a4c94d37 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/OrderingComparisonTest.php @@ -0,0 +1,41 @@ +_text = $text; + } + + public function describeTo(\Hamcrest\Description $description) + { + $description->appendText($this->_text); + } +} + +class StringDescriptionTest extends TestCase +{ + + private $_description; + + protected function setUp() + { + $this->_description = new \Hamcrest\StringDescription(); + } + + public function testAppendTextAppendsTextInformation() + { + $this->_description->appendText('foo')->appendText('bar'); + $this->assertEquals('foobar', (string) $this->_description); + } + + public function testAppendValueCanAppendTextTypes() + { + $this->_description->appendValue('foo'); + $this->assertEquals('"foo"', (string) $this->_description); + } + + public function testSpecialCharactersAreEscapedForStringTypes() + { + $this->_description->appendValue("foo\\bar\"zip\r\n"); + $this->assertEquals('"foo\\bar\\"zip\r\n"', (string) $this->_description); + } + + public function testIntegerValuesCanBeAppended() + { + $this->_description->appendValue(42); + $this->assertEquals('<42>', (string) $this->_description); + } + + public function testFloatValuesCanBeAppended() + { + $this->_description->appendValue(42.78); + $this->assertEquals('<42.78F>', (string) $this->_description); + } + + public function testNullValuesCanBeAppended() + { + $this->_description->appendValue(null); + $this->assertEquals('null', (string) $this->_description); + } + + public function testArraysCanBeAppended() + { + $this->_description->appendValue(array('foo', 42.78)); + $this->assertEquals('["foo", <42.78F>]', (string) $this->_description); + } + + public function testObjectsCanBeAppended() + { + $this->_description->appendValue(new \stdClass()); + $this->assertEquals('', (string) $this->_description); + } + + public function testBooleanValuesCanBeAppended() + { + $this->_description->appendValue(false); + $this->assertEquals('', (string) $this->_description); + } + + public function testListsOfvaluesCanBeAppended() + { + $this->_description->appendValue(array('foo', 42.78)); + $this->assertEquals('["foo", <42.78F>]', (string) $this->_description); + } + + public function testIterableOfvaluesCanBeAppended() + { + $items = new \ArrayObject(array('foo', 42.78)); + $this->_description->appendValue($items); + $this->assertEquals('["foo", <42.78F>]', (string) $this->_description); + } + + public function testIteratorOfvaluesCanBeAppended() + { + $items = new \ArrayObject(array('foo', 42.78)); + $this->_description->appendValue($items->getIterator()); + $this->assertEquals('["foo", <42.78F>]', (string) $this->_description); + } + + public function testListsOfvaluesCanBeAppendedManually() + { + $this->_description->appendValueList('@start@', '@sep@ ', '@end@', array('foo', 42.78)); + $this->assertEquals('@start@"foo"@sep@ <42.78F>@end@', (string) $this->_description); + } + + public function testIterableOfvaluesCanBeAppendedManually() + { + $items = new \ArrayObject(array('foo', 42.78)); + $this->_description->appendValueList('@start@', '@sep@ ', '@end@', $items); + $this->assertEquals('@start@"foo"@sep@ <42.78F>@end@', (string) $this->_description); + } + + public function testIteratorOfvaluesCanBeAppendedManually() + { + $items = new \ArrayObject(array('foo', 42.78)); + $this->_description->appendValueList('@start@', '@sep@ ', '@end@', $items->getIterator()); + $this->assertEquals('@start@"foo"@sep@ <42.78F>@end@', (string) $this->_description); + } + + public function testSelfDescribingObjectsCanBeAppended() + { + $this->_description + ->appendDescriptionOf(new \Hamcrest\SampleSelfDescriber('foo')) + ->appendDescriptionOf(new \Hamcrest\SampleSelfDescriber('bar')) + ; + $this->assertEquals('foobar', (string) $this->_description); + } + + public function testSelfDescribingObjectsCanBeAppendedAsLists() + { + $this->_description->appendList('@start@', '@sep@ ', '@end@', array( + new \Hamcrest\SampleSelfDescriber('foo'), + new \Hamcrest\SampleSelfDescriber('bar') + )); + $this->assertEquals('@start@foo@sep@ bar@end@', (string) $this->_description); + } + + public function testSelfDescribingObjectsCanBeAppendedAsIteratedLists() + { + $items = new \ArrayObject(array( + new \Hamcrest\SampleSelfDescriber('foo'), + new \Hamcrest\SampleSelfDescriber('bar') + )); + $this->_description->appendList('@start@', '@sep@ ', '@end@', $items); + $this->assertEquals('@start@foo@sep@ bar@end@', (string) $this->_description); + } + + public function testSelfDescribingObjectsCanBeAppendedAsIterators() + { + $items = new \ArrayObject(array( + new \Hamcrest\SampleSelfDescriber('foo'), + new \Hamcrest\SampleSelfDescriber('bar') + )); + $this->_description->appendList('@start@', '@sep@ ', '@end@', $items->getIterator()); + $this->assertEquals('@start@foo@sep@ bar@end@', (string) $this->_description); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEmptyStringTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEmptyStringTest.php new file mode 100644 index 00000000..8d5c56be --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEmptyStringTest.php @@ -0,0 +1,86 @@ +assertDoesNotMatch(emptyString(), null, 'null'); + } + + public function testEmptyDoesNotMatchZero() + { + $this->assertDoesNotMatch(emptyString(), 0, 'zero'); + } + + public function testEmptyDoesNotMatchFalse() + { + $this->assertDoesNotMatch(emptyString(), false, 'false'); + } + + public function testEmptyDoesNotMatchEmptyArray() + { + $this->assertDoesNotMatch(emptyString(), array(), 'empty array'); + } + + public function testEmptyMatchesEmptyString() + { + $this->assertMatches(emptyString(), '', 'empty string'); + } + + public function testEmptyDoesNotMatchNonEmptyString() + { + $this->assertDoesNotMatch(emptyString(), 'foo', 'non-empty string'); + } + + public function testEmptyHasAReadableDescription() + { + $this->assertDescription('an empty string', emptyString()); + } + + public function testEmptyOrNullMatchesNull() + { + $this->assertMatches(nullOrEmptyString(), null, 'null'); + } + + public function testEmptyOrNullMatchesEmptyString() + { + $this->assertMatches(nullOrEmptyString(), '', 'empty string'); + } + + public function testEmptyOrNullDoesNotMatchNonEmptyString() + { + $this->assertDoesNotMatch(nullOrEmptyString(), 'foo', 'non-empty string'); + } + + public function testEmptyOrNullHasAReadableDescription() + { + $this->assertDescription('(null or an empty string)', nullOrEmptyString()); + } + + public function testNonEmptyDoesNotMatchNull() + { + $this->assertDoesNotMatch(nonEmptyString(), null, 'null'); + } + + public function testNonEmptyDoesNotMatchEmptyString() + { + $this->assertDoesNotMatch(nonEmptyString(), '', 'empty string'); + } + + public function testNonEmptyMatchesNonEmptyString() + { + $this->assertMatches(nonEmptyString(), 'foo', 'non-empty string'); + } + + public function testNonEmptyHasAReadableDescription() + { + $this->assertDescription('a non-empty string', nonEmptyString()); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringCaseTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringCaseTest.php new file mode 100644 index 00000000..0539fd5c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringCaseTest.php @@ -0,0 +1,40 @@ +assertDescription( + 'equalToIgnoringCase("heLLo")', + equalToIgnoringCase('heLLo') + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php new file mode 100644 index 00000000..27ad338b --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php @@ -0,0 +1,51 @@ +_matcher = \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace( + "Hello World how\n are we? " + ); + } + + protected function createMatcher() + { + return $this->_matcher; + } + + public function testPassesIfWordsAreSameButWhitespaceDiffers() + { + assertThat('Hello World how are we?', $this->_matcher); + assertThat(" Hello \rWorld \t how are\nwe?", $this->_matcher); + } + + public function testFailsIfTextOtherThanWhitespaceDiffers() + { + assertThat('Hello PLANET how are we?', not($this->_matcher)); + assertThat('Hello World how are we', not($this->_matcher)); + } + + public function testFailsIfWhitespaceIsAddedOrRemovedInMidWord() + { + assertThat('HelloWorld how are we?', not($this->_matcher)); + assertThat('Hello Wo rld how are we?', not($this->_matcher)); + } + + public function testFailsIfMatchingAgainstNull() + { + assertThat(null, not($this->_matcher)); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + "equalToIgnoringWhiteSpace(\"Hello World how\\n are we? \")", + $this->_matcher + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/MatchesPatternTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/MatchesPatternTest.php new file mode 100644 index 00000000..4891598f --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/MatchesPatternTest.php @@ -0,0 +1,30 @@ +assertDescription('a string matching "pattern"', matchesPattern('pattern')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php new file mode 100644 index 00000000..73023007 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php @@ -0,0 +1,80 @@ +_stringContains = \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase( + strtolower(self::EXCERPT) + ); + } + + protected function createMatcher() + { + return $this->_stringContains; + } + + public function testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring() + { + $this->assertTrue( + $this->_stringContains->matches(self::EXCERPT . 'END'), + 'should be true if excerpt at beginning' + ); + $this->assertTrue( + $this->_stringContains->matches('START' . self::EXCERPT), + 'should be true if excerpt at end' + ); + $this->assertTrue( + $this->_stringContains->matches('START' . self::EXCERPT . 'END'), + 'should be true if excerpt in middle' + ); + $this->assertTrue( + $this->_stringContains->matches(self::EXCERPT . self::EXCERPT), + 'should be true if excerpt is repeated' + ); + + $this->assertFalse( + $this->_stringContains->matches('Something else'), + 'should not be true if excerpt is not in string' + ); + $this->assertFalse( + $this->_stringContains->matches(substr(self::EXCERPT, 1)), + 'should not be true if part of excerpt is in string' + ); + } + + public function testEvaluatesToTrueIfArgumentIsEqualToSubstring() + { + $this->assertTrue( + $this->_stringContains->matches(self::EXCERPT), + 'should be true if excerpt is entire string' + ); + } + + public function testEvaluatesToTrueIfArgumentContainsExactSubstring() + { + $this->assertTrue( + $this->_stringContains->matches(strtolower(self::EXCERPT)), + 'should be false if excerpt is entire string ignoring case' + ); + $this->assertTrue( + $this->_stringContains->matches('START' . strtolower(self::EXCERPT) . 'END'), + 'should be false if excerpt is contained in string ignoring case' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + 'a string containing in any case "' + . strtolower(self::EXCERPT) . '"', + $this->_stringContains + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsInOrderTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsInOrderTest.php new file mode 100644 index 00000000..4c465b29 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsInOrderTest.php @@ -0,0 +1,42 @@ +_m = \Hamcrest\Text\StringContainsInOrder::stringContainsInOrder(array('a', 'b', 'c')); + } + + protected function createMatcher() + { + return $this->_m; + } + + public function testMatchesOnlyIfStringContainsGivenSubstringsInTheSameOrder() + { + $this->assertMatches($this->_m, 'abc', 'substrings in order'); + $this->assertMatches($this->_m, '1a2b3c4', 'substrings separated'); + + $this->assertDoesNotMatch($this->_m, 'cab', 'substrings out of order'); + $this->assertDoesNotMatch($this->_m, 'xyz', 'no substrings in string'); + $this->assertDoesNotMatch($this->_m, 'ac', 'substring missing'); + $this->assertDoesNotMatch($this->_m, '', 'empty string'); + } + + public function testAcceptsVariableArguments() + { + $this->assertMatches(stringContainsInOrder('a', 'b', 'c'), 'abc', 'substrings as variable arguments'); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + 'a string containing "a", "b", "c" in order', + $this->_m + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsTest.php new file mode 100644 index 00000000..bf4afa3c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsTest.php @@ -0,0 +1,86 @@ +_stringContains = \Hamcrest\Text\StringContains::containsString(self::EXCERPT); + } + + protected function createMatcher() + { + return $this->_stringContains; + } + + public function testEvaluatesToTrueIfArgumentContainsSubstring() + { + $this->assertTrue( + $this->_stringContains->matches(self::EXCERPT . 'END'), + 'should be true if excerpt at beginning' + ); + $this->assertTrue( + $this->_stringContains->matches('START' . self::EXCERPT), + 'should be true if excerpt at end' + ); + $this->assertTrue( + $this->_stringContains->matches('START' . self::EXCERPT . 'END'), + 'should be true if excerpt in middle' + ); + $this->assertTrue( + $this->_stringContains->matches(self::EXCERPT . self::EXCERPT), + 'should be true if excerpt is repeated' + ); + + $this->assertFalse( + $this->_stringContains->matches('Something else'), + 'should not be true if excerpt is not in string' + ); + $this->assertFalse( + $this->_stringContains->matches(substr(self::EXCERPT, 1)), + 'should not be true if part of excerpt is in string' + ); + } + + public function testEvaluatesToTrueIfArgumentIsEqualToSubstring() + { + $this->assertTrue( + $this->_stringContains->matches(self::EXCERPT), + 'should be true if excerpt is entire string' + ); + } + + public function testEvaluatesToFalseIfArgumentContainsSubstringIgnoringCase() + { + $this->assertFalse( + $this->_stringContains->matches(strtolower(self::EXCERPT)), + 'should be false if excerpt is entire string ignoring case' + ); + $this->assertFalse( + $this->_stringContains->matches('START' . strtolower(self::EXCERPT) . 'END'), + 'should be false if excerpt is contained in string ignoring case' + ); + } + + public function testIgnoringCaseReturnsCorrectMatcher() + { + $this->assertTrue( + $this->_stringContains->ignoringCase()->matches('EXceRpT'), + 'should be true if excerpt is entire string ignoring case' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + 'a string containing "' + . self::EXCERPT . '"', + $this->_stringContains + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringEndsWithTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringEndsWithTest.php new file mode 100644 index 00000000..9a30f952 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringEndsWithTest.php @@ -0,0 +1,62 @@ +_stringEndsWith = \Hamcrest\Text\StringEndsWith::endsWith(self::EXCERPT); + } + + protected function createMatcher() + { + return $this->_stringEndsWith; + } + + public function testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring() + { + $this->assertFalse( + $this->_stringEndsWith->matches(self::EXCERPT . 'END'), + 'should be false if excerpt at beginning' + ); + $this->assertTrue( + $this->_stringEndsWith->matches('START' . self::EXCERPT), + 'should be true if excerpt at end' + ); + $this->assertFalse( + $this->_stringEndsWith->matches('START' . self::EXCERPT . 'END'), + 'should be false if excerpt in middle' + ); + $this->assertTrue( + $this->_stringEndsWith->matches(self::EXCERPT . self::EXCERPT), + 'should be true if excerpt is at end and repeated' + ); + + $this->assertFalse( + $this->_stringEndsWith->matches('Something else'), + 'should be false if excerpt is not in string' + ); + $this->assertFalse( + $this->_stringEndsWith->matches(substr(self::EXCERPT, 0, strlen(self::EXCERPT) - 2)), + 'should be false if part of excerpt is at end of string' + ); + } + + public function testEvaluatesToTrueIfArgumentIsEqualToSubstring() + { + $this->assertTrue( + $this->_stringEndsWith->matches(self::EXCERPT), + 'should be true if excerpt is entire string' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('a string ending with "EXCERPT"', $this->_stringEndsWith); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringStartsWithTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringStartsWithTest.php new file mode 100644 index 00000000..3be201f1 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringStartsWithTest.php @@ -0,0 +1,62 @@ +_stringStartsWith = \Hamcrest\Text\StringStartsWith::startsWith(self::EXCERPT); + } + + protected function createMatcher() + { + return $this->_stringStartsWith; + } + + public function testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring() + { + $this->assertTrue( + $this->_stringStartsWith->matches(self::EXCERPT . 'END'), + 'should be true if excerpt at beginning' + ); + $this->assertFalse( + $this->_stringStartsWith->matches('START' . self::EXCERPT), + 'should be false if excerpt at end' + ); + $this->assertFalse( + $this->_stringStartsWith->matches('START' . self::EXCERPT . 'END'), + 'should be false if excerpt in middle' + ); + $this->assertTrue( + $this->_stringStartsWith->matches(self::EXCERPT . self::EXCERPT), + 'should be true if excerpt is at beginning and repeated' + ); + + $this->assertFalse( + $this->_stringStartsWith->matches('Something else'), + 'should be false if excerpt is not in string' + ); + $this->assertFalse( + $this->_stringStartsWith->matches(substr(self::EXCERPT, 1)), + 'should be false if part of excerpt is at start of string' + ); + } + + public function testEvaluatesToTrueIfArgumentIsEqualToSubstring() + { + $this->assertTrue( + $this->_stringStartsWith->matches(self::EXCERPT), + 'should be true if excerpt is entire string' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('a string starting with "EXCERPT"', $this->_stringStartsWith); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsArrayTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsArrayTest.php new file mode 100644 index 00000000..d13c24d2 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsArrayTest.php @@ -0,0 +1,35 @@ +assertDescription('an array', arrayValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', arrayValue(), null); + $this->assertMismatchDescription('was a string "foo"', arrayValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsBooleanTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsBooleanTest.php new file mode 100644 index 00000000..24309fc0 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsBooleanTest.php @@ -0,0 +1,35 @@ +assertDescription('a boolean', booleanValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', booleanValue(), null); + $this->assertMismatchDescription('was a string "foo"', booleanValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsCallableTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsCallableTest.php new file mode 100644 index 00000000..5098e21b --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsCallableTest.php @@ -0,0 +1,103 @@ +=')) { + $this->markTestSkipped('Closures require php 5.3'); + } + eval('assertThat(function () {}, callableValue());'); + } + + public function testEvaluatesToTrueIfArgumentImplementsInvoke() + { + if (!version_compare(PHP_VERSION, '5.3', '>=')) { + $this->markTestSkipped('Magic method __invoke() requires php 5.3'); + } + assertThat($this, callableValue()); + } + + public function testEvaluatesToFalseIfArgumentIsInvalidFunctionName() + { + if (function_exists('not_a_Hamcrest_function')) { + $this->markTestSkipped('Function "not_a_Hamcrest_function" must not exist'); + } + + assertThat('not_a_Hamcrest_function', not(callableValue())); + } + + public function testEvaluatesToFalseIfArgumentIsInvalidStaticMethodCallback() + { + assertThat( + array('Hamcrest\Type\IsCallableTest', 'noMethod'), + not(callableValue()) + ); + } + + public function testEvaluatesToFalseIfArgumentIsInvalidInstanceMethodCallback() + { + assertThat(array($this, 'noMethod'), not(callableValue())); + } + + public function testEvaluatesToFalseIfArgumentDoesntImplementInvoke() + { + assertThat(new \stdClass(), not(callableValue())); + } + + public function testEvaluatesToFalseIfArgumentDoesntMatchType() + { + assertThat(false, not(callableValue())); + assertThat(5.2, not(callableValue())); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('a callable', callableValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription( + 'was a string "invalid-function"', + callableValue(), + 'invalid-function' + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsDoubleTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsDoubleTest.php new file mode 100644 index 00000000..85c2a963 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsDoubleTest.php @@ -0,0 +1,35 @@ +assertDescription('a double', doubleValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', doubleValue(), null); + $this->assertMismatchDescription('was a string "foo"', doubleValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsIntegerTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsIntegerTest.php new file mode 100644 index 00000000..ce5a51a9 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsIntegerTest.php @@ -0,0 +1,36 @@ +assertDescription('an integer', integerValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', integerValue(), null); + $this->assertMismatchDescription('was a string "foo"', integerValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsNumericTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsNumericTest.php new file mode 100644 index 00000000..1fd83efe --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsNumericTest.php @@ -0,0 +1,53 @@ +assertDescription('a number', numericValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', numericValue(), null); + $this->assertMismatchDescription('was a string "foo"', numericValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsObjectTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsObjectTest.php new file mode 100644 index 00000000..a3b617c2 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsObjectTest.php @@ -0,0 +1,34 @@ +assertDescription('an object', objectValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', objectValue(), null); + $this->assertMismatchDescription('was a string "foo"', objectValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsResourceTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsResourceTest.php new file mode 100644 index 00000000..d6ea5348 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsResourceTest.php @@ -0,0 +1,34 @@ +assertDescription('a resource', resourceValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', resourceValue(), null); + $this->assertMismatchDescription('was a string "foo"', resourceValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsScalarTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsScalarTest.php new file mode 100644 index 00000000..72a188d6 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsScalarTest.php @@ -0,0 +1,39 @@ +assertDescription('a scalar', scalarValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', scalarValue(), null); + $this->assertMismatchDescription('was an array ["foo"]', scalarValue(), array('foo')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsStringTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsStringTest.php new file mode 100644 index 00000000..557d5913 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsStringTest.php @@ -0,0 +1,35 @@ +assertDescription('a string', stringValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', stringValue(), null); + $this->assertMismatchDescription('was a double <5.2F>', stringValue(), 5.2); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/UtilTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/UtilTest.php new file mode 100644 index 00000000..7248978c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/UtilTest.php @@ -0,0 +1,82 @@ +assertSame($matcher, $newMatcher); + } + + public function testWrapValueWithIsEqualWrapsPrimitive() + { + $matcher = \Hamcrest\Util::wrapValueWithIsEqual('foo'); + $this->assertInstanceOf('Hamcrest\Core\IsEqual', $matcher); + $this->assertTrue($matcher->matches('foo')); + } + + public function testCheckAllAreMatchersAcceptsMatchers() + { + \Hamcrest\Util::checkAllAreMatchers(array( + new \Hamcrest\Text\MatchesPattern('/fo+/'), + new \Hamcrest\Core\IsEqual('foo'), + )); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testCheckAllAreMatchersFailsForPrimitive() + { + \Hamcrest\Util::checkAllAreMatchers(array( + new \Hamcrest\Text\MatchesPattern('/fo+/'), + 'foo', + )); + } + + private function callAndAssertCreateMatcherArray($items) + { + $matchers = \Hamcrest\Util::createMatcherArray($items); + $this->assertInternalType('array', $matchers); + $this->assertSameSize($items, $matchers); + foreach ($matchers as $matcher) { + $this->assertInstanceOf('\Hamcrest\Matcher', $matcher); + } + + return $matchers; + } + + public function testCreateMatcherArrayLeavesMatchersUntouched() + { + $matcher = new \Hamcrest\Text\MatchesPattern('/fo+/'); + $items = array($matcher); + $matchers = $this->callAndAssertCreateMatcherArray($items); + $this->assertSame($matcher, $matchers[0]); + } + + public function testCreateMatcherArrayWrapsPrimitiveWithIsEqualMatcher() + { + $matchers = $this->callAndAssertCreateMatcherArray(array('foo')); + $this->assertInstanceOf('Hamcrest\Core\IsEqual', $matchers[0]); + $this->assertTrue($matchers[0]->matches('foo')); + } + + public function testCreateMatcherArrayDoesntModifyOriginalArray() + { + $items = array('foo'); + $this->callAndAssertCreateMatcherArray($items); + $this->assertSame('foo', $items[0]); + } + + public function testCreateMatcherArrayUnwrapsSingleArrayElement() + { + $matchers = $this->callAndAssertCreateMatcherArray(array(array('foo'))); + $this->assertInstanceOf('Hamcrest\Core\IsEqual', $matchers[0]); + $this->assertTrue($matchers[0]->matches('foo')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Xml/HasXPathTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Xml/HasXPathTest.php new file mode 100644 index 00000000..67748871 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Xml/HasXPathTest.php @@ -0,0 +1,198 @@ + + + + alice + Alice Frankel + admin + + + bob + Bob Frankel + user + + + charlie + Charlie Chan + user + + +XML; + self::$doc = new \DOMDocument(); + self::$doc->loadXML(self::$xml); + + self::$html = << + + Home Page + + +

Heading

+

Some text

+ + +HTML; + } + + protected function createMatcher() + { + return \Hamcrest\Xml\HasXPath::hasXPath('/users/user'); + } + + public function testMatchesWhenXPathIsFound() + { + assertThat('one match', self::$doc, hasXPath('user[id = "bob"]')); + assertThat('two matches', self::$doc, hasXPath('user[role = "user"]')); + } + + public function testDoesNotMatchWhenXPathIsNotFound() + { + assertThat( + 'no match', + self::$doc, + not(hasXPath('user[contains(id, "frank")]')) + ); + } + + public function testMatchesWhenExpressionWithoutMatcherEvaluatesToTrue() + { + assertThat( + 'one match', + self::$doc, + hasXPath('count(user[id = "bob"])') + ); + } + + public function testDoesNotMatchWhenExpressionWithoutMatcherEvaluatesToFalse() + { + assertThat( + 'no matches', + self::$doc, + not(hasXPath('count(user[id = "frank"])')) + ); + } + + public function testMatchesWhenExpressionIsEqual() + { + assertThat( + 'one match', + self::$doc, + hasXPath('count(user[id = "bob"])', 1) + ); + assertThat( + 'two matches', + self::$doc, + hasXPath('count(user[role = "user"])', 2) + ); + } + + public function testDoesNotMatchWhenExpressionIsNotEqual() + { + assertThat( + 'no match', + self::$doc, + not(hasXPath('count(user[id = "frank"])', 2)) + ); + assertThat( + 'one match', + self::$doc, + not(hasXPath('count(user[role = "admin"])', 2)) + ); + } + + public function testMatchesWhenContentMatches() + { + assertThat( + 'one match', + self::$doc, + hasXPath('user/name', containsString('ice')) + ); + assertThat( + 'two matches', + self::$doc, + hasXPath('user/role', equalTo('user')) + ); + } + + public function testDoesNotMatchWhenContentDoesNotMatch() + { + assertThat( + 'no match', + self::$doc, + not(hasXPath('user/name', containsString('Bobby'))) + ); + assertThat( + 'no matches', + self::$doc, + not(hasXPath('user/role', equalTo('owner'))) + ); + } + + public function testProvidesConvenientShortcutForHasXPathEqualTo() + { + assertThat('matches', self::$doc, hasXPath('count(user)', 3)); + assertThat('matches', self::$doc, hasXPath('user[2]/id', 'bob')); + } + + public function testProvidesConvenientShortcutForHasXPathCountEqualTo() + { + assertThat('matches', self::$doc, hasXPath('user[id = "charlie"]', 1)); + } + + public function testMatchesAcceptsXmlString() + { + assertThat('accepts XML string', self::$xml, hasXPath('user')); + } + + public function testMatchesAcceptsHtmlString() + { + assertThat('accepts HTML string', self::$html, hasXPath('body/h1', 'Heading')); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + 'XML or HTML document with XPath "/users/user"', + hasXPath('/users/user') + ); + $this->assertDescription( + 'XML or HTML document with XPath "count(/users/user)" <2>', + hasXPath('/users/user', 2) + ); + $this->assertDescription( + 'XML or HTML document with XPath "/users/user/name"' + . ' a string starting with "Alice"', + hasXPath('/users/user/name', startsWith('Alice')) + ); + } + + public function testHasAReadableMismatchDescription() + { + $this->assertMismatchDescription( + 'XPath returned no results', + hasXPath('/users/name'), + self::$doc + ); + $this->assertMismatchDescription( + 'XPath expression result was <3F>', + hasXPath('/users/user', 2), + self::$doc + ); + $this->assertMismatchDescription( + 'XPath returned ["alice", "bob", "charlie"]', + hasXPath('/users/user/id', 'Frank'), + self::$doc + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/bootstrap.php b/vendor/hamcrest/hamcrest-php/tests/bootstrap.php new file mode 100644 index 00000000..bc4958d1 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/bootstrap.php @@ -0,0 +1,11 @@ + + + + . + + + + + + ../hamcrest + + + diff --git a/vendor/intervention/image/.github/FUNDING.yml b/vendor/intervention/image/.github/FUNDING.yml new file mode 100644 index 00000000..612406cb --- /dev/null +++ b/vendor/intervention/image/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: [Intervention] +custom: https://www.paypal.me/interventionphp diff --git a/vendor/intervention/image/LICENSE b/vendor/intervention/image/LICENSE new file mode 100644 index 00000000..bc444ba2 --- /dev/null +++ b/vendor/intervention/image/LICENSE @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2014 Oliver Vogel + +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/intervention/image/composer.json b/vendor/intervention/image/composer.json new file mode 100644 index 00000000..e750b406 --- /dev/null +++ b/vendor/intervention/image/composer.json @@ -0,0 +1,47 @@ +{ + "name": "intervention/image", + "description": "Image handling and manipulation library with support for Laravel integration", + "homepage": "http://image.intervention.io/", + "keywords": ["image", "gd", "imagick", "laravel", "watermark", "thumbnail"], + "license": "MIT", + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@olivervogel.com", + "homepage": "http://olivervogel.com/" + } + ], + "require": { + "php": ">=5.4.0", + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1 || ^2.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15", + "mockery/mockery": "~0.9.2" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "minimum-stability": "stable" +} diff --git a/vendor/intervention/image/provides.json b/vendor/intervention/image/provides.json new file mode 100644 index 00000000..a8cd1b6a --- /dev/null +++ b/vendor/intervention/image/provides.json @@ -0,0 +1,11 @@ +{ + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": [ + { + "alias": "Image", + "facade": "Intervention\\Image\\Facades\\Image" + } + ] +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractColor.php b/vendor/intervention/image/src/Intervention/Image/AbstractColor.php new file mode 100644 index 00000000..c9846c6a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractColor.php @@ -0,0 +1,229 @@ +parse($value); + } + + /** + * Parses given value as color + * + * @param mixed $value + * @return \Intervention\Image\AbstractColor + */ + public function parse($value) + { + switch (true) { + + case is_string($value): + $this->initFromString($value); + break; + + case is_int($value): + $this->initFromInteger($value); + break; + + case is_array($value): + $this->initFromArray($value); + break; + + case is_object($value): + $this->initFromObject($value); + break; + + case is_null($value): + $this->initFromArray([255, 255, 255, 0]); + break; + + default: + throw new NotReadableException( + "Color format ({$value}) cannot be read." + ); + } + + return $this; + } + + /** + * Formats current color instance into given format + * + * @param string $type + * @return mixed + */ + public function format($type) + { + switch (strtolower($type)) { + + case 'rgba': + return $this->getRgba(); + + case 'hex': + return $this->getHex('#'); + + case 'int': + case 'integer': + return $this->getInt(); + + case 'array': + return $this->getArray(); + + case 'obj': + case 'object': + return $this; + + default: + throw new NotSupportedException( + "Color format ({$type}) is not supported." + ); + } + } + + /** + * Reads RGBA values from string into array + * + * @param string $value + * @return array + */ + protected function rgbaFromString($value) + { + $result = false; + + // parse color string in hexidecimal format like #cccccc or cccccc or ccc + $hexPattern = '/^#?([a-f0-9]{1,2})([a-f0-9]{1,2})([a-f0-9]{1,2})$/i'; + + // parse color string in format rgb(140, 140, 140) + $rgbPattern = '/^rgb ?\(([0-9]{1,3}), ?([0-9]{1,3}), ?([0-9]{1,3})\)$/i'; + + // parse color string in format rgba(255, 0, 0, 0.5) + $rgbaPattern = '/^rgba ?\(([0-9]{1,3}), ?([0-9]{1,3}), ?([0-9]{1,3}), ?([0-9.]{1,4})\)$/i'; + + if (preg_match($hexPattern, $value, $matches)) { + $result = []; + $result[0] = strlen($matches[1]) == '1' ? hexdec($matches[1].$matches[1]) : hexdec($matches[1]); + $result[1] = strlen($matches[2]) == '1' ? hexdec($matches[2].$matches[2]) : hexdec($matches[2]); + $result[2] = strlen($matches[3]) == '1' ? hexdec($matches[3].$matches[3]) : hexdec($matches[3]); + $result[3] = 1; + } elseif (preg_match($rgbPattern, $value, $matches)) { + $result = []; + $result[0] = ($matches[1] >= 0 && $matches[1] <= 255) ? intval($matches[1]) : 0; + $result[1] = ($matches[2] >= 0 && $matches[2] <= 255) ? intval($matches[2]) : 0; + $result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0; + $result[3] = 1; + } elseif (preg_match($rgbaPattern, $value, $matches)) { + $result = []; + $result[0] = ($matches[1] >= 0 && $matches[1] <= 255) ? intval($matches[1]) : 0; + $result[1] = ($matches[2] >= 0 && $matches[2] <= 255) ? intval($matches[2]) : 0; + $result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0; + $result[3] = ($matches[4] >= 0 && $matches[4] <= 1) ? $matches[4] : 0; + } else { + throw new NotReadableException( + "Unable to read color ({$value})." + ); + } + + return $result; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php b/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php new file mode 100644 index 00000000..743cc5c3 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php @@ -0,0 +1,364 @@ +data = $data; + } + + /** + * Init from given URL + * + * @param string $url + * @return \Intervention\Image\Image + */ + public function initFromUrl($url) + { + + $options = [ + 'http' => [ + 'method'=>"GET", + 'protocol_version'=>1.1, // force use HTTP 1.1 for service mesh environment with envoy + 'header'=>"Accept-language: en\r\n". + "User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2\r\n" + ] + ]; + + $context = stream_context_create($options); + + + if ($data = @file_get_contents($url, false, $context)) { + return $this->initFromBinary($data); + } + + throw new NotReadableException( + "Unable to init from given url (".$url.")." + ); + } + + /** + * Init from given stream + * + * @param StreamInterface|resource $stream + * @return \Intervention\Image\Image + */ + public function initFromStream($stream) + { + if (!$stream instanceof StreamInterface) { + $stream = new Stream($stream); + } + + try { + $offset = $stream->tell(); + } catch (\RuntimeException $e) { + $offset = 0; + } + + $shouldAndCanSeek = $offset !== 0 && $stream->isSeekable(); + + if ($shouldAndCanSeek) { + $stream->rewind(); + } + + try { + $data = $stream->getContents(); + } catch (\RuntimeException $e) { + $data = null; + } + + if ($shouldAndCanSeek) { + $stream->seek($offset); + } + + if ($data) { + return $this->initFromBinary($data); + } + + throw new NotReadableException( + "Unable to init from given stream" + ); + } + + /** + * Determines if current source data is GD resource + * + * @return boolean + */ + public function isGdResource() + { + if (is_resource($this->data)) { + return (get_resource_type($this->data) == 'gd'); + } + + if ($this->data instanceof \GdImage) { + return true; + } + + return false; + } + + /** + * Determines if current source data is Imagick object + * + * @return boolean + */ + public function isImagick() + { + return is_a($this->data, 'Imagick'); + } + + /** + * Determines if current source data is Intervention\Image\Image object + * + * @return boolean + */ + public function isInterventionImage() + { + return is_a($this->data, '\Intervention\Image\Image'); + } + + /** + * Determines if current data is SplFileInfo object + * + * @return boolean + */ + public function isSplFileInfo() + { + return is_a($this->data, 'SplFileInfo'); + } + + /** + * Determines if current data is Symfony UploadedFile component + * + * @return boolean + */ + public function isSymfonyUpload() + { + return is_a($this->data, 'Symfony\Component\HttpFoundation\File\UploadedFile'); + } + + /** + * Determines if current source data is file path + * + * @return boolean + */ + public function isFilePath() + { + if (is_string($this->data)) { + try { + return is_file($this->data); + } catch (\Exception $e) { + return false; + } + } + + return false; + } + + /** + * Determines if current source data is url + * + * @return boolean + */ + public function isUrl() + { + return (bool) filter_var($this->data, FILTER_VALIDATE_URL); + } + + /** + * Determines if current source data is a stream resource + * + * @return boolean + */ + public function isStream() + { + if ($this->data instanceof StreamInterface) return true; + if (!is_resource($this->data)) return false; + if (get_resource_type($this->data) !== 'stream') return false; + + return true; + } + + /** + * Determines if current source data is binary data + * + * @return boolean + */ + public function isBinary() + { + if (is_string($this->data)) { + $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $this->data); + return (substr($mime, 0, 4) != 'text' && $mime != 'application/x-empty'); + } + + return false; + } + + /** + * Determines if current source data is data-url + * + * @return boolean + */ + public function isDataUrl() + { + $data = $this->decodeDataUrl($this->data); + + return is_null($data) ? false : true; + } + + /** + * Determines if current source data is base64 encoded + * + * @return boolean + */ + public function isBase64() + { + if (!is_string($this->data)) { + return false; + } + + return base64_encode(base64_decode($this->data)) === str_replace(["\n", "\r"], '', $this->data); + } + + /** + * Initiates new Image from Intervention\Image\Image + * + * @param Image $object + * @return \Intervention\Image\Image + */ + public function initFromInterventionImage($object) + { + return $object; + } + + /** + * Parses and decodes binary image data from data-url + * + * @param string $data_url + * @return string + */ + private function decodeDataUrl($data_url) + { + if (!is_string($data_url)) { + return null; + } + + $pattern = "/^data:(?:image\/[a-zA-Z\-\.]+)(?:charset=\".+\")?;base64,(?P.+)$/"; + preg_match($pattern, str_replace(["\n", "\r"], '', $data_url), $matches); + + if (is_array($matches) && array_key_exists('data', $matches)) { + return base64_decode($matches['data']); + } + + return null; + } + + /** + * Initiates new image from mixed data + * + * @param mixed $data + * @return \Intervention\Image\Image + */ + public function init($data) + { + $this->data = $data; + + switch (true) { + + case $this->isGdResource(): + return $this->initFromGdResource($this->data); + + case $this->isImagick(): + return $this->initFromImagick($this->data); + + case $this->isInterventionImage(): + return $this->initFromInterventionImage($this->data); + + case $this->isSplFileInfo(): + return $this->initFromPath($this->data->getRealPath()); + + case $this->isBinary(): + return $this->initFromBinary($this->data); + + case $this->isUrl(): + return $this->initFromUrl($this->data); + + case $this->isStream(): + return $this->initFromStream($this->data); + + case $this->isDataUrl(): + return $this->initFromBinary($this->decodeDataUrl($this->data)); + + case $this->isFilePath(): + return $this->initFromPath($this->data); + + // isBase64 has to be after isFilePath to prevent false positives + case $this->isBase64(): + return $this->initFromBinary(base64_decode($this->data)); + + default: + throw new NotReadableException("Image source not readable"); + } + } + + /** + * Decoder object transforms to string source data + * + * @return string + */ + public function __toString() + { + return (string) $this->data; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php b/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php new file mode 100644 index 00000000..6c591a79 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php @@ -0,0 +1,140 @@ +decoder->init($data); + } + + /** + * Encodes given image + * + * @param Image $image + * @param string $format + * @param int $quality + * @return \Intervention\Image\Image + */ + public function encode($image, $format, $quality) + { + return $this->encoder->process($image, $format, $quality); + } + + /** + * Executes named command on given image + * + * @param Image $image + * @param string $name + * @param array $arguments + * @return \Intervention\Image\Commands\AbstractCommand + */ + public function executeCommand($image, $name, $arguments) + { + $commandName = $this->getCommandClassName($name); + $command = new $commandName($arguments); + $command->execute($image); + + return $command; + } + + /** + * Returns classname of given command name + * + * @param string $name + * @return string + */ + private function getCommandClassName($name) + { + if (extension_loaded('mbstring')) { + $name = mb_strtoupper(mb_substr($name, 0, 1)) . mb_substr($name, 1); + } else { + $name = strtoupper(substr($name, 0, 1)) . substr($name, 1); + } + + $drivername = $this->getDriverName(); + $classnameLocal = sprintf('\Intervention\Image\%s\Commands\%sCommand', $drivername, ucfirst($name)); + $classnameGlobal = sprintf('\Intervention\Image\Commands\%sCommand', ucfirst($name)); + + if (class_exists($classnameLocal)) { + return $classnameLocal; + } elseif (class_exists($classnameGlobal)) { + return $classnameGlobal; + } + + throw new NotSupportedException( + "Command ({$name}) is not available for driver ({$drivername})." + ); + } + + /** + * Returns name of current driver instance + * + * @return string + */ + public function getDriverName() + { + $reflect = new \ReflectionClass($this); + $namespace = $reflect->getNamespaceName(); + + return substr(strrchr($namespace, "\\"), 1); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php b/vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php new file mode 100644 index 00000000..c25f8bff --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php @@ -0,0 +1,271 @@ +setImage($image); + $this->setFormat($format); + $this->setQuality($quality); + + switch (strtolower($this->format)) { + + case 'data-url': + $this->result = $this->processDataUrl(); + break; + + case 'gif': + case 'image/gif': + $this->result = $this->processGif(); + break; + + case 'png': + case 'image/png': + case 'image/x-png': + $this->result = $this->processPng(); + break; + + case 'jpg': + case 'jpeg': + case 'jfif': + case 'image/jp2': + case 'image/jpg': + case 'image/jpeg': + case 'image/pjpeg': + case 'image/jfif': + $this->result = $this->processJpeg(); + break; + + case 'tif': + case 'tiff': + case 'image/tiff': + case 'image/tif': + case 'image/x-tif': + case 'image/x-tiff': + $this->result = $this->processTiff(); + break; + + case 'bmp': + case 'ms-bmp': + case 'x-bitmap': + case 'x-bmp': + case 'x-ms-bmp': + case 'x-win-bitmap': + case 'x-windows-bmp': + case 'x-xbitmap': + case 'image/ms-bmp': + case 'image/x-bitmap': + case 'image/x-bmp': + case 'image/x-ms-bmp': + case 'image/x-win-bitmap': + case 'image/x-windows-bmp': + case 'image/x-xbitmap': + $this->result = $this->processBmp(); + break; + + case 'ico': + case 'image/x-ico': + case 'image/x-icon': + case 'image/vnd.microsoft.icon': + $this->result = $this->processIco(); + break; + + case 'psd': + case 'image/vnd.adobe.photoshop': + $this->result = $this->processPsd(); + break; + + case 'webp': + case 'image/webp': + case 'image/x-webp': + $this->result = $this->processWebp(); + break; + + case 'avif': + case 'image/avif': + $this->result = $this->processAvif(); + break; + + case 'heic': + case 'image/heic': + case 'image/heif': + $this->result = $this->processHeic(); + break; + + default: + throw new NotSupportedException( + "Encoding format ({$this->format}) is not supported." + ); + } + + $this->setImage(null); + + return $image->setEncoded($this->result); + } + + /** + * Processes and returns encoded image as data-url string + * + * @return string + */ + protected function processDataUrl() + { + $mime = $this->image->mime ? $this->image->mime : 'image/png'; + + return sprintf('data:%s;base64,%s', + $mime, + base64_encode($this->process($this->image, $mime, $this->quality)) + ); + } + + /** + * Sets image to process + * + * @param Image $image + */ + protected function setImage($image) + { + $this->image = $image; + } + + /** + * Determines output format + * + * @param string $format + */ + protected function setFormat($format = null) + { + if ($format == '' && $this->image instanceof Image) { + $format = $this->image->mime; + } + + $this->format = $format ? $format : 'jpg'; + + return $this; + } + + /** + * Determines output quality + * + * @param int $quality + */ + protected function setQuality($quality) + { + $quality = is_null($quality) ? 90 : $quality; + $quality = $quality === 0 ? 1 : $quality; + + if ($quality < 0 || $quality > 100) { + throw new InvalidArgumentException( + 'Quality must range from 0 to 100.' + ); + } + + $this->quality = intval($quality); + + return $this; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractFont.php b/vendor/intervention/image/src/Intervention/Image/AbstractFont.php new file mode 100644 index 00000000..35c1825a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractFont.php @@ -0,0 +1,295 @@ +text = $text; + } + + /** + * Set text to be written + * + * @param String $text + * @return self + */ + public function text($text) + { + $this->text = $text; + + return $this; + } + + /** + * Get text to be written + * + * @return String + */ + public function getText() + { + return $this->text; + } + + /** + * Set font size in pixels + * + * @param int $size + * @return self + */ + public function size($size) + { + $this->size = $size; + + return $this; + } + + /** + * Get font size in pixels + * + * @return int + */ + public function getSize() + { + return $this->size; + } + + /** + * Set color of text to be written + * + * @param mixed $color + * @return self + */ + public function color($color) + { + $this->color = $color; + + return $this; + } + + /** + * Get color of text + * + * @return mixed + */ + public function getColor() + { + return $this->color; + } + + /** + * Set rotation angle of text + * + * @param int $angle + * @return self + */ + public function angle($angle) + { + $this->angle = $angle; + + return $this; + } + + /** + * Get rotation angle of text + * + * @return int + */ + public function getAngle() + { + return $this->angle; + } + + /** + * Set horizontal text alignment + * + * @param string $align + * @return self + */ + public function align($align) + { + $this->align = $align; + + return $this; + } + + /** + * Get horizontal text alignment + * + * @return string + */ + public function getAlign() + { + return $this->align; + } + + /** + * Set vertical text alignment + * + * @param string $valign + * @return self + */ + public function valign($valign) + { + $this->valign = $valign; + + return $this; + } + + /** + * Get vertical text alignment + * + * @return string + */ + public function getValign() + { + return $this->valign; + } + + /** + * Set text kerning + * + * @param string $kerning + * @return void + */ + public function kerning($kerning) + { + $this->kerning = $kerning; + } + + /** + * Get kerning + * + * @return float + */ + public function getKerning() + { + return $this->kerning; + } + + /** + * Set path to font file + * + * @param string $file + * @return self + */ + public function file($file) + { + $this->file = $file; + + return $this; + } + + /** + * Get path to font file + * + * @return string + */ + public function getFile() + { + return $this->file; + } + + /** + * Checks if current font has access to an applicable font file + * + * @return boolean + */ + protected function hasApplicableFontFile() + { + if (is_string($this->file)) { + return file_exists($this->file); + } + + return false; + } + + /** + * Counts lines of text to be written + * + * @return int + */ + public function countLines() + { + return count(explode(PHP_EOL, $this->text)); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractShape.php b/vendor/intervention/image/src/Intervention/Image/AbstractShape.php new file mode 100644 index 00000000..cd4a9f1c --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractShape.php @@ -0,0 +1,71 @@ +background = $color; + } + + /** + * Set border width and color of current shape + * + * @param int $width + * @param string $color + * @return void + */ + public function border($width, $color = null) + { + $this->border_width = is_numeric($width) ? intval($width) : 0; + $this->border_color = is_null($color) ? '#000000' : $color; + } + + /** + * Determines if current shape has border + * + * @return boolean + */ + public function hasBorder() + { + return ($this->border_width >= 1); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php new file mode 100644 index 00000000..e31078ce --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php @@ -0,0 +1,81 @@ +arguments = $arguments; + } + + /** + * Creates new argument instance from given argument key + * + * @param int $key + * @return \Intervention\Image\Commands\Argument + */ + public function argument($key) + { + return new Argument($this, $key); + } + + /** + * Returns output data of current command + * + * @return mixed + */ + public function getOutput() + { + return $this->output ? $this->output : null; + } + + /** + * Determines if current instance has output data + * + * @return boolean + */ + public function hasOutput() + { + return ! is_null($this->output); + } + + /** + * Sets output data of current command + * + * @param mixed $value + */ + public function setOutput($value) + { + $this->output = $value; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/Argument.php b/vendor/intervention/image/src/Intervention/Image/Commands/Argument.php new file mode 100644 index 00000000..9538199f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/Argument.php @@ -0,0 +1,225 @@ +command = $command; + $this->key = $key; + } + + /** + * Returns name of current arguments command + * + * @return string + */ + public function getCommandName() + { + preg_match("/\\\\([\w]+)Command$/", get_class($this->command), $matches); + return isset($matches[1]) ? lcfirst($matches[1]).'()' : 'Method'; + } + + /** + * Returns value of current argument + * + * @param mixed $default + * @return mixed + */ + public function value($default = null) + { + $arguments = $this->command->arguments; + + if (is_array($arguments)) { + return isset($arguments[$this->key]) ? $arguments[$this->key] : $default; + } + + return $default; + } + + /** + * Defines current argument as required + * + * @return \Intervention\Image\Commands\Argument + */ + public function required() + { + if ( ! array_key_exists($this->key, $this->command->arguments)) { + throw new InvalidArgumentException( + sprintf("Missing argument %d for %s", $this->key + 1, $this->getCommandName()) + ); + } + + return $this; + } + + /** + * Determines that current argument must be of given type + * + * @return \Intervention\Image\Commands\Argument + */ + public function type($type) + { + $valid = true; + $value = $this->value(); + + if ($value === null) { + return $this; + } + + switch (strtolower($type)) { + case 'bool': + case 'boolean': + $valid = \is_bool($value); + $message = '%s accepts only boolean values as argument %d.'; + break; + case 'int': + case 'integer': + $valid = \is_int($value); + $message = '%s accepts only integer values as argument %d.'; + break; + case 'num': + case 'numeric': + $valid = is_numeric($value); + $message = '%s accepts only numeric values as argument %d.'; + break; + case 'str': + case 'string': + $valid = \is_string($value); + $message = '%s accepts only string values as argument %d.'; + break; + case 'array': + $valid = \is_array($value); + $message = '%s accepts only array as argument %d.'; + break; + case 'closure': + $valid = is_a($value, '\Closure'); + $message = '%s accepts only Closure as argument %d.'; + break; + case 'digit': + $valid = $this->isDigit($value); + $message = '%s accepts only integer values as argument %d.'; + break; + } + + if (! $valid) { + $commandName = $this->getCommandName(); + $argument = $this->key + 1; + + if (isset($message)) { + $message = sprintf($message, $commandName, $argument); + } else { + $message = sprintf('Missing argument for %d.', $argument); + } + + throw new InvalidArgumentException( + $message + ); + } + + return $this; + } + + /** + * Determines that current argument value must be numeric between given values + * + * @return \Intervention\Image\Commands\Argument + */ + public function between($x, $y) + { + $value = $this->type('numeric')->value(); + + if (is_null($value)) { + return $this; + } + + $alpha = min($x, $y); + $omega = max($x, $y); + + if ($value < $alpha || $value > $omega) { + throw new InvalidArgumentException( + sprintf('Argument %d must be between %s and %s.', $this->key, $x, $y) + ); + } + + return $this; + } + + /** + * Determines that current argument must be over a minimum value + * + * @return \Intervention\Image\Commands\Argument + */ + public function min($value) + { + $v = $this->type('numeric')->value(); + + if (is_null($v)) { + return $this; + } + + if ($v < $value) { + throw new InvalidArgumentException( + sprintf('Argument %d must be at least %s.', $this->key, $value) + ); + } + + return $this; + } + + /** + * Determines that current argument must be under a maxiumum value + * + * @return \Intervention\Image\Commands\Argument + */ + public function max($value) + { + $v = $this->type('numeric')->value(); + + if (is_null($v)) { + return $this; + } + + if ($v > $value) { + throw new InvalidArgumentException( + sprintf('Argument %d may not be greater than %s.', $this->key, $value) + ); + } + + return $this; + } + + /** + * Checks if value is "PHP" integer (120 but also 120.0) + * + * @param mixed $value + * @return boolean + */ + private function isDigit($value) + { + return is_numeric($value) ? intval($value) == $value : false; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/ChecksumCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/ChecksumCommand.php new file mode 100644 index 00000000..9acc4030 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/ChecksumCommand.php @@ -0,0 +1,29 @@ +getSize(); + + for ($x=0; $x <= ($size->width-1); $x++) { + for ($y=0; $y <= ($size->height-1); $y++) { + $colors[] = $image->pickColor($x, $y, 'array'); + } + } + + $this->setOutput(md5(serialize($colors))); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/CircleCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/CircleCommand.php new file mode 100644 index 00000000..c627818e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/CircleCommand.php @@ -0,0 +1,35 @@ +argument(0)->type('numeric')->required()->value(); + $x = $this->argument(1)->type('numeric')->required()->value(); + $y = $this->argument(2)->type('numeric')->required()->value(); + $callback = $this->argument(3)->type('closure')->value(); + + $circle_classname = sprintf('\Intervention\Image\%s\Shapes\CircleShape', + $image->getDriver()->getDriverName()); + + $circle = new $circle_classname($diameter); + + if ($callback instanceof Closure) { + $callback($circle); + } + + $circle->applyToImage($image, $x, $y); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php new file mode 100644 index 00000000..4637e020 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php @@ -0,0 +1,36 @@ +argument(0)->type('numeric')->required()->value(); + $height = $this->argument(1)->type('numeric')->required()->value(); + $x = $this->argument(2)->type('numeric')->required()->value(); + $y = $this->argument(3)->type('numeric')->required()->value(); + $callback = $this->argument(4)->type('closure')->value(); + + $ellipse_classname = sprintf('\Intervention\Image\%s\Shapes\EllipseShape', + $image->getDriver()->getDriverName()); + + $ellipse = new $ellipse_classname($width, $height); + + if ($callback instanceof Closure) { + $callback($ellipse); + } + + $ellipse->applyToImage($image, $x, $y); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php new file mode 100644 index 00000000..063df6ef --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php @@ -0,0 +1,61 @@ +argument(0)->value(); + + // try to read exif data from image file + try { + if ($image->dirname && $image->basename) { + $stream = $image->dirname . '/' . $image->basename; + } elseif (version_compare(PHP_VERSION, '7.2.0', '>=')) { + // https://www.php.net/manual/en/function.exif-read-data.php#refsect1-function.exif-read-data-changelog + $stream = $image->stream()->detach(); + } else { + // https://bugs.php.net/bug.php?id=65187 + $stream = $image->encode('data-url')->encoded; + } + + $data = @exif_read_data($stream); + + if (!is_null($key) && is_array($data)) { + $data = array_key_exists($key, $data) ? $data[$key] : false; + } + + } catch (\Exception $e) { + throw new NotReadableException( + sprintf( + "Cannot read the Exif data from the filename (%s) provided ", + $image->dirname . '/' . $image->basename + ), + $e->getCode(), + $e + ); + } + + $this->setOutput($data); + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/IptcCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/IptcCommand.php new file mode 100644 index 00000000..b78a2a8e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/IptcCommand.php @@ -0,0 +1,68 @@ +argument(0)->value(); + + $info = []; + @getimagesize($image->dirname .'/'. $image->basename, $info); + + $data = []; + + if (array_key_exists('APP13', $info)) { + $iptc = iptcparse($info['APP13']); + + if (is_array($iptc)) { + $data['DocumentTitle'] = isset($iptc["2#005"][0]) ? $iptc["2#005"][0] : null; + $data['Urgency'] = isset($iptc["2#010"][0]) ? $iptc["2#010"][0] : null; + $data['Category'] = isset($iptc["2#015"][0]) ? $iptc["2#015"][0] : null; + $data['Subcategories'] = isset($iptc["2#020"][0]) ? $iptc["2#020"][0] : null; + $data['Keywords'] = isset($iptc["2#025"][0]) ? $iptc["2#025"] : null; + $data['ReleaseDate'] = isset($iptc["2#030"][0]) ? $iptc["2#030"][0] : null; + $data['ReleaseTime'] = isset($iptc["2#035"][0]) ? $iptc["2#035"][0] : null; + $data['SpecialInstructions'] = isset($iptc["2#040"][0]) ? $iptc["2#040"][0] : null; + $data['CreationDate'] = isset($iptc["2#055"][0]) ? $iptc["2#055"][0] : null; + $data['CreationTime'] = isset($iptc["2#060"][0]) ? $iptc["2#060"][0] : null; + $data['AuthorByline'] = isset($iptc["2#080"][0]) ? $iptc["2#080"][0] : null; + $data['AuthorTitle'] = isset($iptc["2#085"][0]) ? $iptc["2#085"][0] : null; + $data['City'] = isset($iptc["2#090"][0]) ? $iptc["2#090"][0] : null; + $data['SubLocation'] = isset($iptc["2#092"][0]) ? $iptc["2#092"][0] : null; + $data['State'] = isset($iptc["2#095"][0]) ? $iptc["2#095"][0] : null; + $data['Country'] = isset($iptc["2#101"][0]) ? $iptc["2#101"][0] : null; + $data['OTR'] = isset($iptc["2#103"][0]) ? $iptc["2#103"][0] : null; + $data['Headline'] = isset($iptc["2#105"][0]) ? $iptc["2#105"][0] : null; + $data['Source'] = isset($iptc["2#110"][0]) ? $iptc["2#110"][0] : null; + $data['PhotoSource'] = isset($iptc["2#115"][0]) ? $iptc["2#115"][0] : null; + $data['Copyright'] = isset($iptc["2#116"][0]) ? $iptc["2#116"][0] : null; + $data['Caption'] = isset($iptc["2#120"][0]) ? $iptc["2#120"][0] : null; + $data['CaptionWriter'] = isset($iptc["2#122"][0]) ? $iptc["2#122"][0] : null; + } + } + + if (! is_null($key) && is_array($data)) { + $data = array_key_exists($key, $data) ? $data[$key] : false; + } + + $this->setOutput($data); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/LineCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/LineCommand.php new file mode 100644 index 00000000..a068c662 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/LineCommand.php @@ -0,0 +1,36 @@ +argument(0)->type('numeric')->required()->value(); + $y1 = $this->argument(1)->type('numeric')->required()->value(); + $x2 = $this->argument(2)->type('numeric')->required()->value(); + $y2 = $this->argument(3)->type('numeric')->required()->value(); + $callback = $this->argument(4)->type('closure')->value(); + + $line_classname = sprintf('\Intervention\Image\%s\Shapes\LineShape', + $image->getDriver()->getDriverName()); + + $line = new $line_classname($x2, $y2); + + if ($callback instanceof Closure) { + $callback($line); + } + + $line->applyToImage($image, $x1, $y1); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php new file mode 100644 index 00000000..552482cb --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php @@ -0,0 +1,48 @@ +exif('Orientation')) { + + case 2: + $image->flip(); + break; + + case 3: + $image->rotate(180); + break; + + case 4: + $image->rotate(180)->flip(); + break; + + case 5: + $image->rotate(270)->flip(); + break; + + case 6: + $image->rotate(270); + break; + + case 7: + $image->rotate(90)->flip(); + break; + + case 8: + $image->rotate(90); + break; + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/PolygonCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/PolygonCommand.php new file mode 100644 index 00000000..a2fa9978 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/PolygonCommand.php @@ -0,0 +1,49 @@ +argument(0)->type('array')->required()->value(); + $callback = $this->argument(1)->type('closure')->value(); + + $vertices_count = count($points); + + // check if number if coordinates is even + if ($vertices_count % 2 !== 0) { + throw new InvalidArgumentException( + "The number of given polygon vertices must be even." + ); + } + + if ($vertices_count < 6) { + throw new InvalidArgumentException( + "You must have at least 3 points in your array." + ); + } + + $polygon_classname = sprintf('\Intervention\Image\%s\Shapes\PolygonShape', + $image->getDriver()->getDriverName()); + + $polygon = new $polygon_classname($points); + + if ($callback instanceof Closure) { + $callback($polygon); + } + + $polygon->applyToImage($image); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/PsrResponseCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/PsrResponseCommand.php new file mode 100644 index 00000000..d75cd903 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/PsrResponseCommand.php @@ -0,0 +1,45 @@ +argument(0)->value(); + $quality = $this->argument(1)->between(0, 100)->value(); + + //Encoded property will be populated at this moment + $stream = $image->stream($format, $quality); + + $mimetype = finfo_buffer( + finfo_open(FILEINFO_MIME_TYPE), + $image->getEncoded() + ); + + $this->setOutput(new Response( + 200, + [ + 'Content-Type' => $mimetype, + 'Content-Length' => strlen($image->getEncoded()) + ], + $stream + )); + + return true; + } +} \ No newline at end of file diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php new file mode 100644 index 00000000..24378b38 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php @@ -0,0 +1,36 @@ +argument(0)->type('numeric')->required()->value(); + $y1 = $this->argument(1)->type('numeric')->required()->value(); + $x2 = $this->argument(2)->type('numeric')->required()->value(); + $y2 = $this->argument(3)->type('numeric')->required()->value(); + $callback = $this->argument(4)->type('closure')->value(); + + $rectangle_classname = sprintf('\Intervention\Image\%s\Shapes\RectangleShape', + $image->getDriver()->getDriverName()); + + $rectangle = new $rectangle_classname($x1, $y1, $x2, $y2); + + if ($callback instanceof Closure) { + $callback($rectangle); + } + + $rectangle->applyToImage($image, $x1, $y1); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php new file mode 100644 index 00000000..7903b5af --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php @@ -0,0 +1,26 @@ +argument(0)->value(); + $quality = $this->argument(1)->between(0, 100)->value(); + + $response = new Response($image, $format, $quality); + + $this->setOutput($response->make()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/StreamCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/StreamCommand.php new file mode 100644 index 00000000..bc2ff9ef --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/StreamCommand.php @@ -0,0 +1,39 @@ +argument(0)->value(); + $quality = $this->argument(1)->between(0, 100)->value(); + $data = $image->encode($format, $quality)->getEncoded(); + + $this->setOutput($this->getStream($data)); + + return true; + } + + /** + * Create stream from given data + * + * @param string $data + * @return \Psr\Http\Message\StreamInterface + */ + protected function getStream($data) + { + if (class_exists(\GuzzleHttp\Psr7\Utils::class)) { + return \GuzzleHttp\Psr7\Utils::streamFor($data); // guzzlehttp/psr7 >= 2.0 + } + + return \GuzzleHttp\Psr7\stream_for($data); // guzzlehttp/psr7 < 2.0 + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php new file mode 100644 index 00000000..3c60b4e7 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php @@ -0,0 +1,34 @@ +argument(0)->required()->value(); + $x = $this->argument(1)->type('numeric')->value(0); + $y = $this->argument(2)->type('numeric')->value(0); + $callback = $this->argument(3)->type('closure')->value(); + + $fontclassname = sprintf('\Intervention\Image\%s\Font', + $image->getDriver()->getDriverName()); + + $font = new $fontclassname($text); + + if ($callback instanceof Closure) { + $callback($font); + } + + $font->applyToImage($image, $x, $y); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Constraint.php b/vendor/intervention/image/src/Intervention/Image/Constraint.php new file mode 100644 index 00000000..44bdd67a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Constraint.php @@ -0,0 +1,92 @@ +size = $size; + } + + /** + * Returns current size of constraint + * + * @return \Intervention\Image\Size + */ + public function getSize() + { + return $this->size; + } + + /** + * Fix the given argument in current constraint + * + * @param int $type + * @return void + */ + public function fix($type) + { + $this->fixed = ($this->fixed & ~(1 << $type)) | (1 << $type); + } + + /** + * Checks if given argument is fixed in current constraint + * + * @param int $type + * @return boolean + */ + public function isFixed($type) + { + return (bool) ($this->fixed & (1 << $type)); + } + + /** + * Fixes aspect ratio in current constraint + * + * @return void + */ + public function aspectRatio() + { + $this->fix(self::ASPECTRATIO); + } + + /** + * Fixes possibility to size up in current constraint + * + * @return void + */ + public function upsize() + { + $this->fix(self::UPSIZE); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Exception/ImageException.php b/vendor/intervention/image/src/Intervention/Image/Exception/ImageException.php new file mode 100644 index 00000000..83e6b91f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Exception/ImageException.php @@ -0,0 +1,8 @@ +dirname = array_key_exists('dirname', $info) ? $info['dirname'] : null; + $this->basename = array_key_exists('basename', $info) ? $info['basename'] : null; + $this->extension = array_key_exists('extension', $info) ? $info['extension'] : null; + $this->filename = array_key_exists('filename', $info) ? $info['filename'] : null; + + if (file_exists($path) && is_file($path)) { + $this->mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path); + } + + return $this; + } + + /** + * Get file size + * + * @return mixed + */ + public function filesize() + { + $path = $this->basePath(); + + if (file_exists($path) && is_file($path)) { + return filesize($path); + } + + return false; + } + + /** + * Get fully qualified path + * + * @return string + */ + public function basePath() + { + if ($this->dirname && $this->basename) { + return ($this->dirname .'/'. $this->basename); + } + + return null; + } + +} diff --git a/vendor/intervention/image/src/Intervention/Image/Filters/DemoFilter.php b/vendor/intervention/image/src/Intervention/Image/Filters/DemoFilter.php new file mode 100644 index 00000000..4e8f92b8 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Filters/DemoFilter.php @@ -0,0 +1,44 @@ +size = is_numeric($size) ? intval($size) : self::DEFAULT_SIZE; + } + + /** + * Applies filter effects to given image + * + * @param \Intervention\Image\Image $image + * @return \Intervention\Image\Image + */ + public function applyFilter(Image $image) + { + $image->pixelate($this->size); + $image->greyscale(); + + return $image; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Filters/FilterInterface.php b/vendor/intervention/image/src/Intervention/Image/Filters/FilterInterface.php new file mode 100644 index 00000000..88f6cbfe --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Filters/FilterInterface.php @@ -0,0 +1,16 @@ +a = ($value >> 24) & 0xFF; + $this->r = ($value >> 16) & 0xFF; + $this->g = ($value >> 8) & 0xFF; + $this->b = $value & 0xFF; + } + + /** + * Initiates color object from given array + * + * @param array $value + * @return \Intervention\Image\AbstractColor + */ + public function initFromArray($array) + { + $array = array_values($array); + + if (count($array) == 4) { + + // color array with alpha value + list($r, $g, $b, $a) = $array; + $this->a = $this->alpha2gd($a); + + } elseif (count($array) == 3) { + + // color array without alpha value + list($r, $g, $b) = $array; + $this->a = 0; + + } + + $this->r = $r; + $this->g = $g; + $this->b = $b; + } + + /** + * Initiates color object from given string + * + * @param string $value + * @return \Intervention\Image\AbstractColor + */ + public function initFromString($value) + { + if ($color = $this->rgbaFromString($value)) { + $this->r = $color[0]; + $this->g = $color[1]; + $this->b = $color[2]; + $this->a = $this->alpha2gd($color[3]); + } + } + + /** + * Initiates color object from given R, G and B values + * + * @param int $r + * @param int $g + * @param int $b + * @return \Intervention\Image\AbstractColor + */ + public function initFromRgb($r, $g, $b) + { + $this->r = intval($r); + $this->g = intval($g); + $this->b = intval($b); + $this->a = 0; + } + + /** + * Initiates color object from given R, G, B and A values + * + * @param int $r + * @param int $g + * @param int $b + * @param float $a + * @return \Intervention\Image\AbstractColor + */ + public function initFromRgba($r, $g, $b, $a = 1) + { + $this->r = intval($r); + $this->g = intval($g); + $this->b = intval($b); + $this->a = $this->alpha2gd($a); + } + + /** + * Initiates color object from given ImagickPixel object + * + * @param ImagickPixel $value + * @return \Intervention\Image\AbstractColor + */ + public function initFromObject($value) + { + throw new NotSupportedException( + "GD colors cannot init from ImagickPixel objects." + ); + } + + /** + * Calculates integer value of current color instance + * + * @return int + */ + public function getInt() + { + return ($this->a << 24) + ($this->r << 16) + ($this->g << 8) + $this->b; + } + + /** + * Calculates hexadecimal value of current color instance + * + * @param string $prefix + * @return string + */ + public function getHex($prefix = '') + { + return sprintf('%s%02x%02x%02x', $prefix, $this->r, $this->g, $this->b); + } + + /** + * Calculates RGB(A) in array format of current color instance + * + * @return array + */ + public function getArray() + { + return [$this->r, $this->g, $this->b, round(1 - $this->a / 127, 2)]; + } + + /** + * Calculates RGBA in string format of current color instance + * + * @return string + */ + public function getRgba() + { + return sprintf('rgba(%d, %d, %d, %.2F)', $this->r, $this->g, $this->b, round(1 - $this->a / 127, 2)); + } + + /** + * Determines if current color is different from given color + * + * @param AbstractColor $color + * @param int $tolerance + * @return boolean + */ + public function differs(AbstractColor $color, $tolerance = 0) + { + $color_tolerance = round($tolerance * 2.55); + $alpha_tolerance = round($tolerance * 1.27); + + $delta = [ + 'r' => abs($color->r - $this->r), + 'g' => abs($color->g - $this->g), + 'b' => abs($color->b - $this->b), + 'a' => abs($color->a - $this->a) + ]; + + return ( + $delta['r'] > $color_tolerance or + $delta['g'] > $color_tolerance or + $delta['b'] > $color_tolerance or + $delta['a'] > $alpha_tolerance + ); + } + + /** + * Convert rgba alpha (0-1) value to gd value (0-127) + * + * @param float $input + * @return int + */ + private function alpha2gd($input) + { + $oldMin = 0; + $oldMax = 1; + + $newMin = 127; + $newMax = 0; + + return ceil(((($input- $oldMin) * ($newMax - $newMin)) / ($oldMax - $oldMin)) + $newMin); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php new file mode 100644 index 00000000..310dc03a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php @@ -0,0 +1,25 @@ +argument(0)->value(); + + // clone current image resource + $clone = clone $image; + $image->setBackup($clone->getCore(), $backupName); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php new file mode 100644 index 00000000..c4fca0ea --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php @@ -0,0 +1,25 @@ +argument(0)->between(0, 100)->value(1); + + for ($i=0; $i < intval($amount); $i++) { + imagefilter($image->getCore(), IMG_FILTER_GAUSSIAN_BLUR); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php new file mode 100644 index 00000000..4e48464b --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(-100, 100)->required()->value(); + + return imagefilter($image->getCore(), IMG_FILTER_BRIGHTNESS, ($level * 2.55)); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php new file mode 100644 index 00000000..410917b3 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php @@ -0,0 +1,29 @@ +argument(0)->between(-100, 100)->required()->value(); + $green = $this->argument(1)->between(-100, 100)->required()->value(); + $blue = $this->argument(2)->between(-100, 100)->required()->value(); + + // normalize colorize levels + $red = round($red * 2.55); + $green = round($green * 2.55); + $blue = round($blue * 2.55); + + // apply filter + return imagefilter($image->getCore(), IMG_FILTER_COLORIZE, $red, $green, $blue); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php new file mode 100644 index 00000000..916c41f8 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(-100, 100)->required()->value(); + + return imagefilter($image->getCore(), IMG_FILTER_CONTRAST, ($level * -1)); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/CropCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/CropCommand.php new file mode 100644 index 00000000..b7f59542 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/CropCommand.php @@ -0,0 +1,40 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $x = $this->argument(2)->type('digit')->value(); + $y = $this->argument(3)->type('digit')->value(); + + if (is_null($width) || is_null($height)) { + throw new \Intervention\Image\Exception\InvalidArgumentException( + "Width and height of cutout needs to be defined." + ); + } + + $cropped = new Size($width, $height); + $position = new Point($x, $y); + + // align boxes + if (is_null($x) && is_null($y)) { + $position = $image->getSize()->align('center')->relativePosition($cropped->align('center')); + } + + // crop image core + return $this->modify($image, 0, 0, $position->x, $position->y, $cropped->width, $cropped->height, $cropped->width, $cropped->height); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php new file mode 100644 index 00000000..4503d10f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php @@ -0,0 +1,27 @@ +getCore()); + + // destroy backups + foreach ($image->getBackups() as $backup) { + imagedestroy($backup); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FillCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FillCommand.php new file mode 100644 index 00000000..cf190821 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FillCommand.php @@ -0,0 +1,69 @@ +argument(0)->value(); + $x = $this->argument(1)->type('digit')->value(); + $y = $this->argument(2)->type('digit')->value(); + + $width = $image->getWidth(); + $height = $image->getHeight(); + $resource = $image->getCore(); + + try { + + // set image tile filling + $source = new Decoder; + $tile = $source->init($filling); + imagesettile($image->getCore(), $tile->getCore()); + $filling = IMG_COLOR_TILED; + + } catch (\Intervention\Image\Exception\NotReadableException $e) { + + // set solid color filling + $color = new Color($filling); + $filling = $color->getInt(); + } + + imagealphablending($resource, true); + + if (is_int($x) && is_int($y)) { + + // resource should be visible through transparency + $base = $image->getDriver()->newImage($width, $height)->getCore(); + imagecopy($base, $resource, 0, 0, 0, 0, $width, $height); + + // floodfill if exact position is defined + imagefill($resource, $x, $y, $filling); + + // copy filled original over base + imagecopy($base, $resource, 0, 0, 0, 0, $width, $height); + + // set base as new resource-core + $image->setCore($base); + imagedestroy($resource); + + } else { + // fill whole image otherwise + imagefilledrectangle($resource, 0, 0, $width - 1, $height - 1, $filling); + } + + isset($tile) ? imagedestroy($tile->getCore()) : null; + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php new file mode 100644 index 00000000..d861ad94 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php @@ -0,0 +1,32 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->value($width); + $constraints = $this->argument(2)->type('closure')->value(); + $position = $this->argument(3)->type('string')->value('center'); + + // calculate size + $cropped = $image->getSize()->fit(new Size($width, $height), $position); + $resized = clone $cropped; + $resized = $resized->resize($width, $height, $constraints); + + // modify image + $this->modify($image, 0, 0, $cropped->pivot->x, $cropped->pivot->y, $resized->getWidth(), $resized->getHeight(), $cropped->getWidth(), $cropped->getHeight()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php new file mode 100644 index 00000000..aa8f230e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php @@ -0,0 +1,37 @@ +argument(0)->value('h'); + + $size = $image->getSize(); + $dst = clone $size; + + switch (strtolower($mode)) { + case 2: + case 'v': + case 'vert': + case 'vertical': + $size->pivot->y = $size->height - 1; + $size->height = $size->height * (-1); + break; + + default: + $size->pivot->x = $size->width - 1; + $size->width = $size->width * (-1); + break; + } + + return $this->modify($image, 0, 0, $size->pivot->x, $size->pivot->y, $dst->width, $dst->height, $size->width, $size->height); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php new file mode 100644 index 00000000..7de0fb8a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php @@ -0,0 +1,21 @@ +argument(0)->type('numeric')->required()->value(); + + return imagegammacorrect($image->getCore(), 1, $gamma); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php new file mode 100644 index 00000000..9eb7e209 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php @@ -0,0 +1,25 @@ +setOutput(new Size( + imagesx($image->getCore()), + imagesy($image->getCore()) + )); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php new file mode 100644 index 00000000..12921e79 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php @@ -0,0 +1,19 @@ +getCore(), IMG_FILTER_GRAYSCALE); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php new file mode 100644 index 00000000..d31e9cde --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php @@ -0,0 +1,28 @@ +argument(0)->type('digit')->required()->value(); + $additionalConstraints = $this->argument(1)->type('closure')->value(); + + $this->arguments[0] = null; + $this->arguments[1] = $height; + $this->arguments[2] = function ($constraint) use ($additionalConstraints) { + $constraint->aspectRatio(); + if(is_callable($additionalConstraints)) + $additionalConstraints($constraint); + }; + + return parent::execute($image); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php new file mode 100644 index 00000000..47c77039 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php @@ -0,0 +1,34 @@ +argument(0)->required()->value(); + $position = $this->argument(1)->type('string')->value(); + $x = $this->argument(2)->type('digit')->value(0); + $y = $this->argument(3)->type('digit')->value(0); + + // build watermark + $watermark = $image->getDriver()->init($source); + + // define insertion point + $image_size = $image->getSize()->align($position, $x, $y); + $watermark_size = $watermark->getSize()->align($position); + $target = $image_size->relativePosition($watermark_size); + + // insert image at position + imagealphablending($image->getCore(), true); + return imagecopy($image->getCore(), $watermark->getCore(), $target->x, $target->y, 0, 0, $watermark_size->width, $watermark_size->height); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php new file mode 100644 index 00000000..e3461cb0 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php @@ -0,0 +1,23 @@ +argument(0)->type('bool')->value(true); + + imageinterlace($image->getCore(), $mode); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php new file mode 100644 index 00000000..1a514f1d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php @@ -0,0 +1,19 @@ +getCore(), IMG_FILTER_NEGATE); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php new file mode 100644 index 00000000..0baed7e9 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php @@ -0,0 +1,53 @@ +argument(0)->value(); + $matte = $this->argument(1)->value(); + + // get current image size + $size = $image->getSize(); + + // create empty canvas + $resource = imagecreatetruecolor($size->width, $size->height); + + // define matte + if (is_null($matte)) { + $matte = imagecolorallocatealpha($resource, 255, 255, 255, 127); + } else { + $matte = $image->getDriver()->parseColor($matte)->getInt(); + } + + // fill with matte and copy original image + imagefill($resource, 0, 0, $matte); + + // set transparency + imagecolortransparent($resource, $matte); + + // copy original image + imagecopy($resource, $image->getCore(), 0, 0, 0, 0, $size->width, $size->height); + + if (is_numeric($count) && $count <= 256) { + // decrease colors + imagetruecolortopalette($resource, true, $count); + } + + // set new resource + $image->setCore($resource); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/MaskCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/MaskCommand.php new file mode 100644 index 00000000..4c61429b --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/MaskCommand.php @@ -0,0 +1,83 @@ +argument(0)->value(); + $mask_w_alpha = $this->argument(1)->type('bool')->value(false); + + $image_size = $image->getSize(); + + // create empty canvas + $canvas = $image->getDriver()->newImage($image_size->width, $image_size->height, [0,0,0,0]); + + // build mask image from source + $mask = $image->getDriver()->init($mask_source); + $mask_size = $mask->getSize(); + + // resize mask to size of current image (if necessary) + if ($mask_size != $image_size) { + $mask->resize($image_size->width, $image_size->height); + } + + imagealphablending($canvas->getCore(), false); + + if ( ! $mask_w_alpha) { + // mask from greyscale image + imagefilter($mask->getCore(), IMG_FILTER_GRAYSCALE); + } + + // redraw old image pixel by pixel considering alpha map + for ($x=0; $x < $image_size->width; $x++) { + for ($y=0; $y < $image_size->height; $y++) { + + $color = $image->pickColor($x, $y, 'array'); + $alpha = $mask->pickColor($x, $y, 'array'); + + if ($mask_w_alpha) { + $alpha = $alpha[3]; // use alpha channel as mask + } else { + + if ($alpha[3] == 0) { // transparent as black + $alpha = 0; + } else { + + // $alpha = floatval(round((($alpha[0] + $alpha[1] + $alpha[3]) / 3) / 255, 2)); + + // image is greyscale, so channel doesn't matter (use red channel) + $alpha = floatval(round($alpha[0] / 255, 2)); + } + + } + + // preserve alpha of original image... + if ($color[3] < $alpha) { + $alpha = $color[3]; + } + + // replace alpha value + $color[3] = $alpha; + + // redraw pixel + $canvas->pixel($color, $x, $y); + } + } + + + // replace current image with masked instance + $image->setCore($canvas->getCore()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php new file mode 100644 index 00000000..48492d24 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php @@ -0,0 +1,31 @@ +argument(0)->between(0, 100)->required()->value(); + + // get size of image + $size = $image->getSize(); + + // build temp alpha mask + $mask_color = sprintf('rgba(0, 0, 0, %.1F)', $transparency / 100); + $mask = $image->getDriver()->newImage($size->width, $size->height, $mask_color); + + // mask image + $image->mask($mask->getCore(), true); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php new file mode 100644 index 00000000..bad96f49 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php @@ -0,0 +1,37 @@ +argument(0)->type('digit')->required()->value(); + $y = $this->argument(1)->type('digit')->required()->value(); + $format = $this->argument(2)->type('string')->value('array'); + + // pick color + $color = imagecolorat($image->getCore(), $x, $y); + + if ( ! imageistruecolor($image->getCore())) { + $color = imagecolorsforindex($image->getCore(), $color); + $color['alpha'] = round(1 - $color['alpha'] / 127, 2); + } + + $color = new Color($color); + + // format to output + $this->setOutput($color->format($format)); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php new file mode 100644 index 00000000..2a90ce34 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php @@ -0,0 +1,25 @@ +argument(0)->required()->value(); + $color = new Color($color); + $x = $this->argument(1)->type('digit')->required()->value(); + $y = $this->argument(2)->type('digit')->required()->value(); + + return imagesetpixel($image->getCore(), $x, $y, $color->getInt()); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php new file mode 100644 index 00000000..0934797a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php @@ -0,0 +1,21 @@ +argument(0)->type('digit')->value(10); + + return imagefilter($image->getCore(), IMG_FILTER_PIXELATE, $size, true); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php new file mode 100644 index 00000000..a68b75ea --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php @@ -0,0 +1,39 @@ +argument(0)->value(); + $backup = $image->getBackup($backupName); + + if (is_resource($backup) || $backup instanceof \GdImage) { + + // destroy current resource + imagedestroy($image->getCore()); + + // clone backup + $backup = $image->getDriver()->cloneCore($backup); + + // reset to new resource + $image->setCore($backup); + + return true; + } + + throw new RuntimeException( + "Backup not available. Call backup() before reset()." + ); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php new file mode 100644 index 00000000..73f3df30 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php @@ -0,0 +1,83 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $anchor = $this->argument(2)->value('center'); + $relative = $this->argument(3)->type('boolean')->value(false); + $bgcolor = $this->argument(4)->value(); + + $original_width = $image->getWidth(); + $original_height = $image->getHeight(); + + // check of only width or height is set + $width = is_null($width) ? $original_width : intval($width); + $height = is_null($height) ? $original_height : intval($height); + + // check on relative width/height + if ($relative) { + $width = $original_width + $width; + $height = $original_height + $height; + } + + // check for negative width/height + $width = ($width <= 0) ? $width + $original_width : $width; + $height = ($height <= 0) ? $height + $original_height : $height; + + // create new canvas + $canvas = $image->getDriver()->newImage($width, $height, $bgcolor); + + // set copy position + $canvas_size = $canvas->getSize()->align($anchor); + $image_size = $image->getSize()->align($anchor); + $canvas_pos = $image_size->relativePosition($canvas_size); + $image_pos = $canvas_size->relativePosition($image_size); + + if ($width <= $original_width) { + $dst_x = 0; + $src_x = $canvas_pos->x; + $src_w = $canvas_size->width; + } else { + $dst_x = $image_pos->x; + $src_x = 0; + $src_w = $original_width; + } + + if ($height <= $original_height) { + $dst_y = 0; + $src_y = $canvas_pos->y; + $src_h = $canvas_size->height; + } else { + $dst_y = $image_pos->y; + $src_y = 0; + $src_h = $original_height; + } + + // make image area transparent to keep transparency + // even if background-color is set + $transparent = imagecolorallocatealpha($canvas->getCore(), 255, 255, 255, 127); + imagealphablending($canvas->getCore(), false); // do not blend / just overwrite + imagefilledrectangle($canvas->getCore(), $dst_x, $dst_y, $dst_x + $src_w - 1, $dst_y + $src_h - 1, $transparent); + + // copy image into new canvas + imagecopy($canvas->getCore(), $image->getCore(), $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h); + + // set new core to canvas + $image->setCore($canvas->getCore()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCommand.php new file mode 100644 index 00000000..382d9709 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCommand.php @@ -0,0 +1,84 @@ +argument(0)->value(); + $height = $this->argument(1)->value(); + $constraints = $this->argument(2)->type('closure')->value(); + + // resize box + $resized = $image->getSize()->resize($width, $height, $constraints); + + // modify image + $this->modify($image, 0, 0, 0, 0, $resized->getWidth(), $resized->getHeight(), $image->getWidth(), $image->getHeight()); + + return true; + } + + /** + * Wrapper function for 'imagecopyresampled' + * + * @param Image $image + * @param int $dst_x + * @param int $dst_y + * @param int $src_x + * @param int $src_y + * @param int $dst_w + * @param int $dst_h + * @param int $src_w + * @param int $src_h + * @return boolean + */ + protected function modify($image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) + { + // create new image + $modified = imagecreatetruecolor($dst_w, $dst_h); + + // get current image + $resource = $image->getCore(); + + // preserve transparency + $transIndex = imagecolortransparent($resource); + + if ($transIndex != -1) { + $rgba = imagecolorsforindex($modified, $transIndex); + $transColor = imagecolorallocatealpha($modified, $rgba['red'], $rgba['green'], $rgba['blue'], 127); + imagefill($modified, 0, 0, $transColor); + imagecolortransparent($modified, $transColor); + } else { + imagealphablending($modified, false); + imagesavealpha($modified, true); + } + + // copy content from resource + $result = imagecopyresampled( + $modified, + $resource, + $dst_x, + $dst_y, + $src_x, + $src_y, + $dst_w, + $dst_h, + $src_w, + $src_h + ); + + // set new content as recource + $image->setCore($modified); + + return $result; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php new file mode 100644 index 00000000..682ec0d4 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php @@ -0,0 +1,30 @@ +argument(0)->type('numeric')->required()->value(); + $color = $this->argument(1)->value(); + $color = new Color($color); + + // restrict rotations beyond 360 degrees, since the end result is the same + $angle = fmod($angle, 360); + + // rotate image + $image->setCore(imagerotate($image->getCore(), $angle, $color->getInt())); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php new file mode 100644 index 00000000..782e5650 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php @@ -0,0 +1,34 @@ +argument(0)->between(0, 100)->value(10); + + // build matrix + $min = $amount >= 10 ? $amount * -0.01 : 0; + $max = $amount * -0.025; + $abs = ((4 * $min + 4 * $max) * -1) + 1; + $div = 1; + + $matrix = [ + [$min, $max, $min], + [$max, $abs, $max], + [$min, $max, $min] + ]; + + // apply the matrix + return imageconvolution($image->getCore(), $matrix, $div, 0); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/TrimCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/TrimCommand.php new file mode 100644 index 00000000..2e369752 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/TrimCommand.php @@ -0,0 +1,176 @@ +argument(0)->type('string')->value(); + $away = $this->argument(1)->value(); + $tolerance = $this->argument(2)->type('numeric')->value(0); + $feather = $this->argument(3)->type('numeric')->value(0); + + $width = $image->getWidth(); + $height = $image->getHeight(); + + // default values + $checkTransparency = false; + + // define borders to trim away + if (is_null($away)) { + $away = ['top', 'right', 'bottom', 'left']; + } elseif (is_string($away)) { + $away = [$away]; + } + + // lower border names + foreach ($away as $key => $value) { + $away[$key] = strtolower($value); + } + + // define base color position + switch (strtolower($base)) { + case 'transparent': + case 'trans': + $checkTransparency = true; + $base_x = 0; + $base_y = 0; + break; + + case 'bottom-right': + case 'right-bottom': + $base_x = $width - 1; + $base_y = $height - 1; + break; + + default: + case 'top-left': + case 'left-top': + $base_x = 0; + $base_y = 0; + break; + } + + // pick base color + if ($checkTransparency) { + $color = new Color; // color will only be used to compare alpha channel + } else { + $color = $image->pickColor($base_x, $base_y, 'object'); + } + + $top_x = 0; + $top_y = 0; + $bottom_x = $width; + $bottom_y = $height; + + // search upper part of image for colors to trim away + if (in_array('top', $away)) { + + for ($y=0; $y < ceil($height/2); $y++) { + for ($x=0; $x < $width; $x++) { + + $checkColor = $image->pickColor($x, $y, 'object'); + + if ($checkTransparency) { + $checkColor->r = $color->r; + $checkColor->g = $color->g; + $checkColor->b = $color->b; + } + + if ($color->differs($checkColor, $tolerance)) { + $top_y = max(0, $y - $feather); + break 2; + } + + } + } + + } + + // search left part of image for colors to trim away + if (in_array('left', $away)) { + + for ($x=0; $x < ceil($width/2); $x++) { + for ($y=$top_y; $y < $height; $y++) { + + $checkColor = $image->pickColor($x, $y, 'object'); + + if ($checkTransparency) { + $checkColor->r = $color->r; + $checkColor->g = $color->g; + $checkColor->b = $color->b; + } + + if ($color->differs($checkColor, $tolerance)) { + $top_x = max(0, $x - $feather); + break 2; + } + + } + } + + } + + // search lower part of image for colors to trim away + if (in_array('bottom', $away)) { + + for ($y=($height-1); $y >= floor($height/2)-1; $y--) { + for ($x=$top_x; $x < $width; $x++) { + + $checkColor = $image->pickColor($x, $y, 'object'); + + if ($checkTransparency) { + $checkColor->r = $color->r; + $checkColor->g = $color->g; + $checkColor->b = $color->b; + } + + if ($color->differs($checkColor, $tolerance)) { + $bottom_y = min($height, $y+1 + $feather); + break 2; + } + + } + } + + } + + // search right part of image for colors to trim away + if (in_array('right', $away)) { + + for ($x=($width-1); $x >= floor($width/2)-1; $x--) { + for ($y=$top_y; $y < $bottom_y; $y++) { + + $checkColor = $image->pickColor($x, $y, 'object'); + + if ($checkTransparency) { + $checkColor->r = $color->r; + $checkColor->g = $color->g; + $checkColor->b = $color->b; + } + + if ($color->differs($checkColor, $tolerance)) { + $bottom_x = min($width, $x+1 + $feather); + break 2; + } + + } + } + + } + + + // trim parts of image + return $this->modify($image, 0, 0, $top_x, $top_y, ($bottom_x-$top_x), ($bottom_y-$top_y), ($bottom_x-$top_x), ($bottom_y-$top_y)); + + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php new file mode 100644 index 00000000..43000d5d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php @@ -0,0 +1,28 @@ +argument(0)->type('digit')->required()->value(); + $additionalConstraints = $this->argument(1)->type('closure')->value(); + + $this->arguments[0] = $width; + $this->arguments[1] = null; + $this->arguments[2] = function ($constraint) use ($additionalConstraints) { + $constraint->aspectRatio(); + if(is_callable($additionalConstraints)) + $additionalConstraints($constraint); + }; + + return parent::execute($image); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php b/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php new file mode 100644 index 00000000..f5c34aa5 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php @@ -0,0 +1,171 @@ +gdResourceToTruecolor($core); + + // build image + $image = $this->initFromGdResource($core); + $image->mime = $mime; + $image->setFileInfoFromPath($path); + + return $image; + } + + /** + * Initiates new image from GD resource + * + * @param Resource $resource + * @return \Intervention\Image\Image + */ + public function initFromGdResource($resource) + { + return new Image(new Driver, $resource); + } + + /** + * Initiates new image from Imagick object + * + * @param Imagick $object + * @return \Intervention\Image\Image + */ + public function initFromImagick(\Imagick $object) + { + throw new NotSupportedException( + "Gd driver is unable to init from Imagick object." + ); + } + + /** + * Initiates new image from binary data + * + * @param string $data + * @return \Intervention\Image\Image + */ + public function initFromBinary($binary) + { + $resource = @imagecreatefromstring($binary); + + if ($resource === false) { + throw new NotReadableException( + "Unable to init from given binary data." + ); + } + + $image = $this->initFromGdResource($resource); + $image->mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $binary); + + return $image; + } + + /** + * Transform GD resource into Truecolor version + * + * @param resource $resource + * @return bool + */ + public function gdResourceToTruecolor(&$resource) + { + $width = imagesx($resource); + $height = imagesy($resource); + + // new canvas + $canvas = imagecreatetruecolor($width, $height); + + // fill with transparent color + imagealphablending($canvas, false); + $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127); + imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent); + imagecolortransparent($canvas, $transparent); + imagealphablending($canvas, true); + + // copy original + imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height); + imagedestroy($resource); + + $resource = $canvas; + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Driver.php b/vendor/intervention/image/src/Intervention/Image/Gd/Driver.php new file mode 100644 index 00000000..5f2f23ea --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Driver.php @@ -0,0 +1,89 @@ +coreAvailable()) { + throw new NotSupportedException( + "GD Library extension not available with this PHP installation." + ); + } + + $this->decoder = $decoder ? $decoder : new Decoder; + $this->encoder = $encoder ? $encoder : new Encoder; + } + + /** + * Creates new image instance + * + * @param int $width + * @param int $height + * @param mixed $background + * @return \Intervention\Image\Image + */ + public function newImage($width, $height, $background = null) + { + // create empty resource + $core = imagecreatetruecolor($width, $height); + $image = new Image(new static, $core); + + // set background color + $background = new Color($background); + imagefill($image->getCore(), 0, 0, $background->getInt()); + + return $image; + } + + /** + * Reads given string into color object + * + * @param string $value + * @return AbstractColor + */ + public function parseColor($value) + { + return new Color($value); + } + + /** + * Checks if core module installation is available + * + * @return boolean + */ + protected function coreAvailable() + { + return (extension_loaded('gd') && function_exists('gd_info')); + } + + /** + * Returns clone of given core + * + * @return mixed + */ + public function cloneCore($core) + { + $width = imagesx($core); + $height = imagesy($core); + $clone = imagecreatetruecolor($width, $height); + imagealphablending($clone, false); + imagesavealpha($clone, true); + $transparency = imagecolorallocatealpha($clone, 0, 0, 0, 127); + imagefill($clone, 0, 0, $transparency); + + imagecopy($clone, $core, 0, 0, 0, 0, $width, $height); + + return $clone; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Encoder.php b/vendor/intervention/image/src/Intervention/Image/Gd/Encoder.php new file mode 100644 index 00000000..559d60dc --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Encoder.php @@ -0,0 +1,180 @@ +image->getCore(), null, $this->quality); + $this->image->mime = image_type_to_mime_type(IMAGETYPE_JPEG); + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + /** + * Processes and returns encoded image as PNG string + * + * @return string + */ + protected function processPng() + { + ob_start(); + $resource = $this->image->getCore(); + imagealphablending($resource, false); + imagesavealpha($resource, true); + imagepng($resource, null, -1); + $this->image->mime = image_type_to_mime_type(IMAGETYPE_PNG); + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + /** + * Processes and returns encoded image as GIF string + * + * @return string + */ + protected function processGif() + { + ob_start(); + imagegif($this->image->getCore()); + $this->image->mime = image_type_to_mime_type(IMAGETYPE_GIF); + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + /** + * Processes and returns encoded image as WEBP string + * + * @return string + */ + protected function processWebp() + { + if ( ! function_exists('imagewebp')) { + throw new NotSupportedException( + "Webp format is not supported by PHP installation." + ); + } + + ob_start(); + imagepalettetotruecolor($this->image->getCore()); + imagealphablending($this->image->getCore(), true); + imagesavealpha($this->image->getCore(), true); + imagewebp($this->image->getCore(), null, $this->quality); + $this->image->mime = defined('IMAGETYPE_WEBP') ? image_type_to_mime_type(IMAGETYPE_WEBP) : 'image/webp'; + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + /** + * Processes and returns encoded image as TIFF string + * + * @return string + */ + protected function processTiff() + { + throw new NotSupportedException( + "TIFF format is not supported by Gd Driver." + ); + } + + /** + * Processes and returns encoded image as BMP string + * + * @return string + */ + protected function processBmp() + { + if ( ! function_exists('imagebmp')) { + throw new NotSupportedException( + "BMP format is not supported by PHP installation." + ); + } + + ob_start(); + imagebmp($this->image->getCore()); + $this->image->mime = defined('IMAGETYPE_BMP') ? image_type_to_mime_type(IMAGETYPE_BMP) : 'image/bmp'; + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + /** + * Processes and returns encoded image as ICO string + * + * @return string + */ + protected function processIco() + { + throw new NotSupportedException( + "ICO format is not supported by Gd Driver." + ); + } + + /** + * Processes and returns encoded image as PSD string + * + * @return string + */ + protected function processPsd() + { + throw new NotSupportedException( + "PSD format is not supported by Gd Driver." + ); + } + + /** + * Processes and returns encoded image as AVIF string + * + * @return string + */ + protected function processAvif() + { + if ( ! function_exists('imageavif')) { + throw new NotSupportedException( + "AVIF format is not supported by PHP installation." + ); + } + + ob_start(); + $resource = $this->image->getCore(); + imagepalettetotruecolor($resource); + imagealphablending($resource, true); + imagesavealpha($resource, true); + imageavif($resource, null, $this->quality); + $this->image->mime = defined('IMAGETYPE_AVIF') ? image_type_to_mime_type(IMAGETYPE_AVIF) : 'image/avif'; + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + /** + * Processes and returns encoded image as HEIC string + * + * @return string + */ + protected function processHeic() + { + throw new NotSupportedException( + "HEIC format is not supported by Gd Driver." + ); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Font.php b/vendor/intervention/image/src/Intervention/Image/Gd/Font.php new file mode 100644 index 00000000..3f588878 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Font.php @@ -0,0 +1,277 @@ +size * 0.75)); + } + + /** + * Filter function to access internal integer font values + * + * @return int + */ + private function getInternalFont() + { + $internalfont = is_null($this->file) ? 1 : $this->file; + $internalfont = is_numeric($internalfont) ? $internalfont : false; + + if ( ! in_array($internalfont, [1, 2, 3, 4, 5])) { + throw new NotSupportedException( + sprintf('Internal GD font (%s) not available. Use only 1-5.', $internalfont) + ); + } + + return intval($internalfont); + } + + /** + * Get width of an internal font character + * + * @return int + */ + private function getInternalFontWidth() + { + return $this->getInternalFont() + 4; + } + + /** + * Get height of an internal font character + * + * @return int + */ + private function getInternalFontHeight() + { + switch ($this->getInternalFont()) { + case 1: + return 8; + + case 2: + return 14; + + case 3: + return 14; + + case 4: + return 16; + + case 5: + return 16; + } + } + + /** + * Calculates bounding box of current font setting + * + * @return Array + */ + public function getBoxSize() + { + $box = []; + + if ($this->hasApplicableFontFile()) { + + // imagettfbbox() converts numeric entities to their respective + // character. Preserve any originally double encoded entities to be + // represented as is. + // eg: &#160; will render   rather than its character. + $this->text = preg_replace('/&(#(?:x[a-fA-F0-9]+|[0-9]+);)/', '&\1', $this->text); + $this->text = mb_encode_numericentity($this->text, array(0x0080, 0xffff, 0, 0xffff), 'UTF-8'); + + // get bounding box with angle 0 + $box = imagettfbbox($this->getPointSize(), 0, $this->file, $this->text); + + // rotate points manually + if ($this->angle != 0) { + + $angle = pi() * 2 - $this->angle * pi() * 2 / 360; + + for ($i=0; $i<4; $i++) { + $x = $box[$i * 2]; + $y = $box[$i * 2 + 1]; + $box[$i * 2] = cos($angle) * $x - sin($angle) * $y; + $box[$i * 2 + 1] = sin($angle) * $x + cos($angle) * $y; + } + } + + $box['width'] = intval(abs($box[4] - $box[0])); + $box['height'] = intval(abs($box[5] - $box[1])); + + } else { + + // get current internal font size + $width = $this->getInternalFontWidth(); + $height = $this->getInternalFontHeight(); + + if (strlen($this->text) == 0) { + // no text -> no boxsize + $box['width'] = 0; + $box['height'] = 0; + } else { + // calculate boxsize + $box['width'] = strlen($this->text) * $width; + $box['height'] = $height; + } + } + + return $box; + } + + /** + * Draws font to given image at given position + * + * @param Image $image + * @param int $posx + * @param int $posy + * @return void + */ + public function applyToImage(Image $image, $posx = 0, $posy = 0) + { + // parse text color + $color = new Color($this->color); + + if ($this->hasApplicableFontFile()) { + + if ($this->angle != 0 || is_string($this->align) || is_string($this->valign)) { + + $box = $this->getBoxSize(); + + $align = is_null($this->align) ? 'left' : strtolower($this->align); + $valign = is_null($this->valign) ? 'bottom' : strtolower($this->valign); + + // correction on position depending on v/h alignment + switch ($align.'-'.$valign) { + + case 'center-top': + $posx = $posx - round(($box[6]+$box[4])/2); + $posy = $posy - round(($box[7]+$box[5])/2); + break; + + case 'right-top': + $posx = $posx - $box[4]; + $posy = $posy - $box[5]; + break; + + case 'left-top': + $posx = $posx - $box[6]; + $posy = $posy - $box[7]; + break; + + case 'center-center': + case 'center-middle': + $posx = $posx - round(($box[0]+$box[4])/2); + $posy = $posy - round(($box[1]+$box[5])/2); + break; + + case 'right-center': + case 'right-middle': + $posx = $posx - round(($box[2]+$box[4])/2); + $posy = $posy - round(($box[3]+$box[5])/2); + break; + + case 'left-center': + case 'left-middle': + $posx = $posx - round(($box[0]+$box[6])/2); + $posy = $posy - round(($box[1]+$box[7])/2); + break; + + case 'center-bottom': + $posx = $posx - round(($box[0]+$box[2])/2); + $posy = $posy - round(($box[1]+$box[3])/2); + break; + + case 'right-bottom': + $posx = $posx - $box[2]; + $posy = $posy - $box[3]; + break; + + case 'left-bottom': + $posx = $posx - $box[0]; + $posy = $posy - $box[1]; + break; + } + } + + // enable alphablending for imagettftext + imagealphablending($image->getCore(), true); + + // draw ttf text + imagettftext($image->getCore(), $this->getPointSize(), $this->angle, $posx, $posy, $color->getInt(), $this->file, $this->text); + + } else { + + // get box size + $box = $this->getBoxSize(); + $width = $box['width']; + $height = $box['height']; + + // internal font specific position corrections + if ($this->getInternalFont() == 1) { + $top_correction = 1; + $bottom_correction = 2; + } elseif ($this->getInternalFont() == 3) { + $top_correction = 2; + $bottom_correction = 4; + } else { + $top_correction = 3; + $bottom_correction = 4; + } + + // x-position corrections for horizontal alignment + switch (strtolower($this->align)) { + case 'center': + $posx = ceil($posx - ($width / 2)); + break; + + case 'right': + $posx = ceil($posx - $width) + 1; + break; + } + + // y-position corrections for vertical alignment + switch (strtolower($this->valign)) { + case 'center': + case 'middle': + $posy = ceil($posy - ($height / 2)); + break; + + case 'top': + $posy = ceil($posy - $top_correction); + break; + + default: + case 'bottom': + $posy = round($posy - $height + $bottom_correction); + break; + } + + // draw text + imagestring($image->getCore(), $this->getInternalFont(), $posx, $posy, $this->text, $color->getInt()); + } + } + + /** + * Set text kerning + * + * @param string $kerning + * @return void + */ + public function kerning($kerning) + { + throw new \Intervention\Image\Exception\NotSupportedException( + "Kerning is not supported by GD driver." + ); + } + +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php new file mode 100644 index 00000000..c3c42144 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php @@ -0,0 +1,40 @@ +width = is_numeric($diameter) ? intval($diameter) : $this->diameter; + $this->height = is_numeric($diameter) ? intval($diameter) : $this->diameter; + $this->diameter = is_numeric($diameter) ? intval($diameter) : $this->diameter; + } + + /** + * Draw current circle on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + return parent::applyToImage($image, $x, $y); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/EllipseShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/EllipseShape.php new file mode 100644 index 00000000..78e5e4a5 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/EllipseShape.php @@ -0,0 +1,65 @@ +width = is_numeric($width) ? intval($width) : $this->width; + $this->height = is_numeric($height) ? intval($height) : $this->height; + } + + /** + * Draw ellipse instance on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + // parse background color + $background = new Color($this->background); + + if ($this->hasBorder()) { + // slightly smaller ellipse to keep 1px bordered edges clean + imagefilledellipse($image->getCore(), $x, $y, $this->width-1, $this->height-1, $background->getInt()); + + $border_color = new Color($this->border_color); + imagesetthickness($image->getCore(), $this->border_width); + + // gd's imageellipse doesn't respect imagesetthickness so i use imagearc with 359.9 degrees here + imagearc($image->getCore(), $x, $y, $this->width, $this->height, 0, 359.99, $border_color->getInt()); + } else { + imagefilledellipse($image->getCore(), $x, $y, $this->width, $this->height, $background->getInt()); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/LineShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/LineShape.php new file mode 100644 index 00000000..ea38b513 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/LineShape.php @@ -0,0 +1,90 @@ +x = is_numeric($x) ? intval($x) : $this->x; + $this->y = is_numeric($y) ? intval($y) : $this->y; + } + + /** + * Set current line color + * + * @param string $color + * @return void + */ + public function color($color) + { + $this->color = $color; + } + + /** + * Set current line width in pixels + * + * @param int $width + * @return void + */ + public function width($width) + { + throw new \Intervention\Image\Exception\NotSupportedException( + "Line width is not supported by GD driver." + ); + } + + /** + * Draw current instance of line to given endpoint on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $color = new Color($this->color); + imageline($image->getCore(), $x, $y, $this->x, $this->y, $color->getInt()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php new file mode 100644 index 00000000..5e14df40 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php @@ -0,0 +1,49 @@ +points = $points; + } + + /** + * Draw polygon on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $background = new Color($this->background); + imagefilledpolygon($image->getCore(), $this->points, intval(count($this->points) / 2), $background->getInt()); + + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + imagesetthickness($image->getCore(), $this->border_width); + imagepolygon($image->getCore(), $this->points, intval(count($this->points) / 2), $border_color->getInt()); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/RectangleShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/RectangleShape.php new file mode 100644 index 00000000..5f69a7f9 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/RectangleShape.php @@ -0,0 +1,76 @@ +x1 = is_numeric($x1) ? intval($x1) : $this->x1; + $this->y1 = is_numeric($y1) ? intval($y1) : $this->y1; + $this->x2 = is_numeric($x2) ? intval($x2) : $this->x2; + $this->y2 = is_numeric($y2) ? intval($y2) : $this->y2; + } + + /** + * Draw rectangle to given image at certain position + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $background = new Color($this->background); + imagefilledrectangle($image->getCore(), $this->x1, $this->y1, $this->x2, $this->y2, $background->getInt()); + + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + imagesetthickness($image->getCore(), $this->border_width); + imagerectangle($image->getCore(), $this->x1, $this->y1, $this->x2, $this->y2, $border_color->getInt()); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Image.php b/vendor/intervention/image/src/Intervention/Image/Image.php new file mode 100644 index 00000000..7d5a59b7 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Image.php @@ -0,0 +1,370 @@ +driver = $driver; + $this->core = $core; + } + + /** + * Magic method to catch all image calls + * usually any AbstractCommand + * + * @param string $name + * @param Array $arguments + * @return mixed + */ + public function __call($name, $arguments) + { + $command = $this->driver->executeCommand($this, $name, $arguments); + return $command->hasOutput() ? $command->getOutput() : $this; + } + + /** + * Starts encoding of current image + * + * @param string $format + * @param int $quality + * @return \Intervention\Image\Image + */ + public function encode($format = null, $quality = 90) + { + return $this->driver->encode($this, $format, $quality); + } + + /** + * Saves encoded image in filesystem + * + * @param string $path + * @param int $quality + * @param string $format + * @return \Intervention\Image\Image + */ + public function save($path = null, $quality = null, $format = null) + { + $path = is_null($path) ? $this->basePath() : $path; + + if (is_null($path)) { + throw new NotWritableException( + "Can't write to undefined path." + ); + } + + if ($format === null) { + $format = pathinfo($path, PATHINFO_EXTENSION); + } + + $data = $this->encode($format, $quality); + $saved = @file_put_contents($path, $data); + + if ($saved === false) { + throw new NotWritableException( + "Can't write image data to path ({$path})" + ); + } + + // set new file info + $this->setFileInfoFromPath($path); + + return $this; + } + + /** + * Runs a given filter on current image + * + * @param FiltersFilterInterface $filter + * @return \Intervention\Image\Image + */ + public function filter(Filters\FilterInterface $filter) + { + return $filter->applyFilter($this); + } + + /** + * Returns current image driver + * + * @return \Intervention\Image\AbstractDriver + */ + public function getDriver() + { + return $this->driver; + } + + /** + * Sets current image driver + * @param AbstractDriver $driver + */ + public function setDriver(AbstractDriver $driver) + { + $this->driver = $driver; + + return $this; + } + + /** + * Returns current image resource/obj + * + * @return mixed + */ + public function getCore() + { + return $this->core; + } + + /** + * Sets current image resource + * + * @param mixed $core + */ + public function setCore($core) + { + $this->core = $core; + + return $this; + } + + /** + * Returns current image backup + * + * @param string $name + * @return mixed + */ + public function getBackup($name = null) + { + $name = is_null($name) ? 'default' : $name; + + if ( ! $this->backupExists($name)) { + throw new RuntimeException( + "Backup with name ({$name}) not available. Call backup() before reset()." + ); + } + + return $this->backups[$name]; + } + + /** + * Returns all backups attached to image + * + * @return array + */ + public function getBackups() + { + return $this->backups; + } + + /** + * Sets current image backup + * + * @param mixed $resource + * @param string $name + * @return self + */ + public function setBackup($resource, $name = null) + { + $name = is_null($name) ? 'default' : $name; + + $this->backups[$name] = $resource; + + return $this; + } + + /** + * Checks if named backup exists + * + * @param string $name + * @return bool + */ + private function backupExists($name) + { + return array_key_exists($name, $this->backups); + } + + /** + * Checks if current image is already encoded + * + * @return boolean + */ + public function isEncoded() + { + return ! empty($this->encoded); + } + + /** + * Returns encoded image data of current image + * + * @return string + */ + public function getEncoded() + { + return $this->encoded; + } + + /** + * Sets encoded image buffer + * + * @param string $value + */ + public function setEncoded($value) + { + $this->encoded = $value; + + return $this; + } + + /** + * Calculates current image width + * + * @return int + */ + public function getWidth() + { + return $this->getSize()->width; + } + + /** + * Alias of getWidth() + * + * @return int + */ + public function width() + { + return $this->getWidth(); + } + + /** + * Calculates current image height + * + * @return int + */ + public function getHeight() + { + return $this->getSize()->height; + } + + /** + * Alias of getHeight + * + * @return int + */ + public function height() + { + return $this->getHeight(); + } + + /** + * Reads mime type + * + * @return string + */ + public function mime() + { + return $this->mime; + } + + /** + * Returns encoded image data in string conversion + * + * @return string + */ + public function __toString() + { + return $this->encoded; + } + + /** + * Cloning an image + */ + public function __clone() + { + $this->core = $this->driver->cloneCore($this->core); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageManager.php b/vendor/intervention/image/src/Intervention/Image/ImageManager.php new file mode 100644 index 00000000..324fe7fa --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageManager.php @@ -0,0 +1,142 @@ + 'gd' + ]; + + /** + * Creates new instance of Image Manager + * + * @param array $config + */ + public function __construct(array $config = []) + { + $this->checkRequirements(); + $this->configure($config); + } + + /** + * Overrides configuration settings + * + * @param array $config + * + * @return self + */ + public function configure(array $config = []) + { + $this->config = array_replace($this->config, $config); + + return $this; + } + + /** + * Initiates an Image instance from different input types + * + * @param mixed $data + * + * @return \Intervention\Image\Image + */ + public function make($data) + { + return $this->createDriver()->init($data); + } + + /** + * Creates an empty image canvas + * + * @param int $width + * @param int $height + * @param mixed $background + * + * @return \Intervention\Image\Image + */ + public function canvas($width, $height, $background = null) + { + return $this->createDriver()->newImage($width, $height, $background); + } + + /** + * Create new cached image and run callback + * (requires additional package intervention/imagecache) + * + * @param Closure $callback + * @param int $lifetime + * @param boolean $returnObj + * + * @return Image + */ + public function cache(Closure $callback, $lifetime = null, $returnObj = false) + { + if (class_exists('Intervention\\Image\\ImageCache')) { + // create imagecache + $imagecache = new ImageCache($this); + + // run callback + if (is_callable($callback)) { + $callback($imagecache); + } + + return $imagecache->get($lifetime, $returnObj); + } + + throw new MissingDependencyException( + "Please install package intervention/imagecache before running this function." + ); + } + + /** + * Creates a driver instance according to config settings + * + * @return \Intervention\Image\AbstractDriver + */ + private function createDriver() + { + if (is_string($this->config['driver'])) { + $drivername = ucfirst($this->config['driver']); + $driverclass = sprintf('Intervention\\Image\\%s\\Driver', $drivername); + + if (class_exists($driverclass)) { + return new $driverclass; + } + + throw new NotSupportedException( + "Driver ({$drivername}) could not be instantiated." + ); + } + + if ($this->config['driver'] instanceof AbstractDriver) { + return $this->config['driver']; + } + + throw new NotSupportedException( + "Unknown driver type." + ); + } + + /** + * Check if all requirements are available + * + * @return void + */ + private function checkRequirements() + { + if ( ! function_exists('finfo_buffer')) { + throw new MissingDependencyException( + "PHP Fileinfo extension must be installed/enabled to use Intervention Image." + ); + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php b/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php new file mode 100644 index 00000000..a1b56426 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php @@ -0,0 +1,88 @@ +configure($config); + } + + /** + * Statically initiates an Image instance from different input types + * + * @param mixed $data + * + * @return \Intervention\Image\Image + * @throws \Intervention\Image\Exception\NotReadableException + */ + public static function make($data) + { + return self::getManager()->make($data); + } + + /** + * Statically creates an empty image canvas + * + * @param int $width + * @param int $height + * @param mixed $background + * + * @return \Intervention\Image\Image + */ + public static function canvas($width, $height, $background = null) + { + return self::getManager()->canvas($width, $height, $background); + } + + /** + * Create new cached image and run callback statically + * + * @param Closure $callback + * @param int $lifetime + * @param boolean $returnObj + * + * @return mixed + */ + public static function cache(Closure $callback, $lifetime = null, $returnObj = false) + { + return self::getManager()->cache($callback, $lifetime, $returnObj); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProvider.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProvider.php new file mode 100644 index 00000000..f99fe4a3 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProvider.php @@ -0,0 +1,87 @@ +provider = $this->getProvider(); + } + + /** + * Bootstrap the application events. + * + * @return void + */ + public function boot() + { + if (method_exists($this->provider, 'boot')) { + return $this->provider->boot(); + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + return $this->provider->register(); + } + + /** + * Return ServiceProvider according to Laravel version + * + * @return \Intervention\Image\Provider\ProviderInterface + */ + private function getProvider() + { + if ($this->app instanceof LumenApplication) { + $provider = '\Intervention\Image\ImageServiceProviderLumen'; + } elseif (version_compare(IlluminateApplication::VERSION, '5.0', '<')) { + $provider = '\Intervention\Image\ImageServiceProviderLaravel4'; + } else { + $provider = '\Intervention\Image\ImageServiceProviderLaravelRecent'; + } + + return new $provider($this->app); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['image']; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel4.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel4.php new file mode 100755 index 00000000..3b1388f2 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel4.php @@ -0,0 +1,112 @@ +package('intervention/image'); + + // try to create imagecache route only if imagecache is present + if (class_exists('Intervention\\Image\\ImageCache')) { + + $app = $this->app; + + // load imagecache config + $app['config']->package('intervention/imagecache', __DIR__.'/../../../../imagecache/src/config', 'imagecache'); + $config = $app['config']; + + // create dynamic manipulation route + if (is_string($config->get('imagecache::route'))) { + + // add original to route templates + $config->set('imagecache::templates.original', null); + + // setup image manipulator route + $app['router']->get($config->get('imagecache::route').'/{template}/{filename}', ['as' => 'imagecache', function ($template, $filename) use ($app, $config) { + + // disable session cookies for image route + $app['config']->set('session.driver', 'array'); + + // find file + foreach ($config->get('imagecache::paths') as $path) { + // don't allow '..' in filenames + $image_path = $path.'/'.str_replace('..', '', $filename); + if (file_exists($image_path) && is_file($image_path)) { + break; + } else { + $image_path = false; + } + } + + // abort if file not found + if ($image_path === false) { + $app->abort(404); + } + + // define template callback + $callback = $config->get("imagecache::templates.{$template}"); + + if (is_callable($callback) || class_exists($callback)) { + + // image manipulation based on callback + $content = $app['image']->cache(function ($image) use ($image_path, $callback) { + + switch (true) { + case is_callable($callback): + return $callback($image->make($image_path)); + break; + + case class_exists($callback): + return $image->make($image_path)->filter(new $callback); + break; + } + + }, $config->get('imagecache::lifetime')); + + } else { + + // get original image file contents + $content = file_get_contents($image_path); + } + + // define mime type + $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $content); + + // return http response + return new IlluminateResponse($content, 200, [ + 'Content-Type' => $mime, + 'Cache-Control' => 'max-age='.($config->get('imagecache::lifetime')*60).', public', + 'Etag' => md5($content) + ]); + + }])->where(['template' => join('|', array_keys($config->get('imagecache::templates'))), 'filename' => '[ \w\\.\\/\\-]+']); + } + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $app = $this->app; + + $app['image'] = $app->share(function ($app) { + return new ImageManager($app['config']->get('image::config')); + }); + + $app->alias('image', 'Intervention\Image\ImageManager'); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravelRecent.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravelRecent.php new file mode 100644 index 00000000..17a84d0a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravelRecent.php @@ -0,0 +1,106 @@ +publishes([ + __DIR__.'/../../config/config.php' => config_path('image.php') + ]); + + // setup intervention/imagecache if package is installed + $this->cacheIsInstalled() ? $this->bootstrapImageCache() : null; + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $app = $this->app; + + // merge default config + $this->mergeConfigFrom( + __DIR__.'/../../config/config.php', + 'image' + ); + + // create image + $app->singleton('image', function ($app) { + return new ImageManager($this->getImageConfig($app)); + }); + + $app->alias('image', 'Intervention\Image\ImageManager'); + } + + /** + * Bootstrap imagecache + * + * @return void + */ + protected function bootstrapImageCache() + { + $app = $this->app; + $config = __DIR__.'/../../../../imagecache/src/config/config.php'; + + $this->publishes([ + $config => config_path('imagecache.php') + ]); + + // merge default config + $this->mergeConfigFrom( + $config, + 'imagecache' + ); + + // imagecache route + if (is_string(config('imagecache.route'))) { + + $filename_pattern = '[ \w\\.\\/\\-\\@\(\)\=]+'; + + // route to access template applied image file + $app['router']->get(config('imagecache.route').'/{template}/{filename}', [ + 'uses' => 'Intervention\Image\ImageCacheController@getResponse', + 'as' => 'imagecache' + ])->where(['filename' => $filename_pattern]); + } + } + + /** + * Return image configuration as array + * + * @param Application $app + * @return array + */ + private function getImageConfig($app) + { + $config = $app['config']->get('image'); + + if (is_null($config)) { + return []; + } + + return $config; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php new file mode 100644 index 00000000..b756a61f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php @@ -0,0 +1,42 @@ +config = $config; + } + + /** + * Register the server provider. + * + * @return void + */ + public function register() + { + $this->getContainer()->share('Intervention\Image\ImageManager', function () { + return new ImageManager($this->config); + }); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php new file mode 100644 index 00000000..4a381ccd --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php @@ -0,0 +1,34 @@ +app; + + // merge default config + $this->mergeConfigFrom( + __DIR__.'/../../config/config.php', + 'image' + ); + + // set configuration + $app->configure('image'); + + // create image + $app->singleton('image',function ($app) { + return new ImageManager($app['config']->get('image')); + }); + + $app->alias('image', 'Intervention\Image\ImageManager'); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Color.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Color.php new file mode 100644 index 00000000..a41ff3a6 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Color.php @@ -0,0 +1,279 @@ +> 24) & 0xFF; + $r = ($value >> 16) & 0xFF; + $g = ($value >> 8) & 0xFF; + $b = $value & 0xFF; + $a = $this->rgb2alpha($a); + + $this->setPixel($r, $g, $b, $a); + } + + /** + * Initiates color object from given array + * + * @param array $value + * @return \Intervention\Image\AbstractColor + */ + public function initFromArray($array) + { + $array = array_values($array); + + if (count($array) == 4) { + + // color array with alpha value + list($r, $g, $b, $a) = $array; + + } elseif (count($array) == 3) { + + // color array without alpha value + list($r, $g, $b) = $array; + $a = 1; + } + + $this->setPixel($r, $g, $b, $a); + } + + /** + * Initiates color object from given string + * + * @param string $value + * + * @return \Intervention\Image\AbstractColor + */ + public function initFromString($value) + { + if ($color = $this->rgbaFromString($value)) { + $this->setPixel($color[0], $color[1], $color[2], $color[3]); + } + } + + /** + * Initiates color object from given ImagickPixel object + * + * @param ImagickPixel $value + * + * @return \Intervention\Image\AbstractColor + */ + public function initFromObject($value) + { + if (is_a($value, '\ImagickPixel')) { + $this->pixel = $value; + } + } + + /** + * Initiates color object from given R, G and B values + * + * @param int $r + * @param int $g + * @param int $b + * + * @return \Intervention\Image\AbstractColor + */ + public function initFromRgb($r, $g, $b) + { + $this->setPixel($r, $g, $b); + } + + /** + * Initiates color object from given R, G, B and A values + * + * @param int $r + * @param int $g + * @param int $b + * @param float $a + * + * @return \Intervention\Image\AbstractColor + */ + public function initFromRgba($r, $g, $b, $a) + { + $this->setPixel($r, $g, $b, $a); + } + + /** + * Calculates integer value of current color instance + * + * @return int + */ + public function getInt() + { + $r = $this->getRedValue(); + $g = $this->getGreenValue(); + $b = $this->getBlueValue(); + $a = intval(round($this->getAlphaValue() * 255)); + + return intval(($a << 24) + ($r << 16) + ($g << 8) + $b); + } + + /** + * Calculates hexadecimal value of current color instance + * + * @param string $prefix + * + * @return string + */ + public function getHex($prefix = '') + { + return sprintf('%s%02x%02x%02x', $prefix, + $this->getRedValue(), + $this->getGreenValue(), + $this->getBlueValue() + ); + } + + /** + * Calculates RGB(A) in array format of current color instance + * + * @return array + */ + public function getArray() + { + return [ + $this->getRedValue(), + $this->getGreenValue(), + $this->getBlueValue(), + $this->getAlphaValue() + ]; + } + + /** + * Calculates RGBA in string format of current color instance + * + * @return string + */ + public function getRgba() + { + return sprintf('rgba(%d, %d, %d, %.2F)', + $this->getRedValue(), + $this->getGreenValue(), + $this->getBlueValue(), + $this->getAlphaValue() + ); + } + + /** + * Determines if current color is different from given color + * + * @param AbstractColor $color + * @param int $tolerance + * @return boolean + */ + public function differs(AbstractColor $color, $tolerance = 0) + { + $color_tolerance = round($tolerance * 2.55); + $alpha_tolerance = round($tolerance); + + $delta = [ + 'r' => abs($color->getRedValue() - $this->getRedValue()), + 'g' => abs($color->getGreenValue() - $this->getGreenValue()), + 'b' => abs($color->getBlueValue() - $this->getBlueValue()), + 'a' => abs($color->getAlphaValue() - $this->getAlphaValue()) + ]; + + return ( + $delta['r'] > $color_tolerance or + $delta['g'] > $color_tolerance or + $delta['b'] > $color_tolerance or + $delta['a'] > $alpha_tolerance + ); + } + + /** + * Returns RGB red value of current color + * + * @return int + */ + public function getRedValue() + { + return intval(round($this->pixel->getColorValue(\Imagick::COLOR_RED) * 255)); + } + + /** + * Returns RGB green value of current color + * + * @return int + */ + public function getGreenValue() + { + return intval(round($this->pixel->getColorValue(\Imagick::COLOR_GREEN) * 255)); + } + + /** + * Returns RGB blue value of current color + * + * @return int + */ + public function getBlueValue() + { + return intval(round($this->pixel->getColorValue(\Imagick::COLOR_BLUE) * 255)); + } + + /** + * Returns RGB alpha value of current color + * + * @return float + */ + public function getAlphaValue() + { + return round($this->pixel->getColorValue(\Imagick::COLOR_ALPHA), 2); + } + + /** + * Initiates ImagickPixel from given RGBA values + * + * @return \ImagickPixel + */ + private function setPixel($r, $g, $b, $a = null) + { + $a = is_null($a) ? 1 : $a; + + return $this->pixel = new \ImagickPixel( + sprintf('rgba(%d, %d, %d, %.2F)', $r, $g, $b, $a) + ); + } + + /** + * Returns current color as ImagickPixel + * + * @return \ImagickPixel + */ + public function getPixel() + { + return $this->pixel; + } + + /** + * Calculates RGA integer alpha value into float value + * + * @param int $value + * @return float + */ + private function rgb2alpha($value) + { + // (255 -> 1.0) / (0 -> 0.0) + return (float) round($value/255, 2); + } + +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php new file mode 100644 index 00000000..76b4f72b --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php @@ -0,0 +1,25 @@ +argument(0)->value(); + + // clone current image resource + $clone = clone $image; + $image->setBackup($clone->getCore(), $backupName); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php new file mode 100644 index 00000000..d2533e0e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(0, 100)->value(1); + + return $image->getCore()->blurImage(1 * $amount, 0.5 * $amount); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php new file mode 100644 index 00000000..03ac8478 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(-100, 100)->required()->value(); + + return $image->getCore()->modulateImage(100 + $level, 100, 100); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php new file mode 100644 index 00000000..3a6506f6 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php @@ -0,0 +1,44 @@ +argument(0)->between(-100, 100)->required()->value(); + $green = $this->argument(1)->between(-100, 100)->required()->value(); + $blue = $this->argument(2)->between(-100, 100)->required()->value(); + + // normalize colorize levels + $red = $this->normalizeLevel($red); + $green = $this->normalizeLevel($green); + $blue = $this->normalizeLevel($blue); + + $qrange = $image->getCore()->getQuantumRange(); + + // apply + $image->getCore()->levelImage(0, $red, $qrange['quantumRangeLong'], \Imagick::CHANNEL_RED); + $image->getCore()->levelImage(0, $green, $qrange['quantumRangeLong'], \Imagick::CHANNEL_GREEN); + $image->getCore()->levelImage(0, $blue, $qrange['quantumRangeLong'], \Imagick::CHANNEL_BLUE); + + return true; + } + + private function normalizeLevel($level) + { + if ($level > 0) { + return $level/5; + } else { + return ($level+100)/100; + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php new file mode 100644 index 00000000..c4847c61 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(-100, 100)->required()->value(); + + return $image->getCore()->sigmoidalContrastImage($level > 0, $level / 4, 0); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/CropCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/CropCommand.php new file mode 100644 index 00000000..618edea7 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/CropCommand.php @@ -0,0 +1,45 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $x = $this->argument(2)->type('digit')->value(); + $y = $this->argument(3)->type('digit')->value(); + + if (is_null($width) || is_null($height)) { + throw new InvalidArgumentException( + "Width and height of cutout needs to be defined." + ); + } + + $cropped = new Size($width, $height); + $position = new Point($x, $y); + + // align boxes + if (is_null($x) && is_null($y)) { + $position = $image->getSize()->align('center')->relativePosition($cropped->align('center')); + } + + // crop image core + $image->getCore()->cropImage($cropped->width, $cropped->height, $position->x, $position->y); + $image->getCore()->setImagePage(0,0,0,0); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php new file mode 100644 index 00000000..58c9556e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php @@ -0,0 +1,27 @@ +getCore()->clear(); + + // destroy backups + foreach ($image->getBackups() as $backup) { + $backup->clear(); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php new file mode 100644 index 00000000..521b38b0 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php @@ -0,0 +1,63 @@ +preferExtension = false; + } + + /** + * Read Exif data from the given image + * + * @param \Intervention\Image\Image $image + * @return boolean + */ + public function execute($image) + { + if ($this->preferExtension && function_exists('exif_read_data')) { + return parent::execute($image); + } + + $core = $image->getCore(); + + if ( ! method_exists($core, 'getImageProperties')) { + throw new NotSupportedException( + "Reading Exif data is not supported by this PHP installation." + ); + } + + $requestedKey = $this->argument(0)->value(); + if ($requestedKey !== null) { + $this->setOutput($core->getImageProperty('exif:' . $requestedKey)); + return true; + } + + $exif = []; + $properties = $core->getImageProperties(); + foreach ($properties as $key => $value) { + if (substr($key, 0, 5) !== 'exif:') { + continue; + } + + $exif[substr($key, 5)] = $value; + } + + $this->setOutput($exif); + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FillCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FillCommand.php new file mode 100644 index 00000000..82baac53 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FillCommand.php @@ -0,0 +1,105 @@ +argument(0)->value(); + $x = $this->argument(1)->type('digit')->value(); + $y = $this->argument(2)->type('digit')->value(); + + $imagick = $image->getCore(); + + try { + // set image filling + $source = new Decoder; + $filling = $source->init($filling); + + } catch (NotReadableException $e) { + + // set solid color filling + $filling = new Color($filling); + } + + // flood fill if coordinates are set + if (is_int($x) && is_int($y)) { + + // flood fill with texture + if ($filling instanceof Image) { + + // create tile + $tile = clone $image->getCore(); + + // mask away color at position + $tile->transparentPaintImage($tile->getImagePixelColor($x, $y), 0, 0, false); + + // create canvas + $canvas = clone $image->getCore(); + + // fill canvas with texture + $canvas = $canvas->textureImage($filling->getCore()); + + // merge canvas and tile + $canvas->compositeImage($tile, \Imagick::COMPOSITE_DEFAULT, 0, 0); + + // replace image core + $image->setCore($canvas); + + // flood fill with color + } elseif ($filling instanceof Color) { + + // create canvas with filling + $canvas = new \Imagick; + $canvas->newImage($image->getWidth(), $image->getHeight(), $filling->getPixel(), 'png'); + + // create tile to put on top + $tile = clone $image->getCore(); + + // mask away color at pos. + $tile->transparentPaintImage($tile->getImagePixelColor($x, $y), 0, 0, false); + + // save alpha channel of original image + $alpha = clone $image->getCore(); + + // merge original with canvas and tile + $image->getCore()->compositeImage($canvas, \Imagick::COMPOSITE_DEFAULT, 0, 0); + $image->getCore()->compositeImage($tile, \Imagick::COMPOSITE_DEFAULT, 0, 0); + + // restore alpha channel of original image + $image->getCore()->compositeImage($alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + } + + } else { + + if ($filling instanceof Image) { + + // fill whole image with texture + $image->setCore($image->getCore()->textureImage($filling->getCore())); + + } elseif ($filling instanceof Color) { + + // fill whole image with color + $draw = new \ImagickDraw(); + $draw->setFillColor($filling->getPixel()); + $draw->rectangle(0, 0, $image->getWidth(), $image->getHeight()); + $image->getCore()->drawImage($draw); + } + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FitCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FitCommand.php new file mode 100644 index 00000000..6d62ba67 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FitCommand.php @@ -0,0 +1,42 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->value($width); + $constraints = $this->argument(2)->type('closure')->value(); + $position = $this->argument(3)->type('string')->value('center'); + + // calculate size + $cropped = $image->getSize()->fit(new Size($width, $height), $position); + $resized = clone $cropped; + $resized = $resized->resize($width, $height, $constraints); + + // crop image + $image->getCore()->cropImage( + $cropped->width, + $cropped->height, + $cropped->pivot->x, + $cropped->pivot->y + ); + + // resize image + $image->getCore()->scaleImage($resized->getWidth(), $resized->getHeight()); + $image->getCore()->setImagePage(0,0,0,0); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php new file mode 100644 index 00000000..abae16ad --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php @@ -0,0 +1,27 @@ +argument(0)->value('h'); + + if (in_array(strtolower($mode), [2, 'v', 'vert', 'vertical'])) { + // flip vertical + return $image->getCore()->flipImage(); + } else { + // flip horizontal + return $image->getCore()->flopImage(); + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php new file mode 100644 index 00000000..200515f3 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php @@ -0,0 +1,21 @@ +argument(0)->type('numeric')->required()->value(); + + return $image->getCore()->gammaImage($gamma); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php new file mode 100644 index 00000000..ccccedb0 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php @@ -0,0 +1,28 @@ +getCore(); + + $this->setOutput(new Size( + $core->getImageWidth(), + $core->getImageHeight() + )); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php new file mode 100644 index 00000000..df0ff5b5 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php @@ -0,0 +1,19 @@ +getCore()->modulateImage(100, 0, 100); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php new file mode 100644 index 00000000..0b61e50c --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php @@ -0,0 +1,28 @@ +argument(0)->type('digit')->required()->value(); + $additionalConstraints = $this->argument(1)->type('closure')->value(); + + $this->arguments[0] = null; + $this->arguments[1] = $height; + $this->arguments[2] = function ($constraint) use ($additionalConstraints) { + $constraint->aspectRatio(); + if(is_callable($additionalConstraints)) + $additionalConstraints($constraint); + }; + + return parent::execute($image); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php new file mode 100644 index 00000000..2a997436 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php @@ -0,0 +1,33 @@ +argument(0)->required()->value(); + $position = $this->argument(1)->type('string')->value(); + $x = $this->argument(2)->type('digit')->value(0); + $y = $this->argument(3)->type('digit')->value(0); + + // build watermark + $watermark = $image->getDriver()->init($source); + + // define insertion point + $image_size = $image->getSize()->align($position, $x, $y); + $watermark_size = $watermark->getSize()->align($position); + $target = $image_size->relativePosition($watermark_size); + + // insert image at position + return $image->getCore()->compositeImage($watermark->getCore(), \Imagick::COMPOSITE_DEFAULT, $target->x, $target->y); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php new file mode 100644 index 00000000..913cab7e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php @@ -0,0 +1,29 @@ +argument(0)->type('bool')->value(true); + + if ($mode) { + $mode = \Imagick::INTERLACE_LINE; + } else { + $mode = \Imagick::INTERLACE_NO; + } + + $image->getCore()->setInterlaceScheme($mode); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php new file mode 100644 index 00000000..1d134301 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php @@ -0,0 +1,19 @@ +getCore()->negateImage(false); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php new file mode 100644 index 00000000..16f9b82e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php @@ -0,0 +1,59 @@ +argument(0)->value(); + $matte = $this->argument(1)->value(); + + // get current image size + $size = $image->getSize(); + + // build 2 color alpha mask from original alpha + $alpha = clone $image->getCore(); + $alpha->separateImageChannel(\Imagick::CHANNEL_ALPHA); + $alpha->transparentPaintImage('#ffffff', 0, 0, false); + $alpha->separateImageChannel(\Imagick::CHANNEL_ALPHA); + $alpha->negateImage(false); + + if ($matte) { + + // get matte color + $mattecolor = $image->getDriver()->parseColor($matte)->getPixel(); + + // create matte image + $canvas = new \Imagick; + $canvas->newImage($size->width, $size->height, $mattecolor, 'png'); + + // lower colors of original and copy to matte + $image->getCore()->quantizeImage($count, \Imagick::COLORSPACE_RGB, 0, false, false); + $canvas->compositeImage($image->getCore(), \Imagick::COMPOSITE_DEFAULT, 0, 0); + + // copy new alpha to canvas + $canvas->compositeImage($alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + + // replace core + $image->setCore($canvas); + + } else { + + $image->getCore()->quantizeImage($count, \Imagick::COLORSPACE_RGB, 0, false, false); + $image->getCore()->compositeImage($alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + + } + + return true; + + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/MaskCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/MaskCommand.php new file mode 100644 index 00000000..af9d6b2f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/MaskCommand.php @@ -0,0 +1,60 @@ +argument(0)->value(); + $mask_w_alpha = $this->argument(1)->type('bool')->value(false); + + // get imagick + $imagick = $image->getCore(); + + // build mask image from source + $mask = $image->getDriver()->init($mask_source); + + // resize mask to size of current image (if necessary) + $image_size = $image->getSize(); + if ($mask->getSize() != $image_size) { + $mask->resize($image_size->width, $image_size->height); + } + + $imagick->setImageMatte(true); + + if ($mask_w_alpha) { + + // just mask with alpha map + $imagick->compositeImage($mask->getCore(), \Imagick::COMPOSITE_DSTIN, 0, 0); + + } else { + + // get alpha channel of original as greyscale image + $original_alpha = clone $imagick; + $original_alpha->separateImageChannel(\Imagick::CHANNEL_ALPHA); + + // use red channel from mask ask alpha + $mask_alpha = clone $mask->getCore(); + $mask_alpha->compositeImage($mask->getCore(), \Imagick::COMPOSITE_DEFAULT, 0, 0); + // $mask_alpha->setImageAlphaChannel(\Imagick::ALPHACHANNEL_DEACTIVATE); + $mask_alpha->separateImageChannel(\Imagick::CHANNEL_ALL); + + // combine both alphas from original and mask + $original_alpha->compositeImage($mask_alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + + // mask the image with the alpha combination + $imagick->compositeImage($original_alpha, \Imagick::COMPOSITE_DSTIN, 0, 0); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php new file mode 100644 index 00000000..b4708d89 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php @@ -0,0 +1,23 @@ +argument(0)->between(0, 100)->required()->value(); + + $transparency = $transparency > 0 ? (100 / $transparency) : 1000; + + return $image->getCore()->evaluateImage(\Imagick::EVALUATE_DIVIDE, $transparency, \Imagick::CHANNEL_ALPHA); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php new file mode 100644 index 00000000..978a1284 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php @@ -0,0 +1,30 @@ +argument(0)->type('digit')->required()->value(); + $y = $this->argument(1)->type('digit')->required()->value(); + $format = $this->argument(2)->type('string')->value('array'); + + // pick color + $color = new Color($image->getCore()->getImagePixelColor($x, $y)); + + // format to output + $this->setOutput($color->format($format)); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php new file mode 100644 index 00000000..6eb6ae71 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php @@ -0,0 +1,31 @@ +argument(0)->required()->value(); + $color = new Color($color); + $x = $this->argument(1)->type('digit')->required()->value(); + $y = $this->argument(2)->type('digit')->required()->value(); + + // prepare pixel + $draw = new \ImagickDraw; + $draw->setFillColor($color->getPixel()); + $draw->point($x, $y); + + // apply pixel + return $image->getCore()->drawImage($draw); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php new file mode 100644 index 00000000..6fe79491 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php @@ -0,0 +1,27 @@ +argument(0)->type('digit')->value(10); + + $width = $image->getWidth(); + $height = $image->getHeight(); + + $image->getCore()->scaleImage(max(1, ($width / $size)), max(1, ($height / $size))); + $image->getCore()->scaleImage($width, $height); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php new file mode 100644 index 00000000..77b7f336 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php @@ -0,0 +1,40 @@ +argument(0)->value(); + + $backup = $image->getBackup($backupName); + + if ($backup instanceof \Imagick) { + + // destroy current core + $image->getCore()->clear(); + + // clone backup + $backup = clone $backup; + + // reset to new resource + $image->setCore($backup); + + return true; + } + + throw new RuntimeException( + "Backup not available. Call backup({$backupName}) before reset()." + ); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php new file mode 100644 index 00000000..ecf07610 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php @@ -0,0 +1,91 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $anchor = $this->argument(2)->value('center'); + $relative = $this->argument(3)->type('boolean')->value(false); + $bgcolor = $this->argument(4)->value(); + + $original_width = $image->getWidth(); + $original_height = $image->getHeight(); + + // check of only width or height is set + $width = is_null($width) ? $original_width : intval($width); + $height = is_null($height) ? $original_height : intval($height); + + // check on relative width/height + if ($relative) { + $width = $original_width + $width; + $height = $original_height + $height; + } + + // check for negative width/height + $width = ($width <= 0) ? $width + $original_width : $width; + $height = ($height <= 0) ? $height + $original_height : $height; + + // create new canvas + $canvas = $image->getDriver()->newImage($width, $height, $bgcolor); + + // set copy position + $canvas_size = $canvas->getSize()->align($anchor); + $image_size = $image->getSize()->align($anchor); + $canvas_pos = $image_size->relativePosition($canvas_size); + $image_pos = $canvas_size->relativePosition($image_size); + + if ($width <= $original_width) { + $dst_x = 0; + $src_x = $canvas_pos->x; + $src_w = $canvas_size->width; + } else { + $dst_x = $image_pos->x; + $src_x = 0; + $src_w = $original_width; + } + + if ($height <= $original_height) { + $dst_y = 0; + $src_y = $canvas_pos->y; + $src_h = $canvas_size->height; + } else { + $dst_y = $image_pos->y; + $src_y = 0; + $src_h = $original_height; + } + + // make image area transparent to keep transparency + // even if background-color is set + $rect = new \ImagickDraw; + $fill = $canvas->pickColor(0, 0, 'hex'); + $fill = $fill == '#ff0000' ? '#00ff00' : '#ff0000'; + $rect->setFillColor($fill); + $rect->rectangle($dst_x, $dst_y, $dst_x + $src_w - 1, $dst_y + $src_h - 1); + $canvas->getCore()->drawImage($rect); + $canvas->getCore()->transparentPaintImage($fill, 0, 0, false); + + $canvas->getCore()->setImageColorspace($image->getCore()->getImageColorspace()); + + // copy image into new canvas + $image->getCore()->cropImage($src_w, $src_h, $src_x, $src_y); + $canvas->getCore()->compositeImage($image->getCore(), \Imagick::COMPOSITE_DEFAULT, $dst_x, $dst_y); + $canvas->getCore()->setImagePage(0,0,0,0); + + // set new core to canvas + $image->setCore($canvas->getCore()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php new file mode 100644 index 00000000..3d4dc5be --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php @@ -0,0 +1,29 @@ +argument(0)->value(); + $height = $this->argument(1)->value(); + $constraints = $this->argument(2)->type('closure')->value(); + + // resize box + $resized = $image->getSize()->resize($width, $height, $constraints); + + // modify image + $image->getCore()->scaleImage($resized->getWidth(), $resized->getHeight()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php new file mode 100644 index 00000000..b3e12a53 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php @@ -0,0 +1,30 @@ +argument(0)->type('numeric')->required()->value(); + $color = $this->argument(1)->value(); + $color = new Color($color); + + // restrict rotations beyond 360 degrees, since the end result is the same + $angle = fmod($angle, 360); + + // rotate image + $image->getCore()->rotateImage($color->getPixel(), ($angle * -1)); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php new file mode 100644 index 00000000..bc5e393f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(0, 100)->value(10); + + return $image->getCore()->unsharpMaskImage(1, 1, $amount / 6.25, 0); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/TrimCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/TrimCommand.php new file mode 100644 index 00000000..bdc897be --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/TrimCommand.php @@ -0,0 +1,121 @@ +argument(0)->type('string')->value(); + $away = $this->argument(1)->value(); + $tolerance = $this->argument(2)->type('numeric')->value(0); + $feather = $this->argument(3)->type('numeric')->value(0); + + $width = $image->getWidth(); + $height = $image->getHeight(); + + $checkTransparency = false; + + // define borders to trim away + if (is_null($away)) { + $away = ['top', 'right', 'bottom', 'left']; + } elseif (is_string($away)) { + $away = [$away]; + } + + // lower border names + foreach ($away as $key => $value) { + $away[$key] = strtolower($value); + } + + // define base color position + switch (strtolower($base)) { + case 'transparent': + case 'trans': + $checkTransparency = true; + $base_x = 0; + $base_y = 0; + break; + + case 'bottom-right': + case 'right-bottom': + $base_x = $width - 1; + $base_y = $height - 1; + break; + + default: + case 'top-left': + case 'left-top': + $base_x = 0; + $base_y = 0; + break; + } + + // pick base color + if ($checkTransparency) { + $base_color = new Color; // color will only be used to compare alpha channel + } else { + $base_color = $image->pickColor($base_x, $base_y, 'object'); + } + + // trim on clone to get only coordinates + $trimed = clone $image->getCore(); + + // add border to trim specific color + $trimed->borderImage($base_color->getPixel(), 1, 1); + + // trim image + $trimed->trimImage(65850 / 100 * $tolerance); + + // get coordinates of trim + $imagePage = $trimed->getImagePage(); + list($crop_x, $crop_y) = [$imagePage['x']-1, $imagePage['y']-1]; + // $trimed->setImagePage(0, 0, 0, 0); + list($crop_width, $crop_height) = [$trimed->width, $trimed->height]; + + // adjust settings if right should not be trimed + if ( ! in_array('right', $away)) { + $crop_width = $crop_width + ($width - ($width - $crop_x)); + } + + // adjust settings if bottom should not be trimed + if ( ! in_array('bottom', $away)) { + $crop_height = $crop_height + ($height - ($height - $crop_y)); + } + + // adjust settings if left should not be trimed + if ( ! in_array('left', $away)) { + $crop_width = $crop_width + $crop_x; + $crop_x = 0; + } + + // adjust settings if top should not be trimed + if ( ! in_array('top', $away)) { + $crop_height = $crop_height + $crop_y; + $crop_y = 0; + } + + // add feather + $crop_width = min($width, ($crop_width + $feather * 2)); + $crop_height = min($height, ($crop_height + $feather * 2)); + $crop_x = max(0, ($crop_x - $feather)); + $crop_y = max(0, ($crop_y - $feather)); + + // finally crop based on page + $image->getCore()->cropImage($crop_width, $crop_height, $crop_x, $crop_y); + $image->getCore()->setImagePage(0,0,0,0); + + $trimed->destroy(); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php new file mode 100644 index 00000000..a1967534 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php @@ -0,0 +1,28 @@ +argument(0)->type('digit')->required()->value(); + $additionalConstraints = $this->argument(1)->type('closure')->value(); + + $this->arguments[0] = $width; + $this->arguments[1] = null; + $this->arguments[2] = function ($constraint) use ($additionalConstraints) { + $constraint->aspectRatio(); + if(is_callable($additionalConstraints)) + $additionalConstraints($constraint); + }; + + return parent::execute($image); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php new file mode 100644 index 00000000..f4dde9a8 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php @@ -0,0 +1,124 @@ +setBackgroundColor(new \ImagickPixel('transparent')); + $core->readImage($path); + $core->setImageType(defined('\Imagick::IMGTYPE_TRUECOLORALPHA') ? \Imagick::IMGTYPE_TRUECOLORALPHA : \Imagick::IMGTYPE_TRUECOLORMATTE); + + } catch (\ImagickException $e) { + throw new \Intervention\Image\Exception\NotReadableException( + "Unable to read image from path ({$path}).", + 0, + $e + ); + } + + // build image + $image = $this->initFromImagick($core); + $image->setFileInfoFromPath($path); + + return $image; + } + + /** + * Initiates new image from GD resource + * + * @param Resource $resource + * @return \Intervention\Image\Image + */ + public function initFromGdResource($resource) + { + throw new NotSupportedException( + 'Imagick driver is unable to init from GD resource.' + ); + } + + /** + * Initiates new image from Imagick object + * + * @param Imagick $object + * @return \Intervention\Image\Image + */ + public function initFromImagick(\Imagick $object) + { + // currently animations are not supported + // so all images are turned into static + $object = $this->removeAnimation($object); + + // reset image orientation + $object->setImageOrientation(\Imagick::ORIENTATION_UNDEFINED); + + return new Image(new Driver, $object); + } + + /** + * Initiates new image from binary data + * + * @param string $data + * @return \Intervention\Image\Image + */ + public function initFromBinary($binary) + { + $core = new \Imagick; + + try { + $core->setBackgroundColor(new \ImagickPixel('transparent')); + + $core->readImageBlob($binary); + + } catch (\ImagickException $e) { + throw new NotReadableException( + "Unable to read image from binary data.", + 0, + $e + ); + } + + // build image + $image = $this->initFromImagick($core); + $image->mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $binary); + + return $image; + } + + /** + * Turns object into one frame Imagick object + * by removing all frames except first + * + * @param Imagick $object + * @return Imagick + */ + private function removeAnimation(\Imagick $object) + { + $imagick = new \Imagick; + + foreach ($object as $frame) { + $imagick->addImage($frame->getImage()); + break; + } + + $object->destroy(); + + return $imagick; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Driver.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Driver.php new file mode 100644 index 00000000..bb26ca0f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Driver.php @@ -0,0 +1,74 @@ +coreAvailable()) { + throw new NotSupportedException( + "ImageMagick module not available with this PHP installation." + ); + } + + $this->decoder = $decoder ? $decoder : new Decoder; + $this->encoder = $encoder ? $encoder : new Encoder; + } + + /** + * Creates new image instance + * + * @param int $width + * @param int $height + * @param mixed $background + * @return \Intervention\Image\Image + */ + public function newImage($width, $height, $background = null) + { + $background = new Color($background); + + // create empty core + $core = new \Imagick; + $core->newImage($width, $height, $background->getPixel(), 'png'); + $core->setType(\Imagick::IMGTYPE_UNDEFINED); + $core->setImageType(\Imagick::IMGTYPE_UNDEFINED); + $core->setColorspace(\Imagick::COLORSPACE_UNDEFINED); + + // build image + $image = new Image(new static, $core); + + return $image; + } + + /** + * Reads given string into color object + * + * @param string $value + * @return AbstractColor + */ + public function parseColor($value) + { + return new Color($value); + } + + /** + * Checks if core module installation is available + * + * @return boolean + */ + protected function coreAvailable() + { + return (extension_loaded('imagick') && class_exists('Imagick')); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Encoder.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Encoder.php new file mode 100644 index 00000000..feb8a9d5 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Encoder.php @@ -0,0 +1,239 @@ +image->getCore(); + $imagick->setImageBackgroundColor('white'); + $imagick->setBackgroundColor('white'); + $imagick = $imagick->mergeImageLayers(\Imagick::LAYERMETHOD_MERGE); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as PNG string + * + * @return string + */ + protected function processPng() + { + $format = 'png'; + $compression = \Imagick::COMPRESSION_ZIP; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + $this->image->mime = image_type_to_mime_type(IMAGETYPE_PNG); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as GIF string + * + * @return string + */ + protected function processGif() + { + $format = 'gif'; + $compression = \Imagick::COMPRESSION_LZW; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + $this->image->mime = image_type_to_mime_type(IMAGETYPE_GIF); + + return $imagick->getImagesBlob(); + } + + protected function processWebp() + { + if ( ! \Imagick::queryFormats('WEBP')) { + throw new NotSupportedException( + "Webp format is not supported by Imagick installation." + ); + } + + $format = 'webp'; + $compression = \Imagick::COMPRESSION_JPEG; + + $imagick = $this->image->getCore(); + $imagick->setImageBackgroundColor(new \ImagickPixel('transparent')); + + $imagick = $imagick->mergeImageLayers(\Imagick::LAYERMETHOD_MERGE); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setImageCompressionQuality($this->quality); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as TIFF string + * + * @return string + */ + protected function processTiff() + { + $format = 'tiff'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + + $this->image->mime = image_type_to_mime_type(IMAGETYPE_TIFF_II); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as BMP string + * + * @return string + */ + protected function processBmp() + { + $format = 'bmp'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + $this->image->mime = image_type_to_mime_type(IMAGETYPE_BMP); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as ICO string + * + * @return string + */ + protected function processIco() + { + $format = 'ico'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + $this->image->mime = image_type_to_mime_type(IMAGETYPE_ICO); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as PSD string + * + * @return string + */ + protected function processPsd() + { + $format = 'psd'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + $this->image->mime = image_type_to_mime_type(IMAGETYPE_PSD); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as AVIF string + * + * @return string + */ + protected function processAvif() + { + if ( ! \Imagick::queryFormats('AVIF')) { + throw new NotSupportedException( + "AVIF format is not supported by Imagick installation." + ); + } + + $format = 'avif'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as HEIC string + * + * @return string + */ + protected function processHeic() + { + if ( ! \Imagick::queryFormats('HEIC')) { + throw new NotSupportedException( + "HEIC format is not supported by Imagick installation." + ); + } + + $format = 'heic'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + + return $imagick->getImagesBlob(); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Font.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Font.php new file mode 100644 index 00000000..9869d067 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Font.php @@ -0,0 +1,122 @@ +setStrokeAntialias(true); + $draw->setTextAntialias(true); + + // set font file + if ($this->hasApplicableFontFile()) { + $draw->setFont($this->file); + } else { + throw new RuntimeException( + "Font file must be provided to apply text to image." + ); + } + + // parse text color + $color = new Color($this->color); + + $draw->setFontSize($this->size); + $draw->setFillColor($color->getPixel()); + $draw->setTextKerning($this->kerning); + + // align horizontal + switch (strtolower($this->align)) { + case 'center': + $align = \Imagick::ALIGN_CENTER; + break; + + case 'right': + $align = \Imagick::ALIGN_RIGHT; + break; + + default: + $align = \Imagick::ALIGN_LEFT; + break; + } + + $draw->setTextAlignment($align); + + // align vertical + if (strtolower($this->valign) != 'bottom') { + + // corrections on y-position + switch (strtolower($this->valign)) { + case 'center': + case 'middle': + // calculate box size + $dimensions = $image->getCore()->queryFontMetrics($draw, $this->text); + $posy = $posy + $dimensions['textHeight'] * 0.65 / 2; + break; + + case 'top': + // calculate box size + $dimensions = $image->getCore()->queryFontMetrics($draw, $this->text, false); + $posy = $posy + $dimensions['characterHeight']; + break; + } + } + + // apply to image + $image->getCore()->annotateImage($draw, $posx, $posy, $this->angle * (-1), $this->text); + } + + /** + * Calculates bounding box of current font setting + * + * @return array + */ + public function getBoxSize() + { + $box = []; + + // build draw object + $draw = new \ImagickDraw(); + $draw->setStrokeAntialias(true); + $draw->setTextAntialias(true); + + // set font file + if ($this->hasApplicableFontFile()) { + $draw->setFont($this->file); + } else { + throw new RuntimeException( + "Font file must be provided to apply text to image." + ); + } + + $draw->setFontSize($this->size); + + $dimensions = (new \Imagick())->queryFontMetrics($draw, $this->text); + + if (strlen($this->text) == 0) { + // no text -> no boxsize + $box['width'] = 0; + $box['height'] = 0; + } else { + // get boxsize + $box['width'] = intval(abs($dimensions['textWidth'])); + $box['height'] = intval(abs($dimensions['textHeight'])); + } + + return $box; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php new file mode 100644 index 00000000..24172ea1 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php @@ -0,0 +1,40 @@ +width = is_numeric($diameter) ? intval($diameter) : $this->diameter; + $this->height = is_numeric($diameter) ? intval($diameter) : $this->diameter; + $this->diameter = is_numeric($diameter) ? intval($diameter) : $this->diameter; + } + + /** + * Draw current circle on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + return parent::applyToImage($image, $x, $y); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/EllipseShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/EllipseShape.php new file mode 100644 index 00000000..99694b97 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/EllipseShape.php @@ -0,0 +1,66 @@ +width = is_numeric($width) ? intval($width) : $this->width; + $this->height = is_numeric($height) ? intval($height) : $this->height; + } + + /** + * Draw ellipse instance on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $circle = new \ImagickDraw; + + // set background + $bgcolor = new Color($this->background); + $circle->setFillColor($bgcolor->getPixel()); + + // set border + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + $circle->setStrokeWidth($this->border_width); + $circle->setStrokeColor($border_color->getPixel()); + } + + $circle->ellipse($x, $y, $this->width / 2, $this->height / 2, 0, 360); + + $image->getCore()->drawImage($circle); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/LineShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/LineShape.php new file mode 100644 index 00000000..0d6b3297 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/LineShape.php @@ -0,0 +1,94 @@ +x = is_numeric($x) ? intval($x) : $this->x; + $this->y = is_numeric($y) ? intval($y) : $this->y; + } + + /** + * Set current line color + * + * @param string $color + * @return void + */ + public function color($color) + { + $this->color = $color; + } + + /** + * Set current line width in pixels + * + * @param int $width + * @return void + */ + public function width($width) + { + $this->width = $width; + } + + /** + * Draw current instance of line to given endpoint on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $line = new \ImagickDraw; + + $color = new Color($this->color); + $line->setStrokeColor($color->getPixel()); + $line->setStrokeWidth($this->width); + + $line->line($this->x, $this->y, $x, $y); + $image->getCore()->drawImage($line); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/PolygonShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/PolygonShape.php new file mode 100644 index 00000000..45f44ad8 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/PolygonShape.php @@ -0,0 +1,81 @@ +points = $this->formatPoints($points); + } + + /** + * Draw polygon on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $polygon = new \ImagickDraw; + + // set background + $bgcolor = new Color($this->background); + $polygon->setFillColor($bgcolor->getPixel()); + + // set border + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + $polygon->setStrokeWidth($this->border_width); + $polygon->setStrokeColor($border_color->getPixel()); + } + + $polygon->polygon($this->points); + + $image->getCore()->drawImage($polygon); + + return true; + } + + /** + * Format polygon points to Imagick format + * + * @param Array $points + * @return Array + */ + private function formatPoints($points) + { + $ipoints = []; + $count = 1; + + foreach ($points as $key => $value) { + if ($count%2 === 0) { + $y = $value; + $ipoints[] = ['x' => $x, 'y' => $y]; + } else { + $x = $value; + } + $count++; + } + + return $ipoints; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/RectangleShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/RectangleShape.php new file mode 100644 index 00000000..1166d77b --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/RectangleShape.php @@ -0,0 +1,84 @@ +x1 = is_numeric($x1) ? intval($x1) : $this->x1; + $this->y1 = is_numeric($y1) ? intval($y1) : $this->y1; + $this->x2 = is_numeric($x2) ? intval($x2) : $this->x2; + $this->y2 = is_numeric($y2) ? intval($y2) : $this->y2; + } + + /** + * Draw rectangle to given image at certain position + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $rectangle = new \ImagickDraw; + + // set background + $bgcolor = new Color($this->background); + $rectangle->setFillColor($bgcolor->getPixel()); + + // set border + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + $rectangle->setStrokeWidth($this->border_width); + $rectangle->setStrokeColor($border_color->getPixel()); + } + + $rectangle->rectangle($this->x1, $this->y1, $this->x2, $this->y2); + + $image->getCore()->drawImage($rectangle); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Point.php b/vendor/intervention/image/src/Intervention/Image/Point.php new file mode 100644 index 00000000..d51452e0 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Point.php @@ -0,0 +1,64 @@ +x = is_numeric($x) ? intval($x) : 0; + $this->y = is_numeric($y) ? intval($y) : 0; + } + + /** + * Sets X coordinate + * + * @param int $x + */ + public function setX($x) + { + $this->x = intval($x); + } + + /** + * Sets Y coordinate + * + * @param int $y + */ + public function setY($y) + { + $this->y = intval($y); + } + + /** + * Sets both X and Y coordinate + * + * @param int $x + * @param int $y + */ + public function setPosition($x, $y) + { + $this->setX($x); + $this->setY($y); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Response.php b/vendor/intervention/image/src/Intervention/Image/Response.php new file mode 100644 index 00000000..59a51e99 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Response.php @@ -0,0 +1,78 @@ +image = $image; + $this->format = $format ? $format : $image->mime; + $this->quality = $quality ? $quality : 90; + } + + /** + * Builds response according to settings + * + * @return mixed + */ + public function make() + { + $this->image->encode($this->format, $this->quality); + $data = $this->image->getEncoded(); + $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data); + $length = strlen($data); + + if (function_exists('app') && is_a($app = app(), 'Illuminate\Foundation\Application')) { + + $response = IlluminateResponse::make($data); + $response->header('Content-Type', $mime); + $response->header('Content-Length', $length); + + } elseif (class_exists('\Symfony\Component\HttpFoundation\Response')) { + + $response = new SymfonyResponse($data); + $response->headers->set('Content-Type', $mime); + $response->headers->set('Content-Length', $length); + + } else { + + header('Content-Type: ' . $mime); + header('Content-Length: ' . $length); + $response = $data; + } + + return $response; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Size.php b/vendor/intervention/image/src/Intervention/Image/Size.php new file mode 100644 index 00000000..f8b6dc8e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Size.php @@ -0,0 +1,374 @@ +width = is_numeric($width) ? intval($width) : 1; + $this->height = is_numeric($height) ? intval($height) : 1; + $this->pivot = $pivot ? $pivot : new Point; + } + + /** + * Set the width and height absolutely + * + * @param int $width + * @param int $height + */ + public function set($width, $height) + { + $this->width = $width; + $this->height = $height; + } + + /** + * Set current pivot point + * + * @param Point $point + */ + public function setPivot(Point $point) + { + $this->pivot = $point; + } + + /** + * Get the current width + * + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * Get the current height + * + * @return int + */ + public function getHeight() + { + return $this->height; + } + + /** + * Calculate the current aspect ratio + * + * @return float + */ + public function getRatio() + { + return $this->width / $this->height; + } + + /** + * Resize to desired width and/or height + * + * @param int $width + * @param int $height + * @param Closure $callback + * @return Size + */ + public function resize($width, $height, Closure $callback = null) + { + if (is_null($width) && is_null($height)) { + throw new InvalidArgumentException( + "Width or height needs to be defined." + ); + } + + // new size with dominant width + $dominant_w_size = clone $this; + $dominant_w_size->resizeHeight($height, $callback); + $dominant_w_size->resizeWidth($width, $callback); + + // new size with dominant height + $dominant_h_size = clone $this; + $dominant_h_size->resizeWidth($width, $callback); + $dominant_h_size->resizeHeight($height, $callback); + + // decide which size to use + if ($dominant_h_size->fitsInto(new self($width, $height))) { + $this->set($dominant_h_size->width, $dominant_h_size->height); + } else { + $this->set($dominant_w_size->width, $dominant_w_size->height); + } + + return $this; + } + + /** + * Scale size according to given constraints + * + * @param int $width + * @param Closure $callback + * @return Size + */ + private function resizeWidth($width, Closure $callback = null) + { + $constraint = $this->getConstraint($callback); + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $max_width = $constraint->getSize()->getWidth(); + $max_height = $constraint->getSize()->getHeight(); + } + + if (is_numeric($width)) { + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $this->width = ($width > $max_width) ? $max_width : $width; + } else { + $this->width = $width; + } + + if ($constraint->isFixed(Constraint::ASPECTRATIO)) { + $h = max(1, intval(round($this->width / $constraint->getSize()->getRatio()))); + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $this->height = ($h > $max_height) ? $max_height : $h; + } else { + $this->height = $h; + } + } + } + } + + /** + * Scale size according to given constraints + * + * @param int $height + * @param Closure $callback + * @return Size + */ + private function resizeHeight($height, Closure $callback = null) + { + $constraint = $this->getConstraint($callback); + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $max_width = $constraint->getSize()->getWidth(); + $max_height = $constraint->getSize()->getHeight(); + } + + if (is_numeric($height)) { + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $this->height = ($height > $max_height) ? $max_height : $height; + } else { + $this->height = $height; + } + + if ($constraint->isFixed(Constraint::ASPECTRATIO)) { + $w = max(1, intval(round($this->height * $constraint->getSize()->getRatio()))); + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $this->width = ($w > $max_width) ? $max_width : $w; + } else { + $this->width = $w; + } + } + } + } + + /** + * Calculate the relative position to another Size + * based on the pivot point settings of both sizes. + * + * @param Size $size + * @return \Intervention\Image\Point + */ + public function relativePosition(Size $size) + { + $x = $this->pivot->x - $size->pivot->x; + $y = $this->pivot->y - $size->pivot->y; + + return new Point($x, $y); + } + + /** + * Resize given Size to best fitting size of current size. + * + * @param Size $size + * @return \Intervention\Image\Size + */ + public function fit(Size $size, $position = 'center') + { + // create size with auto height + $auto_height = clone $size; + + $auto_height->resize($this->width, null, function ($constraint) { + $constraint->aspectRatio(); + }); + + // decide which version to use + if ($auto_height->fitsInto($this)) { + + $size = $auto_height; + + } else { + + // create size with auto width + $auto_width = clone $size; + + $auto_width->resize(null, $this->height, function ($constraint) { + $constraint->aspectRatio(); + }); + + $size = $auto_width; + } + + $this->align($position); + $size->align($position); + $size->setPivot($this->relativePosition($size)); + + return $size; + } + + /** + * Checks if given size fits into current size + * + * @param Size $size + * @return boolean + */ + public function fitsInto(Size $size) + { + return ($this->width <= $size->width) && ($this->height <= $size->height); + } + + /** + * Aligns current size's pivot point to given position + * and moves point automatically by offset. + * + * @param string $position + * @param int $offset_x + * @param int $offset_y + * @return \Intervention\Image\Size + */ + public function align($position, $offset_x = 0, $offset_y = 0) + { + switch (strtolower($position)) { + + case 'top': + case 'top-center': + case 'top-middle': + case 'center-top': + case 'middle-top': + $x = intval($this->width / 2); + $y = 0 + $offset_y; + break; + + case 'top-right': + case 'right-top': + $x = $this->width - $offset_x; + $y = 0 + $offset_y; + break; + + case 'left': + case 'left-center': + case 'left-middle': + case 'center-left': + case 'middle-left': + $x = 0 + $offset_x; + $y = intval($this->height / 2); + break; + + case 'right': + case 'right-center': + case 'right-middle': + case 'center-right': + case 'middle-right': + $x = $this->width - $offset_x; + $y = intval($this->height / 2); + break; + + case 'bottom-left': + case 'left-bottom': + $x = 0 + $offset_x; + $y = $this->height - $offset_y; + break; + + case 'bottom': + case 'bottom-center': + case 'bottom-middle': + case 'center-bottom': + case 'middle-bottom': + $x = intval($this->width / 2); + $y = $this->height - $offset_y; + break; + + case 'bottom-right': + case 'right-bottom': + $x = $this->width - $offset_x; + $y = $this->height - $offset_y; + break; + + case 'center': + case 'middle': + case 'center-center': + case 'middle-middle': + $x = intval($this->width / 2) + $offset_x; + $y = intval($this->height / 2) + $offset_y; + break; + + default: + case 'top-left': + case 'left-top': + $x = 0 + $offset_x; + $y = 0 + $offset_y; + break; + } + + $this->pivot->setPosition($x, $y); + + return $this; + } + + /** + * Runs constraints on current size + * + * @param Closure $callback + * @return \Intervention\Image\Constraint + */ + private function getConstraint(Closure $callback = null) + { + $constraint = new Constraint(clone $this); + + if (is_callable($callback)) { + $callback($constraint); + } + + return $constraint; + } +} diff --git a/vendor/intervention/image/src/config/config.php b/vendor/intervention/image/src/config/config.php new file mode 100644 index 00000000..2b1d2c3e --- /dev/null +++ b/vendor/intervention/image/src/config/config.php @@ -0,0 +1,20 @@ + 'gd' + +]; diff --git a/vendor/laravel/framework/LICENSE.md b/vendor/laravel/framework/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/README.md b/vendor/laravel/framework/README.md new file mode 100644 index 00000000..ef4bc184 --- /dev/null +++ b/vendor/laravel/framework/README.md @@ -0,0 +1,45 @@ +

+ +

+Build Status +Total Downloads +Latest Stable Version +License +

+ +## About Laravel + +> **Note:** This repository contains the core code of the Laravel framework. If you want to build an application using Laravel, visit the main [Laravel repository](https://github.com/laravel/laravel). + +Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as: + +- [Simple, fast routing engine](https://laravel.com/docs/routing). +- [Powerful dependency injection container](https://laravel.com/docs/container). +- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. +- Database agnostic [schema migrations](https://laravel.com/docs/migrations). +- [Robust background job processing](https://laravel.com/docs/queues). +- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). + +Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation gives you a complete toolset required to build any application with which you are tasked. + +## Learning Laravel + +Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework. The [Laravel documentation](https://laravel.com/docs) is in-depth and complete, making it a breeze to get started learning the framework. + +If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 1100 video tutorials covering a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library. + +## Contributing + +Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). + +## Code of Conduct + +In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). + +## Security Vulnerabilities + +Please review [our security policy](https://github.com/laravel/framework/security/policy) on how to report security vulnerabilities. + +## License + +The Laravel framework is open-sourced software licensed under the [MIT license](LICENSE.md). diff --git a/vendor/laravel/framework/composer.json b/vendor/laravel/framework/composer.json new file mode 100644 index 00000000..e32e0591 --- /dev/null +++ b/vendor/laravel/framework/composer.json @@ -0,0 +1,146 @@ +{ + "name": "laravel/framework", + "description": "The Laravel Framework.", + "keywords": ["framework", "laravel"], + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "doctrine/inflector": "^1.4|^2.0", + "dragonmantank/cron-expression": "^2.3.1", + "egulias/email-validator": "^2.1.10", + "league/commonmark": "^1.3", + "league/flysystem": "^1.1", + "monolog/monolog": "^1.12|^2.0", + "nesbot/carbon": "^2.31", + "opis/closure": "^3.6", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0", + "ramsey/uuid": "^3.7", + "swiftmailer/swiftmailer": "^6.0", + "symfony/console": "^4.3.4", + "symfony/debug": "^4.3.4", + "symfony/finder": "^4.3.4", + "symfony/http-foundation": "^4.3.4", + "symfony/http-kernel": "^4.3.4", + "symfony/polyfill-php73": "^1.17", + "symfony/process": "^4.3.4", + "symfony/routing": "^4.3.4", + "symfony/var-dumper": "^4.3.4", + "tijsverkoyen/css-to-inline-styles": "^2.2.1", + "vlucas/phpdotenv": "^3.3" + }, + "replace": { + "illuminate/auth": "self.version", + "illuminate/broadcasting": "self.version", + "illuminate/bus": "self.version", + "illuminate/cache": "self.version", + "illuminate/config": "self.version", + "illuminate/console": "self.version", + "illuminate/container": "self.version", + "illuminate/contracts": "self.version", + "illuminate/cookie": "self.version", + "illuminate/database": "self.version", + "illuminate/encryption": "self.version", + "illuminate/events": "self.version", + "illuminate/filesystem": "self.version", + "illuminate/hashing": "self.version", + "illuminate/http": "self.version", + "illuminate/log": "self.version", + "illuminate/mail": "self.version", + "illuminate/notifications": "self.version", + "illuminate/pagination": "self.version", + "illuminate/pipeline": "self.version", + "illuminate/queue": "self.version", + "illuminate/redis": "self.version", + "illuminate/routing": "self.version", + "illuminate/session": "self.version", + "illuminate/support": "self.version", + "illuminate/translation": "self.version", + "illuminate/validation": "self.version", + "illuminate/view": "self.version" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.155", + "doctrine/dbal": "^2.6", + "filp/whoops": "^2.8", + "guzzlehttp/guzzle": "^6.3.1|^7.0.1", + "league/flysystem-cached-adapter": "^1.0", + "mockery/mockery": "~1.3.3|^1.4.2", + "moontoast/math": "^1.1", + "orchestra/testbench-core": "^4.8", + "pda/pheanstalk": "^4.0", + "phpunit/phpunit": "^7.5.15|^8.4|^9.3.3", + "predis/predis": "^1.1.1", + "symfony/cache": "^4.3.4" + }, + "autoload": { + "files": [ + "src/Illuminate/Foundation/helpers.php", + "src/Illuminate/Support/helpers.php" + ], + "psr-4": { + "Illuminate\\": "src/Illuminate/" + } + }, + "autoload-dev": { + "files": [ + "tests/Database/stubs/MigrationCreatorFakeMigration.php" + ], + "psr-4": { + "Illuminate\\Tests\\": "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "suggest": { + "ext-ftp": "Required to use the Flysystem FTP driver.", + "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", + "ext-memcached": "Required to use the memcache cache driver.", + "ext-pcntl": "Required to use all features of the queue worker.", + "ext-posix": "Required to use all features of the queue worker.", + "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", + "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.155).", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "filp/whoops": "Required for friendly error pages in development (^2.8).", + "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", + "guzzlehttp/guzzle": "Required to use the Mailgun mail driver and the ping methods on schedules (^6.3.1|^7.0.1).", + "laravel/tinker": "Required to use the tinker console command (^2.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", + "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", + "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).", + "predis/predis": "Required to use the predis connector (^1.1.2).", + "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0).", + "symfony/cache": "Required to PSR-6 cache bridge (^4.3.4).", + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^1.2).", + "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Access/AuthorizationException.php b/vendor/laravel/framework/src/Illuminate/Auth/Access/AuthorizationException.php new file mode 100644 index 00000000..126da306 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Access/AuthorizationException.php @@ -0,0 +1,63 @@ +code = $code ?: 0; + } + + /** + * Get the response from the gate. + * + * @return \Illuminate\Auth\Access\Response + */ + public function response() + { + return $this->response; + } + + /** + * Set the response from the gate. + * + * @param \Illuminate\Auth\Access\Response $response + * @return $this + */ + public function setResponse($response) + { + $this->response = $response; + + return $this; + } + + /** + * Create a deny response object from this exception. + * + * @return \Illuminate\Auth\Access\Response + */ + public function toResponse() + { + return Response::deny($this->message, $this->code); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php b/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php new file mode 100644 index 00000000..9cc70156 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php @@ -0,0 +1,769 @@ +policies = $policies; + $this->container = $container; + $this->abilities = $abilities; + $this->userResolver = $userResolver; + $this->afterCallbacks = $afterCallbacks; + $this->beforeCallbacks = $beforeCallbacks; + $this->guessPolicyNamesUsingCallback = $guessPolicyNamesUsingCallback; + } + + /** + * Determine if a given ability has been defined. + * + * @param string|array $ability + * @return bool + */ + public function has($ability) + { + $abilities = is_array($ability) ? $ability : func_get_args(); + + foreach ($abilities as $ability) { + if (! isset($this->abilities[$ability])) { + return false; + } + } + + return true; + } + + /** + * Define a new ability. + * + * @param string $ability + * @param callable|string $callback + * @return $this + * + * @throws \InvalidArgumentException + */ + public function define($ability, $callback) + { + if (is_callable($callback)) { + $this->abilities[$ability] = $callback; + } elseif (is_string($callback)) { + $this->stringCallbacks[$ability] = $callback; + + $this->abilities[$ability] = $this->buildAbilityCallback($ability, $callback); + } else { + throw new InvalidArgumentException("Callback must be a callable or a 'Class@method' string."); + } + + return $this; + } + + /** + * Define abilities for a resource. + * + * @param string $name + * @param string $class + * @param array|null $abilities + * @return $this + */ + public function resource($name, $class, array $abilities = null) + { + $abilities = $abilities ?: [ + 'viewAny' => 'viewAny', + 'view' => 'view', + 'create' => 'create', + 'update' => 'update', + 'delete' => 'delete', + ]; + + foreach ($abilities as $ability => $method) { + $this->define($name.'.'.$ability, $class.'@'.$method); + } + + return $this; + } + + /** + * Create the ability callback for a callback string. + * + * @param string $ability + * @param string $callback + * @return \Closure + */ + protected function buildAbilityCallback($ability, $callback) + { + return function () use ($ability, $callback) { + if (Str::contains($callback, '@')) { + [$class, $method] = Str::parseCallback($callback); + } else { + $class = $callback; + } + + $policy = $this->resolvePolicy($class); + + $arguments = func_get_args(); + + $user = array_shift($arguments); + + $result = $this->callPolicyBefore( + $policy, $user, $ability, $arguments + ); + + if (! is_null($result)) { + return $result; + } + + return isset($method) + ? $policy->{$method}(...func_get_args()) + : $policy(...func_get_args()); + }; + } + + /** + * Define a policy class for a given class type. + * + * @param string $class + * @param string $policy + * @return $this + */ + public function policy($class, $policy) + { + $this->policies[$class] = $policy; + + return $this; + } + + /** + * Register a callback to run before all Gate checks. + * + * @param callable $callback + * @return $this + */ + public function before(callable $callback) + { + $this->beforeCallbacks[] = $callback; + + return $this; + } + + /** + * Register a callback to run after all Gate checks. + * + * @param callable $callback + * @return $this + */ + public function after(callable $callback) + { + $this->afterCallbacks[] = $callback; + + return $this; + } + + /** + * Determine if the given ability should be granted for the current user. + * + * @param string $ability + * @param array|mixed $arguments + * @return bool + */ + public function allows($ability, $arguments = []) + { + return $this->check($ability, $arguments); + } + + /** + * Determine if the given ability should be denied for the current user. + * + * @param string $ability + * @param array|mixed $arguments + * @return bool + */ + public function denies($ability, $arguments = []) + { + return ! $this->allows($ability, $arguments); + } + + /** + * Determine if all of the given abilities should be granted for the current user. + * + * @param iterable|string $abilities + * @param array|mixed $arguments + * @return bool + */ + public function check($abilities, $arguments = []) + { + return collect($abilities)->every(function ($ability) use ($arguments) { + return $this->inspect($ability, $arguments)->allowed(); + }); + } + + /** + * Determine if any one of the given abilities should be granted for the current user. + * + * @param iterable|string $abilities + * @param array|mixed $arguments + * @return bool + */ + public function any($abilities, $arguments = []) + { + return collect($abilities)->contains(function ($ability) use ($arguments) { + return $this->check($ability, $arguments); + }); + } + + /** + * Determine if all of the given abilities should be denied for the current user. + * + * @param iterable|string $abilities + * @param array|mixed $arguments + * @return bool + */ + public function none($abilities, $arguments = []) + { + return ! $this->any($abilities, $arguments); + } + + /** + * Determine if the given ability should be granted for the current user. + * + * @param string $ability + * @param array|mixed $arguments + * @return \Illuminate\Auth\Access\Response + * + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function authorize($ability, $arguments = []) + { + return $this->inspect($ability, $arguments)->authorize(); + } + + /** + * Inspect the user for the given ability. + * + * @param string $ability + * @param array|mixed $arguments + * @return \Illuminate\Auth\Access\Response + */ + public function inspect($ability, $arguments = []) + { + try { + $result = $this->raw($ability, $arguments); + + if ($result instanceof Response) { + return $result; + } + + return $result ? Response::allow() : Response::deny(); + } catch (AuthorizationException $e) { + return $e->toResponse(); + } + } + + /** + * Get the raw result from the authorization callback. + * + * @param string $ability + * @param array|mixed $arguments + * @return mixed + * + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function raw($ability, $arguments = []) + { + $arguments = Arr::wrap($arguments); + + $user = $this->resolveUser(); + + // First we will call the "before" callbacks for the Gate. If any of these give + // back a non-null response, we will immediately return that result in order + // to let the developers override all checks for some authorization cases. + $result = $this->callBeforeCallbacks( + $user, $ability, $arguments + ); + + if (is_null($result)) { + $result = $this->callAuthCallback($user, $ability, $arguments); + } + + // After calling the authorization callback, we will call the "after" callbacks + // that are registered with the Gate, which allows a developer to do logging + // if that is required for this application. Then we'll return the result. + return $this->callAfterCallbacks( + $user, $ability, $arguments, $result + ); + } + + /** + * Determine whether the callback/method can be called with the given user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + * @param \Closure|string|array $class + * @param string|null $method + * @return bool + */ + protected function canBeCalledWithUser($user, $class, $method = null) + { + if (! is_null($user)) { + return true; + } + + if (! is_null($method)) { + return $this->methodAllowsGuests($class, $method); + } + + if (is_array($class)) { + $className = is_string($class[0]) ? $class[0] : get_class($class[0]); + + return $this->methodAllowsGuests($className, $class[1]); + } + + return $this->callbackAllowsGuests($class); + } + + /** + * Determine if the given class method allows guests. + * + * @param string $class + * @param string $method + * @return bool + */ + protected function methodAllowsGuests($class, $method) + { + try { + $reflection = new ReflectionClass($class); + + $method = $reflection->getMethod($method); + } catch (Exception $e) { + return false; + } + + if ($method) { + $parameters = $method->getParameters(); + + return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]); + } + + return false; + } + + /** + * Determine if the callback allows guests. + * + * @param callable $callback + * @return bool + * + * @throws \ReflectionException + */ + protected function callbackAllowsGuests($callback) + { + $parameters = (new ReflectionFunction($callback))->getParameters(); + + return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]); + } + + /** + * Determine if the given parameter allows guests. + * + * @param \ReflectionParameter $parameter + * @return bool + */ + protected function parameterAllowsGuests($parameter) + { + return ($parameter->hasType() && $parameter->allowsNull()) || + ($parameter->isDefaultValueAvailable() && is_null($parameter->getDefaultValue())); + } + + /** + * Resolve and call the appropriate authorization callback. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + * @param string $ability + * @param array $arguments + * @return bool + */ + protected function callAuthCallback($user, $ability, array $arguments) + { + $callback = $this->resolveAuthCallback($user, $ability, $arguments); + + return $callback($user, ...$arguments); + } + + /** + * Call all of the before callbacks and return if a result is given. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + * @param string $ability + * @param array $arguments + * @return bool|null + */ + protected function callBeforeCallbacks($user, $ability, array $arguments) + { + foreach ($this->beforeCallbacks as $before) { + if (! $this->canBeCalledWithUser($user, $before)) { + continue; + } + + if (! is_null($result = $before($user, $ability, $arguments))) { + return $result; + } + } + } + + /** + * Call all of the after callbacks with check result. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $ability + * @param array $arguments + * @param bool $result + * @return bool|null + */ + protected function callAfterCallbacks($user, $ability, array $arguments, $result) + { + foreach ($this->afterCallbacks as $after) { + if (! $this->canBeCalledWithUser($user, $after)) { + continue; + } + + $afterResult = $after($user, $ability, $result, $arguments); + + $result = $result ?? $afterResult; + } + + return $result; + } + + /** + * Resolve the callable for the given ability and arguments. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + * @param string $ability + * @param array $arguments + * @return callable + */ + protected function resolveAuthCallback($user, $ability, array $arguments) + { + if (isset($arguments[0]) && + ! is_null($policy = $this->getPolicyFor($arguments[0])) && + $callback = $this->resolvePolicyCallback($user, $ability, $arguments, $policy)) { + return $callback; + } + + if (isset($this->stringCallbacks[$ability])) { + [$class, $method] = Str::parseCallback($this->stringCallbacks[$ability]); + + if ($this->canBeCalledWithUser($user, $class, $method ?: '__invoke')) { + return $this->abilities[$ability]; + } + } + + if (isset($this->abilities[$ability]) && + $this->canBeCalledWithUser($user, $this->abilities[$ability])) { + return $this->abilities[$ability]; + } + + return function () { + // + }; + } + + /** + * Get a policy instance for a given class. + * + * @param object|string $class + * @return mixed + */ + public function getPolicyFor($class) + { + if (is_object($class)) { + $class = get_class($class); + } + + if (! is_string($class)) { + return; + } + + if (isset($this->policies[$class])) { + return $this->resolvePolicy($this->policies[$class]); + } + + foreach ($this->guessPolicyName($class) as $guessedPolicy) { + if (class_exists($guessedPolicy)) { + return $this->resolvePolicy($guessedPolicy); + } + } + + foreach ($this->policies as $expected => $policy) { + if (is_subclass_of($class, $expected)) { + return $this->resolvePolicy($policy); + } + } + } + + /** + * Guess the policy name for the given class. + * + * @param string $class + * @return array + */ + protected function guessPolicyName($class) + { + if ($this->guessPolicyNamesUsingCallback) { + return Arr::wrap(call_user_func($this->guessPolicyNamesUsingCallback, $class)); + } + + $classDirname = str_replace('/', '\\', dirname(str_replace('\\', '/', $class))); + + return [$classDirname.'\\Policies\\'.class_basename($class).'Policy']; + } + + /** + * Specify a callback to be used to guess policy names. + * + * @param callable $callback + * @return $this + */ + public function guessPolicyNamesUsing(callable $callback) + { + $this->guessPolicyNamesUsingCallback = $callback; + + return $this; + } + + /** + * Build a policy class instance of the given type. + * + * @param object|string $class + * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + public function resolvePolicy($class) + { + return $this->container->make($class); + } + + /** + * Resolve the callback for a policy check. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $ability + * @param array $arguments + * @param mixed $policy + * @return bool|callable + */ + protected function resolvePolicyCallback($user, $ability, array $arguments, $policy) + { + if (! is_callable([$policy, $this->formatAbilityToMethod($ability)])) { + return false; + } + + return function () use ($user, $ability, $arguments, $policy) { + // This callback will be responsible for calling the policy's before method and + // running this policy method if necessary. This is used to when objects are + // mapped to policy objects in the user's configurations or on this class. + $result = $this->callPolicyBefore( + $policy, $user, $ability, $arguments + ); + + // When we receive a non-null result from this before method, we will return it + // as the "final" results. This will allow developers to override the checks + // in this policy to return the result for all rules defined in the class. + if (! is_null($result)) { + return $result; + } + + $method = $this->formatAbilityToMethod($ability); + + return $this->callPolicyMethod($policy, $method, $user, $arguments); + }; + } + + /** + * Call the "before" method on the given policy, if applicable. + * + * @param mixed $policy + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $ability + * @param array $arguments + * @return mixed + */ + protected function callPolicyBefore($policy, $user, $ability, $arguments) + { + if (! method_exists($policy, 'before')) { + return; + } + + if ($this->canBeCalledWithUser($user, $policy, 'before')) { + return $policy->before($user, $ability, ...$arguments); + } + } + + /** + * Call the appropriate method on the given policy. + * + * @param mixed $policy + * @param string $method + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + * @param array $arguments + * @return mixed + */ + protected function callPolicyMethod($policy, $method, $user, array $arguments) + { + // If this first argument is a string, that means they are passing a class name + // to the policy. We will remove the first argument from this argument array + // because this policy already knows what type of models it can authorize. + if (isset($arguments[0]) && is_string($arguments[0])) { + array_shift($arguments); + } + + if (! is_callable([$policy, $method])) { + return; + } + + if ($this->canBeCalledWithUser($user, $policy, $method)) { + return $policy->{$method}($user, ...$arguments); + } + } + + /** + * Format the policy ability into a method name. + * + * @param string $ability + * @return string + */ + protected function formatAbilityToMethod($ability) + { + return strpos($ability, '-') !== false ? Str::camel($ability) : $ability; + } + + /** + * Get a gate instance for the given user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user + * @return static + */ + public function forUser($user) + { + $callback = function () use ($user) { + return $user; + }; + + return new static( + $this->container, $callback, $this->abilities, + $this->policies, $this->beforeCallbacks, $this->afterCallbacks, + $this->guessPolicyNamesUsingCallback + ); + } + + /** + * Resolve the user from the user resolver. + * + * @return mixed + */ + protected function resolveUser() + { + return call_user_func($this->userResolver); + } + + /** + * Get all of the defined abilities. + * + * @return array + */ + public function abilities() + { + return $this->abilities; + } + + /** + * Get all of the defined policies. + * + * @return array + */ + public function policies() + { + return $this->policies; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php b/vendor/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php new file mode 100644 index 00000000..66e5786e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php @@ -0,0 +1,30 @@ +code = $code; + $this->allowed = $allowed; + $this->message = $message; + } + + /** + * Create a new "allow" Response. + * + * @param string|null $message + * @param mixed $code + * @return \Illuminate\Auth\Access\Response + */ + public static function allow($message = null, $code = null) + { + return new static(true, $message, $code); + } + + /** + * Create a new "deny" Response. + * + * @param string|null $message + * @param mixed $code + * @return \Illuminate\Auth\Access\Response + */ + public static function deny($message = null, $code = null) + { + return new static(false, $message, $code); + } + + /** + * Determine if the response was allowed. + * + * @return bool + */ + public function allowed() + { + return $this->allowed; + } + + /** + * Determine if the response was denied. + * + * @return bool + */ + public function denied() + { + return ! $this->allowed(); + } + + /** + * Get the response message. + * + * @return string|null + */ + public function message() + { + return $this->message; + } + + /** + * Get the response code / reason. + * + * @return mixed + */ + public function code() + { + return $this->code; + } + + /** + * Throw authorization exception if response was denied. + * + * @return \Illuminate\Auth\Access\Response + * + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function authorize() + { + if ($this->denied()) { + throw (new AuthorizationException($this->message(), $this->code())) + ->setResponse($this); + } + + return $this; + } + + /** + * Convert the response to an array. + * + * @return array + */ + public function toArray() + { + return [ + 'allowed' => $this->allowed(), + 'message' => $this->message(), + 'code' => $this->code(), + ]; + } + + /** + * Get the string representation of the message. + * + * @return string + */ + public function __toString() + { + return (string) $this->message(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php b/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php new file mode 100755 index 00000000..ebbd7f5f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php @@ -0,0 +1,309 @@ +app = $app; + + $this->userResolver = function ($guard = null) { + return $this->guard($guard)->user(); + }; + } + + /** + * Attempt to get the guard from the local cache. + * + * @param string|null $name + * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard + */ + public function guard($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return $this->guards[$name] ?? $this->guards[$name] = $this->resolve($name); + } + + /** + * Resolve the given guard. + * + * @param string $name + * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (is_null($config)) { + throw new InvalidArgumentException("Auth guard [{$name}] is not defined."); + } + + if (isset($this->customCreators[$config['driver']])) { + return $this->callCustomCreator($name, $config); + } + + $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; + + if (method_exists($this, $driverMethod)) { + return $this->{$driverMethod}($name, $config); + } + + throw new InvalidArgumentException( + "Auth driver [{$config['driver']}] for guard [{$name}] is not defined." + ); + } + + /** + * Call a custom driver creator. + * + * @param string $name + * @param array $config + * @return mixed + */ + protected function callCustomCreator($name, array $config) + { + return $this->customCreators[$config['driver']]($this->app, $name, $config); + } + + /** + * Create a session based authentication guard. + * + * @param string $name + * @param array $config + * @return \Illuminate\Auth\SessionGuard + */ + public function createSessionDriver($name, $config) + { + $provider = $this->createUserProvider($config['provider'] ?? null); + + $guard = new SessionGuard($name, $provider, $this->app['session.store']); + + // When using the remember me functionality of the authentication services we + // will need to be set the encryption instance of the guard, which allows + // secure, encrypted cookie values to get generated for those cookies. + if (method_exists($guard, 'setCookieJar')) { + $guard->setCookieJar($this->app['cookie']); + } + + if (method_exists($guard, 'setDispatcher')) { + $guard->setDispatcher($this->app['events']); + } + + if (method_exists($guard, 'setRequest')) { + $guard->setRequest($this->app->refresh('request', $guard, 'setRequest')); + } + + return $guard; + } + + /** + * Create a token based authentication guard. + * + * @param string $name + * @param array $config + * @return \Illuminate\Auth\TokenGuard + */ + public function createTokenDriver($name, $config) + { + // The token guard implements a basic API token based guard implementation + // that takes an API token field from the request and matches it to the + // user in the database or another persistence layer where users are. + $guard = new TokenGuard( + $this->createUserProvider($config['provider'] ?? null), + $this->app['request'], + $config['input_key'] ?? 'api_token', + $config['storage_key'] ?? 'api_token', + $config['hash'] ?? false + ); + + $this->app->refresh('request', $guard, 'setRequest'); + + return $guard; + } + + /** + * Get the guard configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["auth.guards.{$name}"]; + } + + /** + * Get the default authentication driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['auth.defaults.guard']; + } + + /** + * Set the default guard driver the factory should serve. + * + * @param string $name + * @return void + */ + public function shouldUse($name) + { + $name = $name ?: $this->getDefaultDriver(); + + $this->setDefaultDriver($name); + + $this->userResolver = function ($name = null) { + return $this->guard($name)->user(); + }; + } + + /** + * Set the default authentication driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['auth.defaults.guard'] = $name; + } + + /** + * Register a new callback based request guard. + * + * @param string $driver + * @param callable $callback + * @return $this + */ + public function viaRequest($driver, callable $callback) + { + return $this->extend($driver, function () use ($callback) { + $guard = new RequestGuard($callback, $this->app['request'], $this->createUserProvider()); + + $this->app->refresh('request', $guard, 'setRequest'); + + return $guard; + }); + } + + /** + * Get the user resolver callback. + * + * @return \Closure + */ + public function userResolver() + { + return $this->userResolver; + } + + /** + * Set the callback to be used to resolve users. + * + * @param \Closure $userResolver + * @return $this + */ + public function resolveUsersUsing(Closure $userResolver) + { + $this->userResolver = $userResolver; + + return $this; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback; + + return $this; + } + + /** + * Register a custom provider creator Closure. + * + * @param string $name + * @param \Closure $callback + * @return $this + */ + public function provider($name, Closure $callback) + { + $this->customProviderCreators[$name] = $callback; + + return $this; + } + + /** + * Determines if any guards have already been resolved. + * + * @return bool + */ + public function hasResolvedGuards() + { + return count($this->guards) > 0; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->guard()->{$method}(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php new file mode 100755 index 00000000..7a6b4121 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php @@ -0,0 +1,132 @@ +registerAuthenticator(); + $this->registerUserResolver(); + $this->registerAccessGate(); + $this->registerRequirePassword(); + $this->registerRequestRebindHandler(); + $this->registerEventRebindHandler(); + } + + /** + * Register the authenticator services. + * + * @return void + */ + protected function registerAuthenticator() + { + $this->app->singleton('auth', function ($app) { + // Once the authentication service has actually been requested by the developer + // we will set a variable in the application indicating such. This helps us + // know that we need to set any queued cookies in the after event later. + $app['auth.loaded'] = true; + + return new AuthManager($app); + }); + + $this->app->singleton('auth.driver', function ($app) { + return $app['auth']->guard(); + }); + } + + /** + * Register a resolver for the authenticated user. + * + * @return void + */ + protected function registerUserResolver() + { + $this->app->bind( + AuthenticatableContract::class, function ($app) { + return call_user_func($app['auth']->userResolver()); + } + ); + } + + /** + * Register the access gate service. + * + * @return void + */ + protected function registerAccessGate() + { + $this->app->singleton(GateContract::class, function ($app) { + return new Gate($app, function () use ($app) { + return call_user_func($app['auth']->userResolver()); + }); + }); + } + + /** + * Register a resolver for the authenticated user. + * + * @return void + */ + protected function registerRequirePassword() + { + $this->app->bind( + RequirePassword::class, function ($app) { + return new RequirePassword( + $app[ResponseFactory::class], + $app[UrlGenerator::class], + $app['config']->get('auth.password_timeout') + ); + } + ); + } + + /** + * Handle the re-binding of the request binding. + * + * @return void + */ + protected function registerRequestRebindHandler() + { + $this->app->rebinding('request', function ($app, $request) { + $request->setUserResolver(function ($guard = null) use ($app) { + return call_user_func($app['auth']->userResolver(), $guard); + }); + }); + } + + /** + * Handle the re-binding of the event dispatcher binding. + * + * @return void + */ + protected function registerEventRebindHandler() + { + $this->app->rebinding('events', function ($app, $dispatcher) { + if (! $app->resolved('auth')) { + return; + } + + if ($app['auth']->hasResolvedGuards() === false) { + return; + } + + if (method_exists($guard = $app['auth']->guard(), 'setDispatcher')) { + $guard->setDispatcher($dispatcher); + } + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php b/vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php new file mode 100644 index 00000000..d7578a3d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php @@ -0,0 +1,78 @@ +getKeyName(); + } + + /** + * Get the unique identifier for the user. + * + * @return mixed + */ + public function getAuthIdentifier() + { + return $this->{$this->getAuthIdentifierName()}; + } + + /** + * Get the password for the user. + * + * @return string + */ + public function getAuthPassword() + { + return $this->password; + } + + /** + * Get the token value for the "remember me" session. + * + * @return string|null + */ + public function getRememberToken() + { + if (! empty($this->getRememberTokenName())) { + return (string) $this->{$this->getRememberTokenName()}; + } + } + + /** + * Set the token value for the "remember me" session. + * + * @param string $value + * @return void + */ + public function setRememberToken($value) + { + if (! empty($this->getRememberTokenName())) { + $this->{$this->getRememberTokenName()} = $value; + } + } + + /** + * Get the column name for the "remember me" token. + * + * @return string + */ + public function getRememberTokenName() + { + return $this->rememberTokenName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/AuthenticationException.php b/vendor/laravel/framework/src/Illuminate/Auth/AuthenticationException.php new file mode 100644 index 00000000..ef7dbee6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/AuthenticationException.php @@ -0,0 +1,58 @@ +guards = $guards; + $this->redirectTo = $redirectTo; + } + + /** + * Get the guards that were checked. + * + * @return array + */ + public function guards() + { + return $this->guards; + } + + /** + * Get the path the user should be redirected to. + * + * @return string + */ + public function redirectTo() + { + return $this->redirectTo; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/ClearResetsCommand.php b/vendor/laravel/framework/src/Illuminate/Auth/Console/ClearResetsCommand.php new file mode 100644 index 00000000..57c3bd50 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/ClearResetsCommand.php @@ -0,0 +1,34 @@ +laravel['auth.password']->broker($this->argument('name'))->getRepository()->deleteExpired(); + + $this->info('Expired reset tokens cleared!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stub b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stub new file mode 100644 index 00000000..9224ba38 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stub @@ -0,0 +1,80 @@ + + + + + + + + + + {{ config('app.name', 'Laravel') }} + + + + + + + + + + + + +
+ + +
+ @yield('content') +
+
+ + diff --git a/vendor/laravel/framework/src/Illuminate/Auth/CreatesUserProviders.php b/vendor/laravel/framework/src/Illuminate/Auth/CreatesUserProviders.php new file mode 100644 index 00000000..c2135f71 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/CreatesUserProviders.php @@ -0,0 +1,94 @@ +getProviderConfiguration($provider))) { + return; + } + + if (isset($this->customProviderCreators[$driver = ($config['driver'] ?? null)])) { + return call_user_func( + $this->customProviderCreators[$driver], $this->app, $config + ); + } + + switch ($driver) { + case 'database': + return $this->createDatabaseProvider($config); + case 'eloquent': + return $this->createEloquentProvider($config); + default: + throw new InvalidArgumentException( + "Authentication user provider [{$driver}] is not defined." + ); + } + } + + /** + * Get the user provider configuration. + * + * @param string|null $provider + * @return array|null + */ + protected function getProviderConfiguration($provider) + { + if ($provider = $provider ?: $this->getDefaultUserProvider()) { + return $this->app['config']['auth.providers.'.$provider]; + } + } + + /** + * Create an instance of the database user provider. + * + * @param array $config + * @return \Illuminate\Auth\DatabaseUserProvider + */ + protected function createDatabaseProvider($config) + { + $connection = $this->app['db']->connection($config['connection'] ?? null); + + return new DatabaseUserProvider($connection, $this->app['hash'], $config['table']); + } + + /** + * Create an instance of the Eloquent user provider. + * + * @param array $config + * @return \Illuminate\Auth\EloquentUserProvider + */ + protected function createEloquentProvider($config) + { + return new EloquentUserProvider($this->app['hash'], $config['model']); + } + + /** + * Get the default user provider name. + * + * @return string + */ + public function getDefaultUserProvider() + { + return $this->app['config']['auth.defaults.provider']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/DatabaseUserProvider.php b/vendor/laravel/framework/src/Illuminate/Auth/DatabaseUserProvider.php new file mode 100755 index 00000000..8aa563d8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/DatabaseUserProvider.php @@ -0,0 +1,159 @@ +conn = $conn; + $this->table = $table; + $this->hasher = $hasher; + } + + /** + * Retrieve a user by their unique identifier. + * + * @param mixed $identifier + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveById($identifier) + { + $user = $this->conn->table($this->table)->find($identifier); + + return $this->getGenericUser($user); + } + + /** + * Retrieve a user by their unique identifier and "remember me" token. + * + * @param mixed $identifier + * @param string $token + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByToken($identifier, $token) + { + $user = $this->getGenericUser( + $this->conn->table($this->table)->find($identifier) + ); + + return $user && $user->getRememberToken() && hash_equals($user->getRememberToken(), $token) + ? $user : null; + } + + /** + * Update the "remember me" token for the given user in storage. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $token + * @return void + */ + public function updateRememberToken(UserContract $user, $token) + { + $this->conn->table($this->table) + ->where($user->getAuthIdentifierName(), $user->getAuthIdentifier()) + ->update([$user->getRememberTokenName() => $token]); + } + + /** + * Retrieve a user by the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByCredentials(array $credentials) + { + if (empty($credentials) || + (count($credentials) === 1 && + array_key_exists('password', $credentials))) { + return; + } + + // First we will add each credential element to the query as a where clause. + // Then we can execute the query and, if we found a user, return it in a + // generic "user" object that will be utilized by the Guard instances. + $query = $this->conn->table($this->table); + + foreach ($credentials as $key => $value) { + if (Str::contains($key, 'password')) { + continue; + } + + if (is_array($value) || $value instanceof Arrayable) { + $query->whereIn($key, $value); + } else { + $query->where($key, $value); + } + } + + // Now we are ready to execute the query to see if we have an user matching + // the given credentials. If not, we will just return nulls and indicate + // that there are no matching users for these given credential arrays. + $user = $query->first(); + + return $this->getGenericUser($user); + } + + /** + * Get the generic user. + * + * @param mixed $user + * @return \Illuminate\Auth\GenericUser|null + */ + protected function getGenericUser($user) + { + if (! is_null($user)) { + return new GenericUser((array) $user); + } + } + + /** + * Validate a user against the given credentials. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param array $credentials + * @return bool + */ + public function validateCredentials(UserContract $user, array $credentials) + { + return $this->hasher->check( + $credentials['password'], $user->getAuthPassword() + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php b/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php new file mode 100755 index 00000000..f175298c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php @@ -0,0 +1,231 @@ +model = $model; + $this->hasher = $hasher; + } + + /** + * Retrieve a user by their unique identifier. + * + * @param mixed $identifier + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveById($identifier) + { + $model = $this->createModel(); + + return $this->newModelQuery($model) + ->where($model->getAuthIdentifierName(), $identifier) + ->first(); + } + + /** + * Retrieve a user by their unique identifier and "remember me" token. + * + * @param mixed $identifier + * @param string $token + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByToken($identifier, $token) + { + $model = $this->createModel(); + + $retrievedModel = $this->newModelQuery($model)->where( + $model->getAuthIdentifierName(), $identifier + )->first(); + + if (! $retrievedModel) { + return; + } + + $rememberToken = $retrievedModel->getRememberToken(); + + return $rememberToken && hash_equals($rememberToken, $token) + ? $retrievedModel : null; + } + + /** + * Update the "remember me" token for the given user in storage. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|\Illuminate\Database\Eloquent\Model $user + * @param string $token + * @return void + */ + public function updateRememberToken(UserContract $user, $token) + { + $user->setRememberToken($token); + + $timestamps = $user->timestamps; + + $user->timestamps = false; + + $user->save(); + + $user->timestamps = $timestamps; + } + + /** + * Retrieve a user by the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByCredentials(array $credentials) + { + if (empty($credentials) || + (count($credentials) === 1 && + Str::contains($this->firstCredentialKey($credentials), 'password'))) { + return; + } + + // First we will add each credential element to the query as a where clause. + // Then we can execute the query and, if we found a user, return it in a + // Eloquent User "model" that will be utilized by the Guard instances. + $query = $this->newModelQuery(); + + foreach ($credentials as $key => $value) { + if (Str::contains($key, 'password')) { + continue; + } + + if (is_array($value) || $value instanceof Arrayable) { + $query->whereIn($key, $value); + } else { + $query->where($key, $value); + } + } + + return $query->first(); + } + + /** + * Get the first key from the credential array. + * + * @param array $credentials + * @return string|null + */ + protected function firstCredentialKey(array $credentials) + { + foreach ($credentials as $key => $value) { + return $key; + } + } + + /** + * Validate a user against the given credentials. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param array $credentials + * @return bool + */ + public function validateCredentials(UserContract $user, array $credentials) + { + $plain = $credentials['password']; + + return $this->hasher->check($plain, $user->getAuthPassword()); + } + + /** + * Get a new query builder for the model instance. + * + * @param \Illuminate\Database\Eloquent\Model|null $model + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function newModelQuery($model = null) + { + return is_null($model) + ? $this->createModel()->newQuery() + : $model->newQuery(); + } + + /** + * Create a new instance of the model. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function createModel() + { + $class = '\\'.ltrim($this->model, '\\'); + + return new $class; + } + + /** + * Gets the hasher implementation. + * + * @return \Illuminate\Contracts\Hashing\Hasher + */ + public function getHasher() + { + return $this->hasher; + } + + /** + * Sets the hasher implementation. + * + * @param \Illuminate\Contracts\Hashing\Hasher $hasher + * @return $this + */ + public function setHasher(HasherContract $hasher) + { + $this->hasher = $hasher; + + return $this; + } + + /** + * Gets the name of the Eloquent user model. + * + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Sets the name of the Eloquent user model. + * + * @param string $model + * @return $this + */ + public function setModel($model) + { + $this->model = $model; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Attempting.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Attempting.php new file mode 100644 index 00000000..3f911bac --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Attempting.php @@ -0,0 +1,42 @@ +guard = $guard; + $this->remember = $remember; + $this->credentials = $credentials; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Authenticated.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Authenticated.php new file mode 100644 index 00000000..faefcbec --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Authenticated.php @@ -0,0 +1,37 @@ +user = $user; + $this->guard = $guard; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/CurrentDeviceLogout.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/CurrentDeviceLogout.php new file mode 100644 index 00000000..32d31faf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/CurrentDeviceLogout.php @@ -0,0 +1,37 @@ +user = $user; + $this->guard = $guard; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Failed.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Failed.php new file mode 100644 index 00000000..34f81248 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Failed.php @@ -0,0 +1,42 @@ +user = $user; + $this->guard = $guard; + $this->credentials = $credentials; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Lockout.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Lockout.php new file mode 100644 index 00000000..347943fe --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Lockout.php @@ -0,0 +1,26 @@ +request = $request; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Login.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Login.php new file mode 100644 index 00000000..87a399ea --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Login.php @@ -0,0 +1,46 @@ +user = $user; + $this->guard = $guard; + $this->remember = $remember; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Logout.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Logout.php new file mode 100644 index 00000000..c47341dc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Logout.php @@ -0,0 +1,37 @@ +user = $user; + $this->guard = $guard; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/OtherDeviceLogout.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/OtherDeviceLogout.php new file mode 100644 index 00000000..ea139a7b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/OtherDeviceLogout.php @@ -0,0 +1,37 @@ +user = $user; + $this->guard = $guard; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/PasswordReset.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/PasswordReset.php new file mode 100644 index 00000000..f57b3c94 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/PasswordReset.php @@ -0,0 +1,28 @@ +user = $user; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Registered.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Registered.php new file mode 100644 index 00000000..f84058cf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Registered.php @@ -0,0 +1,28 @@ +user = $user; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Validated.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Validated.php new file mode 100644 index 00000000..ebc3b2ce --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Validated.php @@ -0,0 +1,37 @@ +user = $user; + $this->guard = $guard; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Verified.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Verified.php new file mode 100644 index 00000000..1d6e4c0f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Verified.php @@ -0,0 +1,28 @@ +user = $user; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/GenericUser.php b/vendor/laravel/framework/src/Illuminate/Auth/GenericUser.php new file mode 100755 index 00000000..c87bc238 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/GenericUser.php @@ -0,0 +1,132 @@ +attributes = $attributes; + } + + /** + * Get the name of the unique identifier for the user. + * + * @return string + */ + public function getAuthIdentifierName() + { + return 'id'; + } + + /** + * Get the unique identifier for the user. + * + * @return mixed + */ + public function getAuthIdentifier() + { + return $this->attributes[$this->getAuthIdentifierName()]; + } + + /** + * Get the password for the user. + * + * @return string + */ + public function getAuthPassword() + { + return $this->attributes['password']; + } + + /** + * Get the "remember me" token value. + * + * @return string + */ + public function getRememberToken() + { + return $this->attributes[$this->getRememberTokenName()]; + } + + /** + * Set the "remember me" token value. + * + * @param string $value + * @return void + */ + public function setRememberToken($value) + { + $this->attributes[$this->getRememberTokenName()] = $value; + } + + /** + * Get the column name for the "remember me" token. + * + * @return string + */ + public function getRememberTokenName() + { + return 'remember_token'; + } + + /** + * Dynamically access the user's attributes. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->attributes[$key]; + } + + /** + * Dynamically set an attribute on the user. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->attributes[$key] = $value; + } + + /** + * Dynamically check if a value is set on the user. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return isset($this->attributes[$key]); + } + + /** + * Dynamically unset a value on the user. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + unset($this->attributes[$key]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/GuardHelpers.php b/vendor/laravel/framework/src/Illuminate/Auth/GuardHelpers.php new file mode 100644 index 00000000..fb9267ca --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/GuardHelpers.php @@ -0,0 +1,118 @@ +user())) { + return $user; + } + + throw new AuthenticationException; + } + + /** + * Determine if the guard has a user instance. + * + * @return bool + */ + public function hasUser() + { + return ! is_null($this->user); + } + + /** + * Determine if the current user is authenticated. + * + * @return bool + */ + public function check() + { + return ! is_null($this->user()); + } + + /** + * Determine if the current user is a guest. + * + * @return bool + */ + public function guest() + { + return ! $this->check(); + } + + /** + * Get the ID for the currently authenticated user. + * + * @return int|null + */ + public function id() + { + if ($this->user()) { + return $this->user()->getAuthIdentifier(); + } + } + + /** + * Set the current user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return $this + */ + public function setUser(AuthenticatableContract $user) + { + $this->user = $user; + + return $this; + } + + /** + * Get the user provider used by the guard. + * + * @return \Illuminate\Contracts\Auth\UserProvider + */ + public function getProvider() + { + return $this->provider; + } + + /** + * Set the user provider used by the guard. + * + * @param \Illuminate\Contracts\Auth\UserProvider $provider + * @return void + */ + public function setProvider(UserProvider $provider) + { + $this->provider = $provider; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Auth/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php b/vendor/laravel/framework/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php new file mode 100644 index 00000000..12dfa697 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php @@ -0,0 +1,22 @@ +user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) { + $event->user->sendEmailVerificationNotification(); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php new file mode 100644 index 00000000..ec82e44d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php @@ -0,0 +1,96 @@ +auth = $auth; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string[] ...$guards + * @return mixed + * + * @throws \Illuminate\Auth\AuthenticationException + */ + public function handle($request, Closure $next, ...$guards) + { + $this->authenticate($request, $guards); + + return $next($request); + } + + /** + * Determine if the user is logged in to any of the given guards. + * + * @param \Illuminate\Http\Request $request + * @param array $guards + * @return void + * + * @throws \Illuminate\Auth\AuthenticationException + */ + protected function authenticate($request, array $guards) + { + if (empty($guards)) { + $guards = [null]; + } + + foreach ($guards as $guard) { + if ($this->auth->guard($guard)->check()) { + return $this->auth->shouldUse($guard); + } + } + + $this->unauthenticated($request, $guards); + } + + /** + * Handle an unauthenticated user. + * + * @param \Illuminate\Http\Request $request + * @param array $guards + * @return void + * + * @throws \Illuminate\Auth\AuthenticationException + */ + protected function unauthenticated($request, array $guards) + { + throw new AuthenticationException( + 'Unauthenticated.', $guards, $this->redirectTo($request) + ); + } + + /** + * Get the path the user should be redirected to when they are not authenticated. + * + * @param \Illuminate\Http\Request $request + * @return string|null + */ + protected function redirectTo($request) + { + // + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php new file mode 100644 index 00000000..92c81e68 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php @@ -0,0 +1,45 @@ +auth = $auth; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard + * @param string|null $field + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException + */ + public function handle($request, Closure $next, $guard = null, $field = null) + { + $this->auth->guard($guard)->basic($field ?: 'email'); + + return $next($request); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authorize.php b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authorize.php new file mode 100644 index 00000000..aea9801d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authorize.php @@ -0,0 +1,93 @@ +gate = $gate; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string $ability + * @param array|null ...$models + * @return mixed + * + * @throws \Illuminate\Auth\AuthenticationException + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function handle($request, Closure $next, $ability, ...$models) + { + $this->gate->authorize($ability, $this->getGateArguments($request, $models)); + + return $next($request); + } + + /** + * Get the arguments parameter for the gate. + * + * @param \Illuminate\Http\Request $request + * @param array|null $models + * @return \Illuminate\Database\Eloquent\Model|array|string + */ + protected function getGateArguments($request, $models) + { + if (is_null($models)) { + return []; + } + + return collect($models)->map(function ($model) use ($request) { + return $model instanceof Model ? $model : $this->getModel($request, $model); + })->all(); + } + + /** + * Get the model to authorize. + * + * @param \Illuminate\Http\Request $request + * @param string $model + * @return \Illuminate\Database\Eloquent\Model|string + */ + protected function getModel($request, $model) + { + if ($this->isClassName($model)) { + return trim($model); + } else { + return $request->route($model, null) ?: + ((preg_match("/^['\"](.*)['\"]$/", trim($model), $matches)) ? $matches[1] : null); + } + } + + /** + * Checks if the given string looks like a fully qualified class name. + * + * @param string $value + * @return bool + */ + protected function isClassName($value) + { + return strpos($value, '\\') !== false; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php new file mode 100644 index 00000000..1f73e576 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php @@ -0,0 +1,31 @@ +user() || + ($request->user() instanceof MustVerifyEmail && + ! $request->user()->hasVerifiedEmail())) { + return $request->expectsJson() + ? abort(403, 'Your email address is not verified.') + : Redirect::route($redirectToRoute ?: 'verification.notice'); + } + + return $next($request); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Middleware/RequirePassword.php b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/RequirePassword.php new file mode 100644 index 00000000..315bdb81 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/RequirePassword.php @@ -0,0 +1,84 @@ +responseFactory = $responseFactory; + $this->urlGenerator = $urlGenerator; + $this->passwordTimeout = $passwordTimeout ?: 10800; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $redirectToRoute + * @return mixed + */ + public function handle($request, Closure $next, $redirectToRoute = null) + { + if ($this->shouldConfirmPassword($request)) { + if ($request->expectsJson()) { + return $this->responseFactory->json([ + 'message' => 'Password confirmation required.', + ], 423); + } + + return $this->responseFactory->redirectGuest( + $this->urlGenerator->route($redirectToRoute ?? 'password.confirm') + ); + } + + return $next($request); + } + + /** + * Determine if the confirmation timeout has expired. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function shouldConfirmPassword($request) + { + $confirmedAt = time() - $request->session()->get('auth.password_confirmed_at', 0); + + return $confirmedAt > $this->passwordTimeout; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/MustVerifyEmail.php b/vendor/laravel/framework/src/Illuminate/Auth/MustVerifyEmail.php new file mode 100644 index 00000000..8e1ce33f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/MustVerifyEmail.php @@ -0,0 +1,50 @@ +email_verified_at); + } + + /** + * Mark the given user's email as verified. + * + * @return bool + */ + public function markEmailAsVerified() + { + return $this->forceFill([ + 'email_verified_at' => $this->freshTimestamp(), + ])->save(); + } + + /** + * Send the email verification notification. + * + * @return void + */ + public function sendEmailVerificationNotification() + { + $this->notify(new VerifyEmail); + } + + /** + * Get the email address that should be used for verification. + * + * @return string + */ + public function getEmailForVerification() + { + return $this->email; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Notifications/ResetPassword.php b/vendor/laravel/framework/src/Illuminate/Auth/Notifications/ResetPassword.php new file mode 100644 index 00000000..2d46c8a4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Notifications/ResetPassword.php @@ -0,0 +1,77 @@ +token = $token; + } + + /** + * Get the notification's channels. + * + * @param mixed $notifiable + * @return array|string + */ + public function via($notifiable) + { + return ['mail']; + } + + /** + * Build the mail representation of the notification. + * + * @param mixed $notifiable + * @return \Illuminate\Notifications\Messages\MailMessage + */ + public function toMail($notifiable) + { + if (static::$toMailCallback) { + return call_user_func(static::$toMailCallback, $notifiable, $this->token); + } + + return (new MailMessage) + ->subject(Lang::get('Reset Password Notification')) + ->line(Lang::get('You are receiving this email because we received a password reset request for your account.')) + ->action(Lang::get('Reset Password'), url(route('password.reset', ['token' => $this->token, 'email' => $notifiable->getEmailForPasswordReset()], false))) + ->line(Lang::get('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.'.config('auth.defaults.passwords').'.expire')])) + ->line(Lang::get('If you did not request a password reset, no further action is required.')); + } + + /** + * Set a callback that should be used when building the notification mail message. + * + * @param \Closure $callback + * @return void + */ + public static function toMailUsing($callback) + { + static::$toMailCallback = $callback; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php b/vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php new file mode 100644 index 00000000..f746685f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php @@ -0,0 +1,81 @@ +verificationUrl($notifiable); + + if (static::$toMailCallback) { + return call_user_func(static::$toMailCallback, $notifiable, $verificationUrl); + } + + return (new MailMessage) + ->subject(Lang::get('Verify Email Address')) + ->line(Lang::get('Please click the button below to verify your email address.')) + ->action(Lang::get('Verify Email Address'), $verificationUrl) + ->line(Lang::get('If you did not create an account, no further action is required.')); + } + + /** + * Get the verification URL for the given notifiable. + * + * @param mixed $notifiable + * @return string + */ + protected function verificationUrl($notifiable) + { + return URL::temporarySignedRoute( + 'verification.verify', + Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)), + [ + 'id' => $notifiable->getKey(), + 'hash' => sha1($notifiable->getEmailForVerification()), + ] + ); + } + + /** + * Set a callback that should be used when building the notification mail message. + * + * @param \Closure $callback + * @return void + */ + public static function toMailUsing($callback) + { + static::$toMailCallback = $callback; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Passwords/CanResetPassword.php b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/CanResetPassword.php new file mode 100644 index 00000000..918a288f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/CanResetPassword.php @@ -0,0 +1,29 @@ +email; + } + + /** + * Send the password reset notification. + * + * @param string $token + * @return void + */ + public function sendPasswordResetNotification($token) + { + $this->notify(new ResetPasswordNotification($token)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php new file mode 100755 index 00000000..fe5f54b7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php @@ -0,0 +1,246 @@ +table = $table; + $this->hasher = $hasher; + $this->hashKey = $hashKey; + $this->expires = $expires * 60; + $this->connection = $connection; + $this->throttle = $throttle; + } + + /** + * Create a new token record. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return string + */ + public function create(CanResetPasswordContract $user) + { + $email = $user->getEmailForPasswordReset(); + + $this->deleteExisting($user); + + // We will create a new, random token for the user so that we can e-mail them + // a safe link to the password reset form. Then we will insert a record in + // the database so that we can verify the token within the actual reset. + $token = $this->createNewToken(); + + $this->getTable()->insert($this->getPayload($email, $token)); + + return $token; + } + + /** + * Delete all existing reset tokens from the database. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return int + */ + protected function deleteExisting(CanResetPasswordContract $user) + { + return $this->getTable()->where('email', $user->getEmailForPasswordReset())->delete(); + } + + /** + * Build the record payload for the table. + * + * @param string $email + * @param string $token + * @return array + */ + protected function getPayload($email, $token) + { + return ['email' => $email, 'token' => $this->hasher->make($token), 'created_at' => new Carbon]; + } + + /** + * Determine if a token record exists and is valid. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @param string $token + * @return bool + */ + public function exists(CanResetPasswordContract $user, $token) + { + $record = (array) $this->getTable()->where( + 'email', $user->getEmailForPasswordReset() + )->first(); + + return $record && + ! $this->tokenExpired($record['created_at']) && + $this->hasher->check($token, $record['token']); + } + + /** + * Determine if the token has expired. + * + * @param string $createdAt + * @return bool + */ + protected function tokenExpired($createdAt) + { + return Carbon::parse($createdAt)->addSeconds($this->expires)->isPast(); + } + + /** + * Determine if the given user recently created a password reset token. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return bool + */ + public function recentlyCreatedToken(CanResetPasswordContract $user) + { + $record = (array) $this->getTable()->where( + 'email', $user->getEmailForPasswordReset() + )->first(); + + return $record && $this->tokenRecentlyCreated($record['created_at']); + } + + /** + * Determine if the token was recently created. + * + * @param string $createdAt + * @return bool + */ + protected function tokenRecentlyCreated($createdAt) + { + if ($this->throttle <= 0) { + return false; + } + + return Carbon::parse($createdAt)->addSeconds( + $this->throttle + )->isFuture(); + } + + /** + * Delete a token record by user. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return void + */ + public function delete(CanResetPasswordContract $user) + { + $this->deleteExisting($user); + } + + /** + * Delete expired tokens. + * + * @return void + */ + public function deleteExpired() + { + $expiredAt = Carbon::now()->subSeconds($this->expires); + + $this->getTable()->where('created_at', '<', $expiredAt)->delete(); + } + + /** + * Create a new token for the user. + * + * @return string + */ + public function createNewToken() + { + return hash_hmac('sha256', Str::random(40), $this->hashKey); + } + + /** + * Get the database connection instance. + * + * @return \Illuminate\Database\ConnectionInterface + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Begin a new database query against the table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function getTable() + { + return $this->connection->table($this->table); + } + + /** + * Get the hasher instance. + * + * @return \Illuminate\Contracts\Hashing\Hasher + */ + public function getHasher() + { + return $this->hasher; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php new file mode 100755 index 00000000..30861dc4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php @@ -0,0 +1,186 @@ +users = $users; + $this->tokens = $tokens; + } + + /** + * Send a password reset link to a user. + * + * @param array $credentials + * @return string + */ + public function sendResetLink(array $credentials) + { + // First we will check to see if we found a user at the given credentials and + // if we did not we will redirect back to this current URI with a piece of + // "flash" data in the session to indicate to the developers the errors. + $user = $this->getUser($credentials); + + if (is_null($user)) { + return static::INVALID_USER; + } + + if (method_exists($this->tokens, 'recentlyCreatedToken') && + $this->tokens->recentlyCreatedToken($user)) { + return static::RESET_THROTTLED; + } + + // Once we have the reset token, we are ready to send the message out to this + // user with a link to reset their password. We will then redirect back to + // the current URI having nothing set in the session to indicate errors. + $user->sendPasswordResetNotification( + $this->tokens->create($user) + ); + + return static::RESET_LINK_SENT; + } + + /** + * Reset the password for the given token. + * + * @param array $credentials + * @param \Closure $callback + * @return mixed + */ + public function reset(array $credentials, Closure $callback) + { + $user = $this->validateReset($credentials); + + // If the responses from the validate method is not a user instance, we will + // assume that it is a redirect and simply return it from this method and + // the user is properly redirected having an error message on the post. + if (! $user instanceof CanResetPasswordContract) { + return $user; + } + + $password = $credentials['password']; + + // Once the reset has been validated, we'll call the given callback with the + // new password. This gives the user an opportunity to store the password + // in their persistent storage. Then we'll delete the token and return. + $callback($user, $password); + + $this->tokens->delete($user); + + return static::PASSWORD_RESET; + } + + /** + * Validate a password reset for the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\CanResetPassword|string + */ + protected function validateReset(array $credentials) + { + if (is_null($user = $this->getUser($credentials))) { + return static::INVALID_USER; + } + + if (! $this->tokens->exists($user, $credentials['token'])) { + return static::INVALID_TOKEN; + } + + return $user; + } + + /** + * Get the user for the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\CanResetPassword|null + * + * @throws \UnexpectedValueException + */ + public function getUser(array $credentials) + { + $credentials = Arr::except($credentials, ['token']); + + $user = $this->users->retrieveByCredentials($credentials); + + if ($user && ! $user instanceof CanResetPasswordContract) { + throw new UnexpectedValueException('User must implement CanResetPassword interface.'); + } + + return $user; + } + + /** + * Create a new password reset token for the given user. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return string + */ + public function createToken(CanResetPasswordContract $user) + { + return $this->tokens->create($user); + } + + /** + * Delete password reset tokens of the given user. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return void + */ + public function deleteToken(CanResetPasswordContract $user) + { + $this->tokens->delete($user); + } + + /** + * Validate the given password reset token. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @param string $token + * @return bool + */ + public function tokenExists(CanResetPasswordContract $user, $token) + { + return $this->tokens->exists($user, $token); + } + + /** + * Get the password reset token repository implementation. + * + * @return \Illuminate\Auth\Passwords\TokenRepositoryInterface + */ + public function getRepository() + { + return $this->tokens; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php new file mode 100644 index 00000000..f7617262 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php @@ -0,0 +1,146 @@ +app = $app; + } + + /** + * Attempt to get the broker from the local cache. + * + * @param string|null $name + * @return \Illuminate\Contracts\Auth\PasswordBroker + */ + public function broker($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return $this->brokers[$name] ?? ($this->brokers[$name] = $this->resolve($name)); + } + + /** + * Resolve the given broker. + * + * @param string $name + * @return \Illuminate\Contracts\Auth\PasswordBroker + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (is_null($config)) { + throw new InvalidArgumentException("Password resetter [{$name}] is not defined."); + } + + // The password broker uses a token repository to validate tokens and send user + // password e-mails, as well as validating that password reset process as an + // aggregate service of sorts providing a convenient interface for resets. + return new PasswordBroker( + $this->createTokenRepository($config), + $this->app['auth']->createUserProvider($config['provider'] ?? null) + ); + } + + /** + * Create a token repository instance based on the given configuration. + * + * @param array $config + * @return \Illuminate\Auth\Passwords\TokenRepositoryInterface + */ + protected function createTokenRepository(array $config) + { + $key = $this->app['config']['app.key']; + + if (Str::startsWith($key, 'base64:')) { + $key = base64_decode(substr($key, 7)); + } + + $connection = $config['connection'] ?? null; + + return new DatabaseTokenRepository( + $this->app['db']->connection($connection), + $this->app['hash'], + $config['table'], + $key, + $config['expire'], + $config['throttle'] ?? 0 + ); + } + + /** + * Get the password broker configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["auth.passwords.{$name}"]; + } + + /** + * Get the default password broker name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['auth.defaults.passwords']; + } + + /** + * Set the default password broker name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['auth.defaults.passwords'] = $name; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->broker()->{$method}(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php new file mode 100755 index 00000000..a26b7e6e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php @@ -0,0 +1,45 @@ +registerPasswordBroker(); + } + + /** + * Register the password broker instance. + * + * @return void + */ + protected function registerPasswordBroker() + { + $this->app->singleton('auth.password', function ($app) { + return new PasswordBrokerManager($app); + }); + + $this->app->bind('auth.password.broker', function ($app) { + return $app->make('auth.password')->broker(); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['auth.password', 'auth.password.broker']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php new file mode 100755 index 00000000..dcd06e8d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php @@ -0,0 +1,40 @@ +recaller = @unserialize($recaller, ['allowed_classes' => false]) ?: $recaller; + } + + /** + * Get the user ID from the recaller. + * + * @return string + */ + public function id() + { + return explode('|', $this->recaller, 3)[0]; + } + + /** + * Get the "remember token" token from the recaller. + * + * @return string + */ + public function token() + { + return explode('|', $this->recaller, 3)[1]; + } + + /** + * Get the password from the recaller. + * + * @return string + */ + public function hash() + { + return explode('|', $this->recaller, 3)[2]; + } + + /** + * Determine if the recaller is valid. + * + * @return bool + */ + public function valid() + { + return $this->properString() && $this->hasAllSegments(); + } + + /** + * Determine if the recaller is an invalid string. + * + * @return bool + */ + protected function properString() + { + return is_string($this->recaller) && Str::contains($this->recaller, '|'); + } + + /** + * Determine if the recaller has all segments. + * + * @return bool + */ + protected function hasAllSegments() + { + $segments = explode('|', $this->recaller); + + return count($segments) === 3 && trim($segments[0]) !== '' && trim($segments[1]) !== ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/RequestGuard.php b/vendor/laravel/framework/src/Illuminate/Auth/RequestGuard.php new file mode 100644 index 00000000..d0af83cb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/RequestGuard.php @@ -0,0 +1,87 @@ +request = $request; + $this->callback = $callback; + $this->provider = $provider; + } + + /** + * Get the currently authenticated user. + * + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function user() + { + // If we've already retrieved the user for the current request we can just + // return it back immediately. We do not want to fetch the user data on + // every call to this method because that would be tremendously slow. + if (! is_null($this->user)) { + return $this->user; + } + + return $this->user = call_user_func( + $this->callback, $this->request, $this->getProvider() + ); + } + + /** + * Validate a user's credentials. + * + * @param array $credentials + * @return bool + */ + public function validate(array $credentials = []) + { + return ! is_null((new static( + $this->callback, $credentials['request'], $this->getProvider() + ))->user()); + } + + /** + * Set the current request instance. + * + * @param \Illuminate\Http\Request $request + * @return $this + */ + public function setRequest(Request $request) + { + $this->request = $request; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php b/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php new file mode 100644 index 00000000..8cc646ec --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php @@ -0,0 +1,855 @@ +name = $name; + $this->session = $session; + $this->request = $request; + $this->provider = $provider; + } + + /** + * Get the currently authenticated user. + * + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function user() + { + if ($this->loggedOut) { + return; + } + + // If we've already retrieved the user for the current request we can just + // return it back immediately. We do not want to fetch the user data on + // every call to this method because that would be tremendously slow. + if (! is_null($this->user)) { + return $this->user; + } + + $id = $this->session->get($this->getName()); + + // First we will try to load the user using the identifier in the session if + // one exists. Otherwise we will check for a "remember me" cookie in this + // request, and if one exists, attempt to retrieve the user using that. + if (! is_null($id) && $this->user = $this->provider->retrieveById($id)) { + $this->fireAuthenticatedEvent($this->user); + } + + // If the user is null, but we decrypt a "recaller" cookie we can attempt to + // pull the user data on that cookie which serves as a remember cookie on + // the application. Once we have a user we can return it to the caller. + if (is_null($this->user) && ! is_null($recaller = $this->recaller())) { + $this->user = $this->userFromRecaller($recaller); + + if ($this->user) { + $this->updateSession($this->user->getAuthIdentifier()); + + $this->fireLoginEvent($this->user, true); + } + } + + return $this->user; + } + + /** + * Pull a user from the repository by its "remember me" cookie token. + * + * @param \Illuminate\Auth\Recaller $recaller + * @return mixed + */ + protected function userFromRecaller($recaller) + { + if (! $recaller->valid() || $this->recallAttempted) { + return; + } + + // If the user is null, but we decrypt a "recaller" cookie we can attempt to + // pull the user data on that cookie which serves as a remember cookie on + // the application. Once we have a user we can return it to the caller. + $this->recallAttempted = true; + + $this->viaRemember = ! is_null($user = $this->provider->retrieveByToken( + $recaller->id(), $recaller->token() + )); + + return $user; + } + + /** + * Get the decrypted recaller cookie for the request. + * + * @return \Illuminate\Auth\Recaller|null + */ + protected function recaller() + { + if (is_null($this->request)) { + return; + } + + if ($recaller = $this->request->cookies->get($this->getRecallerName())) { + return new Recaller($recaller); + } + } + + /** + * Get the ID for the currently authenticated user. + * + * @return int|null + */ + public function id() + { + if ($this->loggedOut) { + return; + } + + return $this->user() + ? $this->user()->getAuthIdentifier() + : $this->session->get($this->getName()); + } + + /** + * Log a user into the application without sessions or cookies. + * + * @param array $credentials + * @return bool + */ + public function once(array $credentials = []) + { + $this->fireAttemptEvent($credentials); + + if ($this->validate($credentials)) { + $this->setUser($this->lastAttempted); + + return true; + } + + return false; + } + + /** + * Log the given user ID into the application without sessions or cookies. + * + * @param mixed $id + * @return \Illuminate\Contracts\Auth\Authenticatable|false + */ + public function onceUsingId($id) + { + if (! is_null($user = $this->provider->retrieveById($id))) { + $this->setUser($user); + + return $user; + } + + return false; + } + + /** + * Validate a user's credentials. + * + * @param array $credentials + * @return bool + */ + public function validate(array $credentials = []) + { + $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); + + return $this->hasValidCredentials($user, $credentials); + } + + /** + * Attempt to authenticate using HTTP Basic Auth. + * + * @param string $field + * @param array $extraConditions + * @return \Symfony\Component\HttpFoundation\Response|null + */ + public function basic($field = 'email', $extraConditions = []) + { + if ($this->check()) { + return; + } + + // If a username is set on the HTTP basic request, we will return out without + // interrupting the request lifecycle. Otherwise, we'll need to generate a + // request indicating that the given credentials were invalid for login. + if ($this->attemptBasic($this->getRequest(), $field, $extraConditions)) { + return; + } + + return $this->failedBasicResponse(); + } + + /** + * Perform a stateless HTTP Basic login attempt. + * + * @param string $field + * @param array $extraConditions + * @return \Symfony\Component\HttpFoundation\Response|null + */ + public function onceBasic($field = 'email', $extraConditions = []) + { + $credentials = $this->basicCredentials($this->getRequest(), $field); + + if (! $this->once(array_merge($credentials, $extraConditions))) { + return $this->failedBasicResponse(); + } + } + + /** + * Attempt to authenticate using basic authentication. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param string $field + * @param array $extraConditions + * @return bool + */ + protected function attemptBasic(Request $request, $field, $extraConditions = []) + { + if (! $request->getUser()) { + return false; + } + + return $this->attempt(array_merge( + $this->basicCredentials($request, $field), $extraConditions + )); + } + + /** + * Get the credential array for a HTTP Basic request. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param string $field + * @return array + */ + protected function basicCredentials(Request $request, $field) + { + return [$field => $request->getUser(), 'password' => $request->getPassword()]; + } + + /** + * Get the response for basic authentication. + * + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException + */ + protected function failedBasicResponse() + { + throw new UnauthorizedHttpException('Basic', 'Invalid credentials.'); + } + + /** + * Attempt to authenticate a user using the given credentials. + * + * @param array $credentials + * @param bool $remember + * @return bool + */ + public function attempt(array $credentials = [], $remember = false) + { + $this->fireAttemptEvent($credentials, $remember); + + $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); + + // If an implementation of UserInterface was returned, we'll ask the provider + // to validate the user against the given credentials, and if they are in + // fact valid we'll log the users into the application and return true. + if ($this->hasValidCredentials($user, $credentials)) { + $this->login($user, $remember); + + return true; + } + + // If the authentication attempt fails we will fire an event so that the user + // may be notified of any suspicious attempts to access their account from + // an unrecognized user. A developer may listen to this event as needed. + $this->fireFailedEvent($user, $credentials); + + return false; + } + + /** + * Determine if the user matches the credentials. + * + * @param mixed $user + * @param array $credentials + * @return bool + */ + protected function hasValidCredentials($user, $credentials) + { + $validated = ! is_null($user) && $this->provider->validateCredentials($user, $credentials); + + if ($validated) { + $this->fireValidatedEvent($user); + } + + return $validated; + } + + /** + * Log the given user ID into the application. + * + * @param mixed $id + * @param bool $remember + * @return \Illuminate\Contracts\Auth\Authenticatable|false + */ + public function loginUsingId($id, $remember = false) + { + if (! is_null($user = $this->provider->retrieveById($id))) { + $this->login($user, $remember); + + return $user; + } + + return false; + } + + /** + * Log a user into the application. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param bool $remember + * @return void + */ + public function login(AuthenticatableContract $user, $remember = false) + { + $this->updateSession($user->getAuthIdentifier()); + + // If the user should be permanently "remembered" by the application we will + // queue a permanent cookie that contains the encrypted copy of the user + // identifier. We will then decrypt this later to retrieve the users. + if ($remember) { + $this->ensureRememberTokenIsSet($user); + + $this->queueRecallerCookie($user); + } + + // If we have an event dispatcher instance set we will fire an event so that + // any listeners will hook into the authentication events and run actions + // based on the login and logout events fired from the guard instances. + $this->fireLoginEvent($user, $remember); + + $this->setUser($user); + } + + /** + * Update the session with the given ID. + * + * @param string $id + * @return void + */ + protected function updateSession($id) + { + $this->session->put($this->getName(), $id); + + $this->session->migrate(true); + } + + /** + * Create a new "remember me" token for the user if one doesn't already exist. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + protected function ensureRememberTokenIsSet(AuthenticatableContract $user) + { + if (empty($user->getRememberToken())) { + $this->cycleRememberToken($user); + } + } + + /** + * Queue the recaller cookie into the cookie jar. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + protected function queueRecallerCookie(AuthenticatableContract $user) + { + $this->getCookieJar()->queue($this->createRecaller( + $user->getAuthIdentifier().'|'.$user->getRememberToken().'|'.$user->getAuthPassword() + )); + } + + /** + * Create a "remember me" cookie for a given ID. + * + * @param string $value + * @return \Symfony\Component\HttpFoundation\Cookie + */ + protected function createRecaller($value) + { + return $this->getCookieJar()->forever($this->getRecallerName(), $value); + } + + /** + * Log the user out of the application. + * + * @return void + */ + public function logout() + { + $user = $this->user(); + + $this->clearUserDataFromStorage(); + + if (! is_null($this->user) && ! empty($user->getRememberToken())) { + $this->cycleRememberToken($user); + } + + // If we have an event dispatcher instance, we can fire off the logout event + // so any further processing can be done. This allows the developer to be + // listening for anytime a user signs out of this application manually. + if (isset($this->events)) { + $this->events->dispatch(new Logout($this->name, $user)); + } + + // Once we have fired the logout event we will clear the users out of memory + // so they are no longer available as the user is no longer considered as + // being signed into this application and should not be available here. + $this->user = null; + + $this->loggedOut = true; + } + + /** + * Remove the user data from the session and cookies. + * + * @return void + */ + protected function clearUserDataFromStorage() + { + $this->session->remove($this->getName()); + + if (! is_null($this->recaller())) { + $this->getCookieJar()->queue($this->getCookieJar() + ->forget($this->getRecallerName())); + } + } + + /** + * Refresh the "remember me" token for the user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + protected function cycleRememberToken(AuthenticatableContract $user) + { + $user->setRememberToken($token = Str::random(60)); + + $this->provider->updateRememberToken($user, $token); + } + + /** + * Log the user out of the application on their current device only. + * + * @return void + */ + public function logoutCurrentDevice() + { + $user = $this->user(); + + $this->clearUserDataFromStorage(); + + // If we have an event dispatcher instance, we can fire off the logout event + // so any further processing can be done. This allows the developer to be + // listening for anytime a user signs out of this application manually. + if (isset($this->events)) { + $this->events->dispatch(new CurrentDeviceLogout($this->name, $user)); + } + + // Once we have fired the logout event we will clear the users out of memory + // so they are no longer available as the user is no longer considered as + // being signed into this application and should not be available here. + $this->user = null; + + $this->loggedOut = true; + } + + /** + * Invalidate other sessions for the current user. + * + * The application must be using the AuthenticateSession middleware. + * + * @param string $password + * @param string $attribute + * @return bool|null + */ + public function logoutOtherDevices($password, $attribute = 'password') + { + if (! $this->user()) { + return; + } + + $result = tap($this->user()->forceFill([ + $attribute => Hash::make($password), + ]))->save(); + + if ($this->recaller() || + $this->getCookieJar()->hasQueued($this->getRecallerName())) { + $this->queueRecallerCookie($this->user()); + } + + $this->fireOtherDeviceLogoutEvent($this->user()); + + return $result; + } + + /** + * Register an authentication attempt event listener. + * + * @param mixed $callback + * @return void + */ + public function attempting($callback) + { + if (isset($this->events)) { + $this->events->listen(Events\Attempting::class, $callback); + } + } + + /** + * Fire the attempt event with the arguments. + * + * @param array $credentials + * @param bool $remember + * @return void + */ + protected function fireAttemptEvent(array $credentials, $remember = false) + { + if (isset($this->events)) { + $this->events->dispatch(new Attempting( + $this->name, $credentials, $remember + )); + } + } + + /** + * Fires the validated event if the dispatcher is set. + * + * @param $user + */ + protected function fireValidatedEvent($user) + { + if (isset($this->events)) { + $this->events->dispatch(new Validated( + $this->name, $user + )); + } + } + + /** + * Fire the login event if the dispatcher is set. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param bool $remember + * @return void + */ + protected function fireLoginEvent($user, $remember = false) + { + if (isset($this->events)) { + $this->events->dispatch(new Login( + $this->name, $user, $remember + )); + } + } + + /** + * Fire the authenticated event if the dispatcher is set. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + protected function fireAuthenticatedEvent($user) + { + if (isset($this->events)) { + $this->events->dispatch(new Authenticated( + $this->name, $user + )); + } + } + + /** + * Fire the other device logout event if the dispatcher is set. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + protected function fireOtherDeviceLogoutEvent($user) + { + if (isset($this->events)) { + $this->events->dispatch(new OtherDeviceLogout( + $this->name, $user + )); + } + } + + /** + * Fire the failed authentication attempt event with the given arguments. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + * @param array $credentials + * @return void + */ + protected function fireFailedEvent($user, array $credentials) + { + if (isset($this->events)) { + $this->events->dispatch(new Failed( + $this->name, $user, $credentials + )); + } + } + + /** + * Get the last user we attempted to authenticate. + * + * @return \Illuminate\Contracts\Auth\Authenticatable + */ + public function getLastAttempted() + { + return $this->lastAttempted; + } + + /** + * Get a unique identifier for the auth session value. + * + * @return string + */ + public function getName() + { + return 'login_'.$this->name.'_'.sha1(static::class); + } + + /** + * Get the name of the cookie used to store the "recaller". + * + * @return string + */ + public function getRecallerName() + { + return 'remember_'.$this->name.'_'.sha1(static::class); + } + + /** + * Determine if the user was authenticated via "remember me" cookie. + * + * @return bool + */ + public function viaRemember() + { + return $this->viaRemember; + } + + /** + * Get the cookie creator instance used by the guard. + * + * @return \Illuminate\Contracts\Cookie\QueueingFactory + * + * @throws \RuntimeException + */ + public function getCookieJar() + { + if (! isset($this->cookie)) { + throw new RuntimeException('Cookie jar has not been set.'); + } + + return $this->cookie; + } + + /** + * Set the cookie creator instance used by the guard. + * + * @param \Illuminate\Contracts\Cookie\QueueingFactory $cookie + * @return void + */ + public function setCookieJar(CookieJar $cookie) + { + $this->cookie = $cookie; + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getDispatcher() + { + return $this->events; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function setDispatcher(Dispatcher $events) + { + $this->events = $events; + } + + /** + * Get the session store used by the guard. + * + * @return \Illuminate\Contracts\Session\Session + */ + public function getSession() + { + return $this->session; + } + + /** + * Return the currently cached user. + * + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function getUser() + { + return $this->user; + } + + /** + * Set the current user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return $this + */ + public function setUser(AuthenticatableContract $user) + { + $this->user = $user; + + $this->loggedOut = false; + + $this->fireAuthenticatedEvent($user); + + return $this; + } + + /** + * Get the current request instance. + * + * @return \Symfony\Component\HttpFoundation\Request + */ + public function getRequest() + { + return $this->request ?: Request::createFromGlobals(); + } + + /** + * Set the current request instance. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return $this + */ + public function setRequest(Request $request) + { + $this->request = $request; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/TokenGuard.php b/vendor/laravel/framework/src/Illuminate/Auth/TokenGuard.php new file mode 100644 index 00000000..b1aa7a7e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/TokenGuard.php @@ -0,0 +1,149 @@ +hash = $hash; + $this->request = $request; + $this->provider = $provider; + $this->inputKey = $inputKey; + $this->storageKey = $storageKey; + } + + /** + * Get the currently authenticated user. + * + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function user() + { + // If we've already retrieved the user for the current request we can just + // return it back immediately. We do not want to fetch the user data on + // every call to this method because that would be tremendously slow. + if (! is_null($this->user)) { + return $this->user; + } + + $user = null; + + $token = $this->getTokenForRequest(); + + if (! empty($token)) { + $user = $this->provider->retrieveByCredentials([ + $this->storageKey => $this->hash ? hash('sha256', $token) : $token, + ]); + } + + return $this->user = $user; + } + + /** + * Get the token for the current request. + * + * @return string + */ + public function getTokenForRequest() + { + $token = $this->request->query($this->inputKey); + + if (empty($token)) { + $token = $this->request->input($this->inputKey); + } + + if (empty($token)) { + $token = $this->request->bearerToken(); + } + + if (empty($token)) { + $token = $this->request->getPassword(); + } + + return $token; + } + + /** + * Validate a user's credentials. + * + * @param array $credentials + * @return bool + */ + public function validate(array $credentials = []) + { + if (empty($credentials[$this->inputKey])) { + return false; + } + + $credentials = [$this->storageKey => $credentials[$this->inputKey]]; + + if ($this->provider->retrieveByCredentials($credentials)) { + return true; + } + + return false; + } + + /** + * Set the current request instance. + * + * @param \Illuminate\Http\Request $request + * @return $this + */ + public function setRequest(Request $request) + { + $this->request = $request; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/composer.json b/vendor/laravel/framework/src/Illuminate/Auth/composer.json new file mode 100644 index 00000000..dacafaaa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/composer.json @@ -0,0 +1,42 @@ +{ + "name": "illuminate/auth", + "description": "The Illuminate Auth package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/contracts": "^6.0", + "illuminate/http": "^6.0", + "illuminate/queue": "^6.0", + "illuminate/support": "^6.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Auth\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "suggest": { + "illuminate/console": "Required to use the auth:clear-resets command (^6.0).", + "illuminate/queue": "Required to fire login / logout events (^6.0).", + "illuminate/session": "Required to use the session based guard (^6.0)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastController.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastController.php new file mode 100644 index 00000000..486a6023 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastController.php @@ -0,0 +1,25 @@ +hasSession()) { + $request->session()->reflash(); + } + + return Broadcast::auth($request); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php new file mode 100644 index 00000000..775df780 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php @@ -0,0 +1,127 @@ +event = $event; + $this->tries = property_exists($event, 'tries') ? $event->tries : null; + $this->timeout = property_exists($event, 'timeout') ? $event->timeout : null; + } + + /** + * Handle the queued job. + * + * @param \Illuminate\Contracts\Broadcasting\Broadcaster $broadcaster + * @return void + */ + public function handle(Broadcaster $broadcaster) + { + $name = method_exists($this->event, 'broadcastAs') + ? $this->event->broadcastAs() : get_class($this->event); + + $broadcaster->broadcast( + Arr::wrap($this->event->broadcastOn()), $name, + $this->getPayloadFromEvent($this->event) + ); + } + + /** + * Get the payload for the given event. + * + * @param mixed $event + * @return array + */ + protected function getPayloadFromEvent($event) + { + if (method_exists($event, 'broadcastWith')) { + return array_merge( + $event->broadcastWith(), ['socket' => data_get($event, 'socket')] + ); + } + + $payload = []; + + foreach ((new ReflectionClass($event))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { + $payload[$property->getName()] = $this->formatProperty($property->getValue($event)); + } + + unset($payload['broadcastQueue']); + + return $payload; + } + + /** + * Format the given value for a property. + * + * @param mixed $value + * @return mixed + */ + protected function formatProperty($value) + { + if ($value instanceof Arrayable) { + return $value->toArray(); + } + + return $value; + } + + /** + * Get the display name for the queued job. + * + * @return string + */ + public function displayName() + { + return get_class($this->event); + } + + /** + * Prepare the instance for cloning. + * + * @return void + */ + public function __clone() + { + $this->event = clone $this->event; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastException.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastException.php new file mode 100644 index 00000000..8fd55f7c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastException.php @@ -0,0 +1,10 @@ +app = $app; + } + + /** + * Register the routes for handling broadcast authentication and sockets. + * + * @param array|null $attributes + * @return void + */ + public function routes(array $attributes = null) + { + if ($this->app->routesAreCached()) { + return; + } + + $attributes = $attributes ?: ['middleware' => ['web']]; + + $this->app['router']->group($attributes, function ($router) { + $router->match( + ['get', 'post'], '/broadcasting/auth', + '\\'.BroadcastController::class.'@authenticate' + ); + }); + } + + /** + * Get the socket ID for the given request. + * + * @param \Illuminate\Http\Request|null $request + * @return string|null + */ + public function socket($request = null) + { + if (! $request && ! $this->app->bound('request')) { + return; + } + + $request = $request ?: $this->app['request']; + + return $request->header('X-Socket-ID'); + } + + /** + * Begin broadcasting an event. + * + * @param mixed|null $event + * @return \Illuminate\Broadcasting\PendingBroadcast + */ + public function event($event = null) + { + return new PendingBroadcast($this->app->make('events'), $event); + } + + /** + * Queue the given event for broadcast. + * + * @param mixed $event + * @return void + */ + public function queue($event) + { + if ($event instanceof ShouldBroadcastNow) { + return $this->app->make(BusDispatcherContract::class)->dispatchNow(new BroadcastEvent(clone $event)); + } + + $queue = null; + + if (method_exists($event, 'broadcastQueue')) { + $queue = $event->broadcastQueue(); + } elseif (isset($event->broadcastQueue)) { + $queue = $event->broadcastQueue; + } elseif (isset($event->queue)) { + $queue = $event->queue; + } + + $this->app->make('queue')->connection($event->connection ?? null)->pushOn( + $queue, new BroadcastEvent(clone $event) + ); + } + + /** + * Get a driver instance. + * + * @param string|null $driver + * @return mixed + */ + public function connection($driver = null) + { + return $this->driver($driver); + } + + /** + * Get a driver instance. + * + * @param string|null $name + * @return mixed + */ + public function driver($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return $this->drivers[$name] = $this->get($name); + } + + /** + * Attempt to get the connection from the local cache. + * + * @param string $name + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function get($name) + { + return $this->drivers[$name] ?? $this->resolve($name); + } + + /** + * Resolve the given broadcaster. + * + * @param string $name + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (isset($this->customCreators[$config['driver']])) { + return $this->callCustomCreator($config); + } + + $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; + + if (! method_exists($this, $driverMethod)) { + throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); + } + + return $this->{$driverMethod}($config); + } + + /** + * Call a custom driver creator. + * + * @param array $config + * @return mixed + */ + protected function callCustomCreator(array $config) + { + return $this->customCreators[$config['driver']]($this->app, $config); + } + + /** + * Create an instance of the driver. + * + * @param array $config + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function createPusherDriver(array $config) + { + $pusher = new Pusher( + $config['key'], $config['secret'], + $config['app_id'], $config['options'] ?? [] + ); + + if ($config['log'] ?? false) { + $pusher->setLogger($this->app->make(LoggerInterface::class)); + } + + return new PusherBroadcaster($pusher); + } + + /** + * Create an instance of the driver. + * + * @param array $config + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function createRedisDriver(array $config) + { + return new RedisBroadcaster( + $this->app->make('redis'), $config['connection'] ?? null, + $this->app['config']->get('database.redis.options.prefix', '') + ); + } + + /** + * Create an instance of the driver. + * + * @param array $config + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function createLogDriver(array $config) + { + return new LogBroadcaster( + $this->app->make(LoggerInterface::class) + ); + } + + /** + * Create an instance of the driver. + * + * @param array $config + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function createNullDriver(array $config) + { + return new NullBroadcaster; + } + + /** + * Get the connection configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + if (! is_null($name) && $name !== 'null') { + return $this->app['config']["broadcasting.connections.{$name}"]; + } + + return ['driver' => 'null']; + } + + /** + * Get the default driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['broadcasting.default']; + } + + /** + * Set the default driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['broadcasting.default'] = $name; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback; + + return $this; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->driver()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php new file mode 100644 index 00000000..e6897e2d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php @@ -0,0 +1,45 @@ +app->singleton(BroadcastManager::class, function ($app) { + return new BroadcastManager($app); + }); + + $this->app->singleton(BroadcasterContract::class, function ($app) { + return $app->make(BroadcastManager::class)->connection(); + }); + + $this->app->alias( + BroadcastManager::class, BroadcastingFactory::class + ); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + BroadcastManager::class, + BroadcastingFactory::class, + BroadcasterContract::class, + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php new file mode 100644 index 00000000..f626187b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php @@ -0,0 +1,330 @@ +channels[$channel] = $callback; + + $this->channelOptions[$channel] = $options; + + return $this; + } + + /** + * Authenticate the incoming request for a given channel. + * + * @param \Illuminate\Http\Request $request + * @param string $channel + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException + */ + protected function verifyUserCanAccessChannel($request, $channel) + { + foreach ($this->channels as $pattern => $callback) { + if (! $this->channelNameMatchesPattern($channel, $pattern)) { + continue; + } + + $parameters = $this->extractAuthParameters($pattern, $channel, $callback); + + $handler = $this->normalizeChannelHandlerToCallable($callback); + + if ($result = $handler($this->retrieveUser($request, $channel), ...$parameters)) { + return $this->validAuthenticationResponse($request, $result); + } + } + + throw new AccessDeniedHttpException; + } + + /** + * Extract the parameters from the given pattern and channel. + * + * @param string $pattern + * @param string $channel + * @param callable|string $callback + * @return array + */ + protected function extractAuthParameters($pattern, $channel, $callback) + { + $callbackParameters = $this->extractParameters($callback); + + return collect($this->extractChannelKeys($pattern, $channel))->reject(function ($value, $key) { + return is_numeric($key); + })->map(function ($value, $key) use ($callbackParameters) { + return $this->resolveBinding($key, $value, $callbackParameters); + })->values()->all(); + } + + /** + * Extracts the parameters out of what the user passed to handle the channel authentication. + * + * @param callable|string $callback + * @return \ReflectionParameter[] + * + * @throws \Exception + */ + protected function extractParameters($callback) + { + if (is_callable($callback)) { + return (new ReflectionFunction($callback))->getParameters(); + } elseif (is_string($callback)) { + return $this->extractParametersFromClass($callback); + } + + throw new Exception('Given channel handler is an unknown type.'); + } + + /** + * Extracts the parameters out of a class channel's "join" method. + * + * @param string $callback + * @return \ReflectionParameter[] + * + * @throws \Exception + */ + protected function extractParametersFromClass($callback) + { + $reflection = new ReflectionClass($callback); + + if (! $reflection->hasMethod('join')) { + throw new Exception('Class based channel must define a "join" method.'); + } + + return $reflection->getMethod('join')->getParameters(); + } + + /** + * Extract the channel keys from the incoming channel name. + * + * @param string $pattern + * @param string $channel + * @return array + */ + protected function extractChannelKeys($pattern, $channel) + { + preg_match('/^'.preg_replace('/\{(.*?)\}/', '(?<$1>[^\.]+)', $pattern).'/', $channel, $keys); + + return $keys; + } + + /** + * Resolve the given parameter binding. + * + * @param string $key + * @param string $value + * @param array $callbackParameters + * @return mixed + */ + protected function resolveBinding($key, $value, $callbackParameters) + { + $newValue = $this->resolveExplicitBindingIfPossible($key, $value); + + return $newValue === $value ? $this->resolveImplicitBindingIfPossible( + $key, $value, $callbackParameters + ) : $newValue; + } + + /** + * Resolve an explicit parameter binding if applicable. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function resolveExplicitBindingIfPossible($key, $value) + { + $binder = $this->binder(); + + if ($binder && $binder->getBindingCallback($key)) { + return call_user_func($binder->getBindingCallback($key), $value); + } + + return $value; + } + + /** + * Resolve an implicit parameter binding if applicable. + * + * @param string $key + * @param mixed $value + * @param array $callbackParameters + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException + */ + protected function resolveImplicitBindingIfPossible($key, $value, $callbackParameters) + { + foreach ($callbackParameters as $parameter) { + if (! $this->isImplicitlyBindable($key, $parameter)) { + continue; + } + + $className = Reflector::getParameterClassName($parameter); + + if (is_null($model = (new $className)->resolveRouteBinding($value))) { + throw new AccessDeniedHttpException; + } + + return $model; + } + + return $value; + } + + /** + * Determine if a given key and parameter is implicitly bindable. + * + * @param string $key + * @param \ReflectionParameter $parameter + * @return bool + */ + protected function isImplicitlyBindable($key, $parameter) + { + return $parameter->getName() === $key && + Reflector::isParameterSubclassOf($parameter, UrlRoutable::class); + } + + /** + * Format the channel array into an array of strings. + * + * @param array $channels + * @return array + */ + protected function formatChannels(array $channels) + { + return array_map(function ($channel) { + return (string) $channel; + }, $channels); + } + + /** + * Get the model binding registrar instance. + * + * @return \Illuminate\Contracts\Routing\BindingRegistrar + */ + protected function binder() + { + if (! $this->bindingRegistrar) { + $this->bindingRegistrar = Container::getInstance()->bound(BindingRegistrar::class) + ? Container::getInstance()->make(BindingRegistrar::class) : null; + } + + return $this->bindingRegistrar; + } + + /** + * Normalize the given callback into a callable. + * + * @param mixed $callback + * @return \Closure|callable + */ + protected function normalizeChannelHandlerToCallable($callback) + { + return is_callable($callback) ? $callback : function (...$args) use ($callback) { + return Container::getInstance() + ->make($callback) + ->join(...$args); + }; + } + + /** + * Retrieve the authenticated user using the configured guard (if any). + * + * @param \Illuminate\Http\Request $request + * @param string $channel + * @return mixed + */ + protected function retrieveUser($request, $channel) + { + $options = $this->retrieveChannelOptions($channel); + + $guards = $options['guards'] ?? null; + + if (is_null($guards)) { + return $request->user(); + } + + foreach (Arr::wrap($guards) as $guard) { + if ($user = $request->user($guard)) { + return $user; + } + } + } + + /** + * Retrieve options for a certain channel. + * + * @param string $channel + * @return array + */ + protected function retrieveChannelOptions($channel) + { + foreach ($this->channelOptions as $pattern => $options) { + if (! $this->channelNameMatchesPattern($channel, $pattern)) { + continue; + } + + return $options; + } + + return []; + } + + /** + * Check if channel name from request match a pattern from registered channels. + * + * @param string $channel + * @param string $pattern + * @return bool + */ + protected function channelNameMatchesPattern($channel, $pattern) + { + return Str::is(preg_replace('/\{(.*?)\}/', '*', $pattern), $channel); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php new file mode 100644 index 00000000..50877dc9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php @@ -0,0 +1,54 @@ +logger = $logger; + } + + /** + * {@inheritdoc} + */ + public function auth($request) + { + // + } + + /** + * {@inheritdoc} + */ + public function validAuthenticationResponse($request, $result) + { + // + } + + /** + * {@inheritdoc} + */ + public function broadcast(array $channels, $event, array $payload = []) + { + $channels = implode(', ', $this->formatChannels($channels)); + + $payload = json_encode($payload, JSON_PRETTY_PRINT); + + $this->logger->info('Broadcasting ['.$event.'] on channels ['.$channels.'] with payload:'.PHP_EOL.$payload); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/NullBroadcaster.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/NullBroadcaster.php new file mode 100644 index 00000000..6205c90c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/NullBroadcaster.php @@ -0,0 +1,30 @@ +pusher = $pusher; + } + + /** + * Authenticate the incoming request for a given channel. + * + * @param \Illuminate\Http\Request $request + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException + */ + public function auth($request) + { + $channelName = $this->normalizeChannelName($request->channel_name); + + if ($this->isGuardedChannel($request->channel_name) && + ! $this->retrieveUser($request, $channelName)) { + throw new AccessDeniedHttpException; + } + + return parent::verifyUserCanAccessChannel( + $request, $channelName + ); + } + + /** + * Return the valid authentication response. + * + * @param \Illuminate\Http\Request $request + * @param mixed $result + * @return mixed + */ + public function validAuthenticationResponse($request, $result) + { + if (Str::startsWith($request->channel_name, 'private')) { + return $this->decodePusherResponse( + $request, $this->pusher->socket_auth($request->channel_name, $request->socket_id) + ); + } + + $channelName = $this->normalizeChannelName($request->channel_name); + + return $this->decodePusherResponse( + $request, + $this->pusher->presence_auth( + $request->channel_name, $request->socket_id, + $this->retrieveUser($request, $channelName)->getAuthIdentifier(), $result + ) + ); + } + + /** + * Decode the given Pusher response. + * + * @param \Illuminate\Http\Request $request + * @param mixed $response + * @return array + */ + protected function decodePusherResponse($request, $response) + { + if (! $request->input('callback', false)) { + return json_decode($response, true); + } + + return response()->json(json_decode($response, true)) + ->withCallback($request->callback); + } + + /** + * Broadcast the given event. + * + * @param array $channels + * @param string $event + * @param array $payload + * @return void + * + * @throws \Illuminate\Broadcasting\BroadcastException + */ + public function broadcast(array $channels, $event, array $payload = []) + { + $socket = Arr::pull($payload, 'socket'); + + $response = $this->pusher->trigger( + $this->formatChannels($channels), $event, $payload, $socket, true + ); + + if ((is_array($response) && $response['status'] >= 200 && $response['status'] <= 299) + || $response === true) { + return; + } + + throw new BroadcastException( + ! empty($response['body']) + ? sprintf('Pusher error: %s.', $response['body']) + : 'Failed to connect to Pusher.' + ); + } + + /** + * Get the Pusher SDK instance. + * + * @return \Pusher\Pusher + */ + public function getPusher() + { + return $this->pusher; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php new file mode 100644 index 00000000..18cb0fef --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php @@ -0,0 +1,151 @@ +redis = $redis; + $this->prefix = $prefix; + $this->connection = $connection; + } + + /** + * Authenticate the incoming request for a given channel. + * + * @param \Illuminate\Http\Request $request + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException + */ + public function auth($request) + { + $channelName = $this->normalizeChannelName( + str_replace($this->prefix, '', $request->channel_name) + ); + + if ($this->isGuardedChannel($request->channel_name) && + ! $this->retrieveUser($request, $channelName)) { + throw new AccessDeniedHttpException; + } + + return parent::verifyUserCanAccessChannel( + $request, $channelName + ); + } + + /** + * Return the valid authentication response. + * + * @param \Illuminate\Http\Request $request + * @param mixed $result + * @return mixed + */ + public function validAuthenticationResponse($request, $result) + { + if (is_bool($result)) { + return json_encode($result); + } + + $channelName = $this->normalizeChannelName($request->channel_name); + + return json_encode(['channel_data' => [ + 'user_id' => $this->retrieveUser($request, $channelName)->getAuthIdentifier(), + 'user_info' => $result, + ]]); + } + + /** + * Broadcast the given event. + * + * @param array $channels + * @param string $event + * @param array $payload + * @return void + */ + public function broadcast(array $channels, $event, array $payload = []) + { + if (empty($channels)) { + return; + } + + $connection = $this->redis->connection($this->connection); + + $payload = json_encode([ + 'event' => $event, + 'data' => $payload, + 'socket' => Arr::pull($payload, 'socket'), + ]); + + $connection->eval( + $this->broadcastMultipleChannelsScript(), + 0, $payload, ...$this->formatChannels($channels) + ); + } + + /** + * Get the Lua script for broadcasting to multiple channels. + * + * ARGV[1] - The payload + * ARGV[2...] - The channels + * + * @return string + */ + protected function broadcastMultipleChannelsScript() + { + return <<<'LUA' +for i = 2, #ARGV do + redis.call('publish', ARGV[i], ARGV[1]) +end +LUA; + } + + /** + * Format the channel array into an array of strings. + * + * @param array $channels + * @return array + */ + protected function formatChannels(array $channels) + { + return array_map(function ($channel) { + return $this->prefix.$channel; + }, parent::formatChannels($channels)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/UsePusherChannelConventions.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/UsePusherChannelConventions.php new file mode 100644 index 00000000..07c707ce --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/UsePusherChannelConventions.php @@ -0,0 +1,36 @@ +name = $name; + } + + /** + * Convert the channel instance to a string. + * + * @return string + */ + public function __toString() + { + return $this->name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/EncryptedPrivateChannel.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/EncryptedPrivateChannel.php new file mode 100644 index 00000000..76977c15 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/EncryptedPrivateChannel.php @@ -0,0 +1,17 @@ +socket = Broadcast::socket(); + + return $this; + } + + /** + * Broadcast the event to everyone. + * + * @return $this + */ + public function broadcastToEveryone() + { + $this->socket = null; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Broadcasting/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Broadcasting/PendingBroadcast.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/PendingBroadcast.php new file mode 100644 index 00000000..b7550290 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/PendingBroadcast.php @@ -0,0 +1,59 @@ +event = $event; + $this->events = $events; + } + + /** + * Broadcast the event to everyone except the current user. + * + * @return $this + */ + public function toOthers() + { + if (method_exists($this->event, 'dontBroadcastToCurrentUser')) { + $this->event->dontBroadcastToCurrentUser(); + } + + return $this; + } + + /** + * Handle the object's destruction. + * + * @return void + */ + public function __destruct() + { + $this->events->dispatch($this->event); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/PresenceChannel.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/PresenceChannel.php new file mode 100644 index 00000000..22de12d3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/PresenceChannel.php @@ -0,0 +1,17 @@ +app->singleton(Dispatcher::class, function ($app) { + return new Dispatcher($app, function ($connection = null) use ($app) { + return $app[QueueFactoryContract::class]->connection($connection); + }); + }); + + $this->app->alias( + Dispatcher::class, DispatcherContract::class + ); + + $this->app->alias( + Dispatcher::class, QueueingDispatcherContract::class + ); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + Dispatcher::class, + DispatcherContract::class, + QueueingDispatcherContract::class, + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php b/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php new file mode 100644 index 00000000..9d809620 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php @@ -0,0 +1,224 @@ +container = $container; + $this->queueResolver = $queueResolver; + $this->pipeline = new Pipeline($container); + } + + /** + * Dispatch a command to its appropriate handler. + * + * @param mixed $command + * @return mixed + */ + public function dispatch($command) + { + if ($this->queueResolver && $this->commandShouldBeQueued($command)) { + return $this->dispatchToQueue($command); + } + + return $this->dispatchNow($command); + } + + /** + * Dispatch a command to its appropriate handler in the current process. + * + * @param mixed $command + * @param mixed $handler + * @return mixed + */ + public function dispatchNow($command, $handler = null) + { + if ($handler || $handler = $this->getCommandHandler($command)) { + $callback = function ($command) use ($handler) { + return $handler->handle($command); + }; + } else { + $callback = function ($command) { + return $this->container->call([$command, 'handle']); + }; + } + + return $this->pipeline->send($command)->through($this->pipes)->then($callback); + } + + /** + * Determine if the given command has a handler. + * + * @param mixed $command + * @return bool + */ + public function hasCommandHandler($command) + { + return array_key_exists(get_class($command), $this->handlers); + } + + /** + * Retrieve the handler for a command. + * + * @param mixed $command + * @return bool|mixed + */ + public function getCommandHandler($command) + { + if ($this->hasCommandHandler($command)) { + return $this->container->make($this->handlers[get_class($command)]); + } + + return false; + } + + /** + * Determine if the given command should be queued. + * + * @param mixed $command + * @return bool + */ + protected function commandShouldBeQueued($command) + { + return $command instanceof ShouldQueue; + } + + /** + * Dispatch a command to its appropriate handler behind a queue. + * + * @param mixed $command + * @return mixed + */ + public function dispatchToQueue($command) + { + $connection = $command->connection ?? null; + + $queue = call_user_func($this->queueResolver, $connection); + + if (! $queue instanceof Queue) { + throw new RuntimeException('Queue resolver did not return a Queue implementation.'); + } + + if (method_exists($command, 'queue')) { + return $command->queue($queue, $command); + } + + return $this->pushCommandToQueue($queue, $command); + } + + /** + * Push the command onto the given queue instance. + * + * @param \Illuminate\Contracts\Queue\Queue $queue + * @param mixed $command + * @return mixed + */ + protected function pushCommandToQueue($queue, $command) + { + if (isset($command->queue, $command->delay)) { + return $queue->laterOn($command->queue, $command->delay, $command); + } + + if (isset($command->queue)) { + return $queue->pushOn($command->queue, $command); + } + + if (isset($command->delay)) { + return $queue->later($command->delay, $command); + } + + return $queue->push($command); + } + + /** + * Dispatch a command to its appropriate handler after the current process. + * + * @param mixed $command + * @param mixed $handler + * @return void + */ + public function dispatchAfterResponse($command, $handler = null) + { + $this->container->terminating(function () use ($command, $handler) { + $this->dispatchNow($command, $handler); + }); + } + + /** + * Set the pipes through which commands should be piped before dispatching. + * + * @param array $pipes + * @return $this + */ + public function pipeThrough(array $pipes) + { + $this->pipes = $pipes; + + return $this; + } + + /** + * Map a command to a handler. + * + * @param array $map + * @return $this + */ + public function map(array $map) + { + $this->handlers = array_merge($this->handlers, $map); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Bus/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Bus/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Bus/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Bus/Queueable.php b/vendor/laravel/framework/src/Illuminate/Bus/Queueable.php new file mode 100644 index 00000000..073347cc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Bus/Queueable.php @@ -0,0 +1,180 @@ +connection = $connection; + + return $this; + } + + /** + * Set the desired queue for the job. + * + * @param string|null $queue + * @return $this + */ + public function onQueue($queue) + { + $this->queue = $queue; + + return $this; + } + + /** + * Set the desired connection for the chain. + * + * @param string|null $connection + * @return $this + */ + public function allOnConnection($connection) + { + $this->chainConnection = $connection; + $this->connection = $connection; + + return $this; + } + + /** + * Set the desired queue for the chain. + * + * @param string|null $queue + * @return $this + */ + public function allOnQueue($queue) + { + $this->chainQueue = $queue; + $this->queue = $queue; + + return $this; + } + + /** + * Set the desired delay for the job. + * + * @param \DateTimeInterface|\DateInterval|int|null $delay + * @return $this + */ + public function delay($delay) + { + $this->delay = $delay; + + return $this; + } + + /** + * Get the middleware the job should be dispatched through. + * + * @return array + */ + public function middleware() + { + return []; + } + + /** + * Specify the middleware the job should be dispatched through. + * + * @param array|object $middleware + * @return $this + */ + public function through($middleware) + { + $this->middleware = Arr::wrap($middleware); + + return $this; + } + + /** + * Set the jobs that should run if this job is successful. + * + * @param array $chain + * @return $this + */ + public function chain($chain) + { + $this->chained = collect($chain)->map(function ($job) { + return serialize($job); + })->all(); + + return $this; + } + + /** + * Dispatch the next job on the chain. + * + * @return void + */ + public function dispatchNextJobInChain() + { + if (! empty($this->chained)) { + dispatch(tap(unserialize(array_shift($this->chained)), function ($next) { + $next->chained = $this->chained; + + $next->onConnection($next->connection ?: $this->chainConnection); + $next->onQueue($next->queue ?: $this->chainQueue); + + $next->chainConnection = $this->chainConnection; + $next->chainQueue = $this->chainQueue; + })); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Bus/composer.json b/vendor/laravel/framework/src/Illuminate/Bus/composer.json new file mode 100644 index 00000000..e133ae33 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Bus/composer.json @@ -0,0 +1,36 @@ +{ + "name": "illuminate/bus", + "description": "The Illuminate Bus package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/contracts": "^6.0", + "illuminate/pipeline": "^6.0", + "illuminate/support": "^6.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Bus\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/ApcStore.php b/vendor/laravel/framework/src/Illuminate/Cache/ApcStore.php new file mode 100755 index 00000000..90132c16 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/ApcStore.php @@ -0,0 +1,130 @@ +apc = $apc; + $this->prefix = $prefix; + } + + /** + * Retrieve an item from the cache by key. + * + * @param string|array $key + * @return mixed + */ + public function get($key) + { + $value = $this->apc->get($this->prefix.$key); + + if ($value !== false) { + return $value; + } + } + + /** + * Store an item in the cache for a given number of seconds. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return bool + */ + public function put($key, $value, $seconds) + { + return $this->apc->put($this->prefix.$key, $value, $seconds); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + return $this->apc->increment($this->prefix.$key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + return $this->apc->decrement($this->prefix.$key, $value); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return bool + */ + public function forever($key, $value) + { + return $this->put($key, $value, 0); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return $this->apc->delete($this->prefix.$key); + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + return $this->apc->flush(); + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/ApcWrapper.php b/vendor/laravel/framework/src/Illuminate/Cache/ApcWrapper.php new file mode 100755 index 00000000..6c129c63 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/ApcWrapper.php @@ -0,0 +1,92 @@ +apcu = function_exists('apcu_fetch'); + } + + /** + * Get an item from the cache. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + return $this->apcu ? apcu_fetch($key) : apc_fetch($key); + } + + /** + * Store an item in the cache. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return array|bool + */ + public function put($key, $value, $seconds) + { + return $this->apcu ? apcu_store($key, $value, $seconds) : apc_store($key, $value, $seconds); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value) + { + return $this->apcu ? apcu_inc($key, $value) : apc_inc($key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value) + { + return $this->apcu ? apcu_dec($key, $value) : apc_dec($key, $value); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function delete($key) + { + return $this->apcu ? apcu_delete($key) : apc_delete($key); + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + return $this->apcu ? apcu_clear_cache() : apc_clear_cache('user'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/ArrayLock.php b/vendor/laravel/framework/src/Illuminate/Cache/ArrayLock.php new file mode 100644 index 00000000..8bb4938c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/ArrayLock.php @@ -0,0 +1,102 @@ +store = $store; + } + + /** + * Attempt to acquire the lock. + * + * @return bool + */ + public function acquire() + { + $expiration = $this->store->locks[$this->name]['expiresAt'] ?? Carbon::now()->addSecond(); + + if ($this->exists() && $expiration->isFuture()) { + return false; + } + + $this->store->locks[$this->name] = [ + 'owner' => $this->owner, + 'expiresAt' => $this->seconds === 0 ? null : Carbon::now()->addSeconds($this->seconds), + ]; + + return true; + } + + /** + * Determine if the current lock exists. + * + * @return bool + */ + protected function exists() + { + return isset($this->store->locks[$this->name]); + } + + /** + * Release the lock. + * + * @return bool + */ + public function release() + { + if (! $this->exists()) { + return false; + } + + if (! $this->isOwnedByCurrentProcess()) { + return false; + } + + $this->forceRelease(); + + return true; + } + + /** + * Returns the owner value written into the driver for this lock. + * + * @return string + */ + protected function getCurrentOwner() + { + return $this->store->locks[$this->name]['owner']; + } + + /** + * Releases this lock in disregard of ownership. + * + * @return void + */ + public function forceRelease() + { + unset($this->store->locks[$this->name]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/ArrayStore.php b/vendor/laravel/framework/src/Illuminate/Cache/ArrayStore.php new file mode 100644 index 00000000..1914a832 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/ArrayStore.php @@ -0,0 +1,198 @@ +storage[$key])) { + return; + } + + $item = $this->storage[$key]; + + $expiresAt = $item['expiresAt'] ?? 0; + + if ($expiresAt !== 0 && $this->currentTime() > $expiresAt) { + $this->forget($key); + + return; + } + + return $item['value']; + } + + /** + * Store an item in the cache for a given number of seconds. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return bool + */ + public function put($key, $value, $seconds) + { + $this->storage[$key] = [ + 'value' => $value, + 'expiresAt' => $this->calculateExpiration($seconds), + ]; + + return true; + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function increment($key, $value = 1) + { + if (! isset($this->storage[$key])) { + $this->forever($key, $value); + + return $this->storage[$key]['value']; + } + + $this->storage[$key]['value'] = ((int) $this->storage[$key]['value']) + $value; + + return $this->storage[$key]['value']; + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function decrement($key, $value = 1) + { + return $this->increment($key, $value * -1); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return bool + */ + public function forever($key, $value) + { + return $this->put($key, $value, 0); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + if (array_key_exists($key, $this->storage)) { + unset($this->storage[$key]); + + return true; + } + + return false; + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + $this->storage = []; + + return true; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return ''; + } + + /** + * Get the expiration time of the key. + * + * @param int $seconds + * @return int + */ + protected function calculateExpiration($seconds) + { + return $this->toTimestamp($seconds); + } + + /** + * Get the UNIX timestamp for the given number of seconds. + * + * @param int $seconds + * @return int + */ + protected function toTimestamp($seconds) + { + return $seconds > 0 ? $this->availableAt($seconds) : 0; + } + + /** + * Get a lock instance. + * + * @param string $name + * @param int $seconds + * @param string|null $owner + * @return \Illuminate\Contracts\Cache\Lock + */ + public function lock($name, $seconds = 0, $owner = null) + { + return new ArrayLock($this, $name, $seconds, $owner); + } + + /** + * Restore a lock instance using the owner identifier. + * + * @param string $name + * @param string $owner + * @return \Illuminate\Contracts\Cache\Lock + */ + public function restoreLock($name, $owner) + { + return $this->lock($name, 0, $owner); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php b/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php new file mode 100755 index 00000000..1f514369 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php @@ -0,0 +1,392 @@ +app = $app; + } + + /** + * Get a cache store instance by name, wrapped in a repository. + * + * @param string|null $name + * @return \Illuminate\Contracts\Cache\Repository + */ + public function store($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return $this->stores[$name] = $this->get($name); + } + + /** + * Get a cache driver instance. + * + * @param string|null $driver + * @return \Illuminate\Contracts\Cache\Repository + */ + public function driver($driver = null) + { + return $this->store($driver); + } + + /** + * Attempt to get the store from the local cache. + * + * @param string $name + * @return \Illuminate\Contracts\Cache\Repository + */ + protected function get($name) + { + return $this->stores[$name] ?? $this->resolve($name); + } + + /** + * Resolve the given store. + * + * @param string $name + * @return \Illuminate\Contracts\Cache\Repository + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (is_null($config)) { + throw new InvalidArgumentException("Cache store [{$name}] is not defined."); + } + + if (isset($this->customCreators[$config['driver']])) { + return $this->callCustomCreator($config); + } else { + $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; + + if (method_exists($this, $driverMethod)) { + return $this->{$driverMethod}($config); + } else { + throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); + } + } + } + + /** + * Call a custom driver creator. + * + * @param array $config + * @return mixed + */ + protected function callCustomCreator(array $config) + { + return $this->customCreators[$config['driver']]($this->app, $config); + } + + /** + * Create an instance of the APC cache driver. + * + * @param array $config + * @return \Illuminate\Cache\Repository + */ + protected function createApcDriver(array $config) + { + $prefix = $this->getPrefix($config); + + return $this->repository(new ApcStore(new ApcWrapper, $prefix)); + } + + /** + * Create an instance of the array cache driver. + * + * @return \Illuminate\Cache\Repository + */ + protected function createArrayDriver() + { + return $this->repository(new ArrayStore); + } + + /** + * Create an instance of the file cache driver. + * + * @param array $config + * @return \Illuminate\Cache\Repository + */ + protected function createFileDriver(array $config) + { + return $this->repository(new FileStore($this->app['files'], $config['path'], $config['permission'] ?? null)); + } + + /** + * Create an instance of the Memcached cache driver. + * + * @param array $config + * @return \Illuminate\Cache\Repository + */ + protected function createMemcachedDriver(array $config) + { + $prefix = $this->getPrefix($config); + + $memcached = $this->app['memcached.connector']->connect( + $config['servers'], + $config['persistent_id'] ?? null, + $config['options'] ?? [], + array_filter($config['sasl'] ?? []) + ); + + return $this->repository(new MemcachedStore($memcached, $prefix)); + } + + /** + * Create an instance of the Null cache driver. + * + * @return \Illuminate\Cache\Repository + */ + protected function createNullDriver() + { + return $this->repository(new NullStore); + } + + /** + * Create an instance of the Redis cache driver. + * + * @param array $config + * @return \Illuminate\Cache\Repository + */ + protected function createRedisDriver(array $config) + { + $redis = $this->app['redis']; + + $connection = $config['connection'] ?? 'default'; + + return $this->repository(new RedisStore($redis, $this->getPrefix($config), $connection)); + } + + /** + * Create an instance of the database cache driver. + * + * @param array $config + * @return \Illuminate\Cache\Repository + */ + protected function createDatabaseDriver(array $config) + { + $connection = $this->app['db']->connection($config['connection'] ?? null); + + return $this->repository( + new DatabaseStore( + $connection, $config['table'], $this->getPrefix($config) + ) + ); + } + + /** + * Create an instance of the DynamoDB cache driver. + * + * @param array $config + * @return \Illuminate\Cache\Repository + */ + protected function createDynamodbDriver(array $config) + { + $client = $this->newDynamodbClient($config); + + return $this->repository( + new DynamoDbStore( + $client, + $config['table'], + $config['attributes']['key'] ?? 'key', + $config['attributes']['value'] ?? 'value', + $config['attributes']['expiration'] ?? 'expires_at', + $this->getPrefix($config) + ) + ); + } + + /** + * Create new DynamoDb Client instance. + * + * @return DynamoDbClient + */ + protected function newDynamodbClient(array $config) + { + $dynamoConfig = [ + 'region' => $config['region'], + 'version' => 'latest', + 'endpoint' => $config['endpoint'] ?? null, + ]; + + if (isset($config['key']) && isset($config['secret'])) { + $dynamoConfig['credentials'] = Arr::only( + $config, ['key', 'secret', 'token'] + ); + } + + return new DynamoDbClient($dynamoConfig); + } + + /** + * Create a new cache repository with the given implementation. + * + * @param \Illuminate\Contracts\Cache\Store $store + * @return \Illuminate\Cache\Repository + */ + public function repository(Store $store) + { + return tap(new Repository($store), function ($repository) { + $this->setEventDispatcher($repository); + }); + } + + /** + * Set the event dispatcher on the given repository instance. + * + * @param \Illuminate\Cache\Repository $repository + * @return void + */ + protected function setEventDispatcher(Repository $repository) + { + if (! $this->app->bound(DispatcherContract::class)) { + return; + } + + $repository->setEventDispatcher( + $this->app[DispatcherContract::class] + ); + } + + /** + * Re-set the event dispatcher on all resolved cache repositories. + * + * @return void + */ + public function refreshEventDispatcher() + { + array_map([$this, 'setEventDispatcher'], $this->stores); + } + + /** + * Get the cache prefix. + * + * @param array $config + * @return string + */ + protected function getPrefix(array $config) + { + return $config['prefix'] ?? $this->app['config']['cache.prefix']; + } + + /** + * Get the cache connection configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["cache.stores.{$name}"]; + } + + /** + * Get the default cache driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['cache.default']; + } + + /** + * Set the default cache driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['cache.default'] = $name; + } + + /** + * Unset the given driver instances. + * + * @param array|string|null $name + * @return $this + */ + public function forgetDriver($name = null) + { + $name = $name ?? $this->getDefaultDriver(); + + foreach ((array) $name as $cacheName) { + if (isset($this->stores[$cacheName])) { + unset($this->stores[$cacheName]); + } + } + + return $this; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback->bindTo($this, $this); + + return $this; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->store()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php new file mode 100755 index 00000000..46fa0ae2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php @@ -0,0 +1,46 @@ +app->singleton('cache', function ($app) { + return new CacheManager($app); + }); + + $this->app->singleton('cache.store', function ($app) { + return $app['cache']->driver(); + }); + + $this->app->singleton('cache.psr6', function ($app) { + return new Psr16Adapter($app['cache.store']); + }); + + $this->app->singleton('memcached.connector', function () { + return new MemcachedConnector; + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'cache', 'cache.store', 'cache.psr6', 'memcached.connector', + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Console/CacheTableCommand.php b/vendor/laravel/framework/src/Illuminate/Cache/Console/CacheTableCommand.php new file mode 100644 index 00000000..a8c78c9e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Console/CacheTableCommand.php @@ -0,0 +1,81 @@ +files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $fullPath = $this->createBaseMigration(); + + $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/cache.stub')); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the table. + * + * @return string + */ + protected function createBaseMigration() + { + $name = 'create_cache_table'; + + $path = $this->laravel->databasePath().'/migrations'; + + return $this->laravel['migration.creator']->create($name, $path); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php b/vendor/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php new file mode 100755 index 00000000..aa88964d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php @@ -0,0 +1,145 @@ +cache = $cache; + $this->files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->laravel['events']->dispatch( + 'cache:clearing', [$this->argument('store'), $this->tags()] + ); + + $successful = $this->cache()->flush(); + + $this->flushFacades(); + + if (! $successful) { + return $this->error('Failed to clear cache. Make sure you have the appropriate permissions.'); + } + + $this->laravel['events']->dispatch( + 'cache:cleared', [$this->argument('store'), $this->tags()] + ); + + $this->info('Application cache cleared!'); + } + + /** + * Flush the real-time facades stored in the cache directory. + * + * @return void + */ + public function flushFacades() + { + if (! $this->files->exists($storagePath = storage_path('framework/cache'))) { + return; + } + + foreach ($this->files->files($storagePath) as $file) { + if (preg_match('/facade-.*\.php$/', $file)) { + $this->files->delete($file); + } + } + } + + /** + * Get the cache instance for the command. + * + * @return \Illuminate\Cache\Repository + */ + protected function cache() + { + $cache = $this->cache->store($this->argument('store')); + + return empty($this->tags()) ? $cache : $cache->tags($this->tags()); + } + + /** + * Get the tags passed to the command. + * + * @return array + */ + protected function tags() + { + return array_filter(explode(',', $this->option('tags'))); + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['store', InputArgument::OPTIONAL, 'The name of the store you would like to clear'], + ]; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['tags', null, InputOption::VALUE_OPTIONAL, 'The cache tags you would like to clear', null], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Console/ForgetCommand.php b/vendor/laravel/framework/src/Illuminate/Cache/Console/ForgetCommand.php new file mode 100755 index 00000000..eb0c0666 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Console/ForgetCommand.php @@ -0,0 +1,57 @@ +cache = $cache; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->cache->store($this->argument('store'))->forget( + $this->argument('key') + ); + + $this->info('The ['.$this->argument('key').'] key has been removed from the cache.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Console/stubs/cache.stub b/vendor/laravel/framework/src/Illuminate/Cache/Console/stubs/cache.stub new file mode 100644 index 00000000..7b73e5fd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Console/stubs/cache.stub @@ -0,0 +1,32 @@ +string('key')->unique(); + $table->mediumText('value'); + $table->integer('expiration'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cache'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php b/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php new file mode 100755 index 00000000..48844ebd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php @@ -0,0 +1,294 @@ +table = $table; + $this->prefix = $prefix; + $this->connection = $connection; + } + + /** + * Retrieve an item from the cache by key. + * + * @param string|array $key + * @return mixed + */ + public function get($key) + { + $prefixed = $this->prefix.$key; + + $cache = $this->table()->where('key', '=', $prefixed)->first(); + + // If we have a cache record we will check the expiration time against current + // time on the system and see if the record has expired. If it has, we will + // remove the records from the database table so it isn't returned again. + if (is_null($cache)) { + return; + } + + $cache = is_array($cache) ? (object) $cache : $cache; + + // If this cache expiration date is past the current time, we will remove this + // item from the cache. Then we will return a null value since the cache is + // expired. We will use "Carbon" to make this comparison with the column. + if ($this->currentTime() >= $cache->expiration) { + $this->forget($key); + + return; + } + + return $this->unserialize($cache->value); + } + + /** + * Store an item in the cache for a given number of seconds. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return bool + */ + public function put($key, $value, $seconds) + { + $key = $this->prefix.$key; + + $value = $this->serialize($value); + + $expiration = $this->getTime() + $seconds; + + try { + return $this->table()->insert(compact('key', 'value', 'expiration')); + } catch (Exception $e) { + $result = $this->table()->where('key', $key)->update(compact('value', 'expiration')); + + return $result > 0; + } + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + return $this->incrementOrDecrement($key, $value, function ($current, $value) { + return $current + $value; + }); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + return $this->incrementOrDecrement($key, $value, function ($current, $value) { + return $current - $value; + }); + } + + /** + * Increment or decrement an item in the cache. + * + * @param string $key + * @param mixed $value + * @param \Closure $callback + * @return int|bool + */ + protected function incrementOrDecrement($key, $value, Closure $callback) + { + return $this->connection->transaction(function () use ($key, $value, $callback) { + $prefixed = $this->prefix.$key; + + $cache = $this->table()->where('key', $prefixed) + ->lockForUpdate()->first(); + + // If there is no value in the cache, we will return false here. Otherwise the + // value will be decrypted and we will proceed with this function to either + // increment or decrement this value based on the given action callbacks. + if (is_null($cache)) { + return false; + } + + $cache = is_array($cache) ? (object) $cache : $cache; + + $current = $this->unserialize($cache->value); + + // Here we'll call this callback function that was given to the function which + // is used to either increment or decrement the function. We use a callback + // so we do not have to recreate all this logic in each of the functions. + $new = $callback((int) $current, $value); + + if (! is_numeric($current)) { + return false; + } + + // Here we will update the values in the table. We will also encrypt the value + // since database cache values are encrypted by default with secure storage + // that can't be easily read. We will return the new value after storing. + $this->table()->where('key', $prefixed)->update([ + 'value' => $this->serialize($new), + ]); + + return $new; + }); + } + + /** + * Get the current system time. + * + * @return int + */ + protected function getTime() + { + return $this->currentTime(); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return bool + */ + public function forever($key, $value) + { + return $this->put($key, $value, 315360000); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + $this->table()->where('key', '=', $this->prefix.$key)->delete(); + + return true; + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + $this->table()->delete(); + + return true; + } + + /** + * Get a query builder for the cache table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function table() + { + return $this->connection->table($this->table); + } + + /** + * Get the underlying database connection. + * + * @return \Illuminate\Database\ConnectionInterface + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Serialize the given value. + * + * @param mixed $value + * @return string + */ + protected function serialize($value) + { + $result = serialize($value); + + if ($this->connection instanceof PostgresConnection && Str::contains($result, "\0")) { + $result = base64_encode($result); + } + + return $result; + } + + /** + * Unserialize the given value. + * + * @param string $value + * @return mixed + */ + protected function unserialize($value) + { + if ($this->connection instanceof PostgresConnection && ! Str::contains($value, [':', ';'])) { + $value = base64_decode($value); + } + + return unserialize($value); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/DynamoDbLock.php b/vendor/laravel/framework/src/Illuminate/Cache/DynamoDbLock.php new file mode 100644 index 00000000..54eec53f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/DynamoDbLock.php @@ -0,0 +1,75 @@ +dynamo = $dynamo; + } + + /** + * Attempt to acquire the lock. + * + * @return bool + */ + public function acquire() + { + return $this->dynamo->add( + $this->name, $this->owner, $this->seconds + ); + } + + /** + * Release the lock. + * + * @return bool + */ + public function release() + { + if ($this->isOwnedByCurrentProcess()) { + return $this->dynamo->forget($this->name); + } + + return false; + } + + /** + * Release this lock in disregard of ownership. + * + * @return void + */ + public function forceRelease() + { + $this->dynamo->forget($this->name); + } + + /** + * Returns the owner value written into the driver for this lock. + * + * @return mixed + */ + protected function getCurrentOwner() + { + return $this->dynamo->get($this->name); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/DynamoDbStore.php b/vendor/laravel/framework/src/Illuminate/Cache/DynamoDbStore.php new file mode 100644 index 00000000..aa28a789 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/DynamoDbStore.php @@ -0,0 +1,538 @@ +table = $table; + $this->dynamo = $dynamo; + $this->keyAttribute = $keyAttribute; + $this->valueAttribute = $valueAttribute; + $this->expirationAttribute = $expirationAttribute; + + $this->setPrefix($prefix); + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + $response = $this->dynamo->getItem([ + 'TableName' => $this->table, + 'ConsistentRead' => false, + 'Key' => [ + $this->keyAttribute => [ + 'S' => $this->prefix.$key, + ], + ], + ]); + + if (! isset($response['Item'])) { + return; + } + + if ($this->isExpired($response['Item'])) { + return; + } + + if (isset($response['Item'][$this->valueAttribute])) { + return $this->unserialize( + $response['Item'][$this->valueAttribute]['S'] ?? + $response['Item'][$this->valueAttribute]['N'] ?? + null + ); + } + } + + /** + * Retrieve multiple items from the cache by key. + * + * Items not found in the cache will have a null value. + * + * @param array $keys + * @return array + */ + public function many(array $keys) + { + $prefixedKeys = array_map(function ($key) { + return $this->prefix.$key; + }, $keys); + + $response = $this->dynamo->batchGetItem([ + 'RequestItems' => [ + $this->table => [ + 'ConsistentRead' => false, + 'Keys' => collect($prefixedKeys)->map(function ($key) { + return [ + $this->keyAttribute => [ + 'S' => $key, + ], + ]; + })->all(), + ], + ], + ]); + + $now = Carbon::now(); + + return array_merge(collect(array_flip($keys))->map(function () { + // + })->all(), collect($response['Responses'][$this->table])->mapWithKeys(function ($response) use ($now) { + if ($this->isExpired($response, $now)) { + $value = null; + } else { + $value = $this->unserialize( + $response[$this->valueAttribute]['S'] ?? + $response[$this->valueAttribute]['N'] ?? + null + ); + } + + return [Str::replaceFirst($this->prefix, '', $response[$this->keyAttribute]['S']) => $value]; + })->all()); + } + + /** + * Determine if the given item is expired. + * + * @param array $item + * @param \DateTimeInterface|null $expiration + * @return bool + */ + protected function isExpired(array $item, $expiration = null) + { + $expiration = $expiration ?: Carbon::now(); + + return isset($item[$this->expirationAttribute]) && + $expiration->getTimestamp() >= $item[$this->expirationAttribute]['N']; + } + + /** + * Store an item in the cache for a given number of seconds. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return bool + */ + public function put($key, $value, $seconds) + { + $this->dynamo->putItem([ + 'TableName' => $this->table, + 'Item' => [ + $this->keyAttribute => [ + 'S' => $this->prefix.$key, + ], + $this->valueAttribute => [ + $this->type($value) => $this->serialize($value), + ], + $this->expirationAttribute => [ + 'N' => (string) $this->toTimestamp($seconds), + ], + ], + ]); + + return true; + } + + /** + * Store multiple items in the cache for a given number of $seconds. + * + * @param array $values + * @param int $seconds + * @return bool + */ + public function putMany(array $values, $seconds) + { + $expiration = $this->toTimestamp($seconds); + + $this->dynamo->batchWriteItem([ + 'RequestItems' => [ + $this->table => collect($values)->map(function ($value, $key) use ($expiration) { + return [ + 'PutRequest' => [ + 'Item' => [ + $this->keyAttribute => [ + 'S' => $this->prefix.$key, + ], + $this->valueAttribute => [ + $this->type($value) => $this->serialize($value), + ], + $this->expirationAttribute => [ + 'N' => (string) $expiration, + ], + ], + ], + ]; + })->values()->all(), + ], + ]); + + return true; + } + + /** + * Store an item in the cache if the key doesn't exist. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return bool + */ + public function add($key, $value, $seconds) + { + try { + $this->dynamo->putItem([ + 'TableName' => $this->table, + 'Item' => [ + $this->keyAttribute => [ + 'S' => $this->prefix.$key, + ], + $this->valueAttribute => [ + $this->type($value) => $this->serialize($value), + ], + $this->expirationAttribute => [ + 'N' => (string) $this->toTimestamp($seconds), + ], + ], + 'ConditionExpression' => 'attribute_not_exists(#key) OR #expires_at < :now', + 'ExpressionAttributeNames' => [ + '#key' => $this->keyAttribute, + '#expires_at' => $this->expirationAttribute, + ], + 'ExpressionAttributeValues' => [ + ':now' => [ + 'N' => (string) Carbon::now()->getTimestamp(), + ], + ], + ]); + + return true; + } catch (DynamoDbException $e) { + if (Str::contains($e->getMessage(), 'ConditionalCheckFailed')) { + return false; + } + + throw $e; + } + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + try { + $response = $this->dynamo->updateItem([ + 'TableName' => $this->table, + 'Key' => [ + $this->keyAttribute => [ + 'S' => $this->prefix.$key, + ], + ], + 'ConditionExpression' => 'attribute_exists(#key) AND #expires_at > :now', + 'UpdateExpression' => 'SET #value = #value + :amount', + 'ExpressionAttributeNames' => [ + '#key' => $this->keyAttribute, + '#value' => $this->valueAttribute, + '#expires_at' => $this->expirationAttribute, + ], + 'ExpressionAttributeValues' => [ + ':now' => [ + 'N' => (string) Carbon::now()->getTimestamp(), + ], + ':amount' => [ + 'N' => (string) $value, + ], + ], + 'ReturnValues' => 'UPDATED_NEW', + ]); + + return (int) $response['Attributes'][$this->valueAttribute]['N']; + } catch (DynamoDbException $e) { + if (Str::contains($e->getMessage(), 'ConditionalCheckFailed')) { + return false; + } + + throw $e; + } + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + try { + $response = $this->dynamo->updateItem([ + 'TableName' => $this->table, + 'Key' => [ + $this->keyAttribute => [ + 'S' => $this->prefix.$key, + ], + ], + 'ConditionExpression' => 'attribute_exists(#key) AND #expires_at > :now', + 'UpdateExpression' => 'SET #value = #value - :amount', + 'ExpressionAttributeNames' => [ + '#key' => $this->keyAttribute, + '#value' => $this->valueAttribute, + '#expires_at' => $this->expirationAttribute, + ], + 'ExpressionAttributeValues' => [ + ':now' => [ + 'N' => (string) Carbon::now()->getTimestamp(), + ], + ':amount' => [ + 'N' => (string) $value, + ], + ], + 'ReturnValues' => 'UPDATED_NEW', + ]); + + return (int) $response['Attributes'][$this->valueAttribute]['N']; + } catch (DynamoDbException $e) { + if (Str::contains($e->getMessage(), 'ConditionalCheckFailed')) { + return false; + } + + throw $e; + } + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return bool + */ + public function forever($key, $value) + { + return $this->put($key, $value, Carbon::now()->addYears(5)->getTimestamp()); + } + + /** + * Get a lock instance. + * + * @param string $name + * @param int $seconds + * @param string|null $owner + * @return \Illuminate\Contracts\Cache\Lock + */ + public function lock($name, $seconds = 0, $owner = null) + { + return new DynamoDbLock($this, $this->prefix.$name, $seconds, $owner); + } + + /** + * Restore a lock instance using the owner identifier. + * + * @param string $name + * @param string $owner + * @return \Illuminate\Contracts\Cache\Lock + */ + public function restoreLock($name, $owner) + { + return $this->lock($name, 0, $owner); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + $this->dynamo->deleteItem([ + 'TableName' => $this->table, + 'Key' => [ + $this->keyAttribute => [ + 'S' => $this->prefix.$key, + ], + ], + ]); + + return true; + } + + /** + * Remove all items from the cache. + * + * @return bool + * + * @throws \RuntimeException + */ + public function flush() + { + throw new RuntimeException('DynamoDb does not support flushing an entire table. Please create a new table.'); + } + + /** + * Get the UNIX timestamp for the given number of seconds. + * + * @param int $seconds + * @return int + */ + protected function toTimestamp($seconds) + { + return $seconds > 0 + ? $this->availableAt($seconds) + : Carbon::now()->getTimestamp(); + } + + /** + * Serialize the value. + * + * @param mixed $value + * @return mixed + */ + protected function serialize($value) + { + return is_numeric($value) ? (string) $value : serialize($value); + } + + /** + * Unserialize the value. + * + * @param mixed $value + * @return mixed + */ + protected function unserialize($value) + { + if (filter_var($value, FILTER_VALIDATE_INT) !== false) { + return (int) $value; + } + + if (is_numeric($value)) { + return (float) $value; + } + + return unserialize($value); + } + + /** + * Get the DynamoDB type for the given value. + * + * @param mixed $value + * @return string + */ + protected function type($value) + { + return is_numeric($value) ? 'N' : 'S'; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Set the cache key prefix. + * + * @param string $prefix + * @return void + */ + public function setPrefix($prefix) + { + $this->prefix = ! empty($prefix) ? $prefix.':' : ''; + } + + /** + * Get the DynamoDb Client instance. + * + * @return DynamoDbClient + */ + public function getClient() + { + return $this->dynamo; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheEvent.php b/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheEvent.php new file mode 100644 index 00000000..6c9d42c5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheEvent.php @@ -0,0 +1,46 @@ +key = $key; + $this->tags = $tags; + } + + /** + * Set the tags for the cache event. + * + * @param array $tags + * @return $this + */ + public function setTags($tags) + { + $this->tags = $tags; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheHit.php b/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheHit.php new file mode 100644 index 00000000..976c9e4f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheHit.php @@ -0,0 +1,28 @@ +value = $value; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheMissed.php b/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheMissed.php new file mode 100644 index 00000000..d2a5c9f9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheMissed.php @@ -0,0 +1,8 @@ +value = $value; + $this->seconds = $seconds; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php b/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php new file mode 100755 index 00000000..7295d9e6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php @@ -0,0 +1,303 @@ +files = $files; + $this->directory = $directory; + $this->filePermission = $filePermission; + } + + /** + * Retrieve an item from the cache by key. + * + * @param string|array $key + * @return mixed + */ + public function get($key) + { + return $this->getPayload($key)['data'] ?? null; + } + + /** + * Store an item in the cache for a given number of seconds. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return bool + */ + public function put($key, $value, $seconds) + { + $this->ensureCacheDirectoryExists($path = $this->path($key)); + + $result = $this->files->put( + $path, $this->expiration($seconds).serialize($value), true + ); + + if ($result !== false && $result > 0) { + $this->ensureFileHasCorrectPermissions($path); + + return true; + } + + return false; + } + + /** + * Create the file cache directory if necessary. + * + * @param string $path + * @return void + */ + protected function ensureCacheDirectoryExists($path) + { + if (! $this->files->exists(dirname($path))) { + $this->files->makeDirectory(dirname($path), 0777, true, true); + } + } + + /** + * Ensure the cache file has the correct permissions. + * + * @param string $path + * @return void + */ + protected function ensureFileHasCorrectPermissions($path) + { + if (is_null($this->filePermission) || + intval($this->files->chmod($path), 8) == $this->filePermission) { + return; + } + + $this->files->chmod($path, $this->filePermission); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function increment($key, $value = 1) + { + $raw = $this->getPayload($key); + + return tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) { + $this->put($key, $newValue, $raw['time'] ?? 0); + }); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function decrement($key, $value = 1) + { + return $this->increment($key, $value * -1); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return bool + */ + public function forever($key, $value) + { + return $this->put($key, $value, 0); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + if ($this->files->exists($file = $this->path($key))) { + return $this->files->delete($file); + } + + return false; + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + if (! $this->files->isDirectory($this->directory)) { + return false; + } + + foreach ($this->files->directories($this->directory) as $directory) { + $deleted = $this->files->deleteDirectory($directory); + + if (! $deleted || $this->files->exists($directory)) { + return false; + } + } + + return true; + } + + /** + * Retrieve an item and expiry time from the cache by key. + * + * @param string $key + * @return array + */ + protected function getPayload($key) + { + $path = $this->path($key); + + // If the file doesn't exist, we obviously cannot return the cache so we will + // just return null. Otherwise, we'll get the contents of the file and get + // the expiration UNIX timestamps from the start of the file's contents. + try { + $expire = substr( + $contents = $this->files->get($path, true), 0, 10 + ); + } catch (Exception $e) { + return $this->emptyPayload(); + } + + // If the current time is greater than expiration timestamps we will delete + // the file and return null. This helps clean up the old files and keeps + // this directory much cleaner for us as old files aren't hanging out. + if ($this->currentTime() >= $expire) { + $this->forget($key); + + return $this->emptyPayload(); + } + + try { + $data = unserialize(substr($contents, 10)); + } catch (Exception $e) { + $this->forget($key); + + return $this->emptyPayload(); + } + + // Next, we'll extract the number of seconds that are remaining for a cache + // so that we can properly retain the time for things like the increment + // operation that may be performed on this cache on a later operation. + $time = $expire - $this->currentTime(); + + return compact('data', 'time'); + } + + /** + * Get a default empty payload for the cache. + * + * @return array + */ + protected function emptyPayload() + { + return ['data' => null, 'time' => null]; + } + + /** + * Get the full path for the given cache key. + * + * @param string $key + * @return string + */ + protected function path($key) + { + $parts = array_slice(str_split($hash = sha1($key), 2), 0, 2); + + return $this->directory.'/'.implode('/', $parts).'/'.$hash; + } + + /** + * Get the expiration time based on the given seconds. + * + * @param int $seconds + * @return int + */ + protected function expiration($seconds) + { + $time = $this->availableAt($seconds); + + return $seconds === 0 || $time > 9999999999 ? 9999999999 : $time; + } + + /** + * Get the Filesystem instance. + * + * @return \Illuminate\Filesystem\Filesystem + */ + public function getFilesystem() + { + return $this->files; + } + + /** + * Get the working directory of the cache. + * + * @return string + */ + public function getDirectory() + { + return $this->directory; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Cache/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Cache/Lock.php b/vendor/laravel/framework/src/Illuminate/Cache/Lock.php new file mode 100644 index 00000000..e2b8fa4a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Lock.php @@ -0,0 +1,147 @@ +name = $name; + $this->owner = $owner; + $this->seconds = $seconds; + } + + /** + * Attempt to acquire the lock. + * + * @return bool + */ + abstract public function acquire(); + + /** + * Release the lock. + * + * @return bool + */ + abstract public function release(); + + /** + * Returns the owner value written into the driver for this lock. + * + * @return string + */ + abstract protected function getCurrentOwner(); + + /** + * Attempt to acquire the lock. + * + * @param callable|null $callback + * @return mixed + */ + public function get($callback = null) + { + $result = $this->acquire(); + + if ($result && is_callable($callback)) { + try { + return $callback(); + } finally { + $this->release(); + } + } + + return $result; + } + + /** + * Attempt to acquire the lock for the given number of seconds. + * + * @param int $seconds + * @param callable|null $callback + * @return mixed + * + * @throws \Illuminate\Contracts\Cache\LockTimeoutException + */ + public function block($seconds, $callback = null) + { + $starting = $this->currentTime(); + + while (! $this->acquire()) { + usleep(250 * 1000); + + if ($this->currentTime() - $seconds >= $starting) { + throw new LockTimeoutException; + } + } + + if (is_callable($callback)) { + try { + return $callback(); + } finally { + $this->release(); + } + } + + return true; + } + + /** + * Returns the current owner of the lock. + * + * @return string + */ + public function owner() + { + return $this->owner; + } + + /** + * Determines whether this lock is allowed to release the lock in the driver. + * + * @return bool + */ + protected function isOwnedByCurrentProcess() + { + return $this->getCurrentOwner() === $this->owner; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/LuaScripts.php b/vendor/laravel/framework/src/Illuminate/Cache/LuaScripts.php new file mode 100644 index 00000000..6d22fcd4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/LuaScripts.php @@ -0,0 +1,25 @@ +getMemcached( + $connectionId, $credentials, $options + ); + + if (! $memcached->getServerList()) { + // For each server in the array, we'll just extract the configuration and add + // the server to the Memcached connection. Once we have added all of these + // servers we'll verify the connection is successful and return it back. + foreach ($servers as $server) { + $memcached->addServer( + $server['host'], $server['port'], $server['weight'] + ); + } + } + + return $memcached; + } + + /** + * Get a new Memcached instance. + * + * @param string|null $connectionId + * @param array $credentials + * @param array $options + * @return \Memcached + */ + protected function getMemcached($connectionId, array $credentials, array $options) + { + $memcached = $this->createMemcachedInstance($connectionId); + + if (count($credentials) === 2) { + $this->setCredentials($memcached, $credentials); + } + + if (count($options)) { + $memcached->setOptions($options); + } + + return $memcached; + } + + /** + * Create the Memcached instance. + * + * @param string|null $connectionId + * @return \Memcached + */ + protected function createMemcachedInstance($connectionId) + { + return empty($connectionId) ? new Memcached : new Memcached($connectionId); + } + + /** + * Set the SASL credentials on the Memcached connection. + * + * @param \Memcached $memcached + * @param array $credentials + * @return void + */ + protected function setCredentials($memcached, $credentials) + { + [$username, $password] = $credentials; + + $memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true); + + $memcached->setSaslAuthData($username, $password); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/MemcachedLock.php b/vendor/laravel/framework/src/Illuminate/Cache/MemcachedLock.php new file mode 100644 index 00000000..0078a09e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/MemcachedLock.php @@ -0,0 +1,75 @@ +memcached = $memcached; + } + + /** + * Attempt to acquire the lock. + * + * @return bool + */ + public function acquire() + { + return $this->memcached->add( + $this->name, $this->owner, $this->seconds + ); + } + + /** + * Release the lock. + * + * @return bool + */ + public function release() + { + if ($this->isOwnedByCurrentProcess()) { + return $this->memcached->delete($this->name); + } + + return false; + } + + /** + * Releases this lock in disregard of ownership. + * + * @return void + */ + public function forceRelease() + { + $this->memcached->delete($this->name); + } + + /** + * Returns the owner value written into the driver for this lock. + * + * @return mixed + */ + protected function getCurrentOwner() + { + return $this->memcached->get($this->name); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php b/vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php new file mode 100755 index 00000000..299dab9a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php @@ -0,0 +1,279 @@ += 3.0.0. + * + * @var bool + */ + protected $onVersionThree; + + /** + * Create a new Memcached store. + * + * @param \Memcached $memcached + * @param string $prefix + * @return void + */ + public function __construct($memcached, $prefix = '') + { + $this->setPrefix($prefix); + $this->memcached = $memcached; + + $this->onVersionThree = (new ReflectionMethod('Memcached', 'getMulti')) + ->getNumberOfParameters() == 2; + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + $value = $this->memcached->get($this->prefix.$key); + + if ($this->memcached->getResultCode() == 0) { + return $value; + } + } + + /** + * Retrieve multiple items from the cache by key. + * + * Items not found in the cache will have a null value. + * + * @param array $keys + * @return array + */ + public function many(array $keys) + { + $prefixedKeys = array_map(function ($key) { + return $this->prefix.$key; + }, $keys); + + if ($this->onVersionThree) { + $values = $this->memcached->getMulti($prefixedKeys, Memcached::GET_PRESERVE_ORDER); + } else { + $null = null; + + $values = $this->memcached->getMulti($prefixedKeys, $null, Memcached::GET_PRESERVE_ORDER); + } + + if ($this->memcached->getResultCode() != 0) { + return array_fill_keys($keys, null); + } + + return array_combine($keys, $values); + } + + /** + * Store an item in the cache for a given number of seconds. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return bool + */ + public function put($key, $value, $seconds) + { + return $this->memcached->set( + $this->prefix.$key, $value, $this->calculateExpiration($seconds) + ); + } + + /** + * Store multiple items in the cache for a given number of seconds. + * + * @param array $values + * @param int $seconds + * @return bool + */ + public function putMany(array $values, $seconds) + { + $prefixedValues = []; + + foreach ($values as $key => $value) { + $prefixedValues[$this->prefix.$key] = $value; + } + + return $this->memcached->setMulti( + $prefixedValues, $this->calculateExpiration($seconds) + ); + } + + /** + * Store an item in the cache if the key doesn't exist. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return bool + */ + public function add($key, $value, $seconds) + { + return $this->memcached->add( + $this->prefix.$key, $value, $this->calculateExpiration($seconds) + ); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + return $this->memcached->increment($this->prefix.$key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + return $this->memcached->decrement($this->prefix.$key, $value); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return bool + */ + public function forever($key, $value) + { + return $this->put($key, $value, 0); + } + + /** + * Get a lock instance. + * + * @param string $name + * @param int $seconds + * @param string|null $owner + * @return \Illuminate\Contracts\Cache\Lock + */ + public function lock($name, $seconds = 0, $owner = null) + { + return new MemcachedLock($this->memcached, $this->prefix.$name, $seconds, $owner); + } + + /** + * Restore a lock instance using the owner identifier. + * + * @param string $name + * @param string $owner + * @return \Illuminate\Contracts\Cache\Lock + */ + public function restoreLock($name, $owner) + { + return $this->lock($name, 0, $owner); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return $this->memcached->delete($this->prefix.$key); + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + return $this->memcached->flush(); + } + + /** + * Get the expiration time of the key. + * + * @param int $seconds + * @return int + */ + protected function calculateExpiration($seconds) + { + return $this->toTimestamp($seconds); + } + + /** + * Get the UNIX timestamp for the given number of seconds. + * + * @param int $seconds + * @return int + */ + protected function toTimestamp($seconds) + { + return $seconds > 0 ? $this->availableAt($seconds) : 0; + } + + /** + * Get the underlying Memcached connection. + * + * @return \Memcached + */ + public function getMemcached() + { + return $this->memcached; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Set the cache key prefix. + * + * @param string $prefix + * @return void + */ + public function setPrefix($prefix) + { + $this->prefix = ! empty($prefix) ? $prefix.':' : ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/NullStore.php b/vendor/laravel/framework/src/Illuminate/Cache/NullStore.php new file mode 100755 index 00000000..43231b49 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/NullStore.php @@ -0,0 +1,99 @@ +cache = $cache; + } + + /** + * Determine if the given key has been "accessed" too many times. + * + * @param string $key + * @param int $maxAttempts + * @return bool + */ + public function tooManyAttempts($key, $maxAttempts) + { + $key = $this->cleanRateLimiterKey($key); + + if ($this->attempts($key) >= $maxAttempts) { + if ($this->cache->has($key.':timer')) { + return true; + } + + $this->resetAttempts($key); + } + + return false; + } + + /** + * Increment the counter for a given key for a given decay time. + * + * @param string $key + * @param int $decaySeconds + * @return int + */ + public function hit($key, $decaySeconds = 60) + { + $key = $this->cleanRateLimiterKey($key); + + $this->cache->add( + $key.':timer', $this->availableAt($decaySeconds), $decaySeconds + ); + + $added = $this->cache->add($key, 0, $decaySeconds); + + $hits = (int) $this->cache->increment($key); + + if (! $added && $hits == 1) { + $this->cache->put($key, 1, $decaySeconds); + } + + return $hits; + } + + /** + * Get the number of attempts for the given key. + * + * @param string $key + * @return mixed + */ + public function attempts($key) + { + $key = $this->cleanRateLimiterKey($key); + + return $this->cache->get($key, 0); + } + + /** + * Reset the number of attempts for the given key. + * + * @param string $key + * @return mixed + */ + public function resetAttempts($key) + { + $key = $this->cleanRateLimiterKey($key); + + return $this->cache->forget($key); + } + + /** + * Get the number of retries left for the given key. + * + * @param string $key + * @param int $maxAttempts + * @return int + */ + public function retriesLeft($key, $maxAttempts) + { + $key = $this->cleanRateLimiterKey($key); + + $attempts = $this->attempts($key); + + return $maxAttempts - $attempts; + } + + /** + * Clear the hits and lockout timer for the given key. + * + * @param string $key + * @return void + */ + public function clear($key) + { + $key = $this->cleanRateLimiterKey($key); + + $this->resetAttempts($key); + + $this->cache->forget($key.':timer'); + } + + /** + * Get the number of seconds until the "key" is accessible again. + * + * @param string $key + * @return int + */ + public function availableIn($key) + { + $key = $this->cleanRateLimiterKey($key); + + return $this->cache->get($key.':timer') - $this->currentTime(); + } + + /** + * Clean the rate limiter key from unicode characters. + * + * @param string $key + * @return string + */ + public function cleanRateLimiterKey($key) + { + return preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities($key)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/RedisLock.php b/vendor/laravel/framework/src/Illuminate/Cache/RedisLock.php new file mode 100644 index 00000000..9f62eada --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/RedisLock.php @@ -0,0 +1,73 @@ +redis = $redis; + } + + /** + * Attempt to acquire the lock. + * + * @return bool + */ + public function acquire() + { + if ($this->seconds > 0) { + return $this->redis->set($this->name, $this->owner, 'EX', $this->seconds, 'NX') == true; + } else { + return $this->redis->setnx($this->name, $this->owner) === 1; + } + } + + /** + * Release the lock. + * + * @return bool + */ + public function release() + { + return (bool) $this->redis->eval(LuaScripts::releaseLock(), 1, $this->name, $this->owner); + } + + /** + * Releases this lock in disregard of ownership. + * + * @return void + */ + public function forceRelease() + { + $this->redis->del($this->name); + } + + /** + * Returns the owner value written into the driver for this lock. + * + * @return string + */ + protected function getCurrentOwner() + { + return $this->redis->get($this->name); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php b/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php new file mode 100755 index 00000000..f3aa8a3d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php @@ -0,0 +1,308 @@ +redis = $redis; + $this->setPrefix($prefix); + $this->setConnection($connection); + } + + /** + * Retrieve an item from the cache by key. + * + * @param string|array $key + * @return mixed + */ + public function get($key) + { + $value = $this->connection()->get($this->prefix.$key); + + return ! is_null($value) ? $this->unserialize($value) : null; + } + + /** + * Retrieve multiple items from the cache by key. + * + * Items not found in the cache will have a null value. + * + * @param array $keys + * @return array + */ + public function many(array $keys) + { + $results = []; + + $values = $this->connection()->mget(array_map(function ($key) { + return $this->prefix.$key; + }, $keys)); + + foreach ($values as $index => $value) { + $results[$keys[$index]] = ! is_null($value) ? $this->unserialize($value) : null; + } + + return $results; + } + + /** + * Store an item in the cache for a given number of seconds. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return bool + */ + public function put($key, $value, $seconds) + { + return (bool) $this->connection()->setex( + $this->prefix.$key, (int) max(1, $seconds), $this->serialize($value) + ); + } + + /** + * Store multiple items in the cache for a given number of seconds. + * + * @param array $values + * @param int $seconds + * @return bool + */ + public function putMany(array $values, $seconds) + { + $this->connection()->multi(); + + $manyResult = null; + + foreach ($values as $key => $value) { + $result = $this->put($key, $value, $seconds); + + $manyResult = is_null($manyResult) ? $result : $result && $manyResult; + } + + $this->connection()->exec(); + + return $manyResult ?: false; + } + + /** + * Store an item in the cache if the key doesn't exist. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return bool + */ + public function add($key, $value, $seconds) + { + $lua = "return redis.call('exists',KEYS[1])<1 and redis.call('setex',KEYS[1],ARGV[2],ARGV[1])"; + + return (bool) $this->connection()->eval( + $lua, 1, $this->prefix.$key, $this->serialize($value), (int) max(1, $seconds) + ); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function increment($key, $value = 1) + { + return $this->connection()->incrby($this->prefix.$key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function decrement($key, $value = 1) + { + return $this->connection()->decrby($this->prefix.$key, $value); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return bool + */ + public function forever($key, $value) + { + return (bool) $this->connection()->set($this->prefix.$key, $this->serialize($value)); + } + + /** + * Get a lock instance. + * + * @param string $name + * @param int $seconds + * @param string|null $owner + * @return \Illuminate\Contracts\Cache\Lock + */ + public function lock($name, $seconds = 0, $owner = null) + { + return new RedisLock($this->connection(), $this->prefix.$name, $seconds, $owner); + } + + /** + * Restore a lock instance using the owner identifier. + * + * @param string $name + * @param string $owner + * @return \Illuminate\Contracts\Cache\Lock + */ + public function restoreLock($name, $owner) + { + return $this->lock($name, 0, $owner); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return (bool) $this->connection()->del($this->prefix.$key); + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + $this->connection()->flushdb(); + + return true; + } + + /** + * Begin executing a new tags operation. + * + * @param array|mixed $names + * @return \Illuminate\Cache\RedisTaggedCache + */ + public function tags($names) + { + return new RedisTaggedCache( + $this, new TagSet($this, is_array($names) ? $names : func_get_args()) + ); + } + + /** + * Get the Redis connection instance. + * + * @return \Illuminate\Redis\Connections\Connection + */ + public function connection() + { + return $this->redis->connection($this->connection); + } + + /** + * Set the connection name to be used. + * + * @param string $connection + * @return void + */ + public function setConnection($connection) + { + $this->connection = $connection; + } + + /** + * Get the Redis database instance. + * + * @return \Illuminate\Contracts\Redis\Factory + */ + public function getRedis() + { + return $this->redis; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Set the cache key prefix. + * + * @param string $prefix + * @return void + */ + public function setPrefix($prefix) + { + $this->prefix = ! empty($prefix) ? $prefix.':' : ''; + } + + /** + * Serialize the value. + * + * @param mixed $value + * @return mixed + */ + protected function serialize($value) + { + return is_numeric($value) && ! in_array($value, [INF, -INF]) && ! is_nan($value) ? $value : serialize($value); + } + + /** + * Unserialize the value. + * + * @param mixed $value + * @return mixed + */ + protected function unserialize($value) + { + return is_numeric($value) ? $value : unserialize($value); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php b/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php new file mode 100644 index 00000000..ad50ce9a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php @@ -0,0 +1,198 @@ +forever($key, $value); + } + + $this->pushStandardKeys($this->tags->getNamespace(), $key); + + return parent::put($key, $value, $ttl); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function increment($key, $value = 1) + { + $this->pushStandardKeys($this->tags->getNamespace(), $key); + + parent::increment($key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function decrement($key, $value = 1) + { + $this->pushStandardKeys($this->tags->getNamespace(), $key); + + parent::decrement($key, $value); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return bool + */ + public function forever($key, $value) + { + $this->pushForeverKeys($this->tags->getNamespace(), $key); + + return parent::forever($key, $value); + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + $this->deleteForeverKeys(); + $this->deleteStandardKeys(); + + return parent::flush(); + } + + /** + * Store standard key references into store. + * + * @param string $namespace + * @param string $key + * @return void + */ + protected function pushStandardKeys($namespace, $key) + { + $this->pushKeys($namespace, $key, self::REFERENCE_KEY_STANDARD); + } + + /** + * Store forever key references into store. + * + * @param string $namespace + * @param string $key + * @return void + */ + protected function pushForeverKeys($namespace, $key) + { + $this->pushKeys($namespace, $key, self::REFERENCE_KEY_FOREVER); + } + + /** + * Store a reference to the cache key against the reference key. + * + * @param string $namespace + * @param string $key + * @param string $reference + * @return void + */ + protected function pushKeys($namespace, $key, $reference) + { + $fullKey = $this->store->getPrefix().sha1($namespace).':'.$key; + + foreach (explode('|', $namespace) as $segment) { + $this->store->connection()->sadd($this->referenceKey($segment, $reference), $fullKey); + } + } + + /** + * Delete all of the items that were stored forever. + * + * @return void + */ + protected function deleteForeverKeys() + { + $this->deleteKeysByReference(self::REFERENCE_KEY_FOREVER); + } + + /** + * Delete all standard items. + * + * @return void + */ + protected function deleteStandardKeys() + { + $this->deleteKeysByReference(self::REFERENCE_KEY_STANDARD); + } + + /** + * Find and delete all of the items that were stored against a reference. + * + * @param string $reference + * @return void + */ + protected function deleteKeysByReference($reference) + { + foreach (explode('|', $this->tags->getNamespace()) as $segment) { + $this->deleteValues($segment = $this->referenceKey($segment, $reference)); + + $this->store->connection()->del($segment); + } + } + + /** + * Delete item keys that have been stored against a reference. + * + * @param string $referenceKey + * @return void + */ + protected function deleteValues($referenceKey) + { + $values = array_unique($this->store->connection()->smembers($referenceKey)); + + if (count($values) > 0) { + foreach (array_chunk($values, 1000) as $valuesChunk) { + $this->store->connection()->del(...$valuesChunk); + } + } + } + + /** + * Get the reference key for the segment. + * + * @param string $segment + * @param string $suffix + * @return string + */ + protected function referenceKey($segment, $suffix) + { + return $this->store->getPrefix().$segment.':'.$suffix; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Repository.php b/vendor/laravel/framework/src/Illuminate/Cache/Repository.php new file mode 100755 index 00000000..a242e8af --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Repository.php @@ -0,0 +1,658 @@ +store = $store; + } + + /** + * Determine if an item exists in the cache. + * + * @param string $key + * @return bool + */ + public function has($key) + { + return ! is_null($this->get($key)); + } + + /** + * Determine if an item doesn't exist in the cache. + * + * @param string $key + * @return bool + */ + public function missing($key) + { + return ! $this->has($key); + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + if (is_array($key)) { + return $this->many($key); + } + + $value = $this->store->get($this->itemKey($key)); + + // If we could not find the cache value, we will fire the missed event and get + // the default value for this cache value. This default could be a callback + // so we will execute the value function which will resolve it if needed. + if (is_null($value)) { + $this->event(new CacheMissed($key)); + + $value = value($default); + } else { + $this->event(new CacheHit($key, $value)); + } + + return $value; + } + + /** + * Retrieve multiple items from the cache by key. + * + * Items not found in the cache will have a null value. + * + * @param array $keys + * @return array + */ + public function many(array $keys) + { + $values = $this->store->many(collect($keys)->map(function ($value, $key) { + return is_string($key) ? $key : $value; + })->values()->all()); + + return collect($values)->map(function ($value, $key) use ($keys) { + return $this->handleManyResult($keys, $key, $value); + })->all(); + } + + /** + * {@inheritdoc} + */ + public function getMultiple($keys, $default = null) + { + $defaults = []; + + foreach ($keys as $key) { + $defaults[$key] = $default; + } + + return $this->many($defaults); + } + + /** + * Handle a result for the "many" method. + * + * @param array $keys + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function handleManyResult($keys, $key, $value) + { + // If we could not find the cache value, we will fire the missed event and get + // the default value for this cache value. This default could be a callback + // so we will execute the value function which will resolve it if needed. + if (is_null($value)) { + $this->event(new CacheMissed($key)); + + return isset($keys[$key]) ? value($keys[$key]) : null; + } + + // If we found a valid value we will fire the "hit" event and return the value + // back from this function. The "hit" event gives developers an opportunity + // to listen for every possible cache "hit" throughout this applications. + $this->event(new CacheHit($key, $value)); + + return $value; + } + + /** + * Retrieve an item from the cache and delete it. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function pull($key, $default = null) + { + return tap($this->get($key, $default), function () use ($key) { + $this->forget($key); + }); + } + + /** + * Store an item in the cache. + * + * @param string $key + * @param mixed $value + * @param \DateTimeInterface|\DateInterval|int|null $ttl + * @return bool + */ + public function put($key, $value, $ttl = null) + { + if (is_array($key)) { + return $this->putMany($key, $value); + } + + if ($ttl === null) { + return $this->forever($key, $value); + } + + $seconds = $this->getSeconds($ttl); + + if ($seconds <= 0) { + return $this->forget($key); + } + + $result = $this->store->put($this->itemKey($key), $value, $seconds); + + if ($result) { + $this->event(new KeyWritten($key, $value, $seconds)); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function set($key, $value, $ttl = null) + { + return $this->put($key, $value, $ttl); + } + + /** + * Store multiple items in the cache for a given number of seconds. + * + * @param array $values + * @param \DateTimeInterface|\DateInterval|int|null $ttl + * @return bool + */ + public function putMany(array $values, $ttl = null) + { + if ($ttl === null) { + return $this->putManyForever($values); + } + + $seconds = $this->getSeconds($ttl); + + if ($seconds <= 0) { + return $this->deleteMultiple(array_keys($values)); + } + + $result = $this->store->putMany($values, $seconds); + + if ($result) { + foreach ($values as $key => $value) { + $this->event(new KeyWritten($key, $value, $seconds)); + } + } + + return $result; + } + + /** + * Store multiple items in the cache indefinitely. + * + * @param array $values + * @return bool + */ + protected function putManyForever(array $values) + { + $result = true; + + foreach ($values as $key => $value) { + if (! $this->forever($key, $value)) { + $result = false; + } + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function setMultiple($values, $ttl = null) + { + return $this->putMany(is_array($values) ? $values : iterator_to_array($values), $ttl); + } + + /** + * Store an item in the cache if the key does not exist. + * + * @param string $key + * @param mixed $value + * @param \DateTimeInterface|\DateInterval|int|null $ttl + * @return bool + */ + public function add($key, $value, $ttl = null) + { + if ($ttl !== null) { + if ($this->getSeconds($ttl) <= 0) { + return false; + } + + // If the store has an "add" method we will call the method on the store so it + // has a chance to override this logic. Some drivers better support the way + // this operation should work with a total "atomic" implementation of it. + if (method_exists($this->store, 'add')) { + $seconds = $this->getSeconds($ttl); + + return $this->store->add( + $this->itemKey($key), $value, $seconds + ); + } + } + + // If the value did not exist in the cache, we will put the value in the cache + // so it exists for subsequent requests. Then, we will return true so it is + // easy to know if the value gets added. Otherwise, we will return false. + if (is_null($this->get($key))) { + return $this->put($key, $value, $ttl); + } + + return false; + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + return $this->store->increment($key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + return $this->store->decrement($key, $value); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return bool + */ + public function forever($key, $value) + { + $result = $this->store->forever($this->itemKey($key), $value); + + if ($result) { + $this->event(new KeyWritten($key, $value)); + } + + return $result; + } + + /** + * Get an item from the cache, or execute the given Closure and store the result. + * + * @param string $key + * @param \DateTimeInterface|\DateInterval|int|null $ttl + * @param \Closure $callback + * @return mixed + */ + public function remember($key, $ttl, Closure $callback) + { + $value = $this->get($key); + + // If the item exists in the cache we will just return this immediately and if + // not we will execute the given Closure and cache the result of that for a + // given number of seconds so it's available for all subsequent requests. + if (! is_null($value)) { + return $value; + } + + $this->put($key, $value = $callback(), $ttl); + + return $value; + } + + /** + * Get an item from the cache, or execute the given Closure and store the result forever. + * + * @param string $key + * @param \Closure $callback + * @return mixed + */ + public function sear($key, Closure $callback) + { + return $this->rememberForever($key, $callback); + } + + /** + * Get an item from the cache, or execute the given Closure and store the result forever. + * + * @param string $key + * @param \Closure $callback + * @return mixed + */ + public function rememberForever($key, Closure $callback) + { + $value = $this->get($key); + + // If the item exists in the cache we will just return this immediately + // and if not we will execute the given Closure and cache the result + // of that forever so it is available for all subsequent requests. + if (! is_null($value)) { + return $value; + } + + $this->forever($key, $value = $callback()); + + return $value; + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return tap($this->store->forget($this->itemKey($key)), function ($result) use ($key) { + if ($result) { + $this->event(new KeyForgotten($key)); + } + }); + } + + /** + * {@inheritdoc} + */ + public function delete($key) + { + return $this->forget($key); + } + + /** + * {@inheritdoc} + */ + public function deleteMultiple($keys) + { + $result = true; + + foreach ($keys as $key) { + if (! $this->forget($key)) { + $result = false; + } + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function clear() + { + return $this->store->flush(); + } + + /** + * Begin executing a new tags operation if the store supports it. + * + * @param array|mixed $names + * @return \Illuminate\Cache\TaggedCache + * + * @throws \BadMethodCallException + */ + public function tags($names) + { + if (! method_exists($this->store, 'tags')) { + throw new BadMethodCallException('This cache store does not support tagging.'); + } + + $cache = $this->store->tags(is_array($names) ? $names : func_get_args()); + + if (! is_null($this->events)) { + $cache->setEventDispatcher($this->events); + } + + return $cache->setDefaultCacheTime($this->default); + } + + /** + * Format the key for a cache item. + * + * @param string $key + * @return string + */ + protected function itemKey($key) + { + return $key; + } + + /** + * Get the default cache time. + * + * @return int|null + */ + public function getDefaultCacheTime() + { + return $this->default; + } + + /** + * Set the default cache time in seconds. + * + * @param int|null $seconds + * @return $this + */ + public function setDefaultCacheTime($seconds) + { + $this->default = $seconds; + + return $this; + } + + /** + * Get the cache store implementation. + * + * @return \Illuminate\Contracts\Cache\Store + */ + public function getStore() + { + return $this->store; + } + + /** + * Fire an event for this cache instance. + * + * @param string $event + * @return void + */ + protected function event($event) + { + if (isset($this->events)) { + $this->events->dispatch($event); + } + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getEventDispatcher() + { + return $this->events; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function setEventDispatcher(Dispatcher $events) + { + $this->events = $events; + } + + /** + * Determine if a cached value exists. + * + * @param string $key + * @return bool + */ + public function offsetExists($key) + { + return $this->has($key); + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->get($key); + } + + /** + * Store an item in the cache for the default time. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->put($key, $value, $this->default); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + $this->forget($key); + } + + /** + * Calculate the number of seconds for the given TTL. + * + * @param \DateTimeInterface|\DateInterval|int $ttl + * @return int + */ + protected function getSeconds($ttl) + { + $duration = $this->parseDateInterval($ttl); + + if ($duration instanceof DateTimeInterface) { + $duration = Carbon::now()->diffInRealSeconds($duration, false); + } + + return (int) $duration > 0 ? $duration : 0; + } + + /** + * Handle dynamic calls into macros or pass missing methods to the store. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + return $this->store->$method(...$parameters); + } + + /** + * Clone cache repository instance. + * + * @return void + */ + public function __clone() + { + $this->store = clone $this->store; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/RetrievesMultipleKeys.php b/vendor/laravel/framework/src/Illuminate/Cache/RetrievesMultipleKeys.php new file mode 100644 index 00000000..5dd41edb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/RetrievesMultipleKeys.php @@ -0,0 +1,45 @@ +get($key); + } + + return $return; + } + + /** + * Store multiple items in the cache for a given number of seconds. + * + * @param array $values + * @param int $seconds + * @return bool + */ + public function putMany(array $values, $seconds) + { + $manyResult = null; + + foreach ($values as $key => $value) { + $result = $this->put($key, $value, $seconds); + + $manyResult = is_null($manyResult) ? $result : $result && $manyResult; + } + + return $manyResult ?: false; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php b/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php new file mode 100644 index 00000000..214d6481 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php @@ -0,0 +1,110 @@ +store = $store; + $this->names = $names; + } + + /** + * Reset all tags in the set. + * + * @return void + */ + public function reset() + { + array_walk($this->names, [$this, 'resetTag']); + } + + /** + * Reset the tag and return the new tag identifier. + * + * @param string $name + * @return string + */ + public function resetTag($name) + { + $this->store->forever($this->tagKey($name), $id = str_replace('.', '', uniqid('', true))); + + return $id; + } + + /** + * Get a unique namespace that changes when any of the tags are flushed. + * + * @return string + */ + public function getNamespace() + { + return implode('|', $this->tagIds()); + } + + /** + * Get an array of tag identifiers for all of the tags in the set. + * + * @return array + */ + protected function tagIds() + { + return array_map([$this, 'tagId'], $this->names); + } + + /** + * Get the unique tag identifier for a given tag. + * + * @param string $name + * @return string + */ + public function tagId($name) + { + return $this->store->get($this->tagKey($name)) ?: $this->resetTag($name); + } + + /** + * Get the tag identifier key for a given tag. + * + * @param string $name + * @return string + */ + public function tagKey($name) + { + return 'tag:'.$name.':key'; + } + + /** + * Get all of the tag names in the set. + * + * @return array + */ + public function getNames() + { + return $this->names; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/TaggableStore.php b/vendor/laravel/framework/src/Illuminate/Cache/TaggableStore.php new file mode 100644 index 00000000..6a12b45d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/TaggableStore.php @@ -0,0 +1,19 @@ +tags = $tags; + } + + /** + * Store multiple items in the cache for a given number of seconds. + * + * @param array $values + * @param int|null $ttl + * @return bool + */ + public function putMany(array $values, $ttl = null) + { + if ($ttl === null) { + return $this->putManyForever($values); + } + + return $this->putManyAlias($values, $ttl); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function increment($key, $value = 1) + { + $this->store->increment($this->itemKey($key), $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function decrement($key, $value = 1) + { + $this->store->decrement($this->itemKey($key), $value); + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + $this->tags->reset(); + + return true; + } + + /** + * {@inheritdoc} + */ + protected function itemKey($key) + { + return $this->taggedItemKey($key); + } + + /** + * Get a fully qualified key for a tagged item. + * + * @param string $key + * @return string + */ + public function taggedItemKey($key) + { + return sha1($this->tags->getNamespace()).':'.$key; + } + + /** + * Fire an event for this cache instance. + * + * @param string $event + * @return void + */ + protected function event($event) + { + parent::event($event->setTags($this->tags->getNames())); + } + + /** + * Get the tag set instance. + * + * @return \Illuminate\Cache\TagSet + */ + public function getTags() + { + return $this->tags; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/composer.json b/vendor/laravel/framework/src/Illuminate/Cache/composer.json new file mode 100755 index 00000000..01331f1b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/composer.json @@ -0,0 +1,42 @@ +{ + "name": "illuminate/cache", + "description": "The Illuminate Cache package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Cache\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "suggest": { + "ext-memcached": "Required to use the memcache cache driver.", + "illuminate/database": "Required to use the database cache driver (^6.0).", + "illuminate/filesystem": "Required to use the file cache driver (^6.0).", + "illuminate/redis": "Required to use the redis cache driver (^6.0).", + "symfony/cache": "Required to PSR-6 cache bridge (^4.3.4)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Config/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Config/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Config/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Config/Repository.php b/vendor/laravel/framework/src/Illuminate/Config/Repository.php new file mode 100644 index 00000000..5bcdcbf4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Config/Repository.php @@ -0,0 +1,179 @@ +items = $items; + } + + /** + * Determine if the given configuration value exists. + * + * @param string $key + * @return bool + */ + public function has($key) + { + return Arr::has($this->items, $key); + } + + /** + * Get the specified configuration value. + * + * @param array|string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + if (is_array($key)) { + return $this->getMany($key); + } + + return Arr::get($this->items, $key, $default); + } + + /** + * Get many configuration values. + * + * @param array $keys + * @return array + */ + public function getMany($keys) + { + $config = []; + + foreach ($keys as $key => $default) { + if (is_numeric($key)) { + [$key, $default] = [$default, null]; + } + + $config[$key] = Arr::get($this->items, $key, $default); + } + + return $config; + } + + /** + * Set a given configuration value. + * + * @param array|string $key + * @param mixed $value + * @return void + */ + public function set($key, $value = null) + { + $keys = is_array($key) ? $key : [$key => $value]; + + foreach ($keys as $key => $value) { + Arr::set($this->items, $key, $value); + } + } + + /** + * Prepend a value onto an array configuration value. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function prepend($key, $value) + { + $array = $this->get($key); + + array_unshift($array, $value); + + $this->set($key, $array); + } + + /** + * Push a value onto an array configuration value. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function push($key, $value) + { + $array = $this->get($key); + + $array[] = $value; + + $this->set($key, $array); + } + + /** + * Get all of the configuration items for the application. + * + * @return array + */ + public function all() + { + return $this->items; + } + + /** + * Determine if the given configuration option exists. + * + * @param string $key + * @return bool + */ + public function offsetExists($key) + { + return $this->has($key); + } + + /** + * Get a configuration option. + * + * @param string $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->get($key); + } + + /** + * Set a configuration option. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->set($key, $value); + } + + /** + * Unset a configuration option. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + $this->set($key, null); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Config/composer.json b/vendor/laravel/framework/src/Illuminate/Config/composer.json new file mode 100755 index 00000000..3704ba14 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Config/composer.json @@ -0,0 +1,35 @@ +{ + "name": "illuminate/config", + "description": "The Illuminate Config package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Config\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Application.php b/vendor/laravel/framework/src/Illuminate/Console/Application.php new file mode 100755 index 00000000..ee06175f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Application.php @@ -0,0 +1,316 @@ +laravel = $laravel; + $this->events = $events; + $this->setAutoExit(false); + $this->setCatchExceptions(false); + + $this->events->dispatch(new ArtisanStarting($this)); + + $this->bootstrap(); + } + + /** + * {@inheritdoc} + */ + public function run(InputInterface $input = null, OutputInterface $output = null) + { + $commandName = $this->getCommandName( + $input = $input ?: new ArgvInput + ); + + $this->events->dispatch( + new CommandStarting( + $commandName, $input, $output = $output ?: new ConsoleOutput + ) + ); + + $exitCode = parent::run($input, $output); + + $this->events->dispatch( + new CommandFinished($commandName, $input, $output, $exitCode) + ); + + return $exitCode; + } + + /** + * Determine the proper PHP executable. + * + * @return string + */ + public static function phpBinary() + { + return ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); + } + + /** + * Determine the proper Artisan executable. + * + * @return string + */ + public static function artisanBinary() + { + return ProcessUtils::escapeArgument(defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan'); + } + + /** + * Format the given command as a fully-qualified executable command. + * + * @param string $string + * @return string + */ + public static function formatCommandString($string) + { + return sprintf('%s %s %s', static::phpBinary(), static::artisanBinary(), $string); + } + + /** + * Register a console "starting" bootstrapper. + * + * @param \Closure $callback + * @return void + */ + public static function starting(Closure $callback) + { + static::$bootstrappers[] = $callback; + } + + /** + * Bootstrap the console application. + * + * @return void + */ + protected function bootstrap() + { + foreach (static::$bootstrappers as $bootstrapper) { + $bootstrapper($this); + } + } + + /** + * Clear the console application bootstrappers. + * + * @return void + */ + public static function forgetBootstrappers() + { + static::$bootstrappers = []; + } + + /** + * Run an Artisan console command by name. + * + * @param string $command + * @param array $parameters + * @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer + * @return int + * + * @throws \Symfony\Component\Console\Exception\CommandNotFoundException + */ + public function call($command, array $parameters = [], $outputBuffer = null) + { + [$command, $input] = $this->parseCommand($command, $parameters); + + if (! $this->has($command)) { + throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $command)); + } + + return $this->run( + $input, $this->lastOutput = $outputBuffer ?: new BufferedOutput + ); + } + + /** + * Parse the incoming Artisan command and its input. + * + * @param string $command + * @param array $parameters + * @return array + */ + protected function parseCommand($command, $parameters) + { + if (is_subclass_of($command, SymfonyCommand::class)) { + $callingClass = true; + + $command = $this->laravel->make($command)->getName(); + } + + if (! isset($callingClass) && empty($parameters)) { + $command = $this->getCommandName($input = new StringInput($command)); + } else { + array_unshift($parameters, $command); + + $input = new ArrayInput($parameters); + } + + return [$command, $input ?? null]; + } + + /** + * Get the output for the last run command. + * + * @return string + */ + public function output() + { + return $this->lastOutput && method_exists($this->lastOutput, 'fetch') + ? $this->lastOutput->fetch() + : ''; + } + + /** + * Add a command to the console. + * + * @param \Symfony\Component\Console\Command\Command $command + * @return \Symfony\Component\Console\Command\Command + */ + public function add(SymfonyCommand $command) + { + if ($command instanceof Command) { + $command->setLaravel($this->laravel); + } + + return $this->addToParent($command); + } + + /** + * Add the command to the parent instance. + * + * @param \Symfony\Component\Console\Command\Command $command + * @return \Symfony\Component\Console\Command\Command + */ + protected function addToParent(SymfonyCommand $command) + { + return parent::add($command); + } + + /** + * Add a command, resolving through the application. + * + * @param string $command + * @return \Symfony\Component\Console\Command\Command + */ + public function resolve($command) + { + return $this->add($this->laravel->make($command)); + } + + /** + * Resolve an array of commands through the application. + * + * @param array|mixed $commands + * @return $this + */ + public function resolveCommands($commands) + { + $commands = is_array($commands) ? $commands : func_get_args(); + + foreach ($commands as $command) { + $this->resolve($command); + } + + return $this; + } + + /** + * Get the default input definition for the application. + * + * This is used to add the --env option to every available command. + * + * @return \Symfony\Component\Console\Input\InputDefinition + */ + protected function getDefaultInputDefinition() + { + return tap(parent::getDefaultInputDefinition(), function ($definition) { + $definition->addOption($this->getEnvironmentOption()); + }); + } + + /** + * Get the global environment option for the definition. + * + * @return \Symfony\Component\Console\Input\InputOption + */ + protected function getEnvironmentOption() + { + $message = 'The environment the command should run under'; + + return new InputOption('--env', null, InputOption::VALUE_OPTIONAL, $message); + } + + /** + * Get the Laravel application instance. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + public function getLaravel() + { + return $this->laravel; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Command.php b/vendor/laravel/framework/src/Illuminate/Console/Command.php new file mode 100755 index 00000000..8312a478 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Command.php @@ -0,0 +1,200 @@ +signature)) { + $this->configureUsingFluentDefinition(); + } else { + parent::__construct($this->name); + } + + // Once we have constructed the command, we'll set the description and other + // related properties of the command. If a signature wasn't used to build + // the command we'll set the arguments and the options on this command. + $this->setDescription((string) $this->description); + + $this->setHelp((string) $this->help); + + $this->setHidden($this->isHidden()); + + if (! isset($this->signature)) { + $this->specifyParameters(); + } + } + + /** + * Configure the console command using a fluent definition. + * + * @return void + */ + protected function configureUsingFluentDefinition() + { + [$name, $arguments, $options] = Parser::parse($this->signature); + + parent::__construct($this->name = $name); + + // After parsing the signature we will spin through the arguments and options + // and set them on this command. These will already be changed into proper + // instances of these "InputArgument" and "InputOption" Symfony classes. + $this->getDefinition()->addArguments($arguments); + $this->getDefinition()->addOptions($options); + } + + /** + * Run the console command. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @return int + */ + public function run(InputInterface $input, OutputInterface $output) + { + $this->output = $this->laravel->make( + OutputStyle::class, ['input' => $input, 'output' => $output] + ); + + return parent::run( + $this->input = $input, $this->output + ); + } + + /** + * Execute the console command. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @return mixed + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + return $this->laravel->call([$this, 'handle']); + } + + /** + * Resolve the console command instance for the given command. + * + * @param \Symfony\Component\Console\Command\Command|string $command + * @return \Symfony\Component\Console\Command\Command + */ + protected function resolveCommand($command) + { + if (! class_exists($command)) { + return $this->getApplication()->find($command); + } + + $command = $this->laravel->make($command); + + if ($command instanceof SymfonyCommand) { + $command->setApplication($this->getApplication()); + } + + if ($command instanceof self) { + $command->setLaravel($this->getLaravel()); + } + + return $command; + } + + /** + * {@inheritdoc} + */ + public function isHidden() + { + return $this->hidden; + } + + /** + * {@inheritdoc} + */ + public function setHidden($hidden) + { + parent::setHidden($this->hidden = $hidden); + + return $this; + } + + /** + * Get the Laravel application instance. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + public function getLaravel() + { + return $this->laravel; + } + + /** + * Set the Laravel application instance. + * + * @param \Illuminate\Contracts\Container\Container $laravel + * @return void + */ + public function setLaravel($laravel) + { + $this->laravel = $laravel; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Concerns/CallsCommands.php b/vendor/laravel/framework/src/Illuminate/Console/Concerns/CallsCommands.php new file mode 100644 index 00000000..e060c556 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Concerns/CallsCommands.php @@ -0,0 +1,92 @@ +runCommand($command, $arguments, $this->output); + } + + /** + * Call another console command silently. + * + * @param \Symfony\Component\Console\Command\Command|string $command + * @param array $arguments + * @return int + */ + public function callSilent($command, array $arguments = []) + { + return $this->runCommand($command, $arguments, new NullOutput); + } + + /** + * Run the given the console command. + * + * @param \Symfony\Component\Console\Command\Command|string $command + * @param array $arguments + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @return int + */ + protected function runCommand($command, array $arguments, OutputInterface $output) + { + $arguments['command'] = $command; + + return $this->resolveCommand($command)->run( + $this->createInputFromArguments($arguments), $output + ); + } + + /** + * Create an input instance from the given arguments. + * + * @param array $arguments + * @return \Symfony\Component\Console\Input\ArrayInput + */ + protected function createInputFromArguments(array $arguments) + { + return tap(new ArrayInput(array_merge($this->context(), $arguments)), function ($input) { + if ($input->getParameterOption('--no-interaction')) { + $input->setInteractive(false); + } + }); + } + + /** + * Get all of the context passed to the command. + * + * @return array + */ + protected function context() + { + return collect($this->option())->only([ + 'ansi', + 'no-ansi', + 'no-interaction', + 'quiet', + 'verbose', + ])->filter()->mapWithKeys(function ($value, $key) { + return ["--{$key}" => $value]; + })->all(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Concerns/HasParameters.php b/vendor/laravel/framework/src/Illuminate/Console/Concerns/HasParameters.php new file mode 100644 index 00000000..e860ec2a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Concerns/HasParameters.php @@ -0,0 +1,56 @@ +getArguments() as $arguments) { + if ($arguments instanceof InputArgument) { + $this->getDefinition()->addArgument($arguments); + } else { + $this->addArgument(...array_values($arguments)); + } + } + + foreach ($this->getOptions() as $options) { + if ($options instanceof InputOption) { + $this->getDefinition()->addOption($options); + } else { + $this->addOption(...array_values($options)); + } + } + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return []; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return []; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Concerns/InteractsWithIO.php b/vendor/laravel/framework/src/Illuminate/Console/Concerns/InteractsWithIO.php new file mode 100644 index 00000000..9e9123fc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Concerns/InteractsWithIO.php @@ -0,0 +1,397 @@ + OutputInterface::VERBOSITY_VERBOSE, + 'vv' => OutputInterface::VERBOSITY_VERY_VERBOSE, + 'vvv' => OutputInterface::VERBOSITY_DEBUG, + 'quiet' => OutputInterface::VERBOSITY_QUIET, + 'normal' => OutputInterface::VERBOSITY_NORMAL, + ]; + + /** + * Determine if the given argument is present. + * + * @param string|int $name + * @return bool + */ + public function hasArgument($name) + { + return $this->input->hasArgument($name); + } + + /** + * Get the value of a command argument. + * + * @param string|null $key + * @return string|array|null + */ + public function argument($key = null) + { + if (is_null($key)) { + return $this->input->getArguments(); + } + + return $this->input->getArgument($key); + } + + /** + * Get all of the arguments passed to the command. + * + * @return array + */ + public function arguments() + { + return $this->argument(); + } + + /** + * Determine if the given option is present. + * + * @param string $name + * @return bool + */ + public function hasOption($name) + { + return $this->input->hasOption($name); + } + + /** + * Get the value of a command option. + * + * @param string|null $key + * @return string|array|bool|null + */ + public function option($key = null) + { + if (is_null($key)) { + return $this->input->getOptions(); + } + + return $this->input->getOption($key); + } + + /** + * Get all of the options passed to the command. + * + * @return array + */ + public function options() + { + return $this->option(); + } + + /** + * Confirm a question with the user. + * + * @param string $question + * @param bool $default + * @return bool + */ + public function confirm($question, $default = false) + { + return $this->output->confirm($question, $default); + } + + /** + * Prompt the user for input. + * + * @param string $question + * @param string|null $default + * @return mixed + */ + public function ask($question, $default = null) + { + return $this->output->ask($question, $default); + } + + /** + * Prompt the user for input with auto completion. + * + * @param string $question + * @param array|callable $choices + * @param string|null $default + * @return mixed + */ + public function anticipate($question, $choices, $default = null) + { + return $this->askWithCompletion($question, $choices, $default); + } + + /** + * Prompt the user for input with auto completion. + * + * @param string $question + * @param array|callable $choices + * @param string|null $default + * @return mixed + */ + public function askWithCompletion($question, $choices, $default = null) + { + $question = new Question($question, $default); + + is_callable($choices) + ? $question->setAutocompleterCallback($choices) + : $question->setAutocompleterValues($choices); + + return $this->output->askQuestion($question); + } + + /** + * Prompt the user for input but hide the answer from the console. + * + * @param string $question + * @param bool $fallback + * @return mixed + */ + public function secret($question, $fallback = true) + { + $question = new Question($question); + + $question->setHidden(true)->setHiddenFallback($fallback); + + return $this->output->askQuestion($question); + } + + /** + * Give the user a single choice from an array of answers. + * + * @param string $question + * @param array $choices + * @param string|null $default + * @param mixed|null $attempts + * @param bool|null $multiple + * @return string + */ + public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null) + { + $question = new ChoiceQuestion($question, $choices, $default); + + $question->setMaxAttempts($attempts)->setMultiselect($multiple); + + return $this->output->askQuestion($question); + } + + /** + * Format input to textual table. + * + * @param array $headers + * @param \Illuminate\Contracts\Support\Arrayable|array $rows + * @param string $tableStyle + * @param array $columnStyles + * @return void + */ + public function table($headers, $rows, $tableStyle = 'default', array $columnStyles = []) + { + $table = new Table($this->output); + + if ($rows instanceof Arrayable) { + $rows = $rows->toArray(); + } + + $table->setHeaders((array) $headers)->setRows($rows)->setStyle($tableStyle); + + foreach ($columnStyles as $columnIndex => $columnStyle) { + $table->setColumnStyle($columnIndex, $columnStyle); + } + + $table->render(); + } + + /** + * Write a string as information output. + * + * @param string $string + * @param int|string|null $verbosity + * @return void + */ + public function info($string, $verbosity = null) + { + $this->line($string, 'info', $verbosity); + } + + /** + * Write a string as standard output. + * + * @param string $string + * @param string|null $style + * @param int|string|null $verbosity + * @return void + */ + public function line($string, $style = null, $verbosity = null) + { + $styled = $style ? "<$style>$string" : $string; + + $this->output->writeln($styled, $this->parseVerbosity($verbosity)); + } + + /** + * Write a string as comment output. + * + * @param string $string + * @param int|string|null $verbosity + * @return void + */ + public function comment($string, $verbosity = null) + { + $this->line($string, 'comment', $verbosity); + } + + /** + * Write a string as question output. + * + * @param string $string + * @param int|string|null $verbosity + * @return void + */ + public function question($string, $verbosity = null) + { + $this->line($string, 'question', $verbosity); + } + + /** + * Write a string as error output. + * + * @param string $string + * @param int|string|null $verbosity + * @return void + */ + public function error($string, $verbosity = null) + { + $this->line($string, 'error', $verbosity); + } + + /** + * Write a string as warning output. + * + * @param string $string + * @param int|string|null $verbosity + * @return void + */ + public function warn($string, $verbosity = null) + { + if (! $this->output->getFormatter()->hasStyle('warning')) { + $style = new OutputFormatterStyle('yellow'); + + $this->output->getFormatter()->setStyle('warning', $style); + } + + $this->line($string, 'warning', $verbosity); + } + + /** + * Write a string in an alert box. + * + * @param string $string + * @return void + */ + public function alert($string) + { + $length = Str::length(strip_tags($string)) + 12; + + $this->comment(str_repeat('*', $length)); + $this->comment('* '.$string.' *'); + $this->comment(str_repeat('*', $length)); + + $this->output->newLine(); + } + + /** + * Set the input interface implementation. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @return void + */ + public function setInput(InputInterface $input) + { + $this->input = $input; + } + + /** + * Set the output interface implementation. + * + * @param \Illuminate\Console\OutputStyle $output + * @return void + */ + public function setOutput(OutputStyle $output) + { + $this->output = $output; + } + + /** + * Set the verbosity level. + * + * @param string|int $level + * @return void + */ + protected function setVerbosity($level) + { + $this->verbosity = $this->parseVerbosity($level); + } + + /** + * Get the verbosity level in terms of Symfony's OutputInterface level. + * + * @param string|int|null $level + * @return int + */ + protected function parseVerbosity($level = null) + { + if (isset($this->verbosityMap[$level])) { + $level = $this->verbosityMap[$level]; + } elseif (! is_int($level)) { + $level = $this->verbosity; + } + + return $level; + } + + /** + * Get the output implementation. + * + * @return \Illuminate\Console\OutputStyle + */ + public function getOutput() + { + return $this->output; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php b/vendor/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php new file mode 100644 index 00000000..8d0d6df7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php @@ -0,0 +1,52 @@ +getDefaultConfirmCallback() : $callback; + + $shouldConfirm = value($callback); + + if ($shouldConfirm) { + if ($this->hasOption('force') && $this->option('force')) { + return true; + } + + $this->alert($warning); + + $confirmed = $this->confirm('Do you really wish to run this command?'); + + if (! $confirmed) { + $this->comment('Command Canceled!'); + + return false; + } + } + + return true; + } + + /** + * Get the default confirmation callback. + * + * @return \Closure + */ + protected function getDefaultConfirmCallback() + { + return function () { + return $this->getLaravel()->environment() === 'production'; + }; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/DetectsApplicationNamespace.php b/vendor/laravel/framework/src/Illuminate/Console/DetectsApplicationNamespace.php new file mode 100644 index 00000000..391b6c68 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/DetectsApplicationNamespace.php @@ -0,0 +1,21 @@ +getNamespace(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Events/ArtisanStarting.php b/vendor/laravel/framework/src/Illuminate/Console/Events/ArtisanStarting.php new file mode 100644 index 00000000..f228ac52 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Events/ArtisanStarting.php @@ -0,0 +1,24 @@ +artisan = $artisan; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Events/CommandFinished.php b/vendor/laravel/framework/src/Illuminate/Console/Events/CommandFinished.php new file mode 100644 index 00000000..ef066af3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Events/CommandFinished.php @@ -0,0 +1,54 @@ +input = $input; + $this->output = $output; + $this->command = $command; + $this->exitCode = $exitCode; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Events/CommandStarting.php b/vendor/laravel/framework/src/Illuminate/Console/Events/CommandStarting.php new file mode 100644 index 00000000..c6238b5d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Events/CommandStarting.php @@ -0,0 +1,45 @@ +input = $input; + $this->output = $output; + $this->command = $command; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Events/ScheduledTaskFinished.php b/vendor/laravel/framework/src/Illuminate/Console/Events/ScheduledTaskFinished.php new file mode 100644 index 00000000..61469662 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Events/ScheduledTaskFinished.php @@ -0,0 +1,35 @@ +task = $task; + $this->runtime = $runtime; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Events/ScheduledTaskSkipped.php b/vendor/laravel/framework/src/Illuminate/Console/Events/ScheduledTaskSkipped.php new file mode 100644 index 00000000..cfa7141d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Events/ScheduledTaskSkipped.php @@ -0,0 +1,26 @@ +task = $task; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Events/ScheduledTaskStarting.php b/vendor/laravel/framework/src/Illuminate/Console/Events/ScheduledTaskStarting.php new file mode 100644 index 00000000..66aaaa4c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Events/ScheduledTaskStarting.php @@ -0,0 +1,26 @@ +task = $task; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php b/vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php new file mode 100644 index 00000000..9d2ea99b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php @@ -0,0 +1,274 @@ +files = $files; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + abstract protected function getStub(); + + /** + * Execute the console command. + * + * @return bool|null + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function handle() + { + $name = $this->qualifyClass($this->getNameInput()); + + $path = $this->getPath($name); + + // First we will check to see if the class already exists. If it does, we don't want + // to create the class and overwrite the user's code. So, we will bail out so the + // code is untouched. Otherwise, we will continue generating this class' files. + if ((! $this->hasOption('force') || + ! $this->option('force')) && + $this->alreadyExists($this->getNameInput())) { + $this->error($this->type.' already exists!'); + + return false; + } + + // Next, we will generate the path to the location where this class' file should get + // written. Then, we will build the class and make the proper replacements on the + // stub files so that it gets the correctly formatted namespace and class name. + $this->makeDirectory($path); + + $this->files->put($path, $this->sortImports($this->buildClass($name))); + + $this->info($this->type.' created successfully.'); + } + + /** + * Parse the class name and format according to the root namespace. + * + * @param string $name + * @return string + */ + protected function qualifyClass($name) + { + $name = ltrim($name, '\\/'); + + $rootNamespace = $this->rootNamespace(); + + if (Str::startsWith($name, $rootNamespace)) { + return $name; + } + + $name = str_replace('/', '\\', $name); + + return $this->qualifyClass( + $this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name + ); + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace; + } + + /** + * Determine if the class already exists. + * + * @param string $rawName + * @return bool + */ + protected function alreadyExists($rawName) + { + return $this->files->exists($this->getPath($this->qualifyClass($rawName))); + } + + /** + * Get the destination class path. + * + * @param string $name + * @return string + */ + protected function getPath($name) + { + $name = Str::replaceFirst($this->rootNamespace(), '', $name); + + return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php'; + } + + /** + * Build the directory for the class if necessary. + * + * @param string $path + * @return string + */ + protected function makeDirectory($path) + { + if (! $this->files->isDirectory(dirname($path))) { + $this->files->makeDirectory(dirname($path), 0777, true, true); + } + + return $path; + } + + /** + * Build the class with the given name. + * + * @param string $name + * @return string + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + protected function buildClass($name) + { + $stub = $this->files->get($this->getStub()); + + return $this->replaceNamespace($stub, $name)->replaceClass($stub, $name); + } + + /** + * Replace the namespace for the given stub. + * + * @param string $stub + * @param string $name + * @return $this + */ + protected function replaceNamespace(&$stub, $name) + { + $stub = str_replace( + ['DummyNamespace', 'DummyRootNamespace', 'NamespacedDummyUserModel'], + [$this->getNamespace($name), $this->rootNamespace(), $this->userProviderModel()], + $stub + ); + + return $this; + } + + /** + * Get the full namespace for a given class, without the class name. + * + * @param string $name + * @return string + */ + protected function getNamespace($name) + { + return trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\'); + } + + /** + * Replace the class name for the given stub. + * + * @param string $stub + * @param string $name + * @return string + */ + protected function replaceClass($stub, $name) + { + $class = str_replace($this->getNamespace($name).'\\', '', $name); + + return str_replace('DummyClass', $class, $stub); + } + + /** + * Alphabetically sorts the imports for the given stub. + * + * @param string $stub + * @return string + */ + protected function sortImports($stub) + { + if (preg_match('/(?P(?:use [^;]+;$\n?)+)/m', $stub, $match)) { + $imports = explode("\n", trim($match['imports'])); + + sort($imports); + + return str_replace(trim($match['imports']), implode("\n", $imports), $stub); + } + + return $stub; + } + + /** + * Get the desired class name from the input. + * + * @return string + */ + protected function getNameInput() + { + return trim($this->argument('name')); + } + + /** + * Get the root namespace for the class. + * + * @return string + */ + protected function rootNamespace() + { + return $this->laravel->getNamespace(); + } + + /** + * Get the model for the default guard's user provider. + * + * @return string|null + */ + protected function userProviderModel() + { + $config = $this->laravel['config']; + + $provider = $config->get('auth.guards.'.$config->get('auth.defaults.guard').'.provider'); + + return $config->get("auth.providers.{$provider}.model"); + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['name', InputArgument::REQUIRED, 'The name of the class'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Console/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Console/OutputStyle.php b/vendor/laravel/framework/src/Illuminate/Console/OutputStyle.php new file mode 100644 index 00000000..fe5dc450 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/OutputStyle.php @@ -0,0 +1,71 @@ +output = $output; + + parent::__construct($input, $output); + } + + /** + * Returns whether verbosity is quiet (-q). + * + * @return bool + */ + public function isQuiet() + { + return $this->output->isQuiet(); + } + + /** + * Returns whether verbosity is verbose (-v). + * + * @return bool + */ + public function isVerbose() + { + return $this->output->isVerbose(); + } + + /** + * Returns whether verbosity is very verbose (-vv). + * + * @return bool + */ + public function isVeryVerbose() + { + return $this->output->isVeryVerbose(); + } + + /** + * Returns whether verbosity is debug (-vvv). + * + * @return bool + */ + public function isDebug() + { + return $this->output->isDebug(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Parser.php b/vendor/laravel/framework/src/Illuminate/Console/Parser.php new file mode 100644 index 00000000..00dca1cd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Parser.php @@ -0,0 +1,144 @@ +cache = $cache; + } + + /** + * Attempt to obtain an event mutex for the given event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return bool + */ + public function create(Event $event) + { + return $this->cache->store($this->store)->add( + $event->mutexName(), true, $event->expiresAt * 60 + ); + } + + /** + * Determine if an event mutex exists for the given event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return bool + */ + public function exists(Event $event) + { + return $this->cache->store($this->store)->has($event->mutexName()); + } + + /** + * Clear the event mutex for the given event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return void + */ + public function forget(Event $event) + { + $this->cache->store($this->store)->forget($event->mutexName()); + } + + /** + * Specify the cache store that should be used. + * + * @param string $store + * @return $this + */ + public function useStore($store) + { + $this->store = $store; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php new file mode 100644 index 00000000..0dffb567 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php @@ -0,0 +1,75 @@ +cache = $cache; + } + + /** + * Attempt to obtain a scheduling mutex for the given event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @param \DateTimeInterface $time + * @return bool + */ + public function create(Event $event, DateTimeInterface $time) + { + return $this->cache->store($this->store)->add( + $event->mutexName().$time->format('Hi'), true, 3600 + ); + } + + /** + * Determine if a scheduling mutex exists for the given event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @param \DateTimeInterface $time + * @return bool + */ + public function exists(Event $event, DateTimeInterface $time) + { + return $this->cache->store($this->store)->has( + $event->mutexName().$time->format('Hi') + ); + } + + /** + * Specify the cache store that should be used. + * + * @param string $store + * @return $this + */ + public function useStore($store) + { + $this->store = $store; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php new file mode 100644 index 00000000..6af680d9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php @@ -0,0 +1,169 @@ +mutex = $mutex; + $this->callback = $callback; + $this->parameters = $parameters; + $this->timezone = $timezone; + } + + /** + * Run the given event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return mixed + * + * @throws \Exception + */ + public function run(Container $container) + { + if ($this->description && $this->withoutOverlapping && + ! $this->mutex->create($this)) { + return; + } + + $pid = getmypid(); + + register_shutdown_function(function () use ($pid) { + if ($pid === getmypid()) { + $this->removeMutex(); + } + }); + + parent::callBeforeCallbacks($container); + + try { + $response = is_object($this->callback) + ? $container->call([$this->callback, '__invoke'], $this->parameters) + : $container->call($this->callback, $this->parameters); + } finally { + $this->removeMutex(); + + parent::callAfterCallbacks($container); + } + + return $response; + } + + /** + * Clear the mutex for the event. + * + * @return void + */ + protected function removeMutex() + { + if ($this->description && $this->withoutOverlapping) { + $this->mutex->forget($this); + } + } + + /** + * Do not allow the event to overlap each other. + * + * @param int $expiresAt + * @return $this + * + * @throws \LogicException + */ + public function withoutOverlapping($expiresAt = 1440) + { + if (! isset($this->description)) { + throw new LogicException( + "A scheduled event name is required to prevent overlapping. Use the 'name' method before 'withoutOverlapping'." + ); + } + + $this->withoutOverlapping = true; + + $this->expiresAt = $expiresAt; + + return $this->skip(function () { + return $this->mutex->exists($this); + }); + } + + /** + * Allow the event to only run on one server for each cron expression. + * + * @return $this + * + * @throws \LogicException + */ + public function onOneServer() + { + if (! isset($this->description)) { + throw new LogicException( + "A scheduled event name is required to only run on one server. Use the 'name' method before 'onOneServer'." + ); + } + + $this->onOneServer = true; + + return $this; + } + + /** + * Get the mutex name for the scheduled command. + * + * @return string + */ + public function mutexName() + { + return 'framework/schedule-'.sha1($this->description); + } + + /** + * Get the summary of the event for display. + * + * @return string + */ + public function getSummaryForDisplay() + { + if (is_string($this->description)) { + return $this->description; + } + + return is_string($this->callback) ? $this->callback : 'Callback'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CommandBuilder.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CommandBuilder.php new file mode 100644 index 00000000..bc833bd2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CommandBuilder.php @@ -0,0 +1,75 @@ +runInBackground) { + return $this->buildBackgroundCommand($event); + } + + return $this->buildForegroundCommand($event); + } + + /** + * Build the command for running the event in the foreground. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return string + */ + protected function buildForegroundCommand(Event $event) + { + $output = ProcessUtils::escapeArgument($event->output); + + return $this->ensureCorrectUser( + $event, $event->command.($event->shouldAppendOutput ? ' >> ' : ' > ').$output.' 2>&1' + ); + } + + /** + * Build the command for running the event in the background. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return string + */ + protected function buildBackgroundCommand(Event $event) + { + $output = ProcessUtils::escapeArgument($event->output); + + $redirect = $event->shouldAppendOutput ? ' >> ' : ' > '; + + $finished = Application::formatCommandString('schedule:finish').' "'.$event->mutexName().'"'; + + if (windows_os()) { + return 'start /b cmd /c "('.$event->command.' & '.$finished.' "%errorlevel%")'.$redirect.$output.' 2>&1"'; + } + + return $this->ensureCorrectUser($event, + '('.$event->command.$redirect.$output.' 2>&1 ; '.$finished.' "$?") > ' + .ProcessUtils::escapeArgument($event->getDefaultOutput()).' 2>&1 &' + ); + } + + /** + * Finalize the event's command syntax with the correct user. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @param string $command + * @return string + */ + protected function ensureCorrectUser(Event $event, $command) + { + return $event->user && ! windows_os() ? 'sudo -u '.$event->user.' -- sh -c \''.$command.'\'' : $command; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php new file mode 100644 index 00000000..58bc7e0a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php @@ -0,0 +1,839 @@ +mutex = $mutex; + $this->command = $command; + $this->timezone = $timezone; + + $this->output = $this->getDefaultOutput(); + } + + /** + * Get the default output depending on the OS. + * + * @return string + */ + public function getDefaultOutput() + { + return (DIRECTORY_SEPARATOR === '\\') ? 'NUL' : '/dev/null'; + } + + /** + * Run the given event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function run(Container $container) + { + if ($this->withoutOverlapping && + ! $this->mutex->create($this)) { + return; + } + + $this->runInBackground + ? $this->runCommandInBackground($container) + : $this->runCommandInForeground($container); + } + + /** + * Get the mutex name for the scheduled command. + * + * @return string + */ + public function mutexName() + { + return 'framework'.DIRECTORY_SEPARATOR.'schedule-'.sha1($this->expression.$this->command); + } + + /** + * Run the command in the foreground. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + protected function runCommandInForeground(Container $container) + { + $this->callBeforeCallbacks($container); + + $this->exitCode = Process::fromShellCommandline($this->buildCommand(), base_path(), null, null, null)->run(); + + $this->callAfterCallbacks($container); + } + + /** + * Run the command in the background. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + protected function runCommandInBackground(Container $container) + { + $this->callBeforeCallbacks($container); + + Process::fromShellCommandline($this->buildCommand(), base_path(), null, null, null)->run(); + } + + /** + * Call all of the "before" callbacks for the event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function callBeforeCallbacks(Container $container) + { + foreach ($this->beforeCallbacks as $callback) { + $container->call($callback); + } + } + + /** + * Call all of the "after" callbacks for the event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function callAfterCallbacks(Container $container) + { + foreach ($this->afterCallbacks as $callback) { + $container->call($callback); + } + } + + /** + * Call all of the "after" callbacks for the event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @param int $exitCode + * @return void + */ + public function callAfterCallbacksWithExitCode(Container $container, $exitCode) + { + $this->exitCode = (int) $exitCode; + + $this->callAfterCallbacks($container); + } + + /** + * Build the command string. + * + * @return string + */ + public function buildCommand() + { + return (new CommandBuilder)->buildCommand($this); + } + + /** + * Determine if the given event should run based on the Cron expression. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return bool + */ + public function isDue($app) + { + if (! $this->runsInMaintenanceMode() && $app->isDownForMaintenance()) { + return false; + } + + return $this->expressionPasses() && + $this->runsInEnvironment($app->environment()); + } + + /** + * Determine if the event runs in maintenance mode. + * + * @return bool + */ + public function runsInMaintenanceMode() + { + return $this->evenInMaintenanceMode; + } + + /** + * Determine if the Cron expression passes. + * + * @return bool + */ + protected function expressionPasses() + { + $date = Date::now(); + + if ($this->timezone) { + $date = $date->setTimezone($this->timezone); + } + + return CronExpression::factory($this->expression)->isDue($date->toDateTimeString()); + } + + /** + * Determine if the event runs in the given environment. + * + * @param string $environment + * @return bool + */ + public function runsInEnvironment($environment) + { + return empty($this->environments) || in_array($environment, $this->environments); + } + + /** + * Determine if the filters pass for the event. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return bool + */ + public function filtersPass($app) + { + foreach ($this->filters as $callback) { + if (! $app->call($callback)) { + return false; + } + } + + foreach ($this->rejects as $callback) { + if ($app->call($callback)) { + return false; + } + } + + return true; + } + + /** + * Ensure that the output is stored on disk in a log file. + * + * @return $this + */ + public function storeOutput() + { + $this->ensureOutputIsBeingCaptured(); + + return $this; + } + + /** + * Send the output of the command to a given location. + * + * @param string $location + * @param bool $append + * @return $this + */ + public function sendOutputTo($location, $append = false) + { + $this->output = $location; + + $this->shouldAppendOutput = $append; + + return $this; + } + + /** + * Append the output of the command to a given location. + * + * @param string $location + * @return $this + */ + public function appendOutputTo($location) + { + return $this->sendOutputTo($location, true); + } + + /** + * E-mail the results of the scheduled operation. + * + * @param array|mixed $addresses + * @param bool $onlyIfOutputExists + * @return $this + * + * @throws \LogicException + */ + public function emailOutputTo($addresses, $onlyIfOutputExists = false) + { + $this->ensureOutputIsBeingCaptured(); + + $addresses = Arr::wrap($addresses); + + return $this->then(function (Mailer $mailer) use ($addresses, $onlyIfOutputExists) { + $this->emailOutput($mailer, $addresses, $onlyIfOutputExists); + }); + } + + /** + * E-mail the results of the scheduled operation if it produces output. + * + * @param array|mixed $addresses + * @return $this + * + * @throws \LogicException + */ + public function emailWrittenOutputTo($addresses) + { + return $this->emailOutputTo($addresses, true); + } + + /** + * E-mail the results of the scheduled operation if it fails. + * + * @param array|mixed $addresses + * @return $this + */ + public function emailOutputOnFailure($addresses) + { + $this->ensureOutputIsBeingCaptured(); + + $addresses = Arr::wrap($addresses); + + return $this->onFailure(function (Mailer $mailer) use ($addresses) { + $this->emailOutput($mailer, $addresses, false); + }); + } + + /** + * Ensure that the command output is being captured. + * + * @return void + */ + protected function ensureOutputIsBeingCaptured() + { + if (is_null($this->output) || $this->output == $this->getDefaultOutput()) { + $this->sendOutputTo(storage_path('logs/schedule-'.sha1($this->mutexName()).'.log')); + } + } + + /** + * E-mail the output of the event to the recipients. + * + * @param \Illuminate\Contracts\Mail\Mailer $mailer + * @param array $addresses + * @param bool $onlyIfOutputExists + * @return void + */ + protected function emailOutput(Mailer $mailer, $addresses, $onlyIfOutputExists = false) + { + $text = file_exists($this->output) ? file_get_contents($this->output) : ''; + + if ($onlyIfOutputExists && empty($text)) { + return; + } + + $mailer->raw($text, function ($m) use ($addresses) { + $m->to($addresses)->subject($this->getEmailSubject()); + }); + } + + /** + * Get the e-mail subject line for output results. + * + * @return string + */ + protected function getEmailSubject() + { + if ($this->description) { + return $this->description; + } + + return "Scheduled Job Output For [{$this->command}]"; + } + + /** + * Register a callback to ping a given URL before the job runs. + * + * @param string $url + * @return $this + */ + public function pingBefore($url) + { + return $this->before($this->pingCallback($url)); + } + + /** + * Register a callback to ping a given URL before the job runs if the given condition is true. + * + * @param bool $value + * @param string $url + * @return $this + */ + public function pingBeforeIf($value, $url) + { + return $value ? $this->pingBefore($url) : $this; + } + + /** + * Register a callback to ping a given URL after the job runs. + * + * @param string $url + * @return $this + */ + public function thenPing($url) + { + return $this->then($this->pingCallback($url)); + } + + /** + * Register a callback to ping a given URL after the job runs if the given condition is true. + * + * @param bool $value + * @param string $url + * @return $this + */ + public function thenPingIf($value, $url) + { + return $value ? $this->thenPing($url) : $this; + } + + /** + * Register a callback to ping a given URL if the operation succeeds. + * + * @param string $url + * @return $this + */ + public function pingOnSuccess($url) + { + return $this->onSuccess($this->pingCallback($url)); + } + + /** + * Register a callback to ping a given URL if the operation fails. + * + * @param string $url + * @return $this + */ + public function pingOnFailure($url) + { + return $this->onFailure($this->pingCallback($url)); + } + + /** + * Get the callback that pings the given URL. + * + * @param string $url + * @return \Closure + */ + protected function pingCallback($url) + { + return function (Container $container, HttpClient $http) use ($url) { + try { + $http->get($url); + } catch (ClientExceptionInterface|TransferException $e) { + $container->make(ExceptionHandler::class)->report($e); + } + }; + } + + /** + * State that the command should run in background. + * + * @return $this + */ + public function runInBackground() + { + $this->runInBackground = true; + + return $this; + } + + /** + * Set which user the command should run as. + * + * @param string $user + * @return $this + */ + public function user($user) + { + $this->user = $user; + + return $this; + } + + /** + * Limit the environments the command should run in. + * + * @param array|mixed $environments + * @return $this + */ + public function environments($environments) + { + $this->environments = is_array($environments) ? $environments : func_get_args(); + + return $this; + } + + /** + * State that the command should run even in maintenance mode. + * + * @return $this + */ + public function evenInMaintenanceMode() + { + $this->evenInMaintenanceMode = true; + + return $this; + } + + /** + * Do not allow the event to overlap each other. + * + * @param int $expiresAt + * @return $this + */ + public function withoutOverlapping($expiresAt = 1440) + { + $this->withoutOverlapping = true; + + $this->expiresAt = $expiresAt; + + return $this->then(function () { + $this->mutex->forget($this); + })->skip(function () { + return $this->mutex->exists($this); + }); + } + + /** + * Allow the event to only run on one server for each cron expression. + * + * @return $this + */ + public function onOneServer() + { + $this->onOneServer = true; + + return $this; + } + + /** + * Register a callback to further filter the schedule. + * + * @param \Closure|bool $callback + * @return $this + */ + public function when($callback) + { + $this->filters[] = Reflector::isCallable($callback) ? $callback : function () use ($callback) { + return $callback; + }; + + return $this; + } + + /** + * Register a callback to further filter the schedule. + * + * @param \Closure|bool $callback + * @return $this + */ + public function skip($callback) + { + $this->rejects[] = Reflector::isCallable($callback) ? $callback : function () use ($callback) { + return $callback; + }; + + return $this; + } + + /** + * Register a callback to be called before the operation. + * + * @param \Closure $callback + * @return $this + */ + public function before(Closure $callback) + { + $this->beforeCallbacks[] = $callback; + + return $this; + } + + /** + * Register a callback to be called after the operation. + * + * @param \Closure $callback + * @return $this + */ + public function after(Closure $callback) + { + return $this->then($callback); + } + + /** + * Register a callback to be called after the operation. + * + * @param \Closure $callback + * @return $this + */ + public function then(Closure $callback) + { + $this->afterCallbacks[] = $callback; + + return $this; + } + + /** + * Register a callback to be called if the operation succeeds. + * + * @param \Closure $callback + * @return $this + */ + public function onSuccess(Closure $callback) + { + return $this->then(function (Container $container) use ($callback) { + if (0 === $this->exitCode) { + $container->call($callback); + } + }); + } + + /** + * Register a callback to be called if the operation fails. + * + * @param \Closure $callback + * @return $this + */ + public function onFailure(Closure $callback) + { + return $this->then(function (Container $container) use ($callback) { + if (0 !== $this->exitCode) { + $container->call($callback); + } + }); + } + + /** + * Set the human-friendly description of the event. + * + * @param string $description + * @return $this + */ + public function name($description) + { + return $this->description($description); + } + + /** + * Set the human-friendly description of the event. + * + * @param string $description + * @return $this + */ + public function description($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get the summary of the event for display. + * + * @return string + */ + public function getSummaryForDisplay() + { + if (is_string($this->description)) { + return $this->description; + } + + return $this->buildCommand(); + } + + /** + * Determine the next due date for an event. + * + * @param \DateTimeInterface|string $currentTime + * @param int $nth + * @param bool $allowCurrentDate + * @return \Illuminate\Support\Carbon + */ + public function nextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false) + { + return Date::instance(CronExpression::factory( + $this->getExpression() + )->getNextRunDate($currentTime, $nth, $allowCurrentDate, $this->timezone)); + } + + /** + * Get the Cron expression for the event. + * + * @return string + */ + public function getExpression() + { + return $this->expression; + } + + /** + * Set the event mutex implementation to be used. + * + * @param \Illuminate\Console\Scheduling\EventMutex $mutex + * @return $this + */ + public function preventOverlapsUsing(EventMutex $mutex) + { + $this->mutex = $mutex; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/EventMutex.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/EventMutex.php new file mode 100644 index 00000000..1840e242 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/EventMutex.php @@ -0,0 +1,30 @@ +expression = $expression; + + return $this; + } + + /** + * Schedule the event to run between start and end time. + * + * @param string $startTime + * @param string $endTime + * @return $this + */ + public function between($startTime, $endTime) + { + return $this->when($this->inTimeInterval($startTime, $endTime)); + } + + /** + * Schedule the event to not run between start and end time. + * + * @param string $startTime + * @param string $endTime + * @return $this + */ + public function unlessBetween($startTime, $endTime) + { + return $this->skip($this->inTimeInterval($startTime, $endTime)); + } + + /** + * Schedule the event to run between start and end time. + * + * @param string $startTime + * @param string $endTime + * @return \Closure + */ + private function inTimeInterval($startTime, $endTime) + { + [$now, $startTime, $endTime] = [ + Carbon::now($this->timezone), + Carbon::parse($startTime, $this->timezone), + Carbon::parse($endTime, $this->timezone), + ]; + + if ($endTime->lessThan($startTime)) { + if ($startTime->greaterThan($now)) { + $startTime->subDay(1); + } else { + $endTime->addDay(1); + } + } + + return function () use ($now, $startTime, $endTime) { + return $now->between($startTime, $endTime); + }; + } + + /** + * Schedule the event to run every minute. + * + * @return $this + */ + public function everyMinute() + { + return $this->spliceIntoPosition(1, '*'); + } + + /** + * Schedule the event to run every five minutes. + * + * @return $this + */ + public function everyFiveMinutes() + { + return $this->spliceIntoPosition(1, '*/5'); + } + + /** + * Schedule the event to run every ten minutes. + * + * @return $this + */ + public function everyTenMinutes() + { + return $this->spliceIntoPosition(1, '*/10'); + } + + /** + * Schedule the event to run every fifteen minutes. + * + * @return $this + */ + public function everyFifteenMinutes() + { + return $this->spliceIntoPosition(1, '*/15'); + } + + /** + * Schedule the event to run every thirty minutes. + * + * @return $this + */ + public function everyThirtyMinutes() + { + return $this->spliceIntoPosition(1, '0,30'); + } + + /** + * Schedule the event to run hourly. + * + * @return $this + */ + public function hourly() + { + return $this->spliceIntoPosition(1, 0); + } + + /** + * Schedule the event to run hourly at a given offset in the hour. + * + * @param array|int $offset + * @return $this + */ + public function hourlyAt($offset) + { + $offset = is_array($offset) ? implode(',', $offset) : $offset; + + return $this->spliceIntoPosition(1, $offset); + } + + /** + * Schedule the event to run daily. + * + * @return $this + */ + public function daily() + { + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, 0); + } + + /** + * Schedule the command at a given time. + * + * @param string $time + * @return $this + */ + public function at($time) + { + return $this->dailyAt($time); + } + + /** + * Schedule the event to run daily at a given time (10:00, 19:30, etc). + * + * @param string $time + * @return $this + */ + public function dailyAt($time) + { + $segments = explode(':', $time); + + return $this->spliceIntoPosition(2, (int) $segments[0]) + ->spliceIntoPosition(1, count($segments) === 2 ? (int) $segments[1] : '0'); + } + + /** + * Schedule the event to run twice daily. + * + * @param int $first + * @param int $second + * @return $this + */ + public function twiceDaily($first = 1, $second = 13) + { + $hours = $first.','.$second; + + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, $hours); + } + + /** + * Schedule the event to run only on weekdays. + * + * @return $this + */ + public function weekdays() + { + return $this->spliceIntoPosition(5, '1-5'); + } + + /** + * Schedule the event to run only on weekends. + * + * @return $this + */ + public function weekends() + { + return $this->spliceIntoPosition(5, '0,6'); + } + + /** + * Schedule the event to run only on Mondays. + * + * @return $this + */ + public function mondays() + { + return $this->days(1); + } + + /** + * Schedule the event to run only on Tuesdays. + * + * @return $this + */ + public function tuesdays() + { + return $this->days(2); + } + + /** + * Schedule the event to run only on Wednesdays. + * + * @return $this + */ + public function wednesdays() + { + return $this->days(3); + } + + /** + * Schedule the event to run only on Thursdays. + * + * @return $this + */ + public function thursdays() + { + return $this->days(4); + } + + /** + * Schedule the event to run only on Fridays. + * + * @return $this + */ + public function fridays() + { + return $this->days(5); + } + + /** + * Schedule the event to run only on Saturdays. + * + * @return $this + */ + public function saturdays() + { + return $this->days(6); + } + + /** + * Schedule the event to run only on Sundays. + * + * @return $this + */ + public function sundays() + { + return $this->days(0); + } + + /** + * Schedule the event to run weekly. + * + * @return $this + */ + public function weekly() + { + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(5, 0); + } + + /** + * Schedule the event to run weekly on a given day and time. + * + * @param int $day + * @param string $time + * @return $this + */ + public function weeklyOn($day, $time = '0:0') + { + $this->dailyAt($time); + + return $this->spliceIntoPosition(5, $day); + } + + /** + * Schedule the event to run monthly. + * + * @return $this + */ + public function monthly() + { + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(3, 1); + } + + /** + * Schedule the event to run monthly on a given day and time. + * + * @param int $day + * @param string $time + * @return $this + */ + public function monthlyOn($day = 1, $time = '0:0') + { + $this->dailyAt($time); + + return $this->spliceIntoPosition(3, $day); + } + + /** + * Schedule the event to run twice monthly. + * + * @param int $first + * @param int $second + * @return $this + */ + public function twiceMonthly($first = 1, $second = 16) + { + $days = $first.','.$second; + + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(3, $days); + } + + /** + * Schedule the event to run quarterly. + * + * @return $this + */ + public function quarterly() + { + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(3, 1) + ->spliceIntoPosition(4, '1-12/3'); + } + + /** + * Schedule the event to run yearly. + * + * @return $this + */ + public function yearly() + { + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(3, 1) + ->spliceIntoPosition(4, 1); + } + + /** + * Set the days of the week the command should run on. + * + * @param array|mixed $days + * @return $this + */ + public function days($days) + { + $days = is_array($days) ? $days : func_get_args(); + + return $this->spliceIntoPosition(5, implode(',', $days)); + } + + /** + * Set the timezone the date should be evaluated on. + * + * @param \DateTimeZone|string $timezone + * @return $this + */ + public function timezone($timezone) + { + $this->timezone = $timezone; + + return $this; + } + + /** + * Splice the given value into the given position of the expression. + * + * @param int $position + * @param string $value + * @return $this + */ + protected function spliceIntoPosition($position, $value) + { + $segments = explode(' ', $this->expression); + + $segments[$position - 1] = $value; + + return $this->cron(implode(' ', $segments)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Schedule.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Schedule.php new file mode 100644 index 00000000..bfbb4141 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Schedule.php @@ -0,0 +1,312 @@ +timezone = $timezone; + + if (! class_exists(Container::class)) { + throw new RuntimeException( + 'A container implementation is required to use the scheduler. Please install the illuminate/container package.' + ); + } + + $container = Container::getInstance(); + + $this->eventMutex = $container->bound(EventMutex::class) + ? $container->make(EventMutex::class) + : $container->make(CacheEventMutex::class); + + $this->schedulingMutex = $container->bound(SchedulingMutex::class) + ? $container->make(SchedulingMutex::class) + : $container->make(CacheSchedulingMutex::class); + } + + /** + * Add a new callback event to the schedule. + * + * @param string|callable $callback + * @param array $parameters + * @return \Illuminate\Console\Scheduling\CallbackEvent + */ + public function call($callback, array $parameters = []) + { + $this->events[] = $event = new CallbackEvent( + $this->eventMutex, $callback, $parameters, $this->timezone + ); + + return $event; + } + + /** + * Add a new Artisan command event to the schedule. + * + * @param string $command + * @param array $parameters + * @return \Illuminate\Console\Scheduling\Event + */ + public function command($command, array $parameters = []) + { + if (class_exists($command)) { + $command = Container::getInstance()->make($command)->getName(); + } + + return $this->exec( + Application::formatCommandString($command), $parameters + ); + } + + /** + * Add a new job callback event to the schedule. + * + * @param object|string $job + * @param string|null $queue + * @param string|null $connection + * @return \Illuminate\Console\Scheduling\CallbackEvent + */ + public function job($job, $queue = null, $connection = null) + { + return $this->call(function () use ($job, $queue, $connection) { + $job = is_string($job) ? Container::getInstance()->make($job) : $job; + + if ($job instanceof ShouldQueue) { + $this->dispatchToQueue($job, $queue ?? $job->queue, $connection ?? $job->connection); + } else { + $this->dispatchNow($job); + } + })->name(is_string($job) ? $job : get_class($job)); + } + + /** + * Dispatch the given job to the queue. + * + * @param object $job + * @param string|null $queue + * @param string|null $connection + * @return void + */ + protected function dispatchToQueue($job, $queue, $connection) + { + if ($job instanceof Closure) { + if (! class_exists(CallQueuedClosure::class)) { + throw new RuntimeException( + 'To enable support for closure jobs, please install the illuminate/queue package.' + ); + } + + $job = CallQueuedClosure::create($job); + } + + $this->getDispatcher()->dispatch( + $job->onConnection($connection)->onQueue($queue) + ); + } + + /** + * Dispatch the given job right now. + * + * @param object $job + * @return void + */ + protected function dispatchNow($job) + { + $this->getDispatcher()->dispatchNow($job); + } + + /** + * Add a new command event to the schedule. + * + * @param string $command + * @param array $parameters + * @return \Illuminate\Console\Scheduling\Event + */ + public function exec($command, array $parameters = []) + { + if (count($parameters)) { + $command .= ' '.$this->compileParameters($parameters); + } + + $this->events[] = $event = new Event($this->eventMutex, $command, $this->timezone); + + return $event; + } + + /** + * Compile parameters for a command. + * + * @param array $parameters + * @return string + */ + protected function compileParameters(array $parameters) + { + return collect($parameters)->map(function ($value, $key) { + if (is_array($value)) { + return $this->compileArrayInput($key, $value); + } + + if (! is_numeric($value) && ! preg_match('/^(-.$|--.*)/i', $value)) { + $value = ProcessUtils::escapeArgument($value); + } + + return is_numeric($key) ? $value : "{$key}={$value}"; + })->implode(' '); + } + + /** + * Compile array input for a command. + * + * @param string|int $key + * @param array $value + * @return string + */ + public function compileArrayInput($key, $value) + { + $value = collect($value)->map(function ($value) { + return ProcessUtils::escapeArgument($value); + }); + + if (Str::startsWith($key, '--')) { + $value = $value->map(function ($value) use ($key) { + return "{$key}={$value}"; + }); + } elseif (Str::startsWith($key, '-')) { + $value = $value->map(function ($value) use ($key) { + return "{$key} {$value}"; + }); + } + + return $value->implode(' '); + } + + /** + * Determine if the server is allowed to run this event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @param \DateTimeInterface $time + * @return bool + */ + public function serverShouldRun(Event $event, DateTimeInterface $time) + { + return $this->schedulingMutex->create($event, $time); + } + + /** + * Get all of the events on the schedule that are due. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return \Illuminate\Support\Collection + */ + public function dueEvents($app) + { + return collect($this->events)->filter->isDue($app); + } + + /** + * Get all of the events on the schedule. + * + * @return \Illuminate\Console\Scheduling\Event[] + */ + public function events() + { + return $this->events; + } + + /** + * Specify the cache store that should be used to store mutexes. + * + * @param string $store + * @return $this + */ + public function useCache($store) + { + if ($this->eventMutex instanceof CacheEventMutex) { + $this->eventMutex->useStore($store); + } + + if ($this->schedulingMutex instanceof CacheSchedulingMutex) { + $this->schedulingMutex->useStore($store); + } + + return $this; + } + + /** + * Get the job dispatcher, if available. + * + * @return \Illuminate\Contracts\Bus\Dispatcher + */ + protected function getDispatcher() + { + if ($this->dispatcher === null) { + try { + $this->dispatcher = Container::getInstance()->make(Dispatcher::class); + } catch (BindingResolutionException $e) { + throw new RuntimeException( + 'Unable to resolve the dispatcher from the service container. Please bind it or install the illuminate/bus package.', + $e->getCode(), $e + ); + } + } + + return $this->dispatcher; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php new file mode 100644 index 00000000..c19381f0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php @@ -0,0 +1,42 @@ +events())->filter(function ($value) { + return $value->mutexName() == $this->argument('id'); + })->each->callAfterCallbacksWithExitCode($this->laravel, $this->argument('code')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php new file mode 100644 index 00000000..b211da14 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php @@ -0,0 +1,139 @@ +startedAt = Date::now(); + + parent::__construct(); + } + + /** + * Execute the console command. + * + * @param \Illuminate\Console\Scheduling\Schedule $schedule + * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher + * @return void + */ + public function handle(Schedule $schedule, Dispatcher $dispatcher) + { + $this->schedule = $schedule; + $this->dispatcher = $dispatcher; + + foreach ($this->schedule->dueEvents($this->laravel) as $event) { + if (! $event->filtersPass($this->laravel)) { + $this->dispatcher->dispatch(new ScheduledTaskSkipped($event)); + + continue; + } + + if ($event->onOneServer) { + $this->runSingleServerEvent($event); + } else { + $this->runEvent($event); + } + + $this->eventsRan = true; + } + + if (! $this->eventsRan) { + $this->info('No scheduled commands are ready to run.'); + } + } + + /** + * Run the given single server event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return void + */ + protected function runSingleServerEvent($event) + { + if ($this->schedule->serverShouldRun($event, $this->startedAt)) { + $this->runEvent($event); + } else { + $this->line('Skipping command (has already run on another server): '.$event->getSummaryForDisplay()); + } + } + + /** + * Run the given event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return void + */ + protected function runEvent($event) + { + $this->line('Running scheduled command: '.$event->getSummaryForDisplay()); + + $this->dispatcher->dispatch(new ScheduledTaskStarting($event)); + + $start = microtime(true); + + $event->run($this->laravel); + + $this->dispatcher->dispatch(new ScheduledTaskFinished( + $event, + round(microtime(true) - $start, 2) + )); + + $this->eventsRan = true; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/SchedulingMutex.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/SchedulingMutex.php new file mode 100644 index 00000000..ab4e87da --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/SchedulingMutex.php @@ -0,0 +1,26 @@ +make($segments[0]), $method], $parameters + ); + } + + /** + * Call a method that has been bound to the container. + * + * @param \Illuminate\Container\Container $container + * @param callable $callback + * @param mixed $default + * @return mixed + */ + protected static function callBoundMethod($container, $callback, $default) + { + if (! is_array($callback)) { + return Util::unwrapIfClosure($default); + } + + // Here we need to turn the array callable into a Class@method string we can use to + // examine the container and see if there are any method bindings for this given + // method. If there are, we can call this method binding callback immediately. + $method = static::normalizeMethod($callback); + + if ($container->hasMethodBinding($method)) { + return $container->callMethodBinding($method, $callback[0]); + } + + return Util::unwrapIfClosure($default); + } + + /** + * Normalize the given callback into a Class@method string. + * + * @param callable $callback + * @return string + */ + protected static function normalizeMethod($callback) + { + $class = is_string($callback[0]) ? $callback[0] : get_class($callback[0]); + + return "{$class}@{$callback[1]}"; + } + + /** + * Get all dependencies for a given method. + * + * @param \Illuminate\Container\Container $container + * @param callable|string $callback + * @param array $parameters + * @return array + * + * @throws \ReflectionException + */ + protected static function getMethodDependencies($container, $callback, array $parameters = []) + { + $dependencies = []; + + foreach (static::getCallReflector($callback)->getParameters() as $parameter) { + static::addDependencyForCallParameter($container, $parameter, $parameters, $dependencies); + } + + return array_merge($dependencies, array_values($parameters)); + } + + /** + * Get the proper reflection instance for the given callback. + * + * @param callable|string $callback + * @return \ReflectionFunctionAbstract + * + * @throws \ReflectionException + */ + protected static function getCallReflector($callback) + { + if (is_string($callback) && strpos($callback, '::') !== false) { + $callback = explode('::', $callback); + } elseif (is_object($callback) && ! $callback instanceof Closure) { + $callback = [$callback, '__invoke']; + } + + return is_array($callback) + ? new ReflectionMethod($callback[0], $callback[1]) + : new ReflectionFunction($callback); + } + + /** + * Get the dependency for the given call parameter. + * + * @param \Illuminate\Container\Container $container + * @param \ReflectionParameter $parameter + * @param array $parameters + * @param array $dependencies + * @return void + */ + protected static function addDependencyForCallParameter($container, $parameter, + array &$parameters, &$dependencies) + { + if (array_key_exists($paramName = $parameter->getName(), $parameters)) { + $dependencies[] = $parameters[$paramName]; + + unset($parameters[$paramName]); + } elseif (! is_null($className = Util::getParameterClassName($parameter))) { + if (array_key_exists($className, $parameters)) { + $dependencies[] = $parameters[$className]; + + unset($parameters[$className]); + } else { + $dependencies[] = $container->make($className); + } + } elseif ($parameter->isDefaultValueAvailable()) { + $dependencies[] = $parameter->getDefaultValue(); + } elseif (! $parameter->isOptional() && ! array_key_exists($paramName, $parameters)) { + $message = "Unable to resolve dependency [{$parameter}] in class {$parameter->getDeclaringClass()->getName()}"; + + throw new BindingResolutionException($message); + } + } + + /** + * Determine if the given string is in Class@method syntax. + * + * @param mixed $callback + * @return bool + */ + protected static function isCallableWithAtSign($callback) + { + return is_string($callback) && strpos($callback, '@') !== false; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Container/Container.php b/vendor/laravel/framework/src/Illuminate/Container/Container.php new file mode 100755 index 00000000..0d31a89a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Container/Container.php @@ -0,0 +1,1294 @@ +getAlias($c); + } + + return new ContextualBindingBuilder($this, $aliases); + } + + /** + * Determine if the given abstract type has been bound. + * + * @param string $abstract + * @return bool + */ + public function bound($abstract) + { + return isset($this->bindings[$abstract]) || + isset($this->instances[$abstract]) || + $this->isAlias($abstract); + } + + /** + * {@inheritdoc} + */ + public function has($id) + { + return $this->bound($id); + } + + /** + * Determine if the given abstract type has been resolved. + * + * @param string $abstract + * @return bool + */ + public function resolved($abstract) + { + if ($this->isAlias($abstract)) { + $abstract = $this->getAlias($abstract); + } + + return isset($this->resolved[$abstract]) || + isset($this->instances[$abstract]); + } + + /** + * Determine if a given type is shared. + * + * @param string $abstract + * @return bool + */ + public function isShared($abstract) + { + return isset($this->instances[$abstract]) || + (isset($this->bindings[$abstract]['shared']) && + $this->bindings[$abstract]['shared'] === true); + } + + /** + * Determine if a given string is an alias. + * + * @param string $name + * @return bool + */ + public function isAlias($name) + { + return isset($this->aliases[$name]); + } + + /** + * Register a binding with the container. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @param bool $shared + * @return void + */ + public function bind($abstract, $concrete = null, $shared = false) + { + $this->dropStaleInstances($abstract); + + // If no concrete type was given, we will simply set the concrete type to the + // abstract type. After that, the concrete type to be registered as shared + // without being forced to state their classes in both of the parameters. + if (is_null($concrete)) { + $concrete = $abstract; + } + + // If the factory is not a Closure, it means it is just a class name which is + // bound into this container to the abstract type and we will just wrap it + // up inside its own Closure to give us more convenience when extending. + if (! $concrete instanceof Closure) { + $concrete = $this->getClosure($abstract, $concrete); + } + + $this->bindings[$abstract] = compact('concrete', 'shared'); + + // If the abstract type was already resolved in this container we'll fire the + // rebound listener so that any objects which have already gotten resolved + // can have their copy of the object updated via the listener callbacks. + if ($this->resolved($abstract)) { + $this->rebound($abstract); + } + } + + /** + * Get the Closure to be used when building a type. + * + * @param string $abstract + * @param string $concrete + * @return \Closure + */ + protected function getClosure($abstract, $concrete) + { + return function ($container, $parameters = []) use ($abstract, $concrete) { + if ($abstract == $concrete) { + return $container->build($concrete); + } + + return $container->resolve( + $concrete, $parameters, $raiseEvents = false + ); + }; + } + + /** + * Determine if the container has a method binding. + * + * @param string $method + * @return bool + */ + public function hasMethodBinding($method) + { + return isset($this->methodBindings[$method]); + } + + /** + * Bind a callback to resolve with Container::call. + * + * @param array|string $method + * @param \Closure $callback + * @return void + */ + public function bindMethod($method, $callback) + { + $this->methodBindings[$this->parseBindMethod($method)] = $callback; + } + + /** + * Get the method to be bound in class@method format. + * + * @param array|string $method + * @return string + */ + protected function parseBindMethod($method) + { + if (is_array($method)) { + return $method[0].'@'.$method[1]; + } + + return $method; + } + + /** + * Get the method binding for the given method. + * + * @param string $method + * @param mixed $instance + * @return mixed + */ + public function callMethodBinding($method, $instance) + { + return call_user_func($this->methodBindings[$method], $instance, $this); + } + + /** + * Add a contextual binding to the container. + * + * @param string $concrete + * @param string $abstract + * @param \Closure|string $implementation + * @return void + */ + public function addContextualBinding($concrete, $abstract, $implementation) + { + $this->contextual[$concrete][$this->getAlias($abstract)] = $implementation; + } + + /** + * Register a binding if it hasn't already been registered. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @param bool $shared + * @return void + */ + public function bindIf($abstract, $concrete = null, $shared = false) + { + if (! $this->bound($abstract)) { + $this->bind($abstract, $concrete, $shared); + } + } + + /** + * Register a shared binding in the container. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @return void + */ + public function singleton($abstract, $concrete = null) + { + $this->bind($abstract, $concrete, true); + } + + /** + * Register a shared binding if it hasn't already been registered. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @return void + */ + public function singletonIf($abstract, $concrete = null) + { + if (! $this->bound($abstract)) { + $this->singleton($abstract, $concrete); + } + } + + /** + * "Extend" an abstract type in the container. + * + * @param string $abstract + * @param \Closure $closure + * @return void + * + * @throws \InvalidArgumentException + */ + public function extend($abstract, Closure $closure) + { + $abstract = $this->getAlias($abstract); + + if (isset($this->instances[$abstract])) { + $this->instances[$abstract] = $closure($this->instances[$abstract], $this); + + $this->rebound($abstract); + } else { + $this->extenders[$abstract][] = $closure; + + if ($this->resolved($abstract)) { + $this->rebound($abstract); + } + } + } + + /** + * Register an existing instance as shared in the container. + * + * @param string $abstract + * @param mixed $instance + * @return mixed + */ + public function instance($abstract, $instance) + { + $this->removeAbstractAlias($abstract); + + $isBound = $this->bound($abstract); + + unset($this->aliases[$abstract]); + + // We'll check to determine if this type has been bound before, and if it has + // we will fire the rebound callbacks registered with the container and it + // can be updated with consuming classes that have gotten resolved here. + $this->instances[$abstract] = $instance; + + if ($isBound) { + $this->rebound($abstract); + } + + return $instance; + } + + /** + * Remove an alias from the contextual binding alias cache. + * + * @param string $searched + * @return void + */ + protected function removeAbstractAlias($searched) + { + if (! isset($this->aliases[$searched])) { + return; + } + + foreach ($this->abstractAliases as $abstract => $aliases) { + foreach ($aliases as $index => $alias) { + if ($alias == $searched) { + unset($this->abstractAliases[$abstract][$index]); + } + } + } + } + + /** + * Assign a set of tags to a given binding. + * + * @param array|string $abstracts + * @param array|mixed ...$tags + * @return void + */ + public function tag($abstracts, $tags) + { + $tags = is_array($tags) ? $tags : array_slice(func_get_args(), 1); + + foreach ($tags as $tag) { + if (! isset($this->tags[$tag])) { + $this->tags[$tag] = []; + } + + foreach ((array) $abstracts as $abstract) { + $this->tags[$tag][] = $abstract; + } + } + } + + /** + * Resolve all of the bindings for a given tag. + * + * @param string $tag + * @return iterable + */ + public function tagged($tag) + { + if (! isset($this->tags[$tag])) { + return []; + } + + return new RewindableGenerator(function () use ($tag) { + foreach ($this->tags[$tag] as $abstract) { + yield $this->make($abstract); + } + }, count($this->tags[$tag])); + } + + /** + * Alias a type to a different name. + * + * @param string $abstract + * @param string $alias + * @return void + * + * @throws \LogicException + */ + public function alias($abstract, $alias) + { + if ($alias === $abstract) { + throw new LogicException("[{$abstract}] is aliased to itself."); + } + + $this->aliases[$alias] = $abstract; + + $this->abstractAliases[$abstract][] = $alias; + } + + /** + * Bind a new callback to an abstract's rebind event. + * + * @param string $abstract + * @param \Closure $callback + * @return mixed + */ + public function rebinding($abstract, Closure $callback) + { + $this->reboundCallbacks[$abstract = $this->getAlias($abstract)][] = $callback; + + if ($this->bound($abstract)) { + return $this->make($abstract); + } + } + + /** + * Refresh an instance on the given target and method. + * + * @param string $abstract + * @param mixed $target + * @param string $method + * @return mixed + */ + public function refresh($abstract, $target, $method) + { + return $this->rebinding($abstract, function ($app, $instance) use ($target, $method) { + $target->{$method}($instance); + }); + } + + /** + * Fire the "rebound" callbacks for the given abstract type. + * + * @param string $abstract + * @return void + */ + protected function rebound($abstract) + { + $instance = $this->make($abstract); + + foreach ($this->getReboundCallbacks($abstract) as $callback) { + call_user_func($callback, $this, $instance); + } + } + + /** + * Get the rebound callbacks for a given type. + * + * @param string $abstract + * @return array + */ + protected function getReboundCallbacks($abstract) + { + return $this->reboundCallbacks[$abstract] ?? []; + } + + /** + * Wrap the given closure such that its dependencies will be injected when executed. + * + * @param \Closure $callback + * @param array $parameters + * @return \Closure + */ + public function wrap(Closure $callback, array $parameters = []) + { + return function () use ($callback, $parameters) { + return $this->call($callback, $parameters); + }; + } + + /** + * Call the given Closure / class@method and inject its dependencies. + * + * @param callable|string $callback + * @param array $parameters + * @param string|null $defaultMethod + * @return mixed + */ + public function call($callback, array $parameters = [], $defaultMethod = null) + { + return BoundMethod::call($this, $callback, $parameters, $defaultMethod); + } + + /** + * Get a closure to resolve the given type from the container. + * + * @param string $abstract + * @return \Closure + */ + public function factory($abstract) + { + return function () use ($abstract) { + return $this->make($abstract); + }; + } + + /** + * An alias function name for make(). + * + * @param string $abstract + * @param array $parameters + * @return mixed + */ + public function makeWith($abstract, array $parameters = []) + { + return $this->make($abstract, $parameters); + } + + /** + * Resolve the given type from the container. + * + * @param string $abstract + * @param array $parameters + * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + public function make($abstract, array $parameters = []) + { + return $this->resolve($abstract, $parameters); + } + + /** + * {@inheritdoc} + */ + public function get($id) + { + try { + return $this->resolve($id); + } catch (Exception $e) { + if ($this->has($id)) { + throw $e; + } + + throw new EntryNotFoundException($id, $e->getCode(), $e); + } + } + + /** + * Resolve the given type from the container. + * + * @param string $abstract + * @param array $parameters + * @param bool $raiseEvents + * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function resolve($abstract, $parameters = [], $raiseEvents = true) + { + $abstract = $this->getAlias($abstract); + + $needsContextualBuild = ! empty($parameters) || ! is_null( + $this->getContextualConcrete($abstract) + ); + + // If an instance of the type is currently being managed as a singleton we'll + // just return an existing instance instead of instantiating new instances + // so the developer can keep using the same objects instance every time. + if (isset($this->instances[$abstract]) && ! $needsContextualBuild) { + return $this->instances[$abstract]; + } + + $this->with[] = $parameters; + + $concrete = $this->getConcrete($abstract); + + // We're ready to instantiate an instance of the concrete type registered for + // the binding. This will instantiate the types, as well as resolve any of + // its "nested" dependencies recursively until all have gotten resolved. + if ($this->isBuildable($concrete, $abstract)) { + $object = $this->build($concrete); + } else { + $object = $this->make($concrete); + } + + // If we defined any extenders for this type, we'll need to spin through them + // and apply them to the object being built. This allows for the extension + // of services, such as changing configuration or decorating the object. + foreach ($this->getExtenders($abstract) as $extender) { + $object = $extender($object, $this); + } + + // If the requested type is registered as a singleton we'll want to cache off + // the instances in "memory" so we can return it later without creating an + // entirely new instance of an object on each subsequent request for it. + if ($this->isShared($abstract) && ! $needsContextualBuild) { + $this->instances[$abstract] = $object; + } + + if ($raiseEvents) { + $this->fireResolvingCallbacks($abstract, $object); + } + + // Before returning, we will also set the resolved flag to "true" and pop off + // the parameter overrides for this build. After those two things are done + // we will be ready to return back the fully constructed class instance. + $this->resolved[$abstract] = true; + + array_pop($this->with); + + return $object; + } + + /** + * Get the concrete type for a given abstract. + * + * @param string $abstract + * @return mixed + */ + protected function getConcrete($abstract) + { + if (! is_null($concrete = $this->getContextualConcrete($abstract))) { + return $concrete; + } + + // If we don't have a registered resolver or concrete for the type, we'll just + // assume each type is a concrete name and will attempt to resolve it as is + // since the container should be able to resolve concretes automatically. + if (isset($this->bindings[$abstract])) { + return $this->bindings[$abstract]['concrete']; + } + + return $abstract; + } + + /** + * Get the contextual concrete binding for the given abstract. + * + * @param string $abstract + * @return \Closure|string|null + */ + protected function getContextualConcrete($abstract) + { + if (! is_null($binding = $this->findInContextualBindings($abstract))) { + return $binding; + } + + // Next we need to see if a contextual binding might be bound under an alias of the + // given abstract type. So, we will need to check if any aliases exist with this + // type and then spin through them and check for contextual bindings on these. + if (empty($this->abstractAliases[$abstract])) { + return; + } + + foreach ($this->abstractAliases[$abstract] as $alias) { + if (! is_null($binding = $this->findInContextualBindings($alias))) { + return $binding; + } + } + } + + /** + * Find the concrete binding for the given abstract in the contextual binding array. + * + * @param string $abstract + * @return \Closure|string|null + */ + protected function findInContextualBindings($abstract) + { + return $this->contextual[end($this->buildStack)][$abstract] ?? null; + } + + /** + * Determine if the given concrete is buildable. + * + * @param mixed $concrete + * @param string $abstract + * @return bool + */ + protected function isBuildable($concrete, $abstract) + { + return $concrete === $abstract || $concrete instanceof Closure; + } + + /** + * Instantiate a concrete instance of the given type. + * + * @param string $concrete + * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + public function build($concrete) + { + // If the concrete type is actually a Closure, we will just execute it and + // hand back the results of the functions, which allows functions to be + // used as resolvers for more fine-tuned resolution of these objects. + if ($concrete instanceof Closure) { + return $concrete($this, $this->getLastParameterOverride()); + } + + try { + $reflector = new ReflectionClass($concrete); + } catch (ReflectionException $e) { + throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e); + } + + // If the type is not instantiable, the developer is attempting to resolve + // an abstract type such as an Interface or Abstract Class and there is + // no binding registered for the abstractions so we need to bail out. + if (! $reflector->isInstantiable()) { + return $this->notInstantiable($concrete); + } + + $this->buildStack[] = $concrete; + + $constructor = $reflector->getConstructor(); + + // If there are no constructors, that means there are no dependencies then + // we can just resolve the instances of the objects right away, without + // resolving any other types or dependencies out of these containers. + if (is_null($constructor)) { + array_pop($this->buildStack); + + return new $concrete; + } + + $dependencies = $constructor->getParameters(); + + // Once we have all the constructor's parameters we can create each of the + // dependency instances and then use the reflection instances to make a + // new instance of this class, injecting the created dependencies in. + try { + $instances = $this->resolveDependencies($dependencies); + } catch (BindingResolutionException $e) { + array_pop($this->buildStack); + + throw $e; + } + + array_pop($this->buildStack); + + return $reflector->newInstanceArgs($instances); + } + + /** + * Resolve all of the dependencies from the ReflectionParameters. + * + * @param \ReflectionParameter[] $dependencies + * @return array + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function resolveDependencies(array $dependencies) + { + $results = []; + + foreach ($dependencies as $dependency) { + // If this dependency has a override for this particular build we will use + // that instead as the value. Otherwise, we will continue with this run + // of resolutions and let reflection attempt to determine the result. + if ($this->hasParameterOverride($dependency)) { + $results[] = $this->getParameterOverride($dependency); + + continue; + } + + // If the class is null, it means the dependency is a string or some other + // primitive type which we can not resolve since it is not a class and + // we will just bomb out with an error since we have no-where to go. + $results[] = is_null(Util::getParameterClassName($dependency)) + ? $this->resolvePrimitive($dependency) + : $this->resolveClass($dependency); + } + + return $results; + } + + /** + * Determine if the given dependency has a parameter override. + * + * @param \ReflectionParameter $dependency + * @return bool + */ + protected function hasParameterOverride($dependency) + { + return array_key_exists( + $dependency->name, $this->getLastParameterOverride() + ); + } + + /** + * Get a parameter override for a dependency. + * + * @param \ReflectionParameter $dependency + * @return mixed + */ + protected function getParameterOverride($dependency) + { + return $this->getLastParameterOverride()[$dependency->name]; + } + + /** + * Get the last parameter override. + * + * @return array + */ + protected function getLastParameterOverride() + { + return count($this->with) ? end($this->with) : []; + } + + /** + * Resolve a non-class hinted primitive dependency. + * + * @param \ReflectionParameter $parameter + * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function resolvePrimitive(ReflectionParameter $parameter) + { + if (! is_null($concrete = $this->getContextualConcrete('$'.$parameter->getName()))) { + return $concrete instanceof Closure ? $concrete($this) : $concrete; + } + + if ($parameter->isDefaultValueAvailable()) { + return $parameter->getDefaultValue(); + } + + $this->unresolvablePrimitive($parameter); + } + + /** + * Resolve a class based dependency from the container. + * + * @param \ReflectionParameter $parameter + * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function resolveClass(ReflectionParameter $parameter) + { + try { + return $this->make(Util::getParameterClassName($parameter)); + } + + // If we can not resolve the class instance, we will check to see if the value + // is optional, and if it is we will return the optional parameter value as + // the value of the dependency, similarly to how we do this with scalars. + catch (BindingResolutionException $e) { + if ($parameter->isOptional()) { + return $parameter->getDefaultValue(); + } + + throw $e; + } + } + + /** + * Throw an exception that the concrete is not instantiable. + * + * @param string $concrete + * @return void + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function notInstantiable($concrete) + { + if (! empty($this->buildStack)) { + $previous = implode(', ', $this->buildStack); + + $message = "Target [$concrete] is not instantiable while building [$previous]."; + } else { + $message = "Target [$concrete] is not instantiable."; + } + + throw new BindingResolutionException($message); + } + + /** + * Throw an exception for an unresolvable primitive. + * + * @param \ReflectionParameter $parameter + * @return void + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function unresolvablePrimitive(ReflectionParameter $parameter) + { + $message = "Unresolvable dependency resolving [$parameter] in class {$parameter->getDeclaringClass()->getName()}"; + + throw new BindingResolutionException($message); + } + + /** + * Register a new resolving callback. + * + * @param \Closure|string $abstract + * @param \Closure|null $callback + * @return void + */ + public function resolving($abstract, Closure $callback = null) + { + if (is_string($abstract)) { + $abstract = $this->getAlias($abstract); + } + + if (is_null($callback) && $abstract instanceof Closure) { + $this->globalResolvingCallbacks[] = $abstract; + } else { + $this->resolvingCallbacks[$abstract][] = $callback; + } + } + + /** + * Register a new after resolving callback for all types. + * + * @param \Closure|string $abstract + * @param \Closure|null $callback + * @return void + */ + public function afterResolving($abstract, Closure $callback = null) + { + if (is_string($abstract)) { + $abstract = $this->getAlias($abstract); + } + + if ($abstract instanceof Closure && is_null($callback)) { + $this->globalAfterResolvingCallbacks[] = $abstract; + } else { + $this->afterResolvingCallbacks[$abstract][] = $callback; + } + } + + /** + * Fire all of the resolving callbacks. + * + * @param string $abstract + * @param mixed $object + * @return void + */ + protected function fireResolvingCallbacks($abstract, $object) + { + $this->fireCallbackArray($object, $this->globalResolvingCallbacks); + + $this->fireCallbackArray( + $object, $this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks) + ); + + $this->fireAfterResolvingCallbacks($abstract, $object); + } + + /** + * Fire all of the after resolving callbacks. + * + * @param string $abstract + * @param mixed $object + * @return void + */ + protected function fireAfterResolvingCallbacks($abstract, $object) + { + $this->fireCallbackArray($object, $this->globalAfterResolvingCallbacks); + + $this->fireCallbackArray( + $object, $this->getCallbacksForType($abstract, $object, $this->afterResolvingCallbacks) + ); + } + + /** + * Get all callbacks for a given type. + * + * @param string $abstract + * @param object $object + * @param array $callbacksPerType + * @return array + */ + protected function getCallbacksForType($abstract, $object, array $callbacksPerType) + { + $results = []; + + foreach ($callbacksPerType as $type => $callbacks) { + if ($type === $abstract || $object instanceof $type) { + $results = array_merge($results, $callbacks); + } + } + + return $results; + } + + /** + * Fire an array of callbacks with an object. + * + * @param mixed $object + * @param array $callbacks + * @return void + */ + protected function fireCallbackArray($object, array $callbacks) + { + foreach ($callbacks as $callback) { + $callback($object, $this); + } + } + + /** + * Get the container's bindings. + * + * @return array + */ + public function getBindings() + { + return $this->bindings; + } + + /** + * Get the alias for an abstract if available. + * + * @param string $abstract + * @return string + */ + public function getAlias($abstract) + { + if (! isset($this->aliases[$abstract])) { + return $abstract; + } + + return $this->getAlias($this->aliases[$abstract]); + } + + /** + * Get the extender callbacks for a given type. + * + * @param string $abstract + * @return array + */ + protected function getExtenders($abstract) + { + $abstract = $this->getAlias($abstract); + + return $this->extenders[$abstract] ?? []; + } + + /** + * Remove all of the extender callbacks for a given type. + * + * @param string $abstract + * @return void + */ + public function forgetExtenders($abstract) + { + unset($this->extenders[$this->getAlias($abstract)]); + } + + /** + * Drop all of the stale instances and aliases. + * + * @param string $abstract + * @return void + */ + protected function dropStaleInstances($abstract) + { + unset($this->instances[$abstract], $this->aliases[$abstract]); + } + + /** + * Remove a resolved instance from the instance cache. + * + * @param string $abstract + * @return void + */ + public function forgetInstance($abstract) + { + unset($this->instances[$abstract]); + } + + /** + * Clear all of the instances from the container. + * + * @return void + */ + public function forgetInstances() + { + $this->instances = []; + } + + /** + * Flush the container of all bindings and resolved instances. + * + * @return void + */ + public function flush() + { + $this->aliases = []; + $this->resolved = []; + $this->bindings = []; + $this->instances = []; + $this->abstractAliases = []; + } + + /** + * Get the globally available instance of the container. + * + * @return static + */ + public static function getInstance() + { + if (is_null(static::$instance)) { + static::$instance = new static; + } + + return static::$instance; + } + + /** + * Set the shared instance of the container. + * + * @param \Illuminate\Contracts\Container\Container|null $container + * @return \Illuminate\Contracts\Container\Container|static + */ + public static function setInstance(ContainerContract $container = null) + { + return static::$instance = $container; + } + + /** + * Determine if a given offset exists. + * + * @param string $key + * @return bool + */ + public function offsetExists($key) + { + return $this->bound($key); + } + + /** + * Get the value at a given offset. + * + * @param string $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->make($key); + } + + /** + * Set the value at a given offset. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->bind($key, $value instanceof Closure ? $value : function () use ($value) { + return $value; + }); + } + + /** + * Unset the value at a given offset. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + unset($this->bindings[$key], $this->instances[$key], $this->resolved[$key]); + } + + /** + * Dynamically access container services. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this[$key]; + } + + /** + * Dynamically set container services. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this[$key] = $value; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php b/vendor/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php new file mode 100644 index 00000000..a52db5d5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php @@ -0,0 +1,69 @@ +concrete = $concrete; + $this->container = $container; + } + + /** + * Define the abstract target that depends on the context. + * + * @param string $abstract + * @return $this + */ + public function needs($abstract) + { + $this->needs = $abstract; + + return $this; + } + + /** + * Define the implementation for the contextual binding. + * + * @param \Closure|string $implementation + * @return void + */ + public function give($implementation) + { + foreach (Util::arrayWrap($this->concrete) as $concrete) { + $this->container->addContextualBinding($concrete, $this->needs, $implementation); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Container/EntryNotFoundException.php b/vendor/laravel/framework/src/Illuminate/Container/EntryNotFoundException.php new file mode 100644 index 00000000..42669214 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Container/EntryNotFoundException.php @@ -0,0 +1,11 @@ +count = $count; + $this->generator = $generator; + } + + /** + * Get an iterator from the generator. + * + * @return mixed + */ + public function getIterator() + { + return ($this->generator)(); + } + + /** + * Get the total number of tagged services. + * + * @return int + */ + public function count() + { + if (is_callable($count = $this->count)) { + $this->count = $count(); + } + + return $this->count; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Container/Util.php b/vendor/laravel/framework/src/Illuminate/Container/Util.php new file mode 100644 index 00000000..0b4bb128 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Container/Util.php @@ -0,0 +1,70 @@ +getType(); + + if (! $type instanceof ReflectionNamedType || $type->isBuiltin()) { + return; + } + + $name = $type->getName(); + + if (! is_null($class = $parameter->getDeclaringClass())) { + if ($name === 'self') { + return $class->getName(); + } + + if ($name === 'parent' && $parent = $class->getParentClass()) { + return $parent->getName(); + } + } + + return $name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Container/composer.json b/vendor/laravel/framework/src/Illuminate/Container/composer.json new file mode 100755 index 00000000..bb1a7e39 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Container/composer.json @@ -0,0 +1,35 @@ +{ + "name": "illuminate/container", + "description": "The Illuminate Container package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/contracts": "^6.0", + "psr/container": "^1.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Container\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Contracts/Auth/Access/Authorizable.php b/vendor/laravel/framework/src/Illuminate/Contracts/Auth/Access/Authorizable.php new file mode 100644 index 00000000..2f9657c5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Contracts/Auth/Access/Authorizable.php @@ -0,0 +1,15 @@ +id = $id; + $this->class = $class; + $this->relations = $relations; + $this->connection = $connection; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php b/vendor/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php new file mode 100644 index 00000000..334a7869 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php @@ -0,0 +1,46 @@ +getPathAndDomain($path, $domain, $secure, $sameSite); + + $time = ($minutes == 0) ? 0 : $this->availableAt($minutes * 60); + + return new Cookie($name, $value, $time, $path, $domain, $secure, $httpOnly, $raw, $sameSite); + } + + /** + * Create a cookie that lasts "forever" (five years). + * + * @param string $name + * @param string $value + * @param string|null $path + * @param string|null $domain + * @param bool|null $secure + * @param bool $httpOnly + * @param bool $raw + * @param string|null $sameSite + * @return \Symfony\Component\HttpFoundation\Cookie + */ + public function forever($name, $value, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null) + { + return $this->make($name, $value, 2628000, $path, $domain, $secure, $httpOnly, $raw, $sameSite); + } + + /** + * Expire the given cookie. + * + * @param string $name + * @param string|null $path + * @param string|null $domain + * @return \Symfony\Component\HttpFoundation\Cookie + */ + public function forget($name, $path = null, $domain = null) + { + return $this->make($name, null, -2628000, $path, $domain); + } + + /** + * Determine if a cookie has been queued. + * + * @param string $key + * @param string|null $path + * @return bool + */ + public function hasQueued($key, $path = null) + { + return ! is_null($this->queued($key, null, $path)); + } + + /** + * Get a queued cookie instance. + * + * @param string $key + * @param mixed $default + * @param string|null $path + * @return \Symfony\Component\HttpFoundation\Cookie + */ + public function queued($key, $default = null, $path = null) + { + $queued = Arr::get($this->queued, $key, $default); + + if ($path === null) { + return Arr::last($queued, null, $default); + } + + return Arr::get($queued, $path, $default); + } + + /** + * Queue a cookie to send with the next response. + * + * @param array $parameters + * @return void + */ + public function queue(...$parameters) + { + if (head($parameters) instanceof Cookie) { + $cookie = head($parameters); + } else { + $cookie = $this->make(...array_values($parameters)); + } + + if (! isset($this->queued[$cookie->getName()])) { + $this->queued[$cookie->getName()] = []; + } + + $this->queued[$cookie->getName()][$cookie->getPath()] = $cookie; + } + + /** + * Remove a cookie from the queue. + * + * @param string $name + * @param string|null $path + * @return void + */ + public function unqueue($name, $path = null) + { + if ($path === null) { + unset($this->queued[$name]); + + return; + } + + unset($this->queued[$name][$path]); + + if (empty($this->queued[$name])) { + unset($this->queued[$name]); + } + } + + /** + * Get the path and domain, or the default values. + * + * @param string $path + * @param string $domain + * @param bool|null $secure + * @param string|null $sameSite + * @return array + */ + protected function getPathAndDomain($path, $domain, $secure = null, $sameSite = null) + { + return [$path ?: $this->path, $domain ?: $this->domain, is_bool($secure) ? $secure : $this->secure, $sameSite ?: $this->sameSite]; + } + + /** + * Set the default path and domain for the jar. + * + * @param string $path + * @param string $domain + * @param bool $secure + * @param string|null $sameSite + * @return $this + */ + public function setDefaultPathAndDomain($path, $domain, $secure = false, $sameSite = null) + { + [$this->path, $this->domain, $this->secure, $this->sameSite] = [$path, $domain, $secure, $sameSite]; + + return $this; + } + + /** + * Get the cookies which have been queued for the next request. + * + * @return \Symfony\Component\HttpFoundation\Cookie[] + */ + public function getQueuedCookies() + { + return Arr::flatten($this->queued); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php new file mode 100755 index 00000000..7c82dc14 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php @@ -0,0 +1,24 @@ +app->singleton('cookie', function ($app) { + $config = $app->make('config')->get('session'); + + return (new CookieJar)->setDefaultPathAndDomain( + $config['path'], $config['domain'], $config['secure'], $config['same_site'] ?? null + ); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cookie/CookieValuePrefix.php b/vendor/laravel/framework/src/Illuminate/Cookie/CookieValuePrefix.php new file mode 100644 index 00000000..e39cb69f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cookie/CookieValuePrefix.php @@ -0,0 +1,29 @@ +cookies = $cookies; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + $response = $next($request); + + foreach ($this->cookies->getQueuedCookies() as $cookie) { + $response->headers->setCookie($cookie); + } + + return $response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php b/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php new file mode 100644 index 00000000..c2865884 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php @@ -0,0 +1,194 @@ +encrypter = $encrypter; + } + + /** + * Disable encryption for the given cookie name(s). + * + * @param string|array $name + * @return void + */ + public function disableFor($name) + { + $this->except = array_merge($this->except, (array) $name); + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return \Symfony\Component\HttpFoundation\Response + */ + public function handle($request, Closure $next) + { + return $this->encrypt($next($this->decrypt($request))); + } + + /** + * Decrypt the cookies on the request. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return \Symfony\Component\HttpFoundation\Request + */ + protected function decrypt(Request $request) + { + foreach ($request->cookies as $key => $cookie) { + if ($this->isDisabled($key)) { + continue; + } + + try { + $value = $this->decryptCookie($key, $cookie); + + $hasValidPrefix = strpos($value, CookieValuePrefix::create($key, $this->encrypter->getKey())) === 0; + + $request->cookies->set( + $key, $hasValidPrefix ? CookieValuePrefix::remove($value) : null + ); + } catch (DecryptException $e) { + $request->cookies->set($key, null); + } + } + + return $request; + } + + /** + * Decrypt the given cookie and return the value. + * + * @param string $name + * @param string|array $cookie + * @return string|array + */ + protected function decryptCookie($name, $cookie) + { + return is_array($cookie) + ? $this->decryptArray($cookie) + : $this->encrypter->decrypt($cookie, static::serialized($name)); + } + + /** + * Decrypt an array based cookie. + * + * @param array $cookie + * @return array + */ + protected function decryptArray(array $cookie) + { + $decrypted = []; + + foreach ($cookie as $key => $value) { + if (is_string($value)) { + $decrypted[$key] = $this->encrypter->decrypt($value, static::serialized($key)); + } + } + + return $decrypted; + } + + /** + * Encrypt the cookies on an outgoing response. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function encrypt(Response $response) + { + foreach ($response->headers->getCookies() as $cookie) { + if ($this->isDisabled($cookie->getName())) { + continue; + } + + $response->headers->setCookie($this->duplicate( + $cookie, + $this->encrypter->encrypt( + CookieValuePrefix::create($cookie->getName(), $this->encrypter->getKey()).$cookie->getValue(), + static::serialized($cookie->getName()) + ) + )); + } + + return $response; + } + + /** + * Duplicate a cookie with a new value. + * + * @param \Symfony\Component\HttpFoundation\Cookie $cookie + * @param mixed $value + * @return \Symfony\Component\HttpFoundation\Cookie + */ + protected function duplicate(Cookie $cookie, $value) + { + return new Cookie( + $cookie->getName(), $value, $cookie->getExpiresTime(), + $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), + $cookie->isHttpOnly(), $cookie->isRaw(), $cookie->getSameSite() + ); + } + + /** + * Determine whether encryption has been disabled for the given cookie. + * + * @param string $name + * @return bool + */ + public function isDisabled($name) + { + return in_array($name, $this->except); + } + + /** + * Determine if the cookie contents should be serialized. + * + * @param string $name + * @return bool + */ + public static function serialized($name) + { + return static::$serialize; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cookie/composer.json b/vendor/laravel/framework/src/Illuminate/Cookie/composer.json new file mode 100755 index 00000000..920d7fff --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cookie/composer.json @@ -0,0 +1,37 @@ +{ + "name": "illuminate/cookie", + "description": "The Illuminate Cookie package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0", + "symfony/http-foundation": "^4.3.4", + "symfony/http-kernel": "^4.3.4" + }, + "autoload": { + "psr-4": { + "Illuminate\\Cookie\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php b/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php new file mode 100755 index 00000000..b877e7c6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php @@ -0,0 +1,202 @@ +setupContainer($container ?: new Container); + + // Once we have the container setup, we will setup the default configuration + // options in the container "config" binding. This will make the database + // manager work correctly out of the box without extreme configuration. + $this->setupDefaultConfiguration(); + + $this->setupManager(); + } + + /** + * Setup the default database configuration options. + * + * @return void + */ + protected function setupDefaultConfiguration() + { + $this->container['config']['database.fetch'] = PDO::FETCH_OBJ; + + $this->container['config']['database.default'] = 'default'; + } + + /** + * Build the database manager instance. + * + * @return void + */ + protected function setupManager() + { + $factory = new ConnectionFactory($this->container); + + $this->manager = new DatabaseManager($this->container, $factory); + } + + /** + * Get a connection instance from the global manager. + * + * @param string|null $connection + * @return \Illuminate\Database\Connection + */ + public static function connection($connection = null) + { + return static::$instance->getConnection($connection); + } + + /** + * Get a fluent query builder instance. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $table + * @param string|null $as + * @param string|null $connection + * @return \Illuminate\Database\Query\Builder + */ + public static function table($table, $as = null, $connection = null) + { + return static::$instance->connection($connection)->table($table, $as); + } + + /** + * Get a schema builder instance. + * + * @param string|null $connection + * @return \Illuminate\Database\Schema\Builder + */ + public static function schema($connection = null) + { + return static::$instance->connection($connection)->getSchemaBuilder(); + } + + /** + * Get a registered connection instance. + * + * @param string|null $name + * @return \Illuminate\Database\Connection + */ + public function getConnection($name = null) + { + return $this->manager->connection($name); + } + + /** + * Register a connection with the manager. + * + * @param array $config + * @param string $name + * @return void + */ + public function addConnection(array $config, $name = 'default') + { + $connections = $this->container['config']['database.connections']; + + $connections[$name] = $config; + + $this->container['config']['database.connections'] = $connections; + } + + /** + * Bootstrap Eloquent so it is ready for usage. + * + * @return void + */ + public function bootEloquent() + { + Eloquent::setConnectionResolver($this->manager); + + // If we have an event dispatcher instance, we will go ahead and register it + // with the Eloquent ORM, allowing for model callbacks while creating and + // updating "model" instances; however, it is not necessary to operate. + if ($dispatcher = $this->getEventDispatcher()) { + Eloquent::setEventDispatcher($dispatcher); + } + } + + /** + * Set the fetch mode for the database connections. + * + * @param int $fetchMode + * @return $this + */ + public function setFetchMode($fetchMode) + { + $this->container['config']['database.fetch'] = $fetchMode; + + return $this; + } + + /** + * Get the database manager instance. + * + * @return \Illuminate\Database\DatabaseManager + */ + public function getDatabaseManager() + { + return $this->manager; + } + + /** + * Get the current event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher|null + */ + public function getEventDispatcher() + { + if ($this->container->bound('events')) { + return $this->container['events']; + } + } + + /** + * Set the event dispatcher instance to be used by connections. + * + * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher + * @return void + */ + public function setEventDispatcher(Dispatcher $dispatcher) + { + $this->container->instance('events', $dispatcher); + } + + /** + * Dynamically pass methods to the default connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + return static::connection()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php b/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php new file mode 100644 index 00000000..3c7b4365 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php @@ -0,0 +1,227 @@ +enforceOrderBy(); + + $page = 1; + + do { + // We'll execute the query for the given page and get the results. If there are + // no results we can just break and return from here. When there are results + // we will call the callback with the current chunk of these results here. + $results = $this->forPage($page, $count)->get(); + + $countResults = $results->count(); + + if ($countResults == 0) { + break; + } + + // On each chunk result set, we will pass them to the callback and then let the + // developer take care of everything within the callback, which allows us to + // keep the memory low for spinning through large result sets for working. + if ($callback($results, $page) === false) { + return false; + } + + unset($results); + + $page++; + } while ($countResults == $count); + + return true; + } + + /** + * Execute a callback over each item while chunking. + * + * @param callable $callback + * @param int $count + * @return bool + */ + public function each(callable $callback, $count = 1000) + { + return $this->chunk($count, function ($results) use ($callback) { + foreach ($results as $key => $value) { + if ($callback($value, $key) === false) { + return false; + } + } + }); + } + + /** + * Chunk the results of a query by comparing IDs. + * + * @param int $count + * @param callable $callback + * @param string|null $column + * @param string|null $alias + * @return bool + */ + public function chunkById($count, callable $callback, $column = null, $alias = null) + { + $column = $column ?? $this->defaultKeyName(); + + $alias = $alias ?? $column; + + $lastId = null; + + do { + $clone = clone $this; + + // We'll execute the query for the given page and get the results. If there are + // no results we can just break and return from here. When there are results + // we will call the callback with the current chunk of these results here. + $results = $clone->forPageAfterId($count, $lastId, $column)->get(); + + $countResults = $results->count(); + + if ($countResults == 0) { + break; + } + + // On each chunk result set, we will pass them to the callback and then let the + // developer take care of everything within the callback, which allows us to + // keep the memory low for spinning through large result sets for working. + if ($callback($results) === false) { + return false; + } + + $lastId = $results->last()->{$alias}; + + unset($results); + } while ($countResults == $count); + + return true; + } + + /** + * Execute a callback over each item while chunking by id. + * + * @param callable $callback + * @param int $count + * @param string|null $column + * @param string|null $alias + * @return bool + */ + public function eachById(callable $callback, $count = 1000, $column = null, $alias = null) + { + return $this->chunkById($count, function ($results) use ($callback) { + foreach ($results as $key => $value) { + if ($callback($value, $key) === false) { + return false; + } + } + }, $column, $alias); + } + + /** + * Execute the query and get the first result. + * + * @param array|string $columns + * @return \Illuminate\Database\Eloquent\Model|object|static|null + */ + public function first($columns = ['*']) + { + return $this->take(1)->get($columns)->first(); + } + + /** + * Apply the callback's query changes if the given "value" is true. + * + * @param mixed $value + * @param callable $callback + * @param callable|null $default + * @return mixed|$this + */ + public function when($value, $callback, $default = null) + { + if ($value) { + return $callback($this, $value) ?: $this; + } elseif ($default) { + return $default($this, $value) ?: $this; + } + + return $this; + } + + /** + * Pass the query to a given callback. + * + * @param callable $callback + * @return $this + */ + public function tap($callback) + { + return $this->when(true, $callback); + } + + /** + * Apply the callback's query changes if the given "value" is false. + * + * @param mixed $value + * @param callable $callback + * @param callable|null $default + * @return mixed|$this + */ + public function unless($value, $callback, $default = null) + { + if (! $value) { + return $callback($this, $value) ?: $this; + } elseif ($default) { + return $default($this, $value) ?: $this; + } + + return $this; + } + + /** + * Create a new length-aware paginator instance. + * + * @param \Illuminate\Support\Collection $items + * @param int $total + * @param int $perPage + * @param int $currentPage + * @param array $options + * @return \Illuminate\Pagination\LengthAwarePaginator + */ + protected function paginator($items, $total, $perPage, $currentPage, $options) + { + return Container::getInstance()->makeWith(LengthAwarePaginator::class, compact( + 'items', 'total', 'perPage', 'currentPage', 'options' + )); + } + + /** + * Create a new simple paginator instance. + * + * @param \Illuminate\Support\Collection $items + * @param int $perPage + * @param int $currentPage + * @param array $options + * @return \Illuminate\Pagination\Paginator + */ + protected function simplePaginator($items, $perPage, $currentPage, $options) + { + return Container::getInstance()->makeWith(Paginator::class, compact( + 'items', 'perPage', 'currentPage', 'options' + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php b/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php new file mode 100644 index 00000000..5eab7a46 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php @@ -0,0 +1,291 @@ +beginTransaction(); + + // We'll simply execute the given callback within a try / catch block and if we + // catch any exception we can rollback this transaction so that none of this + // gets actually persisted to a database or stored in a permanent fashion. + try { + $callbackResult = $callback($this); + } + + // If we catch an exception we'll rollback this transaction and try again if we + // are not out of attempts. If we are out of attempts we will just throw the + // exception back out and let the developer handle an uncaught exceptions. + catch (Exception $e) { + $this->handleTransactionException( + $e, $currentAttempt, $attempts + ); + + continue; + } catch (Throwable $e) { + $this->rollBack(); + + throw $e; + } + + try { + if ($this->transactions == 1) { + $this->getPdo()->commit(); + } + + $this->transactions = max(0, $this->transactions - 1); + } catch (Exception $e) { + $commitFailed = true; + + $this->handleCommitTransactionException( + $e, $currentAttempt, $attempts + ); + + continue; + } + + if (! isset($commitFailed)) { + $this->fireConnectionEvent('committed'); + } + + return $callbackResult; + } + } + + /** + * Handle an exception encountered when running a transacted statement. + * + * @param \Exception $e + * @param int $currentAttempt + * @param int $maxAttempts + * @return void + * + * @throws \Exception + */ + protected function handleTransactionException($e, $currentAttempt, $maxAttempts) + { + // On a deadlock, MySQL rolls back the entire transaction so we can't just + // retry the query. We have to throw this exception all the way out and + // let the developer handle it in another way. We will decrement too. + if ($this->causedByConcurrencyError($e) && + $this->transactions > 1) { + $this->transactions--; + + throw $e; + } + + // If there was an exception we will rollback this transaction and then we + // can check if we have exceeded the maximum attempt count for this and + // if we haven't we will return and try this query again in our loop. + $this->rollBack(); + + if ($this->causedByConcurrencyError($e) && + $currentAttempt < $maxAttempts) { + return; + } + + throw $e; + } + + /** + * Start a new database transaction. + * + * @return void + * + * @throws \Exception + */ + public function beginTransaction() + { + $this->createTransaction(); + + $this->transactions++; + + $this->fireConnectionEvent('beganTransaction'); + } + + /** + * Create a transaction within the database. + * + * @return void + */ + protected function createTransaction() + { + if ($this->transactions == 0) { + $this->reconnectIfMissingConnection(); + + try { + $this->getPdo()->beginTransaction(); + } catch (Exception $e) { + $this->handleBeginTransactionException($e); + } + } elseif ($this->transactions >= 1 && $this->queryGrammar->supportsSavepoints()) { + $this->createSavepoint(); + } + } + + /** + * Create a save point within the database. + * + * @return void + */ + protected function createSavepoint() + { + $this->getPdo()->exec( + $this->queryGrammar->compileSavepoint('trans'.($this->transactions + 1)) + ); + } + + /** + * Handle an exception from a transaction beginning. + * + * @param \Throwable $e + * @return void + * + * @throws \Exception + */ + protected function handleBeginTransactionException($e) + { + if ($this->causedByLostConnection($e)) { + $this->reconnect(); + + $this->getPdo()->beginTransaction(); + } else { + throw $e; + } + } + + /** + * Commit the active database transaction. + * + * @return void + */ + public function commit() + { + if ($this->transactions == 1) { + $this->getPdo()->commit(); + } + + $this->transactions = max(0, $this->transactions - 1); + + $this->fireConnectionEvent('committed'); + } + + /** + * Handle an exception encountered when committing a transaction. + * + * @param \Exception $e + * @param int $currentAttempt + * @param int $maxAttempts + * @return void + */ + protected function handleCommitTransactionException($e, $currentAttempt, $maxAttempts) + { + $this->transactions = max(0, $this->transactions - 1); + + if ($this->causedByConcurrencyError($e) && + $currentAttempt < $maxAttempts) { + return; + } + + if ($this->causedByLostConnection($e)) { + $this->transactions = 0; + } + + throw $e; + } + + /** + * Rollback the active database transaction. + * + * @param int|null $toLevel + * @return void + * + * @throws \Exception + */ + public function rollBack($toLevel = null) + { + // We allow developers to rollback to a certain transaction level. We will verify + // that this given transaction level is valid before attempting to rollback to + // that level. If it's not we will just return out and not attempt anything. + $toLevel = is_null($toLevel) + ? $this->transactions - 1 + : $toLevel; + + if ($toLevel < 0 || $toLevel >= $this->transactions) { + return; + } + + // Next, we will actually perform this rollback within this database and fire the + // rollback event. We will also set the current transaction level to the given + // level that was passed into this method so it will be right from here out. + try { + $this->performRollBack($toLevel); + } catch (Exception $e) { + $this->handleRollBackException($e); + } + + $this->transactions = $toLevel; + + $this->fireConnectionEvent('rollingBack'); + } + + /** + * Perform a rollback within the database. + * + * @param int $toLevel + * @return void + */ + protected function performRollBack($toLevel) + { + if ($toLevel == 0) { + $this->getPdo()->rollBack(); + } elseif ($this->queryGrammar->supportsSavepoints()) { + $this->getPdo()->exec( + $this->queryGrammar->compileSavepointRollBack('trans'.($toLevel + 1)) + ); + } + } + + /** + * Handle an exception from a rollback. + * + * @param \Exception $e + * @return void + * + * @throws \Exception + */ + protected function handleRollBackException($e) + { + if ($this->causedByLostConnection($e)) { + $this->transactions = 0; + } + + throw $e; + } + + /** + * Get the number of active transactions. + * + * @return int + */ + public function transactionLevel() + { + return $this->transactions; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/ConfigurationUrlParser.php b/vendor/laravel/framework/src/Illuminate/Database/ConfigurationUrlParser.php new file mode 100644 index 00000000..bc7c624a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/ConfigurationUrlParser.php @@ -0,0 +1,10 @@ +pdo = $pdo; + + // First we will setup the default properties. We keep track of the DB + // name we are connected to since it is needed when some reflective + // type commands are run such as checking whether a table exists. + $this->database = $database; + + $this->tablePrefix = $tablePrefix; + + $this->config = $config; + + // We need to initialize a query grammar and the query post processors + // which are both very important parts of the database abstractions + // so we initialize these to their default values while starting. + $this->useDefaultQueryGrammar(); + + $this->useDefaultPostProcessor(); + } + + /** + * Set the query grammar to the default implementation. + * + * @return void + */ + public function useDefaultQueryGrammar() + { + $this->queryGrammar = $this->getDefaultQueryGrammar(); + } + + /** + * Get the default query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\Grammar + */ + protected function getDefaultQueryGrammar() + { + return new QueryGrammar; + } + + /** + * Set the schema grammar to the default implementation. + * + * @return void + */ + public function useDefaultSchemaGrammar() + { + $this->schemaGrammar = $this->getDefaultSchemaGrammar(); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\Grammar + */ + protected function getDefaultSchemaGrammar() + { + // + } + + /** + * Set the query post processor to the default implementation. + * + * @return void + */ + public function useDefaultPostProcessor() + { + $this->postProcessor = $this->getDefaultPostProcessor(); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\Processor + */ + protected function getDefaultPostProcessor() + { + return new Processor; + } + + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\Builder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new SchemaBuilder($this); + } + + /** + * Begin a fluent query against a database table. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $table + * @param string|null $as + * @return \Illuminate\Database\Query\Builder + */ + public function table($table, $as = null) + { + return $this->query()->from($table, $as); + } + + /** + * Get a new query builder instance. + * + * @return \Illuminate\Database\Query\Builder + */ + public function query() + { + return new QueryBuilder( + $this, $this->getQueryGrammar(), $this->getPostProcessor() + ); + } + + /** + * Run a select statement and return a single result. + * + * @param string $query + * @param array $bindings + * @param bool $useReadPdo + * @return mixed + */ + public function selectOne($query, $bindings = [], $useReadPdo = true) + { + $records = $this->select($query, $bindings, $useReadPdo); + + return array_shift($records); + } + + /** + * Run a select statement against the database. + * + * @param string $query + * @param array $bindings + * @return array + */ + public function selectFromWriteConnection($query, $bindings = []) + { + return $this->select($query, $bindings, false); + } + + /** + * Run a select statement against the database. + * + * @param string $query + * @param array $bindings + * @param bool $useReadPdo + * @return array + */ + public function select($query, $bindings = [], $useReadPdo = true) + { + return $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) { + if ($this->pretending()) { + return []; + } + + // For select statements, we'll simply execute the query and return an array + // of the database result set. Each element in the array will be a single + // row from the database table, and will either be an array or objects. + $statement = $this->prepared($this->getPdoForSelect($useReadPdo) + ->prepare($query)); + + $this->bindValues($statement, $this->prepareBindings($bindings)); + + $statement->execute(); + + return $statement->fetchAll(); + }); + } + + /** + * Run a select statement against the database and returns a generator. + * + * @param string $query + * @param array $bindings + * @param bool $useReadPdo + * @return \Generator + */ + public function cursor($query, $bindings = [], $useReadPdo = true) + { + $statement = $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) { + if ($this->pretending()) { + return []; + } + + // First we will create a statement for the query. Then, we will set the fetch + // mode and prepare the bindings for the query. Once that's done we will be + // ready to execute the query against the database and return the cursor. + $statement = $this->prepared($this->getPdoForSelect($useReadPdo) + ->prepare($query)); + + $this->bindValues( + $statement, $this->prepareBindings($bindings) + ); + + // Next, we'll execute the query against the database and return the statement + // so we can return the cursor. The cursor will use a PHP generator to give + // back one row at a time without using a bunch of memory to render them. + $statement->execute(); + + return $statement; + }); + + while ($record = $statement->fetch()) { + yield $record; + } + } + + /** + * Configure the PDO prepared statement. + * + * @param \PDOStatement $statement + * @return \PDOStatement + */ + protected function prepared(PDOStatement $statement) + { + $statement->setFetchMode($this->fetchMode); + + $this->event(new StatementPrepared( + $this, $statement + )); + + return $statement; + } + + /** + * Get the PDO connection to use for a select query. + * + * @param bool $useReadPdo + * @return \PDO + */ + protected function getPdoForSelect($useReadPdo = true) + { + return $useReadPdo ? $this->getReadPdo() : $this->getPdo(); + } + + /** + * Run an insert statement against the database. + * + * @param string $query + * @param array $bindings + * @return bool + */ + public function insert($query, $bindings = []) + { + return $this->statement($query, $bindings); + } + + /** + * Run an update statement against the database. + * + * @param string $query + * @param array $bindings + * @return int + */ + public function update($query, $bindings = []) + { + return $this->affectingStatement($query, $bindings); + } + + /** + * Run a delete statement against the database. + * + * @param string $query + * @param array $bindings + * @return int + */ + public function delete($query, $bindings = []) + { + return $this->affectingStatement($query, $bindings); + } + + /** + * Execute an SQL statement and return the boolean result. + * + * @param string $query + * @param array $bindings + * @return bool + */ + public function statement($query, $bindings = []) + { + return $this->run($query, $bindings, function ($query, $bindings) { + if ($this->pretending()) { + return true; + } + + $statement = $this->getPdo()->prepare($query); + + $this->bindValues($statement, $this->prepareBindings($bindings)); + + $this->recordsHaveBeenModified(); + + return $statement->execute(); + }); + } + + /** + * Run an SQL statement and get the number of rows affected. + * + * @param string $query + * @param array $bindings + * @return int + */ + public function affectingStatement($query, $bindings = []) + { + return $this->run($query, $bindings, function ($query, $bindings) { + if ($this->pretending()) { + return 0; + } + + // For update or delete statements, we want to get the number of rows affected + // by the statement and return that back to the developer. We'll first need + // to execute the statement and then we'll use PDO to fetch the affected. + $statement = $this->getPdo()->prepare($query); + + $this->bindValues($statement, $this->prepareBindings($bindings)); + + $statement->execute(); + + $this->recordsHaveBeenModified( + ($count = $statement->rowCount()) > 0 + ); + + return $count; + }); + } + + /** + * Run a raw, unprepared query against the PDO connection. + * + * @param string $query + * @return bool + */ + public function unprepared($query) + { + return $this->run($query, [], function ($query) { + if ($this->pretending()) { + return true; + } + + $this->recordsHaveBeenModified( + $change = $this->getPdo()->exec($query) !== false + ); + + return $change; + }); + } + + /** + * Execute the given callback in "dry run" mode. + * + * @param \Closure $callback + * @return array + */ + public function pretend(Closure $callback) + { + return $this->withFreshQueryLog(function () use ($callback) { + $this->pretending = true; + + // Basically to make the database connection "pretend", we will just return + // the default values for all the query methods, then we will return an + // array of queries that were "executed" within the Closure callback. + $callback($this); + + $this->pretending = false; + + return $this->queryLog; + }); + } + + /** + * Execute the given callback in "dry run" mode. + * + * @param \Closure $callback + * @return array + */ + protected function withFreshQueryLog($callback) + { + $loggingQueries = $this->loggingQueries; + + // First we will back up the value of the logging queries property and then + // we'll be ready to run callbacks. This query log will also get cleared + // so we will have a new log of all the queries that are executed now. + $this->enableQueryLog(); + + $this->queryLog = []; + + // Now we'll execute this callback and capture the result. Once it has been + // executed we will restore the value of query logging and give back the + // value of the callback so the original callers can have the results. + $result = $callback(); + + $this->loggingQueries = $loggingQueries; + + return $result; + } + + /** + * Bind values to their parameters in the given statement. + * + * @param \PDOStatement $statement + * @param array $bindings + * @return void + */ + public function bindValues($statement, $bindings) + { + foreach ($bindings as $key => $value) { + $statement->bindValue( + is_string($key) ? $key : $key + 1, $value, + is_int($value) ? PDO::PARAM_INT : PDO::PARAM_STR + ); + } + } + + /** + * Prepare the query bindings for execution. + * + * @param array $bindings + * @return array + */ + public function prepareBindings(array $bindings) + { + $grammar = $this->getQueryGrammar(); + + foreach ($bindings as $key => $value) { + // We need to transform all instances of DateTimeInterface into the actual + // date string. Each query grammar maintains its own date string format + // so we'll just ask the grammar for the format to get from the date. + if ($value instanceof DateTimeInterface) { + $bindings[$key] = $value->format($grammar->getDateFormat()); + } elseif (is_bool($value)) { + $bindings[$key] = (int) $value; + } + } + + return $bindings; + } + + /** + * Run a SQL statement and log its execution context. + * + * @param string $query + * @param array $bindings + * @param \Closure $callback + * @return mixed + * + * @throws \Illuminate\Database\QueryException + */ + protected function run($query, $bindings, Closure $callback) + { + $this->reconnectIfMissingConnection(); + + $start = microtime(true); + + // Here we will run this query. If an exception occurs we'll determine if it was + // caused by a connection that has been lost. If that is the cause, we'll try + // to re-establish connection and re-run the query with a fresh connection. + try { + $result = $this->runQueryCallback($query, $bindings, $callback); + } catch (QueryException $e) { + $result = $this->handleQueryException( + $e, $query, $bindings, $callback + ); + } + + // Once we have run the query we will calculate the time that it took to run and + // then log the query, bindings, and execution time so we will report them on + // the event that the developer needs them. We'll log time in milliseconds. + $this->logQuery( + $query, $bindings, $this->getElapsedTime($start) + ); + + return $result; + } + + /** + * Run a SQL statement. + * + * @param string $query + * @param array $bindings + * @param \Closure $callback + * @return mixed + * + * @throws \Illuminate\Database\QueryException + */ + protected function runQueryCallback($query, $bindings, Closure $callback) + { + // To execute the statement, we'll simply call the callback, which will actually + // run the SQL against the PDO connection. Then we can calculate the time it + // took to execute and log the query SQL, bindings and time in our memory. + try { + $result = $callback($query, $bindings); + } + + // If an exception occurs when attempting to run a query, we'll format the error + // message to include the bindings with SQL, which will make this exception a + // lot more helpful to the developer instead of just the database's errors. + catch (Exception $e) { + throw new QueryException( + $query, $this->prepareBindings($bindings), $e + ); + } + + return $result; + } + + /** + * Log a query in the connection's query log. + * + * @param string $query + * @param array $bindings + * @param float|null $time + * @return void + */ + public function logQuery($query, $bindings, $time = null) + { + $this->event(new QueryExecuted($query, $bindings, $time, $this)); + + if ($this->loggingQueries) { + $this->queryLog[] = compact('query', 'bindings', 'time'); + } + } + + /** + * Get the elapsed time since a given starting point. + * + * @param int $start + * @return float + */ + protected function getElapsedTime($start) + { + return round((microtime(true) - $start) * 1000, 2); + } + + /** + * Handle a query exception. + * + * @param \Illuminate\Database\QueryException $e + * @param string $query + * @param array $bindings + * @param \Closure $callback + * @return mixed + * + * @throws \Illuminate\Database\QueryException + */ + protected function handleQueryException(QueryException $e, $query, $bindings, Closure $callback) + { + if ($this->transactions >= 1) { + throw $e; + } + + return $this->tryAgainIfCausedByLostConnection( + $e, $query, $bindings, $callback + ); + } + + /** + * Handle a query exception that occurred during query execution. + * + * @param \Illuminate\Database\QueryException $e + * @param string $query + * @param array $bindings + * @param \Closure $callback + * @return mixed + * + * @throws \Illuminate\Database\QueryException + */ + protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback) + { + if ($this->causedByLostConnection($e->getPrevious())) { + $this->reconnect(); + + return $this->runQueryCallback($query, $bindings, $callback); + } + + throw $e; + } + + /** + * Reconnect to the database. + * + * @return void + * + * @throws \LogicException + */ + public function reconnect() + { + if (is_callable($this->reconnector)) { + $this->doctrineConnection = null; + + return call_user_func($this->reconnector, $this); + } + + throw new LogicException('Lost connection and no reconnector available.'); + } + + /** + * Reconnect to the database if a PDO connection is missing. + * + * @return void + */ + protected function reconnectIfMissingConnection() + { + if (is_null($this->pdo)) { + $this->reconnect(); + } + } + + /** + * Disconnect from the underlying PDO connection. + * + * @return void + */ + public function disconnect() + { + $this->setPdo(null)->setReadPdo(null); + } + + /** + * Register a database query listener with the connection. + * + * @param \Closure $callback + * @return void + */ + public function listen(Closure $callback) + { + if (isset($this->events)) { + $this->events->listen(Events\QueryExecuted::class, $callback); + } + } + + /** + * Fire an event for this connection. + * + * @param string $event + * @return array|null + */ + protected function fireConnectionEvent($event) + { + if (! isset($this->events)) { + return; + } + + switch ($event) { + case 'beganTransaction': + return $this->events->dispatch(new TransactionBeginning($this)); + case 'committed': + return $this->events->dispatch(new TransactionCommitted($this)); + case 'rollingBack': + return $this->events->dispatch(new TransactionRolledBack($this)); + } + } + + /** + * Fire the given event if possible. + * + * @param mixed $event + * @return void + */ + protected function event($event) + { + if (isset($this->events)) { + $this->events->dispatch($event); + } + } + + /** + * Get a new raw query expression. + * + * @param mixed $value + * @return \Illuminate\Database\Query\Expression + */ + public function raw($value) + { + return new Expression($value); + } + + /** + * Indicate if any records have been modified. + * + * @param bool $value + * @return void + */ + public function recordsHaveBeenModified($value = true) + { + if (! $this->recordsModified) { + $this->recordsModified = $value; + } + } + + /** + * Is Doctrine available? + * + * @return bool + */ + public function isDoctrineAvailable() + { + return class_exists('Doctrine\DBAL\Connection'); + } + + /** + * Get a Doctrine Schema Column instance. + * + * @param string $table + * @param string $column + * @return \Doctrine\DBAL\Schema\Column + */ + public function getDoctrineColumn($table, $column) + { + $schema = $this->getDoctrineSchemaManager(); + + return $schema->listTableDetails($table)->getColumn($column); + } + + /** + * Get the Doctrine DBAL schema manager for the connection. + * + * @return \Doctrine\DBAL\Schema\AbstractSchemaManager + */ + public function getDoctrineSchemaManager() + { + return $this->getDoctrineDriver()->getSchemaManager($this->getDoctrineConnection()); + } + + /** + * Get the Doctrine DBAL database connection instance. + * + * @return \Doctrine\DBAL\Connection + */ + public function getDoctrineConnection() + { + if (is_null($this->doctrineConnection)) { + $driver = $this->getDoctrineDriver(); + + $this->doctrineConnection = new DoctrineConnection(array_filter([ + 'pdo' => $this->getPdo(), + 'dbname' => $this->getDatabaseName(), + 'driver' => $driver->getName(), + 'serverVersion' => $this->getConfig('server_version'), + ]), $driver); + } + + return $this->doctrineConnection; + } + + /** + * Get the current PDO connection. + * + * @return \PDO + */ + public function getPdo() + { + if ($this->pdo instanceof Closure) { + return $this->pdo = call_user_func($this->pdo); + } + + return $this->pdo; + } + + /** + * Get the current PDO connection parameter without executing any reconnect logic. + * + * @return \PDO|\Closure|null + */ + public function getRawPdo() + { + return $this->pdo; + } + + /** + * Get the current PDO connection used for reading. + * + * @return \PDO + */ + public function getReadPdo() + { + if ($this->transactions > 0) { + return $this->getPdo(); + } + + if ($this->recordsModified && $this->getConfig('sticky')) { + return $this->getPdo(); + } + + if ($this->readPdo instanceof Closure) { + return $this->readPdo = call_user_func($this->readPdo); + } + + return $this->readPdo ?: $this->getPdo(); + } + + /** + * Get the current read PDO connection parameter without executing any reconnect logic. + * + * @return \PDO|\Closure|null + */ + public function getRawReadPdo() + { + return $this->readPdo; + } + + /** + * Set the PDO connection. + * + * @param \PDO|\Closure|null $pdo + * @return $this + */ + public function setPdo($pdo) + { + $this->transactions = 0; + + $this->pdo = $pdo; + + return $this; + } + + /** + * Set the PDO connection used for reading. + * + * @param \PDO|\Closure|null $pdo + * @return $this + */ + public function setReadPdo($pdo) + { + $this->readPdo = $pdo; + + return $this; + } + + /** + * Set the reconnect instance on the connection. + * + * @param callable $reconnector + * @return $this + */ + public function setReconnector(callable $reconnector) + { + $this->reconnector = $reconnector; + + return $this; + } + + /** + * Get the database connection name. + * + * @return string|null + */ + public function getName() + { + return $this->getConfig('name'); + } + + /** + * Get an option from the configuration options. + * + * @param string|null $option + * @return mixed + */ + public function getConfig($option = null) + { + return Arr::get($this->config, $option); + } + + /** + * Get the PDO driver name. + * + * @return string + */ + public function getDriverName() + { + return $this->getConfig('driver'); + } + + /** + * Get the query grammar used by the connection. + * + * @return \Illuminate\Database\Query\Grammars\Grammar + */ + public function getQueryGrammar() + { + return $this->queryGrammar; + } + + /** + * Set the query grammar used by the connection. + * + * @param \Illuminate\Database\Query\Grammars\Grammar $grammar + * @return $this + */ + public function setQueryGrammar(Query\Grammars\Grammar $grammar) + { + $this->queryGrammar = $grammar; + + return $this; + } + + /** + * Get the schema grammar used by the connection. + * + * @return \Illuminate\Database\Schema\Grammars\Grammar + */ + public function getSchemaGrammar() + { + return $this->schemaGrammar; + } + + /** + * Set the schema grammar used by the connection. + * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return $this + */ + public function setSchemaGrammar(Schema\Grammars\Grammar $grammar) + { + $this->schemaGrammar = $grammar; + + return $this; + } + + /** + * Get the query post processor used by the connection. + * + * @return \Illuminate\Database\Query\Processors\Processor + */ + public function getPostProcessor() + { + return $this->postProcessor; + } + + /** + * Set the query post processor used by the connection. + * + * @param \Illuminate\Database\Query\Processors\Processor $processor + * @return $this + */ + public function setPostProcessor(Processor $processor) + { + $this->postProcessor = $processor; + + return $this; + } + + /** + * Get the event dispatcher used by the connection. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getEventDispatcher() + { + return $this->events; + } + + /** + * Set the event dispatcher instance on the connection. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return $this + */ + public function setEventDispatcher(Dispatcher $events) + { + $this->events = $events; + + return $this; + } + + /** + * Unset the event dispatcher for this connection. + * + * @return void + */ + public function unsetEventDispatcher() + { + $this->events = null; + } + + /** + * Determine if the connection is in a "dry run". + * + * @return bool + */ + public function pretending() + { + return $this->pretending === true; + } + + /** + * Get the connection query log. + * + * @return array + */ + public function getQueryLog() + { + return $this->queryLog; + } + + /** + * Clear the query log. + * + * @return void + */ + public function flushQueryLog() + { + $this->queryLog = []; + } + + /** + * Enable the query log on the connection. + * + * @return void + */ + public function enableQueryLog() + { + $this->loggingQueries = true; + } + + /** + * Disable the query log on the connection. + * + * @return void + */ + public function disableQueryLog() + { + $this->loggingQueries = false; + } + + /** + * Determine whether we're logging queries. + * + * @return bool + */ + public function logging() + { + return $this->loggingQueries; + } + + /** + * Get the name of the connected database. + * + * @return string + */ + public function getDatabaseName() + { + return $this->database; + } + + /** + * Set the name of the connected database. + * + * @param string $database + * @return $this + */ + public function setDatabaseName($database) + { + $this->database = $database; + + return $this; + } + + /** + * Get the table prefix for the connection. + * + * @return string + */ + public function getTablePrefix() + { + return $this->tablePrefix; + } + + /** + * Set the table prefix in use by the connection. + * + * @param string $prefix + * @return $this + */ + public function setTablePrefix($prefix) + { + $this->tablePrefix = $prefix; + + $this->getQueryGrammar()->setTablePrefix($prefix); + + return $this; + } + + /** + * Set the table prefix and return the grammar. + * + * @param \Illuminate\Database\Grammar $grammar + * @return \Illuminate\Database\Grammar + */ + public function withTablePrefix(Grammar $grammar) + { + $grammar->setTablePrefix($this->tablePrefix); + + return $grammar; + } + + /** + * Register a connection resolver. + * + * @param string $driver + * @param \Closure $callback + * @return void + */ + public static function resolverFor($driver, Closure $callback) + { + static::$resolvers[$driver] = $callback; + } + + /** + * Get the connection resolver for the given driver. + * + * @param string $driver + * @return mixed + */ + public static function getResolver($driver) + { + return static::$resolvers[$driver] ?? null; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/ConnectionInterface.php b/vendor/laravel/framework/src/Illuminate/Database/ConnectionInterface.php new file mode 100755 index 00000000..c7e24b1a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/ConnectionInterface.php @@ -0,0 +1,163 @@ + $connection) { + $this->addConnection($name, $connection); + } + } + + /** + * Get a database connection instance. + * + * @param string|null $name + * @return \Illuminate\Database\ConnectionInterface + */ + public function connection($name = null) + { + if (is_null($name)) { + $name = $this->getDefaultConnection(); + } + + return $this->connections[$name]; + } + + /** + * Add a connection to the resolver. + * + * @param string $name + * @param \Illuminate\Database\ConnectionInterface $connection + * @return void + */ + public function addConnection($name, ConnectionInterface $connection) + { + $this->connections[$name] = $connection; + } + + /** + * Check if a connection has been registered. + * + * @param string $name + * @return bool + */ + public function hasConnection($name) + { + return isset($this->connections[$name]); + } + + /** + * Get the default connection name. + * + * @return string + */ + public function getDefaultConnection() + { + return $this->default; + } + + /** + * Set the default connection name. + * + * @param string $name + * @return void + */ + public function setDefaultConnection($name) + { + $this->default = $name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php b/vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php new file mode 100755 index 00000000..b31e5a79 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php @@ -0,0 +1,29 @@ +container = $container; + } + + /** + * Establish a PDO connection based on the configuration. + * + * @param array $config + * @param string|null $name + * @return \Illuminate\Database\Connection + */ + public function make(array $config, $name = null) + { + $config = $this->parseConfig($config, $name); + + if (isset($config['read'])) { + return $this->createReadWriteConnection($config); + } + + return $this->createSingleConnection($config); + } + + /** + * Parse and prepare the database configuration. + * + * @param array $config + * @param string $name + * @return array + */ + protected function parseConfig(array $config, $name) + { + return Arr::add(Arr::add($config, 'prefix', ''), 'name', $name); + } + + /** + * Create a single database connection instance. + * + * @param array $config + * @return \Illuminate\Database\Connection + */ + protected function createSingleConnection(array $config) + { + $pdo = $this->createPdoResolver($config); + + return $this->createConnection( + $config['driver'], $pdo, $config['database'], $config['prefix'], $config + ); + } + + /** + * Create a single database connection instance. + * + * @param array $config + * @return \Illuminate\Database\Connection + */ + protected function createReadWriteConnection(array $config) + { + $connection = $this->createSingleConnection($this->getWriteConfig($config)); + + return $connection->setReadPdo($this->createReadPdo($config)); + } + + /** + * Create a new PDO instance for reading. + * + * @param array $config + * @return \Closure + */ + protected function createReadPdo(array $config) + { + return $this->createPdoResolver($this->getReadConfig($config)); + } + + /** + * Get the read configuration for a read / write connection. + * + * @param array $config + * @return array + */ + protected function getReadConfig(array $config) + { + return $this->mergeReadWriteConfig( + $config, $this->getReadWriteConfig($config, 'read') + ); + } + + /** + * Get the read configuration for a read / write connection. + * + * @param array $config + * @return array + */ + protected function getWriteConfig(array $config) + { + return $this->mergeReadWriteConfig( + $config, $this->getReadWriteConfig($config, 'write') + ); + } + + /** + * Get a read / write level configuration. + * + * @param array $config + * @param string $type + * @return array + */ + protected function getReadWriteConfig(array $config, $type) + { + return isset($config[$type][0]) + ? Arr::random($config[$type]) + : $config[$type]; + } + + /** + * Merge a configuration for a read / write connection. + * + * @param array $config + * @param array $merge + * @return array + */ + protected function mergeReadWriteConfig(array $config, array $merge) + { + return Arr::except(array_merge($config, $merge), ['read', 'write']); + } + + /** + * Create a new Closure that resolves to a PDO instance. + * + * @param array $config + * @return \Closure + */ + protected function createPdoResolver(array $config) + { + return array_key_exists('host', $config) + ? $this->createPdoResolverWithHosts($config) + : $this->createPdoResolverWithoutHosts($config); + } + + /** + * Create a new Closure that resolves to a PDO instance with a specific host or an array of hosts. + * + * @param array $config + * @return \Closure + */ + protected function createPdoResolverWithHosts(array $config) + { + return function () use ($config) { + foreach (Arr::shuffle($hosts = $this->parseHosts($config)) as $key => $host) { + $config['host'] = $host; + + try { + return $this->createConnector($config)->connect($config); + } catch (PDOException $e) { + continue; + } + } + + throw $e; + }; + } + + /** + * Parse the hosts configuration item into an array. + * + * @param array $config + * @return array + * + * @throws \InvalidArgumentException + */ + protected function parseHosts(array $config) + { + $hosts = Arr::wrap($config['host']); + + if (empty($hosts)) { + throw new InvalidArgumentException('Database hosts array is empty.'); + } + + return $hosts; + } + + /** + * Create a new Closure that resolves to a PDO instance where there is no configured host. + * + * @param array $config + * @return \Closure + */ + protected function createPdoResolverWithoutHosts(array $config) + { + return function () use ($config) { + return $this->createConnector($config)->connect($config); + }; + } + + /** + * Create a connector instance based on the configuration. + * + * @param array $config + * @return \Illuminate\Database\Connectors\ConnectorInterface + * + * @throws \InvalidArgumentException + */ + public function createConnector(array $config) + { + if (! isset($config['driver'])) { + throw new InvalidArgumentException('A driver must be specified.'); + } + + if ($this->container->bound($key = "db.connector.{$config['driver']}")) { + return $this->container->make($key); + } + + switch ($config['driver']) { + case 'mysql': + return new MySqlConnector; + case 'pgsql': + return new PostgresConnector; + case 'sqlite': + return new SQLiteConnector; + case 'sqlsrv': + return new SqlServerConnector; + } + + throw new InvalidArgumentException("Unsupported driver [{$config['driver']}]"); + } + + /** + * Create a new connection instance. + * + * @param string $driver + * @param \PDO|\Closure $connection + * @param string $database + * @param string $prefix + * @param array $config + * @return \Illuminate\Database\Connection + * + * @throws \InvalidArgumentException + */ + protected function createConnection($driver, $connection, $database, $prefix = '', array $config = []) + { + if ($resolver = Connection::getResolver($driver)) { + return $resolver($connection, $database, $prefix, $config); + } + + switch ($driver) { + case 'mysql': + return new MySqlConnection($connection, $database, $prefix, $config); + case 'pgsql': + return new PostgresConnection($connection, $database, $prefix, $config); + case 'sqlite': + return new SQLiteConnection($connection, $database, $prefix, $config); + case 'sqlsrv': + return new SqlServerConnection($connection, $database, $prefix, $config); + } + + throw new InvalidArgumentException("Unsupported driver [{$driver}]"); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php b/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php new file mode 100755 index 00000000..0fecfb5e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php @@ -0,0 +1,139 @@ + 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, + ]; + + /** + * Create a new PDO connection. + * + * @param string $dsn + * @param array $config + * @param array $options + * @return \PDO + * + * @throws \Exception + */ + public function createConnection($dsn, array $config, array $options) + { + [$username, $password] = [ + $config['username'] ?? null, $config['password'] ?? null, + ]; + + try { + return $this->createPdoConnection( + $dsn, $username, $password, $options + ); + } catch (Exception $e) { + return $this->tryAgainIfCausedByLostConnection( + $e, $dsn, $username, $password, $options + ); + } + } + + /** + * Create a new PDO connection instance. + * + * @param string $dsn + * @param string $username + * @param string $password + * @param array $options + * @return \PDO + */ + protected function createPdoConnection($dsn, $username, $password, $options) + { + if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) { + return new PDOConnection($dsn, $username, $password, $options); + } + + return new PDO($dsn, $username, $password, $options); + } + + /** + * Determine if the connection is persistent. + * + * @param array $options + * @return bool + */ + protected function isPersistentConnection($options) + { + return isset($options[PDO::ATTR_PERSISTENT]) && + $options[PDO::ATTR_PERSISTENT]; + } + + /** + * Handle an exception that occurred during connect execution. + * + * @param \Throwable $e + * @param string $dsn + * @param string $username + * @param string $password + * @param array $options + * @return \PDO + * + * @throws \Exception + */ + protected function tryAgainIfCausedByLostConnection(Throwable $e, $dsn, $username, $password, $options) + { + if ($this->causedByLostConnection($e)) { + return $this->createPdoConnection($dsn, $username, $password, $options); + } + + throw $e; + } + + /** + * Get the PDO options based on the configuration. + * + * @param array $config + * @return array + */ + public function getOptions(array $config) + { + $options = $config['options'] ?? []; + + return array_diff_key($this->options, $options) + $options; + } + + /** + * Get the default PDO connection options. + * + * @return array + */ + public function getDefaultOptions() + { + return $this->options; + } + + /** + * Set the default PDO connection options. + * + * @param array $options + * @return void + */ + public function setDefaultOptions(array $options) + { + $this->options = $options; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectorInterface.php b/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectorInterface.php new file mode 100755 index 00000000..08597ac0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectorInterface.php @@ -0,0 +1,14 @@ +getDsn($config); + + $options = $this->getOptions($config); + + // We need to grab the PDO options that should be used while making the brand + // new connection instance. The PDO options control various aspects of the + // connection's behavior, and some might be specified by the developers. + $connection = $this->createConnection($dsn, $config, $options); + + if (! empty($config['database'])) { + $connection->exec("use `{$config['database']}`;"); + } + + $this->configureEncoding($connection, $config); + + // Next, we will check to see if a timezone has been specified in this config + // and if it has we will issue a statement to modify the timezone with the + // database. Setting this DB timezone is an optional configuration item. + $this->configureTimezone($connection, $config); + + $this->setModes($connection, $config); + + return $connection; + } + + /** + * Set the connection character set and collation. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function configureEncoding($connection, array $config) + { + if (! isset($config['charset'])) { + return $connection; + } + + $connection->prepare( + "set names '{$config['charset']}'".$this->getCollation($config) + )->execute(); + } + + /** + * Get the collation for the configuration. + * + * @param array $config + * @return string + */ + protected function getCollation(array $config) + { + return isset($config['collation']) ? " collate '{$config['collation']}'" : ''; + } + + /** + * Set the timezone on the connection. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function configureTimezone($connection, array $config) + { + if (isset($config['timezone'])) { + $connection->prepare('set time_zone="'.$config['timezone'].'"')->execute(); + } + } + + /** + * Create a DSN string from a configuration. + * + * Chooses socket or host/port based on the 'unix_socket' config value. + * + * @param array $config + * @return string + */ + protected function getDsn(array $config) + { + return $this->hasSocket($config) + ? $this->getSocketDsn($config) + : $this->getHostDsn($config); + } + + /** + * Determine if the given configuration array has a UNIX socket value. + * + * @param array $config + * @return bool + */ + protected function hasSocket(array $config) + { + return isset($config['unix_socket']) && ! empty($config['unix_socket']); + } + + /** + * Get the DSN string for a socket configuration. + * + * @param array $config + * @return string + */ + protected function getSocketDsn(array $config) + { + return "mysql:unix_socket={$config['unix_socket']};dbname={$config['database']}"; + } + + /** + * Get the DSN string for a host / port configuration. + * + * @param array $config + * @return string + */ + protected function getHostDsn(array $config) + { + extract($config, EXTR_SKIP); + + return isset($port) + ? "mysql:host={$host};port={$port};dbname={$database}" + : "mysql:host={$host};dbname={$database}"; + } + + /** + * Set the modes for the connection. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function setModes(PDO $connection, array $config) + { + if (isset($config['modes'])) { + $this->setCustomModes($connection, $config); + } elseif (isset($config['strict'])) { + if ($config['strict']) { + $connection->prepare($this->strictMode($connection))->execute(); + } else { + $connection->prepare("set session sql_mode='NO_ENGINE_SUBSTITUTION'")->execute(); + } + } + } + + /** + * Set the custom modes on the connection. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function setCustomModes(PDO $connection, array $config) + { + $modes = implode(',', $config['modes']); + + $connection->prepare("set session sql_mode='{$modes}'")->execute(); + } + + /** + * Get the query to enable strict mode. + * + * @param \PDO $connection + * @return string + */ + protected function strictMode(PDO $connection) + { + if (version_compare($connection->getAttribute(PDO::ATTR_SERVER_VERSION), '8.0.11') >= 0) { + return "set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'"; + } + + return "set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'"; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php b/vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php new file mode 100755 index 00000000..c40369d7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php @@ -0,0 +1,176 @@ + PDO::CASE_NATURAL, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, + PDO::ATTR_STRINGIFY_FETCHES => false, + ]; + + /** + * Establish a database connection. + * + * @param array $config + * @return \PDO + */ + public function connect(array $config) + { + // First we'll create the basic DSN and connection instance connecting to the + // using the configuration option specified by the developer. We will also + // set the default character set on the connections to UTF-8 by default. + $connection = $this->createConnection( + $this->getDsn($config), $config, $this->getOptions($config) + ); + + $this->configureEncoding($connection, $config); + + // Next, we will check to see if a timezone has been specified in this config + // and if it has we will issue a statement to modify the timezone with the + // database. Setting this DB timezone is an optional configuration item. + $this->configureTimezone($connection, $config); + + $this->configureSchema($connection, $config); + + // Postgres allows an application_name to be set by the user and this name is + // used to when monitoring the application with pg_stat_activity. So we'll + // determine if the option has been specified and run a statement if so. + $this->configureApplicationName($connection, $config); + + return $connection; + } + + /** + * Set the connection character set and collation. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function configureEncoding($connection, $config) + { + if (! isset($config['charset'])) { + return; + } + + $connection->prepare("set names '{$config['charset']}'")->execute(); + } + + /** + * Set the timezone on the connection. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function configureTimezone($connection, array $config) + { + if (isset($config['timezone'])) { + $timezone = $config['timezone']; + + $connection->prepare("set time zone '{$timezone}'")->execute(); + } + } + + /** + * Set the schema on the connection. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function configureSchema($connection, $config) + { + if (isset($config['schema'])) { + $schema = $this->formatSchema($config['schema']); + + $connection->prepare("set search_path to {$schema}")->execute(); + } + } + + /** + * Format the schema for the DSN. + * + * @param array|string $schema + * @return string + */ + protected function formatSchema($schema) + { + if (is_array($schema)) { + return '"'.implode('", "', $schema).'"'; + } + + return '"'.$schema.'"'; + } + + /** + * Set the schema on the connection. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function configureApplicationName($connection, $config) + { + if (isset($config['application_name'])) { + $applicationName = $config['application_name']; + + $connection->prepare("set application_name to '$applicationName'")->execute(); + } + } + + /** + * Create a DSN string from a configuration. + * + * @param array $config + * @return string + */ + protected function getDsn(array $config) + { + // First we will create the basic DSN setup as well as the port if it is in + // in the configuration options. This will give us the basic DSN we will + // need to establish the PDO connections and return them back for use. + extract($config, EXTR_SKIP); + + $host = isset($host) ? "host={$host};" : ''; + + $dsn = "pgsql:{$host}dbname={$database}"; + + // If a port was specified, we will add it to this Postgres DSN connections + // format. Once we have done that we are ready to return this connection + // string back out for usage, as this has been fully constructed here. + if (isset($config['port'])) { + $dsn .= ";port={$port}"; + } + + return $this->addSslOptions($dsn, $config); + } + + /** + * Add the SSL options to the DSN. + * + * @param string $dsn + * @param array $config + * @return string + */ + protected function addSslOptions($dsn, array $config) + { + foreach (['sslmode', 'sslcert', 'sslkey', 'sslrootcert'] as $option) { + if (isset($config[$option])) { + $dsn .= ";{$option}={$config[$option]}"; + } + } + + return $dsn; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php b/vendor/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php new file mode 100755 index 00000000..90dc16be --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php @@ -0,0 +1,39 @@ +getOptions($config); + + // SQLite supports "in-memory" databases that only last as long as the owning + // connection does. These are useful for tests or for short lifetime store + // querying. In-memory databases may only have a single open connection. + if ($config['database'] === ':memory:') { + return $this->createConnection('sqlite::memory:', $config, $options); + } + + $path = realpath($config['database']); + + // Here we'll verify that the SQLite database exists before going any further + // as the developer probably wants to know if the database exists and this + // SQLite driver will not throw any exception if it does not by default. + if ($path === false) { + throw new InvalidArgumentException("Database ({$config['database']}) does not exist."); + } + + return $this->createConnection("sqlite:{$path}", $config, $options); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php b/vendor/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php new file mode 100755 index 00000000..0424642e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php @@ -0,0 +1,201 @@ + PDO::CASE_NATURAL, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, + PDO::ATTR_STRINGIFY_FETCHES => false, + ]; + + /** + * Establish a database connection. + * + * @param array $config + * @return \PDO + */ + public function connect(array $config) + { + $options = $this->getOptions($config); + + return $this->createConnection($this->getDsn($config), $config, $options); + } + + /** + * Create a DSN string from a configuration. + * + * @param array $config + * @return string + */ + protected function getDsn(array $config) + { + // First we will create the basic DSN setup as well as the port if it is in + // in the configuration options. This will give us the basic DSN we will + // need to establish the PDO connections and return them back for use. + if ($this->prefersOdbc($config)) { + return $this->getOdbcDsn($config); + } + + if (in_array('sqlsrv', $this->getAvailableDrivers())) { + return $this->getSqlSrvDsn($config); + } else { + return $this->getDblibDsn($config); + } + } + + /** + * Determine if the database configuration prefers ODBC. + * + * @param array $config + * @return bool + */ + protected function prefersOdbc(array $config) + { + return in_array('odbc', $this->getAvailableDrivers()) && + ($config['odbc'] ?? null) === true; + } + + /** + * Get the DSN string for a DbLib connection. + * + * @param array $config + * @return string + */ + protected function getDblibDsn(array $config) + { + return $this->buildConnectString('dblib', array_merge([ + 'host' => $this->buildHostString($config, ':'), + 'dbname' => $config['database'], + ], Arr::only($config, ['appname', 'charset', 'version']))); + } + + /** + * Get the DSN string for an ODBC connection. + * + * @param array $config + * @return string + */ + protected function getOdbcDsn(array $config) + { + return isset($config['odbc_datasource_name']) + ? 'odbc:'.$config['odbc_datasource_name'] : ''; + } + + /** + * Get the DSN string for a SqlSrv connection. + * + * @param array $config + * @return string + */ + protected function getSqlSrvDsn(array $config) + { + $arguments = [ + 'Server' => $this->buildHostString($config, ','), + ]; + + if (isset($config['database'])) { + $arguments['Database'] = $config['database']; + } + + if (isset($config['readonly'])) { + $arguments['ApplicationIntent'] = 'ReadOnly'; + } + + if (isset($config['pooling']) && $config['pooling'] === false) { + $arguments['ConnectionPooling'] = '0'; + } + + if (isset($config['appname'])) { + $arguments['APP'] = $config['appname']; + } + + if (isset($config['encrypt'])) { + $arguments['Encrypt'] = $config['encrypt']; + } + + if (isset($config['trust_server_certificate'])) { + $arguments['TrustServerCertificate'] = $config['trust_server_certificate']; + } + + if (isset($config['multiple_active_result_sets']) && $config['multiple_active_result_sets'] === false) { + $arguments['MultipleActiveResultSets'] = 'false'; + } + + if (isset($config['transaction_isolation'])) { + $arguments['TransactionIsolation'] = $config['transaction_isolation']; + } + + if (isset($config['multi_subnet_failover'])) { + $arguments['MultiSubnetFailover'] = $config['multi_subnet_failover']; + } + + if (isset($config['column_encryption'])) { + $arguments['ColumnEncryption'] = $config['column_encryption']; + } + + if (isset($config['key_store_authentication'])) { + $arguments['KeyStoreAuthentication'] = $config['key_store_authentication']; + } + + if (isset($config['key_store_principal_id'])) { + $arguments['KeyStorePrincipalId'] = $config['key_store_principal_id']; + } + + if (isset($config['key_store_secret'])) { + $arguments['KeyStoreSecret'] = $config['key_store_secret']; + } + + return $this->buildConnectString('sqlsrv', $arguments); + } + + /** + * Build a connection string from the given arguments. + * + * @param string $driver + * @param array $arguments + * @return string + */ + protected function buildConnectString($driver, array $arguments) + { + return $driver.':'.implode(';', array_map(function ($key) use ($arguments) { + return sprintf('%s=%s', $key, $arguments[$key]); + }, array_keys($arguments))); + } + + /** + * Build a host string from the given configuration. + * + * @param array $config + * @param string $separator + * @return string + */ + protected function buildHostString(array $config, $separator) + { + if (empty($config['port'])) { + return $config['host']; + } + + return $config['host'].$separator.$config['port']; + } + + /** + * Get the available PDO drivers. + * + * @return array + */ + protected function getAvailableDrivers() + { + return PDO::getAvailableDrivers(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php new file mode 100644 index 00000000..725a69cc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php @@ -0,0 +1,94 @@ +option('model') + ? $this->qualifyClass($this->option('model')) + : trim($this->rootNamespace(), '\\').'\\Model'; + + $model = class_basename($namespaceModel); + + return str_replace( + [ + 'NamespacedDummyModel', + 'DummyModel', + ], + [ + $namespaceModel, + $model, + ], + parent::buildClass($name) + ); + } + + /** + * Get the destination class path. + * + * @param string $name + * @return string + */ + protected function getPath($name) + { + $name = str_replace( + ['\\', '/'], '', $this->argument('name') + ); + + return $this->laravel->databasePath()."/factories/{$name}.php"; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['model', 'm', InputOption::VALUE_OPTIONAL, 'The name of the model'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/stubs/factory.stub b/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/stubs/factory.stub new file mode 100644 index 00000000..74ac7c52 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/stubs/factory.stub @@ -0,0 +1,12 @@ +define(DummyModel::class, function (Faker $faker) { + return [ + // + ]; +}); diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/BaseCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/BaseCommand.php new file mode 100755 index 00000000..6c4f2550 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/BaseCommand.php @@ -0,0 +1,51 @@ +input->hasOption('path') && $this->option('path')) { + return collect($this->option('path'))->map(function ($path) { + return ! $this->usingRealPath() + ? $this->laravel->basePath().'/'.$path + : $path; + })->all(); + } + + return array_merge( + $this->migrator->paths(), [$this->getMigrationPath()] + ); + } + + /** + * Determine if the given path(s) are pre-resolved "real" paths. + * + * @return bool + */ + protected function usingRealPath() + { + return $this->input->hasOption('realpath') && $this->option('realpath'); + } + + /** + * Get the path to the migration directory. + * + * @return string + */ + protected function getMigrationPath() + { + return $this->laravel->databasePath().DIRECTORY_SEPARATOR.'migrations'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/FreshCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/FreshCommand.php new file mode 100644 index 00000000..4bcba28a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/FreshCommand.php @@ -0,0 +1,104 @@ +confirmToProceed()) { + return; + } + + $database = $this->input->getOption('database'); + + $this->call('db:wipe', array_filter([ + '--database' => $database, + '--drop-views' => $this->option('drop-views'), + '--drop-types' => $this->option('drop-types'), + '--force' => true, + ])); + + $this->call('migrate', array_filter([ + '--database' => $database, + '--path' => $this->input->getOption('path'), + '--realpath' => $this->input->getOption('realpath'), + '--force' => true, + '--step' => $this->option('step'), + ])); + + if ($this->needsSeeding()) { + $this->runSeeder($database); + } + } + + /** + * Determine if the developer has requested database seeding. + * + * @return bool + */ + protected function needsSeeding() + { + return $this->option('seed') || $this->option('seeder'); + } + + /** + * Run the database seeder command. + * + * @param string $database + * @return void + */ + protected function runSeeder($database) + { + $this->call('db:seed', array_filter([ + '--database' => $database, + '--class' => $this->option('seeder') ?: 'DatabaseSeeder', + '--force' => true, + ])); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + ['drop-views', null, InputOption::VALUE_NONE, 'Drop all tables and views'], + ['drop-types', null, InputOption::VALUE_NONE, 'Drop all tables and types (Postgres only)'], + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], + ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], + ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run'], + ['seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder'], + ['step', null, InputOption::VALUE_NONE, 'Force the migrations to be run so they can be rolled back individually'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/InstallCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/InstallCommand.php new file mode 100755 index 00000000..d69c2ab6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/InstallCommand.php @@ -0,0 +1,70 @@ +repository = $repository; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->repository->setSource($this->input->getOption('database')); + + $this->repository->createRepository(); + + $this->info('Migration table created successfully.'); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php new file mode 100755 index 00000000..9fa978d0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php @@ -0,0 +1,97 @@ +migrator = $migrator; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + if (! $this->confirmToProceed()) { + return; + } + + $this->prepareDatabase(); + + // Next, we will check to see if a path option has been defined. If it has + // we will use the path relative to the root of this installation folder + // so that migrations may be run for any path within the applications. + $this->migrator->setOutput($this->output) + ->run($this->getMigrationPaths(), [ + 'pretend' => $this->option('pretend'), + 'step' => $this->option('step'), + ]); + + // Finally, if the "seed" option has been given, we will re-run the database + // seed task to re-populate the database, which is convenient when adding + // a migration and a seed at the same time, as it is only this command. + if ($this->option('seed') && ! $this->option('pretend')) { + $this->call('db:seed', ['--force' => true]); + } + } + + /** + * Prepare the migration database for running. + * + * @return void + */ + protected function prepareDatabase() + { + $this->migrator->setConnection($this->option('database')); + + if (! $this->migrator->repositoryExists()) { + $this->call('migrate:install', array_filter([ + '--database' => $this->option('database'), + ])); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php new file mode 100644 index 00000000..2c2a7115 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php @@ -0,0 +1,145 @@ +creator = $creator; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + // It's possible for the developer to specify the tables to modify in this + // schema operation. The developer may also specify if this table needs + // to be freshly created so we can create the appropriate migrations. + $name = Str::snake(trim($this->input->getArgument('name'))); + + $table = $this->input->getOption('table'); + + $create = $this->input->getOption('create') ?: false; + + // If no table was given as an option but a create option is given then we + // will use the "create" option as the table name. This allows the devs + // to pass a table name into this option as a short-cut for creating. + if (! $table && is_string($create)) { + $table = $create; + + $create = true; + } + + // Next, we will attempt to guess the table name if this the migration has + // "create" in the name. This will allow us to provide a convenient way + // of creating migrations that create new tables for the application. + if (! $table) { + [$table, $create] = TableGuesser::guess($name); + } + + // Now we are ready to write the migration out to disk. Once we've written + // the migration out, we will dump-autoload for the entire framework to + // make sure that the migrations are registered by the class loaders. + $this->writeMigration($name, $table, $create); + + $this->composer->dumpAutoloads(); + } + + /** + * Write the migration file to disk. + * + * @param string $name + * @param string $table + * @param bool $create + * @return string + */ + protected function writeMigration($name, $table, $create) + { + $file = $this->creator->create( + $name, $this->getMigrationPath(), $table, $create + ); + + if (! $this->option('fullpath')) { + $file = pathinfo($file, PATHINFO_FILENAME); + } + + $this->line("Created Migration: {$file}"); + } + + /** + * Get migration path (either specified by '--path' option or default location). + * + * @return string + */ + protected function getMigrationPath() + { + if (! is_null($targetPath = $this->input->getOption('path'))) { + return ! $this->usingRealPath() + ? $this->laravel->basePath().'/'.$targetPath + : $targetPath; + } + + return parent::getMigrationPath(); + } + + /** + * Determine if the given path(s) are pre-resolved "real" paths. + * + * @return bool + */ + protected function usingRealPath() + { + return $this->input->hasOption('realpath') && $this->option('realpath'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php new file mode 100755 index 00000000..1d8cb136 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php @@ -0,0 +1,149 @@ +confirmToProceed()) { + return; + } + + // Next we'll gather some of the options so that we can have the right options + // to pass to the commands. This includes options such as which database to + // use and the path to use for the migration. Then we'll run the command. + $database = $this->input->getOption('database'); + + $path = $this->input->getOption('path'); + + // If the "step" option is specified it means we only want to rollback a small + // number of migrations before migrating again. For example, the user might + // only rollback and remigrate the latest four migrations instead of all. + $step = $this->input->getOption('step') ?: 0; + + if ($step > 0) { + $this->runRollback($database, $path, $step); + } else { + $this->runReset($database, $path); + } + + // The refresh command is essentially just a brief aggregate of a few other of + // the migration commands and just provides a convenient wrapper to execute + // them in succession. We'll also see if we need to re-seed the database. + $this->call('migrate', array_filter([ + '--database' => $database, + '--path' => $path, + '--realpath' => $this->input->getOption('realpath'), + '--force' => true, + ])); + + if ($this->needsSeeding()) { + $this->runSeeder($database); + } + } + + /** + * Run the rollback command. + * + * @param string $database + * @param string $path + * @param int $step + * @return void + */ + protected function runRollback($database, $path, $step) + { + $this->call('migrate:rollback', array_filter([ + '--database' => $database, + '--path' => $path, + '--realpath' => $this->input->getOption('realpath'), + '--step' => $step, + '--force' => true, + ])); + } + + /** + * Run the reset command. + * + * @param string $database + * @param string $path + * @return void + */ + protected function runReset($database, $path) + { + $this->call('migrate:reset', array_filter([ + '--database' => $database, + '--path' => $path, + '--realpath' => $this->input->getOption('realpath'), + '--force' => true, + ])); + } + + /** + * Determine if the developer has requested database seeding. + * + * @return bool + */ + protected function needsSeeding() + { + return $this->option('seed') || $this->option('seeder'); + } + + /** + * Run the database seeder command. + * + * @param string $database + * @return void + */ + protected function runSeeder($database) + { + $this->call('db:seed', array_filter([ + '--database' => $database, + '--class' => $this->option('seeder') ?: 'DatabaseSeeder', + '--force' => true, + ])); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], + ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], + ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run'], + ['seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder'], + ['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted & re-run'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php new file mode 100755 index 00000000..28803806 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php @@ -0,0 +1,91 @@ +migrator = $migrator; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + if (! $this->confirmToProceed()) { + return; + } + + $this->migrator->setConnection($this->option('database')); + + // First, we'll make sure that the migration table actually exists before we + // start trying to rollback and re-run all of the migrations. If it's not + // present we'll just bail out with an info message for the developers. + if (! $this->migrator->repositoryExists()) { + return $this->comment('Migration table not found.'); + } + + $this->migrator->setOutput($this->output)->reset( + $this->getMigrationPaths(), $this->option('pretend') + ); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], + + ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], + + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], + + ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php new file mode 100755 index 00000000..65a50eb0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php @@ -0,0 +1,89 @@ +migrator = $migrator; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + if (! $this->confirmToProceed()) { + return; + } + + $this->migrator->setConnection($this->option('database')); + + $this->migrator->setOutput($this->output)->rollback( + $this->getMigrationPaths(), [ + 'pretend' => $this->option('pretend'), + 'step' => (int) $this->option('step'), + ] + ); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], + + ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], + + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], + + ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run'], + + ['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php new file mode 100644 index 00000000..034ea1be --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php @@ -0,0 +1,115 @@ +migrator = $migrator; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->migrator->setConnection($this->option('database')); + + if (! $this->migrator->repositoryExists()) { + $this->error('Migration table not found.'); + + return 1; + } + + $ran = $this->migrator->getRepository()->getRan(); + + $batches = $this->migrator->getRepository()->getMigrationBatches(); + + if (count($migrations = $this->getStatusFor($ran, $batches)) > 0) { + $this->table(['Ran?', 'Migration', 'Batch'], $migrations); + } else { + $this->error('No migrations found'); + } + } + + /** + * Get the status for the given ran migrations. + * + * @param array $ran + * @param array $batches + * @return \Illuminate\Support\Collection + */ + protected function getStatusFor(array $ran, array $batches) + { + return Collection::make($this->getAllMigrationFiles()) + ->map(function ($migration) use ($ran, $batches) { + $migrationName = $this->migrator->getMigrationName($migration); + + return in_array($migrationName, $ran) + ? ['Yes', $migrationName, $batches[$migrationName]] + : ['No', $migrationName]; + }); + } + + /** + * Get an array of all of the migration files. + * + * @return array + */ + protected function getAllMigrationFiles() + { + return $this->migrator->getMigrationFiles($this->getMigrationPaths()); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + + ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to use'], + + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/TableGuesser.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/TableGuesser.php new file mode 100644 index 00000000..82dfbddb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/TableGuesser.php @@ -0,0 +1,37 @@ +resolver = $resolver; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + if (! $this->confirmToProceed()) { + return; + } + + $this->resolver->setDefaultConnection($this->getDatabase()); + + Model::unguarded(function () { + $this->getSeeder()->__invoke(); + }); + + $this->info('Database seeding completed successfully.'); + } + + /** + * Get a seeder instance from the container. + * + * @return \Illuminate\Database\Seeder + */ + protected function getSeeder() + { + $class = $this->laravel->make($this->input->getOption('class')); + + return $class->setContainer($this->laravel)->setCommand($this); + } + + /** + * Get the name of the database connection to use. + * + * @return string + */ + protected function getDatabase() + { + $database = $this->input->getOption('database'); + + return $database ?: $this->laravel['config']['database.default']; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['class', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder', 'DatabaseSeeder'], + + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to seed'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php new file mode 100644 index 00000000..f25c9ab8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php @@ -0,0 +1,96 @@ +composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + parent::handle(); + + $this->composer->dumpAutoloads(); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return __DIR__.'/stubs/seeder.stub'; + } + + /** + * Get the destination class path. + * + * @param string $name + * @return string + */ + protected function getPath($name) + { + return $this->laravel->databasePath().'/seeds/'.$name.'.php'; + } + + /** + * Parse the class name and format according to the root namespace. + * + * @param string $name + * @return string + */ + protected function qualifyClass($name) + { + return $name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub b/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub new file mode 100644 index 00000000..4aa38454 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub @@ -0,0 +1,16 @@ +confirmToProceed()) { + return; + } + + $database = $this->input->getOption('database'); + + if ($this->option('drop-views')) { + $this->dropAllViews($database); + + $this->info('Dropped all views successfully.'); + } + + $this->dropAllTables($database); + + $this->info('Dropped all tables successfully.'); + + if ($this->option('drop-types')) { + $this->dropAllTypes($database); + + $this->info('Dropped all types successfully.'); + } + } + + /** + * Drop all of the database tables. + * + * @param string $database + * @return void + */ + protected function dropAllTables($database) + { + $this->laravel['db']->connection($database) + ->getSchemaBuilder() + ->dropAllTables(); + } + + /** + * Drop all of the database views. + * + * @param string $database + * @return void + */ + protected function dropAllViews($database) + { + $this->laravel['db']->connection($database) + ->getSchemaBuilder() + ->dropAllViews(); + } + + /** + * Drop all of the database types. + * + * @param string $database + * @return void + */ + protected function dropAllTypes($database) + { + $this->laravel['db']->connection($database) + ->getSchemaBuilder() + ->dropAllTypes(); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + ['drop-views', null, InputOption::VALUE_NONE, 'Drop all tables and views'], + ['drop-types', null, InputOption::VALUE_NONE, 'Drop all tables and types (Postgres only)'], + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php b/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php new file mode 100755 index 00000000..386f0726 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php @@ -0,0 +1,351 @@ +app = $app; + $this->factory = $factory; + + $this->reconnector = function ($connection) { + $this->reconnect($connection->getName()); + }; + } + + /** + * Get a database connection instance. + * + * @param string|null $name + * @return \Illuminate\Database\Connection + */ + public function connection($name = null) + { + [$database, $type] = $this->parseConnectionName($name); + + $name = $name ?: $database; + + // If we haven't created this connection, we'll create it based on the config + // provided in the application. Once we've created the connections we will + // set the "fetch mode" for PDO which determines the query return types. + if (! isset($this->connections[$name])) { + $this->connections[$name] = $this->configure( + $this->makeConnection($database), $type + ); + } + + return $this->connections[$name]; + } + + /** + * Parse the connection into an array of the name and read / write type. + * + * @param string $name + * @return array + */ + protected function parseConnectionName($name) + { + $name = $name ?: $this->getDefaultConnection(); + + return Str::endsWith($name, ['::read', '::write']) + ? explode('::', $name, 2) : [$name, null]; + } + + /** + * Make the database connection instance. + * + * @param string $name + * @return \Illuminate\Database\Connection + */ + protected function makeConnection($name) + { + $config = $this->configuration($name); + + // First we will check by the connection name to see if an extension has been + // registered specifically for that connection. If it has we will call the + // Closure and pass it the config allowing it to resolve the connection. + if (isset($this->extensions[$name])) { + return call_user_func($this->extensions[$name], $config, $name); + } + + // Next we will check to see if an extension has been registered for a driver + // and will call the Closure if so, which allows us to have a more generic + // resolver for the drivers themselves which applies to all connections. + if (isset($this->extensions[$driver = $config['driver']])) { + return call_user_func($this->extensions[$driver], $config, $name); + } + + return $this->factory->make($config, $name); + } + + /** + * Get the configuration for a connection. + * + * @param string $name + * @return array + * + * @throws \InvalidArgumentException + */ + protected function configuration($name) + { + $name = $name ?: $this->getDefaultConnection(); + + // To get the database connection configuration, we will just pull each of the + // connection configurations and get the configurations for the given name. + // If the configuration doesn't exist, we'll throw an exception and bail. + $connections = $this->app['config']['database.connections']; + + if (is_null($config = Arr::get($connections, $name))) { + throw new InvalidArgumentException("Database connection [{$name}] not configured."); + } + + return (new ConfigurationUrlParser) + ->parseConfiguration($config); + } + + /** + * Prepare the database connection instance. + * + * @param \Illuminate\Database\Connection $connection + * @param string $type + * @return \Illuminate\Database\Connection + */ + protected function configure(Connection $connection, $type) + { + $connection = $this->setPdoForType($connection, $type); + + // First we'll set the fetch mode and a few other dependencies of the database + // connection. This method basically just configures and prepares it to get + // used by the application. Once we're finished we'll return it back out. + if ($this->app->bound('events')) { + $connection->setEventDispatcher($this->app['events']); + } + + // Here we'll set a reconnector callback. This reconnector can be any callable + // so we will set a Closure to reconnect from this manager with the name of + // the connection, which will allow us to reconnect from the connections. + $connection->setReconnector($this->reconnector); + + return $connection; + } + + /** + * Prepare the read / write mode for database connection instance. + * + * @param \Illuminate\Database\Connection $connection + * @param string|null $type + * @return \Illuminate\Database\Connection + */ + protected function setPdoForType(Connection $connection, $type = null) + { + if ($type === 'read') { + $connection->setPdo($connection->getReadPdo()); + } elseif ($type === 'write') { + $connection->setReadPdo($connection->getPdo()); + } + + return $connection; + } + + /** + * Disconnect from the given database and remove from local cache. + * + * @param string|null $name + * @return void + */ + public function purge($name = null) + { + $name = $name ?: $this->getDefaultConnection(); + + $this->disconnect($name); + + unset($this->connections[$name]); + } + + /** + * Disconnect from the given database. + * + * @param string|null $name + * @return void + */ + public function disconnect($name = null) + { + if (isset($this->connections[$name = $name ?: $this->getDefaultConnection()])) { + $this->connections[$name]->disconnect(); + } + } + + /** + * Reconnect to the given database. + * + * @param string|null $name + * @return \Illuminate\Database\Connection + */ + public function reconnect($name = null) + { + $this->disconnect($name = $name ?: $this->getDefaultConnection()); + + if (! isset($this->connections[$name])) { + return $this->connection($name); + } + + return $this->refreshPdoConnections($name); + } + + /** + * Refresh the PDO connections on a given connection. + * + * @param string $name + * @return \Illuminate\Database\Connection + */ + protected function refreshPdoConnections($name) + { + $fresh = $this->makeConnection($name); + + return $this->connections[$name] + ->setPdo($fresh->getRawPdo()) + ->setReadPdo($fresh->getRawReadPdo()); + } + + /** + * Get the default connection name. + * + * @return string + */ + public function getDefaultConnection() + { + return $this->app['config']['database.default']; + } + + /** + * Set the default connection name. + * + * @param string $name + * @return void + */ + public function setDefaultConnection($name) + { + $this->app['config']['database.default'] = $name; + } + + /** + * Get all of the support drivers. + * + * @return array + */ + public function supportedDrivers() + { + return ['mysql', 'pgsql', 'sqlite', 'sqlsrv']; + } + + /** + * Get all of the drivers that are actually available. + * + * @return array + */ + public function availableDrivers() + { + return array_intersect( + $this->supportedDrivers(), + str_replace('dblib', 'sqlsrv', PDO::getAvailableDrivers()) + ); + } + + /** + * Register an extension connection resolver. + * + * @param string $name + * @param callable $resolver + * @return void + */ + public function extend($name, callable $resolver) + { + $this->extensions[$name] = $resolver; + } + + /** + * Return all of the created connections. + * + * @return array + */ + public function getConnections() + { + return $this->connections; + } + + /** + * Set the database reconnector callback. + * + * @param callable $reconnector + * @return void + */ + public function setReconnector(callable $reconnector) + { + $this->reconnector = $reconnector; + } + + /** + * Dynamically pass methods to the default connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->connection()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php new file mode 100755 index 00000000..3008e5b6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php @@ -0,0 +1,114 @@ +app['db']); + + Model::setEventDispatcher($this->app['events']); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + Model::clearBootedModels(); + + $this->registerConnectionServices(); + + $this->registerEloquentFactory(); + + $this->registerQueueableEntityResolver(); + } + + /** + * Register the primary database bindings. + * + * @return void + */ + protected function registerConnectionServices() + { + // The connection factory is used to create the actual connection instances on + // the database. We will inject the factory into the manager so that it may + // make the connections while they are actually needed and not of before. + $this->app->singleton('db.factory', function ($app) { + return new ConnectionFactory($app); + }); + + // The database manager is used to resolve various connections, since multiple + // connections might be managed. It also implements the connection resolver + // interface which may be used by other components requiring connections. + $this->app->singleton('db', function ($app) { + return new DatabaseManager($app, $app['db.factory']); + }); + + $this->app->bind('db.connection', function ($app) { + return $app['db']->connection(); + }); + } + + /** + * Register the Eloquent factory instance in the container. + * + * @return void + */ + protected function registerEloquentFactory() + { + $this->app->singleton(FakerGenerator::class, function ($app, $parameters) { + $locale = $parameters['locale'] ?? $app['config']->get('app.faker_locale', 'en_US'); + + if (! isset(static::$fakers[$locale])) { + static::$fakers[$locale] = FakerFactory::create($locale); + } + + static::$fakers[$locale]->unique(true); + + return static::$fakers[$locale]; + }); + + $this->app->singleton(EloquentFactory::class, function ($app) { + return EloquentFactory::construct( + $app->make(FakerGenerator::class), $this->app->databasePath('factories') + ); + }); + } + + /** + * Register the queueable entity resolver implementation. + * + * @return void + */ + protected function registerQueueableEntityResolver() + { + $this->app->singleton(EntityResolver::class, function () { + return new QueueEntityResolver; + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/DetectsConcurrencyErrors.php b/vendor/laravel/framework/src/Illuminate/Database/DetectsConcurrencyErrors.php new file mode 100644 index 00000000..4933aee7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/DetectsConcurrencyErrors.php @@ -0,0 +1,37 @@ +getCode() === '40001') { + return true; + } + + $message = $e->getMessage(); + + return Str::contains($message, [ + 'Deadlock found when trying to get lock', + 'deadlock detected', + 'The database file is locked', + 'database is locked', + 'database table is locked', + 'A table in the database is locked', + 'has been chosen as the deadlock victim', + 'Lock wait timeout exceeded; try restarting transaction', + 'WSREP detected deadlock/conflict and aborted the transaction. Try restarting the transaction', + ]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php b/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php new file mode 100644 index 00000000..16c86874 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php @@ -0,0 +1,62 @@ +getMessage(); + + return Str::contains($message, [ + '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', + 'Transaction() on null', + 'child connection forced to terminate due to client_idle_limit', + 'query_wait_timeout', + 'reset by peer', + 'Physical connection is not usable', + 'TCP Provider: Error code 0x68', + 'ORA-03114', + 'Packets out of order. Expected', + 'Adaptive Server connection failed', + 'Communication link failure', + 'connection is no longer usable', + 'Login timeout expired', + 'SQLSTATE[HY000] [2002] Connection refused', + 'running with the --read-only option so it cannot execute this statement', + 'The connection is broken and recovery is not possible. The connection is marked by the client driver as unrecoverable. No attempt was made to restore the connection.', + 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Try again', + 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known', + 'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: EOF detected', + 'SQLSTATE[HY000] [2002] Connection timed out', + 'SSL: Connection timed out', + 'SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry.', + 'Temporary failure in name resolution', + 'SSL: Broken pipe', + 'SQLSTATE[08S01]: Communication link failure', + 'SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host', + 'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: No route to host', + 'The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior.', + 'SQLSTATE[08006] [7] could not translate host name', + 'TCP Provider: Error code 0x274C', + ]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php new file mode 100755 index 00000000..7ed95b0f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php @@ -0,0 +1,1458 @@ +query = $query; + } + + /** + * Create and return an un-saved model instance. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function make(array $attributes = []) + { + return $this->newModelInstance($attributes); + } + + /** + * Register a new global scope. + * + * @param string $identifier + * @param \Illuminate\Database\Eloquent\Scope|\Closure $scope + * @return $this + */ + public function withGlobalScope($identifier, $scope) + { + $this->scopes[$identifier] = $scope; + + if (method_exists($scope, 'extend')) { + $scope->extend($this); + } + + return $this; + } + + /** + * Remove a registered global scope. + * + * @param \Illuminate\Database\Eloquent\Scope|string $scope + * @return $this + */ + public function withoutGlobalScope($scope) + { + if (! is_string($scope)) { + $scope = get_class($scope); + } + + unset($this->scopes[$scope]); + + $this->removedScopes[] = $scope; + + return $this; + } + + /** + * Remove all or passed registered global scopes. + * + * @param array|null $scopes + * @return $this + */ + public function withoutGlobalScopes(array $scopes = null) + { + if (! is_array($scopes)) { + $scopes = array_keys($this->scopes); + } + + foreach ($scopes as $scope) { + $this->withoutGlobalScope($scope); + } + + return $this; + } + + /** + * Get an array of global scopes that were removed from the query. + * + * @return array + */ + public function removedScopes() + { + return $this->removedScopes; + } + + /** + * Add a where clause on the primary key to the query. + * + * @param mixed $id + * @return $this + */ + public function whereKey($id) + { + if (is_array($id) || $id instanceof Arrayable) { + $this->query->whereIn($this->model->getQualifiedKeyName(), $id); + + return $this; + } + + if ($id !== null && $this->model->getKeyType() === 'string') { + $id = (string) $id; + } + + return $this->where($this->model->getQualifiedKeyName(), '=', $id); + } + + /** + * Add a where clause on the primary key to the query. + * + * @param mixed $id + * @return $this + */ + public function whereKeyNot($id) + { + if (is_array($id) || $id instanceof Arrayable) { + $this->query->whereNotIn($this->model->getQualifiedKeyName(), $id); + + return $this; + } + + if ($id !== null && $this->model->getKeyType() === 'string') { + $id = (string) $id; + } + + return $this->where($this->model->getQualifiedKeyName(), '!=', $id); + } + + /** + * Add a basic where clause to the query. + * + * @param \Closure|string|array|\Illuminate\Database\Query\Expression $column + * @param mixed $operator + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function where($column, $operator = null, $value = null, $boolean = 'and') + { + if ($column instanceof Closure) { + $column($query = $this->model->newQueryWithoutRelationships()); + + $this->query->addNestedWhereQuery($query->getQuery(), $boolean); + } else { + $this->query->where(...func_get_args()); + } + + return $this; + } + + /** + * Add a basic where clause to the query, and return the first result. + * + * @param \Closure|string|array|\Illuminate\Database\Query\Expression $column + * @param mixed $operator + * @param mixed $value + * @param string $boolean + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function firstWhere($column, $operator = null, $value = null, $boolean = 'and') + { + return $this->where($column, $operator, $value, $boolean)->first(); + } + + /** + * Add an "or where" clause to the query. + * + * @param \Closure|array|string|\Illuminate\Database\Query\Expression $column + * @param mixed $operator + * @param mixed $value + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orWhere($column, $operator = null, $value = null) + { + [$value, $operator] = $this->query->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->where($column, $operator, $value, 'or'); + } + + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string|\Illuminate\Database\Query\Expression $column + * @return $this + */ + public function latest($column = null) + { + if (is_null($column)) { + $column = $this->model->getCreatedAtColumn() ?? 'created_at'; + } + + $this->query->latest($column); + + return $this; + } + + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string|\Illuminate\Database\Query\Expression $column + * @return $this + */ + public function oldest($column = null) + { + if (is_null($column)) { + $column = $this->model->getCreatedAtColumn() ?? 'created_at'; + } + + $this->query->oldest($column); + + return $this; + } + + /** + * Create a collection of models from plain arrays. + * + * @param array $items + * @return \Illuminate\Database\Eloquent\Collection + */ + public function hydrate(array $items) + { + $instance = $this->newModelInstance(); + + return $instance->newCollection(array_map(function ($item) use ($instance) { + return $instance->newFromBuilder($item); + }, $items)); + } + + /** + * Create a collection of models from a raw query. + * + * @param string $query + * @param array $bindings + * @return \Illuminate\Database\Eloquent\Collection + */ + public function fromQuery($query, $bindings = []) + { + return $this->hydrate( + $this->query->getConnection()->select($query, $bindings) + ); + } + + /** + * Find a model by its primary key. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|null + */ + public function find($id, $columns = ['*']) + { + if (is_array($id) || $id instanceof Arrayable) { + return $this->findMany($id, $columns); + } + + return $this->whereKey($id)->first($columns); + } + + /** + * Find multiple models by their primary keys. + * + * @param \Illuminate\Contracts\Support\Arrayable|array $ids + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function findMany($ids, $columns = ['*']) + { + $ids = $ids instanceof Arrayable ? $ids->toArray() : $ids; + + if (empty($ids)) { + return $this->model->newCollection(); + } + + return $this->whereKey($ids)->get($columns); + } + + /** + * Find a model by its primary key or throw an exception. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static|static[] + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function findOrFail($id, $columns = ['*']) + { + $result = $this->find($id, $columns); + + if (is_array($id)) { + if (count($result) === count(array_unique($id))) { + return $result; + } + } elseif (! is_null($result)) { + return $result; + } + + throw (new ModelNotFoundException)->setModel( + get_class($this->model), $id + ); + } + + /** + * Find a model by its primary key or return fresh model instance. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function findOrNew($id, $columns = ['*']) + { + if (! is_null($model = $this->find($id, $columns))) { + return $model; + } + + return $this->newModelInstance(); + } + + /** + * Get the first record matching the attributes or instantiate it. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function firstOrNew(array $attributes, array $values = []) + { + if (! is_null($instance = $this->where($attributes)->first())) { + return $instance; + } + + return $this->newModelInstance($attributes + $values); + } + + /** + * Get the first record matching the attributes or create it. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function firstOrCreate(array $attributes, array $values = []) + { + if (! is_null($instance = $this->where($attributes)->first())) { + return $instance; + } + + return tap($this->newModelInstance($attributes + $values), function ($instance) { + $instance->save(); + }); + } + + /** + * Create or update a record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function updateOrCreate(array $attributes, array $values = []) + { + return tap($this->firstOrNew($attributes), function ($instance) use ($values) { + $instance->fill($values)->save(); + }); + } + + /** + * Execute the query and get the first result or throw an exception. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function firstOrFail($columns = ['*']) + { + if (! is_null($model = $this->first($columns))) { + return $model; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->model)); + } + + /** + * Execute the query and get the first result or call a callback. + * + * @param \Closure|array $columns + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Model|static|mixed + */ + public function firstOr($columns = ['*'], Closure $callback = null) + { + if ($columns instanceof Closure) { + $callback = $columns; + + $columns = ['*']; + } + + if (! is_null($model = $this->first($columns))) { + return $model; + } + + return $callback(); + } + + /** + * Get a single column's value from the first result of a query. + * + * @param string|\Illuminate\Database\Query\Expression $column + * @return mixed + */ + public function value($column) + { + if ($result = $this->first([$column])) { + return $result->{Str::afterLast($column, '.')}; + } + } + + /** + * Execute the query as a "select" statement. + * + * @param array|string $columns + * @return \Illuminate\Database\Eloquent\Collection|static[] + */ + public function get($columns = ['*']) + { + $builder = $this->applyScopes(); + + // If we actually found models we will also eager load any relationships that + // have been specified as needing to be eager loaded, which will solve the + // n+1 query issue for the developers to avoid running a lot of queries. + if (count($models = $builder->getModels($columns)) > 0) { + $models = $builder->eagerLoadRelations($models); + } + + return $builder->getModel()->newCollection($models); + } + + /** + * Get the hydrated models without eager loading. + * + * @param array|string $columns + * @return \Illuminate\Database\Eloquent\Model[]|static[] + */ + public function getModels($columns = ['*']) + { + return $this->model->hydrate( + $this->query->get($columns)->all() + )->all(); + } + + /** + * Eager load the relationships for the models. + * + * @param array $models + * @return array + */ + public function eagerLoadRelations(array $models) + { + foreach ($this->eagerLoad as $name => $constraints) { + // For nested eager loads we'll skip loading them here and they will be set as an + // eager load on the query to retrieve the relation so that they will be eager + // loaded on that query, because that is where they get hydrated as models. + if (strpos($name, '.') === false) { + $models = $this->eagerLoadRelation($models, $name, $constraints); + } + } + + return $models; + } + + /** + * Eagerly load the relationship on a set of models. + * + * @param array $models + * @param string $name + * @param \Closure $constraints + * @return array + */ + protected function eagerLoadRelation(array $models, $name, Closure $constraints) + { + // First we will "back up" the existing where conditions on the query so we can + // add our eager constraints. Then we will merge the wheres that were on the + // query back to it in order that any where conditions might be specified. + $relation = $this->getRelation($name); + + $relation->addEagerConstraints($models); + + $constraints($relation); + + // Once we have the results, we just match those back up to their parent models + // using the relationship instance. Then we just return the finished arrays + // of models which have been eagerly hydrated and are readied for return. + return $relation->match( + $relation->initRelation($models, $name), + $relation->getEager(), $name + ); + } + + /** + * Get the relation instance for the given relation name. + * + * @param string $name + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + public function getRelation($name) + { + // We want to run a relationship query without any constrains so that we will + // not have to remove these where clauses manually which gets really hacky + // and error prone. We don't want constraints because we add eager ones. + $relation = Relation::noConstraints(function () use ($name) { + try { + return $this->getModel()->newInstance()->$name(); + } catch (BadMethodCallException $e) { + throw RelationNotFoundException::make($this->getModel(), $name); + } + }); + + $nested = $this->relationsNestedUnder($name); + + // If there are nested relationships set on the query, we will put those onto + // the query instances so that they can be handled after this relationship + // is loaded. In this way they will all trickle down as they are loaded. + if (count($nested) > 0) { + $relation->getQuery()->with($nested); + } + + return $relation; + } + + /** + * Get the deeply nested relations for a given top-level relation. + * + * @param string $relation + * @return array + */ + protected function relationsNestedUnder($relation) + { + $nested = []; + + // We are basically looking for any relationships that are nested deeper than + // the given top-level relationship. We will just check for any relations + // that start with the given top relations and adds them to our arrays. + foreach ($this->eagerLoad as $name => $constraints) { + if ($this->isNestedUnder($relation, $name)) { + $nested[substr($name, strlen($relation.'.'))] = $constraints; + } + } + + return $nested; + } + + /** + * Determine if the relationship is nested. + * + * @param string $relation + * @param string $name + * @return bool + */ + protected function isNestedUnder($relation, $name) + { + return Str::contains($name, '.') && Str::startsWith($name, $relation.'.'); + } + + /** + * Get a lazy collection for the given query. + * + * @return \Illuminate\Support\LazyCollection + */ + public function cursor() + { + return $this->applyScopes()->query->cursor()->map(function ($record) { + return $this->newModelInstance()->newFromBuilder($record); + }); + } + + /** + * Add a generic "order by" clause if the query doesn't already have one. + * + * @return void + */ + protected function enforceOrderBy() + { + if (empty($this->query->orders) && empty($this->query->unionOrders)) { + $this->orderBy($this->model->getQualifiedKeyName(), 'asc'); + } + } + + /** + * Get an array with the values of a given column. + * + * @param string|\Illuminate\Database\Query\Expression $column + * @param string|null $key + * @return \Illuminate\Support\Collection + */ + public function pluck($column, $key = null) + { + $results = $this->toBase()->pluck($column, $key); + + // If the model has a mutator for the requested column, we will spin through + // the results and mutate the values so that the mutated version of these + // columns are returned as you would expect from these Eloquent models. + if (! $this->model->hasGetMutator($column) && + ! $this->model->hasCast($column) && + ! in_array($column, $this->model->getDates())) { + return $results; + } + + return $results->map(function ($value) use ($column) { + return $this->model->newFromBuilder([$column => $value])->{$column}; + }); + } + + /** + * Paginate the given query. + * + * @param int|null $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + * + * @throws \InvalidArgumentException + */ + public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $page = $page ?: Paginator::resolveCurrentPage($pageName); + + $perPage = $perPage ?: $this->model->getPerPage(); + + $results = ($total = $this->toBase()->getCountForPagination()) + ? $this->forPage($page, $perPage)->get($columns) + : $this->model->newCollection(); + + return $this->paginator($results, $total, $perPage, $page, [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ]); + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int|null $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $page = $page ?: Paginator::resolveCurrentPage($pageName); + + $perPage = $perPage ?: $this->model->getPerPage(); + + // Next we will set the limit and offset for this query so that when we get the + // results we get the proper section of results. Then, we'll create the full + // paginator instances for these results with the given page and per page. + $this->skip(($page - 1) * $perPage)->take($perPage + 1); + + return $this->simplePaginator($this->get($columns), $perPage, $page, [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ]); + } + + /** + * Save a new model and return the instance. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model|$this + */ + public function create(array $attributes = []) + { + return tap($this->newModelInstance($attributes), function ($instance) { + $instance->save(); + }); + } + + /** + * Save a new model and return the instance. Allow mass-assignment. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model|$this + */ + public function forceCreate(array $attributes) + { + return $this->model->unguarded(function () use ($attributes) { + return $this->newModelInstance()->create($attributes); + }); + } + + /** + * Update a record in the database. + * + * @param array $values + * @return int + */ + public function update(array $values) + { + return $this->toBase()->update($this->addUpdatedAtColumn($values)); + } + + /** + * Increment a column's value by a given amount. + * + * @param string|\Illuminate\Database\Query\Expression $column + * @param float|int $amount + * @param array $extra + * @return int + */ + public function increment($column, $amount = 1, array $extra = []) + { + return $this->toBase()->increment( + $column, $amount, $this->addUpdatedAtColumn($extra) + ); + } + + /** + * Decrement a column's value by a given amount. + * + * @param string|\Illuminate\Database\Query\Expression $column + * @param float|int $amount + * @param array $extra + * @return int + */ + public function decrement($column, $amount = 1, array $extra = []) + { + return $this->toBase()->decrement( + $column, $amount, $this->addUpdatedAtColumn($extra) + ); + } + + /** + * Add the "updated at" column to an array of values. + * + * @param array $values + * @return array + */ + protected function addUpdatedAtColumn(array $values) + { + if (! $this->model->usesTimestamps() || + is_null($this->model->getUpdatedAtColumn())) { + return $values; + } + + $column = $this->model->getUpdatedAtColumn(); + + $values = array_merge( + [$column => $this->model->freshTimestampString()], + $values + ); + + $segments = preg_split('/\s+as\s+/i', $this->query->from); + + $qualifiedColumn = end($segments).'.'.$column; + + $values[$qualifiedColumn] = $values[$column]; + + unset($values[$column]); + + return $values; + } + + /** + * Delete a record from the database. + * + * @return mixed + */ + public function delete() + { + if (isset($this->onDelete)) { + return call_user_func($this->onDelete, $this); + } + + return $this->toBase()->delete(); + } + + /** + * Run the default delete function on the builder. + * + * Since we do not apply scopes here, the row will actually be deleted. + * + * @return mixed + */ + public function forceDelete() + { + return $this->query->delete(); + } + + /** + * Register a replacement for the default delete function. + * + * @param \Closure $callback + * @return void + */ + public function onDelete(Closure $callback) + { + $this->onDelete = $callback; + } + + /** + * Call the given local model scopes. + * + * @param array|string $scopes + * @return static|mixed + */ + public function scopes($scopes) + { + $builder = $this; + + foreach (Arr::wrap($scopes) as $scope => $parameters) { + // If the scope key is an integer, then the scope was passed as the value and + // the parameter list is empty, so we will format the scope name and these + // parameters here. Then, we'll be ready to call the scope on the model. + if (is_int($scope)) { + [$scope, $parameters] = [$parameters, []]; + } + + // Next we'll pass the scope callback to the callScope method which will take + // care of grouping the "wheres" properly so the logical order doesn't get + // messed up when adding scopes. Then we'll return back out the builder. + $builder = $builder->callScope( + [$this->model, 'scope'.ucfirst($scope)], + Arr::wrap($parameters) + ); + } + + return $builder; + } + + /** + * Apply the scopes to the Eloquent builder instance and return it. + * + * @return static + */ + public function applyScopes() + { + if (! $this->scopes) { + return $this; + } + + $builder = clone $this; + + foreach ($this->scopes as $identifier => $scope) { + if (! isset($builder->scopes[$identifier])) { + continue; + } + + $builder->callScope(function (self $builder) use ($scope) { + // If the scope is a Closure we will just go ahead and call the scope with the + // builder instance. The "callScope" method will properly group the clauses + // that are added to this query so "where" clauses maintain proper logic. + if ($scope instanceof Closure) { + $scope($builder); + } + + // If the scope is a scope object, we will call the apply method on this scope + // passing in the builder and the model instance. After we run all of these + // scopes we will return back the builder instance to the outside caller. + if ($scope instanceof Scope) { + $scope->apply($builder, $this->getModel()); + } + }); + } + + return $builder; + } + + /** + * Apply the given scope on the current builder instance. + * + * @param callable $scope + * @param array $parameters + * @return mixed + */ + protected function callScope(callable $scope, $parameters = []) + { + array_unshift($parameters, $this); + + $query = $this->getQuery(); + + // We will keep track of how many wheres are on the query before running the + // scope so that we can properly group the added scope constraints in the + // query as their own isolated nested where statement and avoid issues. + $originalWhereCount = is_null($query->wheres) + ? 0 : count($query->wheres); + + $result = $scope(...array_values($parameters)) ?? $this; + + if (count((array) $query->wheres) > $originalWhereCount) { + $this->addNewWheresWithinGroup($query, $originalWhereCount); + } + + return $result; + } + + /** + * Nest where conditions by slicing them at the given where count. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $originalWhereCount + * @return void + */ + protected function addNewWheresWithinGroup(QueryBuilder $query, $originalWhereCount) + { + // Here, we totally remove all of the where clauses since we are going to + // rebuild them as nested queries by slicing the groups of wheres into + // their own sections. This is to prevent any confusing logic order. + $allWheres = $query->wheres; + + $query->wheres = []; + + $this->groupWhereSliceForScope( + $query, array_slice($allWheres, 0, $originalWhereCount) + ); + + $this->groupWhereSliceForScope( + $query, array_slice($allWheres, $originalWhereCount) + ); + } + + /** + * Slice where conditions at the given offset and add them to the query as a nested condition. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $whereSlice + * @return void + */ + protected function groupWhereSliceForScope(QueryBuilder $query, $whereSlice) + { + $whereBooleans = collect($whereSlice)->pluck('boolean'); + + // Here we'll check if the given subset of where clauses contains any "or" + // booleans and in this case create a nested where expression. That way + // we don't add any unnecessary nesting thus keeping the query clean. + if ($whereBooleans->contains('or')) { + $query->wheres[] = $this->createNestedWhere( + $whereSlice, $whereBooleans->first() + ); + } else { + $query->wheres = array_merge($query->wheres, $whereSlice); + } + } + + /** + * Create a where array with nested where conditions. + * + * @param array $whereSlice + * @param string $boolean + * @return array + */ + protected function createNestedWhere($whereSlice, $boolean = 'and') + { + $whereGroup = $this->getQuery()->forNestedWhere(); + + $whereGroup->wheres = $whereSlice; + + return ['type' => 'Nested', 'query' => $whereGroup, 'boolean' => $boolean]; + } + + /** + * Set the relationships that should be eager loaded. + * + * @param mixed $relations + * @return $this + */ + public function with($relations) + { + $eagerLoad = $this->parseWithRelations(is_string($relations) ? func_get_args() : $relations); + + $this->eagerLoad = array_merge($this->eagerLoad, $eagerLoad); + + return $this; + } + + /** + * Prevent the specified relations from being eager loaded. + * + * @param mixed $relations + * @return $this + */ + public function without($relations) + { + $this->eagerLoad = array_diff_key($this->eagerLoad, array_flip( + is_string($relations) ? func_get_args() : $relations + )); + + return $this; + } + + /** + * Create a new instance of the model being queried. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function newModelInstance($attributes = []) + { + return $this->model->newInstance($attributes)->setConnection( + $this->query->getConnection()->getName() + ); + } + + /** + * Parse a list of relations into individuals. + * + * @param array $relations + * @return array + */ + protected function parseWithRelations(array $relations) + { + $results = []; + + foreach ($relations as $name => $constraints) { + // If the "name" value is a numeric key, we can assume that no + // constraints have been specified. We'll just put an empty + // Closure there, so that we can treat them all the same. + if (is_numeric($name)) { + $name = $constraints; + + [$name, $constraints] = Str::contains($name, ':') + ? $this->createSelectWithConstraint($name) + : [$name, static function () { + // + }]; + } + + // We need to separate out any nested includes, which allows the developers + // to load deep relationships using "dots" without stating each level of + // the relationship with its own key in the array of eager-load names. + $results = $this->addNestedWiths($name, $results); + + $results[$name] = $constraints; + } + + return $results; + } + + /** + * Create a constraint to select the given columns for the relation. + * + * @param string $name + * @return array + */ + protected function createSelectWithConstraint($name) + { + return [explode(':', $name)[0], static function ($query) use ($name) { + $query->select(array_map(static function ($column) use ($query) { + if (Str::contains($column, '.')) { + return $column; + } + + return $query instanceof BelongsToMany + ? $query->getRelated()->getTable().'.'.$column + : $column; + }, explode(',', explode(':', $name)[1]))); + }]; + } + + /** + * Parse the nested relationships in a relation. + * + * @param string $name + * @param array $results + * @return array + */ + protected function addNestedWiths($name, $results) + { + $progress = []; + + // If the relation has already been set on the result array, we will not set it + // again, since that would override any constraints that were already placed + // on the relationships. We will only set the ones that are not specified. + foreach (explode('.', $name) as $segment) { + $progress[] = $segment; + + if (! isset($results[$last = implode('.', $progress)])) { + $results[$last] = static function () { + // + }; + } + } + + return $results; + } + + /** + * Get the underlying query builder instance. + * + * @return \Illuminate\Database\Query\Builder + */ + public function getQuery() + { + return $this->query; + } + + /** + * Set the underlying query builder instance. + * + * @param \Illuminate\Database\Query\Builder $query + * @return $this + */ + public function setQuery($query) + { + $this->query = $query; + + return $this; + } + + /** + * Get a base query builder instance. + * + * @return \Illuminate\Database\Query\Builder + */ + public function toBase() + { + return $this->applyScopes()->getQuery(); + } + + /** + * Get the relationships being eagerly loaded. + * + * @return array + */ + public function getEagerLoads() + { + return $this->eagerLoad; + } + + /** + * Set the relationships being eagerly loaded. + * + * @param array $eagerLoad + * @return $this + */ + public function setEagerLoads(array $eagerLoad) + { + $this->eagerLoad = $eagerLoad; + + return $this; + } + + /** + * Get the default key name of the table. + * + * @return string + */ + protected function defaultKeyName() + { + return $this->getModel()->getKeyName(); + } + + /** + * Get the model instance being queried. + * + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function getModel() + { + return $this->model; + } + + /** + * Set a model instance for the model being queried. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return $this + */ + public function setModel(Model $model) + { + $this->model = $model; + + $this->query->from($model->getTable()); + + return $this; + } + + /** + * Qualify the given column name by the model's table. + * + * @param string|\Illuminate\Database\Query\Expression $column + * @return string + */ + public function qualifyColumn($column) + { + return $this->model->qualifyColumn($column); + } + + /** + * Get the given macro by name. + * + * @param string $name + * @return \Closure + */ + public function getMacro($name) + { + return Arr::get($this->localMacros, $name); + } + + /** + * Checks if a macro is registered. + * + * @param string $name + * @return bool + */ + public function hasMacro($name) + { + return isset($this->localMacros[$name]); + } + + /** + * Get the given global macro by name. + * + * @param string $name + * @return \Closure + */ + public static function getGlobalMacro($name) + { + return Arr::get(static::$macros, $name); + } + + /** + * Checks if a global macro is registered. + * + * @param string $name + * @return bool + */ + public static function hasGlobalMacro($name) + { + return isset(static::$macros[$name]); + } + + /** + * Dynamically access builder proxies. + * + * @param string $key + * @return mixed + * + * @throws \Exception + */ + public function __get($key) + { + if ($key === 'orWhere') { + return new HigherOrderBuilderProxy($this, $key); + } + + throw new Exception("Property [{$key}] does not exist on the Eloquent builder instance."); + } + + /** + * Dynamically handle calls into the query instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if ($method === 'macro') { + $this->localMacros[$parameters[0]] = $parameters[1]; + + return; + } + + if ($this->hasMacro($method)) { + array_unshift($parameters, $this); + + return $this->localMacros[$method](...$parameters); + } + + if (static::hasGlobalMacro($method)) { + $callable = static::$macros[$method]; + + if ($callable instanceof Closure) { + $callable = $callable->bindTo($this, static::class); + } + + return $callable(...$parameters); + } + + if ($this->model !== null && method_exists($this->model, $scope = 'scope'.ucfirst($method))) { + return $this->callScope([$this->model, $scope], $parameters); + } + + if (in_array($method, $this->passthru)) { + return $this->toBase()->{$method}(...$parameters); + } + + $this->forwardCallTo($this->query, $method, $parameters); + + return $this; + } + + /** + * Dynamically handle calls into the query instance. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public static function __callStatic($method, $parameters) + { + if ($method === 'macro') { + static::$macros[$parameters[0]] = $parameters[1]; + + return; + } + + if ($method === 'mixin') { + return static::registerMixin($parameters[0], $parameters[1] ?? true); + } + + if (! static::hasGlobalMacro($method)) { + static::throwBadMethodCallException($method); + } + + $callable = static::$macros[$method]; + + if ($callable instanceof Closure) { + $callable = $callable->bindTo(null, static::class); + } + + return $callable(...$parameters); + } + + /** + * Register the given mixin with the builder. + * + * @param string $mixin + * @param bool $replace + * @return void + */ + protected static function registerMixin($mixin, $replace) + { + $methods = (new ReflectionClass($mixin))->getMethods( + ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + if ($replace || ! static::hasGlobalMacro($method->name)) { + $method->setAccessible(true); + + static::macro($method->name, $method->invoke($mixin)); + } + } + } + + /** + * Force a clone of the underlying query builder when cloning. + * + * @return void + */ + public function __clone() + { + $this->query = clone $this->query; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php new file mode 100755 index 00000000..6416714c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php @@ -0,0 +1,615 @@ +getKey(); + } + + if ($key instanceof Arrayable) { + $key = $key->toArray(); + } + + if (is_array($key)) { + if ($this->isEmpty()) { + return new static; + } + + return $this->whereIn($this->first()->getKeyName(), $key); + } + + return Arr::first($this->items, function ($model) use ($key) { + return $model->getKey() == $key; + }, $default); + } + + /** + * Load a set of relationships onto the collection. + * + * @param array|string $relations + * @return $this + */ + public function load($relations) + { + if ($this->isNotEmpty()) { + if (is_string($relations)) { + $relations = func_get_args(); + } + + $query = $this->first()->newQueryWithoutRelationships()->with($relations); + + $this->items = $query->eagerLoadRelations($this->items); + } + + return $this; + } + + /** + * Load a set of relationship counts onto the collection. + * + * @param array|string $relations + * @return $this + */ + public function loadCount($relations) + { + if ($this->isEmpty()) { + return $this; + } + + $models = $this->first()->newModelQuery() + ->whereKey($this->modelKeys()) + ->select($this->first()->getKeyName()) + ->withCount(...func_get_args()) + ->get(); + + $attributes = Arr::except( + array_keys($models->first()->getAttributes()), + $models->first()->getKeyName() + ); + + $models->each(function ($model) use ($attributes) { + $this->find($model->getKey())->forceFill( + Arr::only($model->getAttributes(), $attributes) + )->syncOriginalAttributes($attributes); + }); + + return $this; + } + + /** + * Load a set of relationships onto the collection if they are not already eager loaded. + * + * @param array|string $relations + * @return $this + */ + public function loadMissing($relations) + { + if (is_string($relations)) { + $relations = func_get_args(); + } + + foreach ($relations as $key => $value) { + if (is_numeric($key)) { + $key = $value; + } + + $segments = explode('.', explode(':', $key)[0]); + + if (Str::contains($key, ':')) { + $segments[count($segments) - 1] .= ':'.explode(':', $key)[1]; + } + + $path = []; + + foreach ($segments as $segment) { + $path[] = [$segment => $segment]; + } + + if (is_callable($value)) { + $path[count($segments) - 1][end($segments)] = $value; + } + + $this->loadMissingRelation($this, $path); + } + + return $this; + } + + /** + * Load a relationship path if it is not already eager loaded. + * + * @param \Illuminate\Database\Eloquent\Collection $models + * @param array $path + * @return void + */ + protected function loadMissingRelation(self $models, array $path) + { + $relation = array_shift($path); + + $name = explode(':', key($relation))[0]; + + if (is_string(reset($relation))) { + $relation = reset($relation); + } + + $models->filter(function ($model) use ($name) { + return ! is_null($model) && ! $model->relationLoaded($name); + })->load($relation); + + if (empty($path)) { + return; + } + + $models = $models->pluck($name)->whereNotNull(); + + if ($models->first() instanceof BaseCollection) { + $models = $models->collapse(); + } + + $this->loadMissingRelation(new static($models), $path); + } + + /** + * Load a set of relationships onto the mixed relationship collection. + * + * @param string $relation + * @param array $relations + * @return $this + */ + public function loadMorph($relation, $relations) + { + $this->pluck($relation) + ->filter() + ->groupBy(function ($model) { + return get_class($model); + }) + ->each(function ($models, $className) use ($relations) { + static::make($models)->load($relations[$className] ?? []); + }); + + return $this; + } + + /** + * Determine if a key exists in the collection. + * + * @param mixed $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function contains($key, $operator = null, $value = null) + { + if (func_num_args() > 1 || $this->useAsCallable($key)) { + return parent::contains(...func_get_args()); + } + + if ($key instanceof Model) { + return parent::contains(function ($model) use ($key) { + return $model->is($key); + }); + } + + return parent::contains(function ($model) use ($key) { + return $model->getKey() == $key; + }); + } + + /** + * Get the array of primary keys. + * + * @return array + */ + public function modelKeys() + { + return array_map(function ($model) { + return $model->getKey(); + }, $this->items); + } + + /** + * Merge the collection with the given items. + * + * @param \ArrayAccess|array $items + * @return static + */ + public function merge($items) + { + $dictionary = $this->getDictionary(); + + foreach ($items as $item) { + $dictionary[$item->getKey()] = $item; + } + + return new static(array_values($dictionary)); + } + + /** + * Run a map over each of the items. + * + * @param callable $callback + * @return \Illuminate\Support\Collection|static + */ + public function map(callable $callback) + { + $result = parent::map($callback); + + return $result->contains(function ($item) { + return ! $item instanceof Model; + }) ? $result->toBase() : $result; + } + + /** + * Run an associative map over each of the items. + * + * The callback should return an associative array with a single key / value pair. + * + * @param callable $callback + * @return \Illuminate\Support\Collection|static + */ + public function mapWithKeys(callable $callback) + { + $result = parent::mapWithKeys($callback); + + return $result->contains(function ($item) { + return ! $item instanceof Model; + }) ? $result->toBase() : $result; + } + + /** + * Reload a fresh model instance from the database for all the entities. + * + * @param array|string $with + * @return static + */ + public function fresh($with = []) + { + if ($this->isEmpty()) { + return new static; + } + + $model = $this->first(); + + $freshModels = $model->newQueryWithoutScopes() + ->with(is_string($with) ? func_get_args() : $with) + ->whereIn($model->getKeyName(), $this->modelKeys()) + ->get() + ->getDictionary(); + + return $this->map(function ($model) use ($freshModels) { + return $model->exists && isset($freshModels[$model->getKey()]) + ? $freshModels[$model->getKey()] : null; + }); + } + + /** + * Diff the collection with the given items. + * + * @param \ArrayAccess|array $items + * @return static + */ + public function diff($items) + { + $diff = new static; + + $dictionary = $this->getDictionary($items); + + foreach ($this->items as $item) { + if (! isset($dictionary[$item->getKey()])) { + $diff->add($item); + } + } + + return $diff; + } + + /** + * Intersect the collection with the given items. + * + * @param \ArrayAccess|array $items + * @return static + */ + public function intersect($items) + { + $intersect = new static; + + if (empty($items)) { + return $intersect; + } + + $dictionary = $this->getDictionary($items); + + foreach ($this->items as $item) { + if (isset($dictionary[$item->getKey()])) { + $intersect->add($item); + } + } + + return $intersect; + } + + /** + * Return only unique items from the collection. + * + * @param string|callable|null $key + * @param bool $strict + * @return static + */ + public function unique($key = null, $strict = false) + { + if (! is_null($key)) { + return parent::unique($key, $strict); + } + + return new static(array_values($this->getDictionary())); + } + + /** + * Returns only the models from the collection with the specified keys. + * + * @param mixed $keys + * @return static + */ + public function only($keys) + { + if (is_null($keys)) { + return new static($this->items); + } + + $dictionary = Arr::only($this->getDictionary(), $keys); + + return new static(array_values($dictionary)); + } + + /** + * Returns all models in the collection except the models with specified keys. + * + * @param mixed $keys + * @return static + */ + public function except($keys) + { + $dictionary = Arr::except($this->getDictionary(), $keys); + + return new static(array_values($dictionary)); + } + + /** + * Make the given, typically visible, attributes hidden across the entire collection. + * + * @param array|string $attributes + * @return $this + */ + public function makeHidden($attributes) + { + return $this->each->addHidden($attributes); + } + + /** + * Make the given, typically hidden, attributes visible across the entire collection. + * + * @param array|string $attributes + * @return $this + */ + public function makeVisible($attributes) + { + return $this->each->makeVisible($attributes); + } + + /** + * Get a dictionary keyed by primary keys. + * + * @param \ArrayAccess|array|null $items + * @return array + */ + public function getDictionary($items = null) + { + $items = is_null($items) ? $this->items : $items; + + $dictionary = []; + + foreach ($items as $value) { + $dictionary[$value->getKey()] = $value; + } + + return $dictionary; + } + + /** + * The following methods are intercepted to always return base collections. + */ + + /** + * Get an array with the values of a given key. + * + * @param string|array $value + * @param string|null $key + * @return \Illuminate\Support\Collection + */ + public function pluck($value, $key = null) + { + return $this->toBase()->pluck($value, $key); + } + + /** + * Get the keys of the collection items. + * + * @return \Illuminate\Support\Collection + */ + public function keys() + { + return $this->toBase()->keys(); + } + + /** + * Zip the collection together with one or more arrays. + * + * @param mixed ...$items + * @return \Illuminate\Support\Collection + */ + public function zip($items) + { + return $this->toBase()->zip(...func_get_args()); + } + + /** + * Collapse the collection of items into a single array. + * + * @return \Illuminate\Support\Collection + */ + public function collapse() + { + return $this->toBase()->collapse(); + } + + /** + * Get a flattened array of the items in the collection. + * + * @param int $depth + * @return \Illuminate\Support\Collection + */ + public function flatten($depth = INF) + { + return $this->toBase()->flatten($depth); + } + + /** + * Flip the items in the collection. + * + * @return \Illuminate\Support\Collection + */ + public function flip() + { + return $this->toBase()->flip(); + } + + /** + * Pad collection to the specified length with a value. + * + * @param int $size + * @param mixed $value + * @return \Illuminate\Support\Collection + */ + public function pad($size, $value) + { + return $this->toBase()->pad($size, $value); + } + + /** + * Get the comparison function to detect duplicates. + * + * @param bool $strict + * @return \Closure + */ + protected function duplicateComparator($strict) + { + return function ($a, $b) { + return $a->is($b); + }; + } + + /** + * Get the type of the entities being queued. + * + * @return string|null + * + * @throws \LogicException + */ + public function getQueueableClass() + { + if ($this->isEmpty()) { + return; + } + + $class = get_class($this->first()); + + $this->each(function ($model) use ($class) { + if (get_class($model) !== $class) { + throw new LogicException('Queueing collections with multiple model types is not supported.'); + } + }); + + return $class; + } + + /** + * Get the identifiers for all of the entities. + * + * @return array + */ + public function getQueueableIds() + { + if ($this->isEmpty()) { + return []; + } + + return $this->first() instanceof QueueableEntity + ? $this->map->getQueueableId()->all() + : $this->modelKeys(); + } + + /** + * Get the relationships of the entities being queued. + * + * @return array + */ + public function getQueueableRelations() + { + if ($this->isEmpty()) { + return []; + } + + $relations = $this->map->getQueueableRelations()->all(); + + if (count($relations) === 0 || $relations === [[]]) { + return []; + } elseif (count($relations) === 1) { + return array_values($relations)[0]; + } else { + return array_intersect(...$relations); + } + } + + /** + * Get the connection of the entities being queued. + * + * @return string|null + * + * @throws \LogicException + */ + public function getQueueableConnection() + { + if ($this->isEmpty()) { + return; + } + + $connection = $this->first()->getConnectionName(); + + $this->each(function ($model) use ($connection) { + if ($model->getConnectionName() !== $connection) { + throw new LogicException('Queueing collections with multiple model connections is not supported.'); + } + }); + + return $connection; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php new file mode 100644 index 00000000..d663a383 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php @@ -0,0 +1,224 @@ +fillable; + } + + /** + * Set the fillable attributes for the model. + * + * @param array $fillable + * @return $this + */ + public function fillable(array $fillable) + { + $this->fillable = $fillable; + + return $this; + } + + /** + * Get the guarded attributes for the model. + * + * @return array + */ + public function getGuarded() + { + return $this->guarded; + } + + /** + * Set the guarded attributes for the model. + * + * @param array $guarded + * @return $this + */ + public function guard(array $guarded) + { + $this->guarded = $guarded; + + return $this; + } + + /** + * Disable all mass assignable restrictions. + * + * @param bool $state + * @return void + */ + public static function unguard($state = true) + { + static::$unguarded = $state; + } + + /** + * Enable the mass assignment restrictions. + * + * @return void + */ + public static function reguard() + { + static::$unguarded = false; + } + + /** + * Determine if current state is "unguarded". + * + * @return bool + */ + public static function isUnguarded() + { + return static::$unguarded; + } + + /** + * Run the given callable while being unguarded. + * + * @param callable $callback + * @return mixed + */ + public static function unguarded(callable $callback) + { + if (static::$unguarded) { + return $callback(); + } + + static::unguard(); + + try { + return $callback(); + } finally { + static::reguard(); + } + } + + /** + * Determine if the given attribute may be mass assigned. + * + * @param string $key + * @return bool + */ + public function isFillable($key) + { + if (static::$unguarded) { + return true; + } + + // If the key is in the "fillable" array, we can of course assume that it's + // a fillable attribute. Otherwise, we will check the guarded array when + // we need to determine if the attribute is black-listed on the model. + if (in_array($key, $this->getFillable())) { + return true; + } + + // If the attribute is explicitly listed in the "guarded" array then we can + // return false immediately. This means this attribute is definitely not + // fillable and there is no point in going any further in this method. + if ($this->isGuarded($key)) { + return false; + } + + return empty($this->getFillable()) && + strpos($key, '.') === false && + ! Str::startsWith($key, '_'); + } + + /** + * Determine if the given key is guarded. + * + * @param string $key + * @return bool + */ + public function isGuarded($key) + { + if (empty($this->getGuarded())) { + return false; + } + + return $this->getGuarded() == ['*'] || + ! empty(preg_grep('/^'.preg_quote($key).'$/i', $this->getGuarded())) || + ! $this->isGuardableColumn($key); + } + + /** + * Determine if the given column is a valid, guardable column. + * + * @param string $key + * @return bool + */ + protected function isGuardableColumn($key) + { + if (! isset(static::$guardableColumns[get_class($this)])) { + static::$guardableColumns[get_class($this)] = $this->getConnection() + ->getSchemaBuilder() + ->getColumnListing($this->getTable()); + } + + return in_array($key, static::$guardableColumns[get_class($this)]); + } + + /** + * Determine if the model is totally guarded. + * + * @return bool + */ + public function totallyGuarded() + { + return count($this->getFillable()) === 0 && $this->getGuarded() == ['*']; + } + + /** + * Get the fillable attributes of a given array. + * + * @param array $attributes + * @return array + */ + protected function fillableFromArray(array $attributes) + { + if (count($this->getFillable()) > 0 && ! static::$unguarded) { + return array_intersect_key($attributes, array_flip($this->getFillable())); + } + + return $attributes; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php new file mode 100644 index 00000000..c5fa43a6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -0,0 +1,1265 @@ +addDateAttributesToArray( + $attributes = $this->getArrayableAttributes() + ); + + $attributes = $this->addMutatedAttributesToArray( + $attributes, $mutatedAttributes = $this->getMutatedAttributes() + ); + + // Next we will handle any casts that have been setup for this model and cast + // the values to their appropriate type. If the attribute has a mutator we + // will not perform the cast on those attributes to avoid any confusion. + $attributes = $this->addCastAttributesToArray( + $attributes, $mutatedAttributes + ); + + // Here we will grab all of the appended, calculated attributes to this model + // as these attributes are not really in the attributes array, but are run + // when we need to array or JSON the model for convenience to the coder. + foreach ($this->getArrayableAppends() as $key) { + $attributes[$key] = $this->mutateAttributeForArray($key, null); + } + + return $attributes; + } + + /** + * Add the date attributes to the attributes array. + * + * @param array $attributes + * @return array + */ + protected function addDateAttributesToArray(array $attributes) + { + foreach ($this->getDates() as $key) { + if (! isset($attributes[$key])) { + continue; + } + + $attributes[$key] = $this->serializeDate( + $this->asDateTime($attributes[$key]) + ); + } + + return $attributes; + } + + /** + * Add the mutated attributes to the attributes array. + * + * @param array $attributes + * @param array $mutatedAttributes + * @return array + */ + protected function addMutatedAttributesToArray(array $attributes, array $mutatedAttributes) + { + foreach ($mutatedAttributes as $key) { + // We want to spin through all the mutated attributes for this model and call + // the mutator for the attribute. We cache off every mutated attributes so + // we don't have to constantly check on attributes that actually change. + if (! array_key_exists($key, $attributes)) { + continue; + } + + // Next, we will call the mutator for this attribute so that we can get these + // mutated attribute's actual values. After we finish mutating each of the + // attributes we will return this final array of the mutated attributes. + $attributes[$key] = $this->mutateAttributeForArray( + $key, $attributes[$key] + ); + } + + return $attributes; + } + + /** + * Add the casted attributes to the attributes array. + * + * @param array $attributes + * @param array $mutatedAttributes + * @return array + */ + protected function addCastAttributesToArray(array $attributes, array $mutatedAttributes) + { + foreach ($this->getCasts() as $key => $value) { + if (! array_key_exists($key, $attributes) || in_array($key, $mutatedAttributes)) { + continue; + } + + // Here we will cast the attribute. Then, if the cast is a date or datetime cast + // then we will serialize the date for the array. This will convert the dates + // to strings based on the date format specified for these Eloquent models. + $attributes[$key] = $this->castAttribute( + $key, $attributes[$key] + ); + + // If the attribute cast was a date or a datetime, we will serialize the date as + // a string. This allows the developers to customize how dates are serialized + // into an array without affecting how they are persisted into the storage. + if ($attributes[$key] && + ($value === 'date' || $value === 'datetime')) { + $attributes[$key] = $this->serializeDate($attributes[$key]); + } + + if ($attributes[$key] && $this->isCustomDateTimeCast($value)) { + $attributes[$key] = $attributes[$key]->format(explode(':', $value, 2)[1]); + } + + if ($attributes[$key] instanceof Arrayable) { + $attributes[$key] = $attributes[$key]->toArray(); + } + } + + return $attributes; + } + + /** + * Get an attribute array of all arrayable attributes. + * + * @return array + */ + protected function getArrayableAttributes() + { + return $this->getArrayableItems($this->attributes); + } + + /** + * Get all of the appendable values that are arrayable. + * + * @return array + */ + protected function getArrayableAppends() + { + if (! count($this->appends)) { + return []; + } + + return $this->getArrayableItems( + array_combine($this->appends, $this->appends) + ); + } + + /** + * Get the model's relationships in array form. + * + * @return array + */ + public function relationsToArray() + { + $attributes = []; + + foreach ($this->getArrayableRelations() as $key => $value) { + // If the values implements the Arrayable interface we can just call this + // toArray method on the instances which will convert both models and + // collections to their proper array form and we'll set the values. + if ($value instanceof Arrayable) { + $relation = $value->toArray(); + } + + // If the value is null, we'll still go ahead and set it in this list of + // attributes since null is used to represent empty relationships if + // if it a has one or belongs to type relationships on the models. + elseif (is_null($value)) { + $relation = $value; + } + + // If the relationships snake-casing is enabled, we will snake case this + // key so that the relation attribute is snake cased in this returned + // array to the developers, making this consistent with attributes. + if (static::$snakeAttributes) { + $key = Str::snake($key); + } + + // If the relation value has been set, we will set it on this attributes + // list for returning. If it was not arrayable or null, we'll not set + // the value on the array because it is some type of invalid value. + if (isset($relation) || is_null($value)) { + $attributes[$key] = $relation; + } + + unset($relation); + } + + return $attributes; + } + + /** + * Get an attribute array of all arrayable relations. + * + * @return array + */ + protected function getArrayableRelations() + { + return $this->getArrayableItems($this->relations); + } + + /** + * Get an attribute array of all arrayable values. + * + * @param array $values + * @return array + */ + protected function getArrayableItems(array $values) + { + if (count($this->getVisible()) > 0) { + $values = array_intersect_key($values, array_flip($this->getVisible())); + } + + if (count($this->getHidden()) > 0) { + $values = array_diff_key($values, array_flip($this->getHidden())); + } + + return $values; + } + + /** + * Get an attribute from the model. + * + * @param string $key + * @return mixed + */ + public function getAttribute($key) + { + if (! $key) { + return; + } + + // If the attribute exists in the attribute array or has a "get" mutator we will + // get the attribute's value. Otherwise, we will proceed as if the developers + // are asking for a relationship's value. This covers both types of values. + if (array_key_exists($key, $this->attributes) || + $this->hasGetMutator($key)) { + return $this->getAttributeValue($key); + } + + // Here we will determine if the model base class itself contains this given key + // since we don't want to treat any of those methods as relationships because + // they are all intended as helper methods and none of these are relations. + if (method_exists(self::class, $key)) { + return; + } + + return $this->getRelationValue($key); + } + + /** + * Get a plain attribute (not a relationship). + * + * @param string $key + * @return mixed + */ + public function getAttributeValue($key) + { + $value = $this->getAttributeFromArray($key); + + // If the attribute has a get mutator, we will call that then return what + // it returns as the value, which is useful for transforming values on + // retrieval from the model to a form that is more useful for usage. + if ($this->hasGetMutator($key)) { + return $this->mutateAttribute($key, $value); + } + + // If the attribute exists within the cast array, we will convert it to + // an appropriate native PHP type dependent upon the associated value + // given with the key in the pair. Dayle made this comment line up. + if ($this->hasCast($key)) { + return $this->castAttribute($key, $value); + } + + // If the attribute is listed as a date, we will convert it to a DateTime + // instance on retrieval, which makes it quite convenient to work with + // date fields without having to create a mutator for each property. + if (in_array($key, $this->getDates()) && + ! is_null($value)) { + return $this->asDateTime($value); + } + + return $value; + } + + /** + * Get an attribute from the $attributes array. + * + * @param string $key + * @return mixed + */ + protected function getAttributeFromArray($key) + { + return $this->attributes[$key] ?? null; + } + + /** + * Get a relationship. + * + * @param string $key + * @return mixed + */ + public function getRelationValue($key) + { + // If the key already exists in the relationships array, it just means the + // relationship has already been loaded, so we'll just return it out of + // here because there is no need to query within the relations twice. + if ($this->relationLoaded($key)) { + return $this->relations[$key]; + } + + // If the "attribute" exists as a method on the model, we will just assume + // it is a relationship and will load and return results from the query + // and hydrate the relationship's value on the "relationships" array. + if (method_exists($this, $key)) { + return $this->getRelationshipFromMethod($key); + } + } + + /** + * Get a relationship value from a method. + * + * @param string $method + * @return mixed + * + * @throws \LogicException + */ + protected function getRelationshipFromMethod($method) + { + $relation = $this->$method(); + + if (! $relation instanceof Relation) { + if (is_null($relation)) { + throw new LogicException(sprintf( + '%s::%s must return a relationship instance, but "null" was returned. Was the "return" keyword used?', static::class, $method + )); + } + + throw new LogicException(sprintf( + '%s::%s must return a relationship instance.', static::class, $method + )); + } + + return tap($relation->getResults(), function ($results) use ($method) { + $this->setRelation($method, $results); + }); + } + + /** + * Determine if a get mutator exists for an attribute. + * + * @param string $key + * @return bool + */ + public function hasGetMutator($key) + { + return method_exists($this, 'get'.Str::studly($key).'Attribute'); + } + + /** + * Get the value of an attribute using its mutator. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function mutateAttribute($key, $value) + { + return $this->{'get'.Str::studly($key).'Attribute'}($value); + } + + /** + * Get the value of an attribute using its mutator for array conversion. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function mutateAttributeForArray($key, $value) + { + $value = $this->mutateAttribute($key, $value); + + return $value instanceof Arrayable ? $value->toArray() : $value; + } + + /** + * Cast an attribute to a native PHP type. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function castAttribute($key, $value) + { + if (is_null($value)) { + return $value; + } + + switch ($this->getCastType($key)) { + case 'int': + case 'integer': + return (int) $value; + case 'real': + case 'float': + case 'double': + return $this->fromFloat($value); + case 'decimal': + return $this->asDecimal($value, explode(':', $this->getCasts()[$key], 2)[1]); + case 'string': + return (string) $value; + case 'bool': + case 'boolean': + return (bool) $value; + case 'object': + return $this->fromJson($value, true); + case 'array': + case 'json': + return $this->fromJson($value); + case 'collection': + return new BaseCollection($this->fromJson($value)); + case 'date': + return $this->asDate($value); + case 'datetime': + case 'custom_datetime': + return $this->asDateTime($value); + case 'timestamp': + return $this->asTimestamp($value); + default: + return $value; + } + } + + /** + * Get the type of cast for a model attribute. + * + * @param string $key + * @return string + */ + protected function getCastType($key) + { + if ($this->isCustomDateTimeCast($this->getCasts()[$key])) { + return 'custom_datetime'; + } + + if ($this->isDecimalCast($this->getCasts()[$key])) { + return 'decimal'; + } + + return trim(strtolower($this->getCasts()[$key])); + } + + /** + * Determine if the cast type is a custom date time cast. + * + * @param string $cast + * @return bool + */ + protected function isCustomDateTimeCast($cast) + { + return strncmp($cast, 'date:', 5) === 0 || + strncmp($cast, 'datetime:', 9) === 0; + } + + /** + * Determine if the cast type is a decimal cast. + * + * @param string $cast + * @return bool + */ + protected function isDecimalCast($cast) + { + return strncmp($cast, 'decimal:', 8) === 0; + } + + /** + * Set a given attribute on the model. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + public function setAttribute($key, $value) + { + // First we will check for the presence of a mutator for the set operation + // which simply lets the developers tweak the attribute as it is set on + // the model, such as "json_encoding" an listing of data for storage. + if ($this->hasSetMutator($key)) { + return $this->setMutatedAttributeValue($key, $value); + } + + // If an attribute is listed as a "date", we'll convert it from a DateTime + // instance into a form proper for storage on the database tables using + // the connection grammar's date format. We will auto set the values. + elseif ($value && $this->isDateAttribute($key)) { + $value = $this->fromDateTime($value); + } + + if ($this->isJsonCastable($key) && ! is_null($value)) { + $value = $this->castAttributeAsJson($key, $value); + } + + // If this attribute contains a JSON ->, we'll set the proper value in the + // attribute's underlying array. This takes care of properly nesting an + // attribute in the array's value in the case of deeply nested items. + if (Str::contains($key, '->')) { + return $this->fillJsonAttribute($key, $value); + } + + $this->attributes[$key] = $value; + + return $this; + } + + /** + * Determine if a set mutator exists for an attribute. + * + * @param string $key + * @return bool + */ + public function hasSetMutator($key) + { + return method_exists($this, 'set'.Str::studly($key).'Attribute'); + } + + /** + * Set the value of an attribute using its mutator. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function setMutatedAttributeValue($key, $value) + { + return $this->{'set'.Str::studly($key).'Attribute'}($value); + } + + /** + * Determine if the given attribute is a date or date castable. + * + * @param string $key + * @return bool + */ + protected function isDateAttribute($key) + { + return in_array($key, $this->getDates(), true) || + $this->isDateCastable($key); + } + + /** + * Set a given JSON attribute on the model. + * + * @param string $key + * @param mixed $value + * @return $this + */ + public function fillJsonAttribute($key, $value) + { + [$key, $path] = explode('->', $key, 2); + + $this->attributes[$key] = $this->asJson($this->getArrayAttributeWithValue( + $path, $key, $value + )); + + return $this; + } + + /** + * Get an array attribute with the given key and value set. + * + * @param string $path + * @param string $key + * @param mixed $value + * @return $this + */ + protected function getArrayAttributeWithValue($path, $key, $value) + { + return tap($this->getArrayAttributeByKey($key), function (&$array) use ($path, $value) { + Arr::set($array, str_replace('->', '.', $path), $value); + }); + } + + /** + * Get an array attribute or return an empty array if it is not set. + * + * @param string $key + * @return array + */ + protected function getArrayAttributeByKey($key) + { + return isset($this->attributes[$key]) ? + $this->fromJson($this->attributes[$key]) : []; + } + + /** + * Cast the given attribute to JSON. + * + * @param string $key + * @param mixed $value + * @return string + */ + protected function castAttributeAsJson($key, $value) + { + $value = $this->asJson($value); + + if ($value === false) { + throw JsonEncodingException::forAttribute( + $this, $key, json_last_error_msg() + ); + } + + return $value; + } + + /** + * Encode the given value as JSON. + * + * @param mixed $value + * @return string + */ + protected function asJson($value) + { + return json_encode($value); + } + + /** + * Decode the given JSON back into an array or object. + * + * @param string $value + * @param bool $asObject + * @return mixed + */ + public function fromJson($value, $asObject = false) + { + return json_decode($value, ! $asObject); + } + + /** + * Decode the given float. + * + * @param mixed $value + * @return mixed + */ + public function fromFloat($value) + { + switch ((string) $value) { + case 'Infinity': + return INF; + case '-Infinity': + return -INF; + case 'NaN': + return NAN; + default: + return (float) $value; + } + } + + /** + * Return a decimal as string. + * + * @param float $value + * @param int $decimals + * @return string + */ + protected function asDecimal($value, $decimals) + { + return number_format($value, $decimals, '.', ''); + } + + /** + * Return a timestamp as DateTime object with time set to 00:00:00. + * + * @param mixed $value + * @return \Illuminate\Support\Carbon + */ + protected function asDate($value) + { + return $this->asDateTime($value)->startOfDay(); + } + + /** + * Return a timestamp as DateTime object. + * + * @param mixed $value + * @return \Illuminate\Support\Carbon + */ + protected function asDateTime($value) + { + // If this value is already a Carbon instance, we shall just return it as is. + // This prevents us having to re-instantiate a Carbon instance when we know + // it already is one, which wouldn't be fulfilled by the DateTime check. + if ($value instanceof CarbonInterface) { + return Date::instance($value); + } + + // If the value is already a DateTime instance, we will just skip the rest of + // these checks since they will be a waste of time, and hinder performance + // when checking the field. We will just return the DateTime right away. + if ($value instanceof DateTimeInterface) { + return Date::parse( + $value->format('Y-m-d H:i:s.u'), $value->getTimezone() + ); + } + + // If this value is an integer, we will assume it is a UNIX timestamp's value + // and format a Carbon object from this timestamp. This allows flexibility + // when defining your date fields as they might be UNIX timestamps here. + if (is_numeric($value)) { + return Date::createFromTimestamp($value); + } + + // If the value is in simply year, month, day format, we will instantiate the + // Carbon instances from that format. Again, this provides for simple date + // fields on the database, while still supporting Carbonized conversion. + if ($this->isStandardDateFormat($value)) { + return Date::instance(Carbon::createFromFormat('Y-m-d', $value)->startOfDay()); + } + + $format = $this->getDateFormat(); + + // https://bugs.php.net/bug.php?id=75577 + if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) { + $format = str_replace('.v', '.u', $format); + } + + // Finally, we will just assume this date is in the format used by default on + // the database connection and use that format to create the Carbon object + // that is returned back out to the developers after we convert it here. + return Date::createFromFormat($format, $value); + } + + /** + * Determine if the given value is a standard date format. + * + * @param string $value + * @return bool + */ + protected function isStandardDateFormat($value) + { + return preg_match('/^(\d{4})-(\d{1,2})-(\d{1,2})$/', $value); + } + + /** + * Convert a DateTime to a storable string. + * + * @param mixed $value + * @return string|null + */ + public function fromDateTime($value) + { + return empty($value) ? $value : $this->asDateTime($value)->format( + $this->getDateFormat() + ); + } + + /** + * Return a timestamp as unix timestamp. + * + * @param mixed $value + * @return int + */ + protected function asTimestamp($value) + { + return $this->asDateTime($value)->getTimestamp(); + } + + /** + * Prepare a date for array / JSON serialization. + * + * @param \DateTimeInterface $date + * @return string + */ + protected function serializeDate(DateTimeInterface $date) + { + return $date->format($this->getDateFormat()); + } + + /** + * Get the attributes that should be converted to dates. + * + * @return array + */ + public function getDates() + { + $defaults = [ + $this->getCreatedAtColumn(), + $this->getUpdatedAtColumn(), + ]; + + return $this->usesTimestamps() + ? array_unique(array_merge($this->dates, $defaults)) + : $this->dates; + } + + /** + * Get the format for database stored dates. + * + * @return string + */ + public function getDateFormat() + { + return $this->dateFormat ?: $this->getConnection()->getQueryGrammar()->getDateFormat(); + } + + /** + * Set the date format used by the model. + * + * @param string $format + * @return $this + */ + public function setDateFormat($format) + { + $this->dateFormat = $format; + + return $this; + } + + /** + * Determine whether an attribute should be cast to a native type. + * + * @param string $key + * @param array|string|null $types + * @return bool + */ + public function hasCast($key, $types = null) + { + if (array_key_exists($key, $this->getCasts())) { + return $types ? in_array($this->getCastType($key), (array) $types, true) : true; + } + + return false; + } + + /** + * Get the casts array. + * + * @return array + */ + public function getCasts() + { + if ($this->getIncrementing()) { + return array_merge([$this->getKeyName() => $this->getKeyType()], $this->casts); + } + + return $this->casts; + } + + /** + * Determine whether a value is Date / DateTime castable for inbound manipulation. + * + * @param string $key + * @return bool + */ + protected function isDateCastable($key) + { + return $this->hasCast($key, ['date', 'datetime']); + } + + /** + * Determine whether a value is JSON castable for inbound manipulation. + * + * @param string $key + * @return bool + */ + protected function isJsonCastable($key) + { + return $this->hasCast($key, ['array', 'json', 'object', 'collection']); + } + + /** + * Get all of the current attributes on the model. + * + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Set the array of model attributes. No checking is done. + * + * @param array $attributes + * @param bool $sync + * @return $this + */ + public function setRawAttributes(array $attributes, $sync = false) + { + $this->attributes = $attributes; + + if ($sync) { + $this->syncOriginal(); + } + + return $this; + } + + /** + * Get the model's original attribute values. + * + * @param string|null $key + * @param mixed $default + * @return mixed|array + */ + public function getOriginal($key = null, $default = null) + { + return Arr::get($this->original, $key, $default); + } + + /** + * Get a subset of the model's attributes. + * + * @param array|mixed $attributes + * @return array + */ + public function only($attributes) + { + $results = []; + + foreach (is_array($attributes) ? $attributes : func_get_args() as $attribute) { + $results[$attribute] = $this->getAttribute($attribute); + } + + return $results; + } + + /** + * Sync the original attributes with the current. + * + * @return $this + */ + public function syncOriginal() + { + $this->original = $this->attributes; + + return $this; + } + + /** + * Sync a single original attribute with its current value. + * + * @param string $attribute + * @return $this + */ + public function syncOriginalAttribute($attribute) + { + return $this->syncOriginalAttributes($attribute); + } + + /** + * Sync multiple original attribute with their current values. + * + * @param array|string $attributes + * @return $this + */ + public function syncOriginalAttributes($attributes) + { + $attributes = is_array($attributes) ? $attributes : func_get_args(); + + foreach ($attributes as $attribute) { + $this->original[$attribute] = $this->attributes[$attribute]; + } + + return $this; + } + + /** + * Sync the changed attributes. + * + * @return $this + */ + public function syncChanges() + { + $this->changes = $this->getDirty(); + + return $this; + } + + /** + * Determine if the model or any of the given attribute(s) have been modified. + * + * @param array|string|null $attributes + * @return bool + */ + public function isDirty($attributes = null) + { + return $this->hasChanges( + $this->getDirty(), is_array($attributes) ? $attributes : func_get_args() + ); + } + + /** + * Determine if the model and all the given attribute(s) have remained the same. + * + * @param array|string|null $attributes + * @return bool + */ + public function isClean($attributes = null) + { + return ! $this->isDirty(...func_get_args()); + } + + /** + * Determine if the model or any of the given attribute(s) have been modified. + * + * @param array|string|null $attributes + * @return bool + */ + public function wasChanged($attributes = null) + { + return $this->hasChanges( + $this->getChanges(), is_array($attributes) ? $attributes : func_get_args() + ); + } + + /** + * Determine if any of the given attributes were changed. + * + * @param array $changes + * @param array|string|null $attributes + * @return bool + */ + protected function hasChanges($changes, $attributes = null) + { + // If no specific attributes were provided, we will just see if the dirty array + // already contains any attributes. If it does we will just return that this + // count is greater than zero. Else, we need to check specific attributes. + if (empty($attributes)) { + return count($changes) > 0; + } + + // Here we will spin through every attribute and see if this is in the array of + // dirty attributes. If it is, we will return true and if we make it through + // all of the attributes for the entire array we will return false at end. + foreach (Arr::wrap($attributes) as $attribute) { + if (array_key_exists($attribute, $changes)) { + return true; + } + } + + return false; + } + + /** + * Get the attributes that have been changed since last sync. + * + * @return array + */ + public function getDirty() + { + $dirty = []; + + foreach ($this->getAttributes() as $key => $value) { + if (! $this->originalIsEquivalent($key, $value)) { + $dirty[$key] = $value; + } + } + + return $dirty; + } + + /** + * Get the attributes that were changed. + * + * @return array + */ + public function getChanges() + { + return $this->changes; + } + + /** + * Determine if the new and old values for a given key are equivalent. + * + * @param string $key + * @param mixed $current + * @return bool + */ + public function originalIsEquivalent($key, $current) + { + if (! array_key_exists($key, $this->original)) { + return false; + } + + $original = $this->getOriginal($key); + + if ($current === $original) { + return true; + } elseif (is_null($current)) { + return false; + } elseif ($this->isDateAttribute($key)) { + return $this->fromDateTime($current) === + $this->fromDateTime($original); + } elseif ($this->hasCast($key, ['object', 'collection'])) { + return $this->castAttribute($key, $current) == + $this->castAttribute($key, $original); + } elseif ($this->hasCast($key, ['real', 'float', 'double'])) { + if (($current === null && $original !== null) || ($current !== null && $original === null)) { + return false; + } + + return abs($this->castAttribute($key, $current) - $this->castAttribute($key, $original)) < PHP_FLOAT_EPSILON * 4; + } elseif ($this->hasCast($key)) { + return $this->castAttribute($key, $current) === + $this->castAttribute($key, $original); + } + + return is_numeric($current) && is_numeric($original) + && strcmp((string) $current, (string) $original) === 0; + } + + /** + * Append attributes to query when building a query. + * + * @param array|string $attributes + * @return $this + */ + public function append($attributes) + { + $this->appends = array_unique( + array_merge($this->appends, is_string($attributes) ? func_get_args() : $attributes) + ); + + return $this; + } + + /** + * Set the accessors to append to model arrays. + * + * @param array $appends + * @return $this + */ + public function setAppends(array $appends) + { + $this->appends = $appends; + + return $this; + } + + /** + * Get the mutated attributes for a given instance. + * + * @return array + */ + public function getMutatedAttributes() + { + $class = static::class; + + if (! isset(static::$mutatorCache[$class])) { + static::cacheMutatedAttributes($class); + } + + return static::$mutatorCache[$class]; + } + + /** + * Extract and cache all the mutated attributes of a class. + * + * @param string $class + * @return void + */ + public static function cacheMutatedAttributes($class) + { + static::$mutatorCache[$class] = collect(static::getMutatorMethods($class))->map(function ($match) { + return lcfirst(static::$snakeAttributes ? Str::snake($match) : $match); + })->all(); + } + + /** + * Get all of the attribute mutator methods. + * + * @param mixed $class + * @return array + */ + protected static function getMutatorMethods($class) + { + preg_match_all('/(?<=^|;)get([^;]+?)Attribute(;|$)/', implode(';', get_class_methods($class)), $matches); + + return $matches[1]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php new file mode 100644 index 00000000..0dc54308 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php @@ -0,0 +1,415 @@ +registerObserver($class); + } + } + + /** + * Register a single observer with the model. + * + * @param object|string $class + * @return void + * + * @throws \RuntimeException + */ + protected function registerObserver($class) + { + $className = $this->resolveObserverClassName($class); + + // When registering a model observer, we will spin through the possible events + // and determine if this observer has that method. If it does, we will hook + // it into the model's event system, making it convenient to watch these. + foreach ($this->getObservableEvents() as $event) { + if (method_exists($class, $event)) { + static::registerModelEvent($event, $className.'@'.$event); + } + } + } + + /** + * Resolve the observer's class name from an object or string. + * + * @param object|string $class + * @return string + * + * @throws \InvalidArgumentException + */ + private function resolveObserverClassName($class) + { + if (is_object($class)) { + return get_class($class); + } + + if (class_exists($class)) { + return $class; + } + + throw new InvalidArgumentException('Unable to find observer: '.$class); + } + + /** + * Get the observable event names. + * + * @return array + */ + public function getObservableEvents() + { + return array_merge( + [ + 'retrieved', 'creating', 'created', 'updating', 'updated', + 'saving', 'saved', 'restoring', 'restored', 'replicating', + 'deleting', 'deleted', 'forceDeleted', + ], + $this->observables + ); + } + + /** + * Set the observable event names. + * + * @param array $observables + * @return $this + */ + public function setObservableEvents(array $observables) + { + $this->observables = $observables; + + return $this; + } + + /** + * Add an observable event name. + * + * @param array|mixed $observables + * @return void + */ + public function addObservableEvents($observables) + { + $this->observables = array_unique(array_merge( + $this->observables, is_array($observables) ? $observables : func_get_args() + )); + } + + /** + * Remove an observable event name. + * + * @param array|mixed $observables + * @return void + */ + public function removeObservableEvents($observables) + { + $this->observables = array_diff( + $this->observables, is_array($observables) ? $observables : func_get_args() + ); + } + + /** + * Register a model event with the dispatcher. + * + * @param string $event + * @param \Closure|string $callback + * @return void + */ + protected static function registerModelEvent($event, $callback) + { + if (isset(static::$dispatcher)) { + $name = static::class; + + static::$dispatcher->listen("eloquent.{$event}: {$name}", $callback); + } + } + + /** + * Fire the given event for the model. + * + * @param string $event + * @param bool $halt + * @return mixed + */ + protected function fireModelEvent($event, $halt = true) + { + if (! isset(static::$dispatcher)) { + return true; + } + + // First, we will get the proper method to call on the event dispatcher, and then we + // will attempt to fire a custom, object based event for the given event. If that + // returns a result we can return that result, or we'll call the string events. + $method = $halt ? 'until' : 'dispatch'; + + $result = $this->filterModelEventResults( + $this->fireCustomModelEvent($event, $method) + ); + + if ($result === false) { + return false; + } + + return ! empty($result) ? $result : static::$dispatcher->{$method}( + "eloquent.{$event}: ".static::class, $this + ); + } + + /** + * Fire a custom model event for the given event. + * + * @param string $event + * @param string $method + * @return mixed|null + */ + protected function fireCustomModelEvent($event, $method) + { + if (! isset($this->dispatchesEvents[$event])) { + return; + } + + $result = static::$dispatcher->$method(new $this->dispatchesEvents[$event]($this)); + + if (! is_null($result)) { + return $result; + } + } + + /** + * Filter the model event results. + * + * @param mixed $result + * @return mixed + */ + protected function filterModelEventResults($result) + { + if (is_array($result)) { + $result = array_filter($result, function ($response) { + return ! is_null($response); + }); + } + + return $result; + } + + /** + * Register a retrieved model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function retrieved($callback) + { + static::registerModelEvent('retrieved', $callback); + } + + /** + * Register a saving model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function saving($callback) + { + static::registerModelEvent('saving', $callback); + } + + /** + * Register a saved model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function saved($callback) + { + static::registerModelEvent('saved', $callback); + } + + /** + * Register an updating model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function updating($callback) + { + static::registerModelEvent('updating', $callback); + } + + /** + * Register an updated model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function updated($callback) + { + static::registerModelEvent('updated', $callback); + } + + /** + * Register a creating model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function creating($callback) + { + static::registerModelEvent('creating', $callback); + } + + /** + * Register a created model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function created($callback) + { + static::registerModelEvent('created', $callback); + } + + /** + * Register a replicating model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function replicating($callback) + { + static::registerModelEvent('replicating', $callback); + } + + /** + * Register a deleting model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function deleting($callback) + { + static::registerModelEvent('deleting', $callback); + } + + /** + * Register a deleted model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function deleted($callback) + { + static::registerModelEvent('deleted', $callback); + } + + /** + * Remove all of the event listeners for the model. + * + * @return void + */ + public static function flushEventListeners() + { + if (! isset(static::$dispatcher)) { + return; + } + + $instance = new static; + + foreach ($instance->getObservableEvents() as $event) { + static::$dispatcher->forget("eloquent.{$event}: ".static::class); + } + + foreach (array_values($instance->dispatchesEvents) as $event) { + static::$dispatcher->forget($event); + } + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public static function getEventDispatcher() + { + return static::$dispatcher; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher + * @return void + */ + public static function setEventDispatcher(Dispatcher $dispatcher) + { + static::$dispatcher = $dispatcher; + } + + /** + * Unset the event dispatcher for models. + * + * @return void + */ + public static function unsetEventDispatcher() + { + static::$dispatcher = null; + } + + /** + * Execute a callback without firing any model events for any model type. + * + * @param callable $callback + * @return mixed + */ + public static function withoutEvents(callable $callback) + { + $dispatcher = static::getEventDispatcher(); + + if ($dispatcher) { + static::setEventDispatcher(new NullDispatcher($dispatcher)); + } + + try { + return $callback(); + } finally { + if ($dispatcher) { + static::setEventDispatcher($dispatcher); + } + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php new file mode 100644 index 00000000..1742679c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php @@ -0,0 +1,71 @@ +newRelatedInstance($related); + + $foreignKey = $foreignKey ?: $this->getForeignKey(); + + $localKey = $localKey ?: $this->getKeyName(); + + return $this->newHasOne($instance->newQuery(), $this, $instance->getTable().'.'.$foreignKey, $localKey); + } + + /** + * Instantiate a new HasOne relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $foreignKey + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\HasOne + */ + protected function newHasOne(Builder $query, Model $parent, $foreignKey, $localKey) + { + return new HasOne($query, $parent, $foreignKey, $localKey); + } + + /** + * Define a has-one-through relationship. + * + * @param string $related + * @param string $through + * @param string|null $firstKey + * @param string|null $secondKey + * @param string|null $localKey + * @param string|null $secondLocalKey + * @return \Illuminate\Database\Eloquent\Relations\HasOneThrough + */ + public function hasOneThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null) + { + $through = new $through; + + $firstKey = $firstKey ?: $this->getForeignKey(); + + $secondKey = $secondKey ?: $through->getForeignKey(); + + return $this->newHasOneThrough( + $this->newRelatedInstance($related)->newQuery(), $this, $through, + $firstKey, $secondKey, $localKey ?: $this->getKeyName(), + $secondLocalKey ?: $through->getKeyName() + ); + } + + /** + * Instantiate a new HasOneThrough relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $farParent + * @param \Illuminate\Database\Eloquent\Model $throughParent + * @param string $firstKey + * @param string $secondKey + * @param string $localKey + * @param string $secondLocalKey + * @return \Illuminate\Database\Eloquent\Relations\HasOneThrough + */ + protected function newHasOneThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey) + { + return new HasOneThrough($query, $farParent, $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey); + } + + /** + * Define a polymorphic one-to-one relationship. + * + * @param string $related + * @param string $name + * @param string|null $type + * @param string|null $id + * @param string|null $localKey + * @return \Illuminate\Database\Eloquent\Relations\MorphOne + */ + public function morphOne($related, $name, $type = null, $id = null, $localKey = null) + { + $instance = $this->newRelatedInstance($related); + + [$type, $id] = $this->getMorphs($name, $type, $id); + + $table = $instance->getTable(); + + $localKey = $localKey ?: $this->getKeyName(); + + return $this->newMorphOne($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); + } + + /** + * Instantiate a new MorphOne relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $type + * @param string $id + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\MorphOne + */ + protected function newMorphOne(Builder $query, Model $parent, $type, $id, $localKey) + { + return new MorphOne($query, $parent, $type, $id, $localKey); + } + + /** + * Define an inverse one-to-one or many relationship. + * + * @param string $related + * @param string|null $foreignKey + * @param string|null $ownerKey + * @param string|null $relation + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null) + { + // If no relation name was given, we will use this debug backtrace to extract + // the calling method's name and use that as the relationship name as most + // of the time this will be what we desire to use for the relationships. + if (is_null($relation)) { + $relation = $this->guessBelongsToRelation(); + } + + $instance = $this->newRelatedInstance($related); + + // If no foreign key was supplied, we can use a backtrace to guess the proper + // foreign key name by using the name of the relationship function, which + // when combined with an "_id" should conventionally match the columns. + if (is_null($foreignKey)) { + $foreignKey = Str::snake($relation).'_'.$instance->getKeyName(); + } + + // Once we have the foreign key names, we'll just create a new Eloquent query + // for the related models and returns the relationship instance which will + // actually be responsible for retrieving and hydrating every relations. + $ownerKey = $ownerKey ?: $instance->getKeyName(); + + return $this->newBelongsTo( + $instance->newQuery(), $this, $foreignKey, $ownerKey, $relation + ); + } + + /** + * Instantiate a new BelongsTo relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $child + * @param string $foreignKey + * @param string $ownerKey + * @param string $relation + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + protected function newBelongsTo(Builder $query, Model $child, $foreignKey, $ownerKey, $relation) + { + return new BelongsTo($query, $child, $foreignKey, $ownerKey, $relation); + } + + /** + * Define a polymorphic, inverse one-to-one or many relationship. + * + * @param string|null $name + * @param string|null $type + * @param string|null $id + * @param string|null $ownerKey + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + public function morphTo($name = null, $type = null, $id = null, $ownerKey = null) + { + // If no name is provided, we will use the backtrace to get the function name + // since that is most likely the name of the polymorphic interface. We can + // use that to get both the class and foreign key that will be utilized. + $name = $name ?: $this->guessBelongsToRelation(); + + [$type, $id] = $this->getMorphs( + Str::snake($name), $type, $id + ); + + // If the type value is null it is probably safe to assume we're eager loading + // the relationship. In this case we'll just pass in a dummy query where we + // need to remove any eager loads that may already be defined on a model. + return is_null($class = $this->{$type}) || $class === '' + ? $this->morphEagerTo($name, $type, $id, $ownerKey) + : $this->morphInstanceTo($class, $name, $type, $id, $ownerKey); + } + + /** + * Define a polymorphic, inverse one-to-one or many relationship. + * + * @param string $name + * @param string $type + * @param string $id + * @param string $ownerKey + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + protected function morphEagerTo($name, $type, $id, $ownerKey) + { + return $this->newMorphTo( + $this->newQuery()->setEagerLoads([]), $this, $id, $ownerKey, $type, $name + ); + } + + /** + * Define a polymorphic, inverse one-to-one or many relationship. + * + * @param string $target + * @param string $name + * @param string $type + * @param string $id + * @param string $ownerKey + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + protected function morphInstanceTo($target, $name, $type, $id, $ownerKey) + { + $instance = $this->newRelatedInstance( + static::getActualClassNameForMorph($target) + ); + + return $this->newMorphTo( + $instance->newQuery(), $this, $id, $ownerKey ?? $instance->getKeyName(), $type, $name + ); + } + + /** + * Instantiate a new MorphTo relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $foreignKey + * @param string $ownerKey + * @param string $type + * @param string $relation + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + protected function newMorphTo(Builder $query, Model $parent, $foreignKey, $ownerKey, $type, $relation) + { + return new MorphTo($query, $parent, $foreignKey, $ownerKey, $type, $relation); + } + + /** + * Retrieve the actual class name for a given morph class. + * + * @param string $class + * @return string + */ + public static function getActualClassNameForMorph($class) + { + return Arr::get(Relation::morphMap() ?: [], $class, $class); + } + + /** + * Guess the "belongs to" relationship name. + * + * @return string + */ + protected function guessBelongsToRelation() + { + [$one, $two, $caller] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); + + return $caller['function']; + } + + /** + * Define a one-to-many relationship. + * + * @param string $related + * @param string|null $foreignKey + * @param string|null $localKey + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function hasMany($related, $foreignKey = null, $localKey = null) + { + $instance = $this->newRelatedInstance($related); + + $foreignKey = $foreignKey ?: $this->getForeignKey(); + + $localKey = $localKey ?: $this->getKeyName(); + + return $this->newHasMany( + $instance->newQuery(), $this, $instance->getTable().'.'.$foreignKey, $localKey + ); + } + + /** + * Instantiate a new HasMany relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $foreignKey + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + protected function newHasMany(Builder $query, Model $parent, $foreignKey, $localKey) + { + return new HasMany($query, $parent, $foreignKey, $localKey); + } + + /** + * Define a has-many-through relationship. + * + * @param string $related + * @param string $through + * @param string|null $firstKey + * @param string|null $secondKey + * @param string|null $localKey + * @param string|null $secondLocalKey + * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough + */ + public function hasManyThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null) + { + $through = new $through; + + $firstKey = $firstKey ?: $this->getForeignKey(); + + $secondKey = $secondKey ?: $through->getForeignKey(); + + return $this->newHasManyThrough( + $this->newRelatedInstance($related)->newQuery(), $this, $through, + $firstKey, $secondKey, $localKey ?: $this->getKeyName(), + $secondLocalKey ?: $through->getKeyName() + ); + } + + /** + * Instantiate a new HasManyThrough relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $farParent + * @param \Illuminate\Database\Eloquent\Model $throughParent + * @param string $firstKey + * @param string $secondKey + * @param string $localKey + * @param string $secondLocalKey + * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough + */ + protected function newHasManyThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey) + { + return new HasManyThrough($query, $farParent, $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey); + } + + /** + * Define a polymorphic one-to-many relationship. + * + * @param string $related + * @param string $name + * @param string|null $type + * @param string|null $id + * @param string|null $localKey + * @return \Illuminate\Database\Eloquent\Relations\MorphMany + */ + public function morphMany($related, $name, $type = null, $id = null, $localKey = null) + { + $instance = $this->newRelatedInstance($related); + + // Here we will gather up the morph type and ID for the relationship so that we + // can properly query the intermediate table of a relation. Finally, we will + // get the table and create the relationship instances for the developers. + [$type, $id] = $this->getMorphs($name, $type, $id); + + $table = $instance->getTable(); + + $localKey = $localKey ?: $this->getKeyName(); + + return $this->newMorphMany($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); + } + + /** + * Instantiate a new MorphMany relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $type + * @param string $id + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\MorphMany + */ + protected function newMorphMany(Builder $query, Model $parent, $type, $id, $localKey) + { + return new MorphMany($query, $parent, $type, $id, $localKey); + } + + /** + * Define a many-to-many relationship. + * + * @param string $related + * @param string|null $table + * @param string|null $foreignPivotKey + * @param string|null $relatedPivotKey + * @param string|null $parentKey + * @param string|null $relatedKey + * @param string|null $relation + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + public function belongsToMany($related, $table = null, $foreignPivotKey = null, $relatedPivotKey = null, + $parentKey = null, $relatedKey = null, $relation = null) + { + // If no relationship name was passed, we will pull backtraces to get the + // name of the calling function. We will use that function name as the + // title of this relation since that is a great convention to apply. + if (is_null($relation)) { + $relation = $this->guessBelongsToManyRelation(); + } + + // First, we'll need to determine the foreign key and "other key" for the + // relationship. Once we have determined the keys we'll make the query + // instances as well as the relationship instances we need for this. + $instance = $this->newRelatedInstance($related); + + $foreignPivotKey = $foreignPivotKey ?: $this->getForeignKey(); + + $relatedPivotKey = $relatedPivotKey ?: $instance->getForeignKey(); + + // If no table name was provided, we can guess it by concatenating the two + // models using underscores in alphabetical order. The two model names + // are transformed to snake case from their default CamelCase also. + if (is_null($table)) { + $table = $this->joiningTable($related, $instance); + } + + return $this->newBelongsToMany( + $instance->newQuery(), $this, $table, $foreignPivotKey, + $relatedPivotKey, $parentKey ?: $this->getKeyName(), + $relatedKey ?: $instance->getKeyName(), $relation + ); + } + + /** + * Instantiate a new BelongsToMany relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $table + * @param string $foreignPivotKey + * @param string $relatedPivotKey + * @param string $parentKey + * @param string $relatedKey + * @param string $relationName + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + protected function newBelongsToMany(Builder $query, Model $parent, $table, $foreignPivotKey, $relatedPivotKey, + $parentKey, $relatedKey, $relationName = null) + { + return new BelongsToMany($query, $parent, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, $relationName); + } + + /** + * Define a polymorphic many-to-many relationship. + * + * @param string $related + * @param string $name + * @param string|null $table + * @param string|null $foreignPivotKey + * @param string|null $relatedPivotKey + * @param string|null $parentKey + * @param string|null $relatedKey + * @param bool $inverse + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + */ + public function morphToMany($related, $name, $table = null, $foreignPivotKey = null, + $relatedPivotKey = null, $parentKey = null, + $relatedKey = null, $inverse = false) + { + $caller = $this->guessBelongsToManyRelation(); + + // First, we will need to determine the foreign key and "other key" for the + // relationship. Once we have determined the keys we will make the query + // instances, as well as the relationship instances we need for these. + $instance = $this->newRelatedInstance($related); + + $foreignPivotKey = $foreignPivotKey ?: $name.'_id'; + + $relatedPivotKey = $relatedPivotKey ?: $instance->getForeignKey(); + + // Now we're ready to create a new query builder for this related model and + // the relationship instances for this relation. This relations will set + // appropriate query constraints then entirely manages the hydrations. + if (! $table) { + $words = preg_split('/(_)/u', $name, -1, PREG_SPLIT_DELIM_CAPTURE); + + $lastWord = array_pop($words); + + $table = implode('', $words).Str::plural($lastWord); + } + + return $this->newMorphToMany( + $instance->newQuery(), $this, $name, $table, + $foreignPivotKey, $relatedPivotKey, $parentKey ?: $this->getKeyName(), + $relatedKey ?: $instance->getKeyName(), $caller, $inverse + ); + } + + /** + * Instantiate a new MorphToMany relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $name + * @param string $table + * @param string $foreignPivotKey + * @param string $relatedPivotKey + * @param string $parentKey + * @param string $relatedKey + * @param string|null $relationName + * @param bool $inverse + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + */ + protected function newMorphToMany(Builder $query, Model $parent, $name, $table, $foreignPivotKey, + $relatedPivotKey, $parentKey, $relatedKey, + $relationName = null, $inverse = false) + { + return new MorphToMany($query, $parent, $name, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, + $relationName, $inverse); + } + + /** + * Define a polymorphic, inverse many-to-many relationship. + * + * @param string $related + * @param string $name + * @param string|null $table + * @param string|null $foreignPivotKey + * @param string|null $relatedPivotKey + * @param string|null $parentKey + * @param string|null $relatedKey + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + */ + public function morphedByMany($related, $name, $table = null, $foreignPivotKey = null, + $relatedPivotKey = null, $parentKey = null, $relatedKey = null) + { + $foreignPivotKey = $foreignPivotKey ?: $this->getForeignKey(); + + // For the inverse of the polymorphic many-to-many relations, we will change + // the way we determine the foreign and other keys, as it is the opposite + // of the morph-to-many method since we're figuring out these inverses. + $relatedPivotKey = $relatedPivotKey ?: $name.'_id'; + + return $this->morphToMany( + $related, $name, $table, $foreignPivotKey, + $relatedPivotKey, $parentKey, $relatedKey, true + ); + } + + /** + * Get the relationship name of the belongsToMany relationship. + * + * @return string|null + */ + protected function guessBelongsToManyRelation() + { + $caller = Arr::first(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), function ($trace) { + return ! in_array( + $trace['function'], + array_merge(static::$manyMethods, ['guessBelongsToManyRelation']) + ); + }); + + return ! is_null($caller) ? $caller['function'] : null; + } + + /** + * Get the joining table name for a many-to-many relation. + * + * @param string $related + * @param \Illuminate\Database\Eloquent\Model|null $instance + * @return string + */ + public function joiningTable($related, $instance = null) + { + // The joining table name, by convention, is simply the snake cased models + // sorted alphabetically and concatenated with an underscore, so we can + // just sort the models and join them together to get the table name. + $segments = [ + $instance ? $instance->joiningTableSegment() + : Str::snake(class_basename($related)), + $this->joiningTableSegment(), + ]; + + // Now that we have the model names in an array we can just sort them and + // use the implode function to join them together with an underscores, + // which is typically used by convention within the database system. + sort($segments); + + return strtolower(implode('_', $segments)); + } + + /** + * Get this model's half of the intermediate table name for belongsToMany relationships. + * + * @return string + */ + public function joiningTableSegment() + { + return Str::snake(class_basename($this)); + } + + /** + * Determine if the model touches a given relation. + * + * @param string $relation + * @return bool + */ + public function touches($relation) + { + return in_array($relation, $this->touches); + } + + /** + * Touch the owning relations of the model. + * + * @return void + */ + public function touchOwners() + { + foreach ($this->touches as $relation) { + $this->$relation()->touch(); + + if ($this->$relation instanceof self) { + $this->$relation->fireModelEvent('saved', false); + + $this->$relation->touchOwners(); + } elseif ($this->$relation instanceof Collection) { + $this->$relation->each->touchOwners(); + } + } + } + + /** + * Get the polymorphic relationship columns. + * + * @param string $name + * @param string $type + * @param string $id + * @return array + */ + protected function getMorphs($name, $type, $id) + { + return [$type ?: $name.'_type', $id ?: $name.'_id']; + } + + /** + * Get the class name for polymorphic relations. + * + * @return string + */ + public function getMorphClass() + { + $morphMap = Relation::morphMap(); + + if (! empty($morphMap) && in_array(static::class, $morphMap)) { + return array_search(static::class, $morphMap, true); + } + + return static::class; + } + + /** + * Create a new model instance for a related model. + * + * @param string $class + * @return mixed + */ + protected function newRelatedInstance($class) + { + return tap(new $class, function ($instance) { + if (! $instance->getConnectionName()) { + $instance->setConnection($this->connection); + } + }); + } + + /** + * Get all the loaded relations for the instance. + * + * @return array + */ + public function getRelations() + { + return $this->relations; + } + + /** + * Get a specified relationship. + * + * @param string $relation + * @return mixed + */ + public function getRelation($relation) + { + return $this->relations[$relation]; + } + + /** + * Determine if the given relation is loaded. + * + * @param string $key + * @return bool + */ + public function relationLoaded($key) + { + return array_key_exists($key, $this->relations); + } + + /** + * Set the given relationship on the model. + * + * @param string $relation + * @param mixed $value + * @return $this + */ + public function setRelation($relation, $value) + { + $this->relations[$relation] = $value; + + return $this; + } + + /** + * Unset a loaded relationship. + * + * @param string $relation + * @return $this + */ + public function unsetRelation($relation) + { + unset($this->relations[$relation]); + + return $this; + } + + /** + * Set the entire relations array on the model. + * + * @param array $relations + * @return $this + */ + public function setRelations(array $relations) + { + $this->relations = $relations; + + return $this; + } + + /** + * Duplicate the instance and unset all the loaded relations. + * + * @return $this + */ + public function withoutRelations() + { + $model = clone $this; + + return $model->unsetRelations(); + } + + /** + * Unset all the loaded relations for the instance. + * + * @return $this + */ + public function unsetRelations() + { + $this->relations = []; + + return $this; + } + + /** + * Get the relationships that are touched on save. + * + * @return array + */ + public function getTouchedRelations() + { + return $this->touches; + } + + /** + * Set the relationships that are touched on save. + * + * @param array $touches + * @return $this + */ + public function setTouchedRelations(array $touches) + { + $this->touches = $touches; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php new file mode 100644 index 00000000..b9c049b3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php @@ -0,0 +1,149 @@ +usesTimestamps()) { + return false; + } + + $this->updateTimestamps(); + + return $this->save(); + } + + /** + * Update the creation and update timestamps. + * + * @return void + */ + protected function updateTimestamps() + { + $time = $this->freshTimestamp(); + + $updatedAtColumn = $this->getUpdatedAtColumn(); + + if (! is_null($updatedAtColumn) && ! $this->isDirty($updatedAtColumn)) { + $this->setUpdatedAt($time); + } + + $createdAtColumn = $this->getCreatedAtColumn(); + + if (! $this->exists && ! is_null($createdAtColumn) && ! $this->isDirty($createdAtColumn)) { + $this->setCreatedAt($time); + } + } + + /** + * Set the value of the "created at" attribute. + * + * @param mixed $value + * @return $this + */ + public function setCreatedAt($value) + { + $this->{$this->getCreatedAtColumn()} = $value; + + return $this; + } + + /** + * Set the value of the "updated at" attribute. + * + * @param mixed $value + * @return $this + */ + public function setUpdatedAt($value) + { + $this->{$this->getUpdatedAtColumn()} = $value; + + return $this; + } + + /** + * Get a fresh timestamp for the model. + * + * @return \Illuminate\Support\Carbon + */ + public function freshTimestamp() + { + return Date::now(); + } + + /** + * Get a fresh timestamp for the model. + * + * @return string + */ + public function freshTimestampString() + { + return $this->fromDateTime($this->freshTimestamp()); + } + + /** + * Determine if the model uses timestamps. + * + * @return bool + */ + public function usesTimestamps() + { + return $this->timestamps; + } + + /** + * Get the name of the "created at" column. + * + * @return string|null + */ + public function getCreatedAtColumn() + { + return static::CREATED_AT; + } + + /** + * Get the name of the "updated at" column. + * + * @return string|null + */ + public function getUpdatedAtColumn() + { + return static::UPDATED_AT; + } + + /** + * Get the fully qualified "created at" column. + * + * @return string + */ + public function getQualifiedCreatedAtColumn() + { + return $this->qualifyColumn($this->getCreatedAtColumn()); + } + + /** + * Get the fully qualified "updated at" column. + * + * @return string + */ + public function getQualifiedUpdatedAtColumn() + { + return $this->qualifyColumn($this->getUpdatedAtColumn()); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php new file mode 100644 index 00000000..7bd9ef93 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php @@ -0,0 +1,126 @@ +hidden; + } + + /** + * Set the hidden attributes for the model. + * + * @param array $hidden + * @return $this + */ + public function setHidden(array $hidden) + { + $this->hidden = $hidden; + + return $this; + } + + /** + * Add hidden attributes for the model. + * + * @param array|string|null $attributes + * @return void + */ + public function addHidden($attributes = null) + { + $this->hidden = array_merge( + $this->hidden, is_array($attributes) ? $attributes : func_get_args() + ); + } + + /** + * Get the visible attributes for the model. + * + * @return array + */ + public function getVisible() + { + return $this->visible; + } + + /** + * Set the visible attributes for the model. + * + * @param array $visible + * @return $this + */ + public function setVisible(array $visible) + { + $this->visible = $visible; + + return $this; + } + + /** + * Add visible attributes for the model. + * + * @param array|string|null $attributes + * @return void + */ + public function addVisible($attributes = null) + { + $this->visible = array_merge( + $this->visible, is_array($attributes) ? $attributes : func_get_args() + ); + } + + /** + * Make the given, typically hidden, attributes visible. + * + * @param array|string $attributes + * @return $this + */ + public function makeVisible($attributes) + { + $this->hidden = array_diff($this->hidden, (array) $attributes); + + if (! empty($this->visible)) { + $this->addVisible($attributes); + } + + return $this; + } + + /** + * Make the given, typically visible, attributes hidden. + * + * @param array|string $attributes + * @return $this + */ + public function makeHidden($attributes) + { + $attributes = (array) $attributes; + + $this->visible = array_diff($this->visible, $attributes); + + $this->hidden = array_unique(array_merge($this->hidden, $attributes)); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php new file mode 100644 index 00000000..f2615421 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php @@ -0,0 +1,494 @@ +=', $count = 1, $boolean = 'and', Closure $callback = null) + { + if (is_string($relation)) { + if (strpos($relation, '.') !== false) { + return $this->hasNested($relation, $operator, $count, $boolean, $callback); + } + + $relation = $this->getRelationWithoutConstraints($relation); + } + + if ($relation instanceof MorphTo) { + throw new RuntimeException('Please use whereHasMorph() for MorphTo relationships.'); + } + + // If we only need to check for the existence of the relation, then we can optimize + // the subquery to only run a "where exists" clause instead of this full "count" + // clause. This will make these queries run much faster compared with a count. + $method = $this->canUseExistsForExistenceCheck($operator, $count) + ? 'getRelationExistenceQuery' + : 'getRelationExistenceCountQuery'; + + $hasQuery = $relation->{$method}( + $relation->getRelated()->newQueryWithoutRelationships(), $this + ); + + // Next we will call any given callback as an "anonymous" scope so they can get the + // proper logical grouping of the where clauses if needed by this Eloquent query + // builder. Then, we will be ready to finalize and return this query instance. + if ($callback) { + $hasQuery->callScope($callback); + } + + return $this->addHasWhere( + $hasQuery, $relation, $operator, $count, $boolean + ); + } + + /** + * Add nested relationship count / exists conditions to the query. + * + * Sets up recursive call to whereHas until we finish the nested relation. + * + * @param string $relations + * @param string $operator + * @param int $count + * @param string $boolean + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + protected function hasNested($relations, $operator = '>=', $count = 1, $boolean = 'and', $callback = null) + { + $relations = explode('.', $relations); + + $doesntHave = $operator === '<' && $count === 1; + + if ($doesntHave) { + $operator = '>='; + $count = 1; + } + + $closure = function ($q) use (&$closure, &$relations, $operator, $count, $callback) { + // In order to nest "has", we need to add count relation constraints on the + // callback Closure. We'll do this by simply passing the Closure its own + // reference to itself so it calls itself recursively on each segment. + count($relations) > 1 + ? $q->whereHas(array_shift($relations), $closure) + : $q->has(array_shift($relations), $operator, $count, 'and', $callback); + }; + + return $this->has(array_shift($relations), $doesntHave ? '<' : '>=', 1, $boolean, $closure); + } + + /** + * Add a relationship count / exists condition to the query with an "or". + * + * @param string $relation + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orHas($relation, $operator = '>=', $count = 1) + { + return $this->has($relation, $operator, $count, 'or'); + } + + /** + * Add a relationship count / exists condition to the query. + * + * @param string $relation + * @param string $boolean + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function doesntHave($relation, $boolean = 'and', Closure $callback = null) + { + return $this->has($relation, '<', 1, $boolean, $callback); + } + + /** + * Add a relationship count / exists condition to the query with an "or". + * + * @param string $relation + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orDoesntHave($relation) + { + return $this->doesntHave($relation, 'or'); + } + + /** + * Add a relationship count / exists condition to the query with where clauses. + * + * @param string $relation + * @param \Closure|null $callback + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function whereHas($relation, Closure $callback = null, $operator = '>=', $count = 1) + { + return $this->has($relation, $operator, $count, 'and', $callback); + } + + /** + * Add a relationship count / exists condition to the query with where clauses and an "or". + * + * @param string $relation + * @param \Closure $callback + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orWhereHas($relation, Closure $callback = null, $operator = '>=', $count = 1) + { + return $this->has($relation, $operator, $count, 'or', $callback); + } + + /** + * Add a relationship count / exists condition to the query with where clauses. + * + * @param string $relation + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function whereDoesntHave($relation, Closure $callback = null) + { + return $this->doesntHave($relation, 'and', $callback); + } + + /** + * Add a relationship count / exists condition to the query with where clauses and an "or". + * + * @param string $relation + * @param \Closure $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orWhereDoesntHave($relation, Closure $callback = null) + { + return $this->doesntHave($relation, 'or', $callback); + } + + /** + * Add a polymorphic relationship count / exists condition to the query. + * + * @param string $relation + * @param string|array $types + * @param string $operator + * @param int $count + * @param string $boolean + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null) + { + $relation = $this->getRelationWithoutConstraints($relation); + + $types = (array) $types; + + if ($types === ['*']) { + $types = $this->model->newModelQuery()->distinct()->pluck($relation->getMorphType())->filter()->all(); + + foreach ($types as &$type) { + $type = Relation::getMorphedModel($type) ?? $type; + } + } + + return $this->where(function ($query) use ($relation, $callback, $operator, $count, $types) { + foreach ($types as $type) { + $query->orWhere(function ($query) use ($relation, $callback, $operator, $count, $type) { + $belongsTo = $this->getBelongsToRelation($relation, $type); + + if ($callback) { + $callback = function ($query) use ($callback, $type) { + return $callback($query, $type); + }; + } + + $query->where($this->query->from.'.'.$relation->getMorphType(), '=', (new $type)->getMorphClass()) + ->whereHas($belongsTo, $callback, $operator, $count); + }); + } + }, null, null, $boolean); + } + + /** + * Get the BelongsTo relationship for a single polymorphic type. + * + * @param \Illuminate\Database\Eloquent\Relations\MorphTo $relation + * @param string $type + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + protected function getBelongsToRelation(MorphTo $relation, $type) + { + $belongsTo = Relation::noConstraints(function () use ($relation, $type) { + return $this->model->belongsTo( + $type, + $relation->getForeignKeyName(), + $relation->getOwnerKeyName() + ); + }); + + $belongsTo->getQuery()->mergeConstraintsFrom($relation->getQuery()); + + return $belongsTo; + } + + /** + * Add a polymorphic relationship count / exists condition to the query with an "or". + * + * @param string $relation + * @param string|array $types + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orHasMorph($relation, $types, $operator = '>=', $count = 1) + { + return $this->hasMorph($relation, $types, $operator, $count, 'or'); + } + + /** + * Add a polymorphic relationship count / exists condition to the query. + * + * @param string $relation + * @param string|array $types + * @param string $boolean + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function doesntHaveMorph($relation, $types, $boolean = 'and', Closure $callback = null) + { + return $this->hasMorph($relation, $types, '<', 1, $boolean, $callback); + } + + /** + * Add a polymorphic relationship count / exists condition to the query with an "or". + * + * @param string $relation + * @param string|array $types + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orDoesntHaveMorph($relation, $types) + { + return $this->doesntHaveMorph($relation, $types, 'or'); + } + + /** + * Add a polymorphic relationship count / exists condition to the query with where clauses. + * + * @param string $relation + * @param string|array $types + * @param \Closure|null $callback + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function whereHasMorph($relation, $types, Closure $callback = null, $operator = '>=', $count = 1) + { + return $this->hasMorph($relation, $types, $operator, $count, 'and', $callback); + } + + /** + * Add a polymorphic relationship count / exists condition to the query with where clauses and an "or". + * + * @param string $relation + * @param string|array $types + * @param \Closure $callback + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orWhereHasMorph($relation, $types, Closure $callback = null, $operator = '>=', $count = 1) + { + return $this->hasMorph($relation, $types, $operator, $count, 'or', $callback); + } + + /** + * Add a polymorphic relationship count / exists condition to the query with where clauses. + * + * @param string $relation + * @param string|array $types + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function whereDoesntHaveMorph($relation, $types, Closure $callback = null) + { + return $this->doesntHaveMorph($relation, $types, 'and', $callback); + } + + /** + * Add a polymorphic relationship count / exists condition to the query with where clauses and an "or". + * + * @param string $relation + * @param string|array $types + * @param \Closure $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orWhereDoesntHaveMorph($relation, $types, Closure $callback = null) + { + return $this->doesntHaveMorph($relation, $types, 'or', $callback); + } + + /** + * Add subselect queries to count the relations. + * + * @param mixed $relations + * @return $this + */ + public function withCount($relations) + { + if (empty($relations)) { + return $this; + } + + if (is_null($this->query->columns)) { + $this->query->select([$this->query->from.'.*']); + } + + $relations = is_array($relations) ? $relations : func_get_args(); + + foreach ($this->parseWithRelations($relations) as $name => $constraints) { + // First we will determine if the name has been aliased using an "as" clause on the name + // and if it has we will extract the actual relationship name and the desired name of + // the resulting column. This allows multiple counts on the same relationship name. + $segments = explode(' ', $name); + + unset($alias); + + if (count($segments) === 3 && Str::lower($segments[1]) === 'as') { + [$name, $alias] = [$segments[0], $segments[2]]; + } + + $relation = $this->getRelationWithoutConstraints($name); + + // Here we will get the relationship count query and prepare to add it to the main query + // as a sub-select. First, we'll get the "has" query and use that to get the relation + // count query. We will normalize the relation name then append _count as the name. + $query = $relation->getRelationExistenceCountQuery( + $relation->getRelated()->newQuery(), $this + ); + + $query->callScope($constraints); + + $query = $query->mergeConstraintsFrom($relation->getQuery())->toBase(); + + if (count($query->columns) > 1) { + $query->columns = [$query->columns[0]]; + + $query->bindings['select'] = []; + } + + // Finally we will add the proper result column alias to the query and run the subselect + // statement against the query builder. Then we will return the builder instance back + // to the developer for further constraint chaining that needs to take place on it. + $column = $alias ?? Str::snake($name.'_count'); + + $this->selectSub($query, $column); + } + + return $this; + } + + /** + * Add the "has" condition where clause to the query. + * + * @param \Illuminate\Database\Eloquent\Builder $hasQuery + * @param \Illuminate\Database\Eloquent\Relations\Relation $relation + * @param string $operator + * @param int $count + * @param string $boolean + * @return \Illuminate\Database\Eloquent\Builder|static + */ + protected function addHasWhere(Builder $hasQuery, Relation $relation, $operator, $count, $boolean) + { + $hasQuery->mergeConstraintsFrom($relation->getQuery()); + + return $this->canUseExistsForExistenceCheck($operator, $count) + ? $this->addWhereExistsQuery($hasQuery->toBase(), $boolean, $operator === '<' && $count === 1) + : $this->addWhereCountQuery($hasQuery->toBase(), $operator, $count, $boolean); + } + + /** + * Merge the where constraints from another query to the current query. + * + * @param \Illuminate\Database\Eloquent\Builder $from + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function mergeConstraintsFrom(Builder $from) + { + $whereBindings = $from->getQuery()->getRawBindings()['where'] ?? []; + + // Here we have some other query that we want to merge the where constraints from. We will + // copy over any where constraints on the query as well as remove any global scopes the + // query might have removed. Then we will return ourselves with the finished merging. + return $this->withoutGlobalScopes( + $from->removedScopes() + )->mergeWheres( + $from->getQuery()->wheres, $whereBindings + ); + } + + /** + * Add a sub-query count clause to this query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $operator + * @param int $count + * @param string $boolean + * @return $this + */ + protected function addWhereCountQuery(QueryBuilder $query, $operator = '>=', $count = 1, $boolean = 'and') + { + $this->query->addBinding($query->getBindings(), 'where'); + + return $this->where( + new Expression('('.$query->toSql().')'), + $operator, + is_numeric($count) ? new Expression($count) : $count, + $boolean + ); + } + + /** + * Get the "has relation" base query instance. + * + * @param string $relation + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + protected function getRelationWithoutConstraints($relation) + { + return Relation::noConstraints(function () use ($relation) { + return $this->getModel()->{$relation}(); + }); + } + + /** + * Check if we can run an "exists" query to optimize performance. + * + * @param string $operator + * @param int $count + * @return bool + */ + protected function canUseExistsForExistenceCheck($operator, $count) + { + return ($operator === '>=' || $operator === '<') && $count === 1; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php new file mode 100644 index 00000000..ae468238 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php @@ -0,0 +1,326 @@ +faker = $faker; + } + + /** + * Create a new factory container. + * + * @param \Faker\Generator $faker + * @param string|null $pathToFactories + * @return static + */ + public static function construct(Faker $faker, $pathToFactories = null) + { + $pathToFactories = $pathToFactories ?: database_path('factories'); + + return (new static($faker))->load($pathToFactories); + } + + /** + * Define a class with a given short-name. + * + * @param string $class + * @param string $name + * @param callable $attributes + * @return $this + */ + public function defineAs($class, $name, callable $attributes) + { + return $this->define($class, $attributes, $name); + } + + /** + * Define a class with a given set of attributes. + * + * @param string $class + * @param callable $attributes + * @param string $name + * @return $this + */ + public function define($class, callable $attributes, $name = 'default') + { + $this->definitions[$class][$name] = $attributes; + + return $this; + } + + /** + * Define a state with a given set of attributes. + * + * @param string $class + * @param string $state + * @param callable|array $attributes + * @return $this + */ + public function state($class, $state, $attributes) + { + $this->states[$class][$state] = $attributes; + + return $this; + } + + /** + * Define a callback to run after making a model. + * + * @param string $class + * @param callable $callback + * @param string $name + * @return $this + */ + public function afterMaking($class, callable $callback, $name = 'default') + { + $this->afterMaking[$class][$name][] = $callback; + + return $this; + } + + /** + * Define a callback to run after making a model with given state. + * + * @param string $class + * @param string $state + * @param callable $callback + * @return $this + */ + public function afterMakingState($class, $state, callable $callback) + { + return $this->afterMaking($class, $callback, $state); + } + + /** + * Define a callback to run after creating a model. + * + * @param string $class + * @param callable $callback + * @param string $name + * @return $this + */ + public function afterCreating($class, callable $callback, $name = 'default') + { + $this->afterCreating[$class][$name][] = $callback; + + return $this; + } + + /** + * Define a callback to run after creating a model with given state. + * + * @param string $class + * @param string $state + * @param callable $callback + * @return $this + */ + public function afterCreatingState($class, $state, callable $callback) + { + return $this->afterCreating($class, $callback, $state); + } + + /** + * Create an instance of the given model and persist it to the database. + * + * @param string $class + * @param array $attributes + * @return mixed + */ + public function create($class, array $attributes = []) + { + return $this->of($class)->create($attributes); + } + + /** + * Create an instance of the given model and type and persist it to the database. + * + * @param string $class + * @param string $name + * @param array $attributes + * @return mixed + */ + public function createAs($class, $name, array $attributes = []) + { + return $this->of($class, $name)->create($attributes); + } + + /** + * Create an instance of the given model. + * + * @param string $class + * @param array $attributes + * @return mixed + */ + public function make($class, array $attributes = []) + { + return $this->of($class)->make($attributes); + } + + /** + * Create an instance of the given model and type. + * + * @param string $class + * @param string $name + * @param array $attributes + * @return mixed + */ + public function makeAs($class, $name, array $attributes = []) + { + return $this->of($class, $name)->make($attributes); + } + + /** + * Get the raw attribute array for a given named model. + * + * @param string $class + * @param string $name + * @param array $attributes + * @return array + */ + public function rawOf($class, $name, array $attributes = []) + { + return $this->raw($class, $attributes, $name); + } + + /** + * Get the raw attribute array for a given model. + * + * @param string $class + * @param array $attributes + * @param string $name + * @return array + */ + public function raw($class, array $attributes = [], $name = 'default') + { + return array_merge( + call_user_func($this->definitions[$class][$name], $this->faker), $attributes + ); + } + + /** + * Create a builder for the given model. + * + * @param string $class + * @param string $name + * @return \Illuminate\Database\Eloquent\FactoryBuilder + */ + public function of($class, $name = 'default') + { + return new FactoryBuilder( + $class, $name, $this->definitions, $this->states, + $this->afterMaking, $this->afterCreating, $this->faker + ); + } + + /** + * Load factories from path. + * + * @param string $path + * @return $this + */ + public function load($path) + { + $factory = $this; + + if (is_dir($path)) { + foreach (Finder::create()->files()->name('*.php')->in($path) as $file) { + require $file->getRealPath(); + } + } + + return $factory; + } + + /** + * Determine if the given offset exists. + * + * @param string $offset + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->definitions[$offset]); + } + + /** + * Get the value of the given offset. + * + * @param string $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->make($offset); + } + + /** + * Set the given offset to the given value. + * + * @param string $offset + * @param callable $value + * @return void + */ + public function offsetSet($offset, $value) + { + $this->define($offset, $value); + } + + /** + * Unset the value at the given offset. + * + * @param string $offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->definitions[$offset]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php new file mode 100644 index 00000000..97a96564 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php @@ -0,0 +1,458 @@ +name = $name; + $this->class = $class; + $this->faker = $faker; + $this->states = $states; + $this->definitions = $definitions; + $this->afterMaking = $afterMaking; + $this->afterCreating = $afterCreating; + } + + /** + * Set the amount of models you wish to create / make. + * + * @param int $amount + * @return $this + */ + public function times($amount) + { + $this->amount = $amount; + + return $this; + } + + /** + * Set the state to be applied to the model. + * + * @param string $state + * @return $this + */ + public function state($state) + { + return $this->states([$state]); + } + + /** + * Set the states to be applied to the model. + * + * @param array|mixed $states + * @return $this + */ + public function states($states) + { + $this->activeStates = is_array($states) ? $states : func_get_args(); + + return $this; + } + + /** + * Set the database connection on which the model instance should be persisted. + * + * @param string $name + * @return $this + */ + public function connection($name) + { + $this->connection = $name; + + return $this; + } + + /** + * Create a model and persist it in the database if requested. + * + * @param array $attributes + * @return \Closure + */ + public function lazy(array $attributes = []) + { + return function () use ($attributes) { + return $this->create($attributes); + }; + } + + /** + * Create a collection of models and persist them to the database. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|mixed + */ + public function create(array $attributes = []) + { + $results = $this->make($attributes); + + if ($results instanceof Model) { + $this->store(collect([$results])); + + $this->callAfterCreating(collect([$results])); + } else { + $this->store($results); + + $this->callAfterCreating($results); + } + + return $results; + } + + /** + * Create a collection of models and persist them to the database. + * + * @param iterable $records + * @return \Illuminate\Database\Eloquent\Collection|mixed + */ + public function createMany(iterable $records) + { + return (new $this->class)->newCollection(array_map(function ($attribute) { + return $this->create($attribute); + }, $records)); + } + + /** + * Set the connection name on the results and store them. + * + * @param \Illuminate\Support\Collection $results + * @return void + */ + protected function store($results) + { + $results->each(function ($model) { + if (! isset($this->connection)) { + $model->setConnection($model->newQueryWithoutScopes()->getConnection()->getName()); + } + + $model->save(); + }); + } + + /** + * Create a collection of models. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|mixed + */ + public function make(array $attributes = []) + { + if ($this->amount === null) { + return tap($this->makeInstance($attributes), function ($instance) { + $this->callAfterMaking(collect([$instance])); + }); + } + + if ($this->amount < 1) { + return (new $this->class)->newCollection(); + } + + $instances = (new $this->class)->newCollection(array_map(function () use ($attributes) { + return $this->makeInstance($attributes); + }, range(1, $this->amount))); + + $this->callAfterMaking($instances); + + return $instances; + } + + /** + * Create an array of raw attribute arrays. + * + * @param array $attributes + * @return mixed + */ + public function raw(array $attributes = []) + { + if ($this->amount === null) { + return $this->getRawAttributes($attributes); + } + + if ($this->amount < 1) { + return []; + } + + return array_map(function () use ($attributes) { + return $this->getRawAttributes($attributes); + }, range(1, $this->amount)); + } + + /** + * Get a raw attributes array for the model. + * + * @param array $attributes + * @return mixed + * + * @throws \InvalidArgumentException + */ + protected function getRawAttributes(array $attributes = []) + { + if (! isset($this->definitions[$this->class][$this->name])) { + throw new InvalidArgumentException("Unable to locate factory with name [{$this->name}] [{$this->class}]."); + } + + $definition = call_user_func( + $this->definitions[$this->class][$this->name], + $this->faker, $attributes + ); + + return $this->expandAttributes( + array_merge($this->applyStates($definition, $attributes), $attributes) + ); + } + + /** + * Make an instance of the model with the given attributes. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + protected function makeInstance(array $attributes = []) + { + return Model::unguarded(function () use ($attributes) { + $instance = new $this->class( + $this->getRawAttributes($attributes) + ); + + if (isset($this->connection)) { + $instance->setConnection($this->connection); + } + + return $instance; + }); + } + + /** + * Apply the active states to the model definition array. + * + * @param array $definition + * @param array $attributes + * @return array + * + * @throws \InvalidArgumentException + */ + protected function applyStates(array $definition, array $attributes = []) + { + foreach ($this->activeStates as $state) { + if (! isset($this->states[$this->class][$state])) { + if ($this->stateHasAfterCallback($state)) { + continue; + } + + throw new InvalidArgumentException("Unable to locate [{$state}] state for [{$this->class}]."); + } + + $definition = array_merge( + $definition, + $this->stateAttributes($state, $attributes) + ); + } + + return $definition; + } + + /** + * Get the state attributes. + * + * @param string $state + * @param array $attributes + * @return array + */ + protected function stateAttributes($state, array $attributes) + { + $stateAttributes = $this->states[$this->class][$state]; + + if (! is_callable($stateAttributes)) { + return $stateAttributes; + } + + return $stateAttributes($this->faker, $attributes); + } + + /** + * Expand all attributes to their underlying values. + * + * @param array $attributes + * @return array + */ + protected function expandAttributes(array $attributes) + { + foreach ($attributes as &$attribute) { + if (is_callable($attribute) && ! is_string($attribute) && ! is_array($attribute)) { + $attribute = $attribute($attributes); + } + + if ($attribute instanceof static) { + $attribute = $attribute->create()->getKey(); + } + + if ($attribute instanceof Model) { + $attribute = $attribute->getKey(); + } + } + + return $attributes; + } + + /** + * Run after making callbacks on a collection of models. + * + * @param \Illuminate\Support\Collection $models + * @return void + */ + public function callAfterMaking($models) + { + $this->callAfter($this->afterMaking, $models); + } + + /** + * Run after creating callbacks on a collection of models. + * + * @param \Illuminate\Support\Collection $models + * @return void + */ + public function callAfterCreating($models) + { + $this->callAfter($this->afterCreating, $models); + } + + /** + * Call after callbacks for each model and state. + * + * @param array $afterCallbacks + * @param \Illuminate\Support\Collection $models + * @return void + */ + protected function callAfter(array $afterCallbacks, $models) + { + $states = array_merge([$this->name], $this->activeStates); + + $models->each(function ($model) use ($states, $afterCallbacks) { + foreach ($states as $state) { + $this->callAfterCallbacks($afterCallbacks, $model, $state); + } + }); + } + + /** + * Call after callbacks for each model and state. + * + * @param array $afterCallbacks + * @param \Illuminate\Database\Eloquent\Model $model + * @param string $state + * @return void + */ + protected function callAfterCallbacks(array $afterCallbacks, $model, $state) + { + if (! isset($afterCallbacks[$this->class][$state])) { + return; + } + + foreach ($afterCallbacks[$this->class][$state] as $callback) { + $callback($model, $this->faker); + } + } + + /** + * Determine if the given state has an "after" callback. + * + * @param string $state + * @return bool + */ + protected function stateHasAfterCallback($state) + { + return isset($this->afterMaking[$this->class][$state]) || + isset($this->afterCreating[$this->class][$state]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/HigherOrderBuilderProxy.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/HigherOrderBuilderProxy.php new file mode 100644 index 00000000..d238c2fe --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/HigherOrderBuilderProxy.php @@ -0,0 +1,49 @@ +method = $method; + $this->builder = $builder; + } + + /** + * Proxy a scope call onto the query builder. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->builder->{$this->method}(function ($value) use ($method, $parameters) { + return $value->{$method}(...$parameters); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/JsonEncodingException.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/JsonEncodingException.php new file mode 100644 index 00000000..d6956da1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/JsonEncodingException.php @@ -0,0 +1,35 @@ +getKey().'] to JSON: '.$message); + } + + /** + * Create a new JSON encoding exception for an attribute. + * + * @param mixed $model + * @param mixed $key + * @param string $message + * @return static + */ + public static function forAttribute($model, $key, $message) + { + $class = get_class($model); + + return new static("Unable to encode attribute [{$key}] for model [{$class}] to JSON: {$message}."); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php new file mode 100755 index 00000000..7c81aae5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php @@ -0,0 +1,10 @@ +bootIfNotBooted(); + + $this->initializeTraits(); + + $this->syncOriginal(); + + $this->fill($attributes); + } + + /** + * Check if the model needs to be booted and if so, do it. + * + * @return void + */ + protected function bootIfNotBooted() + { + if (! isset(static::$booted[static::class])) { + static::$booted[static::class] = true; + + $this->fireModelEvent('booting', false); + + static::boot(); + + $this->fireModelEvent('booted', false); + } + } + + /** + * The "booting" method of the model. + * + * @return void + */ + protected static function boot() + { + static::bootTraits(); + } + + /** + * Boot all of the bootable traits on the model. + * + * @return void + */ + protected static function bootTraits() + { + $class = static::class; + + $booted = []; + + static::$traitInitializers[$class] = []; + + foreach (class_uses_recursive($class) as $trait) { + $method = 'boot'.class_basename($trait); + + if (method_exists($class, $method) && ! in_array($method, $booted)) { + forward_static_call([$class, $method]); + + $booted[] = $method; + } + + if (method_exists($class, $method = 'initialize'.class_basename($trait))) { + static::$traitInitializers[$class][] = $method; + + static::$traitInitializers[$class] = array_unique( + static::$traitInitializers[$class] + ); + } + } + } + + /** + * Initialize any initializable traits on the model. + * + * @return void + */ + protected function initializeTraits() + { + foreach (static::$traitInitializers[static::class] as $method) { + $this->{$method}(); + } + } + + /** + * Clear the list of booted models so they will be re-booted. + * + * @return void + */ + public static function clearBootedModels() + { + static::$booted = []; + + static::$globalScopes = []; + } + + /** + * Disables relationship model touching for the current class during given callback scope. + * + * @param callable $callback + * @return void + */ + public static function withoutTouching(callable $callback) + { + static::withoutTouchingOn([static::class], $callback); + } + + /** + * Disables relationship model touching for the given model classes during given callback scope. + * + * @param array $models + * @param callable $callback + * @return void + */ + public static function withoutTouchingOn(array $models, callable $callback) + { + static::$ignoreOnTouch = array_values(array_merge(static::$ignoreOnTouch, $models)); + + try { + $callback(); + } finally { + static::$ignoreOnTouch = array_values(array_diff(static::$ignoreOnTouch, $models)); + } + } + + /** + * Determine if the given model is ignoring touches. + * + * @param string|null $class + * @return bool + */ + public static function isIgnoringTouch($class = null) + { + $class = $class ?: static::class; + + if (! get_class_vars($class)['timestamps'] || ! $class::UPDATED_AT) { + return true; + } + + foreach (static::$ignoreOnTouch as $ignoredClass) { + if ($class === $ignoredClass || is_subclass_of($class, $ignoredClass)) { + return true; + } + } + + return false; + } + + /** + * Fill the model with an array of attributes. + * + * @param array $attributes + * @return $this + * + * @throws \Illuminate\Database\Eloquent\MassAssignmentException + */ + public function fill(array $attributes) + { + $totallyGuarded = $this->totallyGuarded(); + + foreach ($this->fillableFromArray($attributes) as $key => $value) { + $key = $this->removeTableFromKey($key); + + // The developers may choose to place some attributes in the "fillable" array + // which means only those attributes may be set through mass assignment to + // the model, and all others will just get ignored for security reasons. + if ($this->isFillable($key)) { + $this->setAttribute($key, $value); + } elseif ($totallyGuarded) { + throw new MassAssignmentException(sprintf( + 'Add [%s] to fillable property to allow mass assignment on [%s].', + $key, get_class($this) + )); + } + } + + return $this; + } + + /** + * Fill the model with an array of attributes. Force mass assignment. + * + * @param array $attributes + * @return $this + */ + public function forceFill(array $attributes) + { + return static::unguarded(function () use ($attributes) { + return $this->fill($attributes); + }); + } + + /** + * Qualify the given column name by the model's table. + * + * @param string $column + * @return string + */ + public function qualifyColumn($column) + { + if (Str::contains($column, '.')) { + return $column; + } + + return $this->getTable().'.'.$column; + } + + /** + * Remove the table name from a given key. + * + * @param string $key + * @return string + */ + protected function removeTableFromKey($key) + { + return $key; + } + + /** + * Create a new instance of the given model. + * + * @param array $attributes + * @param bool $exists + * @return static + */ + public function newInstance($attributes = [], $exists = false) + { + // This method just provides a convenient way for us to generate fresh model + // instances of this current model. It is particularly useful during the + // hydration of new objects via the Eloquent query builder instances. + $model = new static((array) $attributes); + + $model->exists = $exists; + + $model->setConnection( + $this->getConnectionName() + ); + + $model->setTable($this->getTable()); + + return $model; + } + + /** + * Create a new model instance that is existing. + * + * @param array $attributes + * @param string|null $connection + * @return static + */ + public function newFromBuilder($attributes = [], $connection = null) + { + $model = $this->newInstance([], true); + + $model->setRawAttributes((array) $attributes, true); + + $model->setConnection($connection ?: $this->getConnectionName()); + + $model->fireModelEvent('retrieved', false); + + return $model; + } + + /** + * Begin querying the model on a given connection. + * + * @param string|null $connection + * @return \Illuminate\Database\Eloquent\Builder + */ + public static function on($connection = null) + { + // First we will just create a fresh instance of this model, and then we can set the + // connection on the model so that it is used for the queries we execute, as well + // as being set on every relation we retrieve without a custom connection name. + $instance = new static; + + $instance->setConnection($connection); + + return $instance->newQuery(); + } + + /** + * Begin querying the model on the write connection. + * + * @return \Illuminate\Database\Query\Builder + */ + public static function onWriteConnection() + { + return static::query()->useWritePdo(); + } + + /** + * Get all of the models from the database. + * + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Collection|static[] + */ + public static function all($columns = ['*']) + { + return static::query()->get( + is_array($columns) ? $columns : func_get_args() + ); + } + + /** + * Begin querying a model with eager loading. + * + * @param array|string $relations + * @return \Illuminate\Database\Eloquent\Builder + */ + public static function with($relations) + { + return static::query()->with( + is_string($relations) ? func_get_args() : $relations + ); + } + + /** + * Eager load relations on the model. + * + * @param array|string $relations + * @return $this + */ + public function load($relations) + { + $query = $this->newQueryWithoutRelationships()->with( + is_string($relations) ? func_get_args() : $relations + ); + + $query->eagerLoadRelations([$this]); + + return $this; + } + + /** + * Eager load relations on the model if they are not already eager loaded. + * + * @param array|string $relations + * @return $this + */ + public function loadMissing($relations) + { + $relations = is_string($relations) ? func_get_args() : $relations; + + $this->newCollection([$this])->loadMissing($relations); + + return $this; + } + + /** + * Eager load relation counts on the model. + * + * @param array|string $relations + * @return $this + */ + public function loadCount($relations) + { + $relations = is_string($relations) ? func_get_args() : $relations; + + $this->newCollection([$this])->loadCount($relations); + + return $this; + } + + /** + * Increment a column's value by a given amount. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @return int + */ + protected function increment($column, $amount = 1, array $extra = []) + { + return $this->incrementOrDecrement($column, $amount, $extra, 'increment'); + } + + /** + * Decrement a column's value by a given amount. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @return int + */ + protected function decrement($column, $amount = 1, array $extra = []) + { + return $this->incrementOrDecrement($column, $amount, $extra, 'decrement'); + } + + /** + * Run the increment or decrement method on the model. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @param string $method + * @return int + */ + protected function incrementOrDecrement($column, $amount, $extra, $method) + { + $query = $this->newQueryWithoutRelationships(); + + if (! $this->exists) { + return $query->{$method}($column, $amount, $extra); + } + + $this->incrementOrDecrementAttributeValue($column, $amount, $extra, $method); + + return $query->where( + $this->getKeyName(), $this->getKey() + )->{$method}($column, $amount, $extra); + } + + /** + * Increment the underlying attribute value and sync with original. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @param string $method + * @return void + */ + protected function incrementOrDecrementAttributeValue($column, $amount, $extra, $method) + { + $this->{$column} = $this->{$column} + ($method === 'increment' ? $amount : $amount * -1); + + $this->forceFill($extra); + + $this->syncOriginalAttribute($column); + } + + /** + * Update the model in the database. + * + * @param array $attributes + * @param array $options + * @return bool + */ + public function update(array $attributes = [], array $options = []) + { + if (! $this->exists) { + return false; + } + + return $this->fill($attributes)->save($options); + } + + /** + * Save the model and all of its relationships. + * + * @return bool + */ + public function push() + { + if (! $this->save()) { + return false; + } + + // To sync all of the relationships to the database, we will simply spin through + // the relationships and save each model via this "push" method, which allows + // us to recurse into all of these nested relations for the model instance. + foreach ($this->relations as $models) { + $models = $models instanceof Collection + ? $models->all() : [$models]; + + foreach (array_filter($models) as $model) { + if (! $model->push()) { + return false; + } + } + } + + return true; + } + + /** + * Save the model to the database. + * + * @param array $options + * @return bool + */ + public function save(array $options = []) + { + $query = $this->newModelQuery(); + + // If the "saving" event returns false we'll bail out of the save and return + // false, indicating that the save failed. This provides a chance for any + // listeners to cancel save operations if validations fail or whatever. + if ($this->fireModelEvent('saving') === false) { + return false; + } + + // If the model already exists in the database we can just update our record + // that is already in this database using the current IDs in this "where" + // clause to only update this model. Otherwise, we'll just insert them. + if ($this->exists) { + $saved = $this->isDirty() ? + $this->performUpdate($query) : true; + } + + // If the model is brand new, we'll insert it into our database and set the + // ID attribute on the model to the value of the newly inserted row's ID + // which is typically an auto-increment value managed by the database. + else { + $saved = $this->performInsert($query); + + if (! $this->getConnectionName() && + $connection = $query->getConnection()) { + $this->setConnection($connection->getName()); + } + } + + // If the model is successfully saved, we need to do a few more things once + // that is done. We will call the "saved" method here to run any actions + // we need to happen after a model gets successfully saved right here. + if ($saved) { + $this->finishSave($options); + } + + return $saved; + } + + /** + * Save the model to the database using transaction. + * + * @param array $options + * @return bool + * + * @throws \Throwable + */ + public function saveOrFail(array $options = []) + { + return $this->getConnection()->transaction(function () use ($options) { + return $this->save($options); + }); + } + + /** + * Perform any actions that are necessary after the model is saved. + * + * @param array $options + * @return void + */ + protected function finishSave(array $options) + { + $this->fireModelEvent('saved', false); + + if ($this->isDirty() && ($options['touch'] ?? true)) { + $this->touchOwners(); + } + + $this->syncOriginal(); + } + + /** + * Perform a model update operation. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return bool + */ + protected function performUpdate(Builder $query) + { + // If the updating event returns false, we will cancel the update operation so + // developers can hook Validation systems into their models and cancel this + // operation if the model does not pass validation. Otherwise, we update. + if ($this->fireModelEvent('updating') === false) { + return false; + } + + // First we need to create a fresh query instance and touch the creation and + // update timestamp on the model which are maintained by us for developer + // convenience. Then we will just continue saving the model instances. + if ($this->usesTimestamps()) { + $this->updateTimestamps(); + } + + // Once we have run the update operation, we will fire the "updated" event for + // this model instance. This will allow developers to hook into these after + // models are updated, giving them a chance to do any special processing. + $dirty = $this->getDirty(); + + if (count($dirty) > 0) { + $this->setKeysForSaveQuery($query)->update($dirty); + + $this->syncChanges(); + + $this->fireModelEvent('updated', false); + } + + return true; + } + + /** + * Set the keys for a save update query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function setKeysForSaveQuery(Builder $query) + { + $query->where($this->getKeyName(), '=', $this->getKeyForSaveQuery()); + + return $query; + } + + /** + * Get the primary key value for a save query. + * + * @return mixed + */ + protected function getKeyForSaveQuery() + { + return $this->original[$this->getKeyName()] + ?? $this->getKey(); + } + + /** + * Perform a model insert operation. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return bool + */ + protected function performInsert(Builder $query) + { + if ($this->fireModelEvent('creating') === false) { + return false; + } + + // First we'll need to create a fresh query instance and touch the creation and + // update timestamps on this model, which are maintained by us for developer + // convenience. After, we will just continue saving these model instances. + if ($this->usesTimestamps()) { + $this->updateTimestamps(); + } + + // If the model has an incrementing key, we can use the "insertGetId" method on + // the query builder, which will give us back the final inserted ID for this + // table from the database. Not all tables have to be incrementing though. + $attributes = $this->getAttributes(); + + if ($this->getIncrementing()) { + $this->insertAndSetId($query, $attributes); + } + + // If the table isn't incrementing we'll simply insert these attributes as they + // are. These attribute arrays must contain an "id" column previously placed + // there by the developer as the manually determined key for these models. + else { + if (empty($attributes)) { + return true; + } + + $query->insert($attributes); + } + + // We will go ahead and set the exists property to true, so that it is set when + // the created event is fired, just in case the developer tries to update it + // during the event. This will allow them to do so and run an update here. + $this->exists = true; + + $this->wasRecentlyCreated = true; + + $this->fireModelEvent('created', false); + + return true; + } + + /** + * Insert the given attributes and set the ID on the model. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param array $attributes + * @return void + */ + protected function insertAndSetId(Builder $query, $attributes) + { + $id = $query->insertGetId($attributes, $keyName = $this->getKeyName()); + + $this->setAttribute($keyName, $id); + } + + /** + * Destroy the models for the given IDs. + * + * @param \Illuminate\Support\Collection|array|int $ids + * @return int + */ + public static function destroy($ids) + { + // We'll initialize a count here so we will return the total number of deletes + // for the operation. The developers can then check this number as a boolean + // type value or get this total count of records deleted for logging, etc. + $count = 0; + + if ($ids instanceof BaseCollection) { + $ids = $ids->all(); + } + + $ids = is_array($ids) ? $ids : func_get_args(); + + // We will actually pull the models from the database table and call delete on + // each of them individually so that their events get fired properly with a + // correct set of attributes in case the developers wants to check these. + $key = ($instance = new static)->getKeyName(); + + foreach ($instance->whereIn($key, $ids)->get() as $model) { + if ($model->delete()) { + $count++; + } + } + + return $count; + } + + /** + * Delete the model from the database. + * + * @return bool|null + * + * @throws \Exception + */ + public function delete() + { + if (is_null($this->getKeyName())) { + throw new Exception('No primary key defined on model.'); + } + + // If the model doesn't exist, there is nothing to delete so we'll just return + // immediately and not do anything else. Otherwise, we will continue with a + // deletion process on the model, firing the proper events, and so forth. + if (! $this->exists) { + return; + } + + if ($this->fireModelEvent('deleting') === false) { + return false; + } + + // Here, we'll touch the owning models, verifying these timestamps get updated + // for the models. This will allow any caching to get broken on the parents + // by the timestamp. Then we will go ahead and delete the model instance. + $this->touchOwners(); + + $this->performDeleteOnModel(); + + // Once the model has been deleted, we will fire off the deleted event so that + // the developers may hook into post-delete operations. We will then return + // a boolean true as the delete is presumably successful on the database. + $this->fireModelEvent('deleted', false); + + return true; + } + + /** + * Force a hard delete on a soft deleted model. + * + * This method protects developers from running forceDelete when trait is missing. + * + * @return bool|null + */ + public function forceDelete() + { + return $this->delete(); + } + + /** + * Perform the actual delete query on this model instance. + * + * @return void + */ + protected function performDeleteOnModel() + { + $this->setKeysForSaveQuery($this->newModelQuery())->delete(); + + $this->exists = false; + } + + /** + * Begin querying the model. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public static function query() + { + return (new static)->newQuery(); + } + + /** + * Get a new query builder for the model's table. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQuery() + { + return $this->registerGlobalScopes($this->newQueryWithoutScopes()); + } + + /** + * Get a new query builder that doesn't have any global scopes or eager loading. + * + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function newModelQuery() + { + return $this->newEloquentBuilder( + $this->newBaseQueryBuilder() + )->setModel($this); + } + + /** + * Get a new query builder with no relationships loaded. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQueryWithoutRelationships() + { + return $this->registerGlobalScopes($this->newModelQuery()); + } + + /** + * Register the global scopes for this builder instance. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return \Illuminate\Database\Eloquent\Builder + */ + public function registerGlobalScopes($builder) + { + foreach ($this->getGlobalScopes() as $identifier => $scope) { + $builder->withGlobalScope($identifier, $scope); + } + + return $builder; + } + + /** + * Get a new query builder that doesn't have any global scopes. + * + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function newQueryWithoutScopes() + { + return $this->newModelQuery() + ->with($this->with) + ->withCount($this->withCount); + } + + /** + * Get a new query instance without a given scope. + * + * @param \Illuminate\Database\Eloquent\Scope|string $scope + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQueryWithoutScope($scope) + { + return $this->newQuery()->withoutGlobalScope($scope); + } + + /** + * Get a new query to restore one or more models by their queueable IDs. + * + * @param array|int $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQueryForRestoration($ids) + { + return is_array($ids) + ? $this->newQueryWithoutScopes()->whereIn($this->getQualifiedKeyName(), $ids) + : $this->newQueryWithoutScopes()->whereKey($ids); + } + + /** + * Create a new Eloquent query builder for the model. + * + * @param \Illuminate\Database\Query\Builder $query + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function newEloquentBuilder($query) + { + return new Builder($query); + } + + /** + * Get a new query builder instance for the connection. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function newBaseQueryBuilder() + { + return $this->getConnection()->query(); + } + + /** + * Create a new Eloquent Collection instance. + * + * @param array $models + * @return \Illuminate\Database\Eloquent\Collection + */ + public function newCollection(array $models = []) + { + return new Collection($models); + } + + /** + * Create a new pivot model instance. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @param array $attributes + * @param string $table + * @param bool $exists + * @param string|null $using + * @return \Illuminate\Database\Eloquent\Relations\Pivot + */ + public function newPivot(self $parent, array $attributes, $table, $exists, $using = null) + { + return $using ? $using::fromRawAttributes($parent, $attributes, $table, $exists) + : Pivot::fromAttributes($parent, $attributes, $table, $exists); + } + + /** + * Convert the model instance to an array. + * + * @return array + */ + public function toArray() + { + return array_merge($this->attributesToArray(), $this->relationsToArray()); + } + + /** + * Convert the model instance to JSON. + * + * @param int $options + * @return string + * + * @throws \Illuminate\Database\Eloquent\JsonEncodingException + */ + public function toJson($options = 0) + { + $json = json_encode($this->jsonSerialize(), $options); + + if (JSON_ERROR_NONE !== json_last_error()) { + throw JsonEncodingException::forModel($this, json_last_error_msg()); + } + + return $json; + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Reload a fresh model instance from the database. + * + * @param array|string $with + * @return static|null + */ + public function fresh($with = []) + { + if (! $this->exists) { + return; + } + + return static::newQueryWithoutScopes() + ->with(is_string($with) ? func_get_args() : $with) + ->where($this->getKeyName(), $this->getKey()) + ->first(); + } + + /** + * Reload the current model instance with fresh attributes from the database. + * + * @return $this + */ + public function refresh() + { + if (! $this->exists) { + return $this; + } + + $this->setRawAttributes( + static::newQueryWithoutScopes()->findOrFail($this->getKey())->attributes + ); + + $this->load(collect($this->relations)->reject(function ($relation) { + return $relation instanceof Pivot + || (is_object($relation) && in_array(AsPivot::class, class_uses_recursive($relation), true)); + })->keys()->all()); + + $this->syncOriginal(); + + return $this; + } + + /** + * Clone the model into a new, non-existing instance. + * + * @param array|null $except + * @return static + */ + public function replicate(array $except = null) + { + $defaults = [ + $this->getKeyName(), + $this->getCreatedAtColumn(), + $this->getUpdatedAtColumn(), + ]; + + $attributes = Arr::except( + $this->attributes, $except ? array_unique(array_merge($except, $defaults)) : $defaults + ); + + return tap(new static, function ($instance) use ($attributes) { + $instance->setRawAttributes($attributes); + + $instance->setRelations($this->relations); + + $instance->fireModelEvent('replicating', false); + }); + } + + /** + * Determine if two models have the same ID and belong to the same table. + * + * @param \Illuminate\Database\Eloquent\Model|null $model + * @return bool + */ + public function is($model) + { + return ! is_null($model) && + $this->getKey() === $model->getKey() && + $this->getTable() === $model->getTable() && + $this->getConnectionName() === $model->getConnectionName(); + } + + /** + * Determine if two models are not the same. + * + * @param \Illuminate\Database\Eloquent\Model|null $model + * @return bool + */ + public function isNot($model) + { + return ! $this->is($model); + } + + /** + * Get the database connection for the model. + * + * @return \Illuminate\Database\Connection + */ + public function getConnection() + { + return static::resolveConnection($this->getConnectionName()); + } + + /** + * Get the current connection name for the model. + * + * @return string|null + */ + public function getConnectionName() + { + return $this->connection; + } + + /** + * Set the connection associated with the model. + * + * @param string|null $name + * @return $this + */ + public function setConnection($name) + { + $this->connection = $name; + + return $this; + } + + /** + * Resolve a connection instance. + * + * @param string|null $connection + * @return \Illuminate\Database\Connection + */ + public static function resolveConnection($connection = null) + { + return static::$resolver->connection($connection); + } + + /** + * Get the connection resolver instance. + * + * @return \Illuminate\Database\ConnectionResolverInterface + */ + public static function getConnectionResolver() + { + return static::$resolver; + } + + /** + * Set the connection resolver instance. + * + * @param \Illuminate\Database\ConnectionResolverInterface $resolver + * @return void + */ + public static function setConnectionResolver(Resolver $resolver) + { + static::$resolver = $resolver; + } + + /** + * Unset the connection resolver for models. + * + * @return void + */ + public static function unsetConnectionResolver() + { + static::$resolver = null; + } + + /** + * Get the table associated with the model. + * + * @return string + */ + public function getTable() + { + return $this->table ?? Str::snake(Str::pluralStudly(class_basename($this))); + } + + /** + * Set the table associated with the model. + * + * @param string $table + * @return $this + */ + public function setTable($table) + { + $this->table = $table; + + return $this; + } + + /** + * Get the primary key for the model. + * + * @return string + */ + public function getKeyName() + { + return $this->primaryKey; + } + + /** + * Set the primary key for the model. + * + * @param string $key + * @return $this + */ + public function setKeyName($key) + { + $this->primaryKey = $key; + + return $this; + } + + /** + * Get the table qualified key name. + * + * @return string + */ + public function getQualifiedKeyName() + { + return $this->qualifyColumn($this->getKeyName()); + } + + /** + * Get the auto-incrementing key type. + * + * @return string + */ + public function getKeyType() + { + return $this->keyType; + } + + /** + * Set the data type for the primary key. + * + * @param string $type + * @return $this + */ + public function setKeyType($type) + { + $this->keyType = $type; + + return $this; + } + + /** + * Get the value indicating whether the IDs are incrementing. + * + * @return bool + */ + public function getIncrementing() + { + return $this->incrementing; + } + + /** + * Set whether IDs are incrementing. + * + * @param bool $value + * @return $this + */ + public function setIncrementing($value) + { + $this->incrementing = $value; + + return $this; + } + + /** + * Get the value of the model's primary key. + * + * @return mixed + */ + public function getKey() + { + return $this->getAttribute($this->getKeyName()); + } + + /** + * Get the queueable identity for the entity. + * + * @return mixed + */ + public function getQueueableId() + { + return $this->getKey(); + } + + /** + * Get the queueable relationships for the entity. + * + * @return array + */ + public function getQueueableRelations() + { + $relations = []; + + foreach ($this->getRelations() as $key => $relation) { + if (! method_exists($this, $key)) { + continue; + } + + $relations[] = $key; + + if ($relation instanceof QueueableCollection) { + foreach ($relation->getQueueableRelations() as $collectionValue) { + $relations[] = $key.'.'.$collectionValue; + } + } + + if ($relation instanceof QueueableEntity) { + foreach ($relation->getQueueableRelations() as $entityKey => $entityValue) { + $relations[] = $key.'.'.$entityValue; + } + } + } + + return array_unique($relations); + } + + /** + * Get the queueable connection for the entity. + * + * @return string|null + */ + public function getQueueableConnection() + { + return $this->getConnectionName(); + } + + /** + * Get the value of the model's route key. + * + * @return mixed + */ + public function getRouteKey() + { + return $this->getAttribute($this->getRouteKeyName()); + } + + /** + * Get the route key for the model. + * + * @return string + */ + public function getRouteKeyName() + { + return $this->getKeyName(); + } + + /** + * Retrieve the model for a bound value. + * + * @param mixed $value + * @return \Illuminate\Database\Eloquent\Model|null + */ + public function resolveRouteBinding($value) + { + return $this->where($this->getRouteKeyName(), $value)->first(); + } + + /** + * Get the default foreign key name for the model. + * + * @return string + */ + public function getForeignKey() + { + return Str::snake(class_basename($this)).'_'.$this->getKeyName(); + } + + /** + * Get the number of models to return per page. + * + * @return int + */ + public function getPerPage() + { + return $this->perPage; + } + + /** + * Set the number of models to return per page. + * + * @param int $perPage + * @return $this + */ + public function setPerPage($perPage) + { + $this->perPage = $perPage; + + return $this; + } + + /** + * Dynamically retrieve attributes on the model. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->getAttribute($key); + } + + /** + * Dynamically set attributes on the model. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->setAttribute($key, $value); + } + + /** + * Determine if the given attribute exists. + * + * @param mixed $offset + * @return bool + */ + public function offsetExists($offset) + { + return ! is_null($this->getAttribute($offset)); + } + + /** + * Get the value for a given offset. + * + * @param mixed $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->getAttribute($offset); + } + + /** + * Set the value for a given offset. + * + * @param mixed $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value) + { + $this->setAttribute($offset, $value); + } + + /** + * Unset the value for a given offset. + * + * @param mixed $offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->attributes[$offset], $this->relations[$offset]); + } + + /** + * Determine if an attribute or relation exists on the model. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return $this->offsetExists($key); + } + + /** + * Unset an attribute on the model. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + $this->offsetUnset($key); + } + + /** + * Handle dynamic method calls into the model. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (in_array($method, ['increment', 'decrement'])) { + return $this->$method(...$parameters); + } + + return $this->forwardCallTo($this->newQuery(), $method, $parameters); + } + + /** + * Handle dynamic static method calls into the method. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + return (new static)->$method(...$parameters); + } + + /** + * Convert the model to its string representation. + * + * @return string + */ + public function __toString() + { + return $this->toJson(); + } + + /** + * When a model is being unserialized, check if it needs to be booted. + * + * @return void + */ + public function __wakeup() + { + $this->bootIfNotBooted(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php new file mode 100755 index 00000000..2795b934 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php @@ -0,0 +1,66 @@ +model = $model; + $this->ids = Arr::wrap($ids); + + $this->message = "No query results for model [{$model}]"; + + if (count($this->ids) > 0) { + $this->message .= ' '.implode(', ', $this->ids); + } else { + $this->message .= '.'; + } + + return $this; + } + + /** + * Get the affected Eloquent model. + * + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Get the affected Eloquent model IDs. + * + * @return int|array + */ + public function getIds() + { + return $this->ids; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/QueueEntityResolver.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/QueueEntityResolver.php new file mode 100644 index 00000000..22fccf24 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/QueueEntityResolver.php @@ -0,0 +1,29 @@ +find($id); + + if ($instance) { + return $instance; + } + + throw new EntityNotFoundException($type, $id); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/RelationNotFoundException.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/RelationNotFoundException.php new file mode 100755 index 00000000..5acc0b30 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/RelationNotFoundException.php @@ -0,0 +1,41 @@ +model = $class; + $instance->relation = $relation; + + return $instance; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php new file mode 100755 index 00000000..9f319c51 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php @@ -0,0 +1,359 @@ +ownerKey = $ownerKey; + $this->relationName = $relationName; + $this->foreignKey = $foreignKey; + + // In the underlying base relationship class, this variable is referred to as + // the "parent" since most relationships are not inversed. But, since this + // one is we will create a "child" variable for much better readability. + $this->child = $child; + + parent::__construct($query, $child); + } + + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + if (is_null($this->child->{$this->foreignKey})) { + return $this->getDefaultFor($this->parent); + } + + return $this->query->first() ?: $this->getDefaultFor($this->parent); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + if (static::$constraints) { + // For belongs to relationships, which are essentially the inverse of has one + // or has many relationships, we need to actually query on the primary key + // of the related models matching on the foreign key that's on a parent. + $table = $this->related->getTable(); + + $this->query->where($table.'.'.$this->ownerKey, '=', $this->child->{$this->foreignKey}); + } + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + // We'll grab the primary key name of the related models since it could be set to + // a non-standard name and not "id". We will then construct the constraint for + // our eagerly loading query so it returns the proper models from execution. + $key = $this->related->getTable().'.'.$this->ownerKey; + + $whereIn = $this->whereInMethod($this->related, $this->ownerKey); + + $this->query->{$whereIn}($key, $this->getEagerModelKeys($models)); + } + + /** + * Gather the keys from an array of related models. + * + * @param array $models + * @return array + */ + protected function getEagerModelKeys(array $models) + { + $keys = []; + + // First we need to gather all of the keys from the parent models so we know what + // to query for via the eager loading query. We will add them to an array then + // execute a "where in" statement to gather up all of those related records. + foreach ($models as $model) { + if (! is_null($value = $model->{$this->foreignKey})) { + $keys[] = $value; + } + } + + sort($keys); + + return array_values(array_unique($keys)); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->getDefaultFor($model)); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + $foreign = $this->foreignKey; + + $owner = $this->ownerKey; + + // First we will get to build a dictionary of the child models by their primary + // key of the relationship, then we can easily match the children back onto + // the parents using that dictionary and the primary key of the children. + $dictionary = []; + + foreach ($results as $result) { + $dictionary[$result->getAttribute($owner)] = $result; + } + + // Once we have the dictionary constructed, we can loop through all the parents + // and match back onto their children using these keys of the dictionary and + // the primary key of the children to map them onto the correct instances. + foreach ($models as $model) { + if (isset($dictionary[$model->{$foreign}])) { + $model->setRelation($relation, $dictionary[$model->{$foreign}]); + } + } + + return $models; + } + + /** + * Associate the model instance to the given parent. + * + * @param \Illuminate\Database\Eloquent\Model|int|string $model + * @return \Illuminate\Database\Eloquent\Model + */ + public function associate($model) + { + $ownerKey = $model instanceof Model ? $model->getAttribute($this->ownerKey) : $model; + + $this->child->setAttribute($this->foreignKey, $ownerKey); + + if ($model instanceof Model) { + $this->child->setRelation($this->relationName, $model); + } elseif ($this->child->isDirty($this->foreignKey)) { + $this->child->unsetRelation($this->relationName); + } + + return $this->child; + } + + /** + * Dissociate previously associated model from the given parent. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function dissociate() + { + $this->child->setAttribute($this->foreignKey, null); + + return $this->child->setRelation($this->relationName, null); + } + + /** + * Add the constraints for a relationship query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + if ($parentQuery->getQuery()->from == $query->getQuery()->from) { + return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns); + } + + return $query->select($columns)->whereColumn( + $this->getQualifiedForeignKeyName(), '=', $query->qualifyColumn($this->ownerKey) + ); + } + + /** + * Add the constraints for a relationship query on the same table. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) + { + $query->select($columns)->from( + $query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash() + ); + + $query->getModel()->setTable($hash); + + return $query->whereColumn( + $hash.'.'.$this->ownerKey, '=', $this->getQualifiedForeignKeyName() + ); + } + + /** + * Get a relationship join table hash. + * + * @return string + */ + public function getRelationCountHash() + { + return 'laravel_reserved_'.static::$selfJoinCount++; + } + + /** + * Determine if the related model has an auto-incrementing ID. + * + * @return bool + */ + protected function relationHasIncrementingId() + { + return $this->related->getIncrementing() && + $this->related->getKeyType() === 'int'; + } + + /** + * Make a new related instance for the given model. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @return \Illuminate\Database\Eloquent\Model + */ + protected function newRelatedInstanceFor(Model $parent) + { + return $this->related->newInstance(); + } + + /** + * Get the child of the relationship. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function getChild() + { + return $this->child; + } + + /** + * Get the foreign key of the relationship. + * + * @return string + */ + public function getForeignKeyName() + { + return $this->foreignKey; + } + + /** + * Get the fully qualified foreign key of the relationship. + * + * @return string + */ + public function getQualifiedForeignKeyName() + { + return $this->child->qualifyColumn($this->foreignKey); + } + + /** + * Get the associated key of the relationship. + * + * @return string + */ + public function getOwnerKeyName() + { + return $this->ownerKey; + } + + /** + * Get the fully qualified associated key of the relationship. + * + * @return string + */ + public function getQualifiedOwnerKeyName() + { + return $this->related->qualifyColumn($this->ownerKey); + } + + /** + * Get the name of the relationship. + * + * @return string + */ + public function getRelationName() + { + return $this->relationName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php new file mode 100755 index 00000000..59490329 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php @@ -0,0 +1,1203 @@ +parentKey = $parentKey; + $this->relatedKey = $relatedKey; + $this->relationName = $relationName; + $this->relatedPivotKey = $relatedPivotKey; + $this->foreignPivotKey = $foreignPivotKey; + $this->table = $this->resolveTableName($table); + + parent::__construct($query, $parent); + } + + /** + * Attempt to resolve the intermediate table name from the given string. + * + * @param string $table + * @return string + */ + protected function resolveTableName($table) + { + if (! Str::contains($table, '\\') || ! class_exists($table)) { + return $table; + } + + $model = new $table; + + if (! $model instanceof Model) { + return $table; + } + + if ($model instanceof Pivot) { + $this->using($table); + } + + return $model->getTable(); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + $this->performJoin(); + + if (static::$constraints) { + $this->addWhereConstraints(); + } + } + + /** + * Set the join clause for the relation query. + * + * @param \Illuminate\Database\Eloquent\Builder|null $query + * @return $this + */ + protected function performJoin($query = null) + { + $query = $query ?: $this->query; + + // We need to join to the intermediate table on the related model's primary + // key column with the intermediate table's foreign key for the related + // model instance. Then we can set the "where" for the parent models. + $baseTable = $this->related->getTable(); + + $key = $baseTable.'.'.$this->relatedKey; + + $query->join($this->table, $key, '=', $this->getQualifiedRelatedPivotKeyName()); + + return $this; + } + + /** + * Set the where clause for the relation query. + * + * @return $this + */ + protected function addWhereConstraints() + { + $this->query->where( + $this->getQualifiedForeignPivotKeyName(), '=', $this->parent->{$this->parentKey} + ); + + return $this; + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + $whereIn = $this->whereInMethod($this->parent, $this->parentKey); + + $this->query->{$whereIn}( + $this->getQualifiedForeignPivotKeyName(), + $this->getKeys($models, $this->parentKey) + ); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->related->newCollection()); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + $dictionary = $this->buildDictionary($results); + + // Once we have an array dictionary of child objects we can easily match the + // children back to their parent using the dictionary and the keys on the + // the parent models. Then we will return the hydrated models back out. + foreach ($models as $model) { + if (isset($dictionary[$key = $model->{$this->parentKey}])) { + $model->setRelation( + $relation, $this->related->newCollection($dictionary[$key]) + ); + } + } + + return $models; + } + + /** + * Build model dictionary keyed by the relation's foreign key. + * + * @param \Illuminate\Database\Eloquent\Collection $results + * @return array + */ + protected function buildDictionary(Collection $results) + { + // First we will build a dictionary of child models keyed by the foreign key + // of the relation so that we will easily and quickly match them to their + // parents without having a possibly slow inner loops for every models. + $dictionary = []; + + foreach ($results as $result) { + $dictionary[$result->{$this->accessor}->{$this->foreignPivotKey}][] = $result; + } + + return $dictionary; + } + + /** + * Get the class being used for pivot models. + * + * @return string + */ + public function getPivotClass() + { + return $this->using ?? Pivot::class; + } + + /** + * Specify the custom pivot model to use for the relationship. + * + * @param string $class + * @return $this + */ + public function using($class) + { + $this->using = $class; + + return $this; + } + + /** + * Specify the custom pivot accessor to use for the relationship. + * + * @param string $accessor + * @return $this + */ + public function as($accessor) + { + $this->accessor = $accessor; + + return $this; + } + + /** + * Set a where clause for a pivot table column. + * + * @param string $column + * @param string|null $operator + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function wherePivot($column, $operator = null, $value = null, $boolean = 'and') + { + $this->pivotWheres[] = func_get_args(); + + return $this->where($this->table.'.'.$column, $operator, $value, $boolean); + } + + /** + * Set a "where in" clause for a pivot table column. + * + * @param string $column + * @param mixed $values + * @param string $boolean + * @param bool $not + * @return $this + */ + public function wherePivotIn($column, $values, $boolean = 'and', $not = false) + { + $this->pivotWhereIns[] = func_get_args(); + + return $this->whereIn($this->table.'.'.$column, $values, $boolean, $not); + } + + /** + * Set an "or where" clause for a pivot table column. + * + * @param string $column + * @param string|null $operator + * @param mixed $value + * @return $this + */ + public function orWherePivot($column, $operator = null, $value = null) + { + return $this->wherePivot($column, $operator, $value, 'or'); + } + + /** + * Set a where clause for a pivot table column. + * + * In addition, new pivot records will receive this value. + * + * @param string|array $column + * @param mixed $value + * @return $this + * + * @throws \InvalidArgumentException + */ + public function withPivotValue($column, $value = null) + { + if (is_array($column)) { + foreach ($column as $name => $value) { + $this->withPivotValue($name, $value); + } + + return $this; + } + + if (is_null($value)) { + throw new InvalidArgumentException('The provided value may not be null.'); + } + + $this->pivotValues[] = compact('column', 'value'); + + return $this->wherePivot($column, '=', $value); + } + + /** + * Set an "or where in" clause for a pivot table column. + * + * @param string $column + * @param mixed $values + * @return $this + */ + public function orWherePivotIn($column, $values) + { + return $this->wherePivotIn($column, $values, 'or'); + } + + /** + * Set a "where not in" clause for a pivot table column. + * + * @param string $column + * @param mixed $values + * @param string $boolean + * @return $this + */ + public function wherePivotNotIn($column, $values, $boolean = 'and') + { + return $this->wherePivotIn($column, $values, $boolean, true); + } + + /** + * Set an "or where not in" clause for a pivot table column. + * + * @param string $column + * @param mixed $values + * @return $this + */ + public function orWherePivotNotIn($column, $values) + { + return $this->wherePivotNotIn($column, $values, 'or'); + } + + /** + * Find a related model by its primary key or return new instance of the related model. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model + */ + public function findOrNew($id, $columns = ['*']) + { + if (is_null($instance = $this->find($id, $columns))) { + $instance = $this->related->newInstance(); + } + + return $instance; + } + + /** + * Get the first related model record matching the attributes or instantiate it. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrNew(array $attributes) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->related->newInstance($attributes); + } + + return $instance; + } + + /** + * Get the first related record matching the attributes or create it. + * + * @param array $attributes + * @param array $joining + * @param bool $touch + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrCreate(array $attributes, array $joining = [], $touch = true) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->create($attributes, $joining, $touch); + } + + return $instance; + } + + /** + * Create or update a related record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @param array $joining + * @param bool $touch + * @return \Illuminate\Database\Eloquent\Model + */ + public function updateOrCreate(array $attributes, array $values = [], array $joining = [], $touch = true) + { + if (is_null($instance = $this->where($attributes)->first())) { + return $this->create($values, $joining, $touch); + } + + $instance->fill($values); + + $instance->save(['touch' => false]); + + return $instance; + } + + /** + * Find a related model by its primary key. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null + */ + public function find($id, $columns = ['*']) + { + return is_array($id) ? $this->findMany($id, $columns) : $this->where( + $this->getRelated()->getQualifiedKeyName(), '=', $this->parseId($id) + )->first($columns); + } + + /** + * Find multiple related models by their primary keys. + * + * @param mixed $ids + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function findMany($ids, $columns = ['*']) + { + return empty($ids) ? $this->getRelated()->newCollection() : $this->whereIn( + $this->getRelated()->getQualifiedKeyName(), $this->parseIds($ids) + )->get($columns); + } + + /** + * Find a related model by its primary key or throw an exception. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function findOrFail($id, $columns = ['*']) + { + $result = $this->find($id, $columns); + + if (is_array($id)) { + if (count($result) === count(array_unique($id))) { + return $result; + } + } elseif (! is_null($result)) { + return $result; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->related), $id); + } + + /** + * Add a basic where clause to the query, and return the first result. + * + * @param \Closure|string|array $column + * @param mixed $operator + * @param mixed $value + * @param string $boolean + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function firstWhere($column, $operator = null, $value = null, $boolean = 'and') + { + return $this->where($column, $operator, $value, $boolean)->first(); + } + + /** + * Execute the query and get the first result. + * + * @param array $columns + * @return mixed + */ + public function first($columns = ['*']) + { + $results = $this->take(1)->get($columns); + + return count($results) > 0 ? $results->first() : null; + } + + /** + * Execute the query and get the first result or throw an exception. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function firstOrFail($columns = ['*']) + { + if (! is_null($model = $this->first($columns))) { + return $model; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->related)); + } + + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return ! is_null($this->parent->{$this->parentKey}) + ? $this->get() + : $this->related->newCollection(); + } + + /** + * Execute the query as a "select" statement. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function get($columns = ['*']) + { + // First we'll add the proper select columns onto the query so it is run with + // the proper columns. Then, we will get the results and hydrate out pivot + // models with the result of those columns as a separate model relation. + $builder = $this->query->applyScopes(); + + $columns = $builder->getQuery()->columns ? [] : $columns; + + $models = $builder->addSelect( + $this->shouldSelect($columns) + )->getModels(); + + $this->hydratePivotRelation($models); + + // If we actually found models we will also eager load any relationships that + // have been specified as needing to be eager loaded. This will solve the + // n + 1 query problem for the developer and also increase performance. + if (count($models) > 0) { + $models = $builder->eagerLoadRelations($models); + } + + return $this->related->newCollection($models); + } + + /** + * Get the select columns for the relation query. + * + * @param array $columns + * @return array + */ + protected function shouldSelect(array $columns = ['*']) + { + if ($columns == ['*']) { + $columns = [$this->related->getTable().'.*']; + } + + return array_merge($columns, $this->aliasedPivotColumns()); + } + + /** + * Get the pivot columns for the relation. + * + * "pivot_" is prefixed ot each column for easy removal later. + * + * @return array + */ + protected function aliasedPivotColumns() + { + $defaults = [$this->foreignPivotKey, $this->relatedPivotKey]; + + return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) { + return $this->table.'.'.$column.' as pivot_'.$column; + })->unique()->all(); + } + + /** + * Get a paginator for the "select" statement. + * + * @param int|null $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $this->query->addSelect($this->shouldSelect($columns)); + + return tap($this->query->paginate($perPage, $columns, $pageName, $page), function ($paginator) { + $this->hydratePivotRelation($paginator->items()); + }); + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int|null $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $this->query->addSelect($this->shouldSelect($columns)); + + return tap($this->query->simplePaginate($perPage, $columns, $pageName, $page), function ($paginator) { + $this->hydratePivotRelation($paginator->items()); + }); + } + + /** + * Chunk the results of the query. + * + * @param int $count + * @param callable $callback + * @return bool + */ + public function chunk($count, callable $callback) + { + $this->query->addSelect($this->shouldSelect()); + + return $this->query->chunk($count, function ($results) use ($callback) { + $this->hydratePivotRelation($results->all()); + + return $callback($results); + }); + } + + /** + * Chunk the results of a query by comparing numeric IDs. + * + * @param int $count + * @param callable $callback + * @param string|null $column + * @param string|null $alias + * @return bool + */ + public function chunkById($count, callable $callback, $column = null, $alias = null) + { + $this->query->addSelect($this->shouldSelect()); + + $column = $column ?? $this->getRelated()->qualifyColumn( + $this->getRelatedKeyName() + ); + + $alias = $alias ?? $this->getRelatedKeyName(); + + return $this->query->chunkById($count, function ($results) use ($callback) { + $this->hydratePivotRelation($results->all()); + + return $callback($results); + }, $column, $alias); + } + + /** + * Execute a callback over each item while chunking. + * + * @param callable $callback + * @param int $count + * @return bool + */ + public function each(callable $callback, $count = 1000) + { + return $this->chunk($count, function ($results) use ($callback) { + foreach ($results as $key => $value) { + if ($callback($value, $key) === false) { + return false; + } + } + }); + } + + /** + * Get a lazy collection for the given query. + * + * @return \Illuminate\Support\LazyCollection + */ + public function cursor() + { + $this->query->addSelect($this->shouldSelect()); + + return $this->query->cursor()->map(function ($model) { + $this->hydratePivotRelation([$model]); + + return $model; + }); + } + + /** + * Hydrate the pivot table relationship on the models. + * + * @param array $models + * @return void + */ + protected function hydratePivotRelation(array $models) + { + // To hydrate the pivot relationship, we will just gather the pivot attributes + // and create a new Pivot model, which is basically a dynamic model that we + // will set the attributes, table, and connections on it so it will work. + foreach ($models as $model) { + $model->setRelation($this->accessor, $this->newExistingPivot( + $this->migratePivotAttributes($model) + )); + } + } + + /** + * Get the pivot attributes from a model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return array + */ + protected function migratePivotAttributes(Model $model) + { + $values = []; + + foreach ($model->getAttributes() as $key => $value) { + // To get the pivots attributes we will just take any of the attributes which + // begin with "pivot_" and add those to this arrays, as well as unsetting + // them from the parent's models since they exist in a different table. + if (strpos($key, 'pivot_') === 0) { + $values[substr($key, 6)] = $value; + + unset($model->$key); + } + } + + return $values; + } + + /** + * If we're touching the parent model, touch. + * + * @return void + */ + public function touchIfTouching() + { + if ($this->touchingParent()) { + $this->getParent()->touch(); + } + + if ($this->getParent()->touches($this->relationName)) { + $this->touch(); + } + } + + /** + * Determine if we should touch the parent on sync. + * + * @return bool + */ + protected function touchingParent() + { + return $this->getRelated()->touches($this->guessInverseRelation()); + } + + /** + * Attempt to guess the name of the inverse of the relation. + * + * @return string + */ + protected function guessInverseRelation() + { + return Str::camel(Str::pluralStudly(class_basename($this->getParent()))); + } + + /** + * Touch all of the related models for the relationship. + * + * E.g.: Touch all roles associated with this user. + * + * @return void + */ + public function touch() + { + $key = $this->getRelated()->getKeyName(); + + $columns = [ + $this->related->getUpdatedAtColumn() => $this->related->freshTimestampString(), + ]; + + // If we actually have IDs for the relation, we will run the query to update all + // the related model's timestamps, to make sure these all reflect the changes + // to the parent models. This will help us keep any caching synced up here. + if (count($ids = $this->allRelatedIds()) > 0) { + $this->getRelated()->newQueryWithoutRelationships()->whereIn($key, $ids)->update($columns); + } + } + + /** + * Get all of the IDs for the related models. + * + * @return \Illuminate\Support\Collection + */ + public function allRelatedIds() + { + return $this->newPivotQuery()->pluck($this->relatedPivotKey); + } + + /** + * Save a new model and attach it to the parent model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @param array $pivotAttributes + * @param bool $touch + * @return \Illuminate\Database\Eloquent\Model + */ + public function save(Model $model, array $pivotAttributes = [], $touch = true) + { + $model->save(['touch' => false]); + + $this->attach($model, $pivotAttributes, $touch); + + return $model; + } + + /** + * Save an array of new models and attach them to the parent model. + * + * @param \Illuminate\Support\Collection|array $models + * @param array $pivotAttributes + * @return array + */ + public function saveMany($models, array $pivotAttributes = []) + { + foreach ($models as $key => $model) { + $this->save($model, (array) ($pivotAttributes[$key] ?? []), false); + } + + $this->touchIfTouching(); + + return $models; + } + + /** + * Create a new instance of the related model. + * + * @param array $attributes + * @param array $joining + * @param bool $touch + * @return \Illuminate\Database\Eloquent\Model + */ + public function create(array $attributes = [], array $joining = [], $touch = true) + { + $instance = $this->related->newInstance($attributes); + + // Once we save the related model, we need to attach it to the base model via + // through intermediate table so we'll use the existing "attach" method to + // accomplish this which will insert the record and any more attributes. + $instance->save(['touch' => false]); + + $this->attach($instance, $joining, $touch); + + return $instance; + } + + /** + * Create an array of new instances of the related models. + * + * @param iterable $records + * @param array $joinings + * @return array + */ + public function createMany(iterable $records, array $joinings = []) + { + $instances = []; + + foreach ($records as $key => $record) { + $instances[] = $this->create($record, (array) ($joinings[$key] ?? []), false); + } + + $this->touchIfTouching(); + + return $instances; + } + + /** + * Add the constraints for a relationship query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + if ($parentQuery->getQuery()->from == $query->getQuery()->from) { + return $this->getRelationExistenceQueryForSelfJoin($query, $parentQuery, $columns); + } + + $this->performJoin($query); + + return parent::getRelationExistenceQuery($query, $parentQuery, $columns); + } + + /** + * Add the constraints for a relationship query on the same table. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQueryForSelfJoin(Builder $query, Builder $parentQuery, $columns = ['*']) + { + $query->select($columns); + + $query->from($this->related->getTable().' as '.$hash = $this->getRelationCountHash()); + + $this->related->setTable($hash); + + $this->performJoin($query); + + return parent::getRelationExistenceQuery($query, $parentQuery, $columns); + } + + /** + * Get the key for comparing against the parent key in "has" query. + * + * @return string + */ + public function getExistenceCompareKey() + { + return $this->getQualifiedForeignPivotKeyName(); + } + + /** + * Get a relationship join table hash. + * + * @return string + */ + public function getRelationCountHash() + { + return 'laravel_reserved_'.static::$selfJoinCount++; + } + + /** + * Specify that the pivot table has creation and update timestamps. + * + * @param mixed $createdAt + * @param mixed $updatedAt + * @return $this + */ + public function withTimestamps($createdAt = null, $updatedAt = null) + { + $this->withTimestamps = true; + + $this->pivotCreatedAt = $createdAt; + $this->pivotUpdatedAt = $updatedAt; + + return $this->withPivot($this->createdAt(), $this->updatedAt()); + } + + /** + * Get the name of the "created at" column. + * + * @return string + */ + public function createdAt() + { + return $this->pivotCreatedAt ?: $this->parent->getCreatedAtColumn(); + } + + /** + * Get the name of the "updated at" column. + * + * @return string + */ + public function updatedAt() + { + return $this->pivotUpdatedAt ?: $this->parent->getUpdatedAtColumn(); + } + + /** + * Get the foreign key for the relation. + * + * @return string + */ + public function getForeignPivotKeyName() + { + return $this->foreignPivotKey; + } + + /** + * Get the fully qualified foreign key for the relation. + * + * @return string + */ + public function getQualifiedForeignPivotKeyName() + { + return $this->table.'.'.$this->foreignPivotKey; + } + + /** + * Get the "related key" for the relation. + * + * @return string + */ + public function getRelatedPivotKeyName() + { + return $this->relatedPivotKey; + } + + /** + * Get the fully qualified "related key" for the relation. + * + * @return string + */ + public function getQualifiedRelatedPivotKeyName() + { + return $this->table.'.'.$this->relatedPivotKey; + } + + /** + * Get the parent key for the relationship. + * + * @return string + */ + public function getParentKeyName() + { + return $this->parentKey; + } + + /** + * Get the fully qualified parent key name for the relation. + * + * @return string + */ + public function getQualifiedParentKeyName() + { + return $this->parent->qualifyColumn($this->parentKey); + } + + /** + * Get the related key for the relationship. + * + * @return string + */ + public function getRelatedKeyName() + { + return $this->relatedKey; + } + + /** + * Get the intermediate table for the relationship. + * + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Get the relationship name for the relationship. + * + * @return string + */ + public function getRelationName() + { + return $this->relationName; + } + + /** + * Get the name of the pivot accessor for this relationship. + * + * @return string + */ + public function getPivotAccessor() + { + return $this->accessor; + } + + /** + * Get the pivot columns for this relationship. + * + * @return array + */ + public function getPivotColumns() + { + return $this->pivotColumns; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php new file mode 100644 index 00000000..de9f0725 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php @@ -0,0 +1,319 @@ +timestamps = $instance->hasTimestampAttributes($attributes); + + // The pivot model is a "dynamic" model since we will set the tables dynamically + // for the instance. This allows it work for any intermediate tables for the + // many to many relationship that are defined by this developer's classes. + $instance->setConnection($parent->getConnectionName()) + ->setTable($table) + ->forceFill($attributes) + ->syncOriginal(); + + // We store off the parent instance so we will access the timestamp column names + // for the model, since the pivot model timestamps aren't easily configurable + // from the developer's point of view. We can use the parents to get these. + $instance->pivotParent = $parent; + + $instance->exists = $exists; + + return $instance; + } + + /** + * Create a new pivot model from raw values returned from a query. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @param array $attributes + * @param string $table + * @param bool $exists + * @return static + */ + public static function fromRawAttributes(Model $parent, $attributes, $table, $exists = false) + { + $instance = static::fromAttributes($parent, [], $table, $exists); + + $instance->timestamps = $instance->hasTimestampAttributes($attributes); + + $instance->setRawAttributes($attributes, $exists); + + return $instance; + } + + /** + * Set the keys for a save update query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function setKeysForSaveQuery(Builder $query) + { + if (isset($this->attributes[$this->getKeyName()])) { + return parent::setKeysForSaveQuery($query); + } + + $query->where($this->foreignKey, $this->getOriginal( + $this->foreignKey, $this->getAttribute($this->foreignKey) + )); + + return $query->where($this->relatedKey, $this->getOriginal( + $this->relatedKey, $this->getAttribute($this->relatedKey) + )); + } + + /** + * Delete the pivot model record from the database. + * + * @return int + */ + public function delete() + { + if (isset($this->attributes[$this->getKeyName()])) { + return (int) parent::delete(); + } + + if ($this->fireModelEvent('deleting') === false) { + return 0; + } + + $this->touchOwners(); + + return tap($this->getDeleteQuery()->delete(), function () { + $this->fireModelEvent('deleted', false); + }); + } + + /** + * Get the query builder for a delete operation on the pivot. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function getDeleteQuery() + { + return $this->newQueryWithoutRelationships()->where([ + $this->foreignKey => $this->getOriginal($this->foreignKey, $this->getAttribute($this->foreignKey)), + $this->relatedKey => $this->getOriginal($this->relatedKey, $this->getAttribute($this->relatedKey)), + ]); + } + + /** + * Get the table associated with the model. + * + * @return string + */ + public function getTable() + { + if (! isset($this->table)) { + $this->setTable(str_replace( + '\\', '', Str::snake(Str::singular(class_basename($this))) + )); + } + + return $this->table; + } + + /** + * Get the foreign key column name. + * + * @return string + */ + public function getForeignKey() + { + return $this->foreignKey; + } + + /** + * Get the "related key" column name. + * + * @return string + */ + public function getRelatedKey() + { + return $this->relatedKey; + } + + /** + * Get the "related key" column name. + * + * @return string + */ + public function getOtherKey() + { + return $this->getRelatedKey(); + } + + /** + * Set the key names for the pivot model instance. + * + * @param string $foreignKey + * @param string $relatedKey + * @return $this + */ + public function setPivotKeys($foreignKey, $relatedKey) + { + $this->foreignKey = $foreignKey; + + $this->relatedKey = $relatedKey; + + return $this; + } + + /** + * Determine if the pivot model or given attributes has timestamp attributes. + * + * @param array|null $attributes + * @return bool + */ + public function hasTimestampAttributes($attributes = null) + { + return array_key_exists($this->getCreatedAtColumn(), $attributes ?? $this->attributes); + } + + /** + * Get the name of the "created at" column. + * + * @return string + */ + public function getCreatedAtColumn() + { + return $this->pivotParent + ? $this->pivotParent->getCreatedAtColumn() + : parent::getCreatedAtColumn(); + } + + /** + * Get the name of the "updated at" column. + * + * @return string + */ + public function getUpdatedAtColumn() + { + return $this->pivotParent + ? $this->pivotParent->getUpdatedAtColumn() + : parent::getUpdatedAtColumn(); + } + + /** + * Get the queueable identity for the entity. + * + * @return mixed + */ + public function getQueueableId() + { + if (isset($this->attributes[$this->getKeyName()])) { + return $this->getKey(); + } + + return sprintf( + '%s:%s:%s:%s', + $this->foreignKey, $this->getAttribute($this->foreignKey), + $this->relatedKey, $this->getAttribute($this->relatedKey) + ); + } + + /** + * Get a new query to restore one or more models by their queueable IDs. + * + * @param int[]|string[]|string $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQueryForRestoration($ids) + { + if (is_array($ids)) { + return $this->newQueryForCollectionRestoration($ids); + } + + if (! Str::contains($ids, ':')) { + return parent::newQueryForRestoration($ids); + } + + $segments = explode(':', $ids); + + return $this->newQueryWithoutScopes() + ->where($segments[0], $segments[1]) + ->where($segments[2], $segments[3]); + } + + /** + * Get a new query to restore multiple models by their queueable IDs. + * + * @param int[]|string[] $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function newQueryForCollectionRestoration(array $ids) + { + $ids = array_values($ids); + + if (! Str::contains($ids[0], ':')) { + return parent::newQueryForRestoration($ids); + } + + $query = $this->newQueryWithoutScopes(); + + foreach ($ids as $id) { + $segments = explode(':', $id); + + $query->orWhere(function ($query) use ($segments) { + return $query->where($segments[0], $segments[1]) + ->where($segments[2], $segments[3]); + }); + } + + return $query; + } + + /** + * Unset all the loaded relations for the instance. + * + * @return $this + */ + public function unsetRelations() + { + $this->pivotParent = null; + $this->relations = []; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php new file mode 100644 index 00000000..b0abf284 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php @@ -0,0 +1,662 @@ + [], 'detached' => [], + ]; + + $records = $this->formatRecordsList($this->parseIds($ids)); + + // Next, we will determine which IDs should get removed from the join table by + // checking which of the given ID/records is in the list of current records + // and removing all of those rows from this "intermediate" joining table. + $detach = array_values(array_intersect( + $this->newPivotQuery()->pluck($this->relatedPivotKey)->all(), + array_keys($records) + )); + + if (count($detach) > 0) { + $this->detach($detach, false); + + $changes['detached'] = $this->castKeys($detach); + } + + // Finally, for all of the records which were not "detached", we'll attach the + // records into the intermediate table. Then, we will add those attaches to + // this change list and get ready to return these results to the callers. + $attach = array_diff_key($records, array_flip($detach)); + + if (count($attach) > 0) { + $this->attach($attach, [], false); + + $changes['attached'] = array_keys($attach); + } + + // Once we have finished attaching or detaching the records, we will see if we + // have done any attaching or detaching, and if we have we will touch these + // relationships if they are configured to touch on any database updates. + if ($touch && (count($changes['attached']) || + count($changes['detached']))) { + $this->touchIfTouching(); + } + + return $changes; + } + + /** + * Sync the intermediate tables with a list of IDs without detaching. + * + * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids + * @return array + */ + public function syncWithoutDetaching($ids) + { + return $this->sync($ids, false); + } + + /** + * Sync the intermediate tables with a list of IDs or collection of models. + * + * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids + * @param bool $detaching + * @return array + */ + public function sync($ids, $detaching = true) + { + $changes = [ + 'attached' => [], 'detached' => [], 'updated' => [], + ]; + + // First we need to attach any of the associated models that are not currently + // in this joining table. We'll spin through the given IDs, checking to see + // if they exist in the array of current ones, and if not we will insert. + $current = $this->getCurrentlyAttachedPivots() + ->pluck($this->relatedPivotKey)->all(); + + $detach = array_diff($current, array_keys( + $records = $this->formatRecordsList($this->parseIds($ids)) + )); + + // Next, we will take the differences of the currents and given IDs and detach + // all of the entities that exist in the "current" array but are not in the + // array of the new IDs given to the method which will complete the sync. + if ($detaching && count($detach) > 0) { + $this->detach($detach); + + $changes['detached'] = $this->castKeys($detach); + } + + // Now we are finally ready to attach the new records. Note that we'll disable + // touching until after the entire operation is complete so we don't fire a + // ton of touch operations until we are totally done syncing the records. + $changes = array_merge( + $changes, $this->attachNew($records, $current, false) + ); + + // Once we have finished attaching or detaching the records, we will see if we + // have done any attaching or detaching, and if we have we will touch these + // relationships if they are configured to touch on any database updates. + if (count($changes['attached']) || + count($changes['updated'])) { + $this->touchIfTouching(); + } + + return $changes; + } + + /** + * Format the sync / toggle record list so that it is keyed by ID. + * + * @param array $records + * @return array + */ + protected function formatRecordsList(array $records) + { + return collect($records)->mapWithKeys(function ($attributes, $id) { + if (! is_array($attributes)) { + [$id, $attributes] = [$attributes, []]; + } + + return [$id => $attributes]; + })->all(); + } + + /** + * Attach all of the records that aren't in the given current records. + * + * @param array $records + * @param array $current + * @param bool $touch + * @return array + */ + protected function attachNew(array $records, array $current, $touch = true) + { + $changes = ['attached' => [], 'updated' => []]; + + foreach ($records as $id => $attributes) { + // If the ID is not in the list of existing pivot IDs, we will insert a new pivot + // record, otherwise, we will just update this existing record on this joining + // table, so that the developers will easily update these records pain free. + if (! in_array($id, $current)) { + $this->attach($id, $attributes, $touch); + + $changes['attached'][] = $this->castKey($id); + } + + // Now we'll try to update an existing pivot record with the attributes that were + // given to the method. If the model is actually updated we will add it to the + // list of updated pivot records so we return them back out to the consumer. + elseif (count($attributes) > 0 && + $this->updateExistingPivot($id, $attributes, $touch)) { + $changes['updated'][] = $this->castKey($id); + } + } + + return $changes; + } + + /** + * Update an existing pivot record on the table. + * + * @param mixed $id + * @param array $attributes + * @param bool $touch + * @return int + */ + public function updateExistingPivot($id, array $attributes, $touch = true) + { + if ($this->using && empty($this->pivotWheres) && empty($this->pivotWhereIns)) { + return $this->updateExistingPivotUsingCustomClass($id, $attributes, $touch); + } + + if (in_array($this->updatedAt(), $this->pivotColumns)) { + $attributes = $this->addTimestampsToAttachment($attributes, true); + } + + $updated = $this->newPivotStatementForId($this->parseId($id))->update( + $this->castAttributes($attributes) + ); + + if ($touch) { + $this->touchIfTouching(); + } + + return $updated; + } + + /** + * Update an existing pivot record on the table via a custom class. + * + * @param mixed $id + * @param array $attributes + * @param bool $touch + * @return int + */ + protected function updateExistingPivotUsingCustomClass($id, array $attributes, $touch) + { + $pivot = $this->getCurrentlyAttachedPivots() + ->where($this->foreignPivotKey, $this->parent->{$this->parentKey}) + ->where($this->relatedPivotKey, $this->parseId($id)) + ->first(); + + $updated = $pivot ? $pivot->fill($attributes)->isDirty() : false; + + $pivot = $this->newPivot([ + $this->foreignPivotKey => $this->parent->{$this->parentKey}, + $this->relatedPivotKey => $this->parseId($id), + ], true); + + $pivot->timestamps = $updated && in_array($this->updatedAt(), $this->pivotColumns); + + $pivot->fill($attributes)->save(); + + if ($touch) { + $this->touchIfTouching(); + } + + return (int) $updated; + } + + /** + * Attach a model to the parent. + * + * @param mixed $id + * @param array $attributes + * @param bool $touch + * @return void + */ + public function attach($id, array $attributes = [], $touch = true) + { + if ($this->using) { + $this->attachUsingCustomClass($id, $attributes); + } else { + // Here we will insert the attachment records into the pivot table. Once we have + // inserted the records, we will touch the relationships if necessary and the + // function will return. We can parse the IDs before inserting the records. + $this->newPivotStatement()->insert($this->formatAttachRecords( + $this->parseIds($id), $attributes + )); + } + + if ($touch) { + $this->touchIfTouching(); + } + } + + /** + * Attach a model to the parent using a custom class. + * + * @param mixed $id + * @param array $attributes + * @return void + */ + protected function attachUsingCustomClass($id, array $attributes) + { + $records = $this->formatAttachRecords( + $this->parseIds($id), $attributes + ); + + foreach ($records as $record) { + $this->newPivot($record, false)->save(); + } + } + + /** + * Create an array of records to insert into the pivot table. + * + * @param array $ids + * @param array $attributes + * @return array + */ + protected function formatAttachRecords($ids, array $attributes) + { + $records = []; + + $hasTimestamps = ($this->hasPivotColumn($this->createdAt()) || + $this->hasPivotColumn($this->updatedAt())); + + // To create the attachment records, we will simply spin through the IDs given + // and create a new record to insert for each ID. Each ID may actually be a + // key in the array, with extra attributes to be placed in other columns. + foreach ($ids as $key => $value) { + $records[] = $this->formatAttachRecord( + $key, $value, $attributes, $hasTimestamps + ); + } + + return $records; + } + + /** + * Create a full attachment record payload. + * + * @param int $key + * @param mixed $value + * @param array $attributes + * @param bool $hasTimestamps + * @return array + */ + protected function formatAttachRecord($key, $value, $attributes, $hasTimestamps) + { + [$id, $attributes] = $this->extractAttachIdAndAttributes($key, $value, $attributes); + + return array_merge( + $this->baseAttachRecord($id, $hasTimestamps), $this->castAttributes($attributes) + ); + } + + /** + * Get the attach record ID and extra attributes. + * + * @param mixed $key + * @param mixed $value + * @param array $attributes + * @return array + */ + protected function extractAttachIdAndAttributes($key, $value, array $attributes) + { + return is_array($value) + ? [$key, array_merge($value, $attributes)] + : [$value, $attributes]; + } + + /** + * Create a new pivot attachment record. + * + * @param int $id + * @param bool $timed + * @return array + */ + protected function baseAttachRecord($id, $timed) + { + $record[$this->relatedPivotKey] = $id; + + $record[$this->foreignPivotKey] = $this->parent->{$this->parentKey}; + + // If the record needs to have creation and update timestamps, we will make + // them by calling the parent model's "freshTimestamp" method which will + // provide us with a fresh timestamp in this model's preferred format. + if ($timed) { + $record = $this->addTimestampsToAttachment($record); + } + + foreach ($this->pivotValues as $value) { + $record[$value['column']] = $value['value']; + } + + return $record; + } + + /** + * Set the creation and update timestamps on an attach record. + * + * @param array $record + * @param bool $exists + * @return array + */ + protected function addTimestampsToAttachment(array $record, $exists = false) + { + $fresh = $this->parent->freshTimestamp(); + + if ($this->using) { + $pivotModel = new $this->using; + + $fresh = $fresh->format($pivotModel->getDateFormat()); + } + + if (! $exists && $this->hasPivotColumn($this->createdAt())) { + $record[$this->createdAt()] = $fresh; + } + + if ($this->hasPivotColumn($this->updatedAt())) { + $record[$this->updatedAt()] = $fresh; + } + + return $record; + } + + /** + * Determine whether the given column is defined as a pivot column. + * + * @param string $column + * @return bool + */ + public function hasPivotColumn($column) + { + return in_array($column, $this->pivotColumns); + } + + /** + * Detach models from the relationship. + * + * @param mixed $ids + * @param bool $touch + * @return int + */ + public function detach($ids = null, $touch = true) + { + if ($this->using && ! empty($ids) && empty($this->pivotWheres) && empty($this->pivotWhereIns)) { + $results = $this->detachUsingCustomClass($ids); + } else { + $query = $this->newPivotQuery(); + + // If associated IDs were passed to the method we will only delete those + // associations, otherwise all of the association ties will be broken. + // We'll return the numbers of affected rows when we do the deletes. + if (! is_null($ids)) { + $ids = $this->parseIds($ids); + + if (empty($ids)) { + return 0; + } + + $query->whereIn($this->getQualifiedRelatedPivotKeyName(), (array) $ids); + } + + // Once we have all of the conditions set on the statement, we are ready + // to run the delete on the pivot table. Then, if the touch parameter + // is true, we will go ahead and touch all related models to sync. + $results = $query->delete(); + } + + if ($touch) { + $this->touchIfTouching(); + } + + return $results; + } + + /** + * Detach models from the relationship using a custom class. + * + * @param mixed $ids + * @return int + */ + protected function detachUsingCustomClass($ids) + { + $results = 0; + + foreach ($this->parseIds($ids) as $id) { + $results += $this->newPivot([ + $this->foreignPivotKey => $this->parent->{$this->parentKey}, + $this->relatedPivotKey => $id, + ], true)->delete(); + } + + return $results; + } + + /** + * Get the pivot models that are currently attached. + * + * @return \Illuminate\Support\Collection + */ + protected function getCurrentlyAttachedPivots() + { + return $this->newPivotQuery()->get()->map(function ($record) { + $class = $this->using ? $this->using : Pivot::class; + + return (new $class)->setRawAttributes((array) $record, true); + }); + } + + /** + * Create a new pivot model instance. + * + * @param array $attributes + * @param bool $exists + * @return \Illuminate\Database\Eloquent\Relations\Pivot + */ + public function newPivot(array $attributes = [], $exists = false) + { + $pivot = $this->related->newPivot( + $this->parent, $attributes, $this->table, $exists, $this->using + ); + + return $pivot->setPivotKeys($this->foreignPivotKey, $this->relatedPivotKey); + } + + /** + * Create a new existing pivot model instance. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Relations\Pivot + */ + public function newExistingPivot(array $attributes = []) + { + return $this->newPivot($attributes, true); + } + + /** + * Get a new plain query builder for the pivot table. + * + * @return \Illuminate\Database\Query\Builder + */ + public function newPivotStatement() + { + return $this->query->getQuery()->newQuery()->from($this->table); + } + + /** + * Get a new pivot statement for a given "other" ID. + * + * @param mixed $id + * @return \Illuminate\Database\Query\Builder + */ + public function newPivotStatementForId($id) + { + return $this->newPivotQuery()->whereIn($this->relatedPivotKey, $this->parseIds($id)); + } + + /** + * Create a new query builder for the pivot table. + * + * @return \Illuminate\Database\Query\Builder + */ + public function newPivotQuery() + { + $query = $this->newPivotStatement(); + + foreach ($this->pivotWheres as $arguments) { + $query->where(...$arguments); + } + + foreach ($this->pivotWhereIns as $arguments) { + $query->whereIn(...$arguments); + } + + return $query->where($this->getQualifiedForeignPivotKeyName(), $this->parent->{$this->parentKey}); + } + + /** + * Set the columns on the pivot table to retrieve. + * + * @param array|mixed $columns + * @return $this + */ + public function withPivot($columns) + { + $this->pivotColumns = array_merge( + $this->pivotColumns, is_array($columns) ? $columns : func_get_args() + ); + + return $this; + } + + /** + * Get all of the IDs from the given mixed value. + * + * @param mixed $value + * @return array + */ + protected function parseIds($value) + { + if ($value instanceof Model) { + return [$value->{$this->relatedKey}]; + } + + if ($value instanceof Collection) { + return $value->pluck($this->relatedKey)->all(); + } + + if ($value instanceof BaseCollection) { + return $value->toArray(); + } + + return (array) $value; + } + + /** + * Get the ID from the given mixed value. + * + * @param mixed $value + * @return mixed + */ + protected function parseId($value) + { + return $value instanceof Model ? $value->{$this->relatedKey} : $value; + } + + /** + * Cast the given keys to integers if they are numeric and string otherwise. + * + * @param array $keys + * @return array + */ + protected function castKeys(array $keys) + { + return array_map(function ($v) { + return $this->castKey($v); + }, $keys); + } + + /** + * Cast the given key to convert to primary key type. + * + * @param mixed $key + * @return mixed + */ + protected function castKey($key) + { + return $this->getTypeSwapValue( + $this->related->getKeyType(), + $key + ); + } + + /** + * Cast the given pivot attributes. + * + * @param array $attributes + * @return array + */ + protected function castAttributes($attributes) + { + return $this->using + ? $this->newPivot()->fill($attributes)->getAttributes() + : $attributes; + } + + /** + * Converts a given value to a given type value. + * + * @param string $type + * @param mixed $value + * @return mixed + */ + protected function getTypeSwapValue($type, $value) + { + switch (strtolower($type)) { + case 'int': + case 'integer': + return (int) $value; + case 'real': + case 'float': + case 'double': + return (float) $value; + case 'string': + return (string) $value; + default: + return $value; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.php new file mode 100644 index 00000000..74e758f5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.php @@ -0,0 +1,63 @@ +withDefault = $callback; + + return $this; + } + + /** + * Get the default value for this relation. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @return \Illuminate\Database\Eloquent\Model|null + */ + protected function getDefaultFor(Model $parent) + { + if (! $this->withDefault) { + return; + } + + $instance = $this->newRelatedInstanceFor($parent); + + if (is_callable($this->withDefault)) { + return call_user_func($this->withDefault, $instance, $parent) ?: $instance; + } + + if (is_array($this->withDefault)) { + $instance->forceFill($this->withDefault); + } + + return $instance; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php new file mode 100755 index 00000000..b005d4ff --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php @@ -0,0 +1,49 @@ +getParentKey()) + ? $this->query->get() + : $this->related->newCollection(); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->related->newCollection()); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $this->matchMany($models, $results, $relation); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php new file mode 100644 index 00000000..3fe3b8d5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php @@ -0,0 +1,669 @@ +localKey = $localKey; + $this->firstKey = $firstKey; + $this->secondKey = $secondKey; + $this->farParent = $farParent; + $this->throughParent = $throughParent; + $this->secondLocalKey = $secondLocalKey; + + parent::__construct($query, $throughParent); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + $localValue = $this->farParent[$this->localKey]; + + $this->performJoin(); + + if (static::$constraints) { + $this->query->where($this->getQualifiedFirstKeyName(), '=', $localValue); + } + } + + /** + * Set the join clause on the query. + * + * @param \Illuminate\Database\Eloquent\Builder|null $query + * @return void + */ + protected function performJoin(Builder $query = null) + { + $query = $query ?: $this->query; + + $farKey = $this->getQualifiedFarKeyName(); + + $query->join($this->throughParent->getTable(), $this->getQualifiedParentKeyName(), '=', $farKey); + + if ($this->throughParentSoftDeletes()) { + $query->whereNull($this->throughParent->getQualifiedDeletedAtColumn()); + } + } + + /** + * Get the fully qualified parent key name. + * + * @return string + */ + public function getQualifiedParentKeyName() + { + return $this->parent->qualifyColumn($this->secondLocalKey); + } + + /** + * Determine whether "through" parent of the relation uses Soft Deletes. + * + * @return bool + */ + public function throughParentSoftDeletes() + { + return in_array(SoftDeletes::class, class_uses_recursive($this->throughParent)); + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + $whereIn = $this->whereInMethod($this->farParent, $this->localKey); + + $this->query->{$whereIn}( + $this->getQualifiedFirstKeyName(), $this->getKeys($models, $this->localKey) + ); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->related->newCollection()); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + $dictionary = $this->buildDictionary($results); + + // Once we have the dictionary we can simply spin through the parent models to + // link them up with their children using the keyed dictionary to make the + // matching very convenient and easy work. Then we'll just return them. + foreach ($models as $model) { + if (isset($dictionary[$key = $model->getAttribute($this->localKey)])) { + $model->setRelation( + $relation, $this->related->newCollection($dictionary[$key]) + ); + } + } + + return $models; + } + + /** + * Build model dictionary keyed by the relation's foreign key. + * + * @param \Illuminate\Database\Eloquent\Collection $results + * @return array + */ + protected function buildDictionary(Collection $results) + { + $dictionary = []; + + // First we will create a dictionary of models keyed by the foreign key of the + // relationship as this will allow us to quickly access all of the related + // models without having to do nested looping which will be quite slow. + foreach ($results as $result) { + $dictionary[$result->laravel_through_key][] = $result; + } + + return $dictionary; + } + + /** + * Get the first related model record matching the attributes or instantiate it. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrNew(array $attributes) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->related->newInstance($attributes); + } + + return $instance; + } + + /** + * Create or update a related record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model + */ + public function updateOrCreate(array $attributes, array $values = []) + { + $instance = $this->firstOrNew($attributes); + + $instance->fill($values)->save(); + + return $instance; + } + + /** + * Add a basic where clause to the query, and return the first result. + * + * @param \Closure|string|array $column + * @param mixed $operator + * @param mixed $value + * @param string $boolean + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function firstWhere($column, $operator = null, $value = null, $boolean = 'and') + { + return $this->where($column, $operator, $value, $boolean)->first(); + } + + /** + * Execute the query and get the first related model. + * + * @param array $columns + * @return mixed + */ + public function first($columns = ['*']) + { + $results = $this->take(1)->get($columns); + + return count($results) > 0 ? $results->first() : null; + } + + /** + * Execute the query and get the first result or throw an exception. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function firstOrFail($columns = ['*']) + { + if (! is_null($model = $this->first($columns))) { + return $model; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->related)); + } + + /** + * Find a related model by its primary key. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null + */ + public function find($id, $columns = ['*']) + { + if (is_array($id)) { + return $this->findMany($id, $columns); + } + + return $this->where( + $this->getRelated()->getQualifiedKeyName(), '=', $id + )->first($columns); + } + + /** + * Find multiple related models by their primary keys. + * + * @param mixed $ids + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function findMany($ids, $columns = ['*']) + { + if (empty($ids)) { + return $this->getRelated()->newCollection(); + } + + return $this->whereIn( + $this->getRelated()->getQualifiedKeyName(), $ids + )->get($columns); + } + + /** + * Find a related model by its primary key or throw an exception. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function findOrFail($id, $columns = ['*']) + { + $result = $this->find($id, $columns); + + if (is_array($id)) { + if (count($result) === count(array_unique($id))) { + return $result; + } + } elseif (! is_null($result)) { + return $result; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->related), $id); + } + + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return ! is_null($this->farParent->{$this->localKey}) + ? $this->get() + : $this->related->newCollection(); + } + + /** + * Execute the query as a "select" statement. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function get($columns = ['*']) + { + $builder = $this->prepareQueryBuilder($columns); + + $models = $builder->getModels(); + + // If we actually found models we will also eager load any relationships that + // have been specified as needing to be eager loaded. This will solve the + // n + 1 query problem for the developer and also increase performance. + if (count($models) > 0) { + $models = $builder->eagerLoadRelations($models); + } + + return $this->related->newCollection($models); + } + + /** + * Get a paginator for the "select" statement. + * + * @param int|null $perPage + * @param array $columns + * @param string $pageName + * @param int $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $this->query->addSelect($this->shouldSelect($columns)); + + return $this->query->paginate($perPage, $columns, $pageName, $page); + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int|null $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $this->query->addSelect($this->shouldSelect($columns)); + + return $this->query->simplePaginate($perPage, $columns, $pageName, $page); + } + + /** + * Set the select clause for the relation query. + * + * @param array $columns + * @return array + */ + protected function shouldSelect(array $columns = ['*']) + { + if ($columns == ['*']) { + $columns = [$this->related->getTable().'.*']; + } + + return array_merge($columns, [$this->getQualifiedFirstKeyName().' as laravel_through_key']); + } + + /** + * Chunk the results of the query. + * + * @param int $count + * @param callable $callback + * @return bool + */ + public function chunk($count, callable $callback) + { + return $this->prepareQueryBuilder()->chunk($count, $callback); + } + + /** + * Chunk the results of a query by comparing numeric IDs. + * + * @param int $count + * @param callable $callback + * @param string|null $column + * @param string|null $alias + * @return bool + */ + public function chunkById($count, callable $callback, $column = null, $alias = null) + { + $column = $column ?? $this->getRelated()->getQualifiedKeyName(); + + $alias = $alias ?? $this->getRelated()->getKeyName(); + + return $this->prepareQueryBuilder()->chunkById($count, $callback, $column, $alias); + } + + /** + * Get a generator for the given query. + * + * @return \Generator + */ + public function cursor() + { + return $this->prepareQueryBuilder()->cursor(); + } + + /** + * Execute a callback over each item while chunking. + * + * @param callable $callback + * @param int $count + * @return bool + */ + public function each(callable $callback, $count = 1000) + { + return $this->chunk($count, function ($results) use ($callback) { + foreach ($results as $key => $value) { + if ($callback($value, $key) === false) { + return false; + } + } + }); + } + + /** + * Prepare the query builder for query execution. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function prepareQueryBuilder($columns = ['*']) + { + $builder = $this->query->applyScopes(); + + return $builder->addSelect( + $this->shouldSelect($builder->getQuery()->columns ? [] : $columns) + ); + } + + /** + * Add the constraints for a relationship query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + if ($parentQuery->getQuery()->from === $query->getQuery()->from) { + return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns); + } + + if ($parentQuery->getQuery()->from === $this->throughParent->getTable()) { + return $this->getRelationExistenceQueryForThroughSelfRelation($query, $parentQuery, $columns); + } + + $this->performJoin($query); + + return $query->select($columns)->whereColumn( + $this->getQualifiedLocalKeyName(), '=', $this->getQualifiedFirstKeyName() + ); + } + + /** + * Add the constraints for a relationship query on the same table. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) + { + $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); + + $query->join($this->throughParent->getTable(), $this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->secondKey); + + if ($this->throughParentSoftDeletes()) { + $query->whereNull($this->throughParent->getQualifiedDeletedAtColumn()); + } + + $query->getModel()->setTable($hash); + + return $query->select($columns)->whereColumn( + $parentQuery->getQuery()->from.'.'.$this->localKey, '=', $this->getQualifiedFirstKeyName() + ); + } + + /** + * Add the constraints for a relationship query on the same table as the through parent. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQueryForThroughSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) + { + $table = $this->throughParent->getTable().' as '.$hash = $this->getRelationCountHash(); + + $query->join($table, $hash.'.'.$this->secondLocalKey, '=', $this->getQualifiedFarKeyName()); + + if ($this->throughParentSoftDeletes()) { + $query->whereNull($hash.'.'.$this->throughParent->getDeletedAtColumn()); + } + + return $query->select($columns)->whereColumn( + $parentQuery->getQuery()->from.'.'.$this->localKey, '=', $hash.'.'.$this->firstKey + ); + } + + /** + * Get a relationship join table hash. + * + * @return string + */ + public function getRelationCountHash() + { + return 'laravel_reserved_'.static::$selfJoinCount++; + } + + /** + * Get the qualified foreign key on the related model. + * + * @return string + */ + public function getQualifiedFarKeyName() + { + return $this->getQualifiedForeignKeyName(); + } + + /** + * Get the foreign key on the "through" model. + * + * @return string + */ + public function getFirstKeyName() + { + return $this->firstKey; + } + + /** + * Get the qualified foreign key on the "through" model. + * + * @return string + */ + public function getQualifiedFirstKeyName() + { + return $this->throughParent->qualifyColumn($this->firstKey); + } + + /** + * Get the foreign key on the related model. + * + * @return string + */ + public function getForeignKeyName() + { + return $this->secondKey; + } + + /** + * Get the qualified foreign key on the related model. + * + * @return string + */ + public function getQualifiedForeignKeyName() + { + return $this->related->qualifyColumn($this->secondKey); + } + + /** + * Get the local key on the far parent model. + * + * @return string + */ + public function getLocalKeyName() + { + return $this->localKey; + } + + /** + * Get the qualified local key on the far parent model. + * + * @return string + */ + public function getQualifiedLocalKeyName() + { + return $this->farParent->qualifyColumn($this->localKey); + } + + /** + * Get the local key on the intermediary model. + * + * @return string + */ + public function getSecondLocalKeyName() + { + return $this->secondLocalKey; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOne.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOne.php new file mode 100755 index 00000000..1d9e008f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOne.php @@ -0,0 +1,68 @@ +getParentKey())) { + return $this->getDefaultFor($this->parent); + } + + return $this->query->first() ?: $this->getDefaultFor($this->parent); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->getDefaultFor($model)); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $this->matchOne($models, $results, $relation); + } + + /** + * Make a new related instance for the given model. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @return \Illuminate\Database\Eloquent\Model + */ + public function newRelatedInstanceFor(Model $parent) + { + return $this->related->newInstance()->setAttribute( + $this->getForeignKeyName(), $parent->{$this->localKey} + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php new file mode 100755 index 00000000..bc547702 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php @@ -0,0 +1,420 @@ +localKey = $localKey; + $this->foreignKey = $foreignKey; + + parent::__construct($query, $parent); + } + + /** + * Create and return an un-saved instance of the related model. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function make(array $attributes = []) + { + return tap($this->related->newInstance($attributes), function ($instance) { + $this->setForeignAttributesForCreate($instance); + }); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + if (static::$constraints) { + $this->query->where($this->foreignKey, '=', $this->getParentKey()); + + $this->query->whereNotNull($this->foreignKey); + } + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + $whereIn = $this->whereInMethod($this->parent, $this->localKey); + + $this->query->{$whereIn}( + $this->foreignKey, $this->getKeys($models, $this->localKey) + ); + } + + /** + * Match the eagerly loaded results to their single parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function matchOne(array $models, Collection $results, $relation) + { + return $this->matchOneOrMany($models, $results, $relation, 'one'); + } + + /** + * Match the eagerly loaded results to their many parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function matchMany(array $models, Collection $results, $relation) + { + return $this->matchOneOrMany($models, $results, $relation, 'many'); + } + + /** + * Match the eagerly loaded results to their many parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @param string $type + * @return array + */ + protected function matchOneOrMany(array $models, Collection $results, $relation, $type) + { + $dictionary = $this->buildDictionary($results); + + // Once we have the dictionary we can simply spin through the parent models to + // link them up with their children using the keyed dictionary to make the + // matching very convenient and easy work. Then we'll just return them. + foreach ($models as $model) { + if (isset($dictionary[$key = $model->getAttribute($this->localKey)])) { + $model->setRelation( + $relation, $this->getRelationValue($dictionary, $key, $type) + ); + } + } + + return $models; + } + + /** + * Get the value of a relationship by one or many type. + * + * @param array $dictionary + * @param string $key + * @param string $type + * @return mixed + */ + protected function getRelationValue(array $dictionary, $key, $type) + { + $value = $dictionary[$key]; + + return $type === 'one' ? reset($value) : $this->related->newCollection($value); + } + + /** + * Build model dictionary keyed by the relation's foreign key. + * + * @param \Illuminate\Database\Eloquent\Collection $results + * @return array + */ + protected function buildDictionary(Collection $results) + { + $foreign = $this->getForeignKeyName(); + + return $results->mapToDictionary(function ($result) use ($foreign) { + return [$result->{$foreign} => $result]; + })->all(); + } + + /** + * Find a model by its primary key or return new instance of the related model. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model + */ + public function findOrNew($id, $columns = ['*']) + { + if (is_null($instance = $this->find($id, $columns))) { + $instance = $this->related->newInstance(); + + $this->setForeignAttributesForCreate($instance); + } + + return $instance; + } + + /** + * Get the first related model record matching the attributes or instantiate it. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrNew(array $attributes, array $values = []) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->related->newInstance($attributes + $values); + + $this->setForeignAttributesForCreate($instance); + } + + return $instance; + } + + /** + * Get the first related record matching the attributes or create it. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrCreate(array $attributes, array $values = []) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->create($attributes + $values); + } + + return $instance; + } + + /** + * Create or update a related record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model + */ + public function updateOrCreate(array $attributes, array $values = []) + { + return tap($this->firstOrNew($attributes), function ($instance) use ($values) { + $instance->fill($values); + + $instance->save(); + }); + } + + /** + * Attach a model instance to the parent model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return \Illuminate\Database\Eloquent\Model|false + */ + public function save(Model $model) + { + $this->setForeignAttributesForCreate($model); + + return $model->save() ? $model : false; + } + + /** + * Attach a collection of models to the parent instance. + * + * @param iterable $models + * @return iterable + */ + public function saveMany($models) + { + foreach ($models as $model) { + $this->save($model); + } + + return $models; + } + + /** + * Create a new instance of the related model. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function create(array $attributes = []) + { + return tap($this->related->newInstance($attributes), function ($instance) { + $this->setForeignAttributesForCreate($instance); + + $instance->save(); + }); + } + + /** + * Create a Collection of new instances of the related model. + * + * @param iterable $records + * @return \Illuminate\Database\Eloquent\Collection + */ + public function createMany(iterable $records) + { + $instances = $this->related->newCollection(); + + foreach ($records as $record) { + $instances->push($this->create($record)); + } + + return $instances; + } + + /** + * Set the foreign ID for creating a related model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return void + */ + protected function setForeignAttributesForCreate(Model $model) + { + $model->setAttribute($this->getForeignKeyName(), $this->getParentKey()); + } + + /** + * Add the constraints for a relationship query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + if ($query->getQuery()->from == $parentQuery->getQuery()->from) { + return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns); + } + + return parent::getRelationExistenceQuery($query, $parentQuery, $columns); + } + + /** + * Add the constraints for a relationship query on the same table. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) + { + $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); + + $query->getModel()->setTable($hash); + + return $query->select($columns)->whereColumn( + $this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->getForeignKeyName() + ); + } + + /** + * Get a relationship join table hash. + * + * @return string + */ + public function getRelationCountHash() + { + return 'laravel_reserved_'.static::$selfJoinCount++; + } + + /** + * Get the key for comparing against the parent key in "has" query. + * + * @return string + */ + public function getExistenceCompareKey() + { + return $this->getQualifiedForeignKeyName(); + } + + /** + * Get the key value of the parent's local key. + * + * @return mixed + */ + public function getParentKey() + { + return $this->parent->getAttribute($this->localKey); + } + + /** + * Get the fully qualified parent key name. + * + * @return string + */ + public function getQualifiedParentKeyName() + { + return $this->parent->qualifyColumn($this->localKey); + } + + /** + * Get the plain foreign key. + * + * @return string + */ + public function getForeignKeyName() + { + $segments = explode('.', $this->getQualifiedForeignKeyName()); + + return end($segments); + } + + /** + * Get the foreign key for the relationship. + * + * @return string + */ + public function getQualifiedForeignKeyName() + { + return $this->foreignKey; + } + + /** + * Get the local key for the relationship. + * + * @return string + */ + public function getLocalKeyName() + { + return $this->localKey; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneThrough.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneThrough.php new file mode 100644 index 00000000..a48c3186 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneThrough.php @@ -0,0 +1,76 @@ +first() ?: $this->getDefaultFor($this->farParent); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->getDefaultFor($model)); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + $dictionary = $this->buildDictionary($results); + + // Once we have the dictionary we can simply spin through the parent models to + // link them up with their children using the keyed dictionary to make the + // matching very convenient and easy work. Then we'll just return them. + foreach ($models as $model) { + if (isset($dictionary[$key = $model->getAttribute($this->localKey)])) { + $value = $dictionary[$key]; + $model->setRelation( + $relation, reset($value) + ); + } + } + + return $models; + } + + /** + * Make a new related instance for the given model. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @return \Illuminate\Database\Eloquent\Model + */ + public function newRelatedInstanceFor(Model $parent) + { + return $this->related->newInstance(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphMany.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphMany.php new file mode 100755 index 00000000..12b06502 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphMany.php @@ -0,0 +1,49 @@ +getParentKey()) + ? $this->query->get() + : $this->related->newCollection(); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->related->newCollection()); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $this->matchMany($models, $results, $relation); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOne.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOne.php new file mode 100755 index 00000000..5f8da14f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOne.php @@ -0,0 +1,68 @@ +getParentKey())) { + return $this->getDefaultFor($this->parent); + } + + return $this->query->first() ?: $this->getDefaultFor($this->parent); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->getDefaultFor($model)); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $this->matchOne($models, $results, $relation); + } + + /** + * Make a new related instance for the given model. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @return \Illuminate\Database\Eloquent\Model + */ + public function newRelatedInstanceFor(Model $parent) + { + return $this->related->newInstance() + ->setAttribute($this->getForeignKeyName(), $parent->{$this->localKey}) + ->setAttribute($this->getMorphType(), $this->morphClass); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php new file mode 100755 index 00000000..887ebe24 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php @@ -0,0 +1,127 @@ +morphType = $type; + + $this->morphClass = $parent->getMorphClass(); + + parent::__construct($query, $parent, $id, $localKey); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + if (static::$constraints) { + parent::addConstraints(); + + $this->query->where($this->morphType, $this->morphClass); + } + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + parent::addEagerConstraints($models); + + $this->query->where($this->morphType, $this->morphClass); + } + + /** + * Set the foreign ID and type for creating a related model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return void + */ + protected function setForeignAttributesForCreate(Model $model) + { + $model->{$this->getForeignKeyName()} = $this->getParentKey(); + + $model->{$this->getMorphType()} = $this->morphClass; + } + + /** + * Get the relationship query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + return parent::getRelationExistenceQuery($query, $parentQuery, $columns)->where( + $query->qualifyColumn($this->getMorphType()), $this->morphClass + ); + } + + /** + * Get the foreign key "type" name. + * + * @return string + */ + public function getQualifiedMorphType() + { + return $this->morphType; + } + + /** + * Get the plain morph type name without the table. + * + * @return string + */ + public function getMorphType() + { + return last(explode('.', $this->morphType)); + } + + /** + * Get the class name of the parent model. + * + * @return string + */ + public function getMorphClass() + { + return $this->morphClass; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php new file mode 100644 index 00000000..68489265 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php @@ -0,0 +1,162 @@ +where($this->morphType, $this->morphClass); + + return parent::setKeysForSaveQuery($query); + } + + /** + * Delete the pivot model record from the database. + * + * @return int + */ + public function delete() + { + if (isset($this->attributes[$this->getKeyName()])) { + return (int) parent::delete(); + } + + if ($this->fireModelEvent('deleting') === false) { + return 0; + } + + $query = $this->getDeleteQuery(); + + $query->where($this->morphType, $this->morphClass); + + return tap($query->delete(), function () { + $this->fireModelEvent('deleted', false); + }); + } + + /** + * Set the morph type for the pivot. + * + * @param string $morphType + * @return $this + */ + public function setMorphType($morphType) + { + $this->morphType = $morphType; + + return $this; + } + + /** + * Set the morph class for the pivot. + * + * @param string $morphClass + * @return \Illuminate\Database\Eloquent\Relations\MorphPivot + */ + public function setMorphClass($morphClass) + { + $this->morphClass = $morphClass; + + return $this; + } + + /** + * Get the queueable identity for the entity. + * + * @return mixed + */ + public function getQueueableId() + { + if (isset($this->attributes[$this->getKeyName()])) { + return $this->getKey(); + } + + return sprintf( + '%s:%s:%s:%s:%s:%s', + $this->foreignKey, $this->getAttribute($this->foreignKey), + $this->relatedKey, $this->getAttribute($this->relatedKey), + $this->morphType, $this->morphClass + ); + } + + /** + * Get a new query to restore one or more models by their queueable IDs. + * + * @param array|int $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQueryForRestoration($ids) + { + if (is_array($ids)) { + return $this->newQueryForCollectionRestoration($ids); + } + + if (! Str::contains($ids, ':')) { + return parent::newQueryForRestoration($ids); + } + + $segments = explode(':', $ids); + + return $this->newQueryWithoutScopes() + ->where($segments[0], $segments[1]) + ->where($segments[2], $segments[3]) + ->where($segments[4], $segments[5]); + } + + /** + * Get a new query to restore multiple models by their queueable IDs. + * + * @param array $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function newQueryForCollectionRestoration(array $ids) + { + $ids = array_values($ids); + + if (! Str::contains($ids[0], ':')) { + return parent::newQueryForRestoration($ids); + } + + $query = $this->newQueryWithoutScopes(); + + foreach ($ids as $id) { + $segments = explode(':', $id); + + $query->orWhere(function ($query) use ($segments) { + return $query->where($segments[0], $segments[1]) + ->where($segments[2], $segments[3]) + ->where($segments[4], $segments[5]); + }); + } + + return $query; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php new file mode 100644 index 00000000..f0911c9d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -0,0 +1,328 @@ +morphType = $type; + + parent::__construct($query, $parent, $foreignKey, $ownerKey, $relation); + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + $this->buildDictionary($this->models = Collection::make($models)); + } + + /** + * Build a dictionary with the models. + * + * @param \Illuminate\Database\Eloquent\Collection $models + * @return void + */ + protected function buildDictionary(Collection $models) + { + foreach ($models as $model) { + if ($model->{$this->morphType}) { + $this->dictionary[$model->{$this->morphType}][$model->{$this->foreignKey}][] = $model; + } + } + } + + /** + * Get the results of the relationship. + * + * Called via eager load method of Eloquent query builder. + * + * @return mixed + */ + public function getEager() + { + foreach (array_keys($this->dictionary) as $type) { + $this->matchToMorphParents($type, $this->getResultsByType($type)); + } + + return $this->models; + } + + /** + * Get all of the relation results for a type. + * + * @param string $type + * @return \Illuminate\Database\Eloquent\Collection + */ + protected function getResultsByType($type) + { + $instance = $this->createModelByType($type); + + $ownerKey = $this->ownerKey ?? $instance->getKeyName(); + + $query = $this->replayMacros($instance->newQuery()) + ->mergeConstraintsFrom($this->getQuery()) + ->with(array_merge( + $this->getQuery()->getEagerLoads(), + (array) ($this->morphableEagerLoads[get_class($instance)] ?? []) + )); + + $whereIn = $this->whereInMethod($instance, $ownerKey); + + return $query->{$whereIn}( + $instance->getTable().'.'.$ownerKey, $this->gatherKeysByType($type) + )->get(); + } + + /** + * Gather all of the foreign keys for a given type. + * + * @param string $type + * @return array + */ + protected function gatherKeysByType($type) + { + return array_keys($this->dictionary[$type]); + } + + /** + * Create a new model instance by type. + * + * @param string $type + * @return \Illuminate\Database\Eloquent\Model + */ + public function createModelByType($type) + { + $class = Model::getActualClassNameForMorph($type); + + return tap(new $class, function ($instance) { + if (! $instance->getConnectionName()) { + $instance->setConnection($this->getConnection()->getName()); + } + }); + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $models; + } + + /** + * Match the results for a given type to their parents. + * + * @param string $type + * @param \Illuminate\Database\Eloquent\Collection $results + * @return void + */ + protected function matchToMorphParents($type, Collection $results) + { + foreach ($results as $result) { + $ownerKey = ! is_null($this->ownerKey) ? $result->{$this->ownerKey} : $result->getKey(); + + if (isset($this->dictionary[$type][$ownerKey])) { + foreach ($this->dictionary[$type][$ownerKey] as $model) { + $model->setRelation($this->relationName, $result); + } + } + } + } + + /** + * Associate the model instance to the given parent. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return \Illuminate\Database\Eloquent\Model + */ + public function associate($model) + { + $this->parent->setAttribute( + $this->foreignKey, $model instanceof Model ? $model->getKey() : null + ); + + $this->parent->setAttribute( + $this->morphType, $model instanceof Model ? $model->getMorphClass() : null + ); + + return $this->parent->setRelation($this->relationName, $model); + } + + /** + * Dissociate previously associated model from the given parent. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function dissociate() + { + $this->parent->setAttribute($this->foreignKey, null); + + $this->parent->setAttribute($this->morphType, null); + + return $this->parent->setRelation($this->relationName, null); + } + + /** + * Touch all of the related models for the relationship. + * + * @return void + */ + public function touch() + { + if (! is_null($this->child->{$this->foreignKey})) { + parent::touch(); + } + } + + /** + * Make a new related instance for the given model. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @return \Illuminate\Database\Eloquent\Model + */ + protected function newRelatedInstanceFor(Model $parent) + { + return $parent->{$this->getRelationName()}()->getRelated()->newInstance(); + } + + /** + * Get the foreign key "type" name. + * + * @return string + */ + public function getMorphType() + { + return $this->morphType; + } + + /** + * Get the dictionary used by the relationship. + * + * @return array + */ + public function getDictionary() + { + return $this->dictionary; + } + + /** + * Specify which relations to load for a given morph type. + * + * @param array $with + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + public function morphWith(array $with) + { + $this->morphableEagerLoads = array_merge( + $this->morphableEagerLoads, $with + ); + + return $this; + } + + /** + * Replay stored macro calls on the actual related instance. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function replayMacros(Builder $query) + { + foreach ($this->macroBuffer as $macro) { + $query->{$macro['method']}(...$macro['parameters']); + } + + return $query; + } + + /** + * Handle dynamic method calls to the relationship. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + try { + $result = parent::__call($method, $parameters); + + if (in_array($method, ['select', 'selectRaw', 'selectSub', 'addSelect', 'withoutGlobalScopes'])) { + $this->macroBuffer[] = compact('method', 'parameters'); + } + + return $result; + } + + // If we tried to call a method that does not exist on the parent Builder instance, + // we'll assume that we want to call a query macro (e.g. withTrashed) that only + // exists on related models. We will just store the call and replay it later. + catch (BadMethodCallException $e) { + $this->macroBuffer[] = compact('method', 'parameters'); + + return $this; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php new file mode 100644 index 00000000..0adf385e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php @@ -0,0 +1,209 @@ +inverse = $inverse; + $this->morphType = $name.'_type'; + $this->morphClass = $inverse ? $query->getModel()->getMorphClass() : $parent->getMorphClass(); + + parent::__construct( + $query, $parent, $table, $foreignPivotKey, + $relatedPivotKey, $parentKey, $relatedKey, $relationName + ); + } + + /** + * Set the where clause for the relation query. + * + * @return $this + */ + protected function addWhereConstraints() + { + parent::addWhereConstraints(); + + $this->query->where($this->table.'.'.$this->morphType, $this->morphClass); + + return $this; + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + parent::addEagerConstraints($models); + + $this->query->where($this->table.'.'.$this->morphType, $this->morphClass); + } + + /** + * Create a new pivot attachment record. + * + * @param int $id + * @param bool $timed + * @return array + */ + protected function baseAttachRecord($id, $timed) + { + return Arr::add( + parent::baseAttachRecord($id, $timed), $this->morphType, $this->morphClass + ); + } + + /** + * Add the constraints for a relationship count query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + return parent::getRelationExistenceQuery($query, $parentQuery, $columns)->where( + $this->table.'.'.$this->morphType, $this->morphClass + ); + } + + /** + * Get the pivot models that are currently attached. + * + * @return \Illuminate\Support\Collection + */ + protected function getCurrentlyAttachedPivots() + { + return parent::getCurrentlyAttachedPivots()->map(function ($record) { + return $record instanceof MorphPivot + ? $record->setMorphType($this->morphType) + ->setMorphClass($this->morphClass) + : $record; + }); + } + + /** + * Create a new query builder for the pivot table. + * + * @return \Illuminate\Database\Query\Builder + */ + public function newPivotQuery() + { + return parent::newPivotQuery()->where($this->morphType, $this->morphClass); + } + + /** + * Create a new pivot model instance. + * + * @param array $attributes + * @param bool $exists + * @return \Illuminate\Database\Eloquent\Relations\Pivot + */ + public function newPivot(array $attributes = [], $exists = false) + { + $using = $this->using; + + $pivot = $using ? $using::fromRawAttributes($this->parent, $attributes, $this->table, $exists) + : MorphPivot::fromAttributes($this->parent, $attributes, $this->table, $exists); + + $pivot->setPivotKeys($this->foreignPivotKey, $this->relatedPivotKey) + ->setMorphType($this->morphType) + ->setMorphClass($this->morphClass); + + return $pivot; + } + + /** + * Get the pivot columns for the relation. + * + * "pivot_" is prefixed at each column for easy removal later. + * + * @return array + */ + protected function aliasedPivotColumns() + { + $defaults = [$this->foreignPivotKey, $this->relatedPivotKey, $this->morphType]; + + return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) { + return $this->table.'.'.$column.' as pivot_'.$column; + })->unique()->all(); + } + + /** + * Get the foreign key "type" name. + * + * @return string + */ + public function getMorphType() + { + return $this->morphType; + } + + /** + * Get the class name of the parent model. + * + * @return string + */ + public function getMorphClass() + { + return $this->morphClass; + } + + /** + * Get the indicator for a reverse relationship. + * + * @return bool + */ + public function getInverse() + { + return $this->inverse; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php new file mode 100755 index 00000000..a65ecdea --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php @@ -0,0 +1,25 @@ +query = $query; + $this->parent = $parent; + $this->related = $query->getModel(); + + $this->addConstraints(); + } + + /** + * Run a callback with constraints disabled on the relation. + * + * @param \Closure $callback + * @return mixed + */ + public static function noConstraints(Closure $callback) + { + $previous = static::$constraints; + + static::$constraints = false; + + // When resetting the relation where clause, we want to shift the first element + // off of the bindings, leaving only the constraints that the developers put + // as "extra" on the relationships, and not original relation constraints. + try { + return $callback(); + } finally { + static::$constraints = $previous; + } + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + abstract public function addConstraints(); + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + abstract public function addEagerConstraints(array $models); + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + abstract public function initRelation(array $models, $relation); + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + abstract public function match(array $models, Collection $results, $relation); + + /** + * Get the results of the relationship. + * + * @return mixed + */ + abstract public function getResults(); + + /** + * Get the relationship for eager loading. + * + * @return \Illuminate\Database\Eloquent\Collection + */ + public function getEager() + { + return $this->get(); + } + + /** + * Execute the query as a "select" statement. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function get($columns = ['*']) + { + return $this->query->get($columns); + } + + /** + * Touch all of the related models for the relationship. + * + * @return void + */ + public function touch() + { + $model = $this->getRelated(); + + if (! $model::isIgnoringTouch()) { + $this->rawUpdate([ + $model->getUpdatedAtColumn() => $model->freshTimestampString(), + ]); + } + } + + /** + * Run a raw update against the base query. + * + * @param array $attributes + * @return int + */ + public function rawUpdate(array $attributes = []) + { + return $this->query->withoutGlobalScopes()->update($attributes); + } + + /** + * Add the constraints for a relationship count query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceCountQuery(Builder $query, Builder $parentQuery) + { + return $this->getRelationExistenceQuery( + $query, $parentQuery, new Expression('count(*)') + )->setBindings([], 'select'); + } + + /** + * Add the constraints for an internal relationship existence query. + * + * Essentially, these queries compare on column names like whereColumn. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + return $query->select($columns)->whereColumn( + $this->getQualifiedParentKeyName(), '=', $this->getExistenceCompareKey() + ); + } + + /** + * Get all of the primary keys for an array of models. + * + * @param array $models + * @param string $key + * @return array + */ + protected function getKeys(array $models, $key = null) + { + return collect($models)->map(function ($value) use ($key) { + return $key ? $value->getAttribute($key) : $value->getKey(); + })->values()->unique(null, true)->sort()->all(); + } + + /** + * Get the underlying query for the relation. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getQuery() + { + return $this->query; + } + + /** + * Get the base query builder driving the Eloquent builder. + * + * @return \Illuminate\Database\Query\Builder + */ + public function getBaseQuery() + { + return $this->query->getQuery(); + } + + /** + * Get the parent model of the relation. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function getParent() + { + return $this->parent; + } + + /** + * Get the fully qualified parent key name. + * + * @return string + */ + public function getQualifiedParentKeyName() + { + return $this->parent->getQualifiedKeyName(); + } + + /** + * Get the related model of the relation. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function getRelated() + { + return $this->related; + } + + /** + * Get the name of the "created at" column. + * + * @return string + */ + public function createdAt() + { + return $this->parent->getCreatedAtColumn(); + } + + /** + * Get the name of the "updated at" column. + * + * @return string + */ + public function updatedAt() + { + return $this->parent->getUpdatedAtColumn(); + } + + /** + * Get the name of the related model's "updated at" column. + * + * @return string + */ + public function relatedUpdatedAt() + { + return $this->related->getUpdatedAtColumn(); + } + + /** + * Get the name of the "where in" method for eager loading. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @param string $key + * @return string + */ + protected function whereInMethod(Model $model, $key) + { + return $model->getKeyName() === last(explode('.', $key)) + && in_array($model->getKeyType(), ['int', 'integer']) + ? 'whereIntegerInRaw' + : 'whereIn'; + } + + /** + * Set or get the morph map for polymorphic relations. + * + * @param array|null $map + * @param bool $merge + * @return array + */ + public static function morphMap(array $map = null, $merge = true) + { + $map = static::buildMorphMapFromModels($map); + + if (is_array($map)) { + static::$morphMap = $merge && static::$morphMap + ? $map + static::$morphMap : $map; + } + + return static::$morphMap; + } + + /** + * Builds a table-keyed array from model class names. + * + * @param string[]|null $models + * @return array|null + */ + protected static function buildMorphMapFromModels(array $models = null) + { + if (is_null($models) || Arr::isAssoc($models)) { + return $models; + } + + return array_combine(array_map(function ($model) { + return (new $model)->getTable(); + }, $models), $models); + } + + /** + * Get the model associated with a custom polymorphic type. + * + * @param string $alias + * @return string|null + */ + public static function getMorphedModel($alias) + { + return static::$morphMap[$alias] ?? null; + } + + /** + * Handle dynamic method calls to the relationship. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + $result = $this->forwardCallTo($this->query, $method, $parameters); + + if ($result === $this->query) { + return $this; + } + + return $result; + } + + /** + * Force a clone of the underlying query builder when cloning. + * + * @return void + */ + public function __clone() + { + $this->query = clone $this->query; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Scope.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Scope.php new file mode 100644 index 00000000..63cba6a5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Scope.php @@ -0,0 +1,15 @@ +dates[] = $this->getDeletedAtColumn(); + } + + /** + * Force a hard delete on a soft deleted model. + * + * @return bool|null + */ + public function forceDelete() + { + $this->forceDeleting = true; + + return tap($this->delete(), function ($deleted) { + $this->forceDeleting = false; + + if ($deleted) { + $this->fireModelEvent('forceDeleted', false); + } + }); + } + + /** + * Perform the actual delete query on this model instance. + * + * @return mixed + */ + protected function performDeleteOnModel() + { + if ($this->forceDeleting) { + $this->exists = false; + + return $this->setKeysForSaveQuery($this->newModelQuery())->forceDelete(); + } + + return $this->runSoftDelete(); + } + + /** + * Perform the actual delete query on this model instance. + * + * @return void + */ + protected function runSoftDelete() + { + $query = $this->setKeysForSaveQuery($this->newModelQuery()); + + $time = $this->freshTimestamp(); + + $columns = [$this->getDeletedAtColumn() => $this->fromDateTime($time)]; + + $this->{$this->getDeletedAtColumn()} = $time; + + if ($this->timestamps && ! is_null($this->getUpdatedAtColumn())) { + $this->{$this->getUpdatedAtColumn()} = $time; + + $columns[$this->getUpdatedAtColumn()] = $this->fromDateTime($time); + } + + $query->update($columns); + + $this->syncOriginalAttributes(array_keys($columns)); + } + + /** + * Restore a soft-deleted model instance. + * + * @return bool|null + */ + public function restore() + { + // If the restoring event does not return false, we will proceed with this + // restore operation. Otherwise, we bail out so the developer will stop + // the restore totally. We will clear the deleted timestamp and save. + if ($this->fireModelEvent('restoring') === false) { + return false; + } + + $this->{$this->getDeletedAtColumn()} = null; + + // Once we have saved the model, we will fire the "restored" event so this + // developer will do anything they need to after a restore operation is + // totally finished. Then we will return the result of the save call. + $this->exists = true; + + $result = $this->save(); + + $this->fireModelEvent('restored', false); + + return $result; + } + + /** + * Determine if the model instance has been soft-deleted. + * + * @return bool + */ + public function trashed() + { + return ! is_null($this->{$this->getDeletedAtColumn()}); + } + + /** + * Register a restoring model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function restoring($callback) + { + static::registerModelEvent('restoring', $callback); + } + + /** + * Register a restored model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function restored($callback) + { + static::registerModelEvent('restored', $callback); + } + + /** + * Determine if the model is currently force deleting. + * + * @return bool + */ + public function isForceDeleting() + { + return $this->forceDeleting; + } + + /** + * Get the name of the "deleted at" column. + * + * @return string + */ + public function getDeletedAtColumn() + { + return defined('static::DELETED_AT') ? static::DELETED_AT : 'deleted_at'; + } + + /** + * Get the fully qualified "deleted at" column. + * + * @return string + */ + public function getQualifiedDeletedAtColumn() + { + return $this->qualifyColumn($this->getDeletedAtColumn()); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php new file mode 100644 index 00000000..0d516966 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php @@ -0,0 +1,131 @@ +whereNull($model->getQualifiedDeletedAtColumn()); + } + + /** + * Extend the query builder with the needed functions. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + public function extend(Builder $builder) + { + foreach ($this->extensions as $extension) { + $this->{"add{$extension}"}($builder); + } + + $builder->onDelete(function (Builder $builder) { + $column = $this->getDeletedAtColumn($builder); + + return $builder->update([ + $column => $builder->getModel()->freshTimestampString(), + ]); + }); + } + + /** + * Get the "deleted at" column for the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return string + */ + protected function getDeletedAtColumn(Builder $builder) + { + if (count((array) $builder->getQuery()->joins) > 0) { + return $builder->getModel()->getQualifiedDeletedAtColumn(); + } + + return $builder->getModel()->getDeletedAtColumn(); + } + + /** + * Add the restore extension to the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + protected function addRestore(Builder $builder) + { + $builder->macro('restore', function (Builder $builder) { + $builder->withTrashed(); + + return $builder->update([$builder->getModel()->getDeletedAtColumn() => null]); + }); + } + + /** + * Add the with-trashed extension to the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + protected function addWithTrashed(Builder $builder) + { + $builder->macro('withTrashed', function (Builder $builder, $withTrashed = true) { + if (! $withTrashed) { + return $builder->withoutTrashed(); + } + + return $builder->withoutGlobalScope($this); + }); + } + + /** + * Add the without-trashed extension to the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + protected function addWithoutTrashed(Builder $builder) + { + $builder->macro('withoutTrashed', function (Builder $builder) { + $model = $builder->getModel(); + + $builder->withoutGlobalScope($this)->whereNull( + $model->getQualifiedDeletedAtColumn() + ); + + return $builder; + }); + } + + /** + * Add the only-trashed extension to the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + protected function addOnlyTrashed(Builder $builder) + { + $builder->macro('onlyTrashed', function (Builder $builder) { + $model = $builder->getModel(); + + $builder->withoutGlobalScope($this)->whereNotNull( + $model->getQualifiedDeletedAtColumn() + ); + + return $builder; + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Events/ConnectionEvent.php b/vendor/laravel/framework/src/Illuminate/Database/Events/ConnectionEvent.php new file mode 100644 index 00000000..818c7850 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Events/ConnectionEvent.php @@ -0,0 +1,32 @@ +connection = $connection; + $this->connectionName = $connection->getName(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Events/MigrationEnded.php b/vendor/laravel/framework/src/Illuminate/Database/Events/MigrationEnded.php new file mode 100644 index 00000000..a90a4cc4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Events/MigrationEnded.php @@ -0,0 +1,8 @@ +method = $method; + $this->migration = $migration; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Events/MigrationStarted.php b/vendor/laravel/framework/src/Illuminate/Database/Events/MigrationStarted.php new file mode 100644 index 00000000..3f206b4c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Events/MigrationStarted.php @@ -0,0 +1,8 @@ +method = $method; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Events/QueryExecuted.php b/vendor/laravel/framework/src/Illuminate/Database/Events/QueryExecuted.php new file mode 100644 index 00000000..833a21e6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Events/QueryExecuted.php @@ -0,0 +1,59 @@ +sql = $sql; + $this->time = $time; + $this->bindings = $bindings; + $this->connection = $connection; + $this->connectionName = $connection->getName(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Events/StatementPrepared.php b/vendor/laravel/framework/src/Illuminate/Database/Events/StatementPrepared.php new file mode 100644 index 00000000..2f603235 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Events/StatementPrepared.php @@ -0,0 +1,33 @@ +statement = $statement; + $this->connection = $connection; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Events/TransactionBeginning.php b/vendor/laravel/framework/src/Illuminate/Database/Events/TransactionBeginning.php new file mode 100644 index 00000000..3287b5c8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Events/TransactionBeginning.php @@ -0,0 +1,8 @@ +isExpression($table)) { + return $this->wrap($this->tablePrefix.$table, true); + } + + return $this->getValue($table); + } + + /** + * Wrap a value in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $value + * @param bool $prefixAlias + * @return string + */ + public function wrap($value, $prefixAlias = false) + { + if ($this->isExpression($value)) { + return $this->getValue($value); + } + + // If the value being wrapped has a column alias we will need to separate out + // the pieces so we can wrap each of the segments of the expression on its + // own, and then join these both back together using the "as" connector. + if (stripos($value, ' as ') !== false) { + return $this->wrapAliasedValue($value, $prefixAlias); + } + + return $this->wrapSegments(explode('.', $value)); + } + + /** + * Wrap a value that has an alias. + * + * @param string $value + * @param bool $prefixAlias + * @return string + */ + protected function wrapAliasedValue($value, $prefixAlias = false) + { + $segments = preg_split('/\s+as\s+/i', $value); + + // If we are wrapping a table we need to prefix the alias with the table prefix + // as well in order to generate proper syntax. If this is a column of course + // no prefix is necessary. The condition will be true when from wrapTable. + if ($prefixAlias) { + $segments[1] = $this->tablePrefix.$segments[1]; + } + + return $this->wrap($segments[0]).' as '.$this->wrapValue($segments[1]); + } + + /** + * Wrap the given value segments. + * + * @param array $segments + * @return string + */ + protected function wrapSegments($segments) + { + return collect($segments)->map(function ($segment, $key) use ($segments) { + return $key == 0 && count($segments) > 1 + ? $this->wrapTable($segment) + : $this->wrapValue($segment); + })->implode('.'); + } + + /** + * Wrap a single string in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrapValue($value) + { + if ($value !== '*') { + return '"'.str_replace('"', '""', $value).'"'; + } + + return $value; + } + + /** + * Convert an array of column names into a delimited string. + * + * @param array $columns + * @return string + */ + public function columnize(array $columns) + { + return implode(', ', array_map([$this, 'wrap'], $columns)); + } + + /** + * Create query parameter place-holders for an array. + * + * @param array $values + * @return string + */ + public function parameterize(array $values) + { + return implode(', ', array_map([$this, 'parameter'], $values)); + } + + /** + * Get the appropriate query parameter place-holder for a value. + * + * @param mixed $value + * @return string + */ + public function parameter($value) + { + return $this->isExpression($value) ? $this->getValue($value) : '?'; + } + + /** + * Quote the given string literal. + * + * @param string|array $value + * @return string + */ + public function quoteString($value) + { + if (is_array($value)) { + return implode(', ', array_map([$this, __FUNCTION__], $value)); + } + + return "'$value'"; + } + + /** + * Determine if the given value is a raw expression. + * + * @param mixed $value + * @return bool + */ + public function isExpression($value) + { + return $value instanceof Expression; + } + + /** + * Get the value of a raw expression. + * + * @param \Illuminate\Database\Query\Expression $expression + * @return string + */ + public function getValue($expression) + { + return $expression->getValue(); + } + + /** + * Get the format for database stored dates. + * + * @return string + */ + public function getDateFormat() + { + return 'Y-m-d H:i:s'; + } + + /** + * Get the grammar's table prefix. + * + * @return string + */ + public function getTablePrefix() + { + return $this->tablePrefix; + } + + /** + * Set the grammar's table prefix. + * + * @param string $prefix + * @return $this + */ + public function setTablePrefix($prefix) + { + $this->tablePrefix = $prefix; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Database/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php new file mode 100755 index 00000000..efd5f836 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php @@ -0,0 +1,225 @@ + 'command.migrate', + 'MigrateFresh' => 'command.migrate.fresh', + 'MigrateInstall' => 'command.migrate.install', + 'MigrateRefresh' => 'command.migrate.refresh', + 'MigrateReset' => 'command.migrate.reset', + 'MigrateRollback' => 'command.migrate.rollback', + 'MigrateStatus' => 'command.migrate.status', + 'MigrateMake' => 'command.migrate.make', + ]; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerRepository(); + + $this->registerMigrator(); + + $this->registerCreator(); + + $this->registerCommands($this->commands); + } + + /** + * Register the migration repository service. + * + * @return void + */ + protected function registerRepository() + { + $this->app->singleton('migration.repository', function ($app) { + $table = $app['config']['database.migrations']; + + return new DatabaseMigrationRepository($app['db'], $table); + }); + } + + /** + * Register the migrator service. + * + * @return void + */ + protected function registerMigrator() + { + // The migrator is responsible for actually running and rollback the migration + // files in the application. We'll pass in our database connection resolver + // so the migrator can resolve any of these connections when it needs to. + $this->app->singleton('migrator', function ($app) { + $repository = $app['migration.repository']; + + return new Migrator($repository, $app['db'], $app['files'], $app['events']); + }); + } + + /** + * Register the migration creator. + * + * @return void + */ + protected function registerCreator() + { + $this->app->singleton('migration.creator', function ($app) { + return new MigrationCreator($app['files']); + }); + } + + /** + * Register the given commands. + * + * @param array $commands + * @return void + */ + protected function registerCommands(array $commands) + { + foreach (array_keys($commands) as $command) { + $this->{"register{$command}Command"}(); + } + + $this->commands(array_values($commands)); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateCommand() + { + $this->app->singleton('command.migrate', function ($app) { + return new MigrateCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateFreshCommand() + { + $this->app->singleton('command.migrate.fresh', function () { + return new FreshCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateInstallCommand() + { + $this->app->singleton('command.migrate.install', function ($app) { + return new InstallCommand($app['migration.repository']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateMakeCommand() + { + $this->app->singleton('command.migrate.make', function ($app) { + // Once we have the migration creator registered, we will create the command + // and inject the creator. The creator is responsible for the actual file + // creation of the migrations, and may be extended by these developers. + $creator = $app['migration.creator']; + + $composer = $app['composer']; + + return new MigrateMakeCommand($creator, $composer); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateRefreshCommand() + { + $this->app->singleton('command.migrate.refresh', function () { + return new RefreshCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateResetCommand() + { + $this->app->singleton('command.migrate.reset', function ($app) { + return new ResetCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateRollbackCommand() + { + $this->app->singleton('command.migrate.rollback', function ($app) { + return new RollbackCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateStatusCommand() + { + $this->app->singleton('command.migrate.status', function ($app) { + return new StatusCommand($app['migrator']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return array_merge([ + 'migrator', 'migration.repository', 'migration.creator', + ], array_values($this->commands)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php b/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php new file mode 100755 index 00000000..1ace1a6f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php @@ -0,0 +1,212 @@ +table = $table; + $this->resolver = $resolver; + } + + /** + * Get the completed migrations. + * + * @return array + */ + public function getRan() + { + return $this->table() + ->orderBy('batch', 'asc') + ->orderBy('migration', 'asc') + ->pluck('migration')->all(); + } + + /** + * Get list of migrations. + * + * @param int $steps + * @return array + */ + public function getMigrations($steps) + { + $query = $this->table()->where('batch', '>=', '1'); + + return $query->orderBy('batch', 'desc') + ->orderBy('migration', 'desc') + ->take($steps)->get()->all(); + } + + /** + * Get the last migration batch. + * + * @return array + */ + public function getLast() + { + $query = $this->table()->where('batch', $this->getLastBatchNumber()); + + return $query->orderBy('migration', 'desc')->get()->all(); + } + + /** + * Get the completed migrations with their batch numbers. + * + * @return array + */ + public function getMigrationBatches() + { + return $this->table() + ->orderBy('batch', 'asc') + ->orderBy('migration', 'asc') + ->pluck('batch', 'migration')->all(); + } + + /** + * Log that a migration was run. + * + * @param string $file + * @param int $batch + * @return void + */ + public function log($file, $batch) + { + $record = ['migration' => $file, 'batch' => $batch]; + + $this->table()->insert($record); + } + + /** + * Remove a migration from the log. + * + * @param object $migration + * @return void + */ + public function delete($migration) + { + $this->table()->where('migration', $migration->migration)->delete(); + } + + /** + * Get the next migration batch number. + * + * @return int + */ + public function getNextBatchNumber() + { + return $this->getLastBatchNumber() + 1; + } + + /** + * Get the last migration batch number. + * + * @return int + */ + public function getLastBatchNumber() + { + return $this->table()->max('batch'); + } + + /** + * Create the migration repository data store. + * + * @return void + */ + public function createRepository() + { + $schema = $this->getConnection()->getSchemaBuilder(); + + $schema->create($this->table, function ($table) { + // The migrations table is responsible for keeping track of which of the + // migrations have actually run for the application. We'll create the + // table to hold the migration file's path as well as the batch ID. + $table->increments('id'); + $table->string('migration'); + $table->integer('batch'); + }); + } + + /** + * Determine if the migration repository exists. + * + * @return bool + */ + public function repositoryExists() + { + $schema = $this->getConnection()->getSchemaBuilder(); + + return $schema->hasTable($this->table); + } + + /** + * Get a query builder for the migration table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function table() + { + return $this->getConnection()->table($this->table)->useWritePdo(); + } + + /** + * Get the connection resolver instance. + * + * @return \Illuminate\Database\ConnectionResolverInterface + */ + public function getConnectionResolver() + { + return $this->resolver; + } + + /** + * Resolve the database connection instance. + * + * @return \Illuminate\Database\Connection + */ + public function getConnection() + { + return $this->resolver->connection($this->connection); + } + + /** + * Set the information source to gather data. + * + * @param string $name + * @return void + */ + public function setSource($name) + { + $this->connection = $name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migration.php b/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migration.php new file mode 100755 index 00000000..a58f7848 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migration.php @@ -0,0 +1,30 @@ +connection; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationCreator.php b/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationCreator.php new file mode 100755 index 00000000..2a8c69b5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationCreator.php @@ -0,0 +1,213 @@ +files = $files; + } + + /** + * Create a new migration at the given path. + * + * @param string $name + * @param string $path + * @param string|null $table + * @param bool $create + * @return string + * + * @throws \Exception + */ + public function create($name, $path, $table = null, $create = false) + { + $this->ensureMigrationDoesntAlreadyExist($name, $path); + + // First we will get the stub file for the migration, which serves as a type + // of template for the migration. Once we have those we will populate the + // various place-holders, save the file, and run the post create event. + $stub = $this->getStub($table, $create); + + $this->files->put( + $path = $this->getPath($name, $path), + $this->populateStub($name, $stub, $table) + ); + + // Next, we will fire any hooks that are supposed to fire after a migration is + // created. Once that is done we'll be ready to return the full path to the + // migration file so it can be used however it's needed by the developer. + $this->firePostCreateHooks($table); + + return $path; + } + + /** + * Ensure that a migration with the given name doesn't already exist. + * + * @param string $name + * @param string $migrationPath + * @return void + * + * @throws \InvalidArgumentException + */ + protected function ensureMigrationDoesntAlreadyExist($name, $migrationPath = null) + { + if (! empty($migrationPath)) { + $migrationFiles = $this->files->glob($migrationPath.'/*.php'); + + foreach ($migrationFiles as $migrationFile) { + $this->files->requireOnce($migrationFile); + } + } + + if (class_exists($className = $this->getClassName($name))) { + throw new InvalidArgumentException("A {$className} class already exists."); + } + } + + /** + * Get the migration stub file. + * + * @param string|null $table + * @param bool $create + * @return string + */ + protected function getStub($table, $create) + { + if (is_null($table)) { + return $this->files->get($this->stubPath().'/blank.stub'); + } + + // We also have stubs for creating new tables and modifying existing tables + // to save the developer some typing when they are creating a new tables + // or modifying existing tables. We'll grab the appropriate stub here. + $stub = $create ? 'create.stub' : 'update.stub'; + + return $this->files->get($this->stubPath()."/{$stub}"); + } + + /** + * Populate the place-holders in the migration stub. + * + * @param string $name + * @param string $stub + * @param string|null $table + * @return string + */ + protected function populateStub($name, $stub, $table) + { + $stub = str_replace('DummyClass', $this->getClassName($name), $stub); + + // Here we will replace the table place-holders with the table specified by + // the developer, which is useful for quickly creating a tables creation + // or update migration from the console instead of typing it manually. + if (! is_null($table)) { + $stub = str_replace('DummyTable', $table, $stub); + } + + return $stub; + } + + /** + * Get the class name of a migration name. + * + * @param string $name + * @return string + */ + protected function getClassName($name) + { + return Str::studly($name); + } + + /** + * Get the full path to the migration. + * + * @param string $name + * @param string $path + * @return string + */ + protected function getPath($name, $path) + { + return $path.'/'.$this->getDatePrefix().'_'.$name.'.php'; + } + + /** + * Fire the registered post create hooks. + * + * @param string|null $table + * @return void + */ + protected function firePostCreateHooks($table) + { + foreach ($this->postCreate as $callback) { + $callback($table); + } + } + + /** + * Register a post migration create hook. + * + * @param \Closure $callback + * @return void + */ + public function afterCreate(Closure $callback) + { + $this->postCreate[] = $callback; + } + + /** + * Get the date prefix for the migration. + * + * @return string + */ + protected function getDatePrefix() + { + return date('Y_m_d_His'); + } + + /** + * Get the path to the stubs. + * + * @return string + */ + public function stubPath() + { + return __DIR__.'/stubs'; + } + + /** + * Get the filesystem instance. + * + * @return \Illuminate\Filesystem\Filesystem + */ + public function getFilesystem() + { + return $this->files; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php b/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php new file mode 100755 index 00000000..410326a9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php @@ -0,0 +1,81 @@ +files = $files; + $this->events = $dispatcher; + $this->resolver = $resolver; + $this->repository = $repository; + } + + /** + * Run the pending migrations at a given path. + * + * @param array|string $paths + * @param array $options + * @return array + */ + public function run($paths = [], array $options = []) + { + // Once we grab all of the migration files for the path, we will compare them + // against the migrations that have already been run for this package then + // run each of the outstanding migrations against a database connection. + $files = $this->getMigrationFiles($paths); + + $this->requireFiles($migrations = $this->pendingMigrations( + $files, $this->repository->getRan() + )); + + // Once we have all these migrations that are outstanding we are ready to run + // we will go ahead and run them "up". This will execute each migration as + // an operation against a database. Then we'll return this list of them. + $this->runPending($migrations, $options); + + return $migrations; + } + + /** + * Get the migration files that have not yet run. + * + * @param array $files + * @param array $ran + * @return array + */ + protected function pendingMigrations($files, $ran) + { + return Collection::make($files) + ->reject(function ($file) use ($ran) { + return in_array($this->getMigrationName($file), $ran); + })->values()->all(); + } + + /** + * Run an array of migrations. + * + * @param array $migrations + * @param array $options + * @return void + */ + public function runPending(array $migrations, array $options = []) + { + // First we will just make sure that there are any migrations to run. If there + // aren't, we will just make a note of it to the developer so they're aware + // that all of the migrations have been run against this database system. + if (count($migrations) === 0) { + $this->fireMigrationEvent(new NoPendingMigrations('up')); + + $this->note('Nothing to migrate.'); + + return; + } + + // Next, we will get the next batch number for the migrations so we can insert + // correct batch number in the database migrations repository when we store + // each migration's execution. We will also extract a few of the options. + $batch = $this->repository->getNextBatchNumber(); + + $pretend = $options['pretend'] ?? false; + + $step = $options['step'] ?? false; + + $this->fireMigrationEvent(new MigrationsStarted); + + // Once we have the array of migrations, we will spin through them and run the + // migrations "up" so the changes are made to the databases. We'll then log + // that the migration was run so we don't repeat it next time we execute. + foreach ($migrations as $file) { + $this->runUp($file, $batch, $pretend); + + if ($step) { + $batch++; + } + } + + $this->fireMigrationEvent(new MigrationsEnded); + } + + /** + * Run "up" a migration instance. + * + * @param string $file + * @param int $batch + * @param bool $pretend + * @return void + */ + protected function runUp($file, $batch, $pretend) + { + // First we will resolve a "real" instance of the migration class from this + // migration file name. Once we have the instances we can run the actual + // command such as "up" or "down", or we can just simulate the action. + $migration = $this->resolve( + $name = $this->getMigrationName($file) + ); + + if ($pretend) { + return $this->pretendToRun($migration, 'up'); + } + + $this->note("Migrating: {$name}"); + + $startTime = microtime(true); + + $this->runMigration($migration, 'up'); + + $runTime = round(microtime(true) - $startTime, 2); + + // Once we have run a migrations class, we will log that it was run in this + // repository so that we don't try to run it next time we do a migration + // in the application. A migration repository keeps the migrate order. + $this->repository->log($name, $batch); + + $this->note("Migrated: {$name} ({$runTime} seconds)"); + } + + /** + * Rollback the last migration operation. + * + * @param array|string $paths + * @param array $options + * @return array + */ + public function rollback($paths = [], array $options = []) + { + // We want to pull in the last batch of migrations that ran on the previous + // migration operation. We'll then reverse those migrations and run each + // of them "down" to reverse the last migration "operation" which ran. + $migrations = $this->getMigrationsForRollback($options); + + if (count($migrations) === 0) { + $this->fireMigrationEvent(new NoPendingMigrations('down')); + + $this->note('Nothing to rollback.'); + + return []; + } + + return $this->rollbackMigrations($migrations, $paths, $options); + } + + /** + * Get the migrations for a rollback operation. + * + * @param array $options + * @return array + */ + protected function getMigrationsForRollback(array $options) + { + if (($steps = $options['step'] ?? 0) > 0) { + return $this->repository->getMigrations($steps); + } + + return $this->repository->getLast(); + } + + /** + * Rollback the given migrations. + * + * @param array $migrations + * @param array|string $paths + * @param array $options + * @return array + */ + protected function rollbackMigrations(array $migrations, $paths, array $options) + { + $rolledBack = []; + + $this->requireFiles($files = $this->getMigrationFiles($paths)); + + $this->fireMigrationEvent(new MigrationsStarted); + + // Next we will run through all of the migrations and call the "down" method + // which will reverse each migration in order. This getLast method on the + // repository already returns these migration's names in reverse order. + foreach ($migrations as $migration) { + $migration = (object) $migration; + + if (! $file = Arr::get($files, $migration->migration)) { + $this->note("Migration not found: {$migration->migration}"); + + continue; + } + + $rolledBack[] = $file; + + $this->runDown( + $file, $migration, + $options['pretend'] ?? false + ); + } + + $this->fireMigrationEvent(new MigrationsEnded); + + return $rolledBack; + } + + /** + * Rolls all of the currently applied migrations back. + * + * @param array|string $paths + * @param bool $pretend + * @return array + */ + public function reset($paths = [], $pretend = false) + { + // Next, we will reverse the migration list so we can run them back in the + // correct order for resetting this database. This will allow us to get + // the database back into its "empty" state ready for the migrations. + $migrations = array_reverse($this->repository->getRan()); + + if (count($migrations) === 0) { + $this->note('Nothing to rollback.'); + + return []; + } + + return $this->resetMigrations($migrations, $paths, $pretend); + } + + /** + * Reset the given migrations. + * + * @param array $migrations + * @param array $paths + * @param bool $pretend + * @return array + */ + protected function resetMigrations(array $migrations, array $paths, $pretend = false) + { + // Since the getRan method that retrieves the migration name just gives us the + // migration name, we will format the names into objects with the name as a + // property on the objects so that we can pass it to the rollback method. + $migrations = collect($migrations)->map(function ($m) { + return (object) ['migration' => $m]; + })->all(); + + return $this->rollbackMigrations( + $migrations, $paths, compact('pretend') + ); + } + + /** + * Run "down" a migration instance. + * + * @param string $file + * @param object $migration + * @param bool $pretend + * @return void + */ + protected function runDown($file, $migration, $pretend) + { + // First we will get the file name of the migration so we can resolve out an + // instance of the migration. Once we get an instance we can either run a + // pretend execution of the migration or we can run the real migration. + $instance = $this->resolve( + $name = $this->getMigrationName($file) + ); + + $this->note("Rolling back: {$name}"); + + if ($pretend) { + return $this->pretendToRun($instance, 'down'); + } + + $startTime = microtime(true); + + $this->runMigration($instance, 'down'); + + $runTime = round(microtime(true) - $startTime, 2); + + // Once we have successfully run the migration "down" we will remove it from + // the migration repository so it will be considered to have not been run + // by the application then will be able to fire by any later operation. + $this->repository->delete($migration); + + $this->note("Rolled back: {$name} ({$runTime} seconds)"); + } + + /** + * Run a migration inside a transaction if the database supports it. + * + * @param object $migration + * @param string $method + * @return void + */ + protected function runMigration($migration, $method) + { + $connection = $this->resolveConnection( + $migration->getConnection() + ); + + $callback = function () use ($migration, $method) { + if (method_exists($migration, $method)) { + $this->fireMigrationEvent(new MigrationStarted($migration, $method)); + + $migration->{$method}(); + + $this->fireMigrationEvent(new MigrationEnded($migration, $method)); + } + }; + + $this->getSchemaGrammar($connection)->supportsSchemaTransactions() + && $migration->withinTransaction + ? $connection->transaction($callback) + : $callback(); + } + + /** + * Pretend to run the migrations. + * + * @param object $migration + * @param string $method + * @return void + */ + protected function pretendToRun($migration, $method) + { + foreach ($this->getQueries($migration, $method) as $query) { + $name = get_class($migration); + + $this->note("{$name}: {$query['query']}"); + } + } + + /** + * Get all of the queries that would be run for a migration. + * + * @param object $migration + * @param string $method + * @return array + */ + protected function getQueries($migration, $method) + { + // Now that we have the connections we can resolve it and pretend to run the + // queries against the database returning the array of raw SQL statements + // that would get fired against the database system for this migration. + $db = $this->resolveConnection( + $migration->getConnection() + ); + + return $db->pretend(function () use ($migration, $method) { + if (method_exists($migration, $method)) { + $migration->{$method}(); + } + }); + } + + /** + * Resolve a migration instance from a file. + * + * @param string $file + * @return object + */ + public function resolve($file) + { + $class = Str::studly(implode('_', array_slice(explode('_', $file), 4))); + + return new $class; + } + + /** + * Get all of the migration files in a given path. + * + * @param string|array $paths + * @return array + */ + public function getMigrationFiles($paths) + { + return Collection::make($paths)->flatMap(function ($path) { + return Str::endsWith($path, '.php') ? [$path] : $this->files->glob($path.'/*_*.php'); + })->filter()->values()->keyBy(function ($file) { + return $this->getMigrationName($file); + })->sortBy(function ($file, $key) { + return $key; + })->all(); + } + + /** + * Require in all the migration files in a given path. + * + * @param array $files + * @return void + */ + public function requireFiles(array $files) + { + foreach ($files as $file) { + $this->files->requireOnce($file); + } + } + + /** + * Get the name of the migration. + * + * @param string $path + * @return string + */ + public function getMigrationName($path) + { + return str_replace('.php', '', basename($path)); + } + + /** + * Register a custom migration path. + * + * @param string $path + * @return void + */ + public function path($path) + { + $this->paths = array_unique(array_merge($this->paths, [$path])); + } + + /** + * Get all of the custom migration paths. + * + * @return array + */ + public function paths() + { + return $this->paths; + } + + /** + * Get the default connection name. + * + * @return string + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Set the default connection name. + * + * @param string $name + * @return void + */ + public function setConnection($name) + { + if (! is_null($name)) { + $this->resolver->setDefaultConnection($name); + } + + $this->repository->setSource($name); + + $this->connection = $name; + } + + /** + * Resolve the database connection instance. + * + * @param string $connection + * @return \Illuminate\Database\Connection + */ + public function resolveConnection($connection) + { + return $this->resolver->connection($connection ?: $this->connection); + } + + /** + * Get the schema grammar out of a migration connection. + * + * @param \Illuminate\Database\Connection $connection + * @return \Illuminate\Database\Schema\Grammars\Grammar + */ + protected function getSchemaGrammar($connection) + { + if (is_null($grammar = $connection->getSchemaGrammar())) { + $connection->useDefaultSchemaGrammar(); + + $grammar = $connection->getSchemaGrammar(); + } + + return $grammar; + } + + /** + * Get the migration repository instance. + * + * @return \Illuminate\Database\Migrations\MigrationRepositoryInterface + */ + public function getRepository() + { + return $this->repository; + } + + /** + * Determine if the migration repository exists. + * + * @return bool + */ + public function repositoryExists() + { + return $this->repository->repositoryExists(); + } + + /** + * Get the file system instance. + * + * @return \Illuminate\Filesystem\Filesystem + */ + public function getFilesystem() + { + return $this->files; + } + + /** + * Set the output implementation that should be used by the console. + * + * @param \Illuminate\Console\OutputStyle $output + * @return $this + */ + public function setOutput(OutputStyle $output) + { + $this->output = $output; + + return $this; + } + + /** + * Write a note to the console's output. + * + * @param string $message + * @return void + */ + protected function note($message) + { + if ($this->output) { + $this->output->writeln($message); + } + } + + /** + * Fire the given event for the migration. + * + * @param \Illuminate\Contracts\Database\Events\MigrationEvent $event + * @return void + */ + public function fireMigrationEvent($event) + { + if ($this->events) { + $this->events->dispatch($event); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/blank.stub b/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/blank.stub new file mode 100755 index 00000000..5e3b1540 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/blank.stub @@ -0,0 +1,28 @@ +bigIncrements('id'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('DummyTable'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/update.stub b/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/update.stub new file mode 100755 index 00000000..9ee9bfab --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/update.stub @@ -0,0 +1,32 @@ +withTablePrefix(new QueryGrammar); + } + + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\MySqlBuilder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new MySqlBuilder($this); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\MySqlGrammar + */ + protected function getDefaultSchemaGrammar() + { + return $this->withTablePrefix(new SchemaGrammar); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\MySqlProcessor + */ + protected function getDefaultPostProcessor() + { + return new MySqlProcessor; + } + + /** + * Get the Doctrine DBAL driver. + * + * @return \Doctrine\DBAL\Driver\PDOMySql\Driver + */ + protected function getDoctrineDriver() + { + if (! class_exists(DoctrineDriver::class)) { + throw new LogicException( + 'Laravel v6 is only compatible with doctrine/dbal 2, in order to use this feature you must require the package "doctrine/dbal:^2.6".' + ); + } + + return new DoctrineDriver; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php b/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php new file mode 100755 index 00000000..8d207b3e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php @@ -0,0 +1,73 @@ +withTablePrefix(new QueryGrammar); + } + + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\PostgresBuilder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new PostgresBuilder($this); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\PostgresGrammar + */ + protected function getDefaultSchemaGrammar() + { + return $this->withTablePrefix(new SchemaGrammar); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\PostgresProcessor + */ + protected function getDefaultPostProcessor() + { + return new PostgresProcessor; + } + + /** + * Get the Doctrine DBAL driver. + * + * @return \Doctrine\DBAL\Driver\PDOPgSql\Driver + */ + protected function getDoctrineDriver() + { + if (! class_exists(DoctrineDriver::class)) { + throw new LogicException( + 'Laravel v6 is only compatible with doctrine/dbal 2, in order to use this feature you must require the package "doctrine/dbal:^2.6".' + ); + } + + return new DoctrineDriver; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php new file mode 100755 index 00000000..60c61f44 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php @@ -0,0 +1,3110 @@ + [], + 'from' => [], + 'join' => [], + 'where' => [], + 'groupBy' => [], + 'having' => [], + 'order' => [], + 'union' => [], + 'unionOrder' => [], + ]; + + /** + * An aggregate function and column to be run. + * + * @var array + */ + public $aggregate; + + /** + * The columns that should be returned. + * + * @var array + */ + public $columns; + + /** + * Indicates if the query returns distinct results. + * + * Occasionally contains the columns that should be distinct. + * + * @var bool|array + */ + public $distinct = false; + + /** + * The table which the query is targeting. + * + * @var string + */ + public $from; + + /** + * The table joins for the query. + * + * @var array + */ + public $joins; + + /** + * The where constraints for the query. + * + * @var array + */ + public $wheres = []; + + /** + * The groupings for the query. + * + * @var array + */ + public $groups; + + /** + * The having constraints for the query. + * + * @var array + */ + public $havings; + + /** + * The orderings for the query. + * + * @var array + */ + public $orders; + + /** + * The maximum number of records to return. + * + * @var int + */ + public $limit; + + /** + * The number of records to skip. + * + * @var int + */ + public $offset; + + /** + * The query union statements. + * + * @var array + */ + public $unions; + + /** + * The maximum number of union records to return. + * + * @var int + */ + public $unionLimit; + + /** + * The number of union records to skip. + * + * @var int + */ + public $unionOffset; + + /** + * The orderings for the union query. + * + * @var array + */ + public $unionOrders; + + /** + * Indicates whether row locking is being used. + * + * @var string|bool + */ + public $lock; + + /** + * All of the available clause operators. + * + * @var array + */ + public $operators = [ + '=', '<', '>', '<=', '>=', '<>', '!=', '<=>', + 'like', 'like binary', 'not like', 'ilike', + '&', '|', '^', '<<', '>>', + 'rlike', 'not rlike', 'regexp', 'not regexp', + '~', '~*', '!~', '!~*', 'similar to', + 'not similar to', 'not ilike', '~~*', '!~~*', + ]; + + /** + * Whether use write pdo for select. + * + * @var bool + */ + public $useWritePdo = false; + + /** + * Create a new query builder instance. + * + * @param \Illuminate\Database\ConnectionInterface $connection + * @param \Illuminate\Database\Query\Grammars\Grammar|null $grammar + * @param \Illuminate\Database\Query\Processors\Processor|null $processor + * @return void + */ + public function __construct(ConnectionInterface $connection, + Grammar $grammar = null, + Processor $processor = null) + { + $this->connection = $connection; + $this->grammar = $grammar ?: $connection->getQueryGrammar(); + $this->processor = $processor ?: $connection->getPostProcessor(); + } + + /** + * Set the columns to be selected. + * + * @param array|mixed $columns + * @return $this + */ + public function select($columns = ['*']) + { + $this->columns = []; + + $columns = is_array($columns) ? $columns : func_get_args(); + + foreach ($columns as $as => $column) { + if (is_string($as) && $this->isQueryable($column)) { + $this->selectSub($column, $as); + } else { + $this->columns[] = $column; + } + } + + return $this; + } + + /** + * Add a subselect expression to the query. + * + * @param \Closure|$this|string $query + * @param string $as + * @return \Illuminate\Database\Query\Builder|static + * + * @throws \InvalidArgumentException + */ + public function selectSub($query, $as) + { + [$query, $bindings] = $this->createSub($query); + + return $this->selectRaw( + '('.$query.') as '.$this->grammar->wrap($as), $bindings + ); + } + + /** + * Add a new "raw" select expression to the query. + * + * @param string $expression + * @param array $bindings + * @return \Illuminate\Database\Query\Builder|static + */ + public function selectRaw($expression, array $bindings = []) + { + $this->addSelect(new Expression($expression)); + + if ($bindings) { + $this->addBinding($bindings, 'select'); + } + + return $this; + } + + /** + * Makes "from" fetch from a subquery. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @return \Illuminate\Database\Query\Builder|static + * + * @throws \InvalidArgumentException + */ + public function fromSub($query, $as) + { + [$query, $bindings] = $this->createSub($query); + + return $this->fromRaw('('.$query.') as '.$this->grammar->wrapTable($as), $bindings); + } + + /** + * Add a raw from clause to the query. + * + * @param string $expression + * @param mixed $bindings + * @return \Illuminate\Database\Query\Builder|static + */ + public function fromRaw($expression, $bindings = []) + { + $this->from = new Expression($expression); + + $this->addBinding($bindings, 'from'); + + return $this; + } + + /** + * Creates a subquery and parse it. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @return array + */ + protected function createSub($query) + { + // If the given query is a Closure, we will execute it while passing in a new + // query instance to the Closure. This will give the developer a chance to + // format and work with the query before we cast it to a raw SQL string. + if ($query instanceof Closure) { + $callback = $query; + + $callback($query = $this->forSubQuery()); + } + + return $this->parseSub($query); + } + + /** + * Parse the subquery into SQL and bindings. + * + * @param mixed $query + * @return array + * + * @throws \InvalidArgumentException + */ + protected function parseSub($query) + { + if ($query instanceof self || $query instanceof EloquentBuilder) { + return [$query->toSql(), $query->getBindings()]; + } elseif (is_string($query)) { + return [$query, []]; + } else { + throw new InvalidArgumentException( + 'A subquery must be a query builder instance, a Closure, or a string.' + ); + } + } + + /** + * Add a new select column to the query. + * + * @param array|mixed $column + * @return $this + */ + public function addSelect($column) + { + $columns = is_array($column) ? $column : func_get_args(); + + foreach ($columns as $as => $column) { + if (is_string($as) && $this->isQueryable($column)) { + if (is_null($this->columns)) { + $this->select($this->from.'.*'); + } + + $this->selectSub($column, $as); + } else { + $this->columns[] = $column; + } + } + + return $this; + } + + /** + * Force the query to only return distinct results. + * + * @return $this + */ + public function distinct() + { + $columns = func_get_args(); + + if (count($columns) > 0) { + $this->distinct = is_array($columns[0]) || is_bool($columns[0]) ? $columns[0] : $columns; + } else { + $this->distinct = true; + } + + return $this; + } + + /** + * Set the table which the query is targeting. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $table + * @param string|null $as + * @return $this + */ + public function from($table, $as = null) + { + if ($this->isQueryable($table)) { + return $this->fromSub($table, $as); + } + + $this->from = $as ? "{$table} as {$as}" : $table; + + return $this; + } + + /** + * Add a join clause to the query. + * + * @param string $table + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @param string $type + * @param bool $where + * @return $this + */ + public function join($table, $first, $operator = null, $second = null, $type = 'inner', $where = false) + { + $join = $this->newJoinClause($this, $type, $table); + + // If the first "column" of the join is really a Closure instance the developer + // is trying to build a join with a complex "on" clause containing more than + // one condition, so we'll add the join and call a Closure with the query. + if ($first instanceof Closure) { + $first($join); + + $this->joins[] = $join; + + $this->addBinding($join->getBindings(), 'join'); + } + + // If the column is simply a string, we can assume the join simply has a basic + // "on" clause with a single condition. So we will just build the join with + // this simple join clauses attached to it. There is not a join callback. + else { + $method = $where ? 'where' : 'on'; + + $this->joins[] = $join->$method($first, $operator, $second); + + $this->addBinding($join->getBindings(), 'join'); + } + + return $this; + } + + /** + * Add a "join where" clause to the query. + * + * @param string $table + * @param \Closure|string $first + * @param string $operator + * @param string $second + * @param string $type + * @return \Illuminate\Database\Query\Builder|static + */ + public function joinWhere($table, $first, $operator, $second, $type = 'inner') + { + return $this->join($table, $first, $operator, $second, $type, true); + } + + /** + * Add a subquery join clause to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @param string $type + * @param bool $where + * @return \Illuminate\Database\Query\Builder|static + * + * @throws \InvalidArgumentException + */ + public function joinSub($query, $as, $first, $operator = null, $second = null, $type = 'inner', $where = false) + { + [$query, $bindings] = $this->createSub($query); + + $expression = '('.$query.') as '.$this->grammar->wrapTable($as); + + $this->addBinding($bindings, 'join'); + + return $this->join(new Expression($expression), $first, $operator, $second, $type, $where); + } + + /** + * Add a left join to the query. + * + * @param string $table + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function leftJoin($table, $first, $operator = null, $second = null) + { + return $this->join($table, $first, $operator, $second, 'left'); + } + + /** + * Add a "join where" clause to the query. + * + * @param string $table + * @param \Closure|string $first + * @param string $operator + * @param string $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function leftJoinWhere($table, $first, $operator, $second) + { + return $this->joinWhere($table, $first, $operator, $second, 'left'); + } + + /** + * Add a subquery left join to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function leftJoinSub($query, $as, $first, $operator = null, $second = null) + { + return $this->joinSub($query, $as, $first, $operator, $second, 'left'); + } + + /** + * Add a right join to the query. + * + * @param string $table + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function rightJoin($table, $first, $operator = null, $second = null) + { + return $this->join($table, $first, $operator, $second, 'right'); + } + + /** + * Add a "right join where" clause to the query. + * + * @param string $table + * @param \Closure|string $first + * @param string $operator + * @param string $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function rightJoinWhere($table, $first, $operator, $second) + { + return $this->joinWhere($table, $first, $operator, $second, 'right'); + } + + /** + * Add a subquery right join to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function rightJoinSub($query, $as, $first, $operator = null, $second = null) + { + return $this->joinSub($query, $as, $first, $operator, $second, 'right'); + } + + /** + * Add a "cross join" clause to the query. + * + * @param string $table + * @param \Closure|string|null $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function crossJoin($table, $first = null, $operator = null, $second = null) + { + if ($first) { + return $this->join($table, $first, $operator, $second, 'cross'); + } + + $this->joins[] = $this->newJoinClause($this, 'cross', $table); + + return $this; + } + + /** + * Get a new join clause. + * + * @param \Illuminate\Database\Query\Builder $parentQuery + * @param string $type + * @param string $table + * @return \Illuminate\Database\Query\JoinClause + */ + protected function newJoinClause(self $parentQuery, $type, $table) + { + return new JoinClause($parentQuery, $type, $table); + } + + /** + * Merge an array of where clauses and bindings. + * + * @param array $wheres + * @param array $bindings + * @return void + */ + public function mergeWheres($wheres, $bindings) + { + $this->wheres = array_merge($this->wheres, (array) $wheres); + + $this->bindings['where'] = array_values( + array_merge($this->bindings['where'], (array) $bindings) + ); + } + + /** + * Add a basic where clause to the query. + * + * @param \Closure|string|array $column + * @param mixed $operator + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function where($column, $operator = null, $value = null, $boolean = 'and') + { + // If the column is an array, we will assume it is an array of key-value pairs + // and can add them each as a where clause. We will maintain the boolean we + // received when the method was called and pass it into the nested where. + if (is_array($column)) { + return $this->addArrayOfWheres($column, $boolean); + } + + // Here we will make some assumptions about the operator. If only 2 values are + // passed to the method, we will assume that the operator is an equals sign + // and keep going. Otherwise, we'll require the operator to be passed in. + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + // If the columns is actually a Closure instance, we will assume the developer + // wants to begin a nested where statement which is wrapped in parenthesis. + // We'll add that Closure to the query then return back out immediately. + if ($column instanceof Closure) { + return $this->whereNested($column, $boolean); + } + + // If the given operator is not found in the list of valid operators we will + // assume that the developer is just short-cutting the '=' operators and + // we will set the operators to '=' and set the values appropriately. + if ($this->invalidOperator($operator)) { + [$value, $operator] = [$operator, '=']; + } + + // If the value is a Closure, it means the developer is performing an entire + // sub-select within the query and we will need to compile the sub-select + // within the where clause to get the appropriate query record results. + if ($value instanceof Closure) { + return $this->whereSub($column, $operator, $value, $boolean); + } + + // If the value is "null", we will just assume the developer wants to add a + // where null clause to the query. So, we will allow a short-cut here to + // that method for convenience so the developer doesn't have to check. + if (is_null($value)) { + return $this->whereNull($column, $boolean, $operator !== '='); + } + + $type = 'Basic'; + + // If the column is making a JSON reference we'll check to see if the value + // is a boolean. If it is, we'll add the raw boolean string as an actual + // value to the query to ensure this is properly handled by the query. + if (Str::contains($column, '->') && is_bool($value)) { + $value = new Expression($value ? 'true' : 'false'); + + if (is_string($column)) { + $type = 'JsonBoolean'; + } + } + + // Now that we are working with just a simple query we can put the elements + // in our array and add the query binding to our array of bindings that + // will be bound to each SQL statements when it is finally executed. + $this->wheres[] = compact( + 'type', 'column', 'operator', 'value', 'boolean' + ); + + if (! $value instanceof Expression) { + $this->addBinding($this->flattenValue($value), 'where'); + } + + return $this; + } + + /** + * Add an array of where clauses to the query. + * + * @param array $column + * @param string $boolean + * @param string $method + * @return $this + */ + protected function addArrayOfWheres($column, $boolean, $method = 'where') + { + return $this->whereNested(function ($query) use ($column, $method, $boolean) { + foreach ($column as $key => $value) { + if (is_numeric($key) && is_array($value)) { + $query->{$method}(...array_values($value)); + } else { + $query->$method($key, '=', $value, $boolean); + } + } + }, $boolean); + } + + /** + * Prepare the value and operator for a where clause. + * + * @param string $value + * @param string $operator + * @param bool $useDefault + * @return array + * + * @throws \InvalidArgumentException + */ + public function prepareValueAndOperator($value, $operator, $useDefault = false) + { + if ($useDefault) { + return [$operator, '=']; + } elseif ($this->invalidOperatorAndValue($operator, $value)) { + throw new InvalidArgumentException('Illegal operator and value combination.'); + } + + return [$value, $operator]; + } + + /** + * Determine if the given operator and value combination is legal. + * + * Prevents using Null values with invalid operators. + * + * @param string $operator + * @param mixed $value + * @return bool + */ + protected function invalidOperatorAndValue($operator, $value) + { + return is_null($value) && in_array($operator, $this->operators) && + ! in_array($operator, ['=', '<>', '!=']); + } + + /** + * Determine if the given operator is supported. + * + * @param string $operator + * @return bool + */ + protected function invalidOperator($operator) + { + return ! in_array(strtolower($operator), $this->operators, true) && + ! in_array(strtolower($operator), $this->grammar->getOperators(), true); + } + + /** + * Add an "or where" clause to the query. + * + * @param \Closure|string|array $column + * @param mixed $operator + * @param mixed $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhere($column, $operator = null, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->where($column, $operator, $value, 'or'); + } + + /** + * Add a "where" clause comparing two columns to the query. + * + * @param string|array $first + * @param string|null $operator + * @param string|null $second + * @param string|null $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereColumn($first, $operator = null, $second = null, $boolean = 'and') + { + // If the column is an array, we will assume it is an array of key-value pairs + // and can add them each as a where clause. We will maintain the boolean we + // received when the method was called and pass it into the nested where. + if (is_array($first)) { + return $this->addArrayOfWheres($first, $boolean, 'whereColumn'); + } + + // If the given operator is not found in the list of valid operators we will + // assume that the developer is just short-cutting the '=' operators and + // we will set the operators to '=' and set the values appropriately. + if ($this->invalidOperator($operator)) { + [$second, $operator] = [$operator, '=']; + } + + // Finally, we will add this where clause into this array of clauses that we + // are building for the query. All of them will be compiled via a grammar + // once the query is about to be executed and run against the database. + $type = 'Column'; + + $this->wheres[] = compact( + 'type', 'first', 'operator', 'second', 'boolean' + ); + + return $this; + } + + /** + * Add an "or where" clause comparing two columns to the query. + * + * @param string|array $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereColumn($first, $operator = null, $second = null) + { + return $this->whereColumn($first, $operator, $second, 'or'); + } + + /** + * Add a raw where clause to the query. + * + * @param string $sql + * @param mixed $bindings + * @param string $boolean + * @return $this + */ + public function whereRaw($sql, $bindings = [], $boolean = 'and') + { + $this->wheres[] = ['type' => 'raw', 'sql' => $sql, 'boolean' => $boolean]; + + $this->addBinding((array) $bindings, 'where'); + + return $this; + } + + /** + * Add a raw or where clause to the query. + * + * @param string $sql + * @param mixed $bindings + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereRaw($sql, $bindings = []) + { + return $this->whereRaw($sql, $bindings, 'or'); + } + + /** + * Add a "where in" clause to the query. + * + * @param string $column + * @param mixed $values + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereIn($column, $values, $boolean = 'and', $not = false) + { + $type = $not ? 'NotIn' : 'In'; + + // If the value is a query builder instance we will assume the developer wants to + // look for any values that exists within this given query. So we will add the + // query accordingly so that this query is properly executed when it is run. + if ($this->isQueryable($values)) { + [$query, $bindings] = $this->createSub($values); + + $values = [new Expression($query)]; + + $this->addBinding($bindings, 'where'); + } + + // Next, if the value is Arrayable we need to cast it to its raw array form so we + // have the underlying array value instead of an Arrayable object which is not + // able to be added as a binding, etc. We will then add to the wheres array. + if ($values instanceof Arrayable) { + $values = $values->toArray(); + } + + $this->wheres[] = compact('type', 'column', 'values', 'boolean'); + + // Finally we'll add a binding for each values unless that value is an expression + // in which case we will just skip over it since it will be the query as a raw + // string and not as a parameterized place-holder to be replaced by the PDO. + $this->addBinding($this->cleanBindings($values), 'where'); + + return $this; + } + + /** + * Add an "or where in" clause to the query. + * + * @param string $column + * @param mixed $values + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereIn($column, $values) + { + return $this->whereIn($column, $values, 'or'); + } + + /** + * Add a "where not in" clause to the query. + * + * @param string $column + * @param mixed $values + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNotIn($column, $values, $boolean = 'and') + { + return $this->whereIn($column, $values, $boolean, true); + } + + /** + * Add an "or where not in" clause to the query. + * + * @param string $column + * @param mixed $values + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNotIn($column, $values) + { + return $this->whereNotIn($column, $values, 'or'); + } + + /** + * Add a "where in raw" clause for integer values to the query. + * + * @param string $column + * @param \Illuminate\Contracts\Support\Arrayable|array $values + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereIntegerInRaw($column, $values, $boolean = 'and', $not = false) + { + $type = $not ? 'NotInRaw' : 'InRaw'; + + if ($values instanceof Arrayable) { + $values = $values->toArray(); + } + + foreach ($values as &$value) { + $value = (int) $value; + } + + $this->wheres[] = compact('type', 'column', 'values', 'boolean'); + + return $this; + } + + /** + * Add a "where not in raw" clause for integer values to the query. + * + * @param string $column + * @param \Illuminate\Contracts\Support\Arrayable|array $values + * @param string $boolean + * @return $this + */ + public function whereIntegerNotInRaw($column, $values, $boolean = 'and') + { + return $this->whereIntegerInRaw($column, $values, $boolean, true); + } + + /** + * Add a "where null" clause to the query. + * + * @param string|array $columns + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereNull($columns, $boolean = 'and', $not = false) + { + $type = $not ? 'NotNull' : 'Null'; + + foreach (Arr::wrap($columns) as $column) { + $this->wheres[] = compact('type', 'column', 'boolean'); + } + + return $this; + } + + /** + * Add an "or where null" clause to the query. + * + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNull($column) + { + return $this->whereNull($column, 'or'); + } + + /** + * Add a "where not null" clause to the query. + * + * @param string|array $columns + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNotNull($columns, $boolean = 'and') + { + return $this->whereNull($columns, $boolean, true); + } + + /** + * Add a where between statement to the query. + * + * @param string $column + * @param array $values + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereBetween($column, array $values, $boolean = 'and', $not = false) + { + $type = 'between'; + + $this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not'); + + $this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'where'); + + return $this; + } + + /** + * Add an or where between statement to the query. + * + * @param string $column + * @param array $values + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereBetween($column, array $values) + { + return $this->whereBetween($column, $values, 'or'); + } + + /** + * Add a where not between statement to the query. + * + * @param string $column + * @param array $values + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNotBetween($column, array $values, $boolean = 'and') + { + return $this->whereBetween($column, $values, $boolean, true); + } + + /** + * Add an or where not between statement to the query. + * + * @param string $column + * @param array $values + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNotBetween($column, array $values) + { + return $this->whereNotBetween($column, $values, 'or'); + } + + /** + * Add an "or where not null" clause to the query. + * + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNotNull($column) + { + return $this->whereNotNull($column, 'or'); + } + + /** + * Add a "where date" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|null $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereDate($column, $operator, $value = null, $boolean = 'and') + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + $value = $this->flattenValue($value); + + if ($value instanceof DateTimeInterface) { + $value = $value->format('Y-m-d'); + } + + return $this->addDateBasedWhere('Date', $column, $operator, $value, $boolean); + } + + /** + * Add an "or where date" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|null $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereDate($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereDate($column, $operator, $value, 'or'); + } + + /** + * Add a "where time" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|null $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereTime($column, $operator, $value = null, $boolean = 'and') + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + $value = $this->flattenValue($value); + + if ($value instanceof DateTimeInterface) { + $value = $value->format('H:i:s'); + } + + return $this->addDateBasedWhere('Time', $column, $operator, $value, $boolean); + } + + /** + * Add an "or where time" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|null $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereTime($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereTime($column, $operator, $value, 'or'); + } + + /** + * Add a "where day" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|null $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereDay($column, $operator, $value = null, $boolean = 'and') + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + $value = $this->flattenValue($value); + + if ($value instanceof DateTimeInterface) { + $value = $value->format('d'); + } + + if (! $value instanceof Expression) { + $value = str_pad($value, 2, '0', STR_PAD_LEFT); + } + + return $this->addDateBasedWhere('Day', $column, $operator, $value, $boolean); + } + + /** + * Add an "or where day" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|null $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereDay($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereDay($column, $operator, $value, 'or'); + } + + /** + * Add a "where month" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|null $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereMonth($column, $operator, $value = null, $boolean = 'and') + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + $value = $this->flattenValue($value); + + if ($value instanceof DateTimeInterface) { + $value = $value->format('m'); + } + + if (! $value instanceof Expression) { + $value = str_pad($value, 2, '0', STR_PAD_LEFT); + } + + return $this->addDateBasedWhere('Month', $column, $operator, $value, $boolean); + } + + /** + * Add an "or where month" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|null $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereMonth($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereMonth($column, $operator, $value, 'or'); + } + + /** + * Add a "where year" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|int|null $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereYear($column, $operator, $value = null, $boolean = 'and') + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + $value = $this->flattenValue($value); + + if ($value instanceof DateTimeInterface) { + $value = $value->format('Y'); + } + + return $this->addDateBasedWhere('Year', $column, $operator, $value, $boolean); + } + + /** + * Add an "or where year" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|int|null $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereYear($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereYear($column, $operator, $value, 'or'); + } + + /** + * Add a date based (year, month, day, time) statement to the query. + * + * @param string $type + * @param string $column + * @param string $operator + * @param mixed $value + * @param string $boolean + * @return $this + */ + protected function addDateBasedWhere($type, $column, $operator, $value, $boolean = 'and') + { + $this->wheres[] = compact('column', 'type', 'boolean', 'operator', 'value'); + + if (! $value instanceof Expression) { + $this->addBinding($value, 'where'); + } + + return $this; + } + + /** + * Add a nested where statement to the query. + * + * @param \Closure $callback + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNested(Closure $callback, $boolean = 'and') + { + call_user_func($callback, $query = $this->forNestedWhere()); + + return $this->addNestedWhereQuery($query, $boolean); + } + + /** + * Create a new query instance for nested where condition. + * + * @return \Illuminate\Database\Query\Builder + */ + public function forNestedWhere() + { + return $this->newQuery()->from($this->from); + } + + /** + * Add another query builder as a nested where to the query builder. + * + * @param \Illuminate\Database\Query\Builder|static $query + * @param string $boolean + * @return $this + */ + public function addNestedWhereQuery($query, $boolean = 'and') + { + if (count($query->wheres)) { + $type = 'Nested'; + + $this->wheres[] = compact('type', 'query', 'boolean'); + + $this->addBinding($query->getRawBindings()['where'], 'where'); + } + + return $this; + } + + /** + * Add a full sub-select to the query. + * + * @param string $column + * @param string $operator + * @param \Closure $callback + * @param string $boolean + * @return $this + */ + protected function whereSub($column, $operator, Closure $callback, $boolean) + { + $type = 'Sub'; + + // Once we have the query instance we can simply execute it so it can add all + // of the sub-select's conditions to itself, and then we can cache it off + // in the array of where clauses for the "main" parent query instance. + call_user_func($callback, $query = $this->forSubQuery()); + + $this->wheres[] = compact( + 'type', 'column', 'operator', 'query', 'boolean' + ); + + $this->addBinding($query->getBindings(), 'where'); + + return $this; + } + + /** + * Add an exists clause to the query. + * + * @param \Closure $callback + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereExists(Closure $callback, $boolean = 'and', $not = false) + { + $query = $this->forSubQuery(); + + // Similar to the sub-select clause, we will create a new query instance so + // the developer may cleanly specify the entire exists query and we will + // compile the whole thing in the grammar and insert it into the SQL. + call_user_func($callback, $query); + + return $this->addWhereExistsQuery($query, $boolean, $not); + } + + /** + * Add an or exists clause to the query. + * + * @param \Closure $callback + * @param bool $not + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereExists(Closure $callback, $not = false) + { + return $this->whereExists($callback, 'or', $not); + } + + /** + * Add a where not exists clause to the query. + * + * @param \Closure $callback + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNotExists(Closure $callback, $boolean = 'and') + { + return $this->whereExists($callback, $boolean, true); + } + + /** + * Add a where not exists clause to the query. + * + * @param \Closure $callback + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNotExists(Closure $callback) + { + return $this->orWhereExists($callback, true); + } + + /** + * Add an exists clause to the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $boolean + * @param bool $not + * @return $this + */ + public function addWhereExistsQuery(self $query, $boolean = 'and', $not = false) + { + $type = $not ? 'NotExists' : 'Exists'; + + $this->wheres[] = compact('type', 'query', 'boolean'); + + $this->addBinding($query->getBindings(), 'where'); + + return $this; + } + + /** + * Adds a where condition using row values. + * + * @param array $columns + * @param string $operator + * @param array $values + * @param string $boolean + * @return $this + * + * @throws \InvalidArgumentException + */ + public function whereRowValues($columns, $operator, $values, $boolean = 'and') + { + if (count($columns) !== count($values)) { + throw new InvalidArgumentException('The number of columns must match the number of values'); + } + + $type = 'RowValues'; + + $this->wheres[] = compact('type', 'columns', 'operator', 'values', 'boolean'); + + $this->addBinding($this->cleanBindings($values)); + + return $this; + } + + /** + * Adds a or where condition using row values. + * + * @param array $columns + * @param string $operator + * @param array $values + * @return $this + */ + public function orWhereRowValues($columns, $operator, $values) + { + return $this->whereRowValues($columns, $operator, $values, 'or'); + } + + /** + * Add a "where JSON contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereJsonContains($column, $value, $boolean = 'and', $not = false) + { + $type = 'JsonContains'; + + $this->wheres[] = compact('type', 'column', 'value', 'boolean', 'not'); + + if (! $value instanceof Expression) { + $this->addBinding($this->grammar->prepareBindingForJsonContains($value)); + } + + return $this; + } + + /** + * Add a "or where JSON contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @return $this + */ + public function orWhereJsonContains($column, $value) + { + return $this->whereJsonContains($column, $value, 'or'); + } + + /** + * Add a "where JSON not contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function whereJsonDoesntContain($column, $value, $boolean = 'and') + { + return $this->whereJsonContains($column, $value, $boolean, true); + } + + /** + * Add a "or where JSON not contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @return $this + */ + public function orWhereJsonDoesntContain($column, $value) + { + return $this->whereJsonDoesntContain($column, $value, 'or'); + } + + /** + * Add a "where JSON length" clause to the query. + * + * @param string $column + * @param mixed $operator + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function whereJsonLength($column, $operator, $value = null, $boolean = 'and') + { + $type = 'JsonLength'; + + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + $this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean'); + + if (! $value instanceof Expression) { + $this->addBinding((int) $this->flattenValue($value)); + } + + return $this; + } + + /** + * Add a "or where JSON length" clause to the query. + * + * @param string $column + * @param mixed $operator + * @param mixed $value + * @return $this + */ + public function orWhereJsonLength($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereJsonLength($column, $operator, $value, 'or'); + } + + /** + * Handles dynamic "where" clauses to the query. + * + * @param string $method + * @param array $parameters + * @return $this + */ + public function dynamicWhere($method, $parameters) + { + $finder = substr($method, 5); + + $segments = preg_split( + '/(And|Or)(?=[A-Z])/', $finder, -1, PREG_SPLIT_DELIM_CAPTURE + ); + + // The connector variable will determine which connector will be used for the + // query condition. We will change it as we come across new boolean values + // in the dynamic method strings, which could contain a number of these. + $connector = 'and'; + + $index = 0; + + foreach ($segments as $segment) { + // If the segment is not a boolean connector, we can assume it is a column's name + // and we will add it to the query as a new constraint as a where clause, then + // we can keep iterating through the dynamic method string's segments again. + if ($segment !== 'And' && $segment !== 'Or') { + $this->addDynamic($segment, $connector, $parameters, $index); + + $index++; + } + + // Otherwise, we will store the connector so we know how the next where clause we + // find in the query should be connected to the previous ones, meaning we will + // have the proper boolean connector to connect the next where clause found. + else { + $connector = $segment; + } + } + + return $this; + } + + /** + * Add a single dynamic where clause statement to the query. + * + * @param string $segment + * @param string $connector + * @param array $parameters + * @param int $index + * @return void + */ + protected function addDynamic($segment, $connector, $parameters, $index) + { + // Once we have parsed out the columns and formatted the boolean operators we + // are ready to add it to this query as a where clause just like any other + // clause on the query. Then we'll increment the parameter index values. + $bool = strtolower($connector); + + $this->where(Str::snake($segment), '=', $parameters[$index], $bool); + } + + /** + * Add a "group by" clause to the query. + * + * @param array|string ...$groups + * @return $this + */ + public function groupBy(...$groups) + { + foreach ($groups as $group) { + $this->groups = array_merge( + (array) $this->groups, + Arr::wrap($group) + ); + } + + return $this; + } + + /** + * Add a raw groupBy clause to the query. + * + * @param string $sql + * @param array $bindings + * @return $this + */ + public function groupByRaw($sql, array $bindings = []) + { + $this->groups[] = new Expression($sql); + + $this->addBinding($bindings, 'groupBy'); + + return $this; + } + + /** + * Add a "having" clause to the query. + * + * @param string $column + * @param string|null $operator + * @param string|null $value + * @param string $boolean + * @return $this + */ + public function having($column, $operator = null, $value = null, $boolean = 'and') + { + $type = 'Basic'; + + // Here we will make some assumptions about the operator. If only 2 values are + // passed to the method, we will assume that the operator is an equals sign + // and keep going. Otherwise, we'll require the operator to be passed in. + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + // If the given operator is not found in the list of valid operators we will + // assume that the developer is just short-cutting the '=' operators and + // we will set the operators to '=' and set the values appropriately. + if ($this->invalidOperator($operator)) { + [$value, $operator] = [$operator, '=']; + } + + $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean'); + + if (! $value instanceof Expression) { + $this->addBinding($this->flattenValue($value), 'having'); + } + + return $this; + } + + /** + * Add a "or having" clause to the query. + * + * @param string $column + * @param string|null $operator + * @param string|null $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orHaving($column, $operator = null, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->having($column, $operator, $value, 'or'); + } + + /** + * Add a "having between " clause to the query. + * + * @param string $column + * @param array $values + * @param string $boolean + * @param bool $not + * @return \Illuminate\Database\Query\Builder|static + */ + public function havingBetween($column, array $values, $boolean = 'and', $not = false) + { + $type = 'between'; + + $this->havings[] = compact('type', 'column', 'values', 'boolean', 'not'); + + $this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'having'); + + return $this; + } + + /** + * Add a raw having clause to the query. + * + * @param string $sql + * @param array $bindings + * @param string $boolean + * @return $this + */ + public function havingRaw($sql, array $bindings = [], $boolean = 'and') + { + $type = 'Raw'; + + $this->havings[] = compact('type', 'sql', 'boolean'); + + $this->addBinding($bindings, 'having'); + + return $this; + } + + /** + * Add a raw or having clause to the query. + * + * @param string $sql + * @param array $bindings + * @return \Illuminate\Database\Query\Builder|static + */ + public function orHavingRaw($sql, array $bindings = []) + { + return $this->havingRaw($sql, $bindings, 'or'); + } + + /** + * Add an "order by" clause to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Query\Expression|string $column + * @param string $direction + * @return $this + * + * @throws \InvalidArgumentException + */ + public function orderBy($column, $direction = 'asc') + { + if ($this->isQueryable($column)) { + [$query, $bindings] = $this->createSub($column); + + $column = new Expression('('.$query.')'); + + $this->addBinding($bindings, $this->unions ? 'unionOrder' : 'order'); + } + + $direction = strtolower($direction); + + if (! in_array($direction, ['asc', 'desc'], true)) { + throw new InvalidArgumentException('Order direction must be "asc" or "desc".'); + } + + $this->{$this->unions ? 'unionOrders' : 'orders'}[] = [ + 'column' => $column, + 'direction' => $direction, + ]; + + return $this; + } + + /** + * Add a descending "order by" clause to the query. + * + * @param string $column + * @return $this + */ + public function orderByDesc($column) + { + return $this->orderBy($column, 'desc'); + } + + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function latest($column = 'created_at') + { + return $this->orderBy($column, 'desc'); + } + + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function oldest($column = 'created_at') + { + return $this->orderBy($column, 'asc'); + } + + /** + * Put the query's results in random order. + * + * @param string $seed + * @return $this + */ + public function inRandomOrder($seed = '') + { + return $this->orderByRaw($this->grammar->compileRandom($seed)); + } + + /** + * Add a raw "order by" clause to the query. + * + * @param string $sql + * @param array $bindings + * @return $this + */ + public function orderByRaw($sql, $bindings = []) + { + $type = 'Raw'; + + $this->{$this->unions ? 'unionOrders' : 'orders'}[] = compact('type', 'sql'); + + $this->addBinding($bindings, $this->unions ? 'unionOrder' : 'order'); + + return $this; + } + + /** + * Alias to set the "offset" value of the query. + * + * @param int $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function skip($value) + { + return $this->offset($value); + } + + /** + * Set the "offset" value of the query. + * + * @param int $value + * @return $this + */ + public function offset($value) + { + $property = $this->unions ? 'unionOffset' : 'offset'; + + $this->$property = max(0, (int) $value); + + return $this; + } + + /** + * Alias to set the "limit" value of the query. + * + * @param int $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function take($value) + { + return $this->limit($value); + } + + /** + * Set the "limit" value of the query. + * + * @param int $value + * @return $this + */ + public function limit($value) + { + $property = $this->unions ? 'unionLimit' : 'limit'; + + if ($value >= 0) { + $this->$property = ! is_null($value) ? (int) $value : null; + } + + return $this; + } + + /** + * Set the limit and offset for a given page. + * + * @param int $page + * @param int $perPage + * @return \Illuminate\Database\Query\Builder|static + */ + public function forPage($page, $perPage = 15) + { + return $this->offset(($page - 1) * $perPage)->limit($perPage); + } + + /** + * Constrain the query to the previous "page" of results before a given ID. + * + * @param int $perPage + * @param int|null $lastId + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function forPageBeforeId($perPage = 15, $lastId = 0, $column = 'id') + { + $this->orders = $this->removeExistingOrdersFor($column); + + if (! is_null($lastId)) { + $this->where($column, '<', $lastId); + } + + return $this->orderBy($column, 'desc') + ->limit($perPage); + } + + /** + * Constrain the query to the next "page" of results after a given ID. + * + * @param int $perPage + * @param int|null $lastId + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function forPageAfterId($perPage = 15, $lastId = 0, $column = 'id') + { + $this->orders = $this->removeExistingOrdersFor($column); + + if (! is_null($lastId)) { + $this->where($column, '>', $lastId); + } + + return $this->orderBy($column, 'asc') + ->limit($perPage); + } + + /** + * Get an array with all orders with a given column removed. + * + * @param string $column + * @return array + */ + protected function removeExistingOrdersFor($column) + { + return Collection::make($this->orders) + ->reject(function ($order) use ($column) { + return isset($order['column']) + ? $order['column'] === $column : false; + })->values()->all(); + } + + /** + * Add a union statement to the query. + * + * @param \Illuminate\Database\Query\Builder|\Closure $query + * @param bool $all + * @return \Illuminate\Database\Query\Builder|static + */ + public function union($query, $all = false) + { + if ($query instanceof Closure) { + call_user_func($query, $query = $this->newQuery()); + } + + $this->unions[] = compact('query', 'all'); + + $this->addBinding($query->getBindings(), 'union'); + + return $this; + } + + /** + * Add a union all statement to the query. + * + * @param \Illuminate\Database\Query\Builder|\Closure $query + * @return \Illuminate\Database\Query\Builder|static + */ + public function unionAll($query) + { + return $this->union($query, true); + } + + /** + * Lock the selected rows in the table. + * + * @param string|bool $value + * @return $this + */ + public function lock($value = true) + { + $this->lock = $value; + + if (! is_null($this->lock)) { + $this->useWritePdo(); + } + + return $this; + } + + /** + * Lock the selected rows in the table for updating. + * + * @return \Illuminate\Database\Query\Builder + */ + public function lockForUpdate() + { + return $this->lock(true); + } + + /** + * Share lock the selected rows in the table. + * + * @return \Illuminate\Database\Query\Builder + */ + public function sharedLock() + { + return $this->lock(false); + } + + /** + * Get the SQL representation of the query. + * + * @return string + */ + public function toSql() + { + return $this->grammar->compileSelect($this); + } + + /** + * Execute a query for a single record by ID. + * + * @param int|string $id + * @param array $columns + * @return mixed|static + */ + public function find($id, $columns = ['*']) + { + return $this->where('id', '=', $id)->first($columns); + } + + /** + * Get a single column's value from the first result of a query. + * + * @param string $column + * @return mixed + */ + public function value($column) + { + $result = (array) $this->first([$column]); + + return count($result) > 0 ? reset($result) : null; + } + + /** + * Execute the query as a "select" statement. + * + * @param array|string $columns + * @return \Illuminate\Support\Collection + */ + public function get($columns = ['*']) + { + return collect($this->onceWithColumns(Arr::wrap($columns), function () { + return $this->processor->processSelect($this, $this->runSelect()); + })); + } + + /** + * Run the query as a "select" statement against the connection. + * + * @return array + */ + protected function runSelect() + { + return $this->connection->select( + $this->toSql(), $this->getBindings(), ! $this->useWritePdo + ); + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null) + { + $page = $page ?: Paginator::resolveCurrentPage($pageName); + + $total = $this->getCountForPagination(); + + $results = $total ? $this->forPage($page, $perPage)->get($columns) : collect(); + + return $this->paginator($results, $total, $perPage, $page, [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ]); + } + + /** + * Get a paginator only supporting simple next and previous links. + * + * This is more efficient on larger data-sets, etc. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null) + { + $page = $page ?: Paginator::resolveCurrentPage($pageName); + + $this->offset(($page - 1) * $perPage)->limit($perPage + 1); + + return $this->simplePaginator($this->get($columns), $perPage, $page, [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ]); + } + + /** + * Get the count of the total records for the paginator. + * + * @param array $columns + * @return int + */ + public function getCountForPagination($columns = ['*']) + { + $results = $this->runPaginationCountQuery($columns); + + // Once we have run the pagination count query, we will get the resulting count and + // take into account what type of query it was. When there is a group by we will + // just return the count of the entire results set since that will be correct. + if (isset($this->groups)) { + return count($results); + } elseif (! isset($results[0])) { + return 0; + } elseif (is_object($results[0])) { + return (int) $results[0]->aggregate; + } + + return (int) array_change_key_case((array) $results[0])['aggregate']; + } + + /** + * Run a pagination count query. + * + * @param array $columns + * @return array + */ + protected function runPaginationCountQuery($columns = ['*']) + { + $without = $this->unions ? ['orders', 'limit', 'offset'] : ['columns', 'orders', 'limit', 'offset']; + + return $this->cloneWithout($without) + ->cloneWithoutBindings($this->unions ? ['order'] : ['select', 'order']) + ->setAggregate('count', $this->withoutSelectAliases($columns)) + ->get()->all(); + } + + /** + * Remove the column aliases since they will break count queries. + * + * @param array $columns + * @return array + */ + protected function withoutSelectAliases(array $columns) + { + return array_map(function ($column) { + return is_string($column) && ($aliasPosition = stripos($column, ' as ')) !== false + ? substr($column, 0, $aliasPosition) : $column; + }, $columns); + } + + /** + * Get a lazy collection for the given query. + * + * @return \Illuminate\Support\LazyCollection + */ + public function cursor() + { + if (is_null($this->columns)) { + $this->columns = ['*']; + } + + return new LazyCollection(function () { + yield from $this->connection->cursor( + $this->toSql(), $this->getBindings(), ! $this->useWritePdo + ); + }); + } + + /** + * Throw an exception if the query doesn't have an orderBy clause. + * + * @return void + * + * @throws \RuntimeException + */ + protected function enforceOrderBy() + { + if (empty($this->orders) && empty($this->unionOrders)) { + throw new RuntimeException('You must specify an orderBy clause when using this function.'); + } + } + + /** + * Get an array with the values of a given column. + * + * @param string $column + * @param string|null $key + * @return \Illuminate\Support\Collection + */ + public function pluck($column, $key = null) + { + // First, we will need to select the results of the query accounting for the + // given columns / key. Once we have the results, we will be able to take + // the results and get the exact data that was requested for the query. + $queryResult = $this->onceWithColumns( + is_null($key) ? [$column] : [$column, $key], + function () { + return $this->processor->processSelect( + $this, $this->runSelect() + ); + } + ); + + if (empty($queryResult)) { + return collect(); + } + + // If the columns are qualified with a table or have an alias, we cannot use + // those directly in the "pluck" operations since the results from the DB + // are only keyed by the column itself. We'll strip the table out here. + $column = $this->stripTableForPluck($column); + + $key = $this->stripTableForPluck($key); + + return is_array($queryResult[0]) + ? $this->pluckFromArrayColumn($queryResult, $column, $key) + : $this->pluckFromObjectColumn($queryResult, $column, $key); + } + + /** + * Strip off the table name or alias from a column identifier. + * + * @param string $column + * @return string|null + */ + protected function stripTableForPluck($column) + { + if (is_null($column)) { + return $column; + } + + $separator = strpos(strtolower($column), ' as ') !== false ? ' as ' : '\.'; + + return last(preg_split('~'.$separator.'~i', $column)); + } + + /** + * Retrieve column values from rows represented as objects. + * + * @param array $queryResult + * @param string $column + * @param string $key + * @return \Illuminate\Support\Collection + */ + protected function pluckFromObjectColumn($queryResult, $column, $key) + { + $results = []; + + if (is_null($key)) { + foreach ($queryResult as $row) { + $results[] = $row->$column; + } + } else { + foreach ($queryResult as $row) { + $results[$row->$key] = $row->$column; + } + } + + return collect($results); + } + + /** + * Retrieve column values from rows represented as arrays. + * + * @param array $queryResult + * @param string $column + * @param string $key + * @return \Illuminate\Support\Collection + */ + protected function pluckFromArrayColumn($queryResult, $column, $key) + { + $results = []; + + if (is_null($key)) { + foreach ($queryResult as $row) { + $results[] = $row[$column]; + } + } else { + foreach ($queryResult as $row) { + $results[$row[$key]] = $row[$column]; + } + } + + return collect($results); + } + + /** + * Concatenate values of a given column as a string. + * + * @param string $column + * @param string $glue + * @return string + */ + public function implode($column, $glue = '') + { + return $this->pluck($column)->implode($glue); + } + + /** + * Determine if any rows exist for the current query. + * + * @return bool + */ + public function exists() + { + $results = $this->connection->select( + $this->grammar->compileExists($this), $this->getBindings(), ! $this->useWritePdo + ); + + // If the results has rows, we will get the row and see if the exists column is a + // boolean true. If there is no results for this query we will return false as + // there are no rows for this query at all and we can return that info here. + if (isset($results[0])) { + $results = (array) $results[0]; + + return (bool) $results['exists']; + } + + return false; + } + + /** + * Determine if no rows exist for the current query. + * + * @return bool + */ + public function doesntExist() + { + return ! $this->exists(); + } + + /** + * Execute the given callback if no rows exist for the current query. + * + * @param \Closure $callback + * @return mixed + */ + public function existsOr(Closure $callback) + { + return $this->exists() ? true : $callback(); + } + + /** + * Execute the given callback if rows exist for the current query. + * + * @param \Closure $callback + * @return mixed + */ + public function doesntExistOr(Closure $callback) + { + return $this->doesntExist() ? true : $callback(); + } + + /** + * Retrieve the "count" result of the query. + * + * @param string $columns + * @return int + */ + public function count($columns = '*') + { + return (int) $this->aggregate(__FUNCTION__, Arr::wrap($columns)); + } + + /** + * Retrieve the minimum value of a given column. + * + * @param string $column + * @return mixed + */ + public function min($column) + { + return $this->aggregate(__FUNCTION__, [$column]); + } + + /** + * Retrieve the maximum value of a given column. + * + * @param string $column + * @return mixed + */ + public function max($column) + { + return $this->aggregate(__FUNCTION__, [$column]); + } + + /** + * Retrieve the sum of the values of a given column. + * + * @param string $column + * @return mixed + */ + public function sum($column) + { + $result = $this->aggregate(__FUNCTION__, [$column]); + + return $result ?: 0; + } + + /** + * Retrieve the average of the values of a given column. + * + * @param string $column + * @return mixed + */ + public function avg($column) + { + return $this->aggregate(__FUNCTION__, [$column]); + } + + /** + * Alias for the "avg" method. + * + * @param string $column + * @return mixed + */ + public function average($column) + { + return $this->avg($column); + } + + /** + * Execute an aggregate function on the database. + * + * @param string $function + * @param array $columns + * @return mixed + */ + public function aggregate($function, $columns = ['*']) + { + $results = $this->cloneWithout($this->unions ? [] : ['columns']) + ->cloneWithoutBindings($this->unions ? [] : ['select']) + ->setAggregate($function, $columns) + ->get($columns); + + if (! $results->isEmpty()) { + return array_change_key_case((array) $results[0])['aggregate']; + } + } + + /** + * Execute a numeric aggregate function on the database. + * + * @param string $function + * @param array $columns + * @return float|int + */ + public function numericAggregate($function, $columns = ['*']) + { + $result = $this->aggregate($function, $columns); + + // If there is no result, we can obviously just return 0 here. Next, we will check + // if the result is an integer or float. If it is already one of these two data + // types we can just return the result as-is, otherwise we will convert this. + if (! $result) { + return 0; + } + + if (is_int($result) || is_float($result)) { + return $result; + } + + // If the result doesn't contain a decimal place, we will assume it is an int then + // cast it to one. When it does we will cast it to a float since it needs to be + // cast to the expected data type for the developers out of pure convenience. + return strpos((string) $result, '.') === false + ? (int) $result : (float) $result; + } + + /** + * Set the aggregate property without running the query. + * + * @param string $function + * @param array $columns + * @return $this + */ + protected function setAggregate($function, $columns) + { + $this->aggregate = compact('function', 'columns'); + + if (empty($this->groups)) { + $this->orders = null; + + $this->bindings['order'] = []; + } + + return $this; + } + + /** + * Execute the given callback while selecting the given columns. + * + * After running the callback, the columns are reset to the original value. + * + * @param array $columns + * @param callable $callback + * @return mixed + */ + protected function onceWithColumns($columns, $callback) + { + $original = $this->columns; + + if (is_null($original)) { + $this->columns = $columns; + } + + $result = $callback(); + + $this->columns = $original; + + return $result; + } + + /** + * Insert a new record into the database. + * + * @param array $values + * @return bool + */ + public function insert(array $values) + { + // Since every insert gets treated like a batch insert, we will make sure the + // bindings are structured in a way that is convenient when building these + // inserts statements by verifying these elements are actually an array. + if (empty($values)) { + return true; + } + + if (! is_array(reset($values))) { + $values = [$values]; + } + + // Here, we will sort the insert keys for every record so that each insert is + // in the same order for the record. We need to make sure this is the case + // so there are not any errors or problems when inserting these records. + else { + foreach ($values as $key => $value) { + ksort($value); + + $values[$key] = $value; + } + } + + // Finally, we will run this query against the database connection and return + // the results. We will need to also flatten these bindings before running + // the query so they are all in one huge, flattened array for execution. + return $this->connection->insert( + $this->grammar->compileInsert($this, $values), + $this->cleanBindings(Arr::flatten($values, 1)) + ); + } + + /** + * Insert a new record into the database while ignoring errors. + * + * @param array $values + * @return int + */ + public function insertOrIgnore(array $values) + { + if (empty($values)) { + return 0; + } + + if (! is_array(reset($values))) { + $values = [$values]; + } else { + foreach ($values as $key => $value) { + ksort($value); + $values[$key] = $value; + } + } + + return $this->connection->affectingStatement( + $this->grammar->compileInsertOrIgnore($this, $values), + $this->cleanBindings(Arr::flatten($values, 1)) + ); + } + + /** + * Insert a new record and get the value of the primary key. + * + * @param array $values + * @param string|null $sequence + * @return int + */ + public function insertGetId(array $values, $sequence = null) + { + $sql = $this->grammar->compileInsertGetId($this, $values, $sequence); + + $values = $this->cleanBindings($values); + + return $this->processor->processInsertGetId($this, $sql, $values, $sequence); + } + + /** + * Insert new records into the table using a subquery. + * + * @param array $columns + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @return int + */ + public function insertUsing(array $columns, $query) + { + [$sql, $bindings] = $this->createSub($query); + + return $this->connection->affectingStatement( + $this->grammar->compileInsertUsing($this, $columns, $sql), + $this->cleanBindings($bindings) + ); + } + + /** + * Update a record in the database. + * + * @param array $values + * @return int + */ + public function update(array $values) + { + $sql = $this->grammar->compileUpdate($this, $values); + + return $this->connection->update($sql, $this->cleanBindings( + $this->grammar->prepareBindingsForUpdate($this->bindings, $values) + )); + } + + /** + * Insert or update a record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @return bool + */ + public function updateOrInsert(array $attributes, array $values = []) + { + if (! $this->where($attributes)->exists()) { + return $this->insert(array_merge($attributes, $values)); + } + + if (empty($values)) { + return true; + } + + return (bool) $this->limit(1)->update($values); + } + + /** + * Increment a column's value by a given amount. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @return int + * + * @throws \InvalidArgumentException + */ + public function increment($column, $amount = 1, array $extra = []) + { + if (! is_numeric($amount)) { + throw new InvalidArgumentException('Non-numeric value passed to increment method.'); + } + + $wrapped = $this->grammar->wrap($column); + + $columns = array_merge([$column => $this->raw("$wrapped + $amount")], $extra); + + return $this->update($columns); + } + + /** + * Decrement a column's value by a given amount. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @return int + * + * @throws \InvalidArgumentException + */ + public function decrement($column, $amount = 1, array $extra = []) + { + if (! is_numeric($amount)) { + throw new InvalidArgumentException('Non-numeric value passed to decrement method.'); + } + + $wrapped = $this->grammar->wrap($column); + + $columns = array_merge([$column => $this->raw("$wrapped - $amount")], $extra); + + return $this->update($columns); + } + + /** + * Delete a record from the database. + * + * @param mixed $id + * @return int + */ + public function delete($id = null) + { + // If an ID is passed to the method, we will set the where clause to check the + // ID to let developers to simply and quickly remove a single row from this + // database without manually specifying the "where" clauses on the query. + if (! is_null($id)) { + $this->where($this->from.'.id', '=', $id); + } + + return $this->connection->delete( + $this->grammar->compileDelete($this), $this->cleanBindings( + $this->grammar->prepareBindingsForDelete($this->bindings) + ) + ); + } + + /** + * Run a truncate statement on the table. + * + * @return void + */ + public function truncate() + { + foreach ($this->grammar->compileTruncate($this) as $sql => $bindings) { + $this->connection->statement($sql, $bindings); + } + } + + /** + * Get a new instance of the query builder. + * + * @return \Illuminate\Database\Query\Builder + */ + public function newQuery() + { + return new static($this->connection, $this->grammar, $this->processor); + } + + /** + * Create a new query instance for a sub-query. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function forSubQuery() + { + return $this->newQuery(); + } + + /** + * Create a raw database expression. + * + * @param mixed $value + * @return \Illuminate\Database\Query\Expression + */ + public function raw($value) + { + return $this->connection->raw($value); + } + + /** + * Get the current query value bindings in a flattened array. + * + * @return array + */ + public function getBindings() + { + return Arr::flatten($this->bindings); + } + + /** + * Get the raw array of bindings. + * + * @return array + */ + public function getRawBindings() + { + return $this->bindings; + } + + /** + * Set the bindings on the query builder. + * + * @param array $bindings + * @param string $type + * @return $this + * + * @throws \InvalidArgumentException + */ + public function setBindings(array $bindings, $type = 'where') + { + if (! array_key_exists($type, $this->bindings)) { + throw new InvalidArgumentException("Invalid binding type: {$type}."); + } + + $this->bindings[$type] = $bindings; + + return $this; + } + + /** + * Add a binding to the query. + * + * @param mixed $value + * @param string $type + * @return $this + * + * @throws \InvalidArgumentException + */ + public function addBinding($value, $type = 'where') + { + if (! array_key_exists($type, $this->bindings)) { + throw new InvalidArgumentException("Invalid binding type: {$type}."); + } + + if (is_array($value)) { + $this->bindings[$type] = array_values(array_merge($this->bindings[$type], $value)); + } else { + $this->bindings[$type][] = $value; + } + + return $this; + } + + /** + * Merge an array of bindings into our bindings. + * + * @param \Illuminate\Database\Query\Builder $query + * @return $this + */ + public function mergeBindings(self $query) + { + $this->bindings = array_merge_recursive($this->bindings, $query->bindings); + + return $this; + } + + /** + * Remove all of the expressions from a list of bindings. + * + * @param array $bindings + * @return array + */ + protected function cleanBindings(array $bindings) + { + return array_values(array_filter($bindings, function ($binding) { + return ! $binding instanceof Expression; + })); + } + + /** + * Get a scalar type value from an unknown type of input. + * + * @param mixed $value + * @return mixed + */ + protected function flattenValue($value) + { + return is_array($value) ? head(Arr::flatten($value)) : $value; + } + + /** + * Get the default key name of the table. + * + * @return string + */ + protected function defaultKeyName() + { + return 'id'; + } + + /** + * Get the database connection instance. + * + * @return \Illuminate\Database\ConnectionInterface + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Get the database query processor instance. + * + * @return \Illuminate\Database\Query\Processors\Processor + */ + public function getProcessor() + { + return $this->processor; + } + + /** + * Get the query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\Grammar + */ + public function getGrammar() + { + return $this->grammar; + } + + /** + * Use the write pdo for query. + * + * @return $this + */ + public function useWritePdo() + { + $this->useWritePdo = true; + + return $this; + } + + /** + * Determine if the value is a query builder instance or a Closure. + * + * @param mixed $value + * @return bool + */ + protected function isQueryable($value) + { + return $value instanceof self || + $value instanceof EloquentBuilder || + $value instanceof Closure; + } + + /** + * Clone the query without the given properties. + * + * @param array $properties + * @return static + */ + public function cloneWithout(array $properties) + { + return tap(clone $this, function ($clone) use ($properties) { + foreach ($properties as $property) { + $clone->{$property} = null; + } + }); + } + + /** + * Clone the query without the given bindings. + * + * @param array $except + * @return static + */ + public function cloneWithoutBindings(array $except) + { + return tap(clone $this, function ($clone) use ($except) { + foreach ($except as $type) { + $clone->bindings[$type] = []; + } + }); + } + + /** + * Dump the current SQL and bindings. + * + * @return $this + */ + public function dump() + { + dump($this->toSql(), $this->getBindings()); + + return $this; + } + + /** + * Die and dump the current SQL and bindings. + * + * @return void + */ + public function dd() + { + dd($this->toSql(), $this->getBindings()); + } + + /** + * Handle dynamic method calls into the method. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + if (Str::startsWith($method, 'where')) { + return $this->dynamicWhere($method, $parameters); + } + + static::throwBadMethodCallException($method); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Expression.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Expression.php new file mode 100755 index 00000000..de690299 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Expression.php @@ -0,0 +1,44 @@ +value = $value; + } + + /** + * Get the value of the expression. + * + * @return mixed + */ + public function getValue() + { + return $this->value; + } + + /** + * Get the value of the expression. + * + * @return string + */ + public function __toString() + { + return (string) $this->getValue(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php new file mode 100755 index 00000000..a7b930e1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php @@ -0,0 +1,1254 @@ +unions && $query->aggregate) { + return $this->compileUnionAggregate($query); + } + + // If the query does not have any columns set, we'll set the columns to the + // * character to just get all of the columns from the database. Then we + // can build the query and concatenate all the pieces together as one. + $original = $query->columns; + + if (is_null($query->columns)) { + $query->columns = ['*']; + } + + // To compile the query, we'll spin through each component of the query and + // see if that component exists. If it does we'll just call the compiler + // function for the component which is responsible for making the SQL. + $sql = trim($this->concatenate( + $this->compileComponents($query)) + ); + + if ($query->unions) { + $sql = $this->wrapUnion($sql).' '.$this->compileUnions($query); + } + + $query->columns = $original; + + return $sql; + } + + /** + * Compile the components necessary for a select clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + protected function compileComponents(Builder $query) + { + $sql = []; + + foreach ($this->selectComponents as $component) { + // To compile the query, we'll spin through each component of the query and + // see if that component exists. If it does we'll just call the compiler + // function for the component which is responsible for making the SQL. + if (isset($query->$component) && ! is_null($query->$component)) { + $method = 'compile'.ucfirst($component); + + $sql[$component] = $this->$method($query, $query->$component); + } + } + + return $sql; + } + + /** + * Compile an aggregated select clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $aggregate + * @return string + */ + protected function compileAggregate(Builder $query, $aggregate) + { + $column = $this->columnize($aggregate['columns']); + + // If the query has a "distinct" constraint and we're not asking for all columns + // we need to prepend "distinct" onto the column name so that the query takes + // it into account when it performs the aggregating operations on the data. + if (is_array($query->distinct)) { + $column = 'distinct '.$this->columnize($query->distinct); + } elseif ($query->distinct && $column !== '*') { + $column = 'distinct '.$column; + } + + return 'select '.$aggregate['function'].'('.$column.') as aggregate'; + } + + /** + * Compile the "select *" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $columns + * @return string|null + */ + protected function compileColumns(Builder $query, $columns) + { + // If the query is actually performing an aggregating select, we will let that + // compiler handle the building of the select clauses, as it will need some + // more syntax that is best handled by that function to keep things neat. + if (! is_null($query->aggregate)) { + return; + } + + if ($query->distinct) { + $select = 'select distinct '; + } else { + $select = 'select '; + } + + return $select.$this->columnize($columns); + } + + /** + * Compile the "from" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @return string + */ + protected function compileFrom(Builder $query, $table) + { + return 'from '.$this->wrapTable($table); + } + + /** + * Compile the "join" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $joins + * @return string + */ + protected function compileJoins(Builder $query, $joins) + { + return collect($joins)->map(function ($join) use ($query) { + $table = $this->wrapTable($join->table); + + $nestedJoins = is_null($join->joins) ? '' : ' '.$this->compileJoins($query, $join->joins); + + $tableAndNestedJoins = is_null($join->joins) ? $table : '('.$table.$nestedJoins.')'; + + return trim("{$join->type} join {$tableAndNestedJoins} {$this->compileWheres($join)}"); + })->implode(' '); + } + + /** + * Compile the "where" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileWheres(Builder $query) + { + // Each type of where clauses has its own compiler function which is responsible + // for actually creating the where clauses SQL. This helps keep the code nice + // and maintainable since each clause has a very small method that it uses. + if (is_null($query->wheres)) { + return ''; + } + + // If we actually have some where clauses, we will strip off the first boolean + // operator, which is added by the query builders for convenience so we can + // avoid checking for the first clauses in each of the compilers methods. + if (count($sql = $this->compileWheresToArray($query)) > 0) { + return $this->concatenateWhereClauses($query, $sql); + } + + return ''; + } + + /** + * Get an array of all the where clauses for the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + protected function compileWheresToArray($query) + { + return collect($query->wheres)->map(function ($where) use ($query) { + return $where['boolean'].' '.$this->{"where{$where['type']}"}($query, $where); + })->all(); + } + + /** + * Format the where clause statements into one string. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $sql + * @return string + */ + protected function concatenateWhereClauses($query, $sql) + { + $conjunction = $query instanceof JoinClause ? 'on' : 'where'; + + return $conjunction.' '.$this->removeLeadingBoolean(implode(' ', $sql)); + } + + /** + * Compile a raw where clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereRaw(Builder $query, $where) + { + return $where['sql']; + } + + /** + * Compile a basic where clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereBasic(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return $this->wrap($where['column']).' '.$where['operator'].' '.$value; + } + + /** + * Compile a "where in" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereIn(Builder $query, $where) + { + if (! empty($where['values'])) { + return $this->wrap($where['column']).' in ('.$this->parameterize($where['values']).')'; + } + + return '0 = 1'; + } + + /** + * Compile a "where not in" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotIn(Builder $query, $where) + { + if (! empty($where['values'])) { + return $this->wrap($where['column']).' not in ('.$this->parameterize($where['values']).')'; + } + + return '1 = 1'; + } + + /** + * Compile a "where not in raw" clause. + * + * For safety, whereIntegerInRaw ensures this method is only used with integer values. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotInRaw(Builder $query, $where) + { + if (! empty($where['values'])) { + return $this->wrap($where['column']).' not in ('.implode(', ', $where['values']).')'; + } + + return '1 = 1'; + } + + /** + * Compile a "where in raw" clause. + * + * For safety, whereIntegerInRaw ensures this method is only used with integer values. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereInRaw(Builder $query, $where) + { + if (! empty($where['values'])) { + return $this->wrap($where['column']).' in ('.implode(', ', $where['values']).')'; + } + + return '0 = 1'; + } + + /** + * Compile a "where null" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNull(Builder $query, $where) + { + return $this->wrap($where['column']).' is null'; + } + + /** + * Compile a "where not null" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotNull(Builder $query, $where) + { + return $this->wrap($where['column']).' is not null'; + } + + /** + * Compile a "between" where clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereBetween(Builder $query, $where) + { + $between = $where['not'] ? 'not between' : 'between'; + + $min = $this->parameter(reset($where['values'])); + + $max = $this->parameter(end($where['values'])); + + return $this->wrap($where['column']).' '.$between.' '.$min.' and '.$max; + } + + /** + * Compile a "where date" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDate(Builder $query, $where) + { + return $this->dateBasedWhere('date', $query, $where); + } + + /** + * Compile a "where time" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereTime(Builder $query, $where) + { + return $this->dateBasedWhere('time', $query, $where); + } + + /** + * Compile a "where day" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDay(Builder $query, $where) + { + return $this->dateBasedWhere('day', $query, $where); + } + + /** + * Compile a "where month" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereMonth(Builder $query, $where) + { + return $this->dateBasedWhere('month', $query, $where); + } + + /** + * Compile a "where year" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereYear(Builder $query, $where) + { + return $this->dateBasedWhere('year', $query, $where); + } + + /** + * Compile a date based where clause. + * + * @param string $type + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function dateBasedWhere($type, Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return $type.'('.$this->wrap($where['column']).') '.$where['operator'].' '.$value; + } + + /** + * Compile a where clause comparing two columns.. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereColumn(Builder $query, $where) + { + return $this->wrap($where['first']).' '.$where['operator'].' '.$this->wrap($where['second']); + } + + /** + * Compile a nested where clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNested(Builder $query, $where) + { + // Here we will calculate what portion of the string we need to remove. If this + // is a join clause query, we need to remove the "on" portion of the SQL and + // if it is a normal query we need to take the leading "where" of queries. + $offset = $query instanceof JoinClause ? 3 : 6; + + return '('.substr($this->compileWheres($where['query']), $offset).')'; + } + + /** + * Compile a where condition with a sub-select. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereSub(Builder $query, $where) + { + $select = $this->compileSelect($where['query']); + + return $this->wrap($where['column']).' '.$where['operator']." ($select)"; + } + + /** + * Compile a where exists clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereExists(Builder $query, $where) + { + return 'exists ('.$this->compileSelect($where['query']).')'; + } + + /** + * Compile a where exists clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotExists(Builder $query, $where) + { + return 'not exists ('.$this->compileSelect($where['query']).')'; + } + + /** + * Compile a where row values condition. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereRowValues(Builder $query, $where) + { + $columns = $this->columnize($where['columns']); + + $values = $this->parameterize($where['values']); + + return '('.$columns.') '.$where['operator'].' ('.$values.')'; + } + + /** + * Compile a "where JSON boolean" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereJsonBoolean(Builder $query, $where) + { + $column = $this->wrapJsonBooleanSelector($where['column']); + + $value = $this->wrapJsonBooleanValue( + $this->parameter($where['value']) + ); + + return $column.' '.$where['operator'].' '.$value; + } + + /** + * Compile a "where JSON contains" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereJsonContains(Builder $query, $where) + { + $not = $where['not'] ? 'not ' : ''; + + return $not.$this->compileJsonContains( + $where['column'], $this->parameter($where['value']) + ); + } + + /** + * Compile a "JSON contains" statement into SQL. + * + * @param string $column + * @param string $value + * @return string + * + * @throws \RuntimeException + */ + protected function compileJsonContains($column, $value) + { + throw new RuntimeException('This database engine does not support JSON contains operations.'); + } + + /** + * Prepare the binding for a "JSON contains" statement. + * + * @param mixed $binding + * @return string + */ + public function prepareBindingForJsonContains($binding) + { + return json_encode($binding); + } + + /** + * Compile a "where JSON length" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereJsonLength(Builder $query, $where) + { + return $this->compileJsonLength( + $where['column'], $where['operator'], $this->parameter($where['value']) + ); + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + * + * @throws \RuntimeException + */ + protected function compileJsonLength($column, $operator, $value) + { + throw new RuntimeException('This database engine does not support JSON length operations.'); + } + + /** + * Compile the "group by" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $groups + * @return string + */ + protected function compileGroups(Builder $query, $groups) + { + return 'group by '.$this->columnize($groups); + } + + /** + * Compile the "having" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $havings + * @return string + */ + protected function compileHavings(Builder $query, $havings) + { + $sql = implode(' ', array_map([$this, 'compileHaving'], $havings)); + + return 'having '.$this->removeLeadingBoolean($sql); + } + + /** + * Compile a single having clause. + * + * @param array $having + * @return string + */ + protected function compileHaving(array $having) + { + // If the having clause is "raw", we can just return the clause straight away + // without doing any more processing on it. Otherwise, we will compile the + // clause into SQL based on the components that make it up from builder. + if ($having['type'] === 'Raw') { + return $having['boolean'].' '.$having['sql']; + } elseif ($having['type'] === 'between') { + return $this->compileHavingBetween($having); + } + + return $this->compileBasicHaving($having); + } + + /** + * Compile a basic having clause. + * + * @param array $having + * @return string + */ + protected function compileBasicHaving($having) + { + $column = $this->wrap($having['column']); + + $parameter = $this->parameter($having['value']); + + return $having['boolean'].' '.$column.' '.$having['operator'].' '.$parameter; + } + + /** + * Compile a "between" having clause. + * + * @param array $having + * @return string + */ + protected function compileHavingBetween($having) + { + $between = $having['not'] ? 'not between' : 'between'; + + $column = $this->wrap($having['column']); + + $min = $this->parameter(head($having['values'])); + + $max = $this->parameter(last($having['values'])); + + return $having['boolean'].' '.$column.' '.$between.' '.$min.' and '.$max; + } + + /** + * Compile the "order by" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $orders + * @return string + */ + protected function compileOrders(Builder $query, $orders) + { + if (! empty($orders)) { + return 'order by '.implode(', ', $this->compileOrdersToArray($query, $orders)); + } + + return ''; + } + + /** + * Compile the query orders to an array. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $orders + * @return array + */ + protected function compileOrdersToArray(Builder $query, $orders) + { + return array_map(function ($order) { + return $order['sql'] ?? $this->wrap($order['column']).' '.$order['direction']; + }, $orders); + } + + /** + * Compile the random statement into SQL. + * + * @param string $seed + * @return string + */ + public function compileRandom($seed) + { + return 'RANDOM()'; + } + + /** + * Compile the "limit" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $limit + * @return string + */ + protected function compileLimit(Builder $query, $limit) + { + return 'limit '.(int) $limit; + } + + /** + * Compile the "offset" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $offset + * @return string + */ + protected function compileOffset(Builder $query, $offset) + { + return 'offset '.(int) $offset; + } + + /** + * Compile the "union" queries attached to the main query. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileUnions(Builder $query) + { + $sql = ''; + + foreach ($query->unions as $union) { + $sql .= $this->compileUnion($union); + } + + if (! empty($query->unionOrders)) { + $sql .= ' '.$this->compileOrders($query, $query->unionOrders); + } + + if (isset($query->unionLimit)) { + $sql .= ' '.$this->compileLimit($query, $query->unionLimit); + } + + if (isset($query->unionOffset)) { + $sql .= ' '.$this->compileOffset($query, $query->unionOffset); + } + + return ltrim($sql); + } + + /** + * Compile a single union statement. + * + * @param array $union + * @return string + */ + protected function compileUnion(array $union) + { + $conjunction = $union['all'] ? ' union all ' : ' union '; + + return $conjunction.$this->wrapUnion($union['query']->toSql()); + } + + /** + * Wrap a union subquery in parentheses. + * + * @param string $sql + * @return string + */ + protected function wrapUnion($sql) + { + return '('.$sql.')'; + } + + /** + * Compile a union aggregate query into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileUnionAggregate(Builder $query) + { + $sql = $this->compileAggregate($query, $query->aggregate); + + $query->aggregate = null; + + return $sql.' from ('.$this->compileSelect($query).') as '.$this->wrapTable('temp_table'); + } + + /** + * Compile an exists statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileExists(Builder $query) + { + $select = $this->compileSelect($query); + + return "select exists({$select}) as {$this->wrap('exists')}"; + } + + /** + * Compile an insert statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileInsert(Builder $query, array $values) + { + // Essentially we will force every insert to be treated as a batch insert which + // simply makes creating the SQL easier for us since we can utilize the same + // basic routine regardless of an amount of records given to us to insert. + $table = $this->wrapTable($query->from); + + if (empty($values)) { + return "insert into {$table} default values"; + } + + if (! is_array(reset($values))) { + $values = [$values]; + } + + $columns = $this->columnize(array_keys(reset($values))); + + // We need to build a list of parameter place-holders of values that are bound + // to the query. Each insert should have the exact same amount of parameter + // bindings so we will loop through the record and parameterize them all. + $parameters = collect($values)->map(function ($record) { + return '('.$this->parameterize($record).')'; + })->implode(', '); + + return "insert into $table ($columns) values $parameters"; + } + + /** + * Compile an insert ignore statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + * + * @throws \RuntimeException + */ + public function compileInsertOrIgnore(Builder $query, array $values) + { + throw new RuntimeException('This database engine does not support inserting while ignoring errors.'); + } + + /** + * Compile an insert and get ID statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @param string $sequence + * @return string + */ + public function compileInsertGetId(Builder $query, $values, $sequence) + { + return $this->compileInsert($query, $values); + } + + /** + * Compile an insert statement using a subquery into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $columns + * @param string $sql + * @return string + */ + public function compileInsertUsing(Builder $query, array $columns, string $sql) + { + return "insert into {$this->wrapTable($query->from)} ({$this->columnize($columns)}) $sql"; + } + + /** + * Compile an update statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileUpdate(Builder $query, array $values) + { + $table = $this->wrapTable($query->from); + + $columns = $this->compileUpdateColumns($query, $values); + + $where = $this->compileWheres($query); + + return trim( + isset($query->joins) + ? $this->compileUpdateWithJoins($query, $table, $columns, $where) + : $this->compileUpdateWithoutJoins($query, $table, $columns, $where) + ); + } + + /** + * Compile the columns for an update statement. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + protected function compileUpdateColumns(Builder $query, array $values) + { + return collect($values)->map(function ($value, $key) { + return $this->wrap($key).' = '.$this->parameter($value); + })->implode(', '); + } + + /** + * Compile an update statement without joins into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $columns + * @param string $where + * @return string + */ + protected function compileUpdateWithoutJoins(Builder $query, $table, $columns, $where) + { + return "update {$table} set {$columns} {$where}"; + } + + /** + * Compile an update statement with joins into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $columns + * @param string $where + * @return string + */ + protected function compileUpdateWithJoins(Builder $query, $table, $columns, $where) + { + $joins = $this->compileJoins($query, $query->joins); + + return "update {$table} {$joins} set {$columns} {$where}"; + } + + /** + * Prepare the bindings for an update statement. + * + * @param array $bindings + * @param array $values + * @return array + */ + public function prepareBindingsForUpdate(array $bindings, array $values) + { + $cleanBindings = Arr::except($bindings, ['select', 'join']); + + return array_values( + array_merge($bindings['join'], $values, Arr::flatten($cleanBindings)) + ); + } + + /** + * Compile a delete statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileDelete(Builder $query) + { + $table = $this->wrapTable($query->from); + + $where = $this->compileWheres($query); + + return trim( + isset($query->joins) + ? $this->compileDeleteWithJoins($query, $table, $where) + : $this->compileDeleteWithoutJoins($query, $table, $where) + ); + } + + /** + * Compile a delete statement without joins into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $where + * @return string + */ + protected function compileDeleteWithoutJoins(Builder $query, $table, $where) + { + return "delete from {$table} {$where}"; + } + + /** + * Compile a delete statement with joins into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $where + * @return string + */ + protected function compileDeleteWithJoins(Builder $query, $table, $where) + { + $alias = last(explode(' as ', $table)); + + $joins = $this->compileJoins($query, $query->joins); + + return "delete {$alias} from {$table} {$joins} {$where}"; + } + + /** + * Prepare the bindings for a delete statement. + * + * @param array $bindings + * @return array + */ + public function prepareBindingsForDelete(array $bindings) + { + return Arr::flatten( + Arr::except($bindings, 'select') + ); + } + + /** + * Compile a truncate table statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + public function compileTruncate(Builder $query) + { + return ['truncate table '.$this->wrapTable($query->from) => []]; + } + + /** + * Compile the lock into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value + * @return string + */ + protected function compileLock(Builder $query, $value) + { + return is_string($value) ? $value : ''; + } + + /** + * Determine if the grammar supports savepoints. + * + * @return bool + */ + public function supportsSavepoints() + { + return true; + } + + /** + * Compile the SQL statement to define a savepoint. + * + * @param string $name + * @return string + */ + public function compileSavepoint($name) + { + return 'SAVEPOINT '.$name; + } + + /** + * Compile the SQL statement to execute a savepoint rollback. + * + * @param string $name + * @return string + */ + public function compileSavepointRollBack($name) + { + return 'ROLLBACK TO SAVEPOINT '.$name; + } + + /** + * Wrap a value in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $value + * @param bool $prefixAlias + * @return string + */ + public function wrap($value, $prefixAlias = false) + { + if ($this->isExpression($value)) { + return $this->getValue($value); + } + + // If the value being wrapped has a column alias we will need to separate out + // the pieces so we can wrap each of the segments of the expression on its + // own, and then join these both back together using the "as" connector. + if (stripos($value, ' as ') !== false) { + return $this->wrapAliasedValue($value, $prefixAlias); + } + + // If the given value is a JSON selector we will wrap it differently than a + // traditional value. We will need to split this path and wrap each part + // wrapped, etc. Otherwise, we will simply wrap the value as a string. + if ($this->isJsonSelector($value)) { + return $this->wrapJsonSelector($value); + } + + return $this->wrapSegments(explode('.', $value)); + } + + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + * + * @throws \RuntimeException + */ + protected function wrapJsonSelector($value) + { + throw new RuntimeException('This database engine does not support JSON operations.'); + } + + /** + * Wrap the given JSON selector for boolean values. + * + * @param string $value + * @return string + */ + protected function wrapJsonBooleanSelector($value) + { + return $this->wrapJsonSelector($value); + } + + /** + * Wrap the given JSON boolean value. + * + * @param string $value + * @return string + */ + protected function wrapJsonBooleanValue($value) + { + return $value; + } + + /** + * Split the given JSON selector into the field and the optional path and wrap them separately. + * + * @param string $column + * @return array + */ + protected function wrapJsonFieldAndPath($column) + { + $parts = explode('->', $column, 2); + + $field = $this->wrap($parts[0]); + + $path = count($parts) > 1 ? ', '.$this->wrapJsonPath($parts[1], '->') : ''; + + return [$field, $path]; + } + + /** + * Wrap the given JSON path. + * + * @param string $value + * @param string $delimiter + * @return string + */ + protected function wrapJsonPath($value, $delimiter = '->') + { + $value = preg_replace("/([\\\\]+)?\\'/", "''", $value); + + return '\'$."'.str_replace($delimiter, '"."', $value).'"\''; + } + + /** + * Determine if the given string is a JSON selector. + * + * @param string $value + * @return bool + */ + protected function isJsonSelector($value) + { + return Str::contains($value, '->'); + } + + /** + * Concatenate an array of segments, removing empties. + * + * @param array $segments + * @return string + */ + protected function concatenate($segments) + { + return implode(' ', array_filter($segments, function ($value) { + return (string) $value !== ''; + })); + } + + /** + * Remove the leading boolean from a statement. + * + * @param string $value + * @return string + */ + protected function removeLeadingBoolean($value) + { + return preg_replace('/and |or /i', '', $value, 1); + } + + /** + * Get the grammar specific operators. + * + * @return array + */ + public function getOperators() + { + return $this->operators; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php new file mode 100755 index 00000000..c26ad195 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php @@ -0,0 +1,247 @@ +compileInsert($query, $values)); + } + + /** + * Compile a "JSON contains" statement into SQL. + * + * @param string $column + * @param string $value + * @return string + */ + protected function compileJsonContains($column, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); + + return 'json_contains('.$field.', '.$value.$path.')'; + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + */ + protected function compileJsonLength($column, $operator, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); + + return 'json_length('.$field.$path.') '.$operator.' '.$value; + } + + /** + * Compile the random statement into SQL. + * + * @param string $seed + * @return string + */ + public function compileRandom($seed) + { + return 'RAND('.$seed.')'; + } + + /** + * Compile the lock into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value + * @return string + */ + protected function compileLock(Builder $query, $value) + { + if (! is_string($value)) { + return $value ? 'for update' : 'lock in share mode'; + } + + return $value; + } + + /** + * Compile an insert statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileInsert(Builder $query, array $values) + { + if (empty($values)) { + $values = [[]]; + } + + return parent::compileInsert($query, $values); + } + + /** + * Compile the columns for an update statement. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + protected function compileUpdateColumns(Builder $query, array $values) + { + return collect($values)->map(function ($value, $key) { + if ($this->isJsonSelector($key)) { + return $this->compileJsonUpdateColumn($key, $value); + } + + return $this->wrap($key).' = '.$this->parameter($value); + })->implode(', '); + } + + /** + * Prepare a JSON column being updated using the JSON_SET function. + * + * @param string $key + * @param mixed $value + * @return string + */ + protected function compileJsonUpdateColumn($key, $value) + { + if (is_bool($value)) { + $value = $value ? 'true' : 'false'; + } elseif (is_array($value)) { + $value = 'cast(? as json)'; + } else { + $value = $this->parameter($value); + } + + [$field, $path] = $this->wrapJsonFieldAndPath($key); + + return "{$field} = json_set({$field}{$path}, {$value})"; + } + + /** + * Compile an update statement without joins into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $columns + * @param string $where + * @return string + */ + protected function compileUpdateWithoutJoins(Builder $query, $table, $columns, $where) + { + $sql = parent::compileUpdateWithoutJoins($query, $table, $columns, $where); + + if (! empty($query->orders)) { + $sql .= ' '.$this->compileOrders($query, $query->orders); + } + + if (isset($query->limit)) { + $sql .= ' '.$this->compileLimit($query, $query->limit); + } + + return $sql; + } + + /** + * Prepare the bindings for an update statement. + * + * Booleans, integers, and doubles are inserted into JSON updates as raw values. + * + * @param array $bindings + * @param array $values + * @return array + */ + public function prepareBindingsForUpdate(array $bindings, array $values) + { + $values = collect($values)->reject(function ($value, $column) { + return $this->isJsonSelector($column) && is_bool($value); + })->map(function ($value) { + return is_array($value) ? json_encode($value) : $value; + })->all(); + + return parent::prepareBindingsForUpdate($bindings, $values); + } + + /** + * Compile a delete query that does not use joins. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $where + * @return string + */ + protected function compileDeleteWithoutJoins(Builder $query, $table, $where) + { + $sql = parent::compileDeleteWithoutJoins($query, $table, $where); + + // When using MySQL, delete statements may contain order by statements and limits + // so we will compile both of those here. Once we have finished compiling this + // we will return the completed SQL statement so it will be executed for us. + if (! empty($query->orders)) { + $sql .= ' '.$this->compileOrders($query, $query->orders); + } + + if (isset($query->limit)) { + $sql .= ' '.$this->compileLimit($query, $query->limit); + } + + return $sql; + } + + /** + * Wrap a single string in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrapValue($value) + { + return $value === '*' ? $value : '`'.str_replace('`', '``', $value).'`'; + } + + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + */ + protected function wrapJsonSelector($value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($value); + + return 'json_unquote(json_extract('.$field.$path.'))'; + } + + /** + * Wrap the given JSON selector for boolean values. + * + * @param string $value + * @return string + */ + protected function wrapJsonBooleanSelector($value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($value); + + return 'json_extract('.$field.$path.')'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php new file mode 100755 index 00000000..46420bb6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php @@ -0,0 +1,388 @@ +', '<=', '>=', '<>', '!=', + 'like', 'not like', 'between', 'ilike', 'not ilike', + '~', '&', '|', '#', '<<', '>>', '<<=', '>>=', + '&&', '@>', '<@', '?', '?|', '?&', '||', '-', '-', '#-', + 'is distinct from', 'is not distinct from', + ]; + + /** + * {@inheritdoc} + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereBasic(Builder $query, $where) + { + if (Str::contains(strtolower($where['operator']), 'like')) { + return sprintf( + '%s::text %s %s', + $this->wrap($where['column']), + $where['operator'], + $this->parameter($where['value']) + ); + } + + return parent::whereBasic($query, $where); + } + + /** + * Compile a "where date" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDate(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return $this->wrap($where['column']).'::date '.$where['operator'].' '.$value; + } + + /** + * Compile a "where time" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereTime(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return $this->wrap($where['column']).'::time '.$where['operator'].' '.$value; + } + + /** + * Compile a date based where clause. + * + * @param string $type + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function dateBasedWhere($type, Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return 'extract('.$type.' from '.$this->wrap($where['column']).') '.$where['operator'].' '.$value; + } + + /** + * Compile the "select *" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $columns + * @return string|null + */ + protected function compileColumns(Builder $query, $columns) + { + // If the query is actually performing an aggregating select, we will let that + // compiler handle the building of the select clauses, as it will need some + // more syntax that is best handled by that function to keep things neat. + if (! is_null($query->aggregate)) { + return; + } + + if (is_array($query->distinct)) { + $select = 'select distinct on ('.$this->columnize($query->distinct).') '; + } elseif ($query->distinct) { + $select = 'select distinct '; + } else { + $select = 'select '; + } + + return $select.$this->columnize($columns); + } + + /** + * Compile a "JSON contains" statement into SQL. + * + * @param string $column + * @param string $value + * @return string + */ + protected function compileJsonContains($column, $value) + { + $column = str_replace('->>', '->', $this->wrap($column)); + + return '('.$column.')::jsonb @> '.$value; + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + */ + protected function compileJsonLength($column, $operator, $value) + { + $column = str_replace('->>', '->', $this->wrap($column)); + + return 'json_array_length(('.$column.')::json) '.$operator.' '.$value; + } + + /** + * Compile the lock into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value + * @return string + */ + protected function compileLock(Builder $query, $value) + { + if (! is_string($value)) { + return $value ? 'for update' : 'for share'; + } + + return $value; + } + + /** + * Compile an insert ignore statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileInsertOrIgnore(Builder $query, array $values) + { + return $this->compileInsert($query, $values).' on conflict do nothing'; + } + + /** + * Compile an insert and get ID statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @param string $sequence + * @return string + */ + public function compileInsertGetId(Builder $query, $values, $sequence) + { + return $this->compileInsert($query, $values).' returning '.$this->wrap($sequence ?: 'id'); + } + + /** + * Compile an update statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileUpdate(Builder $query, array $values) + { + if (isset($query->joins) || isset($query->limit)) { + return $this->compileUpdateWithJoinsOrLimit($query, $values); + } + + return parent::compileUpdate($query, $values); + } + + /** + * Compile the columns for an update statement. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + protected function compileUpdateColumns(Builder $query, array $values) + { + return collect($values)->map(function ($value, $key) { + $column = last(explode('.', $key)); + + if ($this->isJsonSelector($key)) { + return $this->compileJsonUpdateColumn($column, $value); + } + + return $this->wrap($column).' = '.$this->parameter($value); + })->implode(', '); + } + + /** + * Prepares a JSON column being updated using the JSONB_SET function. + * + * @param string $key + * @param mixed $value + * @return string + */ + protected function compileJsonUpdateColumn($key, $value) + { + $segments = explode('->', $key); + + $field = $this->wrap(array_shift($segments)); + + $path = '\'{"'.implode('","', $segments).'"}\''; + + return "{$field} = jsonb_set({$field}::jsonb, {$path}, {$this->parameter($value)})"; + } + + /** + * Compile an update statement with joins or limit into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + protected function compileUpdateWithJoinsOrLimit(Builder $query, array $values) + { + $table = $this->wrapTable($query->from); + + $columns = $this->compileUpdateColumns($query, $values); + + $alias = last(preg_split('/\s+as\s+/i', $query->from)); + + $selectSql = $this->compileSelect($query->select($alias.'.ctid')); + + return "update {$table} set {$columns} where {$this->wrap('ctid')} in ({$selectSql})"; + } + + /** + * Prepare the bindings for an update statement. + * + * @param array $bindings + * @param array $values + * @return array + */ + public function prepareBindingsForUpdate(array $bindings, array $values) + { + $values = collect($values)->map(function ($value, $column) { + return is_array($value) || ($this->isJsonSelector($column) && ! $this->isExpression($value)) + ? json_encode($value) + : $value; + })->all(); + + $cleanBindings = Arr::except($bindings, 'select'); + + return array_values( + array_merge($values, Arr::flatten($cleanBindings)) + ); + } + + /** + * Compile a delete statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileDelete(Builder $query) + { + if (isset($query->joins) || isset($query->limit)) { + return $this->compileDeleteWithJoinsOrLimit($query); + } + + return parent::compileDelete($query); + } + + /** + * Compile a delete statement with joins or limit into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileDeleteWithJoinsOrLimit(Builder $query) + { + $table = $this->wrapTable($query->from); + + $alias = last(preg_split('/\s+as\s+/i', $query->from)); + + $selectSql = $this->compileSelect($query->select($alias.'.ctid')); + + return "delete from {$table} where {$this->wrap('ctid')} in ({$selectSql})"; + } + + /** + * Compile a truncate table statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + public function compileTruncate(Builder $query) + { + return ['truncate '.$this->wrapTable($query->from).' restart identity cascade' => []]; + } + + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + */ + protected function wrapJsonSelector($value) + { + $path = explode('->', $value); + + $field = $this->wrapSegments(explode('.', array_shift($path))); + + $wrappedPath = $this->wrapJsonPathAttributes($path); + + $attribute = array_pop($wrappedPath); + + if (! empty($wrappedPath)) { + return $field.'->'.implode('->', $wrappedPath).'->>'.$attribute; + } + + return $field.'->>'.$attribute; + } + + /** + *Wrap the given JSON selector for boolean values. + * + * @param string $value + * @return string + */ + protected function wrapJsonBooleanSelector($value) + { + $selector = str_replace( + '->>', '->', + $this->wrapJsonSelector($value) + ); + + return '('.$selector.')::jsonb'; + } + + /** + * Wrap the given JSON boolean value. + * + * @param string $value + * @return string + */ + protected function wrapJsonBooleanValue($value) + { + return "'".$value."'::jsonb"; + } + + /** + * Wrap the attributes of the give JSON path. + * + * @param array $path + * @return array + */ + protected function wrapJsonPathAttributes($path) + { + return array_map(function ($attribute) { + return filter_var($attribute, FILTER_VALIDATE_INT) !== false + ? $attribute + : "'$attribute'"; + }, $path); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php new file mode 100755 index 00000000..2c27ddf3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php @@ -0,0 +1,318 @@ +', '<=', '>=', '<>', '!=', + 'like', 'not like', 'ilike', + '&', '|', '<<', '>>', + ]; + + /** + * Compile the lock into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value + * @return string + */ + protected function compileLock(Builder $query, $value) + { + return ''; + } + + /** + * Wrap a union subquery in parentheses. + * + * @param string $sql + * @return string + */ + protected function wrapUnion($sql) + { + return 'select * from ('.$sql.')'; + } + + /** + * Compile a "where date" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDate(Builder $query, $where) + { + return $this->dateBasedWhere('%Y-%m-%d', $query, $where); + } + + /** + * Compile a "where day" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDay(Builder $query, $where) + { + return $this->dateBasedWhere('%d', $query, $where); + } + + /** + * Compile a "where month" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereMonth(Builder $query, $where) + { + return $this->dateBasedWhere('%m', $query, $where); + } + + /** + * Compile a "where year" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereYear(Builder $query, $where) + { + return $this->dateBasedWhere('%Y', $query, $where); + } + + /** + * Compile a "where time" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereTime(Builder $query, $where) + { + return $this->dateBasedWhere('%H:%M:%S', $query, $where); + } + + /** + * Compile a date based where clause. + * + * @param string $type + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function dateBasedWhere($type, Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return "strftime('{$type}', {$this->wrap($where['column'])}) {$where['operator']} cast({$value} as text)"; + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + */ + protected function compileJsonLength($column, $operator, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); + + return 'json_array_length('.$field.$path.') '.$operator.' '.$value; + } + + /** + * Compile an update statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileUpdate(Builder $query, array $values) + { + if (isset($query->joins) || isset($query->limit)) { + return $this->compileUpdateWithJoinsOrLimit($query, $values); + } + + return parent::compileUpdate($query, $values); + } + + /** + * Compile an insert ignore statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileInsertOrIgnore(Builder $query, array $values) + { + return Str::replaceFirst('insert', 'insert or ignore', $this->compileInsert($query, $values)); + } + + /** + * Compile the columns for an update statement. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + protected function compileUpdateColumns(Builder $query, array $values) + { + $jsonGroups = $this->groupJsonColumnsForUpdate($values); + + return collect($values)->reject(function ($value, $key) { + return $this->isJsonSelector($key); + })->merge($jsonGroups)->map(function ($value, $key) use ($jsonGroups) { + $column = last(explode('.', $key)); + + $value = isset($jsonGroups[$key]) ? $this->compileJsonPatch($column, $value) : $this->parameter($value); + + return $this->wrap($column).' = '.$value; + })->implode(', '); + } + + /** + * Group the nested JSON columns. + * + * @param array $values + * @return array + */ + protected function groupJsonColumnsForUpdate(array $values) + { + $groups = []; + + foreach ($values as $key => $value) { + if ($this->isJsonSelector($key)) { + Arr::set($groups, str_replace('->', '.', Str::after($key, '.')), $value); + } + } + + return $groups; + } + + /** + * Compile a "JSON" patch statement into SQL. + * + * @param string $column + * @param mixed $value + * @return string + */ + protected function compileJsonPatch($column, $value) + { + return "json_patch(ifnull({$this->wrap($column)}, json('{}')), json({$this->parameter($value)}))"; + } + + /** + * Compile an update statement with joins or limit into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + protected function compileUpdateWithJoinsOrLimit(Builder $query, array $values) + { + $table = $this->wrapTable($query->from); + + $columns = $this->compileUpdateColumns($query, $values); + + $alias = last(preg_split('/\s+as\s+/i', $query->from)); + + $selectSql = $this->compileSelect($query->select($alias.'.rowid')); + + return "update {$table} set {$columns} where {$this->wrap('rowid')} in ({$selectSql})"; + } + + /** + * Prepare the bindings for an update statement. + * + * @param array $bindings + * @param array $values + * @return array + */ + public function prepareBindingsForUpdate(array $bindings, array $values) + { + $groups = $this->groupJsonColumnsForUpdate($values); + + $values = collect($values)->reject(function ($value, $key) { + return $this->isJsonSelector($key); + })->merge($groups)->map(function ($value) { + return is_array($value) ? json_encode($value) : $value; + })->all(); + + $cleanBindings = Arr::except($bindings, 'select'); + + return array_values( + array_merge($values, Arr::flatten($cleanBindings)) + ); + } + + /** + * Compile a delete statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileDelete(Builder $query) + { + if (isset($query->joins) || isset($query->limit)) { + return $this->compileDeleteWithJoinsOrLimit($query); + } + + return parent::compileDelete($query); + } + + /** + * Compile a delete statement with joins or limit into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileDeleteWithJoinsOrLimit(Builder $query) + { + $table = $this->wrapTable($query->from); + + $alias = last(preg_split('/\s+as\s+/i', $query->from)); + + $selectSql = $this->compileSelect($query->select($alias.'.rowid')); + + return "delete from {$table} where {$this->wrap('rowid')} in ({$selectSql})"; + } + + /** + * Compile a truncate table statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + public function compileTruncate(Builder $query) + { + return [ + 'delete from sqlite_sequence where name = ?' => [$query->from], + 'delete from '.$this->wrapTable($query->from) => [], + ]; + } + + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + */ + protected function wrapJsonSelector($value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($value); + + return 'json_extract('.$field.$path.')'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php new file mode 100755 index 00000000..88a7df3d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php @@ -0,0 +1,438 @@ +', '<=', '>=', '!<', '!>', '<>', '!=', + 'like', 'not like', 'ilike', + '&', '&=', '|', '|=', '^', '^=', + ]; + + /** + * Compile a select query into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileSelect(Builder $query) + { + if (! $query->offset) { + return parent::compileSelect($query); + } + + // If an offset is present on the query, we will need to wrap the query in + // a big "ANSI" offset syntax block. This is very nasty compared to the + // other database systems but is necessary for implementing features. + if (is_null($query->columns)) { + $query->columns = ['*']; + } + + return $this->compileAnsiOffset( + $query, $this->compileComponents($query) + ); + } + + /** + * Compile the "select *" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $columns + * @return string|null + */ + protected function compileColumns(Builder $query, $columns) + { + if (! is_null($query->aggregate)) { + return; + } + + $select = $query->distinct ? 'select distinct ' : 'select '; + + // If there is a limit on the query, but not an offset, we will add the top + // clause to the query, which serves as a "limit" type clause within the + // SQL Server system similar to the limit keywords available in MySQL. + if (is_numeric($query->limit) && $query->limit > 0 && $query->offset <= 0) { + $select .= 'top '.((int) $query->limit).' '; + } + + return $select.$this->columnize($columns); + } + + /** + * Compile the "from" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @return string + */ + protected function compileFrom(Builder $query, $table) + { + $from = parent::compileFrom($query, $table); + + if (is_string($query->lock)) { + return $from.' '.$query->lock; + } + + if (! is_null($query->lock)) { + return $from.' with(rowlock,'.($query->lock ? 'updlock,' : '').'holdlock)'; + } + + return $from; + } + + /** + * Compile a "where date" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDate(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return 'cast('.$this->wrap($where['column']).' as date) '.$where['operator'].' '.$value; + } + + /** + * Compile a "where time" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereTime(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return 'cast('.$this->wrap($where['column']).' as time) '.$where['operator'].' '.$value; + } + + /** + * Compile a "JSON contains" statement into SQL. + * + * @param string $column + * @param string $value + * @return string + */ + protected function compileJsonContains($column, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); + + return $value.' in (select [value] from openjson('.$field.$path.'))'; + } + + /** + * Prepare the binding for a "JSON contains" statement. + * + * @param mixed $binding + * @return string + */ + public function prepareBindingForJsonContains($binding) + { + return is_bool($binding) ? json_encode($binding) : $binding; + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + */ + protected function compileJsonLength($column, $operator, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); + + return '(select count(*) from openjson('.$field.$path.')) '.$operator.' '.$value; + } + + /** + * Create a full ANSI offset clause for the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $components + * @return string + */ + protected function compileAnsiOffset(Builder $query, $components) + { + // An ORDER BY clause is required to make this offset query work, so if one does + // not exist we'll just create a dummy clause to trick the database and so it + // does not complain about the queries for not having an "order by" clause. + if (empty($components['orders'])) { + $components['orders'] = 'order by (select 0)'; + } + + // We need to add the row number to the query so we can compare it to the offset + // and limit values given for the statements. So we will add an expression to + // the "select" that will give back the row numbers on each of the records. + $components['columns'] .= $this->compileOver($components['orders']); + + unset($components['orders']); + + // Next we need to calculate the constraints that should be placed on the query + // to get the right offset and limit from our query but if there is no limit + // set we will just handle the offset only since that is all that matters. + $sql = $this->concatenate($components); + + return $this->compileTableExpression($sql, $query); + } + + /** + * Compile the over statement for a table expression. + * + * @param string $orderings + * @return string + */ + protected function compileOver($orderings) + { + return ", row_number() over ({$orderings}) as row_num"; + } + + /** + * Compile a common table expression for a query. + * + * @param string $sql + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileTableExpression($sql, $query) + { + $constraint = $this->compileRowConstraint($query); + + return "select * from ({$sql}) as temp_table where row_num {$constraint} order by row_num"; + } + + /** + * Compile the limit / offset row constraint for a query. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileRowConstraint($query) + { + $start = (int) $query->offset + 1; + + if ($query->limit > 0) { + $finish = (int) $query->offset + (int) $query->limit; + + return "between {$start} and {$finish}"; + } + + return ">= {$start}"; + } + + /** + * Compile the random statement into SQL. + * + * @param string $seed + * @return string + */ + public function compileRandom($seed) + { + return 'NEWID()'; + } + + /** + * Compile the "limit" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $limit + * @return string + */ + protected function compileLimit(Builder $query, $limit) + { + return ''; + } + + /** + * Compile the "offset" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $offset + * @return string + */ + protected function compileOffset(Builder $query, $offset) + { + return ''; + } + + /** + * Compile the lock into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value + * @return string + */ + protected function compileLock(Builder $query, $value) + { + return ''; + } + + /** + * Wrap a union subquery in parentheses. + * + * @param string $sql + * @return string + */ + protected function wrapUnion($sql) + { + return 'select * from ('.$sql.') as '.$this->wrapTable('temp_table'); + } + + /** + * Compile an exists statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileExists(Builder $query) + { + $existsQuery = clone $query; + + $existsQuery->columns = []; + + return $this->compileSelect($existsQuery->selectRaw('1 [exists]')->limit(1)); + } + + /** + * Compile an update statement with joins into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $columns + * @param string $where + * @return string + */ + protected function compileUpdateWithJoins(Builder $query, $table, $columns, $where) + { + $alias = last(explode(' as ', $table)); + + $joins = $this->compileJoins($query, $query->joins); + + return "update {$alias} set {$columns} from {$table} {$joins} {$where}"; + } + + /** + * Prepare the bindings for an update statement. + * + * @param array $bindings + * @param array $values + * @return array + */ + public function prepareBindingsForUpdate(array $bindings, array $values) + { + $cleanBindings = Arr::except($bindings, 'select'); + + return array_values( + array_merge($values, Arr::flatten($cleanBindings)) + ); + } + + /** + * Compile the SQL statement to define a savepoint. + * + * @param string $name + * @return string + */ + public function compileSavepoint($name) + { + return 'SAVE TRANSACTION '.$name; + } + + /** + * Compile the SQL statement to execute a savepoint rollback. + * + * @param string $name + * @return string + */ + public function compileSavepointRollBack($name) + { + return 'ROLLBACK TRANSACTION '.$name; + } + + /** + * Get the format for database stored dates. + * + * @return string + */ + public function getDateFormat() + { + return 'Y-m-d H:i:s.v'; + } + + /** + * Wrap a single string in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrapValue($value) + { + return $value === '*' ? $value : '['.str_replace(']', ']]', $value).']'; + } + + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + */ + protected function wrapJsonSelector($value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($value); + + return 'json_value('.$field.$path.')'; + } + + /** + * Wrap the given JSON boolean value. + * + * @param string $value + * @return string + */ + protected function wrapJsonBooleanValue($value) + { + return "'".$value."'"; + } + + /** + * Wrap a table in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $table + * @return string + */ + public function wrapTable($table) + { + if (! $this->isExpression($table)) { + return $this->wrapTableValuedFunction(parent::wrapTable($table)); + } + + return $this->getValue($table); + } + + /** + * Wrap a table in keyword identifiers. + * + * @param string $table + * @return string + */ + protected function wrapTableValuedFunction($table) + { + if (preg_match('/^(.+?)(\(.*?\))]$/', $table, $matches) === 1) { + $table = $matches[1].']'.$matches[2]; + } + + return $table; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/JoinClause.php b/vendor/laravel/framework/src/Illuminate/Database/Query/JoinClause.php new file mode 100755 index 00000000..800da42e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/JoinClause.php @@ -0,0 +1,146 @@ +type = $type; + $this->table = $table; + $this->parentClass = get_class($parentQuery); + $this->parentGrammar = $parentQuery->getGrammar(); + $this->parentProcessor = $parentQuery->getProcessor(); + $this->parentConnection = $parentQuery->getConnection(); + + parent::__construct( + $this->parentConnection, $this->parentGrammar, $this->parentProcessor + ); + } + + /** + * Add an "on" clause to the join. + * + * On clauses can be chained, e.g. + * + * $join->on('contacts.user_id', '=', 'users.id') + * ->on('contacts.info_id', '=', 'info.id') + * + * will produce the following SQL: + * + * on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id` + * + * @param \Closure|string $first + * @param string|null $operator + * @param \Illuminate\Database\Query\Expression|string|null $second + * @param string $boolean + * @return $this + * + * @throws \InvalidArgumentException + */ + public function on($first, $operator = null, $second = null, $boolean = 'and') + { + if ($first instanceof Closure) { + return $this->whereNested($first, $boolean); + } + + return $this->whereColumn($first, $operator, $second, $boolean); + } + + /** + * Add an "or on" clause to the join. + * + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\JoinClause + */ + public function orOn($first, $operator = null, $second = null) + { + return $this->on($first, $operator, $second, 'or'); + } + + /** + * Get a new instance of the join clause builder. + * + * @return \Illuminate\Database\Query\JoinClause + */ + public function newQuery() + { + return new static($this->newParentQuery(), $this->type, $this->table); + } + + /** + * Create a new query instance for sub-query. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function forSubQuery() + { + return $this->newParentQuery()->newQuery(); + } + + /** + * Create a new parent query instance. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function newParentQuery() + { + $class = $this->parentClass; + + return new $class($this->parentConnection, $this->parentGrammar, $this->parentProcessor); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php new file mode 100644 index 00000000..ce918385 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php @@ -0,0 +1,19 @@ +column_name; + }, $results); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/PostgresProcessor.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/PostgresProcessor.php new file mode 100755 index 00000000..5956a8fb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/PostgresProcessor.php @@ -0,0 +1,45 @@ +getConnection(); + + $connection->recordsHaveBeenModified(); + + $result = $connection->selectFromWriteConnection($sql, $values)[0]; + + $sequence = $sequence ?: 'id'; + + $id = is_object($result) ? $result->{$sequence} : $result[$sequence]; + + return is_numeric($id) ? (int) $id : $id; + } + + /** + * Process the results of a column listing query. + * + * @param array $results + * @return array + */ + public function processColumnListing($results) + { + return array_map(function ($result) { + return ((object) $result)->column_name; + }, $results); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php new file mode 100755 index 00000000..0069b436 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php @@ -0,0 +1,49 @@ +getConnection()->insert($sql, $values); + + $id = $query->getConnection()->getPdo()->lastInsertId($sequence); + + return is_numeric($id) ? (int) $id : $id; + } + + /** + * Process the results of a column listing query. + * + * @param array $results + * @return array + */ + public function processColumnListing($results) + { + return $results; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php new file mode 100644 index 00000000..65da1dff --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php @@ -0,0 +1,19 @@ +name; + }, $results); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php new file mode 100755 index 00000000..49476f09 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php @@ -0,0 +1,70 @@ +getConnection(); + + $connection->insert($sql, $values); + + if ($connection->getConfig('odbc') === true) { + $id = $this->processInsertGetIdForOdbc($connection); + } else { + $id = $connection->getPdo()->lastInsertId(); + } + + return is_numeric($id) ? (int) $id : $id; + } + + /** + * Process an "insert get ID" query for ODBC. + * + * @param \Illuminate\Database\Connection $connection + * @return int + * + * @throws \Exception + */ + protected function processInsertGetIdForOdbc(Connection $connection) + { + $result = $connection->selectFromWriteConnection( + 'SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int) AS insertid' + ); + + if (! $result) { + throw new Exception('Unable to retrieve lastInsertID for ODBC.'); + } + + $row = $result[0]; + + return is_object($row) ? $row->insertid : $row['insertid']; + } + + /** + * Process the results of a column listing query. + * + * @param array $results + * @return array + */ + public function processColumnListing($results) + { + return array_map(function ($result) { + return ((object) $result)->name; + }, $results); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/QueryException.php b/vendor/laravel/framework/src/Illuminate/Database/QueryException.php new file mode 100644 index 00000000..8e64160d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/QueryException.php @@ -0,0 +1,78 @@ +sql = $sql; + $this->bindings = $bindings; + $this->code = $previous->getCode(); + $this->message = $this->formatMessage($sql, $bindings, $previous); + + if ($previous instanceof PDOException) { + $this->errorInfo = $previous->errorInfo; + } + } + + /** + * Format the SQL error message. + * + * @param string $sql + * @param array $bindings + * @param \Exception $previous + * @return string + */ + protected function formatMessage($sql, $bindings, $previous) + { + return $previous->getMessage().' (SQL: '.Str::replaceArray('?', $bindings, $sql).')'; + } + + /** + * Get the SQL for the query. + * + * @return string + */ + public function getSql() + { + return $this->sql; + } + + /** + * Get the bindings for the query. + * + * @return array + */ + public function getBindings() + { + return $this->bindings; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/README.md b/vendor/laravel/framework/src/Illuminate/Database/README.md new file mode 100755 index 00000000..7d59ab7d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/README.md @@ -0,0 +1,69 @@ +## Illuminate Database + +The Illuminate Database component is a full database toolkit for PHP, providing an expressive query builder, ActiveRecord style ORM, and schema builder. It currently supports MySQL, Postgres, SQL Server, and SQLite. It also serves as the database layer of the Laravel PHP framework. + +### Usage Instructions + +First, create a new "Capsule" manager instance. Capsule aims to make configuring the library for usage outside of the Laravel framework as easy as possible. + +```PHP +use Illuminate\Database\Capsule\Manager as Capsule; + +$capsule = new Capsule; + +$capsule->addConnection([ + 'driver' => 'mysql', + 'host' => 'localhost', + 'database' => 'database', + 'username' => 'root', + 'password' => 'password', + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', +]); + +// Set the event dispatcher used by Eloquent models... (optional) +use Illuminate\Events\Dispatcher; +use Illuminate\Container\Container; +$capsule->setEventDispatcher(new Dispatcher(new Container)); + +// Make this Capsule instance available globally via static methods... (optional) +$capsule->setAsGlobal(); + +// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher()) +$capsule->bootEloquent(); +``` + +> `composer require "illuminate/events"` required when you need to use observers with Eloquent. + +Once the Capsule instance has been registered. You may use it like so: + +**Using The Query Builder** + +```PHP +$users = Capsule::table('users')->where('votes', '>', 100)->get(); +``` +Other core methods may be accessed directly from the Capsule in the same manner as from the DB facade: +```PHP +$results = Capsule::select('select * from users where id = ?', [1]); +``` + +**Using The Schema Builder** + +```PHP +Capsule::schema()->create('users', function ($table) { + $table->increments('id'); + $table->string('email')->unique(); + $table->timestamps(); +}); +``` + +**Using The Eloquent ORM** + +```PHP +class User extends Illuminate\Database\Eloquent\Model {} + +$users = User::where('votes', '>', 1)->get(); +``` + +For further documentation on using the various database facilities this library provides, consult the [Laravel framework documentation](https://laravel.com/docs). diff --git a/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php b/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php new file mode 100755 index 00000000..a622df32 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php @@ -0,0 +1,107 @@ +getForeignKeyConstraintsConfigurationValue(); + + if ($enableForeignKeyConstraints === null) { + return; + } + + $enableForeignKeyConstraints + ? $this->getSchemaBuilder()->enableForeignKeyConstraints() + : $this->getSchemaBuilder()->disableForeignKeyConstraints(); + } + + /** + * Get the default query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\SQLiteGrammar + */ + protected function getDefaultQueryGrammar() + { + return $this->withTablePrefix(new QueryGrammar); + } + + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\SQLiteBuilder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new SQLiteBuilder($this); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\SQLiteGrammar + */ + protected function getDefaultSchemaGrammar() + { + return $this->withTablePrefix(new SchemaGrammar); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\SQLiteProcessor + */ + protected function getDefaultPostProcessor() + { + return new SQLiteProcessor; + } + + /** + * Get the Doctrine DBAL driver. + * + * @return \Doctrine\DBAL\Driver\PDOSqlite\Driver + */ + protected function getDoctrineDriver() + { + if (! class_exists(DoctrineDriver::class)) { + throw new LogicException( + 'Laravel v6 is only compatible with doctrine/dbal 2, in order to use this feature you must require the package "doctrine/dbal:^2.6".' + ); + } + + return new DoctrineDriver; + } + + /** + * Get the database connection foreign key constraints configuration option. + * + * @return bool|null + */ + protected function getForeignKeyConstraintsConfigurationValue() + { + return $this->getConfig('foreign_key_constraints'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php new file mode 100755 index 00000000..b475f5f2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php @@ -0,0 +1,1458 @@ +table = $table; + $this->prefix = $prefix; + + if (! is_null($callback)) { + $callback($this); + } + } + + /** + * Execute the blueprint against the database. + * + * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return void + */ + public function build(Connection $connection, Grammar $grammar) + { + foreach ($this->toSql($connection, $grammar) as $statement) { + $connection->statement($statement); + } + } + + /** + * Get the raw SQL statements for the blueprint. + * + * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return array + */ + public function toSql(Connection $connection, Grammar $grammar) + { + $this->addImpliedCommands($grammar); + + $statements = []; + + // Each type of command has a corresponding compiler function on the schema + // grammar which is used to build the necessary SQL statements to build + // the blueprint element, so we'll just call that compilers function. + $this->ensureCommandsAreValid($connection); + + foreach ($this->commands as $command) { + $method = 'compile'.ucfirst($command->name); + + if (method_exists($grammar, $method) || $grammar::hasMacro($method)) { + if (! is_null($sql = $grammar->$method($this, $command, $connection))) { + $statements = array_merge($statements, (array) $sql); + } + } + } + + return $statements; + } + + /** + * Ensure the commands on the blueprint are valid for the connection type. + * + * @param \Illuminate\Database\Connection $connection + * @return void + * + * @throws \BadMethodCallException + */ + protected function ensureCommandsAreValid(Connection $connection) + { + if ($connection instanceof SQLiteConnection) { + if ($this->commandsNamed(['dropColumn', 'renameColumn'])->count() > 1) { + throw new BadMethodCallException( + "SQLite doesn't support multiple calls to dropColumn / renameColumn in a single modification." + ); + } + + if ($this->commandsNamed(['dropForeign'])->count() > 0) { + throw new BadMethodCallException( + "SQLite doesn't support dropping foreign keys (you would need to re-create the table)." + ); + } + } + } + + /** + * Get all of the commands matching the given names. + * + * @param array $names + * @return \Illuminate\Support\Collection + */ + protected function commandsNamed(array $names) + { + return collect($this->commands)->filter(function ($command) use ($names) { + return in_array($command->name, $names); + }); + } + + /** + * Add the commands that are implied by the blueprint's state. + * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return void + */ + protected function addImpliedCommands(Grammar $grammar) + { + if (count($this->getAddedColumns()) > 0 && ! $this->creating()) { + array_unshift($this->commands, $this->createCommand('add')); + } + + if (count($this->getChangedColumns()) > 0 && ! $this->creating()) { + array_unshift($this->commands, $this->createCommand('change')); + } + + $this->addFluentIndexes(); + + $this->addFluentCommands($grammar); + } + + /** + * Add the index commands fluently specified on columns. + * + * @return void + */ + protected function addFluentIndexes() + { + foreach ($this->columns as $column) { + foreach (['primary', 'unique', 'index', 'spatialIndex'] as $index) { + // If the index has been specified on the given column, but is simply equal + // to "true" (boolean), no name has been specified for this index so the + // index method can be called without a name and it will generate one. + if ($column->{$index} === true) { + $this->{$index}($column->name); + $column->{$index} = false; + + continue 2; + } + + // If the index has been specified on the given column, and it has a string + // value, we'll go ahead and call the index method and pass the name for + // the index since the developer specified the explicit name for this. + elseif (isset($column->{$index})) { + $this->{$index}($column->name, $column->{$index}); + $column->{$index} = false; + + continue 2; + } + } + } + } + + /** + * Add the fluent commands specified on any columns. + * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return void + */ + public function addFluentCommands(Grammar $grammar) + { + foreach ($this->columns as $column) { + foreach ($grammar->getFluentCommands() as $commandName) { + $attributeName = lcfirst($commandName); + + if (! isset($column->{$attributeName})) { + continue; + } + + $value = $column->{$attributeName}; + + $this->addCommand( + $commandName, compact('value', 'column') + ); + } + } + } + + /** + * Determine if the blueprint has a create command. + * + * @return bool + */ + protected function creating() + { + return collect($this->commands)->contains(function ($command) { + return $command->name === 'create'; + }); + } + + /** + * Indicate that the table needs to be created. + * + * @return \Illuminate\Support\Fluent + */ + public function create() + { + return $this->addCommand('create'); + } + + /** + * Indicate that the table needs to be temporary. + * + * @return void + */ + public function temporary() + { + $this->temporary = true; + } + + /** + * Indicate that the table should be dropped. + * + * @return \Illuminate\Support\Fluent + */ + public function drop() + { + return $this->addCommand('drop'); + } + + /** + * Indicate that the table should be dropped if it exists. + * + * @return \Illuminate\Support\Fluent + */ + public function dropIfExists() + { + return $this->addCommand('dropIfExists'); + } + + /** + * Indicate that the given columns should be dropped. + * + * @param array|mixed $columns + * @return \Illuminate\Support\Fluent + */ + public function dropColumn($columns) + { + $columns = is_array($columns) ? $columns : func_get_args(); + + return $this->addCommand('dropColumn', compact('columns')); + } + + /** + * Indicate that the given columns should be renamed. + * + * @param string $from + * @param string $to + * @return \Illuminate\Support\Fluent + */ + public function renameColumn($from, $to) + { + return $this->addCommand('renameColumn', compact('from', 'to')); + } + + /** + * Indicate that the given primary key should be dropped. + * + * @param string|array|null $index + * @return \Illuminate\Support\Fluent + */ + public function dropPrimary($index = null) + { + return $this->dropIndexCommand('dropPrimary', 'primary', $index); + } + + /** + * Indicate that the given unique key should be dropped. + * + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + public function dropUnique($index) + { + return $this->dropIndexCommand('dropUnique', 'unique', $index); + } + + /** + * Indicate that the given index should be dropped. + * + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + public function dropIndex($index) + { + return $this->dropIndexCommand('dropIndex', 'index', $index); + } + + /** + * Indicate that the given spatial index should be dropped. + * + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + public function dropSpatialIndex($index) + { + return $this->dropIndexCommand('dropSpatialIndex', 'spatialIndex', $index); + } + + /** + * Indicate that the given foreign key should be dropped. + * + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + public function dropForeign($index) + { + return $this->dropIndexCommand('dropForeign', 'foreign', $index); + } + + /** + * Indicate that the given indexes should be renamed. + * + * @param string $from + * @param string $to + * @return \Illuminate\Support\Fluent + */ + public function renameIndex($from, $to) + { + return $this->addCommand('renameIndex', compact('from', 'to')); + } + + /** + * Indicate that the timestamp columns should be dropped. + * + * @return void + */ + public function dropTimestamps() + { + $this->dropColumn('created_at', 'updated_at'); + } + + /** + * Indicate that the timestamp columns should be dropped. + * + * @return void + */ + public function dropTimestampsTz() + { + $this->dropTimestamps(); + } + + /** + * Indicate that the soft delete column should be dropped. + * + * @param string $column + * @return void + */ + public function dropSoftDeletes($column = 'deleted_at') + { + $this->dropColumn($column); + } + + /** + * Indicate that the soft delete column should be dropped. + * + * @param string $column + * @return void + */ + public function dropSoftDeletesTz($column = 'deleted_at') + { + $this->dropSoftDeletes($column); + } + + /** + * Indicate that the remember token column should be dropped. + * + * @return void + */ + public function dropRememberToken() + { + $this->dropColumn('remember_token'); + } + + /** + * Indicate that the polymorphic columns should be dropped. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function dropMorphs($name, $indexName = null) + { + $this->dropIndex($indexName ?: $this->createIndexName('index', ["{$name}_type", "{$name}_id"])); + + $this->dropColumn("{$name}_type", "{$name}_id"); + } + + /** + * Rename the table to a given name. + * + * @param string $to + * @return \Illuminate\Support\Fluent + */ + public function rename($to) + { + return $this->addCommand('rename', compact('to')); + } + + /** + * Specify the primary key(s) for the table. + * + * @param string|array $columns + * @param string|null $name + * @param string|null $algorithm + * @return \Illuminate\Support\Fluent + */ + public function primary($columns, $name = null, $algorithm = null) + { + return $this->indexCommand('primary', $columns, $name, $algorithm); + } + + /** + * Specify a unique index for the table. + * + * @param string|array $columns + * @param string|null $name + * @param string|null $algorithm + * @return \Illuminate\Support\Fluent + */ + public function unique($columns, $name = null, $algorithm = null) + { + return $this->indexCommand('unique', $columns, $name, $algorithm); + } + + /** + * Specify an index for the table. + * + * @param string|array $columns + * @param string|null $name + * @param string|null $algorithm + * @return \Illuminate\Support\Fluent + */ + public function index($columns, $name = null, $algorithm = null) + { + return $this->indexCommand('index', $columns, $name, $algorithm); + } + + /** + * Specify a spatial index for the table. + * + * @param string|array $columns + * @param string|null $name + * @return \Illuminate\Support\Fluent + */ + public function spatialIndex($columns, $name = null) + { + return $this->indexCommand('spatialIndex', $columns, $name); + } + + /** + * Specify a foreign key for the table. + * + * @param string|array $columns + * @param string|null $name + * @return \Illuminate\Support\Fluent|\Illuminate\Database\Schema\ForeignKeyDefinition + */ + public function foreign($columns, $name = null) + { + return $this->indexCommand('foreign', $columns, $name); + } + + /** + * Create a new auto-incrementing integer (4-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function increments($column) + { + return $this->unsignedInteger($column, true); + } + + /** + * Create a new auto-incrementing integer (4-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function integerIncrements($column) + { + return $this->unsignedInteger($column, true); + } + + /** + * Create a new auto-incrementing tiny integer (1-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function tinyIncrements($column) + { + return $this->unsignedTinyInteger($column, true); + } + + /** + * Create a new auto-incrementing small integer (2-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function smallIncrements($column) + { + return $this->unsignedSmallInteger($column, true); + } + + /** + * Create a new auto-incrementing medium integer (3-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function mediumIncrements($column) + { + return $this->unsignedMediumInteger($column, true); + } + + /** + * Create a new auto-incrementing big integer (8-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function bigIncrements($column) + { + return $this->unsignedBigInteger($column, true); + } + + /** + * Create a new char column on the table. + * + * @param string $column + * @param int|null $length + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function char($column, $length = null) + { + $length = $length ?: Builder::$defaultStringLength; + + return $this->addColumn('char', $column, compact('length')); + } + + /** + * Create a new string column on the table. + * + * @param string $column + * @param int|null $length + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function string($column, $length = null) + { + $length = $length ?: Builder::$defaultStringLength; + + return $this->addColumn('string', $column, compact('length')); + } + + /** + * Create a new text column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function text($column) + { + return $this->addColumn('text', $column); + } + + /** + * Create a new medium text column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function mediumText($column) + { + return $this->addColumn('mediumText', $column); + } + + /** + * Create a new long text column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function longText($column) + { + return $this->addColumn('longText', $column); + } + + /** + * Create a new integer (4-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function integer($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('integer', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new tiny integer (1-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function tinyInteger($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('tinyInteger', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new small integer (2-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function smallInteger($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('smallInteger', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new medium integer (3-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function mediumInteger($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('mediumInteger', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new big integer (8-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function bigInteger($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('bigInteger', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new unsigned integer (4-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedInteger($column, $autoIncrement = false) + { + return $this->integer($column, $autoIncrement, true); + } + + /** + * Create a new unsigned tiny integer (1-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedTinyInteger($column, $autoIncrement = false) + { + return $this->tinyInteger($column, $autoIncrement, true); + } + + /** + * Create a new unsigned small integer (2-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedSmallInteger($column, $autoIncrement = false) + { + return $this->smallInteger($column, $autoIncrement, true); + } + + /** + * Create a new unsigned medium integer (3-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedMediumInteger($column, $autoIncrement = false) + { + return $this->mediumInteger($column, $autoIncrement, true); + } + + /** + * Create a new unsigned big integer (8-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedBigInteger($column, $autoIncrement = false) + { + return $this->bigInteger($column, $autoIncrement, true); + } + + /** + * Create a new float column on the table. + * + * @param string $column + * @param int $total + * @param int $places + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function float($column, $total = 8, $places = 2) + { + return $this->addColumn('float', $column, [ + 'total' => $total, 'places' => $places, 'unsigned' => false, + ]); + } + + /** + * Create a new double column on the table. + * + * @param string $column + * @param int|null $total + * @param int|null $places + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function double($column, $total = null, $places = null) + { + return $this->addColumn('double', $column, [ + 'total' => $total, 'places' => $places, 'unsigned' => false, + ]); + } + + /** + * Create a new decimal column on the table. + * + * @param string $column + * @param int $total + * @param int $places + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function decimal($column, $total = 8, $places = 2) + { + return $this->addColumn('decimal', $column, [ + 'total' => $total, 'places' => $places, 'unsigned' => false, + ]); + } + + /** + * Create a new unsigned decimal column on the table. + * + * @param string $column + * @param int $total + * @param int $places + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedDecimal($column, $total = 8, $places = 2) + { + return $this->addColumn('decimal', $column, [ + 'total' => $total, 'places' => $places, 'unsigned' => true, + ]); + } + + /** + * Create a new boolean column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function boolean($column) + { + return $this->addColumn('boolean', $column); + } + + /** + * Create a new enum column on the table. + * + * @param string $column + * @param array $allowed + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function enum($column, array $allowed) + { + return $this->addColumn('enum', $column, compact('allowed')); + } + + /** + * Create a new set column on the table. + * + * @param string $column + * @param array $allowed + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function set($column, array $allowed) + { + return $this->addColumn('set', $column, compact('allowed')); + } + + /** + * Create a new json column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function json($column) + { + return $this->addColumn('json', $column); + } + + /** + * Create a new jsonb column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function jsonb($column) + { + return $this->addColumn('jsonb', $column); + } + + /** + * Create a new date column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function date($column) + { + return $this->addColumn('date', $column); + } + + /** + * Create a new date-time column on the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function dateTime($column, $precision = 0) + { + return $this->addColumn('dateTime', $column, compact('precision')); + } + + /** + * Create a new date-time column (with time zone) on the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function dateTimeTz($column, $precision = 0) + { + return $this->addColumn('dateTimeTz', $column, compact('precision')); + } + + /** + * Create a new time column on the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function time($column, $precision = 0) + { + return $this->addColumn('time', $column, compact('precision')); + } + + /** + * Create a new time column (with time zone) on the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function timeTz($column, $precision = 0) + { + return $this->addColumn('timeTz', $column, compact('precision')); + } + + /** + * Create a new timestamp column on the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function timestamp($column, $precision = 0) + { + return $this->addColumn('timestamp', $column, compact('precision')); + } + + /** + * Create a new timestamp (with time zone) column on the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function timestampTz($column, $precision = 0) + { + return $this->addColumn('timestampTz', $column, compact('precision')); + } + + /** + * Add nullable creation and update timestamps to the table. + * + * @param int $precision + * @return void + */ + public function timestamps($precision = 0) + { + $this->timestamp('created_at', $precision)->nullable(); + + $this->timestamp('updated_at', $precision)->nullable(); + } + + /** + * Add nullable creation and update timestamps to the table. + * + * Alias for self::timestamps(). + * + * @param int $precision + * @return void + */ + public function nullableTimestamps($precision = 0) + { + $this->timestamps($precision); + } + + /** + * Add creation and update timestampTz columns to the table. + * + * @param int $precision + * @return void + */ + public function timestampsTz($precision = 0) + { + $this->timestampTz('created_at', $precision)->nullable(); + + $this->timestampTz('updated_at', $precision)->nullable(); + } + + /** + * Add a "deleted at" timestamp for the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function softDeletes($column = 'deleted_at', $precision = 0) + { + return $this->timestamp($column, $precision)->nullable(); + } + + /** + * Add a "deleted at" timestampTz for the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function softDeletesTz($column = 'deleted_at', $precision = 0) + { + return $this->timestampTz($column, $precision)->nullable(); + } + + /** + * Create a new year column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function year($column) + { + return $this->addColumn('year', $column); + } + + /** + * Create a new binary column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function binary($column) + { + return $this->addColumn('binary', $column); + } + + /** + * Create a new uuid column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function uuid($column) + { + return $this->addColumn('uuid', $column); + } + + /** + * Create a new IP address column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function ipAddress($column) + { + return $this->addColumn('ipAddress', $column); + } + + /** + * Create a new MAC address column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function macAddress($column) + { + return $this->addColumn('macAddress', $column); + } + + /** + * Create a new geometry column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function geometry($column) + { + return $this->addColumn('geometry', $column); + } + + /** + * Create a new point column on the table. + * + * @param string $column + * @param int|null $srid + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function point($column, $srid = null) + { + return $this->addColumn('point', $column, compact('srid')); + } + + /** + * Create a new linestring column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function lineString($column) + { + return $this->addColumn('linestring', $column); + } + + /** + * Create a new polygon column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function polygon($column) + { + return $this->addColumn('polygon', $column); + } + + /** + * Create a new geometrycollection column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function geometryCollection($column) + { + return $this->addColumn('geometrycollection', $column); + } + + /** + * Create a new multipoint column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function multiPoint($column) + { + return $this->addColumn('multipoint', $column); + } + + /** + * Create a new multilinestring column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function multiLineString($column) + { + return $this->addColumn('multilinestring', $column); + } + + /** + * Create a new multipolygon column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function multiPolygon($column) + { + return $this->addColumn('multipolygon', $column); + } + + /** + * Create a new multipolygon column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function multiPolygonZ($column) + { + return $this->addColumn('multipolygonz', $column); + } + + /** + * Create a new generated, computed column on the table. + * + * @param string $column + * @param string $expression + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function computed($column, $expression) + { + return $this->addColumn('computed', $column, compact('expression')); + } + + /** + * Add the proper columns for a polymorphic table. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function morphs($name, $indexName = null) + { + $this->string("{$name}_type"); + + $this->unsignedBigInteger("{$name}_id"); + + $this->index(["{$name}_type", "{$name}_id"], $indexName); + } + + /** + * Add nullable columns for a polymorphic table. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function nullableMorphs($name, $indexName = null) + { + $this->string("{$name}_type")->nullable(); + + $this->unsignedBigInteger("{$name}_id")->nullable(); + + $this->index(["{$name}_type", "{$name}_id"], $indexName); + } + + /** + * Add the proper columns for a polymorphic table using UUIDs. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function uuidMorphs($name, $indexName = null) + { + $this->string("{$name}_type"); + + $this->uuid("{$name}_id"); + + $this->index(["{$name}_type", "{$name}_id"], $indexName); + } + + /** + * Add nullable columns for a polymorphic table using UUIDs. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function nullableUuidMorphs($name, $indexName = null) + { + $this->string("{$name}_type")->nullable(); + + $this->uuid("{$name}_id")->nullable(); + + $this->index(["{$name}_type", "{$name}_id"], $indexName); + } + + /** + * Adds the `remember_token` column to the table. + * + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function rememberToken() + { + return $this->string('remember_token', 100)->nullable(); + } + + /** + * Add a new index command to the blueprint. + * + * @param string $type + * @param string|array $columns + * @param string $index + * @param string|null $algorithm + * @return \Illuminate\Support\Fluent + */ + protected function indexCommand($type, $columns, $index, $algorithm = null) + { + $columns = (array) $columns; + + // If no name was specified for this index, we will create one using a basic + // convention of the table name, followed by the columns, followed by an + // index type, such as primary or index, which makes the index unique. + $index = $index ?: $this->createIndexName($type, $columns); + + return $this->addCommand( + $type, compact('index', 'columns', 'algorithm') + ); + } + + /** + * Create a new drop index command on the blueprint. + * + * @param string $command + * @param string $type + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + protected function dropIndexCommand($command, $type, $index) + { + $columns = []; + + // If the given "index" is actually an array of columns, the developer means + // to drop an index merely by specifying the columns involved without the + // conventional name, so we will build the index name from the columns. + if (is_array($index)) { + $index = $this->createIndexName($type, $columns = $index); + } + + return $this->indexCommand($command, $columns, $index); + } + + /** + * Create a default index name for the table. + * + * @param string $type + * @param array $columns + * @return string + */ + protected function createIndexName($type, array $columns) + { + $index = strtolower($this->prefix.$this->table.'_'.implode('_', $columns).'_'.$type); + + return str_replace(['-', '.'], '_', $index); + } + + /** + * Add a new column to the blueprint. + * + * @param string $type + * @param string $name + * @param array $parameters + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function addColumn($type, $name, array $parameters = []) + { + $this->columns[] = $column = new ColumnDefinition( + array_merge(compact('type', 'name'), $parameters) + ); + + return $column; + } + + /** + * Remove a column from the schema blueprint. + * + * @param string $name + * @return $this + */ + public function removeColumn($name) + { + $this->columns = array_values(array_filter($this->columns, function ($c) use ($name) { + return $c['name'] != $name; + })); + + return $this; + } + + /** + * Add a new command to the blueprint. + * + * @param string $name + * @param array $parameters + * @return \Illuminate\Support\Fluent + */ + protected function addCommand($name, array $parameters = []) + { + $this->commands[] = $command = $this->createCommand($name, $parameters); + + return $command; + } + + /** + * Create a new Fluent command. + * + * @param string $name + * @param array $parameters + * @return \Illuminate\Support\Fluent + */ + protected function createCommand($name, array $parameters = []) + { + return new Fluent(array_merge(compact('name'), $parameters)); + } + + /** + * Get the table the blueprint describes. + * + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Get the columns on the blueprint. + * + * @return \Illuminate\Database\Schema\ColumnDefinition[] + */ + public function getColumns() + { + return $this->columns; + } + + /** + * Get the commands on the blueprint. + * + * @return \Illuminate\Support\Fluent[] + */ + public function getCommands() + { + return $this->commands; + } + + /** + * Get the columns on the blueprint that should be added. + * + * @return \Illuminate\Database\Schema\ColumnDefinition[] + */ + public function getAddedColumns() + { + return array_filter($this->columns, function ($column) { + return ! $column->change; + }); + } + + /** + * Get the columns on the blueprint that should be changed. + * + * @return \Illuminate\Database\Schema\ColumnDefinition[] + */ + public function getChangedColumns() + { + return array_filter($this->columns, function ($column) { + return (bool) $column->change; + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php new file mode 100755 index 00000000..93571b2c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php @@ -0,0 +1,375 @@ +connection = $connection; + $this->grammar = $connection->getSchemaGrammar(); + } + + /** + * Set the default string length for migrations. + * + * @param int $length + * @return void + */ + public static function defaultStringLength($length) + { + static::$defaultStringLength = $length; + } + + /** + * Determine if the given table exists. + * + * @param string $table + * @return bool + */ + public function hasTable($table) + { + $table = $this->connection->getTablePrefix().$table; + + return count($this->connection->selectFromWriteConnection( + $this->grammar->compileTableExists(), [$table] + )) > 0; + } + + /** + * Determine if the given table has a given column. + * + * @param string $table + * @param string $column + * @return bool + */ + public function hasColumn($table, $column) + { + return in_array( + strtolower($column), array_map('strtolower', $this->getColumnListing($table)) + ); + } + + /** + * Determine if the given table has given columns. + * + * @param string $table + * @param array $columns + * @return bool + */ + public function hasColumns($table, array $columns) + { + $tableColumns = array_map('strtolower', $this->getColumnListing($table)); + + foreach ($columns as $column) { + if (! in_array(strtolower($column), $tableColumns)) { + return false; + } + } + + return true; + } + + /** + * Get the data type for the given column name. + * + * @param string $table + * @param string $column + * @return string + */ + public function getColumnType($table, $column) + { + $table = $this->connection->getTablePrefix().$table; + + return $this->connection->getDoctrineColumn($table, $column)->getType()->getName(); + } + + /** + * Get the column listing for a given table. + * + * @param string $table + * @return array + */ + public function getColumnListing($table) + { + $results = $this->connection->selectFromWriteConnection($this->grammar->compileColumnListing( + $this->connection->getTablePrefix().$table + )); + + return $this->connection->getPostProcessor()->processColumnListing($results); + } + + /** + * Modify a table on the schema. + * + * @param string $table + * @param \Closure $callback + * @return void + */ + public function table($table, Closure $callback) + { + $this->build($this->createBlueprint($table, $callback)); + } + + /** + * Create a new table on the schema. + * + * @param string $table + * @param \Closure $callback + * @return void + */ + public function create($table, Closure $callback) + { + $this->build(tap($this->createBlueprint($table), function ($blueprint) use ($callback) { + $blueprint->create(); + + $callback($blueprint); + })); + } + + /** + * Drop a table from the schema. + * + * @param string $table + * @return void + */ + public function drop($table) + { + $this->build(tap($this->createBlueprint($table), function ($blueprint) { + $blueprint->drop(); + })); + } + + /** + * Drop a table from the schema if it exists. + * + * @param string $table + * @return void + */ + public function dropIfExists($table) + { + $this->build(tap($this->createBlueprint($table), function ($blueprint) { + $blueprint->dropIfExists(); + })); + } + + /** + * Drop all tables from the database. + * + * @return void + * + * @throws \LogicException + */ + public function dropAllTables() + { + throw new LogicException('This database driver does not support dropping all tables.'); + } + + /** + * Drop all views from the database. + * + * @return void + * + * @throws \LogicException + */ + public function dropAllViews() + { + throw new LogicException('This database driver does not support dropping all views.'); + } + + /** + * Drop all types from the database. + * + * @return void + * + * @throws \LogicException + */ + public function dropAllTypes() + { + throw new LogicException('This database driver does not support dropping all types.'); + } + + /** + * Get all of the table names for the database. + * + * @return void + * + * @throws \LogicException + */ + public function getAllTables() + { + throw new LogicException('This database driver does not support getting all tables.'); + } + + /** + * Rename a table on the schema. + * + * @param string $from + * @param string $to + * @return void + */ + public function rename($from, $to) + { + $this->build(tap($this->createBlueprint($from), function ($blueprint) use ($to) { + $blueprint->rename($to); + })); + } + + /** + * Enable foreign key constraints. + * + * @return bool + */ + public function enableForeignKeyConstraints() + { + return $this->connection->statement( + $this->grammar->compileEnableForeignKeyConstraints() + ); + } + + /** + * Disable foreign key constraints. + * + * @return bool + */ + public function disableForeignKeyConstraints() + { + return $this->connection->statement( + $this->grammar->compileDisableForeignKeyConstraints() + ); + } + + /** + * Execute the blueprint to build / modify the table. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return void + */ + protected function build(Blueprint $blueprint) + { + $blueprint->build($this->connection, $this->grammar); + } + + /** + * Create a new command set with a Closure. + * + * @param string $table + * @param \Closure|null $callback + * @return \Illuminate\Database\Schema\Blueprint + */ + protected function createBlueprint($table, Closure $callback = null) + { + $prefix = $this->connection->getConfig('prefix_indexes') + ? $this->connection->getConfig('prefix') + : ''; + + if (isset($this->resolver)) { + return call_user_func($this->resolver, $table, $callback, $prefix); + } + + return new Blueprint($table, $callback, $prefix); + } + + /** + * Register a custom Doctrine mapping type. + * + * @param string $class + * @param string $name + * @param string $type + * @return void + * + * @throws \Doctrine\DBAL\DBALException + * @throws \RuntimeException + */ + public function registerCustomDoctrineType($class, $name, $type) + { + if (! $this->connection->isDoctrineAvailable()) { + throw new RuntimeException( + 'Registering a custom Doctrine type requires Doctrine DBAL (doctrine/dbal).' + ); + } + + if (! Type::hasType($name)) { + Type::addType($name, $class); + + $this->connection + ->getDoctrineSchemaManager() + ->getDatabasePlatform() + ->registerDoctrineTypeMapping($type, $name); + } + } + + /** + * Get the database connection instance. + * + * @return \Illuminate\Database\Connection + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Set the database connection instance. + * + * @param \Illuminate\Database\Connection $connection + * @return $this + */ + public function setConnection(Connection $connection) + { + $this->connection = $connection; + + return $this; + } + + /** + * Set the Schema Blueprint resolver callback. + * + * @param \Closure $resolver + * @return void + */ + public function blueprintResolver(Closure $resolver) + { + $this->resolver = $resolver; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/ColumnDefinition.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/ColumnDefinition.php new file mode 100644 index 00000000..ae72c527 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/ColumnDefinition.php @@ -0,0 +1,33 @@ +isDoctrineAvailable()) { + throw new RuntimeException(sprintf( + 'Changing columns for table "%s" requires Doctrine DBAL. Please install the doctrine/dbal package.', + $blueprint->getTable() + )); + } + + $tableDiff = static::getChangedDiff( + $grammar, $blueprint, $schema = $connection->getDoctrineSchemaManager() + ); + + if ($tableDiff !== false) { + return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); + } + + return []; + } + + /** + * Get the Doctrine table difference for the given changes. + * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema + * @return \Doctrine\DBAL\Schema\TableDiff|bool + */ + protected static function getChangedDiff($grammar, Blueprint $blueprint, SchemaManager $schema) + { + $current = $schema->listTableDetails($grammar->getTablePrefix().$blueprint->getTable()); + + return (new Comparator)->diffTable( + $current, static::getTableWithColumnChanges($blueprint, $current) + ); + } + + /** + * Get a copy of the given Doctrine table after making the column changes. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Doctrine\DBAL\Schema\Table $table + * @return \Doctrine\DBAL\Schema\Table + */ + protected static function getTableWithColumnChanges(Blueprint $blueprint, Table $table) + { + $table = clone $table; + + foreach ($blueprint->getChangedColumns() as $fluent) { + $column = static::getDoctrineColumn($table, $fluent); + + // Here we will spin through each fluent column definition and map it to the proper + // Doctrine column definitions - which is necessary because Laravel and Doctrine + // use some different terminology for various column attributes on the tables. + foreach ($fluent->getAttributes() as $key => $value) { + if (! is_null($option = static::mapFluentOptionToDoctrine($key))) { + if (method_exists($column, $method = 'set'.ucfirst($option))) { + $column->{$method}(static::mapFluentValueToDoctrine($option, $value)); + continue; + } + + $column->setCustomSchemaOption($option, static::mapFluentValueToDoctrine($option, $value)); + } + } + } + + return $table; + } + + /** + * Get the Doctrine column instance for a column change. + * + * @param \Doctrine\DBAL\Schema\Table $table + * @param \Illuminate\Support\Fluent $fluent + * @return \Doctrine\DBAL\Schema\Column + */ + protected static function getDoctrineColumn(Table $table, Fluent $fluent) + { + return $table->changeColumn( + $fluent['name'], static::getDoctrineColumnChangeOptions($fluent) + )->getColumn($fluent['name']); + } + + /** + * Get the Doctrine column change options. + * + * @param \Illuminate\Support\Fluent $fluent + * @return array + */ + protected static function getDoctrineColumnChangeOptions(Fluent $fluent) + { + $options = ['type' => static::getDoctrineColumnType($fluent['type'])]; + + if (in_array($fluent['type'], ['text', 'mediumText', 'longText'])) { + $options['length'] = static::calculateDoctrineTextLength($fluent['type']); + } + + if (static::doesntNeedCharacterOptions($fluent['type'])) { + $options['customSchemaOptions'] = [ + 'collation' => '', + 'charset' => '', + ]; + } + + return $options; + } + + /** + * Get the doctrine column type. + * + * @param string $type + * @return \Doctrine\DBAL\Types\Type + */ + protected static function getDoctrineColumnType($type) + { + $type = strtolower($type); + + switch ($type) { + case 'biginteger': + $type = 'bigint'; + break; + case 'smallinteger': + $type = 'smallint'; + break; + case 'mediumtext': + case 'longtext': + $type = 'text'; + break; + case 'binary': + $type = 'blob'; + break; + } + + return Type::getType($type); + } + + /** + * Calculate the proper column length to force the Doctrine text type. + * + * @param string $type + * @return int + */ + protected static function calculateDoctrineTextLength($type) + { + switch ($type) { + case 'mediumText': + return 65535 + 1; + case 'longText': + return 16777215 + 1; + default: + return 255 + 1; + } + } + + /** + * Determine if the given type does not need character / collation options. + * + * @param string $type + * @return bool + */ + protected static function doesntNeedCharacterOptions($type) + { + return in_array($type, [ + 'bigInteger', + 'binary', + 'boolean', + 'date', + 'decimal', + 'double', + 'float', + 'integer', + 'json', + 'mediumInteger', + 'smallInteger', + 'time', + 'tinyInteger', + ]); + } + + /** + * Get the matching Doctrine option for a given Fluent attribute name. + * + * @param string $attribute + * @return string|null + */ + protected static function mapFluentOptionToDoctrine($attribute) + { + switch ($attribute) { + case 'type': + case 'name': + return; + case 'nullable': + return 'notnull'; + case 'total': + return 'precision'; + case 'places': + return 'scale'; + default: + return $attribute; + } + } + + /** + * Get the matching Doctrine value for a given Fluent attribute. + * + * @param string $option + * @param mixed $value + * @return mixed + */ + protected static function mapFluentValueToDoctrine($option, $value) + { + return $option === 'notnull' ? ! $value : $value; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php new file mode 100755 index 00000000..b60dfe81 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php @@ -0,0 +1,286 @@ +wrapTable($blueprint), + $this->wrap($command->index) + ); + + // Once we have the initial portion of the SQL statement we will add on the + // key name, table name, and referenced columns. These will complete the + // main portion of the SQL statement and this SQL will almost be done. + $sql .= sprintf('foreign key (%s) references %s (%s)', + $this->columnize($command->columns), + $this->wrapTable($command->on), + $this->columnize((array) $command->references) + ); + + // Once we have the basic foreign key creation statement constructed we can + // build out the syntax for what should happen on an update or delete of + // the affected columns, which will get something like "cascade", etc. + if (! is_null($command->onDelete)) { + $sql .= " on delete {$command->onDelete}"; + } + + if (! is_null($command->onUpdate)) { + $sql .= " on update {$command->onUpdate}"; + } + + return $sql; + } + + /** + * Compile the blueprint's column definitions. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return array + */ + protected function getColumns(Blueprint $blueprint) + { + $columns = []; + + foreach ($blueprint->getAddedColumns() as $column) { + // Each of the column types have their own compiler functions which are tasked + // with turning the column definition into its SQL format for this platform + // used by the connection. The column's modifiers are compiled and added. + $sql = $this->wrap($column).' '.$this->getType($column); + + $columns[] = $this->addModifiers($sql, $blueprint, $column); + } + + return $columns; + } + + /** + * Get the SQL for the column data type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function getType(Fluent $column) + { + return $this->{'type'.ucfirst($column->type)}($column); + } + + /** + * Create the column definition for a generated, computed column type. + * + * @param \Illuminate\Support\Fluent $column + * @return void + * + * @throws \RuntimeException + */ + protected function typeComputed(Fluent $column) + { + throw new RuntimeException('This database driver does not support the computed type.'); + } + + /** + * Add the column modifiers to the definition. + * + * @param string $sql + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function addModifiers($sql, Blueprint $blueprint, Fluent $column) + { + foreach ($this->modifiers as $modifier) { + if (method_exists($this, $method = "modify{$modifier}")) { + $sql .= $this->{$method}($blueprint, $column); + } + } + + return $sql; + } + + /** + * Get the primary key command if it exists on the blueprint. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param string $name + * @return \Illuminate\Support\Fluent|null + */ + protected function getCommandByName(Blueprint $blueprint, $name) + { + $commands = $this->getCommandsByName($blueprint, $name); + + if (count($commands) > 0) { + return reset($commands); + } + } + + /** + * Get all of the commands with a given name. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param string $name + * @return array + */ + protected function getCommandsByName(Blueprint $blueprint, $name) + { + return array_filter($blueprint->getCommands(), function ($value) use ($name) { + return $value->name == $name; + }); + } + + /** + * Add a prefix to an array of values. + * + * @param string $prefix + * @param array $values + * @return array + */ + public function prefixArray($prefix, array $values) + { + return array_map(function ($value) use ($prefix) { + return $prefix.' '.$value; + }, $values); + } + + /** + * Wrap a table in keyword identifiers. + * + * @param mixed $table + * @return string + */ + public function wrapTable($table) + { + return parent::wrapTable( + $table instanceof Blueprint ? $table->getTable() : $table + ); + } + + /** + * Wrap a value in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $value + * @param bool $prefixAlias + * @return string + */ + public function wrap($value, $prefixAlias = false) + { + return parent::wrap( + $value instanceof Fluent ? $value->name : $value, $prefixAlias + ); + } + + /** + * Format a value so that it can be used in "default" clauses. + * + * @param mixed $value + * @return string + */ + protected function getDefaultValue($value) + { + if ($value instanceof Expression) { + return $value; + } + + return is_bool($value) + ? "'".(int) $value."'" + : "'".(string) $value."'"; + } + + /** + * Create an empty Doctrine DBAL TableDiff from the Blueprint. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema + * @return \Doctrine\DBAL\Schema\TableDiff + */ + public function getDoctrineTableDiff(Blueprint $blueprint, SchemaManager $schema) + { + $table = $this->getTablePrefix().$blueprint->getTable(); + + return tap(new TableDiff($table), function ($tableDiff) use ($schema, $table) { + $tableDiff->fromTable = $schema->listTableDetails($table); + }); + } + + /** + * Get the fluent commands for the grammar. + * + * @return array + */ + public function getFluentCommands() + { + return $this->fluentCommands; + } + + /** + * Check if this Grammar supports schema changes wrapped in a transaction. + * + * @return bool + */ + public function supportsSchemaTransactions() + { + return $this->transactions; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php new file mode 100755 index 00000000..6464a5d8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php @@ -0,0 +1,1049 @@ +compileCreateTable( + $blueprint, $command, $connection + ); + + // Once we have the primary SQL, we can add the encoding option to the SQL for + // the table. Then, we can check if a storage engine has been supplied for + // the table. If so, we will add the engine declaration to the SQL query. + $sql = $this->compileCreateEncoding( + $sql, $connection, $blueprint + ); + + // Finally, we will append the engine configuration onto this SQL statement as + // the final thing we do before returning this finished SQL. Once this gets + // added the query will be ready to execute against the real connections. + return $this->compileCreateEngine( + $sql, $connection, $blueprint + ); + } + + /** + * Create the main create table clause. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Illuminate\Database\Connection $connection + * @return string + */ + protected function compileCreateTable($blueprint, $command, $connection) + { + return sprintf('%s table %s (%s)', + $blueprint->temporary ? 'create temporary' : 'create', + $this->wrapTable($blueprint), + implode(', ', $this->getColumns($blueprint)) + ); + } + + /** + * Append the character set specifications to a command. + * + * @param string $sql + * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return string + */ + protected function compileCreateEncoding($sql, Connection $connection, Blueprint $blueprint) + { + // First we will set the character set if one has been set on either the create + // blueprint itself or on the root configuration for the connection that the + // table is being created on. We will add these to the create table query. + if (isset($blueprint->charset)) { + $sql .= ' default character set '.$blueprint->charset; + } elseif (! is_null($charset = $connection->getConfig('charset'))) { + $sql .= ' default character set '.$charset; + } + + // Next we will add the collation to the create table statement if one has been + // added to either this create table blueprint or the configuration for this + // connection that the query is targeting. We'll add it to this SQL query. + if (isset($blueprint->collation)) { + $sql .= " collate '{$blueprint->collation}'"; + } elseif (! is_null($collation = $connection->getConfig('collation'))) { + $sql .= " collate '{$collation}'"; + } + + return $sql; + } + + /** + * Append the engine specifications to a command. + * + * @param string $sql + * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return string + */ + protected function compileCreateEngine($sql, Connection $connection, Blueprint $blueprint) + { + if (isset($blueprint->engine)) { + return $sql.' engine = '.$blueprint->engine; + } elseif (! is_null($engine = $connection->getConfig('engine'))) { + return $sql.' engine = '.$engine; + } + + return $sql; + } + + /** + * Compile an add column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileAdd(Blueprint $blueprint, Fluent $command) + { + $columns = $this->prefixArray('add', $this->getColumns($blueprint)); + + return 'alter table '.$this->wrapTable($blueprint).' '.implode(', ', $columns); + } + + /** + * Compile a primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compilePrimary(Blueprint $blueprint, Fluent $command) + { + $command->name(null); + + return $this->compileKey($blueprint, $command, 'primary key'); + } + + /** + * Compile a unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileUnique(Blueprint $blueprint, Fluent $command) + { + return $this->compileKey($blueprint, $command, 'unique'); + } + + /** + * Compile a plain index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileIndex(Blueprint $blueprint, Fluent $command) + { + return $this->compileKey($blueprint, $command, 'index'); + } + + /** + * Compile a spatial index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) + { + return $this->compileKey($blueprint, $command, 'spatial index'); + } + + /** + * Compile an index creation command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param string $type + * @return string + */ + protected function compileKey(Blueprint $blueprint, Fluent $command, $type) + { + return sprintf('alter table %s add %s %s%s(%s)', + $this->wrapTable($blueprint), + $type, + $this->wrap($command->index), + $command->algorithm ? ' using '.$command->algorithm : '', + $this->columnize($command->columns) + ); + } + + /** + * Compile a drop table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDrop(Blueprint $blueprint, Fluent $command) + { + return 'drop table '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop table (if exists) command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIfExists(Blueprint $blueprint, Fluent $command) + { + return 'drop table if exists '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropColumn(Blueprint $blueprint, Fluent $command) + { + $columns = $this->prefixArray('drop', $this->wrapArray($command->columns)); + + return 'alter table '.$this->wrapTable($blueprint).' '.implode(', ', $columns); + } + + /** + * Compile a drop primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropPrimary(Blueprint $blueprint, Fluent $command) + { + return 'alter table '.$this->wrapTable($blueprint).' drop primary key'; + } + + /** + * Compile a drop unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropUnique(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop index {$index}"; + } + + /** + * Compile a drop index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIndex(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop index {$index}"; + } + + /** + * Compile a drop spatial index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) + { + return $this->compileDropIndex($blueprint, $command); + } + + /** + * Compile a drop foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropForeign(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop foreign key {$index}"; + } + + /** + * Compile a rename table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRename(Blueprint $blueprint, Fluent $command) + { + $from = $this->wrapTable($blueprint); + + return "rename table {$from} to ".$this->wrapTable($command->to); + } + + /** + * Compile a rename index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRenameIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter table %s rename index %s to %s', + $this->wrapTable($blueprint), + $this->wrap($command->from), + $this->wrap($command->to) + ); + } + + /** + * Compile the SQL needed to drop all tables. + * + * @param array $tables + * @return string + */ + public function compileDropAllTables($tables) + { + return 'drop table '.implode(',', $this->wrapArray($tables)); + } + + /** + * Compile the SQL needed to drop all views. + * + * @param array $views + * @return string + */ + public function compileDropAllViews($views) + { + return 'drop view '.implode(',', $this->wrapArray($views)); + } + + /** + * Compile the SQL needed to retrieve all table names. + * + * @return string + */ + public function compileGetAllTables() + { + return 'SHOW FULL TABLES WHERE table_type = \'BASE TABLE\''; + } + + /** + * Compile the SQL needed to retrieve all view names. + * + * @return string + */ + public function compileGetAllViews() + { + return 'SHOW FULL TABLES WHERE table_type = \'VIEW\''; + } + + /** + * Compile the command to enable foreign key constraints. + * + * @return string + */ + public function compileEnableForeignKeyConstraints() + { + return 'SET FOREIGN_KEY_CHECKS=1;'; + } + + /** + * Compile the command to disable foreign key constraints. + * + * @return string + */ + public function compileDisableForeignKeyConstraints() + { + return 'SET FOREIGN_KEY_CHECKS=0;'; + } + + /** + * Create the column definition for a char type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeChar(Fluent $column) + { + return "char({$column->length})"; + } + + /** + * Create the column definition for a string type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeString(Fluent $column) + { + return "varchar({$column->length})"; + } + + /** + * Create the column definition for a text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a medium text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumText(Fluent $column) + { + return 'mediumtext'; + } + + /** + * Create the column definition for a long text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLongText(Fluent $column) + { + return 'longtext'; + } + + /** + * Create the column definition for a big integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBigInteger(Fluent $column) + { + return 'bigint'; + } + + /** + * Create the column definition for an integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeInteger(Fluent $column) + { + return 'int'; + } + + /** + * Create the column definition for a medium integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumInteger(Fluent $column) + { + return 'mediumint'; + } + + /** + * Create the column definition for a tiny integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTinyInteger(Fluent $column) + { + return 'tinyint'; + } + + /** + * Create the column definition for a small integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSmallInteger(Fluent $column) + { + return 'smallint'; + } + + /** + * Create the column definition for a float type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeFloat(Fluent $column) + { + return $this->typeDouble($column); + } + + /** + * Create the column definition for a double type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDouble(Fluent $column) + { + if ($column->total && $column->places) { + return "double({$column->total}, {$column->places})"; + } + + return 'double'; + } + + /** + * Create the column definition for a decimal type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDecimal(Fluent $column) + { + return "decimal({$column->total}, {$column->places})"; + } + + /** + * Create the column definition for a boolean type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBoolean(Fluent $column) + { + return 'tinyint(1)'; + } + + /** + * Create the column definition for an enumeration type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeEnum(Fluent $column) + { + return sprintf('enum(%s)', $this->quoteString($column->allowed)); + } + + /** + * Create the column definition for a set enumeration type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSet(Fluent $column) + { + return sprintf('set(%s)', $this->quoteString($column->allowed)); + } + + /** + * Create the column definition for a json type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJson(Fluent $column) + { + return 'json'; + } + + /** + * Create the column definition for a jsonb type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJsonb(Fluent $column) + { + return 'json'; + } + + /** + * Create the column definition for a date type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDate(Fluent $column) + { + return 'date'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTime(Fluent $column) + { + $columnType = $column->precision ? "datetime($column->precision)" : 'datetime'; + + return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; + } + + /** + * Create the column definition for a date-time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTimeTz(Fluent $column) + { + return $this->typeDateTime($column); + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTime(Fluent $column) + { + return $column->precision ? "time($column->precision)" : 'time'; + } + + /** + * Create the column definition for a time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimeTz(Fluent $column) + { + return $this->typeTime($column); + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestamp(Fluent $column) + { + $columnType = $column->precision ? "timestamp($column->precision)" : 'timestamp'; + + return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; + } + + /** + * Create the column definition for a timestamp (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestampTz(Fluent $column) + { + return $this->typeTimestamp($column); + } + + /** + * Create the column definition for a year type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeYear(Fluent $column) + { + return 'year'; + } + + /** + * Create the column definition for a binary type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBinary(Fluent $column) + { + return 'blob'; + } + + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'char(36)'; + } + + /** + * Create the column definition for an IP address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeIpAddress(Fluent $column) + { + return 'varchar(45)'; + } + + /** + * Create the column definition for a MAC address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMacAddress(Fluent $column) + { + return 'varchar(17)'; + } + + /** + * Create the column definition for a spatial Geometry type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeGeometry(Fluent $column) + { + return 'geometry'; + } + + /** + * Create the column definition for a spatial Point type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typePoint(Fluent $column) + { + return 'point'; + } + + /** + * Create the column definition for a spatial LineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeLineString(Fluent $column) + { + return 'linestring'; + } + + /** + * Create the column definition for a spatial Polygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typePolygon(Fluent $column) + { + return 'polygon'; + } + + /** + * Create the column definition for a spatial GeometryCollection type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeGeometryCollection(Fluent $column) + { + return 'geometrycollection'; + } + + /** + * Create the column definition for a spatial MultiPoint type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiPoint(Fluent $column) + { + return 'multipoint'; + } + + /** + * Create the column definition for a spatial MultiLineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiLineString(Fluent $column) + { + return 'multilinestring'; + } + + /** + * Create the column definition for a spatial MultiPolygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiPolygon(Fluent $column) + { + return 'multipolygon'; + } + + /** + * Create the column definition for a generated, computed column type. + * + * @param \Illuminate\Support\Fluent $column + * @return void + * + * @throws \RuntimeException + */ + protected function typeComputed(Fluent $column) + { + throw new RuntimeException('This database driver requires a type, see the virtualAs / storedAs modifiers.'); + } + + /** + * Get the SQL for a generated virtual column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyVirtualAs(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->virtualAs)) { + return " as ({$column->virtualAs})"; + } + } + + /** + * Get the SQL for a generated stored column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyStoredAs(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->storedAs)) { + return " as ({$column->storedAs}) stored"; + } + } + + /** + * Get the SQL for an unsigned column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyUnsigned(Blueprint $blueprint, Fluent $column) + { + if ($column->unsigned) { + return ' unsigned'; + } + } + + /** + * Get the SQL for a character set column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyCharset(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->charset)) { + return ' character set '.$column->charset; + } + } + + /** + * Get the SQL for a collation column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyCollate(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->collation)) { + return " collate '{$column->collation}'"; + } + } + + /** + * Get the SQL for a nullable column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyNullable(Blueprint $blueprint, Fluent $column) + { + if (is_null($column->virtualAs) && is_null($column->storedAs)) { + return $column->nullable ? ' null' : ' not null'; + } + + if ($column->nullable === false) { + return ' not null'; + } + } + + /** + * Get the SQL for a default column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyDefault(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->default)) { + return ' default '.$this->getDefaultValue($column->default); + } + } + + /** + * Get the SQL for an auto-increment column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyIncrement(Blueprint $blueprint, Fluent $column) + { + if (in_array($column->type, $this->serials) && $column->autoIncrement) { + return ' auto_increment primary key'; + } + } + + /** + * Get the SQL for a "first" column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyFirst(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->first)) { + return ' first'; + } + } + + /** + * Get the SQL for an "after" column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyAfter(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->after)) { + return ' after '.$this->wrap($column->after); + } + } + + /** + * Get the SQL for a "comment" column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyComment(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->comment)) { + return " comment '".addslashes($column->comment)."'"; + } + } + + /** + * Get the SQL for a SRID column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifySrid(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->srid) && is_int($column->srid) && $column->srid > 0) { + return ' srid '.$column->srid; + } + } + + /** + * Wrap a single string in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrapValue($value) + { + if ($value !== '*') { + return '`'.str_replace('`', '``', $value).'`'; + } + + return $value; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php new file mode 100755 index 00000000..0c1dd2e5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php @@ -0,0 +1,983 @@ +temporary ? 'create temporary' : 'create', + $this->wrapTable($blueprint), + implode(', ', $this->getColumns($blueprint)) + ); + } + + /** + * Compile a column addition command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileAdd(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter table %s %s', + $this->wrapTable($blueprint), + implode(', ', $this->prefixArray('add column', $this->getColumns($blueprint))) + ); + } + + /** + * Compile a primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compilePrimary(Blueprint $blueprint, Fluent $command) + { + $columns = $this->columnize($command->columns); + + return 'alter table '.$this->wrapTable($blueprint)." add primary key ({$columns})"; + } + + /** + * Compile a unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileUnique(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter table %s add constraint %s unique (%s)', + $this->wrapTable($blueprint), + $this->wrap($command->index), + $this->columnize($command->columns) + ); + } + + /** + * Compile a plain index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('create index %s on %s%s (%s)', + $this->wrap($command->index), + $this->wrapTable($blueprint), + $command->algorithm ? ' using '.$command->algorithm : '', + $this->columnize($command->columns) + ); + } + + /** + * Compile a spatial index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) + { + $command->algorithm = 'gist'; + + return $this->compileIndex($blueprint, $command); + } + + /** + * Compile a foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileForeign(Blueprint $blueprint, Fluent $command) + { + $sql = parent::compileForeign($blueprint, $command); + + if (! is_null($command->deferrable)) { + $sql .= $command->deferrable ? ' deferrable' : ' not deferrable'; + } + + if ($command->deferrable && ! is_null($command->initiallyImmediate)) { + $sql .= $command->initiallyImmediate ? ' initially immediate' : ' initially deferred'; + } + + if (! is_null($command->notValid)) { + $sql .= ' not valid'; + } + + return $sql; + } + + /** + * Compile a drop table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDrop(Blueprint $blueprint, Fluent $command) + { + return 'drop table '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop table (if exists) command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIfExists(Blueprint $blueprint, Fluent $command) + { + return 'drop table if exists '.$this->wrapTable($blueprint); + } + + /** + * Compile the SQL needed to drop all tables. + * + * @param array $tables + * @return string + */ + public function compileDropAllTables($tables) + { + return 'drop table "'.implode('","', $tables).'" cascade'; + } + + /** + * Compile the SQL needed to drop all views. + * + * @param array $views + * @return string + */ + public function compileDropAllViews($views) + { + return 'drop view "'.implode('","', $views).'" cascade'; + } + + /** + * Compile the SQL needed to drop all types. + * + * @param array $types + * @return string + */ + public function compileDropAllTypes($types) + { + return 'drop type "'.implode('","', $types).'" cascade'; + } + + /** + * Compile the SQL needed to retrieve all table names. + * + * @param string|array $schema + * @return string + */ + public function compileGetAllTables($schema) + { + return "select tablename from pg_catalog.pg_tables where schemaname in ('".implode("','", (array) $schema)."')"; + } + + /** + * Compile the SQL needed to retrieve all view names. + * + * @param string|array $schema + * @return string + */ + public function compileGetAllViews($schema) + { + return "select viewname from pg_catalog.pg_views where schemaname in ('".implode("','", (array) $schema)."')"; + } + + /** + * Compile the SQL needed to retrieve all type names. + * + * @return string + */ + public function compileGetAllTypes() + { + return 'select distinct pg_type.typname from pg_type inner join pg_enum on pg_enum.enumtypid = pg_type.oid'; + } + + /** + * Compile a drop column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropColumn(Blueprint $blueprint, Fluent $command) + { + $columns = $this->prefixArray('drop column', $this->wrapArray($command->columns)); + + return 'alter table '.$this->wrapTable($blueprint).' '.implode(', ', $columns); + } + + /** + * Compile a drop primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropPrimary(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap("{$blueprint->getTable()}_pkey"); + + return 'alter table '.$this->wrapTable($blueprint)." drop constraint {$index}"; + } + + /** + * Compile a drop unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropUnique(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; + } + + /** + * Compile a drop index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIndex(Blueprint $blueprint, Fluent $command) + { + return "drop index {$this->wrap($command->index)}"; + } + + /** + * Compile a drop spatial index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) + { + return $this->compileDropIndex($blueprint, $command); + } + + /** + * Compile a drop foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropForeign(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; + } + + /** + * Compile a rename table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRename(Blueprint $blueprint, Fluent $command) + { + $from = $this->wrapTable($blueprint); + + return "alter table {$from} rename to ".$this->wrapTable($command->to); + } + + /** + * Compile a rename index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRenameIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter index %s rename to %s', + $this->wrap($command->from), + $this->wrap($command->to) + ); + } + + /** + * Compile the command to enable foreign key constraints. + * + * @return string + */ + public function compileEnableForeignKeyConstraints() + { + return 'SET CONSTRAINTS ALL IMMEDIATE;'; + } + + /** + * Compile the command to disable foreign key constraints. + * + * @return string + */ + public function compileDisableForeignKeyConstraints() + { + return 'SET CONSTRAINTS ALL DEFERRED;'; + } + + /** + * Compile a comment command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileComment(Blueprint $blueprint, Fluent $command) + { + return sprintf('comment on column %s.%s is %s', + $this->wrapTable($blueprint), + $this->wrap($command->column->name), + "'".str_replace("'", "''", $command->value)."'" + ); + } + + /** + * Create the column definition for a char type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeChar(Fluent $column) + { + return "char({$column->length})"; + } + + /** + * Create the column definition for a string type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeString(Fluent $column) + { + return "varchar({$column->length})"; + } + + /** + * Create the column definition for a text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a medium text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a long text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLongText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for an integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeInteger(Fluent $column) + { + return $this->generatableColumn('integer', $column); + } + + /** + * Create the column definition for a big integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBigInteger(Fluent $column) + { + return $this->generatableColumn('bigint', $column); + } + + /** + * Create the column definition for a medium integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumInteger(Fluent $column) + { + return $this->generatableColumn('integer', $column); + } + + /** + * Create the column definition for a tiny integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTinyInteger(Fluent $column) + { + return $this->generatableColumn('smallint', $column); + } + + /** + * Create the column definition for a small integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSmallInteger(Fluent $column) + { + return $this->generatableColumn('smallint', $column); + } + + /** + * Create the column definition for a generatable column. + * + * @param string $type + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function generatableColumn($type, Fluent $column) + { + if (! $column->autoIncrement && is_null($column->generatedAs)) { + return $type; + } + + if ($column->autoIncrement && is_null($column->generatedAs)) { + return with([ + 'integer' => 'serial', + 'bigint' => 'bigserial', + 'smallint' => 'smallserial', + ])[$type]; + } + + $options = ''; + + if (! is_bool($column->generatedAs) && ! empty($column->generatedAs)) { + $options = sprintf(' (%s)', $column->generatedAs); + } + + return sprintf( + '%s generated %s as identity%s', + $type, + $column->always ? 'always' : 'by default', + $options + ); + } + + /** + * Create the column definition for a float type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeFloat(Fluent $column) + { + return $this->typeDouble($column); + } + + /** + * Create the column definition for a double type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDouble(Fluent $column) + { + return 'double precision'; + } + + /** + * Create the column definition for a real type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeReal(Fluent $column) + { + return 'real'; + } + + /** + * Create the column definition for a decimal type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDecimal(Fluent $column) + { + return "decimal({$column->total}, {$column->places})"; + } + + /** + * Create the column definition for a boolean type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBoolean(Fluent $column) + { + return 'boolean'; + } + + /** + * Create the column definition for an enumeration type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeEnum(Fluent $column) + { + return sprintf( + 'varchar(255) check ("%s" in (%s))', + $column->name, + $this->quoteString($column->allowed) + ); + } + + /** + * Create the column definition for a json type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJson(Fluent $column) + { + return 'json'; + } + + /** + * Create the column definition for a jsonb type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJsonb(Fluent $column) + { + return 'jsonb'; + } + + /** + * Create the column definition for a date type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDate(Fluent $column) + { + return 'date'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTime(Fluent $column) + { + return $this->typeTimestamp($column); + } + + /** + * Create the column definition for a date-time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTimeTz(Fluent $column) + { + return $this->typeTimestampTz($column); + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTime(Fluent $column) + { + return 'time'.(is_null($column->precision) ? '' : "($column->precision)").' without time zone'; + } + + /** + * Create the column definition for a time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimeTz(Fluent $column) + { + return 'time'.(is_null($column->precision) ? '' : "($column->precision)").' with time zone'; + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestamp(Fluent $column) + { + $columnType = 'timestamp'.(is_null($column->precision) ? '' : "($column->precision)").' without time zone'; + + return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; + } + + /** + * Create the column definition for a timestamp (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestampTz(Fluent $column) + { + $columnType = 'timestamp'.(is_null($column->precision) ? '' : "($column->precision)").' with time zone'; + + return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; + } + + /** + * Create the column definition for a year type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeYear(Fluent $column) + { + return $this->typeInteger($column); + } + + /** + * Create the column definition for a binary type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBinary(Fluent $column) + { + return 'bytea'; + } + + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'uuid'; + } + + /** + * Create the column definition for an IP address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeIpAddress(Fluent $column) + { + return 'inet'; + } + + /** + * Create the column definition for a MAC address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMacAddress(Fluent $column) + { + return 'macaddr'; + } + + /** + * Create the column definition for a spatial Geometry type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeGeometry(Fluent $column) + { + return $this->formatPostGisType('geometry', $column); + } + + /** + * Create the column definition for a spatial Point type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typePoint(Fluent $column) + { + return $this->formatPostGisType('point', $column); + } + + /** + * Create the column definition for a spatial LineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLineString(Fluent $column) + { + return $this->formatPostGisType('linestring', $column); + } + + /** + * Create the column definition for a spatial Polygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typePolygon(Fluent $column) + { + return $this->formatPostGisType('polygon', $column); + } + + /** + * Create the column definition for a spatial GeometryCollection type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeGeometryCollection(Fluent $column) + { + return $this->formatPostGisType('geometrycollection', $column); + } + + /** + * Create the column definition for a spatial MultiPoint type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMultiPoint(Fluent $column) + { + return $this->formatPostGisType('multipoint', $column); + } + + /** + * Create the column definition for a spatial MultiLineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiLineString(Fluent $column) + { + return $this->formatPostGisType('multilinestring', $column); + } + + /** + * Create the column definition for a spatial MultiPolygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMultiPolygon(Fluent $column) + { + return $this->formatPostGisType('multipolygon', $column); + } + + /** + * Create the column definition for a spatial MultiPolygonZ type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMultiPolygonZ(Fluent $column) + { + return $this->formatPostGisType('multipolygonz', $column); + } + + /** + * Format the column definition for a PostGIS spatial type. + * + * @param string $type + * @param \Illuminate\Support\Fluent $column + * @return string + */ + private function formatPostGisType($type, Fluent $column) + { + if ($column->isGeometry === null) { + return sprintf('geography(%s, %s)', $type, $column->projection ?? '4326'); + } + + if ($column->projection !== null) { + return sprintf('geometry(%s, %s)', $type, $column->projection); + } + + return "geometry({$type})"; + } + + /** + * Get the SQL for a collation column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyCollate(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->collation)) { + return ' collate '.$this->wrapValue($column->collation); + } + } + + /** + * Get the SQL for a nullable column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyNullable(Blueprint $blueprint, Fluent $column) + { + return $column->nullable ? ' null' : ' not null'; + } + + /** + * Get the SQL for a default column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyDefault(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->default)) { + return ' default '.$this->getDefaultValue($column->default); + } + } + + /** + * Get the SQL for an auto-increment column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyIncrement(Blueprint $blueprint, Fluent $column) + { + if ((in_array($column->type, $this->serials) || ($column->generatedAs !== null)) && $column->autoIncrement) { + return ' primary key'; + } + } + + /** + * Get the SQL for a generated virtual column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyVirtualAs(Blueprint $blueprint, Fluent $column) + { + if ($column->virtualAs !== null) { + return " generated always as ({$column->virtualAs})"; + } + } + + /** + * Get the SQL for a generated stored column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyStoredAs(Blueprint $blueprint, Fluent $column) + { + if ($column->storedAs !== null) { + return " generated always as ({$column->storedAs}) stored"; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/RenameColumn.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/RenameColumn.php new file mode 100644 index 00000000..fd54fb28 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/RenameColumn.php @@ -0,0 +1,82 @@ +getDoctrineColumn( + $grammar->getTablePrefix().$blueprint->getTable(), $command->from + ); + + $schema = $connection->getDoctrineSchemaManager(); + + return (array) $schema->getDatabasePlatform()->getAlterTableSQL(static::getRenamedDiff( + $grammar, $blueprint, $command, $column, $schema + )); + } + + /** + * Get a new column instance with the new column name. + * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Doctrine\DBAL\Schema\Column $column + * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema + * @return \Doctrine\DBAL\Schema\TableDiff + */ + protected static function getRenamedDiff(Grammar $grammar, Blueprint $blueprint, Fluent $command, Column $column, SchemaManager $schema) + { + return static::setRenamedColumns( + $grammar->getDoctrineTableDiff($blueprint, $schema), $command, $column + ); + } + + /** + * Set the renamed columns on the table diff. + * + * @param \Doctrine\DBAL\Schema\TableDiff $tableDiff + * @param \Illuminate\Support\Fluent $command + * @param \Doctrine\DBAL\Schema\Column $column + * @return \Doctrine\DBAL\Schema\TableDiff + */ + protected static function setRenamedColumns(TableDiff $tableDiff, Fluent $command, Column $column) + { + $tableDiff->renamedColumns = [ + $command->from => new Column($command->to, $column->getType(), self::getWritableColumnOptions($column)), + ]; + + return $tableDiff; + } + + /** + * Get the writable column options. + * + * @param \Doctrine\DBAL\Schema\Column $column + * @return array + */ + private static function getWritableColumnOptions(Column $column) + { + return array_filter($column->toArray(), function (string $name) use ($column) { + return method_exists($column, 'set'.$name); + }, ARRAY_FILTER_USE_KEY); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php new file mode 100755 index 00000000..374ff9aa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php @@ -0,0 +1,865 @@ +wrap(str_replace('.', '__', $table)).')'; + } + + /** + * Compile a create table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileCreate(Blueprint $blueprint, Fluent $command) + { + return sprintf('%s table %s (%s%s%s)', + $blueprint->temporary ? 'create temporary' : 'create', + $this->wrapTable($blueprint), + implode(', ', $this->getColumns($blueprint)), + (string) $this->addForeignKeys($blueprint), + (string) $this->addPrimaryKeys($blueprint) + ); + } + + /** + * Get the foreign key syntax for a table creation statement. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return string|null + */ + protected function addForeignKeys(Blueprint $blueprint) + { + $foreigns = $this->getCommandsByName($blueprint, 'foreign'); + + return collect($foreigns)->reduce(function ($sql, $foreign) { + // Once we have all the foreign key commands for the table creation statement + // we'll loop through each of them and add them to the create table SQL we + // are building, since SQLite needs foreign keys on the tables creation. + $sql .= $this->getForeignKey($foreign); + + if (! is_null($foreign->onDelete)) { + $sql .= " on delete {$foreign->onDelete}"; + } + + // If this foreign key specifies the action to be taken on update we will add + // that to the statement here. We'll append it to this SQL and then return + // the SQL so we can keep adding any other foreign constraints onto this. + if (! is_null($foreign->onUpdate)) { + $sql .= " on update {$foreign->onUpdate}"; + } + + return $sql; + }, ''); + } + + /** + * Get the SQL for the foreign key. + * + * @param \Illuminate\Support\Fluent $foreign + * @return string + */ + protected function getForeignKey($foreign) + { + // We need to columnize the columns that the foreign key is being defined for + // so that it is a properly formatted list. Once we have done this, we can + // return the foreign key SQL declaration to the calling method for use. + return sprintf(', foreign key(%s) references %s(%s)', + $this->columnize($foreign->columns), + $this->wrapTable($foreign->on), + $this->columnize((array) $foreign->references) + ); + } + + /** + * Get the primary key syntax for a table creation statement. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return string|null + */ + protected function addPrimaryKeys(Blueprint $blueprint) + { + if (! is_null($primary = $this->getCommandByName($blueprint, 'primary'))) { + return ", primary key ({$this->columnize($primary->columns)})"; + } + } + + /** + * Compile alter table commands for adding columns. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return array + */ + public function compileAdd(Blueprint $blueprint, Fluent $command) + { + $columns = $this->prefixArray('add column', $this->getColumns($blueprint)); + + return collect($columns)->map(function ($column) use ($blueprint) { + return 'alter table '.$this->wrapTable($blueprint).' '.$column; + })->all(); + } + + /** + * Compile a unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileUnique(Blueprint $blueprint, Fluent $command) + { + return sprintf('create unique index %s on %s (%s)', + $this->wrap($command->index), + $this->wrapTable($blueprint), + $this->columnize($command->columns) + ); + } + + /** + * Compile a plain index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('create index %s on %s (%s)', + $this->wrap($command->index), + $this->wrapTable($blueprint), + $this->columnize($command->columns) + ); + } + + /** + * Compile a spatial index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return void + * + * @throws \RuntimeException + */ + public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) + { + throw new RuntimeException('The database driver in use does not support spatial indexes.'); + } + + /** + * Compile a foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileForeign(Blueprint $blueprint, Fluent $command) + { + // Handled on table creation... + } + + /** + * Compile a drop table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDrop(Blueprint $blueprint, Fluent $command) + { + return 'drop table '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop table (if exists) command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIfExists(Blueprint $blueprint, Fluent $command) + { + return 'drop table if exists '.$this->wrapTable($blueprint); + } + + /** + * Compile the SQL needed to drop all tables. + * + * @return string + */ + public function compileDropAllTables() + { + return "delete from sqlite_master where type in ('table', 'index', 'trigger')"; + } + + /** + * Compile the SQL needed to drop all views. + * + * @return string + */ + public function compileDropAllViews() + { + return "delete from sqlite_master where type in ('view')"; + } + + /** + * Compile the SQL needed to rebuild the database. + * + * @return string + */ + public function compileRebuild() + { + return 'vacuum'; + } + + /** + * Compile a drop column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Illuminate\Database\Connection $connection + * @return array + */ + public function compileDropColumn(Blueprint $blueprint, Fluent $command, Connection $connection) + { + $tableDiff = $this->getDoctrineTableDiff( + $blueprint, $schema = $connection->getDoctrineSchemaManager() + ); + + foreach ($command->columns as $name) { + $tableDiff->removedColumns[$name] = $connection->getDoctrineColumn( + $this->getTablePrefix().$blueprint->getTable(), $name + ); + } + + return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); + } + + /** + * Compile a drop unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropUnique(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "drop index {$index}"; + } + + /** + * Compile a drop index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIndex(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "drop index {$index}"; + } + + /** + * Compile a drop spatial index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return void + * + * @throws \RuntimeException + */ + public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) + { + throw new RuntimeException('The database driver in use does not support spatial indexes.'); + } + + /** + * Compile a rename table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRename(Blueprint $blueprint, Fluent $command) + { + $from = $this->wrapTable($blueprint); + + return "alter table {$from} rename to ".$this->wrapTable($command->to); + } + + /** + * Compile a rename index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Illuminate\Database\Connection $connection + * @return array + * + * @throws \RuntimeException + */ + public function compileRenameIndex(Blueprint $blueprint, Fluent $command, Connection $connection) + { + $schemaManager = $connection->getDoctrineSchemaManager(); + + $indexes = $schemaManager->listTableIndexes($this->getTablePrefix().$blueprint->getTable()); + + $index = Arr::get($indexes, $command->from); + + if (! $index) { + throw new RuntimeException("Index [{$command->from}] does not exist."); + } + + $newIndex = new Index( + $command->to, $index->getColumns(), $index->isUnique(), + $index->isPrimary(), $index->getFlags(), $index->getOptions() + ); + + $platform = $schemaManager->getDatabasePlatform(); + + return [ + $platform->getDropIndexSQL($command->from, $this->getTablePrefix().$blueprint->getTable()), + $platform->getCreateIndexSQL($newIndex, $this->getTablePrefix().$blueprint->getTable()), + ]; + } + + /** + * Compile the command to enable foreign key constraints. + * + * @return string + */ + public function compileEnableForeignKeyConstraints() + { + return 'PRAGMA foreign_keys = ON;'; + } + + /** + * Compile the command to disable foreign key constraints. + * + * @return string + */ + public function compileDisableForeignKeyConstraints() + { + return 'PRAGMA foreign_keys = OFF;'; + } + + /** + * Compile the SQL needed to enable a writable schema. + * + * @return string + */ + public function compileEnableWriteableSchema() + { + return 'PRAGMA writable_schema = 1;'; + } + + /** + * Compile the SQL needed to disable a writable schema. + * + * @return string + */ + public function compileDisableWriteableSchema() + { + return 'PRAGMA writable_schema = 0;'; + } + + /** + * Create the column definition for a char type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeChar(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for a string type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeString(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for a text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a medium text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a long text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLongText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a big integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBigInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a medium integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a tiny integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTinyInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a small integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSmallInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a float type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeFloat(Fluent $column) + { + return 'float'; + } + + /** + * Create the column definition for a double type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDouble(Fluent $column) + { + return 'float'; + } + + /** + * Create the column definition for a decimal type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDecimal(Fluent $column) + { + return 'numeric'; + } + + /** + * Create the column definition for a boolean type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBoolean(Fluent $column) + { + return 'tinyint(1)'; + } + + /** + * Create the column definition for an enumeration type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeEnum(Fluent $column) + { + return sprintf( + 'varchar check ("%s" in (%s))', + $column->name, + $this->quoteString($column->allowed) + ); + } + + /** + * Create the column definition for a json type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJson(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a jsonb type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJsonb(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a date type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDate(Fluent $column) + { + return 'date'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTime(Fluent $column) + { + return $this->typeTimestamp($column); + } + + /** + * Create the column definition for a date-time (with time zone) type. + * + * Note: "SQLite does not have a storage class set aside for storing dates and/or times." + * + * @link https://www.sqlite.org/datatype3.html + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTimeTz(Fluent $column) + { + return $this->typeDateTime($column); + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTime(Fluent $column) + { + return 'time'; + } + + /** + * Create the column definition for a time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimeTz(Fluent $column) + { + return $this->typeTime($column); + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestamp(Fluent $column) + { + return $column->useCurrent ? 'datetime default CURRENT_TIMESTAMP' : 'datetime'; + } + + /** + * Create the column definition for a timestamp (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestampTz(Fluent $column) + { + return $this->typeTimestamp($column); + } + + /** + * Create the column definition for a year type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeYear(Fluent $column) + { + return $this->typeInteger($column); + } + + /** + * Create the column definition for a binary type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBinary(Fluent $column) + { + return 'blob'; + } + + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for an IP address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeIpAddress(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for a MAC address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMacAddress(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for a spatial Geometry type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeGeometry(Fluent $column) + { + return 'geometry'; + } + + /** + * Create the column definition for a spatial Point type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typePoint(Fluent $column) + { + return 'point'; + } + + /** + * Create the column definition for a spatial LineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeLineString(Fluent $column) + { + return 'linestring'; + } + + /** + * Create the column definition for a spatial Polygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typePolygon(Fluent $column) + { + return 'polygon'; + } + + /** + * Create the column definition for a spatial GeometryCollection type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeGeometryCollection(Fluent $column) + { + return 'geometrycollection'; + } + + /** + * Create the column definition for a spatial MultiPoint type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiPoint(Fluent $column) + { + return 'multipoint'; + } + + /** + * Create the column definition for a spatial MultiLineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiLineString(Fluent $column) + { + return 'multilinestring'; + } + + /** + * Create the column definition for a spatial MultiPolygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiPolygon(Fluent $column) + { + return 'multipolygon'; + } + + /** + * Get the SQL for a nullable column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyNullable(Blueprint $blueprint, Fluent $column) + { + return $column->nullable ? ' null' : ' not null'; + } + + /** + * Get the SQL for a default column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyDefault(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->default)) { + return ' default '.$this->getDefaultValue($column->default); + } + } + + /** + * Get the SQL for an auto-increment column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyIncrement(Blueprint $blueprint, Fluent $column) + { + if (in_array($column->type, $this->serials) && $column->autoIncrement) { + return ' primary key autoincrement'; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php new file mode 100755 index 00000000..e4e41f91 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php @@ -0,0 +1,896 @@ +getColumns($blueprint)); + + return 'create table '.$this->wrapTable($blueprint)." ($columns)"; + } + + /** + * Compile a column addition table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileAdd(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter table %s add %s', + $this->wrapTable($blueprint), + implode(', ', $this->getColumns($blueprint)) + ); + } + + /** + * Compile a primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compilePrimary(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter table %s add constraint %s primary key (%s)', + $this->wrapTable($blueprint), + $this->wrap($command->index), + $this->columnize($command->columns) + ); + } + + /** + * Compile a unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileUnique(Blueprint $blueprint, Fluent $command) + { + return sprintf('create unique index %s on %s (%s)', + $this->wrap($command->index), + $this->wrapTable($blueprint), + $this->columnize($command->columns) + ); + } + + /** + * Compile a plain index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('create index %s on %s (%s)', + $this->wrap($command->index), + $this->wrapTable($blueprint), + $this->columnize($command->columns) + ); + } + + /** + * Compile a spatial index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('create spatial index %s on %s (%s)', + $this->wrap($command->index), + $this->wrapTable($blueprint), + $this->columnize($command->columns) + ); + } + + /** + * Compile a drop table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDrop(Blueprint $blueprint, Fluent $command) + { + return 'drop table '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop table (if exists) command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIfExists(Blueprint $blueprint, Fluent $command) + { + return sprintf('if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = %s) drop table %s', + "'".str_replace("'", "''", $this->getTablePrefix().$blueprint->getTable())."'", + $this->wrapTable($blueprint) + ); + } + + /** + * Compile the SQL needed to drop all tables. + * + * @return string + */ + public function compileDropAllTables() + { + return "EXEC sp_msforeachtable 'DROP TABLE ?'"; + } + + /** + * Compile a drop column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropColumn(Blueprint $blueprint, Fluent $command) + { + $columns = $this->wrapArray($command->columns); + + $dropExistingConstraintsSql = $this->compileDropDefaultConstraint($blueprint, $command).';'; + + return $dropExistingConstraintsSql.'alter table '.$this->wrapTable($blueprint).' drop column '.implode(', ', $columns); + } + + /** + * Compile a drop default constraint command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropDefaultConstraint(Blueprint $blueprint, Fluent $command) + { + $columns = "'".implode("','", $command->columns)."'"; + + $tableName = $this->getTablePrefix().$blueprint->getTable(); + + $sql = "DECLARE @sql NVARCHAR(MAX) = '';"; + $sql .= "SELECT @sql += 'ALTER TABLE [dbo].[{$tableName}] DROP CONSTRAINT ' + OBJECT_NAME([default_object_id]) + ';' "; + $sql .= 'FROM sys.columns '; + $sql .= "WHERE [object_id] = OBJECT_ID('[dbo].[{$tableName}]') AND [name] in ({$columns}) AND [default_object_id] <> 0;"; + $sql .= 'EXEC(@sql)'; + + return $sql; + } + + /** + * Compile a drop primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropPrimary(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; + } + + /** + * Compile a drop unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropUnique(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "drop index {$index} on {$this->wrapTable($blueprint)}"; + } + + /** + * Compile a drop index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIndex(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "drop index {$index} on {$this->wrapTable($blueprint)}"; + } + + /** + * Compile a drop spatial index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) + { + return $this->compileDropIndex($blueprint, $command); + } + + /** + * Compile a drop foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropForeign(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; + } + + /** + * Compile a rename table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRename(Blueprint $blueprint, Fluent $command) + { + $from = $this->wrapTable($blueprint); + + return "sp_rename {$from}, ".$this->wrapTable($command->to); + } + + /** + * Compile a rename index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRenameIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf("sp_rename N'%s', %s, N'INDEX'", + $this->wrap($blueprint->getTable().'.'.$command->from), + $this->wrap($command->to) + ); + } + + /** + * Compile the command to enable foreign key constraints. + * + * @return string + */ + public function compileEnableForeignKeyConstraints() + { + return 'EXEC sp_msforeachtable @command1="print \'?\'", @command2="ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all";'; + } + + /** + * Compile the command to disable foreign key constraints. + * + * @return string + */ + public function compileDisableForeignKeyConstraints() + { + return 'EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all";'; + } + + /** + * Compile the command to drop all foreign keys. + * + * @return string + */ + public function compileDropAllForeignKeys() + { + return "DECLARE @sql NVARCHAR(MAX) = N''; + SELECT @sql += 'ALTER TABLE ' + + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id)) + '.' + + QUOTENAME(OBJECT_NAME(parent_object_id)) + + ' DROP CONSTRAINT ' + QUOTENAME(name) + ';' + FROM sys.foreign_keys; + + EXEC sp_executesql @sql;"; + } + + /** + * Compile the command to drop all views. + * + * @return string + */ + public function compileDropAllViews() + { + return "DECLARE @sql NVARCHAR(MAX) = N''; + SELECT @sql += 'DROP VIEW ' + QUOTENAME(OBJECT_SCHEMA_NAME(object_id)) + '.' + QUOTENAME(name) + ';' + FROM sys.views; + + EXEC sp_executesql @sql;"; + } + + /** + * Create the column definition for a char type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeChar(Fluent $column) + { + return "nchar({$column->length})"; + } + + /** + * Create the column definition for a string type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeString(Fluent $column) + { + return "nvarchar({$column->length})"; + } + + /** + * Create the column definition for a text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeText(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a medium text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumText(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a long text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLongText(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for an integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeInteger(Fluent $column) + { + return 'int'; + } + + /** + * Create the column definition for a big integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBigInteger(Fluent $column) + { + return 'bigint'; + } + + /** + * Create the column definition for a medium integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumInteger(Fluent $column) + { + return 'int'; + } + + /** + * Create the column definition for a tiny integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTinyInteger(Fluent $column) + { + return 'tinyint'; + } + + /** + * Create the column definition for a small integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSmallInteger(Fluent $column) + { + return 'smallint'; + } + + /** + * Create the column definition for a float type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeFloat(Fluent $column) + { + return 'float'; + } + + /** + * Create the column definition for a double type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDouble(Fluent $column) + { + return 'float'; + } + + /** + * Create the column definition for a decimal type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDecimal(Fluent $column) + { + return "decimal({$column->total}, {$column->places})"; + } + + /** + * Create the column definition for a boolean type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBoolean(Fluent $column) + { + return 'bit'; + } + + /** + * Create the column definition for an enumeration type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeEnum(Fluent $column) + { + return sprintf( + 'nvarchar(255) check ("%s" in (%s))', + $column->name, + $this->quoteString($column->allowed) + ); + } + + /** + * Create the column definition for a json type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJson(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a jsonb type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJsonb(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a date type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDate(Fluent $column) + { + return 'date'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTime(Fluent $column) + { + return $this->typeTimestamp($column); + } + + /** + * Create the column definition for a date-time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTimeTz(Fluent $column) + { + return $this->typeTimestampTz($column); + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTime(Fluent $column) + { + return $column->precision ? "time($column->precision)" : 'time'; + } + + /** + * Create the column definition for a time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimeTz(Fluent $column) + { + return $this->typeTime($column); + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestamp(Fluent $column) + { + $columnType = $column->precision ? "datetime2($column->precision)" : 'datetime'; + + return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; + } + + /** + * Create the column definition for a timestamp (with time zone) type. + * + * @link https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetimeoffset-transact-sql?view=sql-server-ver15 + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestampTz(Fluent $column) + { + $columnType = $column->precision ? "datetimeoffset($column->precision)" : 'datetimeoffset'; + + return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; + } + + /** + * Create the column definition for a year type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeYear(Fluent $column) + { + return $this->typeInteger($column); + } + + /** + * Create the column definition for a binary type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBinary(Fluent $column) + { + return 'varbinary(max)'; + } + + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'uniqueidentifier'; + } + + /** + * Create the column definition for an IP address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeIpAddress(Fluent $column) + { + return 'nvarchar(45)'; + } + + /** + * Create the column definition for a MAC address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMacAddress(Fluent $column) + { + return 'nvarchar(17)'; + } + + /** + * Create the column definition for a spatial Geometry type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeGeometry(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial Point type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typePoint(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial LineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeLineString(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial Polygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typePolygon(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial GeometryCollection type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeGeometryCollection(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial MultiPoint type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiPoint(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial MultiLineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiLineString(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial MultiPolygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiPolygon(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a generated, computed column type. + * + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function typeComputed(Fluent $column) + { + return "as ({$column->expression})"; + } + + /** + * Get the SQL for a collation column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyCollate(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->collation)) { + return ' collate '.$column->collation; + } + } + + /** + * Get the SQL for a nullable column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyNullable(Blueprint $blueprint, Fluent $column) + { + if ($column->type !== 'computed') { + return $column->nullable ? ' null' : ' not null'; + } + } + + /** + * Get the SQL for a default column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyDefault(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->default)) { + return ' default '.$this->getDefaultValue($column->default); + } + } + + /** + * Get the SQL for an auto-increment column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyIncrement(Blueprint $blueprint, Fluent $column) + { + if (in_array($column->type, $this->serials) && $column->autoIncrement) { + return ' identity primary key'; + } + } + + /** + * Get the SQL for a generated stored column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyPersisted(Blueprint $blueprint, Fluent $column) + { + if ($column->persisted) { + return ' persisted'; + } + } + + /** + * Wrap a table in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $table + * @return string + */ + public function wrapTable($table) + { + if ($table instanceof Blueprint && $table->temporary) { + $this->setTablePrefix('#'); + } + + return parent::wrapTable($table); + } + + /** + * Quote the given string literal. + * + * @param string|array $value + * @return string + */ + public function quoteString($value) + { + if (is_array($value)) { + return implode(', ', array_map([$this, __FUNCTION__], $value)); + } + + return "N'$value'"; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php new file mode 100755 index 00000000..f07946c8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php @@ -0,0 +1,114 @@ +connection->getTablePrefix().$table; + + return count($this->connection->select( + $this->grammar->compileTableExists(), [$this->connection->getDatabaseName(), $table] + )) > 0; + } + + /** + * Get the column listing for a given table. + * + * @param string $table + * @return array + */ + public function getColumnListing($table) + { + $table = $this->connection->getTablePrefix().$table; + + $results = $this->connection->select( + $this->grammar->compileColumnListing(), [$this->connection->getDatabaseName(), $table] + ); + + return $this->connection->getPostProcessor()->processColumnListing($results); + } + + /** + * Drop all tables from the database. + * + * @return void + */ + public function dropAllTables() + { + $tables = []; + + foreach ($this->getAllTables() as $row) { + $row = (array) $row; + + $tables[] = reset($row); + } + + if (empty($tables)) { + return; + } + + $this->disableForeignKeyConstraints(); + + $this->connection->statement( + $this->grammar->compileDropAllTables($tables) + ); + + $this->enableForeignKeyConstraints(); + } + + /** + * Drop all views from the database. + * + * @return void + */ + public function dropAllViews() + { + $views = []; + + foreach ($this->getAllViews() as $row) { + $row = (array) $row; + + $views[] = reset($row); + } + + if (empty($views)) { + return; + } + + $this->connection->statement( + $this->grammar->compileDropAllViews($views) + ); + } + + /** + * Get all of the table names for the database. + * + * @return array + */ + public function getAllTables() + { + return $this->connection->select( + $this->grammar->compileGetAllTables() + ); + } + + /** + * Get all of the view names for the database. + * + * @return array + */ + public function getAllViews() + { + return $this->connection->select( + $this->grammar->compileGetAllViews() + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php new file mode 100755 index 00000000..76673a71 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php @@ -0,0 +1,177 @@ +parseSchemaAndTable($table); + + $table = $this->connection->getTablePrefix().$table; + + return count($this->connection->select( + $this->grammar->compileTableExists(), [$schema, $table] + )) > 0; + } + + /** + * Drop all tables from the database. + * + * @return void + */ + public function dropAllTables() + { + $tables = []; + + $excludedTables = $this->connection->getConfig('dont_drop') ?? ['spatial_ref_sys']; + + foreach ($this->getAllTables() as $row) { + $row = (array) $row; + + $table = reset($row); + + if (! in_array($table, $excludedTables)) { + $tables[] = $table; + } + } + + if (empty($tables)) { + return; + } + + $this->connection->statement( + $this->grammar->compileDropAllTables($tables) + ); + } + + /** + * Drop all views from the database. + * + * @return void + */ + public function dropAllViews() + { + $views = []; + + foreach ($this->getAllViews() as $row) { + $row = (array) $row; + + $views[] = reset($row); + } + + if (empty($views)) { + return; + } + + $this->connection->statement( + $this->grammar->compileDropAllViews($views) + ); + } + + /** + * Drop all types from the database. + * + * @return void + */ + public function dropAllTypes() + { + $types = []; + + foreach ($this->getAllTypes() as $row) { + $row = (array) $row; + + $types[] = reset($row); + } + + if (empty($types)) { + return; + } + + $this->connection->statement( + $this->grammar->compileDropAllTypes($types) + ); + } + + /** + * Get all of the table names for the database. + * + * @return array + */ + public function getAllTables() + { + return $this->connection->select( + $this->grammar->compileGetAllTables((array) $this->connection->getConfig('schema')) + ); + } + + /** + * Get all of the view names for the database. + * + * @return array + */ + public function getAllViews() + { + return $this->connection->select( + $this->grammar->compileGetAllViews((array) $this->connection->getConfig('schema')) + ); + } + + /** + * Get all of the type names for the database. + * + * @return array + */ + public function getAllTypes() + { + return $this->connection->select( + $this->grammar->compileGetAllTypes() + ); + } + + /** + * Get the column listing for a given table. + * + * @param string $table + * @return array + */ + public function getColumnListing($table) + { + [$schema, $table] = $this->parseSchemaAndTable($table); + + $table = $this->connection->getTablePrefix().$table; + + $results = $this->connection->select( + $this->grammar->compileColumnListing(), [$schema, $table] + ); + + return $this->connection->getPostProcessor()->processColumnListing($results); + } + + /** + * Parse the table name and extract the schema and table. + * + * @param string $table + * @return array + */ + protected function parseSchemaAndTable($table) + { + $table = explode('.', $table); + + if (is_array($schema = $this->connection->getConfig('schema'))) { + if (in_array($table[0], $schema)) { + return [array_shift($table), implode('.', $table)]; + } + + $schema = head($schema); + } + + return [$schema ?: 'public', implode('.', $table)]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/SQLiteBuilder.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/SQLiteBuilder.php new file mode 100644 index 00000000..78b6b9c7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/SQLiteBuilder.php @@ -0,0 +1,52 @@ +connection->getDatabaseName() !== ':memory:') { + return $this->refreshDatabaseFile(); + } + + $this->connection->select($this->grammar->compileEnableWriteableSchema()); + + $this->connection->select($this->grammar->compileDropAllTables()); + + $this->connection->select($this->grammar->compileDisableWriteableSchema()); + + $this->connection->select($this->grammar->compileRebuild()); + } + + /** + * Drop all views from the database. + * + * @return void + */ + public function dropAllViews() + { + $this->connection->select($this->grammar->compileEnableWriteableSchema()); + + $this->connection->select($this->grammar->compileDropAllViews()); + + $this->connection->select($this->grammar->compileDisableWriteableSchema()); + + $this->connection->select($this->grammar->compileRebuild()); + } + + /** + * Empty the database file. + * + * @return void + */ + public function refreshDatabaseFile() + { + file_put_contents($this->connection->getDatabaseName(), ''); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/SqlServerBuilder.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/SqlServerBuilder.php new file mode 100644 index 00000000..0b3e47be --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/SqlServerBuilder.php @@ -0,0 +1,28 @@ +connection->statement($this->grammar->compileDropAllForeignKeys()); + + $this->connection->statement($this->grammar->compileDropAllTables()); + } + + /** + * Drop all views from the database. + * + * @return void + */ + public function dropAllViews() + { + $this->connection->statement($this->grammar->compileDropAllViews()); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Seeder.php b/vendor/laravel/framework/src/Illuminate/Database/Seeder.php new file mode 100755 index 00000000..2facfd7d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Seeder.php @@ -0,0 +1,137 @@ +resolve($class); + + $name = get_class($seeder); + + if ($silent === false && isset($this->command)) { + $this->command->getOutput()->writeln("Seeding: {$name}"); + } + + $startTime = microtime(true); + + $seeder->__invoke(); + + $runTime = round(microtime(true) - $startTime, 2); + + if ($silent === false && isset($this->command)) { + $this->command->getOutput()->writeln("Seeded: {$name} ({$runTime} seconds)"); + } + } + + return $this; + } + + /** + * Silently seed the given connection from the given path. + * + * @param array|string $class + * @return void + */ + public function callSilent($class) + { + $this->call($class, true); + } + + /** + * Resolve an instance of the given seeder class. + * + * @param string $class + * @return \Illuminate\Database\Seeder + */ + protected function resolve($class) + { + if (isset($this->container)) { + $instance = $this->container->make($class); + + $instance->setContainer($this->container); + } else { + $instance = new $class; + } + + if (isset($this->command)) { + $instance->setCommand($this->command); + } + + return $instance; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Container\Container $container + * @return $this + */ + public function setContainer(Container $container) + { + $this->container = $container; + + return $this; + } + + /** + * Set the console command instance. + * + * @param \Illuminate\Console\Command $command + * @return $this + */ + public function setCommand(Command $command) + { + $this->command = $command; + + return $this; + } + + /** + * Run the database seeds. + * + * @return mixed + * + * @throws \InvalidArgumentException + */ + public function __invoke() + { + if (! method_exists($this, 'run')) { + throw new InvalidArgumentException('Method [run] missing from '.get_class($this)); + } + + return isset($this->container) + ? $this->container->call([$this, 'run']) + : $this->run(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php b/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php new file mode 100755 index 00000000..ab523576 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php @@ -0,0 +1,120 @@ +getDriverName() === 'sqlsrv') { + return parent::transaction($callback); + } + + $this->getPdo()->exec('BEGIN TRAN'); + + // We'll simply execute the given callback within a try / catch block + // and if we catch any exception we can rollback the transaction + // so that none of the changes are persisted to the database. + try { + $result = $callback($this); + + $this->getPdo()->exec('COMMIT TRAN'); + } + + // If we catch an exception, we will roll back so nothing gets messed + // up in the database. Then we'll re-throw the exception so it can + // be handled how the developer sees fit for their applications. + catch (Exception $e) { + $this->getPdo()->exec('ROLLBACK TRAN'); + + throw $e; + } catch (Throwable $e) { + $this->getPdo()->exec('ROLLBACK TRAN'); + + throw $e; + } + + return $result; + } + } + + /** + * Get the default query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\SqlServerGrammar + */ + protected function getDefaultQueryGrammar() + { + return $this->withTablePrefix(new QueryGrammar); + } + + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\SqlServerBuilder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new SqlServerBuilder($this); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\SqlServerGrammar + */ + protected function getDefaultSchemaGrammar() + { + return $this->withTablePrefix(new SchemaGrammar); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\SqlServerProcessor + */ + protected function getDefaultPostProcessor() + { + return new SqlServerProcessor; + } + + /** + * Get the Doctrine DBAL driver. + * + * @return \Doctrine\DBAL\Driver\PDOSqlsrv\Driver + */ + protected function getDoctrineDriver() + { + if (! class_exists(DoctrineDriver::class)) { + throw new LogicException( + 'Laravel v6 is only compatible with doctrine/dbal 2, in order to use this feature you must require the package "doctrine/dbal:^2.6".' + ); + } + + return new DoctrineDriver; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/composer.json b/vendor/laravel/framework/src/Illuminate/Database/composer.json new file mode 100644 index 00000000..2d658fb0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/composer.json @@ -0,0 +1,47 @@ +{ + "name": "illuminate/database", + "description": "The Illuminate Database package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "keywords": ["laravel", "database", "sql", "orm"], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "ext-json": "*", + "illuminate/container": "^6.0", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Database\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "suggest": { + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", + "illuminate/console": "Required to use the database commands (^6.0).", + "illuminate/events": "Required to use the observers with Eloquent (^6.0).", + "illuminate/filesystem": "Required to use the migrations (^6.0).", + "illuminate/pagination": "Required to paginate the result set (^6.0).", + "symfony/finder": "Required to use Eloquent model factories (^4.3.4)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php b/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php new file mode 100755 index 00000000..662cd177 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php @@ -0,0 +1,255 @@ +key = $key; + $this->cipher = $cipher; + } else { + throw new RuntimeException('The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.'); + } + } + + /** + * Determine if the given key and cipher combination is valid. + * + * @param string $key + * @param string $cipher + * @return bool + */ + public static function supported($key, $cipher) + { + $length = mb_strlen($key, '8bit'); + + return ($cipher === 'AES-128-CBC' && $length === 16) || + ($cipher === 'AES-256-CBC' && $length === 32); + } + + /** + * Create a new encryption key for the given cipher. + * + * @param string $cipher + * @return string + */ + public static function generateKey($cipher) + { + return random_bytes($cipher === 'AES-128-CBC' ? 16 : 32); + } + + /** + * Encrypt the given value. + * + * @param mixed $value + * @param bool $serialize + * @return string + * + * @throws \Illuminate\Contracts\Encryption\EncryptException + */ + public function encrypt($value, $serialize = true) + { + $iv = random_bytes(openssl_cipher_iv_length($this->cipher)); + + // First we will encrypt the value using OpenSSL. After this is encrypted we + // will proceed to calculating a MAC for the encrypted value so that this + // value can be verified later as not having been changed by the users. + $value = \openssl_encrypt( + $serialize ? serialize($value) : $value, + $this->cipher, $this->key, 0, $iv + ); + + if ($value === false) { + throw new EncryptException('Could not encrypt the data.'); + } + + // Once we get the encrypted value we'll go ahead and base64_encode the input + // vector and create the MAC for the encrypted value so we can then verify + // its authenticity. Then, we'll JSON the data into the "payload" array. + $mac = $this->hash($iv = base64_encode($iv), $value); + + $json = json_encode(compact('iv', 'value', 'mac')); + + if (json_last_error() !== JSON_ERROR_NONE) { + throw new EncryptException('Could not encrypt the data.'); + } + + return base64_encode($json); + } + + /** + * Encrypt a string without serialization. + * + * @param string $value + * @return string + * + * @throws \Illuminate\Contracts\Encryption\EncryptException + */ + public function encryptString($value) + { + return $this->encrypt($value, false); + } + + /** + * Decrypt the given value. + * + * @param string $payload + * @param bool $unserialize + * @return mixed + * + * @throws \Illuminate\Contracts\Encryption\DecryptException + */ + public function decrypt($payload, $unserialize = true) + { + $payload = $this->getJsonPayload($payload); + + $iv = base64_decode($payload['iv']); + + // Here we will decrypt the value. If we are able to successfully decrypt it + // we will then unserialize it and return it out to the caller. If we are + // unable to decrypt this value we will throw out an exception message. + $decrypted = \openssl_decrypt( + $payload['value'], $this->cipher, $this->key, 0, $iv + ); + + if ($decrypted === false) { + throw new DecryptException('Could not decrypt the data.'); + } + + return $unserialize ? unserialize($decrypted) : $decrypted; + } + + /** + * Decrypt the given string without unserialization. + * + * @param string $payload + * @return string + * + * @throws \Illuminate\Contracts\Encryption\DecryptException + */ + public function decryptString($payload) + { + return $this->decrypt($payload, false); + } + + /** + * Create a MAC for the given value. + * + * @param string $iv + * @param mixed $value + * @return string + */ + protected function hash($iv, $value) + { + return hash_hmac('sha256', $iv.$value, $this->key); + } + + /** + * Get the JSON array from the given payload. + * + * @param string $payload + * @return array + * + * @throws \Illuminate\Contracts\Encryption\DecryptException + */ + protected function getJsonPayload($payload) + { + $payload = json_decode(base64_decode($payload), true); + + // If the payload is not valid JSON or does not have the proper keys set we will + // assume it is invalid and bail out of the routine since we will not be able + // to decrypt the given value. We'll also check the MAC for this encryption. + if (! $this->validPayload($payload)) { + throw new DecryptException('The payload is invalid.'); + } + + if (! $this->validMac($payload)) { + throw new DecryptException('The MAC is invalid.'); + } + + return $payload; + } + + /** + * Verify that the encryption payload is valid. + * + * @param mixed $payload + * @return bool + */ + protected function validPayload($payload) + { + return is_array($payload) && isset($payload['iv'], $payload['value'], $payload['mac']) && + strlen(base64_decode($payload['iv'], true)) === openssl_cipher_iv_length($this->cipher); + } + + /** + * Determine if the MAC for the given payload is valid. + * + * @param array $payload + * @return bool + */ + protected function validMac(array $payload) + { + $calculated = $this->calculateMac($payload, $bytes = random_bytes(16)); + + return hash_equals( + hash_hmac('sha256', $payload['mac'], $bytes, true), $calculated + ); + } + + /** + * Calculate the hash of the given payload. + * + * @param array $payload + * @param string $bytes + * @return string + */ + protected function calculateMac($payload, $bytes) + { + return hash_hmac( + 'sha256', $this->hash($payload['iv'], $payload['value']), $bytes, true + ); + } + + /** + * Get the encryption key. + * + * @return string + */ + public function getKey() + { + return $this->key; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php new file mode 100755 index 00000000..cd590f12 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php @@ -0,0 +1,86 @@ +registerEncrypter(); + $this->registerOpisSecurityKey(); + } + + /** + * Register the encrypter. + * + * @return void + */ + protected function registerEncrypter() + { + $this->app->singleton('encrypter', function ($app) { + $config = $app->make('config')->get('app'); + + return new Encrypter($this->parseKey($config), $config['cipher']); + }); + } + + /** + * Configure Opis Closure signing for security. + * + * @return void + */ + protected function registerOpisSecurityKey() + { + $config = $this->app->make('config')->get('app'); + + if (! class_exists(SerializableClosure::class) || empty($config['key'])) { + return; + } + + SerializableClosure::setSecretKey($this->parseKey($config)); + } + + /** + * Parse the encryption key. + * + * @param array $config + * @return string + */ + protected function parseKey(array $config) + { + if (Str::startsWith($key = $this->key($config), $prefix = 'base64:')) { + $key = base64_decode(Str::after($key, $prefix)); + } + + return $key; + } + + /** + * Extract the encryption key from the given configuration. + * + * @param array $config + * @return string + * + * @throws \RuntimeException + */ + protected function key(array $config) + { + return tap($config['key'], function ($key) { + if (empty($key)) { + throw new RuntimeException( + 'No application encryption key has been specified.' + ); + } + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Encryption/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Encryption/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Encryption/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Encryption/composer.json b/vendor/laravel/framework/src/Illuminate/Encryption/composer.json new file mode 100644 index 00000000..cc0b3e34 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Encryption/composer.json @@ -0,0 +1,38 @@ +{ + "name": "illuminate/encryption", + "description": "The Illuminate Encryption package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Encryption\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php b/vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php new file mode 100644 index 00000000..c7fc821d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php @@ -0,0 +1,165 @@ +data = $data; + $this->class = $class; + $this->method = $method; + } + + /** + * Handle the queued job. + * + * @param \Illuminate\Container\Container $container + * @return void + */ + public function handle(Container $container) + { + $this->prepareData(); + + $handler = $this->setJobInstanceIfNecessary( + $this->job, $container->make($this->class) + ); + + $handler->{$this->method}(...array_values($this->data)); + } + + /** + * Set the job instance of the given class if necessary. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param object $instance + * @return object + */ + protected function setJobInstanceIfNecessary(Job $job, $instance) + { + if (in_array(InteractsWithQueue::class, class_uses_recursive($instance))) { + $instance->setJob($job); + } + + return $instance; + } + + /** + * Call the failed method on the job instance. + * + * The event instance and the exception will be passed. + * + * @param \Exception $e + * @return void + */ + public function failed($e) + { + $this->prepareData(); + + $handler = Container::getInstance()->make($this->class); + + $parameters = array_merge(array_values($this->data), [$e]); + + if (method_exists($handler, 'failed')) { + $handler->failed(...$parameters); + } + } + + /** + * Unserialize the data if needed. + * + * @return void + */ + protected function prepareData() + { + if (is_string($this->data)) { + $this->data = unserialize($this->data); + } + } + + /** + * Get the display name for the queued job. + * + * @return string + */ + public function displayName() + { + return $this->class; + } + + /** + * Prepare the instance for cloning. + * + * @return void + */ + public function __clone() + { + $this->data = array_map(function ($data) { + return is_object($data) ? clone $data : $data; + }, $this->data); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php b/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php new file mode 100755 index 00000000..eb25f5c6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php @@ -0,0 +1,591 @@ +container = $container ?: new Container; + } + + /** + * Register an event listener with the dispatcher. + * + * @param string|array $events + * @param \Closure|string $listener + * @return void + */ + public function listen($events, $listener) + { + foreach ((array) $events as $event) { + if (Str::contains($event, '*')) { + $this->setupWildcardListen($event, $listener); + } else { + $this->listeners[$event][] = $this->makeListener($listener); + } + } + } + + /** + * Setup a wildcard listener callback. + * + * @param string $event + * @param \Closure|string $listener + * @return void + */ + protected function setupWildcardListen($event, $listener) + { + $this->wildcards[$event][] = $this->makeListener($listener, true); + + $this->wildcardsCache = []; + } + + /** + * Determine if a given event has listeners. + * + * @param string $eventName + * @return bool + */ + public function hasListeners($eventName) + { + return isset($this->listeners[$eventName]) || + isset($this->wildcards[$eventName]) || + $this->hasWildcardListeners($eventName); + } + + /** + * Determine if the given event has any wildcard listeners. + * + * @param string $eventName + * @return bool + */ + public function hasWildcardListeners($eventName) + { + foreach ($this->wildcards as $key => $listeners) { + if (Str::is($key, $eventName)) { + return true; + } + } + + return false; + } + + /** + * Register an event and payload to be fired later. + * + * @param string $event + * @param array $payload + * @return void + */ + public function push($event, $payload = []) + { + $this->listen($event.'_pushed', function () use ($event, $payload) { + $this->dispatch($event, $payload); + }); + } + + /** + * Flush a set of pushed events. + * + * @param string $event + * @return void + */ + public function flush($event) + { + $this->dispatch($event.'_pushed'); + } + + /** + * Register an event subscriber with the dispatcher. + * + * @param object|string $subscriber + * @return void + */ + public function subscribe($subscriber) + { + $subscriber = $this->resolveSubscriber($subscriber); + + $subscriber->subscribe($this); + } + + /** + * Resolve the subscriber instance. + * + * @param object|string $subscriber + * @return mixed + */ + protected function resolveSubscriber($subscriber) + { + if (is_string($subscriber)) { + return $this->container->make($subscriber); + } + + return $subscriber; + } + + /** + * Fire an event until the first non-null response is returned. + * + * @param string|object $event + * @param mixed $payload + * @return array|null + */ + public function until($event, $payload = []) + { + return $this->dispatch($event, $payload, true); + } + + /** + * Fire an event and call the listeners. + * + * @param string|object $event + * @param mixed $payload + * @param bool $halt + * @return array|null + */ + public function dispatch($event, $payload = [], $halt = false) + { + // When the given "event" is actually an object we will assume it is an event + // object and use the class as the event name and this event itself as the + // payload to the handler, which makes object based events quite simple. + [$event, $payload] = $this->parseEventAndPayload( + $event, $payload + ); + + if ($this->shouldBroadcast($payload)) { + $this->broadcastEvent($payload[0]); + } + + $responses = []; + + foreach ($this->getListeners($event) as $listener) { + $response = $listener($event, $payload); + + // If a response is returned from the listener and event halting is enabled + // we will just return this response, and not call the rest of the event + // listeners. Otherwise we will add the response on the response list. + if ($halt && ! is_null($response)) { + return $response; + } + + // If a boolean false is returned from a listener, we will stop propagating + // the event to any further listeners down in the chain, else we keep on + // looping through the listeners and firing every one in our sequence. + if ($response === false) { + break; + } + + $responses[] = $response; + } + + return $halt ? null : $responses; + } + + /** + * Parse the given event and payload and prepare them for dispatching. + * + * @param mixed $event + * @param mixed $payload + * @return array + */ + protected function parseEventAndPayload($event, $payload) + { + if (is_object($event)) { + [$payload, $event] = [[$event], get_class($event)]; + } + + return [$event, Arr::wrap($payload)]; + } + + /** + * Determine if the payload has a broadcastable event. + * + * @param array $payload + * @return bool + */ + protected function shouldBroadcast(array $payload) + { + return isset($payload[0]) && + $payload[0] instanceof ShouldBroadcast && + $this->broadcastWhen($payload[0]); + } + + /** + * Check if event should be broadcasted by condition. + * + * @param mixed $event + * @return bool + */ + protected function broadcastWhen($event) + { + return method_exists($event, 'broadcastWhen') + ? $event->broadcastWhen() : true; + } + + /** + * Broadcast the given event class. + * + * @param \Illuminate\Contracts\Broadcasting\ShouldBroadcast $event + * @return void + */ + protected function broadcastEvent($event) + { + $this->container->make(BroadcastFactory::class)->queue($event); + } + + /** + * Get all of the listeners for a given event name. + * + * @param string $eventName + * @return array + */ + public function getListeners($eventName) + { + $listeners = $this->listeners[$eventName] ?? []; + + $listeners = array_merge( + $listeners, + $this->wildcardsCache[$eventName] ?? $this->getWildcardListeners($eventName) + ); + + return class_exists($eventName, false) + ? $this->addInterfaceListeners($eventName, $listeners) + : $listeners; + } + + /** + * Get the wildcard listeners for the event. + * + * @param string $eventName + * @return array + */ + protected function getWildcardListeners($eventName) + { + $wildcards = []; + + foreach ($this->wildcards as $key => $listeners) { + if (Str::is($key, $eventName)) { + $wildcards = array_merge($wildcards, $listeners); + } + } + + return $this->wildcardsCache[$eventName] = $wildcards; + } + + /** + * Add the listeners for the event's interfaces to the given array. + * + * @param string $eventName + * @param array $listeners + * @return array + */ + protected function addInterfaceListeners($eventName, array $listeners = []) + { + foreach (class_implements($eventName) as $interface) { + if (isset($this->listeners[$interface])) { + foreach ($this->listeners[$interface] as $names) { + $listeners = array_merge($listeners, (array) $names); + } + } + } + + return $listeners; + } + + /** + * Register an event listener with the dispatcher. + * + * @param \Closure|string $listener + * @param bool $wildcard + * @return \Closure + */ + public function makeListener($listener, $wildcard = false) + { + if (is_string($listener)) { + return $this->createClassListener($listener, $wildcard); + } + + return function ($event, $payload) use ($listener, $wildcard) { + if ($wildcard) { + return $listener($event, $payload); + } + + return $listener(...array_values($payload)); + }; + } + + /** + * Create a class based listener using the IoC container. + * + * @param string $listener + * @param bool $wildcard + * @return \Closure + */ + public function createClassListener($listener, $wildcard = false) + { + return function ($event, $payload) use ($listener, $wildcard) { + if ($wildcard) { + return call_user_func($this->createClassCallable($listener), $event, $payload); + } + + $callable = $this->createClassCallable($listener); + + return $callable(...array_values($payload)); + }; + } + + /** + * Create the class based event callable. + * + * @param string $listener + * @return callable + */ + protected function createClassCallable($listener) + { + [$class, $method] = $this->parseClassCallable($listener); + + if ($this->handlerShouldBeQueued($class)) { + return $this->createQueuedHandlerCallable($class, $method); + } + + return [$this->container->make($class), $method]; + } + + /** + * Parse the class listener into class and method. + * + * @param string $listener + * @return array + */ + protected function parseClassCallable($listener) + { + return Str::parseCallback($listener, 'handle'); + } + + /** + * Determine if the event handler class should be queued. + * + * @param string $class + * @return bool + */ + protected function handlerShouldBeQueued($class) + { + try { + return (new ReflectionClass($class))->implementsInterface( + ShouldQueue::class + ); + } catch (Exception $e) { + return false; + } + } + + /** + * Create a callable for putting an event handler on the queue. + * + * @param string $class + * @param string $method + * @return \Closure + */ + protected function createQueuedHandlerCallable($class, $method) + { + return function () use ($class, $method) { + $arguments = array_map(function ($a) { + return is_object($a) ? clone $a : $a; + }, func_get_args()); + + if ($this->handlerWantsToBeQueued($class, $arguments)) { + $this->queueHandler($class, $method, $arguments); + } + }; + } + + /** + * Determine if the event handler wants to be queued. + * + * @param string $class + * @param array $arguments + * @return bool + */ + protected function handlerWantsToBeQueued($class, $arguments) + { + $instance = $this->container->make($class); + + if (method_exists($instance, 'shouldQueue')) { + return $instance->shouldQueue($arguments[0]); + } + + return true; + } + + /** + * Queue the handler class. + * + * @param string $class + * @param string $method + * @param array $arguments + * @return void + */ + protected function queueHandler($class, $method, $arguments) + { + [$listener, $job] = $this->createListenerAndJob($class, $method, $arguments); + + $connection = $this->resolveQueue()->connection( + $listener->connection ?? null + ); + + $queue = $listener->queue ?? null; + + isset($listener->delay) + ? $connection->laterOn($queue, $listener->delay, $job) + : $connection->pushOn($queue, $job); + } + + /** + * Create the listener and job for a queued listener. + * + * @param string $class + * @param string $method + * @param array $arguments + * @return array + */ + protected function createListenerAndJob($class, $method, $arguments) + { + $listener = (new ReflectionClass($class))->newInstanceWithoutConstructor(); + + return [$listener, $this->propagateListenerOptions( + $listener, new CallQueuedListener($class, $method, $arguments) + )]; + } + + /** + * Propagate listener options to the job. + * + * @param mixed $listener + * @param mixed $job + * @return mixed + */ + protected function propagateListenerOptions($listener, $job) + { + return tap($job, function ($job) use ($listener) { + $job->tries = $listener->tries ?? null; + $job->retryAfter = $listener->retryAfter ?? null; + $job->timeout = $listener->timeout ?? null; + $job->timeoutAt = method_exists($listener, 'retryUntil') + ? $listener->retryUntil() : null; + }); + } + + /** + * Remove a set of listeners from the dispatcher. + * + * @param string $event + * @return void + */ + public function forget($event) + { + if (Str::contains($event, '*')) { + unset($this->wildcards[$event]); + } else { + unset($this->listeners[$event]); + } + + foreach ($this->wildcardsCache as $key => $listeners) { + if (Str::is($event, $key)) { + unset($this->wildcardsCache[$key]); + } + } + } + + /** + * Forget all of the pushed listeners. + * + * @return void + */ + public function forgetPushed() + { + foreach ($this->listeners as $key => $value) { + if (Str::endsWith($key, '_pushed')) { + $this->forget($key); + } + } + } + + /** + * Get the queue implementation from the resolver. + * + * @return \Illuminate\Contracts\Queue\Factory + */ + protected function resolveQueue() + { + return call_user_func($this->queueResolver); + } + + /** + * Set the queue resolver implementation. + * + * @param callable $resolver + * @return $this + */ + public function setQueueResolver(callable $resolver) + { + $this->queueResolver = $resolver; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php new file mode 100755 index 00000000..15fb60b1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php @@ -0,0 +1,23 @@ +app->singleton('events', function ($app) { + return (new Dispatcher($app))->setQueueResolver(function () use ($app) { + return $app->make(QueueFactoryContract::class); + }); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Events/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Events/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Events/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Events/NullDispatcher.php b/vendor/laravel/framework/src/Illuminate/Events/NullDispatcher.php new file mode 100644 index 00000000..793ef1e1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Events/NullDispatcher.php @@ -0,0 +1,141 @@ +dispatcher = $dispatcher; + } + + /** + * Don't fire an event. + * + * @param string|object $event + * @param mixed $payload + * @param bool $halt + * @return void + */ + public function dispatch($event, $payload = [], $halt = false) + { + } + + /** + * Don't register an event and payload to be fired later. + * + * @param string $event + * @param array $payload + * @return void + */ + public function push($event, $payload = []) + { + } + + /** + * Don't dispatch an event. + * + * @param string|object $event + * @param mixed $payload + * @return array|null + */ + public function until($event, $payload = []) + { + } + + /** + * Register an event listener with the dispatcher. + * + * @param string|array $events + * @param \Closure|string $listener + * @return void + */ + public function listen($events, $listener) + { + $this->dispatcher->listen($events, $listener); + } + + /** + * Determine if a given event has listeners. + * + * @param string $eventName + * @return bool + */ + public function hasListeners($eventName) + { + return $this->dispatcher->hasListeners($eventName); + } + + /** + * Register an event subscriber with the dispatcher. + * + * @param object|string $subscriber + * @return void + */ + public function subscribe($subscriber) + { + $this->dispatcher->subscribe($subscriber); + } + + /** + * Flush a set of pushed events. + * + * @param string $event + * @return void + */ + public function flush($event) + { + $this->dispatcher->flush($event); + } + + /** + * Remove a set of listeners from the dispatcher. + * + * @param string $event + * @return void + */ + public function forget($event) + { + $this->dispatcher->forget($event); + } + + /** + * Forget all of the queued listeners. + * + * @return void + */ + public function forgetPushed() + { + $this->dispatcher->forgetPushed(); + } + + /** + * Dynamically pass method calls to the underlying dispatcher. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->forwardCallTo($this->dispatcher, $method, $parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Events/composer.json b/vendor/laravel/framework/src/Illuminate/Events/composer.json new file mode 100755 index 00000000..9dd481dc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Events/composer.json @@ -0,0 +1,36 @@ +{ + "name": "illuminate/events", + "description": "The Illuminate Events package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/container": "^6.0", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Events\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/Cache.php b/vendor/laravel/framework/src/Illuminate/Filesystem/Cache.php new file mode 100644 index 00000000..8ae2486d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/Cache.php @@ -0,0 +1,71 @@ +key = $key; + $this->expire = $expire; + $this->repository = $repository; + } + + /** + * Load the cache. + * + * @return void + */ + public function load() + { + $contents = $this->repository->get($this->key); + + if (! is_null($contents)) { + $this->setFromStorage($contents); + } + } + + /** + * Persist the cache. + * + * @return void + */ + public function save() + { + $contents = $this->getForStorage(); + + $this->repository->put($this->key, $contents, $this->expire); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php b/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php new file mode 100644 index 00000000..b7459f77 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php @@ -0,0 +1,635 @@ +exists($path); + } + + /** + * Get the contents of a file. + * + * @param string $path + * @param bool $lock + * @return string + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function get($path, $lock = false) + { + if ($this->isFile($path)) { + return $lock ? $this->sharedGet($path) : file_get_contents($path); + } + + throw new FileNotFoundException("File does not exist at path {$path}"); + } + + /** + * Get contents of a file with shared access. + * + * @param string $path + * @return string + */ + public function sharedGet($path) + { + $contents = ''; + + $handle = fopen($path, 'rb'); + + if ($handle) { + try { + if (flock($handle, LOCK_SH)) { + clearstatcache(true, $path); + + $contents = fread($handle, $this->size($path) ?: 1); + + flock($handle, LOCK_UN); + } + } finally { + fclose($handle); + } + } + + return $contents; + } + + /** + * Get the returned value of a file. + * + * @param string $path + * @return mixed + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function getRequire($path) + { + if ($this->isFile($path)) { + return require $path; + } + + throw new FileNotFoundException("File does not exist at path {$path}"); + } + + /** + * Require the given file once. + * + * @param string $file + * @return mixed + */ + public function requireOnce($file) + { + require_once $file; + } + + /** + * Get the MD5 hash of the file at the given path. + * + * @param string $path + * @return string + */ + public function hash($path) + { + return md5_file($path); + } + + /** + * Write the contents of a file. + * + * @param string $path + * @param string $contents + * @param bool $lock + * @return int|bool + */ + public function put($path, $contents, $lock = false) + { + return file_put_contents($path, $contents, $lock ? LOCK_EX : 0); + } + + /** + * Write the contents of a file, replacing it atomically if it already exists. + * + * @param string $path + * @param string $content + * @return void + */ + public function replace($path, $content) + { + // If the path already exists and is a symlink, get the real path... + clearstatcache(true, $path); + + $path = realpath($path) ?: $path; + + $tempPath = tempnam(dirname($path), basename($path)); + + // Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600... + chmod($tempPath, 0777 - umask()); + + file_put_contents($tempPath, $content); + + rename($tempPath, $path); + } + + /** + * Prepend to a file. + * + * @param string $path + * @param string $data + * @return int + */ + public function prepend($path, $data) + { + if ($this->exists($path)) { + return $this->put($path, $data.$this->get($path)); + } + + return $this->put($path, $data); + } + + /** + * Append to a file. + * + * @param string $path + * @param string $data + * @return int + */ + public function append($path, $data) + { + return file_put_contents($path, $data, FILE_APPEND); + } + + /** + * Get or set UNIX mode of a file or directory. + * + * @param string $path + * @param int|null $mode + * @return mixed + */ + public function chmod($path, $mode = null) + { + if ($mode) { + return chmod($path, $mode); + } + + return substr(sprintf('%o', fileperms($path)), -4); + } + + /** + * Delete the file at a given path. + * + * @param string|array $paths + * @return bool + */ + public function delete($paths) + { + $paths = is_array($paths) ? $paths : func_get_args(); + + $success = true; + + foreach ($paths as $path) { + try { + if (! @unlink($path)) { + $success = false; + } + } catch (ErrorException $e) { + $success = false; + } + } + + return $success; + } + + /** + * Move a file to a new location. + * + * @param string $path + * @param string $target + * @return bool + */ + public function move($path, $target) + { + return rename($path, $target); + } + + /** + * Copy a file to a new location. + * + * @param string $path + * @param string $target + * @return bool + */ + public function copy($path, $target) + { + return copy($path, $target); + } + + /** + * Create a symlink to the target file or directory. On Windows, a hard link is created if the target is a file. + * + * @param string $target + * @param string $link + * @return void + */ + public function link($target, $link) + { + if (! windows_os()) { + return symlink($target, $link); + } + + $mode = $this->isDirectory($target) ? 'J' : 'H'; + + exec("mklink /{$mode} ".escapeshellarg($link).' '.escapeshellarg($target)); + } + + /** + * Extract the file name from a file path. + * + * @param string $path + * @return string + */ + public function name($path) + { + return pathinfo($path, PATHINFO_FILENAME); + } + + /** + * Extract the trailing name component from a file path. + * + * @param string $path + * @return string + */ + public function basename($path) + { + return pathinfo($path, PATHINFO_BASENAME); + } + + /** + * Extract the parent directory from a file path. + * + * @param string $path + * @return string + */ + public function dirname($path) + { + return pathinfo($path, PATHINFO_DIRNAME); + } + + /** + * Extract the file extension from a file path. + * + * @param string $path + * @return string + */ + public function extension($path) + { + return pathinfo($path, PATHINFO_EXTENSION); + } + + /** + * Get the file type of a given file. + * + * @param string $path + * @return string + */ + public function type($path) + { + return filetype($path); + } + + /** + * Get the mime-type of a given file. + * + * @param string $path + * @return string|false + */ + public function mimeType($path) + { + return finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path); + } + + /** + * Get the file size of a given file. + * + * @param string $path + * @return int + */ + public function size($path) + { + return filesize($path); + } + + /** + * Get the file's last modification time. + * + * @param string $path + * @return int + */ + public function lastModified($path) + { + return filemtime($path); + } + + /** + * Determine if the given path is a directory. + * + * @param string $directory + * @return bool + */ + public function isDirectory($directory) + { + return is_dir($directory); + } + + /** + * Determine if the given path is readable. + * + * @param string $path + * @return bool + */ + public function isReadable($path) + { + return is_readable($path); + } + + /** + * Determine if the given path is writable. + * + * @param string $path + * @return bool + */ + public function isWritable($path) + { + return is_writable($path); + } + + /** + * Determine if the given path is a file. + * + * @param string $file + * @return bool + */ + public function isFile($file) + { + return is_file($file); + } + + /** + * Find path names matching a given pattern. + * + * @param string $pattern + * @param int $flags + * @return array + */ + public function glob($pattern, $flags = 0) + { + return glob($pattern, $flags); + } + + /** + * Get an array of all files in a directory. + * + * @param string $directory + * @param bool $hidden + * @return \Symfony\Component\Finder\SplFileInfo[] + */ + public function files($directory, $hidden = false) + { + return iterator_to_array( + Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->depth(0)->sortByName(), + false + ); + } + + /** + * Get all of the files from the given directory (recursive). + * + * @param string $directory + * @param bool $hidden + * @return \Symfony\Component\Finder\SplFileInfo[] + */ + public function allFiles($directory, $hidden = false) + { + return iterator_to_array( + Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->sortByName(), + false + ); + } + + /** + * Get all of the directories within a given directory. + * + * @param string $directory + * @return array + */ + public function directories($directory) + { + $directories = []; + + foreach (Finder::create()->in($directory)->directories()->depth(0)->sortByName() as $dir) { + $directories[] = $dir->getPathname(); + } + + return $directories; + } + + /** + * Ensure a directory exists. + * + * @param string $path + * @param int $mode + * @param bool $recursive + * @return void + */ + public function ensureDirectoryExists($path, $mode = 0755, $recursive = true) + { + if (! $this->isDirectory($path)) { + $this->makeDirectory($path, $mode, $recursive); + } + } + + /** + * Create a directory. + * + * @param string $path + * @param int $mode + * @param bool $recursive + * @param bool $force + * @return bool + */ + public function makeDirectory($path, $mode = 0755, $recursive = false, $force = false) + { + if ($force) { + return @mkdir($path, $mode, $recursive); + } + + return mkdir($path, $mode, $recursive); + } + + /** + * Move a directory. + * + * @param string $from + * @param string $to + * @param bool $overwrite + * @return bool + */ + public function moveDirectory($from, $to, $overwrite = false) + { + if ($overwrite && $this->isDirectory($to) && ! $this->deleteDirectory($to)) { + return false; + } + + return @rename($from, $to) === true; + } + + /** + * Copy a directory from one location to another. + * + * @param string $directory + * @param string $destination + * @param int|null $options + * @return bool + */ + public function copyDirectory($directory, $destination, $options = null) + { + if (! $this->isDirectory($directory)) { + return false; + } + + $options = $options ?: FilesystemIterator::SKIP_DOTS; + + // If the destination directory does not actually exist, we will go ahead and + // create it recursively, which just gets the destination prepared to copy + // the files over. Once we make the directory we'll proceed the copying. + if (! $this->isDirectory($destination)) { + $this->makeDirectory($destination, 0777, true); + } + + $items = new FilesystemIterator($directory, $options); + + foreach ($items as $item) { + // As we spin through items, we will check to see if the current file is actually + // a directory or a file. When it is actually a directory we will need to call + // back into this function recursively to keep copying these nested folders. + $target = $destination.'/'.$item->getBasename(); + + if ($item->isDir()) { + $path = $item->getPathname(); + + if (! $this->copyDirectory($path, $target, $options)) { + return false; + } + } + + // If the current items is just a regular file, we will just copy this to the new + // location and keep looping. If for some reason the copy fails we'll bail out + // and return false, so the developer is aware that the copy process failed. + else { + if (! $this->copy($item->getPathname(), $target)) { + return false; + } + } + } + + return true; + } + + /** + * Recursively delete a directory. + * + * The directory itself may be optionally preserved. + * + * @param string $directory + * @param bool $preserve + * @return bool + */ + public function deleteDirectory($directory, $preserve = false) + { + if (! $this->isDirectory($directory)) { + return false; + } + + $items = new FilesystemIterator($directory); + + foreach ($items as $item) { + // If the item is a directory, we can just recurse into the function and + // delete that sub-directory otherwise we'll just delete the file and + // keep iterating through each file until the directory is cleaned. + if ($item->isDir() && ! $item->isLink()) { + $this->deleteDirectory($item->getPathname()); + } + + // If the item is just a file, we can go ahead and delete it since we're + // just looping through and waxing all of the files in this directory + // and calling directories recursively, so we delete the real path. + else { + $this->delete($item->getPathname()); + } + } + + if (! $preserve) { + @rmdir($directory); + } + + return true; + } + + /** + * Remove all of the directories within a given directory. + * + * @param string $directory + * @return bool + */ + public function deleteDirectories($directory) + { + $allDirectories = $this->directories($directory); + + if (! empty($allDirectories)) { + foreach ($allDirectories as $directoryName) { + $this->deleteDirectory($directoryName); + } + + return true; + } + + return false; + } + + /** + * Empty the specified directory of all files and folders. + * + * @param string $directory + * @return bool + */ + public function cleanDirectory($directory) + { + return $this->deleteDirectory($directory, true); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php new file mode 100644 index 00000000..e4b917c0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php @@ -0,0 +1,744 @@ +driver = $driver; + } + + /** + * Assert that the given file exists. + * + * @param string|array $path + * @return $this + */ + public function assertExists($path) + { + $paths = Arr::wrap($path); + + foreach ($paths as $path) { + PHPUnit::assertTrue( + $this->exists($path), "Unable to find a file at path [{$path}]." + ); + } + + return $this; + } + + /** + * Assert that the given file does not exist. + * + * @param string|array $path + * @return $this + */ + public function assertMissing($path) + { + $paths = Arr::wrap($path); + + foreach ($paths as $path) { + PHPUnit::assertFalse( + $this->exists($path), "Found unexpected file at path [{$path}]." + ); + } + + return $this; + } + + /** + * Determine if a file exists. + * + * @param string $path + * @return bool + */ + public function exists($path) + { + return $this->driver->has($path); + } + + /** + * Determine if a file or directory is missing. + * + * @param string $path + * @return bool + */ + public function missing($path) + { + return ! $this->exists($path); + } + + /** + * Get the full path for the file at the given "short" path. + * + * @param string $path + * @return string + */ + public function path($path) + { + return $this->driver->getAdapter()->getPathPrefix().$path; + } + + /** + * Get the contents of a file. + * + * @param string $path + * @return string + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function get($path) + { + try { + return $this->driver->read($path); + } catch (FileNotFoundException $e) { + throw new ContractFileNotFoundException($e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Create a streamed response for a given file. + * + * @param string $path + * @param string|null $name + * @param array|null $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function response($path, $name = null, array $headers = [], $disposition = 'inline') + { + $response = new StreamedResponse; + + $filename = $name ?? basename($path); + + $disposition = $response->headers->makeDisposition( + $disposition, $filename, $this->fallbackName($filename) + ); + + $response->headers->replace($headers + [ + 'Content-Type' => $this->mimeType($path), + 'Content-Length' => $this->size($path), + 'Content-Disposition' => $disposition, + ]); + + $response->setCallback(function () use ($path) { + $stream = $this->readStream($path); + fpassthru($stream); + fclose($stream); + }); + + return $response; + } + + /** + * Create a streamed download response for a given file. + * + * @param string $path + * @param string|null $name + * @param array|null $headers + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function download($path, $name = null, array $headers = []) + { + return $this->response($path, $name, $headers, 'attachment'); + } + + /** + * Convert the string to ASCII characters that are equivalent to the given name. + * + * @param string $name + * @return string + */ + protected function fallbackName($name) + { + return str_replace('%', '', Str::ascii($name)); + } + + /** + * Write the contents of a file. + * + * @param string $path + * @param string|resource $contents + * @param mixed $options + * @return bool + */ + public function put($path, $contents, $options = []) + { + $options = is_string($options) + ? ['visibility' => $options] + : (array) $options; + + // If the given contents is actually a file or uploaded file instance than we will + // automatically store the file using a stream. This provides a convenient path + // for the developer to store streams without managing them manually in code. + if ($contents instanceof File || + $contents instanceof UploadedFile) { + return $this->putFile($path, $contents, $options); + } + + if ($contents instanceof StreamInterface) { + return $this->driver->putStream($path, $contents->detach(), $options); + } + + return is_resource($contents) + ? $this->driver->putStream($path, $contents, $options) + : $this->driver->put($path, $contents, $options); + } + + /** + * Store the uploaded file on the disk. + * + * @param string $path + * @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file + * @param mixed $options + * @return string|false + */ + public function putFile($path, $file, $options = []) + { + $file = is_string($file) ? new File($file) : $file; + + return $this->putFileAs($path, $file, $file->hashName(), $options); + } + + /** + * Store the uploaded file on the disk with a given name. + * + * @param string $path + * @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file + * @param string $name + * @param mixed $options + * @return string|false + */ + public function putFileAs($path, $file, $name, $options = []) + { + $stream = fopen(is_string($file) ? $file : $file->getRealPath(), 'r'); + + // Next, we will format the path of the file and store the file using a stream since + // they provide better performance than alternatives. Once we write the file this + // stream will get closed automatically by us so the developer doesn't have to. + $result = $this->put( + $path = trim($path.'/'.$name, '/'), $stream, $options + ); + + if (is_resource($stream)) { + fclose($stream); + } + + return $result ? $path : false; + } + + /** + * Get the visibility for the given path. + * + * @param string $path + * @return string + */ + public function getVisibility($path) + { + if ($this->driver->getVisibility($path) == AdapterInterface::VISIBILITY_PUBLIC) { + return FilesystemContract::VISIBILITY_PUBLIC; + } + + return FilesystemContract::VISIBILITY_PRIVATE; + } + + /** + * Set the visibility for the given path. + * + * @param string $path + * @param string $visibility + * @return bool + */ + public function setVisibility($path, $visibility) + { + return $this->driver->setVisibility($path, $this->parseVisibility($visibility)); + } + + /** + * Prepend to a file. + * + * @param string $path + * @param string $data + * @param string $separator + * @return bool + */ + public function prepend($path, $data, $separator = PHP_EOL) + { + if ($this->exists($path)) { + return $this->put($path, $data.$separator.$this->get($path)); + } + + return $this->put($path, $data); + } + + /** + * Append to a file. + * + * @param string $path + * @param string $data + * @param string $separator + * @return bool + */ + public function append($path, $data, $separator = PHP_EOL) + { + if ($this->exists($path)) { + return $this->put($path, $this->get($path).$separator.$data); + } + + return $this->put($path, $data); + } + + /** + * Delete the file at a given path. + * + * @param string|array $paths + * @return bool + */ + public function delete($paths) + { + $paths = is_array($paths) ? $paths : func_get_args(); + + $success = true; + + foreach ($paths as $path) { + try { + if (! $this->driver->delete($path)) { + $success = false; + } + } catch (FileNotFoundException $e) { + $success = false; + } + } + + return $success; + } + + /** + * Copy a file to a new location. + * + * @param string $from + * @param string $to + * @return bool + */ + public function copy($from, $to) + { + return $this->driver->copy($from, $to); + } + + /** + * Move a file to a new location. + * + * @param string $from + * @param string $to + * @return bool + */ + public function move($from, $to) + { + return $this->driver->rename($from, $to); + } + + /** + * Get the file size of a given file. + * + * @param string $path + * @return int + */ + public function size($path) + { + return $this->driver->getSize($path); + } + + /** + * Get the mime-type of a given file. + * + * @param string $path + * @return string|false + */ + public function mimeType($path) + { + return $this->driver->getMimetype($path); + } + + /** + * Get the file's last modification time. + * + * @param string $path + * @return int + */ + public function lastModified($path) + { + return $this->driver->getTimestamp($path); + } + + /** + * Get the URL for the file at the given path. + * + * @param string $path + * @return string + * + * @throws \RuntimeException + */ + public function url($path) + { + $adapter = $this->driver->getAdapter(); + + if ($adapter instanceof CachedAdapter) { + $adapter = $adapter->getAdapter(); + } + + if (method_exists($adapter, 'getUrl')) { + return $adapter->getUrl($path); + } elseif (method_exists($this->driver, 'getUrl')) { + return $this->driver->getUrl($path); + } elseif ($adapter instanceof AwsS3Adapter) { + return $this->getAwsUrl($adapter, $path); + } elseif ($adapter instanceof Ftp) { + return $this->getFtpUrl($path); + } elseif ($adapter instanceof LocalAdapter) { + return $this->getLocalUrl($path); + } else { + throw new RuntimeException('This driver does not support retrieving URLs.'); + } + } + + /** + * {@inheritdoc} + */ + public function readStream($path) + { + try { + return $this->driver->readStream($path) ?: null; + } catch (FileNotFoundException $e) { + throw new ContractFileNotFoundException($e->getMessage(), $e->getCode(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function writeStream($path, $resource, array $options = []) + { + try { + return $this->driver->writeStream($path, $resource, $options); + } catch (FileExistsException $e) { + throw new ContractFileExistsException($e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Get the URL for the file at the given path. + * + * @param \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter + * @param string $path + * @return string + */ + protected function getAwsUrl($adapter, $path) + { + // If an explicit base URL has been set on the disk configuration then we will use + // it as the base URL instead of the default path. This allows the developer to + // have full control over the base path for this filesystem's generated URLs. + if (! is_null($url = $this->driver->getConfig()->get('url'))) { + return $this->concatPathToUrl($url, $adapter->getPathPrefix().$path); + } + + return $adapter->getClient()->getObjectUrl( + $adapter->getBucket(), $adapter->getPathPrefix().$path + ); + } + + /** + * Get the URL for the file at the given path. + * + * @param string $path + * @return string + */ + protected function getFtpUrl($path) + { + $config = $this->driver->getConfig(); + + return $config->has('url') + ? $this->concatPathToUrl($config->get('url'), $path) + : $path; + } + + /** + * Get the URL for the file at the given path. + * + * @param string $path + * @return string + */ + protected function getLocalUrl($path) + { + $config = $this->driver->getConfig(); + + // If an explicit base URL has been set on the disk configuration then we will use + // it as the base URL instead of the default path. This allows the developer to + // have full control over the base path for this filesystem's generated URLs. + if ($config->has('url')) { + return $this->concatPathToUrl($config->get('url'), $path); + } + + $path = '/storage/'.$path; + + // If the path contains "storage/public", it probably means the developer is using + // the default disk to generate the path instead of the "public" disk like they + // are really supposed to use. We will remove the public from this path here. + if (Str::contains($path, '/storage/public/')) { + return Str::replaceFirst('/public/', '/', $path); + } + + return $path; + } + + /** + * Get a temporary URL for the file at the given path. + * + * @param string $path + * @param \DateTimeInterface $expiration + * @param array $options + * @return string + * + * @throws \RuntimeException + */ + public function temporaryUrl($path, $expiration, array $options = []) + { + $adapter = $this->driver->getAdapter(); + + if ($adapter instanceof CachedAdapter) { + $adapter = $adapter->getAdapter(); + } + + if (method_exists($adapter, 'getTemporaryUrl')) { + return $adapter->getTemporaryUrl($path, $expiration, $options); + } elseif ($adapter instanceof AwsS3Adapter) { + return $this->getAwsTemporaryUrl($adapter, $path, $expiration, $options); + } else { + throw new RuntimeException('This driver does not support creating temporary URLs.'); + } + } + + /** + * Get a temporary URL for the file at the given path. + * + * @param \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter + * @param string $path + * @param \DateTimeInterface $expiration + * @param array $options + * @return string + */ + public function getAwsTemporaryUrl($adapter, $path, $expiration, $options) + { + $client = $adapter->getClient(); + + $command = $client->getCommand('GetObject', array_merge([ + 'Bucket' => $adapter->getBucket(), + 'Key' => $adapter->getPathPrefix().$path, + ], $options)); + + return (string) $client->createPresignedRequest( + $command, $expiration + )->getUri(); + } + + /** + * Concatenate a path to a URL. + * + * @param string $url + * @param string $path + * @return string + */ + protected function concatPathToUrl($url, $path) + { + return rtrim($url, '/').'/'.ltrim($path, '/'); + } + + /** + * Get an array of all files in a directory. + * + * @param string|null $directory + * @param bool $recursive + * @return array + */ + public function files($directory = null, $recursive = false) + { + $contents = $this->driver->listContents($directory, $recursive); + + return $this->filterContentsByType($contents, 'file'); + } + + /** + * Get all of the files from the given directory (recursive). + * + * @param string|null $directory + * @return array + */ + public function allFiles($directory = null) + { + return $this->files($directory, true); + } + + /** + * Get all of the directories within a given directory. + * + * @param string|null $directory + * @param bool $recursive + * @return array + */ + public function directories($directory = null, $recursive = false) + { + $contents = $this->driver->listContents($directory, $recursive); + + return $this->filterContentsByType($contents, 'dir'); + } + + /** + * Get all (recursive) of the directories within a given directory. + * + * @param string|null $directory + * @return array + */ + public function allDirectories($directory = null) + { + return $this->directories($directory, true); + } + + /** + * Create a directory. + * + * @param string $path + * @return bool + */ + public function makeDirectory($path) + { + return $this->driver->createDir($path); + } + + /** + * Recursively delete a directory. + * + * @param string $directory + * @return bool + */ + public function deleteDirectory($directory) + { + return $this->driver->deleteDir($directory); + } + + /** + * Flush the Flysystem cache. + * + * @return void + */ + public function flushCache() + { + $adapter = $this->driver->getAdapter(); + + if ($adapter instanceof CachedAdapter) { + $adapter->getCache()->flush(); + } + } + + /** + * Get the Flysystem driver. + * + * @return \League\Flysystem\FilesystemInterface + */ + public function getDriver() + { + return $this->driver; + } + + /** + * Filter directory contents by type. + * + * @param array $contents + * @param string $type + * @return array + */ + protected function filterContentsByType($contents, $type) + { + return Collection::make($contents) + ->where('type', $type) + ->pluck('path') + ->values() + ->all(); + } + + /** + * Parse the given visibility value. + * + * @param string|null $visibility + * @return string|null + * + * @throws \InvalidArgumentException + */ + protected function parseVisibility($visibility) + { + if (is_null($visibility)) { + return; + } + + switch ($visibility) { + case FilesystemContract::VISIBILITY_PUBLIC: + return AdapterInterface::VISIBILITY_PUBLIC; + case FilesystemContract::VISIBILITY_PRIVATE: + return AdapterInterface::VISIBILITY_PRIVATE; + } + + throw new InvalidArgumentException("Unknown visibility: {$visibility}"); + } + + /** + * Pass dynamic methods call onto Flysystem. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, array $parameters) + { + return $this->driver->{$method}(...array_values($parameters)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php new file mode 100644 index 00000000..6003ac6b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php @@ -0,0 +1,372 @@ +app = $app; + } + + /** + * Get a filesystem instance. + * + * @param string|null $name + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function drive($name = null) + { + return $this->disk($name); + } + + /** + * Get a filesystem instance. + * + * @param string|null $name + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function disk($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return $this->disks[$name] = $this->get($name); + } + + /** + * Get a default cloud filesystem instance. + * + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function cloud() + { + $name = $this->getDefaultCloudDriver(); + + return $this->disks[$name] = $this->get($name); + } + + /** + * Attempt to get the disk from the local cache. + * + * @param string $name + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + protected function get($name) + { + return $this->disks[$name] ?? $this->resolve($name); + } + + /** + * Resolve the given disk. + * + * @param string $name + * @return \Illuminate\Contracts\Filesystem\Filesystem + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (empty($config['driver'])) { + throw new InvalidArgumentException("Disk [{$name}] does not have a configured driver."); + } + + $name = $config['driver']; + + if (isset($this->customCreators[$name])) { + return $this->callCustomCreator($config); + } + + $driverMethod = 'create'.ucfirst($name).'Driver'; + + if (method_exists($this, $driverMethod)) { + return $this->{$driverMethod}($config); + } else { + throw new InvalidArgumentException("Driver [{$name}] is not supported."); + } + } + + /** + * Call a custom driver creator. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + protected function callCustomCreator(array $config) + { + $driver = $this->customCreators[$config['driver']]($this->app, $config); + + if ($driver instanceof FilesystemInterface) { + return $this->adapt($driver); + } + + return $driver; + } + + /** + * Create an instance of the local driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function createLocalDriver(array $config) + { + $permissions = $config['permissions'] ?? []; + + $links = ($config['links'] ?? null) === 'skip' + ? LocalAdapter::SKIP_LINKS + : LocalAdapter::DISALLOW_LINKS; + + return $this->adapt($this->createFlysystem(new LocalAdapter( + $config['root'], $config['lock'] ?? LOCK_EX, $links, $permissions + ), $config)); + } + + /** + * Create an instance of the ftp driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function createFtpDriver(array $config) + { + return $this->adapt($this->createFlysystem( + new FtpAdapter($config), $config + )); + } + + /** + * Create an instance of the sftp driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function createSftpDriver(array $config) + { + return $this->adapt($this->createFlysystem( + new SftpAdapter($config), $config + )); + } + + /** + * Create an instance of the Amazon S3 driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Cloud + */ + public function createS3Driver(array $config) + { + $s3Config = $this->formatS3Config($config); + + $root = $s3Config['root'] ?? null; + + $options = $config['options'] ?? []; + + $streamReads = $config['stream_reads'] ?? false; + + return $this->adapt($this->createFlysystem( + new S3Adapter(new S3Client($s3Config), $s3Config['bucket'], $root, $options, $streamReads), $config + )); + } + + /** + * Format the given S3 configuration with the default options. + * + * @param array $config + * @return array + */ + protected function formatS3Config(array $config) + { + $config += ['version' => 'latest']; + + if (! empty($config['key']) && ! empty($config['secret'])) { + $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); + } + + return $config; + } + + /** + * Create a Flysystem instance with the given adapter. + * + * @param \League\Flysystem\AdapterInterface $adapter + * @param array $config + * @return \League\Flysystem\FilesystemInterface + */ + protected function createFlysystem(AdapterInterface $adapter, array $config) + { + $cache = Arr::pull($config, 'cache'); + + $config = Arr::only($config, ['visibility', 'disable_asserts', 'url']); + + if ($cache) { + $adapter = new CachedAdapter($adapter, $this->createCacheStore($cache)); + } + + return new Flysystem($adapter, count($config) > 0 ? $config : null); + } + + /** + * Create a cache store instance. + * + * @param mixed $config + * @return \League\Flysystem\Cached\CacheInterface + * + * @throws \InvalidArgumentException + */ + protected function createCacheStore($config) + { + if ($config === true) { + return new MemoryStore; + } + + return new Cache( + $this->app['cache']->store($config['store']), + $config['prefix'] ?? 'flysystem', + $config['expire'] ?? null + ); + } + + /** + * Adapt the filesystem implementation. + * + * @param \League\Flysystem\FilesystemInterface $filesystem + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + protected function adapt(FilesystemInterface $filesystem) + { + return new FilesystemAdapter($filesystem); + } + + /** + * Set the given disk instance. + * + * @param string $name + * @param mixed $disk + * @return $this + */ + public function set($name, $disk) + { + $this->disks[$name] = $disk; + + return $this; + } + + /** + * Get the filesystem connection configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["filesystems.disks.{$name}"] ?: []; + } + + /** + * Get the default driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['filesystems.default']; + } + + /** + * Get the default cloud driver name. + * + * @return string + */ + public function getDefaultCloudDriver() + { + return $this->app['config']['filesystems.cloud']; + } + + /** + * Unset the given disk instances. + * + * @param array|string $disk + * @return $this + */ + public function forgetDisk($disk) + { + foreach ((array) $disk as $diskName) { + unset($this->disks[$diskName]); + } + + return $this; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback; + + return $this; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->disk()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php new file mode 100644 index 00000000..69322705 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php @@ -0,0 +1,82 @@ +registerNativeFilesystem(); + + $this->registerFlysystem(); + } + + /** + * Register the native filesystem implementation. + * + * @return void + */ + protected function registerNativeFilesystem() + { + $this->app->singleton('files', function () { + return new Filesystem; + }); + } + + /** + * Register the driver based filesystem. + * + * @return void + */ + protected function registerFlysystem() + { + $this->registerManager(); + + $this->app->singleton('filesystem.disk', function () { + return $this->app['filesystem']->disk($this->getDefaultDriver()); + }); + + $this->app->singleton('filesystem.cloud', function () { + return $this->app['filesystem']->disk($this->getCloudDriver()); + }); + } + + /** + * Register the filesystem manager. + * + * @return void + */ + protected function registerManager() + { + $this->app->singleton('filesystem', function () { + return new FilesystemManager($this->app); + }); + } + + /** + * Get the default file driver. + * + * @return string + */ + protected function getDefaultDriver() + { + return $this->app['config']['filesystems.default']; + } + + /** + * Get the default cloud based file driver. + * + * @return string + */ + protected function getCloudDriver() + { + return $this->app['config']['filesystems.cloud']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Filesystem/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Filesystem/composer.json b/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json new file mode 100644 index 00000000..b9c23cea --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json @@ -0,0 +1,44 @@ +{ + "name": "illuminate/filesystem", + "description": "The Illuminate Filesystem package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0", + "symfony/finder": "^4.3.4" + }, + "autoload": { + "psr-4": { + "Illuminate\\Filesystem\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "suggest": { + "ext-ftp": "Required to use the Flysystem FTP driver.", + "league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.1).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", + "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", + "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php b/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php new file mode 100755 index 00000000..63f38913 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php @@ -0,0 +1,243 @@ +aliases = $aliases; + } + + /** + * Get or create the singleton alias loader instance. + * + * @param array $aliases + * @return \Illuminate\Foundation\AliasLoader + */ + public static function getInstance(array $aliases = []) + { + if (is_null(static::$instance)) { + return static::$instance = new static($aliases); + } + + $aliases = array_merge(static::$instance->getAliases(), $aliases); + + static::$instance->setAliases($aliases); + + return static::$instance; + } + + /** + * Load a class alias if it is registered. + * + * @param string $alias + * @return bool|null + */ + public function load($alias) + { + if (static::$facadeNamespace && strpos($alias, static::$facadeNamespace) === 0) { + $this->loadFacade($alias); + + return true; + } + + if (isset($this->aliases[$alias])) { + return class_alias($this->aliases[$alias], $alias); + } + } + + /** + * Load a real-time facade for the given alias. + * + * @param string $alias + * @return void + */ + protected function loadFacade($alias) + { + require $this->ensureFacadeExists($alias); + } + + /** + * Ensure that the given alias has an existing real-time facade class. + * + * @param string $alias + * @return string + */ + protected function ensureFacadeExists($alias) + { + if (file_exists($path = storage_path('framework/cache/facade-'.sha1($alias).'.php'))) { + return $path; + } + + file_put_contents($path, $this->formatFacadeStub( + $alias, file_get_contents(__DIR__.'/stubs/facade.stub') + )); + + return $path; + } + + /** + * Format the facade stub with the proper namespace and class. + * + * @param string $alias + * @param string $stub + * @return string + */ + protected function formatFacadeStub($alias, $stub) + { + $replacements = [ + str_replace('/', '\\', dirname(str_replace('\\', '/', $alias))), + class_basename($alias), + substr($alias, strlen(static::$facadeNamespace)), + ]; + + return str_replace( + ['DummyNamespace', 'DummyClass', 'DummyTarget'], $replacements, $stub + ); + } + + /** + * Add an alias to the loader. + * + * @param string $class + * @param string $alias + * @return void + */ + public function alias($class, $alias) + { + $this->aliases[$class] = $alias; + } + + /** + * Register the loader on the auto-loader stack. + * + * @return void + */ + public function register() + { + if (! $this->registered) { + $this->prependToLoaderStack(); + + $this->registered = true; + } + } + + /** + * Prepend the load method to the auto-loader stack. + * + * @return void + */ + protected function prependToLoaderStack() + { + spl_autoload_register([$this, 'load'], true, true); + } + + /** + * Get the registered aliases. + * + * @return array + */ + public function getAliases() + { + return $this->aliases; + } + + /** + * Set the registered aliases. + * + * @param array $aliases + * @return void + */ + public function setAliases(array $aliases) + { + $this->aliases = $aliases; + } + + /** + * Indicates if the loader has been registered. + * + * @return bool + */ + public function isRegistered() + { + return $this->registered; + } + + /** + * Set the "registered" state of the loader. + * + * @param bool $value + * @return void + */ + public function setRegistered($value) + { + $this->registered = $value; + } + + /** + * Set the real-time facade namespace. + * + * @param string $namespace + * @return void + */ + public static function setFacadeNamespace($namespace) + { + static::$facadeNamespace = rtrim($namespace, '\\').'\\'; + } + + /** + * Set the value of the singleton alias loader. + * + * @param \Illuminate\Foundation\AliasLoader $loader + * @return void + */ + public static function setInstance($loader) + { + static::$instance = $loader; + } + + /** + * Clone method. + * + * @return void + */ + private function __clone() + { + // + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Application.php b/vendor/laravel/framework/src/Illuminate/Foundation/Application.php new file mode 100755 index 00000000..6b08a8b1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Application.php @@ -0,0 +1,1270 @@ +setBasePath($basePath); + } + + $this->registerBaseBindings(); + $this->registerBaseServiceProviders(); + $this->registerCoreContainerAliases(); + } + + /** + * Get the version number of the application. + * + * @return string + */ + public function version() + { + return static::VERSION; + } + + /** + * Register the basic bindings into the container. + * + * @return void + */ + protected function registerBaseBindings() + { + static::setInstance($this); + + $this->instance('app', $this); + + $this->instance(Container::class, $this); + $this->singleton(Mix::class); + + $this->instance(PackageManifest::class, new PackageManifest( + new Filesystem, $this->basePath(), $this->getCachedPackagesPath() + )); + } + + /** + * Register all of the base service providers. + * + * @return void + */ + protected function registerBaseServiceProviders() + { + $this->register(new EventServiceProvider($this)); + $this->register(new LogServiceProvider($this)); + $this->register(new RoutingServiceProvider($this)); + } + + /** + * Run the given array of bootstrap classes. + * + * @param string[] $bootstrappers + * @return void + */ + public function bootstrapWith(array $bootstrappers) + { + $this->hasBeenBootstrapped = true; + + foreach ($bootstrappers as $bootstrapper) { + $this['events']->dispatch('bootstrapping: '.$bootstrapper, [$this]); + + $this->make($bootstrapper)->bootstrap($this); + + $this['events']->dispatch('bootstrapped: '.$bootstrapper, [$this]); + } + } + + /** + * Register a callback to run after loading the environment. + * + * @param \Closure $callback + * @return void + */ + public function afterLoadingEnvironment(Closure $callback) + { + $this->afterBootstrapping( + LoadEnvironmentVariables::class, $callback + ); + } + + /** + * Register a callback to run before a bootstrapper. + * + * @param string $bootstrapper + * @param \Closure $callback + * @return void + */ + public function beforeBootstrapping($bootstrapper, Closure $callback) + { + $this['events']->listen('bootstrapping: '.$bootstrapper, $callback); + } + + /** + * Register a callback to run after a bootstrapper. + * + * @param string $bootstrapper + * @param \Closure $callback + * @return void + */ + public function afterBootstrapping($bootstrapper, Closure $callback) + { + $this['events']->listen('bootstrapped: '.$bootstrapper, $callback); + } + + /** + * Determine if the application has been bootstrapped before. + * + * @return bool + */ + public function hasBeenBootstrapped() + { + return $this->hasBeenBootstrapped; + } + + /** + * Set the base path for the application. + * + * @param string $basePath + * @return $this + */ + public function setBasePath($basePath) + { + $this->basePath = rtrim($basePath, '\/'); + + $this->bindPathsInContainer(); + + return $this; + } + + /** + * Bind all of the application paths in the container. + * + * @return void + */ + protected function bindPathsInContainer() + { + $this->instance('path', $this->path()); + $this->instance('path.base', $this->basePath()); + $this->instance('path.lang', $this->langPath()); + $this->instance('path.config', $this->configPath()); + $this->instance('path.public', $this->publicPath()); + $this->instance('path.storage', $this->storagePath()); + $this->instance('path.database', $this->databasePath()); + $this->instance('path.resources', $this->resourcePath()); + $this->instance('path.bootstrap', $this->bootstrapPath()); + } + + /** + * Get the path to the application "app" directory. + * + * @param string $path + * @return string + */ + public function path($path = '') + { + $appPath = $this->appPath ?: $this->basePath.DIRECTORY_SEPARATOR.'app'; + + return $appPath.($path ? DIRECTORY_SEPARATOR.$path : $path); + } + + /** + * Set the application directory. + * + * @param string $path + * @return $this + */ + public function useAppPath($path) + { + $this->appPath = $path; + + $this->instance('path', $path); + + return $this; + } + + /** + * Get the base path of the Laravel installation. + * + * @param string $path + * @return string + */ + public function basePath($path = '') + { + return $this->basePath.($path ? DIRECTORY_SEPARATOR.$path : $path); + } + + /** + * Get the path to the bootstrap directory. + * + * @param string $path + * @return string + */ + public function bootstrapPath($path = '') + { + return $this->basePath.DIRECTORY_SEPARATOR.'bootstrap'.($path ? DIRECTORY_SEPARATOR.$path : $path); + } + + /** + * Get the path to the application configuration files. + * + * @param string $path + * @return string + */ + public function configPath($path = '') + { + return $this->basePath.DIRECTORY_SEPARATOR.'config'.($path ? DIRECTORY_SEPARATOR.$path : $path); + } + + /** + * Get the path to the database directory. + * + * @param string $path + * @return string + */ + public function databasePath($path = '') + { + return ($this->databasePath ?: $this->basePath.DIRECTORY_SEPARATOR.'database').($path ? DIRECTORY_SEPARATOR.$path : $path); + } + + /** + * Set the database directory. + * + * @param string $path + * @return $this + */ + public function useDatabasePath($path) + { + $this->databasePath = $path; + + $this->instance('path.database', $path); + + return $this; + } + + /** + * Get the path to the language files. + * + * @return string + */ + public function langPath() + { + return $this->resourcePath().DIRECTORY_SEPARATOR.'lang'; + } + + /** + * Get the path to the public / web directory. + * + * @return string + */ + public function publicPath() + { + return $this->basePath.DIRECTORY_SEPARATOR.'public'; + } + + /** + * Get the path to the storage directory. + * + * @return string + */ + public function storagePath() + { + return $this->storagePath ?: $this->basePath.DIRECTORY_SEPARATOR.'storage'; + } + + /** + * Set the storage directory. + * + * @param string $path + * @return $this + */ + public function useStoragePath($path) + { + $this->storagePath = $path; + + $this->instance('path.storage', $path); + + return $this; + } + + /** + * Get the path to the resources directory. + * + * @param string $path + * @return string + */ + public function resourcePath($path = '') + { + return $this->basePath.DIRECTORY_SEPARATOR.'resources'.($path ? DIRECTORY_SEPARATOR.$path : $path); + } + + /** + * Get the path to the environment file directory. + * + * @return string + */ + public function environmentPath() + { + return $this->environmentPath ?: $this->basePath; + } + + /** + * Set the directory for the environment file. + * + * @param string $path + * @return $this + */ + public function useEnvironmentPath($path) + { + $this->environmentPath = $path; + + return $this; + } + + /** + * Set the environment file to be loaded during bootstrapping. + * + * @param string $file + * @return $this + */ + public function loadEnvironmentFrom($file) + { + $this->environmentFile = $file; + + return $this; + } + + /** + * Get the environment file the application is using. + * + * @return string + */ + public function environmentFile() + { + return $this->environmentFile ?: '.env'; + } + + /** + * Get the fully qualified path to the environment file. + * + * @return string + */ + public function environmentFilePath() + { + return $this->environmentPath().DIRECTORY_SEPARATOR.$this->environmentFile(); + } + + /** + * Get or check the current application environment. + * + * @param string|array $environments + * @return string|bool + */ + public function environment(...$environments) + { + if (count($environments) > 0) { + $patterns = is_array($environments[0]) ? $environments[0] : $environments; + + return Str::is($patterns, $this['env']); + } + + return $this['env']; + } + + /** + * Determine if application is in local environment. + * + * @return bool + */ + public function isLocal() + { + return $this['env'] === 'local'; + } + + /** + * Determine if application is in production environment. + * + * @return bool + */ + public function isProduction() + { + return $this['env'] === 'production'; + } + + /** + * Detect the application's current environment. + * + * @param \Closure $callback + * @return string + */ + public function detectEnvironment(Closure $callback) + { + $args = $_SERVER['argv'] ?? null; + + return $this['env'] = (new EnvironmentDetector)->detect($callback, $args); + } + + /** + * Determine if the application is running in the console. + * + * @return bool + */ + public function runningInConsole() + { + if ($this->isRunningInConsole === null) { + $this->isRunningInConsole = Env::get('APP_RUNNING_IN_CONSOLE') ?? (\PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg'); + } + + return $this->isRunningInConsole; + } + + /** + * Determine if the application is running unit tests. + * + * @return bool + */ + public function runningUnitTests() + { + return $this['env'] === 'testing'; + } + + /** + * Register all of the configured providers. + * + * @return void + */ + public function registerConfiguredProviders() + { + $providers = Collection::make($this->config['app.providers']) + ->partition(function ($provider) { + return strpos($provider, 'Illuminate\\') === 0; + }); + + $providers->splice(1, 0, [$this->make(PackageManifest::class)->providers()]); + + (new ProviderRepository($this, new Filesystem, $this->getCachedServicesPath())) + ->load($providers->collapse()->toArray()); + } + + /** + * Register a service provider with the application. + * + * @param \Illuminate\Support\ServiceProvider|string $provider + * @param bool $force + * @return \Illuminate\Support\ServiceProvider + */ + public function register($provider, $force = false) + { + if (($registered = $this->getProvider($provider)) && ! $force) { + return $registered; + } + + // If the given "provider" is a string, we will resolve it, passing in the + // application instance automatically for the developer. This is simply + // a more convenient way of specifying your service provider classes. + if (is_string($provider)) { + $provider = $this->resolveProvider($provider); + } + + $provider->register(); + + // If there are bindings / singletons set as properties on the provider we + // will spin through them and register them with the application, which + // serves as a convenience layer while registering a lot of bindings. + if (property_exists($provider, 'bindings')) { + foreach ($provider->bindings as $key => $value) { + $this->bind($key, $value); + } + } + + if (property_exists($provider, 'singletons')) { + foreach ($provider->singletons as $key => $value) { + $this->singleton($key, $value); + } + } + + $this->markAsRegistered($provider); + + // If the application has already booted, we will call this boot method on + // the provider class so it has an opportunity to do its boot logic and + // will be ready for any usage by this developer's application logic. + if ($this->isBooted()) { + $this->bootProvider($provider); + } + + return $provider; + } + + /** + * Get the registered service provider instance if it exists. + * + * @param \Illuminate\Support\ServiceProvider|string $provider + * @return \Illuminate\Support\ServiceProvider|null + */ + public function getProvider($provider) + { + return array_values($this->getProviders($provider))[0] ?? null; + } + + /** + * Get the registered service provider instances if any exist. + * + * @param \Illuminate\Support\ServiceProvider|string $provider + * @return array + */ + public function getProviders($provider) + { + $name = is_string($provider) ? $provider : get_class($provider); + + return Arr::where($this->serviceProviders, function ($value) use ($name) { + return $value instanceof $name; + }); + } + + /** + * Resolve a service provider instance from the class name. + * + * @param string $provider + * @return \Illuminate\Support\ServiceProvider + */ + public function resolveProvider($provider) + { + return new $provider($this); + } + + /** + * Mark the given provider as registered. + * + * @param \Illuminate\Support\ServiceProvider $provider + * @return void + */ + protected function markAsRegistered($provider) + { + $this->serviceProviders[] = $provider; + + $this->loadedProviders[get_class($provider)] = true; + } + + /** + * Load and boot all of the remaining deferred providers. + * + * @return void + */ + public function loadDeferredProviders() + { + // We will simply spin through each of the deferred providers and register each + // one and boot them if the application has booted. This should make each of + // the remaining services available to this application for immediate use. + foreach ($this->deferredServices as $service => $provider) { + $this->loadDeferredProvider($service); + } + + $this->deferredServices = []; + } + + /** + * Load the provider for a deferred service. + * + * @param string $service + * @return void + */ + public function loadDeferredProvider($service) + { + if (! $this->isDeferredService($service)) { + return; + } + + $provider = $this->deferredServices[$service]; + + // If the service provider has not already been loaded and registered we can + // register it with the application and remove the service from this list + // of deferred services, since it will already be loaded on subsequent. + if (! isset($this->loadedProviders[$provider])) { + $this->registerDeferredProvider($provider, $service); + } + } + + /** + * Register a deferred provider and service. + * + * @param string $provider + * @param string|null $service + * @return void + */ + public function registerDeferredProvider($provider, $service = null) + { + // Once the provider that provides the deferred service has been registered we + // will remove it from our local list of the deferred services with related + // providers so that this container does not try to resolve it out again. + if ($service) { + unset($this->deferredServices[$service]); + } + + $this->register($instance = new $provider($this)); + + if (! $this->isBooted()) { + $this->booting(function () use ($instance) { + $this->bootProvider($instance); + }); + } + } + + /** + * Resolve the given type from the container. + * + * @param string $abstract + * @param array $parameters + * @return mixed + */ + public function make($abstract, array $parameters = []) + { + $this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract)); + + return parent::make($abstract, $parameters); + } + + /** + * Resolve the given type from the container. + * + * @param string $abstract + * @param array $parameters + * @param bool $raiseEvents + * @return mixed + */ + protected function resolve($abstract, $parameters = [], $raiseEvents = true) + { + $this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract)); + + return parent::resolve($abstract, $parameters, $raiseEvents); + } + + /** + * Load the deferred provider if the given type is a deferred service and the instance has not been loaded. + * + * @param string $abstract + * @return void + */ + protected function loadDeferredProviderIfNeeded($abstract) + { + if ($this->isDeferredService($abstract) && ! isset($this->instances[$abstract])) { + $this->loadDeferredProvider($abstract); + } + } + + /** + * Determine if the given abstract type has been bound. + * + * @param string $abstract + * @return bool + */ + public function bound($abstract) + { + return $this->isDeferredService($abstract) || parent::bound($abstract); + } + + /** + * Determine if the application has booted. + * + * @return bool + */ + public function isBooted() + { + return $this->booted; + } + + /** + * Boot the application's service providers. + * + * @return void + */ + public function boot() + { + if ($this->isBooted()) { + return; + } + + // Once the application has booted we will also fire some "booted" callbacks + // for any listeners that need to do work after this initial booting gets + // finished. This is useful when ordering the boot-up processes we run. + $this->fireAppCallbacks($this->bootingCallbacks); + + array_walk($this->serviceProviders, function ($p) { + $this->bootProvider($p); + }); + + $this->booted = true; + + $this->fireAppCallbacks($this->bootedCallbacks); + } + + /** + * Boot the given service provider. + * + * @param \Illuminate\Support\ServiceProvider $provider + * @return mixed + */ + protected function bootProvider(ServiceProvider $provider) + { + if (method_exists($provider, 'boot')) { + return $this->call([$provider, 'boot']); + } + } + + /** + * Register a new boot listener. + * + * @param callable $callback + * @return void + */ + public function booting($callback) + { + $this->bootingCallbacks[] = $callback; + } + + /** + * Register a new "booted" listener. + * + * @param callable $callback + * @return void + */ + public function booted($callback) + { + $this->bootedCallbacks[] = $callback; + + if ($this->isBooted()) { + $this->fireAppCallbacks([$callback]); + } + } + + /** + * Call the booting callbacks for the application. + * + * @param callable[] $callbacks + * @return void + */ + protected function fireAppCallbacks(array $callbacks) + { + foreach ($callbacks as $callback) { + $callback($this); + } + } + + /** + * {@inheritdoc} + */ + public function handle(SymfonyRequest $request, $type = self::MASTER_REQUEST, $catch = true) + { + return $this[HttpKernelContract::class]->handle(Request::createFromBase($request)); + } + + /** + * Determine if middleware has been disabled for the application. + * + * @return bool + */ + public function shouldSkipMiddleware() + { + return $this->bound('middleware.disable') && + $this->make('middleware.disable') === true; + } + + /** + * Get the path to the cached services.php file. + * + * @return string + */ + public function getCachedServicesPath() + { + return $this->normalizeCachePath('APP_SERVICES_CACHE', 'cache/services.php'); + } + + /** + * Get the path to the cached packages.php file. + * + * @return string + */ + public function getCachedPackagesPath() + { + return $this->normalizeCachePath('APP_PACKAGES_CACHE', 'cache/packages.php'); + } + + /** + * Determine if the application configuration is cached. + * + * @return bool + */ + public function configurationIsCached() + { + return file_exists($this->getCachedConfigPath()); + } + + /** + * Get the path to the configuration cache file. + * + * @return string + */ + public function getCachedConfigPath() + { + return $this->normalizeCachePath('APP_CONFIG_CACHE', 'cache/config.php'); + } + + /** + * Determine if the application routes are cached. + * + * @return bool + */ + public function routesAreCached() + { + return $this['files']->exists($this->getCachedRoutesPath()); + } + + /** + * Get the path to the routes cache file. + * + * @return string + */ + public function getCachedRoutesPath() + { + return $this->normalizeCachePath('APP_ROUTES_CACHE', 'cache/routes.php'); + } + + /** + * Determine if the application events are cached. + * + * @return bool + */ + public function eventsAreCached() + { + return $this['files']->exists($this->getCachedEventsPath()); + } + + /** + * Get the path to the events cache file. + * + * @return string + */ + public function getCachedEventsPath() + { + return $this->normalizeCachePath('APP_EVENTS_CACHE', 'cache/events.php'); + } + + /** + * Normalize a relative or absolute path to a cache file. + * + * @param string $key + * @param string $default + * @return string + */ + protected function normalizeCachePath($key, $default) + { + if (is_null($env = Env::get($key))) { + return $this->bootstrapPath($default); + } + + return Str::startsWith($env, '/') + ? $env + : $this->basePath($env); + } + + /** + * Determine if the application is currently down for maintenance. + * + * @return bool + */ + public function isDownForMaintenance() + { + return file_exists($this->storagePath().'/framework/down'); + } + + /** + * Throw an HttpException with the given data. + * + * @param int $code + * @param string $message + * @param array $headers + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + public function abort($code, $message = '', array $headers = []) + { + if ($code == 404) { + throw new NotFoundHttpException($message); + } + + throw new HttpException($code, $message, null, $headers); + } + + /** + * Register a terminating callback with the application. + * + * @param callable|string $callback + * @return $this + */ + public function terminating($callback) + { + $this->terminatingCallbacks[] = $callback; + + return $this; + } + + /** + * Terminate the application. + * + * @return void + */ + public function terminate() + { + foreach ($this->terminatingCallbacks as $terminating) { + $this->call($terminating); + } + } + + /** + * Get the service providers that have been loaded. + * + * @return array + */ + public function getLoadedProviders() + { + return $this->loadedProviders; + } + + /** + * Get the application's deferred services. + * + * @return array + */ + public function getDeferredServices() + { + return $this->deferredServices; + } + + /** + * Set the application's deferred services. + * + * @param array $services + * @return void + */ + public function setDeferredServices(array $services) + { + $this->deferredServices = $services; + } + + /** + * Add an array of services to the application's deferred services. + * + * @param array $services + * @return void + */ + public function addDeferredServices(array $services) + { + $this->deferredServices = array_merge($this->deferredServices, $services); + } + + /** + * Determine if the given service is a deferred service. + * + * @param string $service + * @return bool + */ + public function isDeferredService($service) + { + return isset($this->deferredServices[$service]); + } + + /** + * Configure the real-time facade namespace. + * + * @param string $namespace + * @return void + */ + public function provideFacades($namespace) + { + AliasLoader::setFacadeNamespace($namespace); + } + + /** + * Get the current application locale. + * + * @return string + */ + public function getLocale() + { + return $this['config']->get('app.locale'); + } + + /** + * Set the current application locale. + * + * @param string $locale + * @return void + */ + public function setLocale($locale) + { + $this['config']->set('app.locale', $locale); + + $this['translator']->setLocale($locale); + + $this['events']->dispatch(new LocaleUpdated($locale)); + } + + /** + * Determine if application locale is the given locale. + * + * @param string $locale + * @return bool + */ + public function isLocale($locale) + { + return $this->getLocale() == $locale; + } + + /** + * Register the core class aliases in the container. + * + * @return void + */ + public function registerCoreContainerAliases() + { + foreach ([ + 'app' => [self::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class], + 'auth' => [\Illuminate\Auth\AuthManager::class, \Illuminate\Contracts\Auth\Factory::class], + 'auth.driver' => [\Illuminate\Contracts\Auth\Guard::class], + 'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class], + 'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class], + 'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class, \Psr\SimpleCache\CacheInterface::class], + 'cache.psr6' => [\Symfony\Component\Cache\Adapter\Psr16Adapter::class, \Symfony\Component\Cache\Adapter\AdapterInterface::class, \Psr\Cache\CacheItemPoolInterface::class], + 'config' => [\Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class], + 'cookie' => [\Illuminate\Cookie\CookieJar::class, \Illuminate\Contracts\Cookie\Factory::class, \Illuminate\Contracts\Cookie\QueueingFactory::class], + 'encrypter' => [\Illuminate\Encryption\Encrypter::class, \Illuminate\Contracts\Encryption\Encrypter::class], + 'db' => [\Illuminate\Database\DatabaseManager::class, \Illuminate\Database\ConnectionResolverInterface::class], + 'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class], + 'events' => [\Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class], + 'files' => [\Illuminate\Filesystem\Filesystem::class], + 'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class], + 'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class], + 'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class], + 'hash' => [\Illuminate\Hashing\HashManager::class], + 'hash.driver' => [\Illuminate\Contracts\Hashing\Hasher::class], + 'translator' => [\Illuminate\Translation\Translator::class, \Illuminate\Contracts\Translation\Translator::class], + 'log' => [\Illuminate\Log\LogManager::class, \Psr\Log\LoggerInterface::class], + 'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class], + 'auth.password' => [\Illuminate\Auth\Passwords\PasswordBrokerManager::class, \Illuminate\Contracts\Auth\PasswordBrokerFactory::class], + 'auth.password.broker' => [\Illuminate\Auth\Passwords\PasswordBroker::class, \Illuminate\Contracts\Auth\PasswordBroker::class], + 'queue' => [\Illuminate\Queue\QueueManager::class, \Illuminate\Contracts\Queue\Factory::class, \Illuminate\Contracts\Queue\Monitor::class], + 'queue.connection' => [\Illuminate\Contracts\Queue\Queue::class], + 'queue.failer' => [\Illuminate\Queue\Failed\FailedJobProviderInterface::class], + 'redirect' => [\Illuminate\Routing\Redirector::class], + 'redis' => [\Illuminate\Redis\RedisManager::class, \Illuminate\Contracts\Redis\Factory::class], + 'redis.connection' => [\Illuminate\Redis\Connections\Connection::class, \Illuminate\Contracts\Redis\Connection::class], + 'request' => [\Illuminate\Http\Request::class, \Symfony\Component\HttpFoundation\Request::class], + 'router' => [\Illuminate\Routing\Router::class, \Illuminate\Contracts\Routing\Registrar::class, \Illuminate\Contracts\Routing\BindingRegistrar::class], + 'session' => [\Illuminate\Session\SessionManager::class], + 'session.store' => [\Illuminate\Session\Store::class, \Illuminate\Contracts\Session\Session::class], + 'url' => [\Illuminate\Routing\UrlGenerator::class, \Illuminate\Contracts\Routing\UrlGenerator::class], + 'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class], + 'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class], + ] as $key => $aliases) { + foreach ($aliases as $alias) { + $this->alias($key, $alias); + } + } + } + + /** + * Flush the container of all bindings and resolved instances. + * + * @return void + */ + public function flush() + { + parent::flush(); + + $this->buildStack = []; + $this->loadedProviders = []; + $this->bootedCallbacks = []; + $this->bootingCallbacks = []; + $this->deferredServices = []; + $this->reboundCallbacks = []; + $this->serviceProviders = []; + $this->resolvingCallbacks = []; + $this->terminatingCallbacks = []; + $this->afterResolvingCallbacks = []; + $this->globalResolvingCallbacks = []; + } + + /** + * Get the application namespace. + * + * @return string + * + * @throws \RuntimeException + */ + public function getNamespace() + { + if (! is_null($this->namespace)) { + return $this->namespace; + } + + $composer = json_decode(file_get_contents($this->basePath('composer.json')), true); + + foreach ((array) data_get($composer, 'autoload.psr-4') as $namespace => $path) { + foreach ((array) $path as $pathChoice) { + if (realpath($this->path()) === realpath($this->basePath($pathChoice))) { + return $this->namespace = $namespace; + } + } + } + + throw new RuntimeException('Unable to detect application namespace.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/Authorizable.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/Authorizable.php new file mode 100644 index 00000000..dd0ba609 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/Authorizable.php @@ -0,0 +1,44 @@ +forUser($this)->check($abilities, $arguments); + } + + /** + * Determine if the entity does not have the given abilities. + * + * @param iterable|string $abilities + * @param array|mixed $arguments + * @return bool + */ + public function cant($abilities, $arguments = []) + { + return ! $this->can($abilities, $arguments); + } + + /** + * Determine if the entity does not have the given abilities. + * + * @param iterable|string $abilities + * @param array|mixed $arguments + * @return bool + */ + public function cannot($abilities, $arguments = []) + { + return $this->cant($abilities, $arguments); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php new file mode 100644 index 00000000..85a9596f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php @@ -0,0 +1,127 @@ +parseAbilityAndArguments($ability, $arguments); + + return app(Gate::class)->authorize($ability, $arguments); + } + + /** + * Authorize a given action for a user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user + * @param mixed $ability + * @param mixed|array $arguments + * @return \Illuminate\Auth\Access\Response + * + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function authorizeForUser($user, $ability, $arguments = []) + { + [$ability, $arguments] = $this->parseAbilityAndArguments($ability, $arguments); + + return app(Gate::class)->forUser($user)->authorize($ability, $arguments); + } + + /** + * Guesses the ability's name if it wasn't provided. + * + * @param mixed $ability + * @param mixed|array $arguments + * @return array + */ + protected function parseAbilityAndArguments($ability, $arguments) + { + if (is_string($ability) && strpos($ability, '\\') === false) { + return [$ability, $arguments]; + } + + $method = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['function']; + + return [$this->normalizeGuessedAbilityName($method), $ability]; + } + + /** + * Normalize the ability name that has been guessed from the method name. + * + * @param string $ability + * @return string + */ + protected function normalizeGuessedAbilityName($ability) + { + $map = $this->resourceAbilityMap(); + + return $map[$ability] ?? $ability; + } + + /** + * Authorize a resource action based on the incoming request. + * + * @param string $model + * @param string|null $parameter + * @param array $options + * @param \Illuminate\Http\Request|null $request + * @return void + */ + public function authorizeResource($model, $parameter = null, array $options = [], $request = null) + { + $parameter = $parameter ?: Str::snake(class_basename($model)); + + $middleware = []; + + foreach ($this->resourceAbilityMap() as $method => $ability) { + $modelName = in_array($method, $this->resourceMethodsWithoutModels()) ? $model : $parameter; + + $middleware["can:{$ability},{$modelName}"][] = $method; + } + + foreach ($middleware as $middlewareName => $methods) { + $this->middleware($middlewareName, $options)->only($methods); + } + } + + /** + * Get the map of resource methods to ability names. + * + * @return array + */ + protected function resourceAbilityMap() + { + return [ + 'index' => 'viewAny', + 'show' => 'view', + 'create' => 'create', + 'store' => 'create', + 'edit' => 'update', + 'update' => 'update', + 'destroy' => 'delete', + ]; + } + + /** + * Get the list of resource methods which do not have model parameters. + * + * @return array + */ + protected function resourceMethodsWithoutModels() + { + return ['index', 'create', 'store']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php new file mode 100644 index 00000000..39f25f7d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php @@ -0,0 +1,187 @@ +validateLogin($request); + + // If the class is using the ThrottlesLogins trait, we can automatically throttle + // the login attempts for this application. We'll key this by the username and + // the IP address of the client making these requests into this application. + if (method_exists($this, 'hasTooManyLoginAttempts') && + $this->hasTooManyLoginAttempts($request)) { + $this->fireLockoutEvent($request); + + return $this->sendLockoutResponse($request); + } + + if ($this->attemptLogin($request)) { + return $this->sendLoginResponse($request); + } + + // If the login attempt was unsuccessful we will increment the number of attempts + // to login and redirect the user back to the login form. Of course, when this + // user surpasses their maximum number of attempts they will get locked out. + $this->incrementLoginAttempts($request); + + return $this->sendFailedLoginResponse($request); + } + + /** + * Validate the user login request. + * + * @param \Illuminate\Http\Request $request + * @return void + * + * @throws \Illuminate\Validation\ValidationException + */ + protected function validateLogin(Request $request) + { + $request->validate([ + $this->username() => 'required|string', + 'password' => 'required|string', + ]); + } + + /** + * Attempt to log the user into the application. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function attemptLogin(Request $request) + { + return $this->guard()->attempt( + $this->credentials($request), $request->filled('remember') + ); + } + + /** + * Get the needed authorization credentials from the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function credentials(Request $request) + { + return $request->only($this->username(), 'password'); + } + + /** + * Send the response after the user was authenticated. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + protected function sendLoginResponse(Request $request) + { + $request->session()->regenerate(); + + $this->clearLoginAttempts($request); + + return $this->authenticated($request, $this->guard()->user()) + ?: redirect()->intended($this->redirectPath()); + } + + /** + * The user has been authenticated. + * + * @param \Illuminate\Http\Request $request + * @param mixed $user + * @return mixed + */ + protected function authenticated(Request $request, $user) + { + // + } + + /** + * Get the failed login response instance. + * + * @param \Illuminate\Http\Request $request + * @return \Symfony\Component\HttpFoundation\Response + * + * @throws \Illuminate\Validation\ValidationException + */ + protected function sendFailedLoginResponse(Request $request) + { + throw ValidationException::withMessages([ + $this->username() => [trans('auth.failed')], + ]); + } + + /** + * Get the login username to be used by the controller. + * + * @return string + */ + public function username() + { + return 'email'; + } + + /** + * Log the user out of the application. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function logout(Request $request) + { + $this->guard()->logout(); + + $request->session()->invalidate(); + + $request->session()->regenerateToken(); + + return $this->loggedOut($request) ?: redirect('/'); + } + + /** + * The user has logged out of the application. + * + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function loggedOut(Request $request) + { + // + } + + /** + * Get the guard to be used during authentication. + * + * @return \Illuminate\Contracts\Auth\StatefulGuard + */ + protected function guard() + { + return Auth::guard(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ConfirmsPasswords.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ConfirmsPasswords.php new file mode 100644 index 00000000..655c4e5b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ConfirmsPasswords.php @@ -0,0 +1,68 @@ +validate($this->rules(), $this->validationErrorMessages()); + + $this->resetPasswordConfirmationTimeout($request); + + return redirect()->intended($this->redirectPath()); + } + + /** + * Reset the password confirmation timeout. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function resetPasswordConfirmationTimeout(Request $request) + { + $request->session()->put('auth.password_confirmed_at', time()); + } + + /** + * Get the password confirmation validation rules. + * + * @return array + */ + protected function rules() + { + return [ + 'password' => 'required|password', + ]; + } + + /** + * Get the password confirmation validation error messages. + * + * @return array + */ + protected function validationErrorMessages() + { + return []; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php new file mode 100644 index 00000000..cc992290 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php @@ -0,0 +1,20 @@ +redirectTo(); + } + + return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php new file mode 100644 index 00000000..4dc43425 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php @@ -0,0 +1,62 @@ +validator($request->all())->validate(); + + event(new Registered($user = $this->create($request->all()))); + + $this->guard()->login($user); + + return $this->registered($request, $user) + ?: redirect($this->redirectPath()); + } + + /** + * Get the guard to be used during registration. + * + * @return \Illuminate\Contracts\Auth\StatefulGuard + */ + protected function guard() + { + return Auth::guard(); + } + + /** + * The user has been registered. + * + * @param \Illuminate\Http\Request $request + * @param mixed $user + * @return mixed + */ + protected function registered(Request $request, $user) + { + // + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php new file mode 100644 index 00000000..a1567e0c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php @@ -0,0 +1,174 @@ +with( + ['token' => $token, 'email' => $request->email] + ); + } + + /** + * Reset the given user's password. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse + */ + public function reset(Request $request) + { + $request->validate($this->rules(), $this->validationErrorMessages()); + + // Here we will attempt to reset the user's password. If it is successful we + // will update the password on an actual user model and persist it to the + // database. Otherwise we will parse the error and return the response. + $response = $this->broker()->reset( + $this->credentials($request), function ($user, $password) { + $this->resetPassword($user, $password); + } + ); + + // If the password was successfully reset, we will redirect the user back to + // the application's home authenticated view. If there is an error we can + // redirect them back to where they came from with their error message. + return $response == Password::PASSWORD_RESET + ? $this->sendResetResponse($request, $response) + : $this->sendResetFailedResponse($request, $response); + } + + /** + * Get the password reset validation rules. + * + * @return array + */ + protected function rules() + { + return [ + 'token' => 'required', + 'email' => 'required|email', + 'password' => 'required|confirmed|min:8', + ]; + } + + /** + * Get the password reset validation error messages. + * + * @return array + */ + protected function validationErrorMessages() + { + return []; + } + + /** + * Get the password reset credentials from the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function credentials(Request $request) + { + return $request->only( + 'email', 'password', 'password_confirmation', 'token' + ); + } + + /** + * Reset the given user's password. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @param string $password + * @return void + */ + protected function resetPassword($user, $password) + { + $this->setUserPassword($user, $password); + + $user->setRememberToken(Str::random(60)); + + $user->save(); + + event(new PasswordReset($user)); + + $this->guard()->login($user); + } + + /** + * Set the user's password. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @param string $password + * @return void + */ + protected function setUserPassword($user, $password) + { + $user->password = Hash::make($password); + } + + /** + * Get the response for a successful password reset. + * + * @param \Illuminate\Http\Request $request + * @param string $response + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse + */ + protected function sendResetResponse(Request $request, $response) + { + return redirect($this->redirectPath()) + ->with('status', trans($response)); + } + + /** + * Get the response for a failed password reset. + * + * @param \Illuminate\Http\Request $request + * @param string $response + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse + */ + protected function sendResetFailedResponse(Request $request, $response) + { + return redirect()->back() + ->withInput($request->only('email')) + ->withErrors(['email' => trans($response)]); + } + + /** + * Get the broker to be used during password reset. + * + * @return \Illuminate\Contracts\Auth\PasswordBroker + */ + public function broker() + { + return Password::broker(); + } + + /** + * Get the guard to be used during password reset. + * + * @return \Illuminate\Contracts\Auth\StatefulGuard + */ + protected function guard() + { + return Auth::guard(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/SendsPasswordResetEmails.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/SendsPasswordResetEmails.php new file mode 100644 index 00000000..070c6482 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/SendsPasswordResetEmails.php @@ -0,0 +1,99 @@ +validateEmail($request); + + // We will send the password reset link to this user. Once we have attempted + // to send the link, we will examine the response then see the message we + // need to show to the user. Finally, we'll send out a proper response. + $response = $this->broker()->sendResetLink( + $this->credentials($request) + ); + + return $response == Password::RESET_LINK_SENT + ? $this->sendResetLinkResponse($request, $response) + : $this->sendResetLinkFailedResponse($request, $response); + } + + /** + * Validate the email for the given request. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function validateEmail(Request $request) + { + $request->validate(['email' => 'required|email']); + } + + /** + * Get the needed authentication credentials from the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function credentials(Request $request) + { + return $request->only('email'); + } + + /** + * Get the response for a successful password reset link. + * + * @param \Illuminate\Http\Request $request + * @param string $response + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse + */ + protected function sendResetLinkResponse(Request $request, $response) + { + return back()->with('status', trans($response)); + } + + /** + * Get the response for a failed password reset link. + * + * @param \Illuminate\Http\Request $request + * @param string $response + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse + */ + protected function sendResetLinkFailedResponse(Request $request, $response) + { + return back() + ->withInput($request->only('email')) + ->withErrors(['email' => trans($response)]); + } + + /** + * Get the broker to be used during password reset. + * + * @return \Illuminate\Contracts\Auth\PasswordBroker + */ + public function broker() + { + return Password::broker(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php new file mode 100644 index 00000000..8f632377 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php @@ -0,0 +1,125 @@ +limiter()->tooManyAttempts( + $this->throttleKey($request), $this->maxAttempts() + ); + } + + /** + * Increment the login attempts for the user. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function incrementLoginAttempts(Request $request) + { + $this->limiter()->hit( + $this->throttleKey($request), $this->decayMinutes() * 60 + ); + } + + /** + * Redirect the user after determining they are locked out. + * + * @param \Illuminate\Http\Request $request + * @return void + * + * @throws \Illuminate\Validation\ValidationException + */ + protected function sendLockoutResponse(Request $request) + { + $seconds = $this->limiter()->availableIn( + $this->throttleKey($request) + ); + + throw ValidationException::withMessages([ + $this->username() => [Lang::get('auth.throttle', [ + 'seconds' => $seconds, + 'minutes' => ceil($seconds / 60), + ])], + ])->status(Response::HTTP_TOO_MANY_REQUESTS); + } + + /** + * Clear the login locks for the given user credentials. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function clearLoginAttempts(Request $request) + { + $this->limiter()->clear($this->throttleKey($request)); + } + + /** + * Fire an event when a lockout occurs. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function fireLockoutEvent(Request $request) + { + event(new Lockout($request)); + } + + /** + * Get the throttle key for the given request. + * + * @param \Illuminate\Http\Request $request + * @return string + */ + protected function throttleKey(Request $request) + { + return Str::lower($request->input($this->username())).'|'.$request->ip(); + } + + /** + * Get the rate limiter instance. + * + * @return \Illuminate\Cache\RateLimiter + */ + protected function limiter() + { + return app(RateLimiter::class); + } + + /** + * Get the maximum number of attempts to allow. + * + * @return int + */ + public function maxAttempts() + { + return property_exists($this, 'maxAttempts') ? $this->maxAttempts : 5; + } + + /** + * Get the number of minutes to throttle for. + * + * @return int + */ + public function decayMinutes() + { + return property_exists($this, 'decayMinutes') ? $this->decayMinutes : 1; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/User.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/User.php new file mode 100644 index 00000000..be1dff54 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/User.php @@ -0,0 +1,20 @@ +user()->hasVerifiedEmail() + ? redirect($this->redirectPath()) + : view('auth.verify'); + } + + /** + * Mark the authenticated user's email address as verified. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + * + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function verify(Request $request) + { + if (! hash_equals((string) $request->route('id'), (string) $request->user()->getKey())) { + throw new AuthorizationException; + } + + if (! hash_equals((string) $request->route('hash'), sha1($request->user()->getEmailForVerification()))) { + throw new AuthorizationException; + } + + if ($request->user()->hasVerifiedEmail()) { + return redirect($this->redirectPath()); + } + + if ($request->user()->markEmailAsVerified()) { + event(new Verified($request->user())); + } + + return redirect($this->redirectPath())->with('verified', true); + } + + /** + * Resend the email verification notification. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function resend(Request $request) + { + if ($request->user()->hasVerifiedEmail()) { + return redirect($this->redirectPath()); + } + + $request->user()->sendEmailVerificationNotification(); + + return back()->with('resent', true); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php new file mode 100644 index 00000000..2c0bcb0b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php @@ -0,0 +1,19 @@ +boot(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php new file mode 100644 index 00000000..9da4d463 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php @@ -0,0 +1,172 @@ +app = $app; + + error_reporting(-1); + + set_error_handler([$this, 'handleError']); + + set_exception_handler([$this, 'handleException']); + + register_shutdown_function([$this, 'handleShutdown']); + + if (! $app->environment('testing')) { + ini_set('display_errors', 'Off'); + } + } + + /** + * Convert PHP errors to ErrorException instances. + * + * @param int $level + * @param string $message + * @param string $file + * @param int $line + * @param array $context + * @return void + * + * @throws \ErrorException + */ + public function handleError($level, $message, $file = '', $line = 0, $context = []) + { + if (error_reporting() & $level) { + throw new ErrorException($message, 0, $level, $file, $line); + } + } + + /** + * Handle an uncaught exception from the application. + * + * Note: Most exceptions can be handled via the try / catch block in + * the HTTP and Console kernels. But, fatal error exceptions must + * be handled differently since they are not normal exceptions. + * + * @param \Throwable $e + * @return void + */ + public function handleException($e) + { + if (! $e instanceof Exception) { + $e = new FatalThrowableError($e); + } + + try { + self::$reservedMemory = null; + + $this->getExceptionHandler()->report($e); + } catch (Exception $e) { + // + } + + if ($this->app->runningInConsole()) { + $this->renderForConsole($e); + } else { + $this->renderHttpResponse($e); + } + } + + /** + * Render an exception to the console. + * + * @param \Exception $e + * @return void + */ + protected function renderForConsole(Exception $e) + { + $this->getExceptionHandler()->renderForConsole(new ConsoleOutput, $e); + } + + /** + * Render an exception as an HTTP response and send it. + * + * @param \Exception $e + * @return void + */ + protected function renderHttpResponse(Exception $e) + { + $this->getExceptionHandler()->render($this->app['request'], $e)->send(); + } + + /** + * Handle the PHP shutdown event. + * + * @return void + */ + public function handleShutdown() + { + if (! is_null($error = error_get_last()) && $this->isFatal($error['type'])) { + $this->handleException($this->fatalExceptionFromError($error, 0)); + } + } + + /** + * Create a new fatal exception instance from an error array. + * + * @param array $error + * @param int|null $traceOffset + * @return \Symfony\Component\Debug\Exception\FatalErrorException + */ + protected function fatalExceptionFromError(array $error, $traceOffset = null) + { + return new FatalErrorException( + $error['message'], $error['type'], 0, $error['file'], $error['line'], $traceOffset + ); + } + + /** + * Determine if the error type is fatal. + * + * @param int $type + * @return bool + */ + protected function isFatal($type) + { + return in_array($type, [E_COMPILE_ERROR, E_CORE_ERROR, E_ERROR, E_PARSE]); + } + + /** + * Get an instance of the exception handler. + * + * @return \Illuminate\Contracts\Debug\ExceptionHandler + */ + protected function getExceptionHandler() + { + return $this->app->make(ExceptionHandler::class); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php new file mode 100644 index 00000000..501a1eea --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php @@ -0,0 +1,116 @@ +getCachedConfigPath())) { + $items = require $cached; + + $loadedFromCache = true; + } + + // Next we will spin through all of the configuration files in the configuration + // directory and load each one into the repository. This will make all of the + // options available to the developer for use in various parts of this app. + $app->instance('config', $config = new Repository($items)); + + if (! isset($loadedFromCache)) { + $this->loadConfigurationFiles($app, $config); + } + + // Finally, we will set the application's environment based on the configuration + // values that were loaded. We will pass a callback which will be used to get + // the environment in a web context where an "--env" switch is not present. + $app->detectEnvironment(function () use ($config) { + return $config->get('app.env', 'production'); + }); + + date_default_timezone_set($config->get('app.timezone', 'UTC')); + + mb_internal_encoding('UTF-8'); + } + + /** + * Load the configuration items from all of the files. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Contracts\Config\Repository $repository + * @return void + * + * @throws \Exception + */ + protected function loadConfigurationFiles(Application $app, RepositoryContract $repository) + { + $files = $this->getConfigurationFiles($app); + + if (! isset($files['app'])) { + throw new Exception('Unable to load the "app" configuration file.'); + } + + foreach ($files as $key => $path) { + $repository->set($key, require $path); + } + } + + /** + * Get all of the configuration files for the application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return array + */ + protected function getConfigurationFiles(Application $app) + { + $files = []; + + $configPath = realpath($app->configPath()); + + foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) { + $directory = $this->getNestedDirectory($file, $configPath); + + $files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath(); + } + + ksort($files, SORT_NATURAL); + + return $files; + } + + /** + * Get the configuration file nesting path. + * + * @param \SplFileInfo $file + * @param string $configPath + * @return string + */ + protected function getNestedDirectory(SplFileInfo $file, $configPath) + { + $directory = $file->getPath(); + + if ($nested = trim(str_replace($configPath, '', $directory), DIRECTORY_SEPARATOR)) { + $nested = str_replace(DIRECTORY_SEPARATOR, '.', $nested).'.'; + } + + return $nested; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php new file mode 100644 index 00000000..e03340cc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php @@ -0,0 +1,110 @@ +configurationIsCached()) { + return; + } + + $this->checkForSpecificEnvironmentFile($app); + + try { + $this->createDotenv($app)->safeLoad(); + } catch (InvalidFileException $e) { + $this->writeErrorAndDie($e); + } + } + + /** + * Detect if a custom environment file matching the APP_ENV exists. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + protected function checkForSpecificEnvironmentFile($app) + { + if ($app->runningInConsole() && ($input = new ArgvInput)->hasParameterOption('--env')) { + if ($this->setEnvironmentFilePath( + $app, $app->environmentFile().'.'.$input->getParameterOption('--env') + )) { + return; + } + } + + $environment = Env::get('APP_ENV'); + + if (! $environment) { + return; + } + + $this->setEnvironmentFilePath( + $app, $app->environmentFile().'.'.$environment + ); + } + + /** + * Load a custom environment file. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param string $file + * @return bool + */ + protected function setEnvironmentFilePath($app, $file) + { + if (file_exists($app->environmentPath().'/'.$file)) { + $app->loadEnvironmentFrom($file); + + return true; + } + + return false; + } + + /** + * Create a Dotenv instance. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return \Dotenv\Dotenv + */ + protected function createDotenv($app) + { + return Dotenv::create( + $app->environmentPath(), + $app->environmentFile(), + Env::getFactory() + ); + } + + /** + * Write the error information to the screen and exit. + * + * @param \Dotenv\Exception\InvalidFileException $e + * @return void + */ + protected function writeErrorAndDie(InvalidFileException $e) + { + $output = (new ConsoleOutput)->getErrorOutput(); + + $output->writeln('The environment file is invalid!'); + $output->writeln($e->getMessage()); + + exit(1); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php new file mode 100644 index 00000000..2a4c6b4a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php @@ -0,0 +1,29 @@ +make('config')->get('app.aliases', []), + $app->make(PackageManifest::class)->aliases() + ))->register(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php new file mode 100644 index 00000000..f18375cf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php @@ -0,0 +1,19 @@ +registerConfiguredProviders(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php new file mode 100644 index 00000000..613fa857 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php @@ -0,0 +1,35 @@ +make('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'], + ]); + } + + $app->instance('request', Request::create( + $uri, 'GET', [], [], [], $server + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php new file mode 100644 index 00000000..c98b063f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php @@ -0,0 +1,49 @@ +dispatchNow(new static(...func_get_args())); + } + + /** + * Dispatch a command to its appropriate handler after the current process. + * + * @return mixed + */ + public static function dispatchAfterResponse() + { + return app(Dispatcher::class)->dispatchAfterResponse(new static(...func_get_args())); + } + + /** + * Set the jobs that should run if this job is successful. + * + * @param array $chain + * @return \Illuminate\Foundation\Bus\PendingChain + */ + public static function withChain($chain) + { + return new PendingChain(static::class, $chain); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php new file mode 100644 index 00000000..46d6e5b4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php @@ -0,0 +1,30 @@ +dispatch($job); + } + + /** + * Dispatch a job to its appropriate handler in the current process. + * + * @param mixed $job + * @return mixed + */ + public function dispatchNow($job) + { + return app(Dispatcher::class)->dispatchNow($job); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingChain.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingChain.php new file mode 100644 index 00000000..b3455367 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingChain.php @@ -0,0 +1,45 @@ +class = $class; + $this->chain = $chain; + } + + /** + * Dispatch the job with the given arguments. + * + * @return \Illuminate\Foundation\Bus\PendingDispatch + */ + public function dispatch() + { + return (new PendingDispatch( + new $this->class(...func_get_args()) + ))->chain($this->chain); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingDispatch.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingDispatch.php new file mode 100644 index 00000000..3c3879d4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingDispatch.php @@ -0,0 +1,114 @@ +job = $job; + } + + /** + * Set the desired connection for the job. + * + * @param string|null $connection + * @return $this + */ + public function onConnection($connection) + { + $this->job->onConnection($connection); + + return $this; + } + + /** + * Set the desired queue for the job. + * + * @param string|null $queue + * @return $this + */ + public function onQueue($queue) + { + $this->job->onQueue($queue); + + return $this; + } + + /** + * Set the desired connection for the chain. + * + * @param string|null $connection + * @return $this + */ + public function allOnConnection($connection) + { + $this->job->allOnConnection($connection); + + return $this; + } + + /** + * Set the desired queue for the chain. + * + * @param string|null $queue + * @return $this + */ + public function allOnQueue($queue) + { + $this->job->allOnQueue($queue); + + return $this; + } + + /** + * Set the desired delay for the job. + * + * @param \DateTimeInterface|\DateInterval|int|null $delay + * @return $this + */ + public function delay($delay) + { + $this->job->delay($delay); + + return $this; + } + + /** + * Set the jobs that should run if this job is successful. + * + * @param array $chain + * @return $this + */ + public function chain($chain) + { + $this->job->chain($chain); + + return $this; + } + + /** + * Handle the object's destruction. + * + * @return void + */ + public function __destruct() + { + app(Dispatcher::class)->dispatch($this->job); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php b/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php new file mode 100644 index 00000000..fcda187f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php @@ -0,0 +1,65 @@ +getComposer()->getConfig()->get('vendor-dir').'/autoload.php'; + + static::clearCompiled(); + } + + /** + * Handle the post-update Composer event. + * + * @param \Composer\Script\Event $event + * @return void + */ + public static function postUpdate(Event $event) + { + require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php'; + + static::clearCompiled(); + } + + /** + * Handle the post-autoload-dump Composer event. + * + * @param \Composer\Script\Event $event + * @return void + */ + public static function postAutoloadDump(Event $event) + { + require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php'; + + static::clearCompiled(); + } + + /** + * Clear the cached Laravel bootstrapping files. + * + * @return void + */ + protected static function clearCompiled() + { + $laravel = new Application(getcwd()); + + if (file_exists($servicesPath = $laravel->getCachedServicesPath())) { + @unlink($servicesPath); + } + + if (file_exists($packagesPath = $laravel->getCachedPackagesPath())) { + @unlink($packagesPath); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ChannelMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ChannelMakeCommand.php new file mode 100644 index 00000000..202d81cf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ChannelMakeCommand.php @@ -0,0 +1,65 @@ +userProviderModel()), + parent::buildClass($name) + ); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return __DIR__.'/stubs/channel.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Broadcasting'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php new file mode 100644 index 00000000..399a44dc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php @@ -0,0 +1,40 @@ +laravel->getCachedServicesPath())) { + @unlink($servicesPath); + } + + if (file_exists($packagesPath = $this->laravel->getCachedPackagesPath())) { + @unlink($packagesPath); + } + + $this->info('Compiled services and packages files removed!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClosureCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClosureCommand.php new file mode 100644 index 00000000..c0d736bd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClosureCommand.php @@ -0,0 +1,71 @@ +callback = $callback; + $this->signature = $signature; + + parent::__construct(); + } + + /** + * Execute the console command. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @return mixed + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $inputs = array_merge($input->getArguments(), $input->getOptions()); + + $parameters = []; + + foreach ((new ReflectionFunction($this->callback))->getParameters() as $parameter) { + if (isset($inputs[$parameter->getName()])) { + $parameters[$parameter->getName()] = $inputs[$parameter->getName()]; + } + } + + return $this->laravel->call( + $this->callback->bindTo($this, $this), $parameters + ); + } + + /** + * Set the description for the command. + * + * @param string $description + * @return $this + */ + public function describe($description) + { + $this->setDescription($description); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php new file mode 100644 index 00000000..2703ec7a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php @@ -0,0 +1,92 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + * + * @throws \LogicException + */ + public function handle() + { + $this->call('config:clear'); + + $config = $this->getFreshConfiguration(); + + $configPath = $this->laravel->getCachedConfigPath(); + + $this->files->put( + $configPath, 'files->delete($configPath); + + throw new LogicException('Your configuration files are not serializable.', 0, $e); + } + + $this->info('Configuration cached successfully!'); + } + + /** + * Boot a fresh copy of the application configuration. + * + * @return array + */ + protected function getFreshConfiguration() + { + $app = require $this->laravel->bootstrapPath().'/app.php'; + + $app->useStoragePath($this->laravel->storagePath()); + + $app->make(ConsoleKernelContract::class)->bootstrap(); + + return $app['config']->all(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php new file mode 100644 index 00000000..d20e2d85 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php @@ -0,0 +1,55 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->files->delete($this->laravel->getCachedConfigPath()); + + $this->info('Configuration cache cleared!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php new file mode 100644 index 00000000..0d2ab62e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php @@ -0,0 +1,90 @@ +option('command'), $stub); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return __DIR__.'/stubs/console.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Console\Commands'; + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['name', InputArgument::REQUIRED, 'The name of the command'], + ]; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned', 'command:name'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php new file mode 100644 index 00000000..af2f6eb9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php @@ -0,0 +1,83 @@ +comment('Application is already down.'); + + return true; + } + + file_put_contents(storage_path('framework/down'), + json_encode($this->getDownFilePayload(), + JSON_PRETTY_PRINT)); + + $this->comment('Application is now in maintenance mode.'); + } catch (Exception $e) { + $this->error('Failed to enter maintenance mode.'); + + $this->error($e->getMessage()); + + return 1; + } + } + + /** + * Get the payload to be placed in the "down" file. + * + * @return array + */ + protected function getDownFilePayload() + { + return [ + 'time' => $this->currentTime(), + 'message' => $this->option('message'), + 'retry' => $this->getRetryTime(), + 'allowed' => $this->option('allow'), + ]; + } + + /** + * Get the number of seconds the client should wait before retrying their request. + * + * @return int|null + */ + protected function getRetryTime() + { + $retry = $this->option('retry'); + + return is_numeric($retry) && $retry > 0 ? (int) $retry : null; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php new file mode 100644 index 00000000..ab3bb320 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php @@ -0,0 +1,32 @@ +line('Current application environment: '.$this->laravel['env'].''); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventCacheCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventCacheCommand.php new file mode 100644 index 00000000..310b40ac --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventCacheCommand.php @@ -0,0 +1,58 @@ +call('event:clear'); + + file_put_contents( + $this->laravel->getCachedEventsPath(), + 'getEvents(), true).';' + ); + + $this->info('Events cached successfully!'); + } + + /** + * Get all of the events and listeners configured for the application. + * + * @return array + */ + protected function getEvents() + { + $events = []; + + foreach ($this->laravel->getProviders(EventServiceProvider::class) as $provider) { + $providerEvents = array_merge_recursive($provider->shouldDiscoverEvents() ? $provider->discoverEvents() : [], $provider->listens()); + + $events[get_class($provider)] = $providerEvents; + } + + return $events; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventClearCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventClearCommand.php new file mode 100644 index 00000000..a5fe4e67 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventClearCommand.php @@ -0,0 +1,57 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + * + * @throws \RuntimeException + */ + public function handle() + { + $this->files->delete($this->laravel->getCachedEventsPath()); + + $this->info('Cached events cleared!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php new file mode 100644 index 00000000..529b198f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php @@ -0,0 +1,78 @@ +laravel->getProviders(EventServiceProvider::class); + + foreach ($providers as $provider) { + foreach ($provider->listens() as $event => $listeners) { + $this->makeEventAndListeners($event, $listeners); + } + } + + $this->info('Events and listeners generated successfully!'); + } + + /** + * Make the event and listeners for the given event. + * + * @param string $event + * @param array $listeners + * @return void + */ + protected function makeEventAndListeners($event, $listeners) + { + if (! Str::contains($event, '\\')) { + return; + } + + $this->callSilent('make:event', ['name' => $event]); + + $this->makeListeners($event, $listeners); + } + + /** + * Make the listeners for the given event. + * + * @param string $event + * @param array $listeners + * @return void + */ + protected function makeListeners($event, $listeners) + { + foreach ($listeners as $listener) { + $listener = preg_replace('/@.+$/', '', $listener); + + $this->callSilent('make:listener', array_filter( + ['name' => $listener, '--event' => $event] + )); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventListCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventListCommand.php new file mode 100644 index 00000000..4b11ebb4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventListCommand.php @@ -0,0 +1,91 @@ +getEvents(); + + if (empty($events)) { + return $this->error("Your application doesn't have any events matching the given criteria."); + } + + $this->table(['Event', 'Listeners'], $events); + } + + /** + * Get all of the events and listeners configured for the application. + * + * @return array + */ + protected function getEvents() + { + $events = []; + + foreach ($this->laravel->getProviders(EventServiceProvider::class) as $provider) { + $providerEvents = array_merge_recursive($provider->shouldDiscoverEvents() ? $provider->discoverEvents() : [], $provider->listens()); + + $events = array_merge_recursive($events, $providerEvents); + } + + if ($this->filteringByEvent()) { + $events = $this->filterEvents($events); + } + + return collect($events)->map(function ($listeners, $event) { + return ['Event' => $event, 'Listeners' => implode(PHP_EOL, $listeners)]; + })->sortBy('Event')->values()->toArray(); + } + + /** + * Filter the given events using the provided event name filter. + * + * @param array $events + * @return array + */ + protected function filterEvents(array $events) + { + if (! $eventName = $this->option('event')) { + return $events; + } + + return collect($events)->filter(function ($listeners, $event) use ($eventName) { + return Str::contains($event, $eventName); + })->toArray(); + } + + /** + * Determine whether the user is filtering by an event name. + * + * @return bool + */ + protected function filteringByEvent() + { + return ! empty($this->option('event')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php new file mode 100644 index 00000000..f18719aa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php @@ -0,0 +1,61 @@ +option('render')) { + return $this->option('report') + ? __DIR__.'/stubs/exception-render-report.stub' + : __DIR__.'/stubs/exception-render.stub'; + } + + return $this->option('report') + ? __DIR__.'/stubs/exception-report.stub' + : __DIR__.'/stubs/exception.stub'; + } + + /** + * Determine if the class already exists. + * + * @param string $rawName + * @return bool + */ + protected function alreadyExists($rawName) + { + return class_exists($this->rootNamespace().'Exceptions\\'.$rawName); + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Exceptions'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['render', null, InputOption::VALUE_NONE, 'Create the exception with an empty render method'], + + ['report', null, InputOption::VALUE_NONE, 'Create the exception with an empty report method'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/JobMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/JobMakeCommand.php new file mode 100644 index 00000000..60d942eb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/JobMakeCommand.php @@ -0,0 +1,65 @@ +option('sync') + ? __DIR__.'/stubs/job.stub' + : __DIR__.'/stubs/job-queued.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Jobs'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['sync', null, InputOption::VALUE_NONE, 'Indicates that job should be synchronous'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php new file mode 100644 index 00000000..058ee7c8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php @@ -0,0 +1,390 @@ +app = $app; + $this->events = $events; + + $this->app->booted(function () { + $this->defineConsoleSchedule(); + }); + } + + /** + * Define the application's command schedule. + * + * @return void + */ + protected function defineConsoleSchedule() + { + $this->app->singleton(Schedule::class, function ($app) { + return tap(new Schedule($this->scheduleTimezone()), function ($schedule) { + $this->schedule($schedule->useCache($this->scheduleCache())); + }); + }); + } + + /** + * Get the name of the cache store that should manage scheduling mutexes. + * + * @return string + */ + protected function scheduleCache() + { + return Env::get('SCHEDULE_CACHE_DRIVER'); + } + + /** + * Run the console application. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface|null $output + * @return int + */ + public function handle($input, $output = null) + { + try { + $this->bootstrap(); + + return $this->getArtisan()->run($input, $output); + } catch (Exception $e) { + $this->reportException($e); + + $this->renderException($output, $e); + + return 1; + } catch (Throwable $e) { + $e = new FatalThrowableError($e); + + $this->reportException($e); + + $this->renderException($output, $e); + + return 1; + } + } + + /** + * Terminate the application. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param int $status + * @return void + */ + public function terminate($input, $status) + { + $this->app->terminate(); + } + + /** + * Define the application's command schedule. + * + * @param \Illuminate\Console\Scheduling\Schedule $schedule + * @return void + */ + protected function schedule(Schedule $schedule) + { + // + } + + /** + * Get the timezone that should be used by default for scheduled events. + * + * @return \DateTimeZone|string|null + */ + protected function scheduleTimezone() + { + $config = $this->app['config']; + + return $config->get('app.schedule_timezone', $config->get('app.timezone')); + } + + /** + * Register the Closure based commands for the application. + * + * @return void + */ + protected function commands() + { + // + } + + /** + * Register a Closure based command with the application. + * + * @param string $signature + * @param \Closure $callback + * @return \Illuminate\Foundation\Console\ClosureCommand + */ + public function command($signature, Closure $callback) + { + $command = new ClosureCommand($signature, $callback); + + Artisan::starting(function ($artisan) use ($command) { + $artisan->add($command); + }); + + return $command; + } + + /** + * Register all of the commands in the given directory. + * + * @param array|string $paths + * @return void + */ + protected function load($paths) + { + $paths = array_unique(Arr::wrap($paths)); + + $paths = array_filter($paths, function ($path) { + return is_dir($path); + }); + + if (empty($paths)) { + return; + } + + $namespace = $this->app->getNamespace(); + + foreach ((new Finder)->in($paths)->files() as $command) { + $command = $namespace.str_replace( + ['/', '.php'], + ['\\', ''], + Str::after($command->getPathname(), realpath(app_path()).DIRECTORY_SEPARATOR) + ); + + if (is_subclass_of($command, Command::class) && + ! (new ReflectionClass($command))->isAbstract()) { + Artisan::starting(function ($artisan) use ($command) { + $artisan->resolve($command); + }); + } + } + } + + /** + * Register the given command with the console application. + * + * @param \Symfony\Component\Console\Command\Command $command + * @return void + */ + public function registerCommand($command) + { + $this->getArtisan()->add($command); + } + + /** + * Run an Artisan console command by name. + * + * @param string $command + * @param array $parameters + * @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer + * @return int + * + * @throws \Symfony\Component\Console\Exception\CommandNotFoundException + */ + public function call($command, array $parameters = [], $outputBuffer = null) + { + $this->bootstrap(); + + return $this->getArtisan()->call($command, $parameters, $outputBuffer); + } + + /** + * Queue the given console command. + * + * @param string $command + * @param array $parameters + * @return \Illuminate\Foundation\Bus\PendingDispatch + */ + public function queue($command, array $parameters = []) + { + return QueuedCommand::dispatch(func_get_args()); + } + + /** + * Get all of the commands registered with the console. + * + * @return array + */ + public function all() + { + $this->bootstrap(); + + return $this->getArtisan()->all(); + } + + /** + * Get the output for the last run command. + * + * @return string + */ + public function output() + { + $this->bootstrap(); + + return $this->getArtisan()->output(); + } + + /** + * Bootstrap the application for artisan commands. + * + * @return void + */ + public function bootstrap() + { + if (! $this->app->hasBeenBootstrapped()) { + $this->app->bootstrapWith($this->bootstrappers()); + } + + $this->app->loadDeferredProviders(); + + if (! $this->commandsLoaded) { + $this->commands(); + + $this->commandsLoaded = true; + } + } + + /** + * Get the Artisan application instance. + * + * @return \Illuminate\Console\Application + */ + protected function getArtisan() + { + if (is_null($this->artisan)) { + return $this->artisan = (new Artisan($this->app, $this->events, $this->app->version())) + ->resolveCommands($this->commands); + } + + return $this->artisan; + } + + /** + * Set the Artisan application instance. + * + * @param \Illuminate\Console\Application $artisan + * @return void + */ + public function setArtisan($artisan) + { + $this->artisan = $artisan; + } + + /** + * Get the bootstrap classes for the application. + * + * @return array + */ + protected function bootstrappers() + { + return $this->bootstrappers; + } + + /** + * Report the exception to the exception handler. + * + * @param \Exception $e + * @return void + */ + protected function reportException(Exception $e) + { + $this->app[ExceptionHandler::class]->report($e); + } + + /** + * Render the given exception. + * + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @param \Exception $e + * @return void + */ + protected function renderException($output, Exception $e) + { + $this->app[ExceptionHandler::class]->renderForConsole($output, $e); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php new file mode 100644 index 00000000..030ca213 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php @@ -0,0 +1,111 @@ +generateRandomKey(); + + if ($this->option('show')) { + return $this->line(''.$key.''); + } + + // Next, we will replace the application key in the environment file so it is + // automatically setup for this developer. This key gets generated using a + // secure random byte generator and is later base64 encoded for storage. + if (! $this->setKeyInEnvironmentFile($key)) { + return; + } + + $this->laravel['config']['app.key'] = $key; + + $this->info('Application key set successfully.'); + } + + /** + * Generate a random key for the application. + * + * @return string + */ + protected function generateRandomKey() + { + return 'base64:'.base64_encode( + Encrypter::generateKey($this->laravel['config']['app.cipher']) + ); + } + + /** + * Set the application key in the environment file. + * + * @param string $key + * @return bool + */ + protected function setKeyInEnvironmentFile($key) + { + $currentKey = $this->laravel['config']['app.key']; + + if (strlen($currentKey) !== 0 && (! $this->confirmToProceed())) { + return false; + } + + $this->writeNewEnvironmentFileWith($key); + + return true; + } + + /** + * Write a new environment file with the given key. + * + * @param string $key + * @return void + */ + protected function writeNewEnvironmentFileWith($key) + { + file_put_contents($this->laravel->environmentFilePath(), preg_replace( + $this->keyReplacementPattern(), + 'APP_KEY='.$key, + file_get_contents($this->laravel->environmentFilePath()) + )); + } + + /** + * Get a regex pattern that will match env APP_KEY with any random key. + * + * @return string + */ + protected function keyReplacementPattern() + { + $escaped = preg_quote('='.$this->laravel['config']['app.key'], '/'); + + return "/^APP_KEY{$escaped}/m"; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ListenerMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ListenerMakeCommand.php new file mode 100644 index 00000000..0ded743a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ListenerMakeCommand.php @@ -0,0 +1,112 @@ +option('event'); + + if (! Str::startsWith($event, [ + $this->laravel->getNamespace(), + 'Illuminate', + '\\', + ])) { + $event = $this->laravel->getNamespace().'Events\\'.$event; + } + + $stub = str_replace( + 'DummyEvent', class_basename($event), parent::buildClass($name) + ); + + return str_replace( + 'DummyFullEvent', trim($event, '\\'), $stub + ); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + if ($this->option('queued')) { + return $this->option('event') + ? __DIR__.'/stubs/listener-queued.stub' + : __DIR__.'/stubs/listener-queued-duck.stub'; + } + + return $this->option('event') + ? __DIR__.'/stubs/listener.stub' + : __DIR__.'/stubs/listener-duck.stub'; + } + + /** + * Determine if the class already exists. + * + * @param string $rawName + * @return bool + */ + protected function alreadyExists($rawName) + { + return class_exists($rawName); + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Listeners'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['event', 'e', InputOption::VALUE_OPTIONAL, 'The event class being listened for'], + + ['queued', null, InputOption::VALUE_NONE, 'Indicates the event listener should be queued'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/MailMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/MailMakeCommand.php new file mode 100644 index 00000000..d401a9ec --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/MailMakeCommand.php @@ -0,0 +1,116 @@ +option('force')) { + return; + } + + if ($this->option('markdown')) { + $this->writeMarkdownTemplate(); + } + } + + /** + * Write the Markdown template for the mailable. + * + * @return void + */ + protected function writeMarkdownTemplate() + { + $path = resource_path('views/'.str_replace('.', '/', $this->option('markdown'))).'.blade.php'; + + if (! $this->files->isDirectory(dirname($path))) { + $this->files->makeDirectory(dirname($path), 0755, true); + } + + $this->files->put($path, file_get_contents(__DIR__.'/stubs/markdown.stub')); + } + + /** + * Build the class with the given name. + * + * @param string $name + * @return string + */ + protected function buildClass($name) + { + $class = parent::buildClass($name); + + if ($this->option('markdown')) { + $class = str_replace('DummyView', $this->option('markdown'), $class); + } + + return $class; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return $this->option('markdown') + ? __DIR__.'/stubs/markdown-mail.stub' + : __DIR__.'/stubs/mail.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Mail'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the mailable already exists'], + + ['markdown', 'm', InputOption::VALUE_OPTIONAL, 'Create a new Markdown template for the mailable'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php new file mode 100644 index 00000000..0d2d0b93 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php @@ -0,0 +1,167 @@ +option('force')) { + return false; + } + + if ($this->option('all')) { + $this->input->setOption('factory', true); + $this->input->setOption('seed', true); + $this->input->setOption('migration', true); + $this->input->setOption('controller', true); + $this->input->setOption('resource', true); + } + + if ($this->option('factory')) { + $this->createFactory(); + } + + if ($this->option('migration')) { + $this->createMigration(); + } + + if ($this->option('seed')) { + $this->createSeeder(); + } + + if ($this->option('controller') || $this->option('resource') || $this->option('api')) { + $this->createController(); + } + } + + /** + * Create a model factory for the model. + * + * @return void + */ + protected function createFactory() + { + $factory = Str::studly(class_basename($this->argument('name'))); + + $this->call('make:factory', [ + 'name' => "{$factory}Factory", + '--model' => $this->qualifyClass($this->getNameInput()), + ]); + } + + /** + * Create a migration file for the model. + * + * @return void + */ + protected function createMigration() + { + $table = Str::snake(Str::pluralStudly(class_basename($this->argument('name')))); + + if ($this->option('pivot')) { + $table = Str::singular($table); + } + + $this->call('make:migration', [ + 'name' => "create_{$table}_table", + '--create' => $table, + ]); + } + + /** + * Create a seeder file for the model. + * + * @return void + */ + protected function createSeeder() + { + $seeder = Str::studly(class_basename($this->argument('name'))); + + $this->call('make:seed', [ + 'name' => "{$seeder}Seeder", + ]); + } + + /** + * Create a controller for the model. + * + * @return void + */ + protected function createController() + { + $controller = Str::studly(class_basename($this->argument('name'))); + + $modelName = $this->qualifyClass($this->getNameInput()); + + $this->call('make:controller', array_filter([ + 'name' => "{$controller}Controller", + '--model' => $this->option('resource') || $this->option('api') ? $modelName : null, + '--api' => $this->option('api'), + ])); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + if ($this->option('pivot')) { + return __DIR__.'/stubs/pivot.model.stub'; + } + + return __DIR__.'/stubs/model.stub'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, seeder, factory, and resource controller for the model'], + ['controller', 'c', InputOption::VALUE_NONE, 'Create a new controller for the model'], + ['factory', 'f', InputOption::VALUE_NONE, 'Create a new factory for the model'], + ['force', null, InputOption::VALUE_NONE, 'Create the class even if the model already exists'], + ['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model'], + ['seed', 's', InputOption::VALUE_NONE, 'Create a new seeder file for the model'], + ['pivot', 'p', InputOption::VALUE_NONE, 'Indicates if the generated model should be a custom intermediate table model'], + ['resource', 'r', InputOption::VALUE_NONE, 'Indicates if the generated controller should be a resource controller'], + ['api', null, InputOption::VALUE_NONE, 'Indicates if the generated controller should be an API controller'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/NotificationMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/NotificationMakeCommand.php new file mode 100644 index 00000000..40e9d849 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/NotificationMakeCommand.php @@ -0,0 +1,116 @@ +option('force')) { + return; + } + + if ($this->option('markdown')) { + $this->writeMarkdownTemplate(); + } + } + + /** + * Write the Markdown template for the mailable. + * + * @return void + */ + protected function writeMarkdownTemplate() + { + $path = resource_path('views/'.str_replace('.', '/', $this->option('markdown'))).'.blade.php'; + + if (! $this->files->isDirectory(dirname($path))) { + $this->files->makeDirectory(dirname($path), 0755, true); + } + + $this->files->put($path, file_get_contents(__DIR__.'/stubs/markdown.stub')); + } + + /** + * Build the class with the given name. + * + * @param string $name + * @return string + */ + protected function buildClass($name) + { + $class = parent::buildClass($name); + + if ($this->option('markdown')) { + $class = str_replace('DummyView', $this->option('markdown'), $class); + } + + return $class; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return $this->option('markdown') + ? __DIR__.'/stubs/markdown-notification.stub' + : __DIR__.'/stubs/notification.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Notifications'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the notification already exists'], + + ['markdown', 'm', InputOption::VALUE_OPTIONAL, 'Create a new Markdown template for the notification'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ObserverMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ObserverMakeCommand.php new file mode 100644 index 00000000..b1f1346a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ObserverMakeCommand.php @@ -0,0 +1,113 @@ +option('model'); + + return $model ? $this->replaceModel($stub, $model) : $stub; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return $this->option('model') + ? __DIR__.'/stubs/observer.stub' + : __DIR__.'/stubs/observer.plain.stub'; + } + + /** + * Replace the model for the given stub. + * + * @param string $stub + * @param string $model + * @return string + */ + protected function replaceModel($stub, $model) + { + $model = str_replace('/', '\\', $model); + + $namespaceModel = $this->laravel->getNamespace().$model; + + if (Str::startsWith($model, '\\')) { + $stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub); + } else { + $stub = str_replace('NamespacedDummyModel', $namespaceModel, $stub); + } + + $stub = str_replace( + "use {$namespaceModel};\nuse {$namespaceModel};", "use {$namespaceModel};", $stub + ); + + $model = class_basename(trim($model, '\\')); + + $stub = str_replace('DocDummyModel', Str::snake($model, ' '), $stub); + + $stub = str_replace('DummyModel', $model, $stub); + + return str_replace('dummyModel', Str::camel($model), $stub); + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Observers'; + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getOptions() + { + return [ + ['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the observer applies to.'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeClearCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeClearCommand.php new file mode 100644 index 00000000..0bd92dfe --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeClearCommand.php @@ -0,0 +1,38 @@ +call('view:clear'); + $this->call('cache:clear'); + $this->call('route:clear'); + $this->call('config:clear'); + $this->call('clear-compiled'); + + $this->info('Caches cleared successfully!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php new file mode 100644 index 00000000..af5d731e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php @@ -0,0 +1,35 @@ +call('config:cache'); + $this->call('route:cache'); + + $this->info('Files cached successfully!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php new file mode 100644 index 00000000..3ef8f01f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php @@ -0,0 +1,40 @@ +build(); + + foreach (array_keys($manifest->manifest) as $package) { + $this->line("Discovered Package: {$package}"); + } + + $this->info('Package manifest generated successfully.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php new file mode 100644 index 00000000..adc04d3c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php @@ -0,0 +1,144 @@ +replaceUserNamespace( + parent::buildClass($name) + ); + + $model = $this->option('model'); + + return $model ? $this->replaceModel($stub, $model) : $stub; + } + + /** + * Replace the User model namespace. + * + * @param string $stub + * @return string + */ + protected function replaceUserNamespace($stub) + { + $model = $this->userProviderModel(); + + if (! $model) { + return $stub; + } + + return str_replace( + $this->rootNamespace().'User', + $model, + $stub + ); + } + + /** + * Replace the model for the given stub. + * + * @param string $stub + * @param string $model + * @return string + */ + protected function replaceModel($stub, $model) + { + $model = str_replace('/', '\\', $model); + + $namespaceModel = $this->laravel->getNamespace().$model; + + if (Str::startsWith($model, '\\')) { + $stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub); + } else { + $stub = str_replace('NamespacedDummyModel', $namespaceModel, $stub); + } + + $stub = str_replace( + "use {$namespaceModel};\nuse {$namespaceModel};", "use {$namespaceModel};", $stub + ); + + $model = class_basename(trim($model, '\\')); + + $dummyUser = class_basename($this->userProviderModel()); + + $dummyModel = Str::camel($model) === 'user' ? 'model' : $model; + + $stub = str_replace('DocDummyModel', Str::snake($dummyModel, ' '), $stub); + + $stub = str_replace('DummyModel', $model, $stub); + + $stub = str_replace('dummyModel', Str::camel($dummyModel), $stub); + + $stub = str_replace('DummyUser', $dummyUser, $stub); + + return str_replace('DocDummyPluralModel', Str::snake(Str::pluralStudly($dummyModel), ' '), $stub); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return $this->option('model') + ? __DIR__.'/stubs/policy.stub' + : __DIR__.'/stubs/policy.plain.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Policies'; + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getOptions() + { + return [ + ['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the policy applies to'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/PresetCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/PresetCommand.php new file mode 100644 index 00000000..6473d154 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/PresetCommand.php @@ -0,0 +1,96 @@ +argument('type'))) { + return call_user_func(static::$macros[$this->argument('type')], $this); + } + + if (! in_array($this->argument('type'), ['none', 'bootstrap', 'vue', 'react'])) { + throw new InvalidArgumentException('Invalid preset.'); + } + + return $this->{$this->argument('type')}(); + } + + /** + * Install the "fresh" preset. + * + * @return void + */ + protected function none() + { + Presets\None::install(); + + $this->info('Frontend scaffolding removed successfully.'); + } + + /** + * Install the "bootstrap" preset. + * + * @return void + */ + protected function bootstrap() + { + Presets\Bootstrap::install(); + + $this->info('Bootstrap scaffolding installed successfully.'); + $this->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); + } + + /** + * Install the "vue" preset. + * + * @return void + */ + protected function vue() + { + Presets\Vue::install(); + + $this->info('Vue scaffolding installed successfully.'); + $this->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); + } + + /** + * Install the "react" preset. + * + * @return void + */ + protected function react() + { + Presets\React::install(); + + $this->info('React scaffolding installed successfully.'); + $this->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Bootstrap.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Bootstrap.php new file mode 100644 index 00000000..248e2f29 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Bootstrap.php @@ -0,0 +1,44 @@ + '^4.0.0', + 'jquery' => '^3.2', + 'popper.js' => '^1.12', + ] + $packages; + } + + /** + * Update the Sass files for the application. + * + * @return void + */ + protected static function updateSass() + { + copy(__DIR__.'/bootstrap-stubs/_variables.scss', resource_path('sass/_variables.scss')); + copy(__DIR__.'/bootstrap-stubs/app.scss', resource_path('sass/app.scss')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/None.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/None.php new file mode 100644 index 00000000..63e813e4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/None.php @@ -0,0 +1,72 @@ +deleteDirectory(resource_path('js/components')); + $filesystem->delete(resource_path('sass/_variables.scss')); + $filesystem->deleteDirectory(base_path('node_modules')); + $filesystem->deleteDirectory(public_path('css')); + $filesystem->deleteDirectory(public_path('js')); + }); + } + + /** + * Update the given package array. + * + * @param array $packages + * @return array + */ + protected static function updatePackageArray(array $packages) + { + unset( + $packages['bootstrap'], + $packages['jquery'], + $packages['popper.js'], + $packages['vue'], + $packages['vue-template-compiler'], + $packages['@babel/preset-react'], + $packages['react'], + $packages['react-dom'] + ); + + return $packages; + } + + /** + * Write the stubs for the Sass and JavaScript files. + * + * @return void + */ + protected static function updateBootstrapping() + { + file_put_contents(resource_path('sass/app.scss'), ''.PHP_EOL); + copy(__DIR__.'/none-stubs/app.js', resource_path('js/app.js')); + copy(__DIR__.'/none-stubs/bootstrap.js', resource_path('js/bootstrap.js')); + } + + /** + * Update the Webpack configuration. + * + * @return void + */ + protected static function updateWebpackConfiguration() + { + copy(__DIR__.'/none-stubs/webpack.mix.js', base_path('webpack.mix.js')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Preset.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Preset.php new file mode 100644 index 00000000..99af6b6f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Preset.php @@ -0,0 +1,64 @@ +isDirectory($directory = resource_path('js/components'))) { + $filesystem->makeDirectory($directory, 0755, true); + } + } + + /** + * Update the "package.json" file. + * + * @param bool $dev + * @return void + */ + protected static function updatePackages($dev = true) + { + if (! file_exists(base_path('package.json'))) { + return; + } + + $configurationKey = $dev ? 'devDependencies' : 'dependencies'; + + $packages = json_decode(file_get_contents(base_path('package.json')), true); + + $packages[$configurationKey] = static::updatePackageArray( + array_key_exists($configurationKey, $packages) ? $packages[$configurationKey] : [] + ); + + ksort($packages[$configurationKey]); + + file_put_contents( + base_path('package.json'), + json_encode($packages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT).PHP_EOL + ); + } + + /** + * Remove the installed Node modules. + * + * @return void + */ + protected static function removeNodeModules() + { + tap(new Filesystem, function ($files) { + $files->deleteDirectory(base_path('node_modules')); + + $files->delete(base_path('yarn.lock')); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/React.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/React.php new file mode 100644 index 00000000..a7871b38 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/React.php @@ -0,0 +1,76 @@ + '^7.0.0', + 'react' => '^16.2.0', + 'react-dom' => '^16.2.0', + ] + Arr::except($packages, ['vue', 'vue-template-compiler']); + } + + /** + * Update the Webpack configuration. + * + * @return void + */ + protected static function updateWebpackConfiguration() + { + copy(__DIR__.'/react-stubs/webpack.mix.js', base_path('webpack.mix.js')); + } + + /** + * Update the example component. + * + * @return void + */ + protected static function updateComponent() + { + (new Filesystem)->delete( + resource_path('js/components/ExampleComponent.vue') + ); + + copy( + __DIR__.'/react-stubs/Example.js', + resource_path('js/components/Example.js') + ); + } + + /** + * Update the bootstrapping files. + * + * @return void + */ + protected static function updateBootstrapping() + { + copy(__DIR__.'/react-stubs/app.js', resource_path('js/app.js')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Vue.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Vue.php new file mode 100644 index 00000000..9d6a966b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Vue.php @@ -0,0 +1,76 @@ + '^2.5.17'] + Arr::except($packages, [ + '@babel/preset-react', + 'react', + 'react-dom', + ]); + } + + /** + * Update the Webpack configuration. + * + * @return void + */ + protected static function updateWebpackConfiguration() + { + copy(__DIR__.'/vue-stubs/webpack.mix.js', base_path('webpack.mix.js')); + } + + /** + * Update the example component. + * + * @return void + */ + protected static function updateComponent() + { + (new Filesystem)->delete( + resource_path('js/components/Example.js') + ); + + copy( + __DIR__.'/vue-stubs/ExampleComponent.vue', + resource_path('js/components/ExampleComponent.vue') + ); + } + + /** + * Update the bootstrapping files. + * + * @return void + */ + protected static function updateBootstrapping() + { + copy(__DIR__.'/vue-stubs/app.js', resource_path('js/app.js')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/_variables.scss b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/_variables.scss new file mode 100644 index 00000000..0407ab57 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/_variables.scss @@ -0,0 +1,19 @@ +// Body +$body-bg: #f8fafc; + +// Typography +$font-family-sans-serif: 'Nunito', sans-serif; +$font-size-base: 0.9rem; +$line-height-base: 1.6; + +// Colors +$blue: #3490dc; +$indigo: #6574cd; +$purple: #9561e2; +$pink: #f66d9b; +$red: #e3342f; +$orange: #f6993f; +$yellow: #ffed4a; +$green: #38c172; +$teal: #4dc0b5; +$cyan: #6cb2eb; diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/app.scss b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/app.scss new file mode 100644 index 00000000..3f1850e3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/app.scss @@ -0,0 +1,13 @@ +// Fonts +@import url('https://fonts.googleapis.com/css?family=Nunito'); + +// Variables +@import 'variables'; + +// Bootstrap +@import '~bootstrap/scss/bootstrap'; + +.navbar-laravel { + background-color: #fff; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04); +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/app.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/app.js new file mode 100644 index 00000000..31d6f636 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/app.js @@ -0,0 +1,7 @@ +/** + * First, we will load all of this project's Javascript utilities and other + * dependencies. Then, we will be ready to develop a robust and powerful + * application frontend using useful Laravel and JavaScript libraries. + */ + +require('./bootstrap'); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/bootstrap.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/bootstrap.js new file mode 100644 index 00000000..0c8a1b52 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/bootstrap.js @@ -0,0 +1,42 @@ +window._ = require('lodash'); + +/** + * We'll load the axios HTTP library which allows us to easily issue requests + * to our Laravel back-end. This library automatically handles sending the + * CSRF token as a header based on the value of the "XSRF" token cookie. + */ + +window.axios = require('axios'); + +window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; + +/** + * Next we will register the CSRF Token as a common header with Axios so that + * all outgoing HTTP requests automatically have it attached. This is just + * a simple convenience so we don't have to attach every token manually. + */ + +let token = document.head.querySelector('meta[name="csrf-token"]'); + +if (token) { + window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; +} else { + console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); +} + +/** + * Echo exposes an expressive API for subscribing to channels and listening + * for events that are broadcast by Laravel. Echo and event broadcasting + * allows your team to easily build robust real-time web applications. + */ + +// import Echo from 'laravel-echo' + +// window.Pusher = require('pusher-js'); + +// window.Echo = new Echo({ +// broadcaster: 'pusher', +// key: process.env.MIX_PUSHER_APP_KEY, +// cluster: process.env.MIX_PUSHER_APP_CLUSTER, +// encrypted: true +// }); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/webpack.mix.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/webpack.mix.js new file mode 100644 index 00000000..19a48fa1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/webpack.mix.js @@ -0,0 +1,15 @@ +const mix = require('laravel-mix'); + +/* + |-------------------------------------------------------------------------- + | Mix Asset Management + |-------------------------------------------------------------------------- + | + | Mix provides a clean, fluent API for defining some Webpack build steps + | for your Laravel application. By default, we are compiling the Sass + | file for the application as well as bundling up all the JS files. + | + */ + +mix.js('resources/js/app.js', 'public/js') + .sass('resources/sass/app.scss', 'public/css'); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/Example.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/Example.js new file mode 100644 index 00000000..eac7e850 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/Example.js @@ -0,0 +1,24 @@ +import React, { Component } from 'react'; +import ReactDOM from 'react-dom'; + +export default class Example extends Component { + render() { + return ( +
+
+
+
+
Example Component
+ +
I'm an example component!
+
+
+
+
+ ); + } +} + +if (document.getElementById('example')) { + ReactDOM.render(, document.getElementById('example')); +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/app.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/app.js new file mode 100644 index 00000000..a5f91ab3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/app.js @@ -0,0 +1,15 @@ +/** + * First we will load all of this project's JavaScript dependencies which + * includes React and other helpers. It's a great starting point while + * building robust, powerful web applications using React + Laravel. + */ + +require('./bootstrap'); + +/** + * Next, we will create a fresh React component instance and attach it to + * the page. Then, you may begin adding components to this application + * or customize the JavaScript scaffolding to fit your unique needs. + */ + +require('./components/Example'); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/webpack.mix.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/webpack.mix.js new file mode 100644 index 00000000..cc075aa9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/webpack.mix.js @@ -0,0 +1,15 @@ +const mix = require('laravel-mix'); + +/* + |-------------------------------------------------------------------------- + | Mix Asset Management + |-------------------------------------------------------------------------- + | + | Mix provides a clean, fluent API for defining some Webpack build steps + | for your Laravel application. By default, we are compiling the Sass + | file for the application as well as bundling up all the JS files. + | + */ + +mix.react('resources/js/app.js', 'public/js') + .sass('resources/sass/app.scss', 'public/css'); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/ExampleComponent.vue b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/ExampleComponent.vue new file mode 100644 index 00000000..3fb9f9aa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/ExampleComponent.vue @@ -0,0 +1,23 @@ + + + diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/app.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/app.js new file mode 100644 index 00000000..aa19e31a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/app.js @@ -0,0 +1,32 @@ +/** + * First we will load all of this project's JavaScript dependencies which + * includes Vue and other libraries. It is a great starting point when + * building robust, powerful web applications using Vue and Laravel. + */ + +require('./bootstrap'); + +window.Vue = require('vue'); + +/** + * The following block of code may be used to automatically register your + * Vue components. It will recursively scan this directory for the Vue + * components and automatically register them with their "basename". + * + * Eg. ./components/ExampleComponent.vue -> + */ + +// const files = require.context('./', true, /\.vue$/i) +// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default)) + +Vue.component('example-component', require('./components/ExampleComponent.vue').default); + +/** + * Next, we will create a fresh Vue application instance and attach it to + * the page. Then, you may begin adding components to this application + * or customize the JavaScript scaffolding to fit your unique needs. + */ + +const app = new Vue({ + el: '#app', +}); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/webpack.mix.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/webpack.mix.js new file mode 100644 index 00000000..19a48fa1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/webpack.mix.js @@ -0,0 +1,15 @@ +const mix = require('laravel-mix'); + +/* + |-------------------------------------------------------------------------- + | Mix Asset Management + |-------------------------------------------------------------------------- + | + | Mix provides a clean, fluent API for defining some Webpack build steps + | for your Laravel application. By default, we are compiling the Sass + | file for the application as well as bundling up all the JS files. + | + */ + +mix.js('resources/js/app.js', 'public/js') + .sass('resources/sass/app.scss', 'public/css'); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ProviderMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ProviderMakeCommand.php new file mode 100644 index 00000000..fa887edb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ProviderMakeCommand.php @@ -0,0 +1,50 @@ +data = $data; + } + + /** + * Handle the job. + * + * @param \Illuminate\Contracts\Console\Kernel $kernel + * @return void + */ + public function handle(KernelContract $kernel) + { + $kernel->call(...array_values($this->data)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php new file mode 100644 index 00000000..95b7a87b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php @@ -0,0 +1,50 @@ +collection()) { + $this->type = 'Resource collection'; + } + + parent::handle(); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return $this->collection() + ? __DIR__.'/stubs/resource-collection.stub' + : __DIR__.'/stubs/resource.stub'; + } + + /** + * Determine if the command is generating a resource collection. + * + * @return bool + */ + protected function collection() + { + return $this->option('collection') || + Str::endsWith($this->argument('name'), 'Collection'); + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Http\Resources'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['collection', 'c', InputOption::VALUE_NONE, 'Create a resource collection'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php new file mode 100644 index 00000000..f61e26ba --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php @@ -0,0 +1,109 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->call('route:clear'); + + $routes = $this->getFreshApplicationRoutes(); + + if (count($routes) === 0) { + return $this->error("Your application doesn't have any routes."); + } + + foreach ($routes as $route) { + $route->prepareForSerialization(); + } + + $this->files->put( + $this->laravel->getCachedRoutesPath(), $this->buildRouteCacheFile($routes) + ); + + $this->info('Routes cached successfully!'); + } + + /** + * Boot a fresh copy of the application and get the routes. + * + * @return \Illuminate\Routing\RouteCollection + */ + protected function getFreshApplicationRoutes() + { + return tap($this->getFreshApplication()['router']->getRoutes(), function ($routes) { + $routes->refreshNameLookups(); + $routes->refreshActionLookups(); + }); + } + + /** + * Get a fresh application instance. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + protected function getFreshApplication() + { + return tap(require $this->laravel->bootstrapPath().'/app.php', function ($app) { + $app->make(ConsoleKernelContract::class)->bootstrap(); + }); + } + + /** + * Build the route cache file. + * + * @param \Illuminate\Routing\RouteCollection $routes + * @return string + */ + protected function buildRouteCacheFile(RouteCollection $routes) + { + $stub = $this->files->get(__DIR__.'/stubs/routes.stub'); + + return str_replace('{{routes}}', base64_encode(serialize($routes)), $stub); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php new file mode 100644 index 00000000..03fab1d9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php @@ -0,0 +1,55 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->files->delete($this->laravel->getCachedRoutesPath()); + + $this->info('Route cache cleared!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php new file mode 100644 index 00000000..14fd9286 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php @@ -0,0 +1,264 @@ +router = $router; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + if (empty($this->router->getRoutes())) { + return $this->error("Your application doesn't have any routes."); + } + + if (empty($routes = $this->getRoutes())) { + return $this->error("Your application doesn't have any routes matching the given criteria."); + } + + $this->displayRoutes($routes); + } + + /** + * Compile the routes into a displayable format. + * + * @return array + */ + protected function getRoutes() + { + $routes = collect($this->router->getRoutes())->map(function ($route) { + return $this->getRouteInformation($route); + })->filter()->all(); + + if ($sort = $this->option('sort')) { + $routes = $this->sortRoutes($sort, $routes); + } + + if ($this->option('reverse')) { + $routes = array_reverse($routes); + } + + return $this->pluckColumns($routes); + } + + /** + * Get the route information for a given route. + * + * @param \Illuminate\Routing\Route $route + * @return array + */ + protected function getRouteInformation(Route $route) + { + return $this->filterRoute([ + 'domain' => $route->domain(), + 'method' => implode('|', $route->methods()), + 'uri' => $route->uri(), + 'name' => $route->getName(), + 'action' => ltrim($route->getActionName(), '\\'), + 'middleware' => $this->getMiddleware($route), + ]); + } + + /** + * Sort the routes by a given element. + * + * @param string $sort + * @param array $routes + * @return array + */ + protected function sortRoutes($sort, array $routes) + { + return Arr::sort($routes, function ($route) use ($sort) { + return $route[$sort]; + }); + } + + /** + * Remove unnecessary columns from the routes. + * + * @param array $routes + * @return array + */ + protected function pluckColumns(array $routes) + { + return array_map(function ($route) { + return Arr::only($route, $this->getColumns()); + }, $routes); + } + + /** + * Display the route information on the console. + * + * @param array $routes + * @return void + */ + protected function displayRoutes(array $routes) + { + if ($this->option('json')) { + $this->line(json_encode(array_values($routes))); + + return; + } + + $this->table($this->getHeaders(), $routes); + } + + /** + * Get before filters. + * + * @param \Illuminate\Routing\Route $route + * @return string + */ + protected function getMiddleware($route) + { + return collect($route->gatherMiddleware())->map(function ($middleware) { + return $middleware instanceof Closure ? 'Closure' : $middleware; + })->implode(','); + } + + /** + * Filter the route by URI and / or name. + * + * @param array $route + * @return array|null + */ + protected function filterRoute(array $route) + { + if (($this->option('name') && ! Str::contains($route['name'], $this->option('name'))) || + $this->option('path') && ! Str::contains($route['uri'], $this->option('path')) || + $this->option('method') && ! Str::contains($route['method'], strtoupper($this->option('method')))) { + return; + } + + return $route; + } + + /** + * Get the table headers for the visible columns. + * + * @return array + */ + protected function getHeaders() + { + return Arr::only($this->headers, array_keys($this->getColumns())); + } + + /** + * Get the column names to show (lowercase table headers). + * + * @return array + */ + protected function getColumns() + { + $availableColumns = array_map('strtolower', $this->headers); + + if ($this->option('compact')) { + return array_intersect($availableColumns, $this->compactColumns); + } + + if ($columns = $this->option('columns')) { + return array_intersect($availableColumns, $this->parseColumns($columns)); + } + + return $availableColumns; + } + + /** + * Parse the column list. + * + * @param array $columns + * @return array + */ + protected function parseColumns(array $columns) + { + $results = []; + + foreach ($columns as $i => $column) { + if (Str::contains($column, ',')) { + $results = array_merge($results, explode(',', $column)); + } else { + $results[] = $column; + } + } + + return $results; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['columns', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Columns to include in the route table'], + ['compact', 'c', InputOption::VALUE_NONE, 'Only show method, URI and action columns'], + ['json', null, InputOption::VALUE_NONE, 'Output the route list as JSON'], + ['method', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by method'], + ['name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name'], + ['path', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by path'], + ['reverse', 'r', InputOption::VALUE_NONE, 'Reverse the ordering of the routes'], + ['sort', null, InputOption::VALUE_OPTIONAL, 'The column (domain, method, uri, name, action, middleware) to sort by', 'uri'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/RuleMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RuleMakeCommand.php new file mode 100644 index 00000000..2b699535 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RuleMakeCommand.php @@ -0,0 +1,50 @@ +line("Laravel development server started: http://{$this->host()}:{$this->port()}"); + + passthru($this->serverCommand(), $status); + + if ($status && $this->canTryAnotherPort()) { + $this->portOffset += 1; + + return $this->handle(); + } + + return $status; + } + + /** + * Get the full server command. + * + * @return string + */ + protected function serverCommand() + { + return sprintf('%s -S %s:%s %s', + ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)), + $this->host(), + $this->port(), + ProcessUtils::escapeArgument(base_path('server.php')) + ); + } + + /** + * Get the host for the command. + * + * @return string + */ + protected function host() + { + return $this->input->getOption('host'); + } + + /** + * Get the port for the command. + * + * @return string + */ + protected function port() + { + $port = $this->input->getOption('port') ?: 8000; + + return $port + $this->portOffset; + } + + /** + * Check if command has reached its max amount of port tries. + * + * @return bool + */ + protected function canTryAnotherPort() + { + return is_null($this->input->getOption('port')) && + ($this->input->getOption('tries') > $this->portOffset); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on', '127.0.0.1'], + + ['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on', Env::get('SERVER_PORT')], + + ['tries', null, InputOption::VALUE_OPTIONAL, 'The max number of ports to attempt to serve from', 10], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php new file mode 100644 index 00000000..82b46159 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php @@ -0,0 +1,44 @@ +error('The "public/storage" directory already exists.'); + } + + if (is_link(public_path('storage'))) { + $this->laravel->make('files')->delete(public_path('storage')); + } + + $this->laravel->make('files')->link( + storage_path('app/public'), public_path('storage') + ); + + $this->info('The [public/storage] directory has been linked.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php new file mode 100644 index 00000000..17393246 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php @@ -0,0 +1,82 @@ +option('unit')) { + return __DIR__.'/stubs/unit-test.stub'; + } + + return __DIR__.'/stubs/test.stub'; + } + + /** + * Get the destination class path. + * + * @param string $name + * @return string + */ + protected function getPath($name) + { + $name = Str::replaceFirst($this->rootNamespace(), '', $name); + + return base_path('tests').str_replace('\\', '/', $name).'.php'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + if ($this->option('unit')) { + return $rootNamespace.'\Unit'; + } else { + return $rootNamespace.'\Feature'; + } + } + + /** + * Get the root namespace for the class. + * + * @return string + */ + protected function rootNamespace() + { + return 'Tests'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php new file mode 100644 index 00000000..9f659920 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php @@ -0,0 +1,49 @@ +comment('Application is already up.'); + + return true; + } + + unlink(storage_path('framework/down')); + + $this->info('Application is now live.'); + } catch (Exception $e) { + $this->error('Failed to disable maintenance mode.'); + + $this->error($e->getMessage()); + + return 1; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php new file mode 100644 index 00000000..17a459e7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php @@ -0,0 +1,283 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->determineWhatShouldBePublished(); + + foreach ($this->tags ?: [null] as $tag) { + $this->publishTag($tag); + } + + $this->info('Publishing complete.'); + } + + /** + * Determine the provider or tag(s) to publish. + * + * @return void + */ + protected function determineWhatShouldBePublished() + { + if ($this->option('all')) { + return; + } + + [$this->provider, $this->tags] = [ + $this->option('provider'), (array) $this->option('tag'), + ]; + + if (! $this->provider && ! $this->tags) { + $this->promptForProviderOrTag(); + } + } + + /** + * Prompt for which provider or tag to publish. + * + * @return void + */ + protected function promptForProviderOrTag() + { + $choice = $this->choice( + "Which provider or tag's files would you like to publish?", + $choices = $this->publishableChoices() + ); + + if ($choice == $choices[0] || is_null($choice)) { + return; + } + + $this->parseChoice($choice); + } + + /** + * The choices available via the prompt. + * + * @return array + */ + protected function publishableChoices() + { + return array_merge( + ['Publish files from all providers and tags listed below'], + preg_filter('/^/', 'Provider: ', Arr::sort(ServiceProvider::publishableProviders())), + preg_filter('/^/', 'Tag: ', Arr::sort(ServiceProvider::publishableGroups())) + ); + } + + /** + * Parse the answer that was given via the prompt. + * + * @param string $choice + * @return void + */ + protected function parseChoice($choice) + { + [$type, $value] = explode(': ', strip_tags($choice)); + + if ($type === 'Provider') { + $this->provider = $value; + } elseif ($type === 'Tag') { + $this->tags = [$value]; + } + } + + /** + * Publishes the assets for a tag. + * + * @param string $tag + * @return mixed + */ + protected function publishTag($tag) + { + $published = false; + + foreach ($this->pathsToPublish($tag) as $from => $to) { + $this->publishItem($from, $to); + + $published = true; + } + + if ($published === false) { + $this->error('Unable to locate publishable resources.'); + } + } + + /** + * Get all of the paths to publish. + * + * @param string $tag + * @return array + */ + protected function pathsToPublish($tag) + { + return ServiceProvider::pathsToPublish( + $this->provider, $tag + ); + } + + /** + * Publish the given item from and to the given location. + * + * @param string $from + * @param string $to + * @return void + */ + protected function publishItem($from, $to) + { + if ($this->files->isFile($from)) { + return $this->publishFile($from, $to); + } elseif ($this->files->isDirectory($from)) { + return $this->publishDirectory($from, $to); + } + + $this->error("Can't locate path: <{$from}>"); + } + + /** + * Publish the file to the given path. + * + * @param string $from + * @param string $to + * @return void + */ + protected function publishFile($from, $to) + { + if (! $this->files->exists($to) || $this->option('force')) { + $this->createParentDirectory(dirname($to)); + + $this->files->copy($from, $to); + + $this->status($from, $to, 'File'); + } + } + + /** + * Publish the directory to the given directory. + * + * @param string $from + * @param string $to + * @return void + */ + protected function publishDirectory($from, $to) + { + $this->moveManagedFiles(new MountManager([ + 'from' => new Flysystem(new LocalAdapter($from)), + 'to' => new Flysystem(new LocalAdapter($to)), + ])); + + $this->status($from, $to, 'Directory'); + } + + /** + * Move all the files in the given MountManager. + * + * @param \League\Flysystem\MountManager $manager + * @return void + */ + protected function moveManagedFiles($manager) + { + foreach ($manager->listContents('from://', true) as $file) { + if ($file['type'] === 'file' && (! $manager->has('to://'.$file['path']) || $this->option('force'))) { + $manager->put('to://'.$file['path'], $manager->read('from://'.$file['path'])); + } + } + } + + /** + * Create the directory to house the published files if needed. + * + * @param string $directory + * @return void + */ + protected function createParentDirectory($directory) + { + if (! $this->files->isDirectory($directory)) { + $this->files->makeDirectory($directory, 0755, true); + } + } + + /** + * Write a status message to the console. + * + * @param string $from + * @param string $to + * @param string $type + * @return void + */ + protected function status($from, $to, $type) + { + $from = str_replace(base_path(), '', realpath($from)); + + $to = str_replace(base_path(), '', realpath($to)); + + $this->line('Copied '.$type.' ['.$from.'] To ['.$to.']'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewCacheCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewCacheCommand.php new file mode 100644 index 00000000..19e0ab59 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewCacheCommand.php @@ -0,0 +1,87 @@ +call('view:clear'); + + $this->paths()->each(function ($path) { + $this->compileViews($this->bladeFilesIn([$path])); + }); + + $this->info('Blade templates cached successfully!'); + } + + /** + * Compile the given view files. + * + * @param \Illuminate\Support\Collection $views + * @return void + */ + protected function compileViews(Collection $views) + { + $compiler = $this->laravel['view']->getEngineResolver()->resolve('blade')->getCompiler(); + + $views->map(function (SplFileInfo $file) use ($compiler) { + $compiler->compile($file->getRealPath()); + }); + } + + /** + * Get the Blade files in the given path. + * + * @param array $paths + * @return \Illuminate\Support\Collection + */ + protected function bladeFilesIn(array $paths) + { + return collect( + Finder::create() + ->in($paths) + ->exclude('vendor') + ->name('*.blade.php') + ->files() + ); + } + + /** + * Get all of the possible view paths. + * + * @return \Illuminate\Support\Collection + */ + protected function paths() + { + $finder = $this->laravel['view']->getFinder(); + + return collect($finder->getPaths())->merge( + collect($finder->getHints())->flatten() + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewClearCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewClearCommand.php new file mode 100644 index 00000000..449ebe4b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewClearCommand.php @@ -0,0 +1,66 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + * + * @throws \RuntimeException + */ + public function handle() + { + $path = $this->laravel['config']['view.compiled']; + + if (! $path) { + throw new RuntimeException('View path not found.'); + } + + foreach ($this->files->glob("{$path}/*") as $view) { + $this->files->delete($view); + } + + $this->info('Compiled views cleared!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/channel.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/channel.stub new file mode 100644 index 00000000..bf261ccf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/channel.stub @@ -0,0 +1,29 @@ +view('view.name'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-mail.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-mail.stub new file mode 100644 index 00000000..7bf41616 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-mail.stub @@ -0,0 +1,33 @@ +markdown('DummyView'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-notification.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-notification.stub new file mode 100644 index 00000000..a2c060d6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-notification.stub @@ -0,0 +1,58 @@ +markdown('DummyView'); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * @return array + */ + public function toArray($notifiable) + { + return [ + // + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown.stub new file mode 100644 index 00000000..bc414282 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown.stub @@ -0,0 +1,12 @@ +@component('mail::message') +# Introduction + +The body of your message. + +@component('mail::button', ['url' => '']) +Button Text +@endcomponent + +Thanks,
+{{ config('app.name') }} +@endcomponent diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/model.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/model.stub new file mode 100644 index 00000000..f01a8333 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/model.stub @@ -0,0 +1,10 @@ +line('The introduction to the notification.') + ->action('Notification Action', url('/')) + ->line('Thank you for using our application!'); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * @return array + */ + public function toArray($notifiable) + { + return [ + // + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/observer.plain.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/observer.plain.stub new file mode 100644 index 00000000..daae325c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/observer.plain.stub @@ -0,0 +1,8 @@ +setRoutes( + unserialize(base64_decode('{{routes}}')) +); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/rule.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/rule.stub new file mode 100644 index 00000000..826af0d6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/rule.stub @@ -0,0 +1,40 @@ +get('/'); + + $response->assertStatus(200); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/unit-test.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/unit-test.stub new file mode 100644 index 00000000..4eb7c4a9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/unit-test.stub @@ -0,0 +1,18 @@ +assertTrue(true); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php b/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php new file mode 100644 index 00000000..6e49b31c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php @@ -0,0 +1,74 @@ +detectConsoleEnvironment($callback, $consoleArgs); + } + + return $this->detectWebEnvironment($callback); + } + + /** + * Set the application environment for a web request. + * + * @param \Closure $callback + * @return string + */ + protected function detectWebEnvironment(Closure $callback) + { + return $callback(); + } + + /** + * Set the application environment from command-line arguments. + * + * @param \Closure $callback + * @param array $args + * @return string + */ + protected function detectConsoleEnvironment(Closure $callback, array $args) + { + // First we will check if an environment argument was passed via console arguments + // and if it was that automatically overrides as the environment. Otherwise, we + // will check the environment as a "web" request like a typical HTTP request. + if (! is_null($value = $this->getEnvironmentArgument($args))) { + return $value; + } + + return $this->detectWebEnvironment($callback); + } + + /** + * Get the environment argument from the console. + * + * @param array $args + * @return string|null + */ + protected function getEnvironmentArgument(array $args) + { + foreach ($args as $i => $value) { + if ($value === '--env') { + return $args[$i + 1] ?? null; + } + + if (Str::startsWith($value, '--env')) { + return head(array_slice(explode('=', $value), 1)); + } + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Events/DiscoverEvents.php b/vendor/laravel/framework/src/Illuminate/Foundation/Events/DiscoverEvents.php new file mode 100644 index 00000000..0fa87135 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Events/DiscoverEvents.php @@ -0,0 +1,86 @@ +files()->in($listenerPath), $basePath + ))->mapToDictionary(function ($event, $listener) { + return [$event => $listener]; + })->all(); + } + + /** + * Get all of the listeners and their corresponding events. + * + * @param iterable $listeners + * @param string $basePath + * @return array + */ + protected static function getListenerEvents($listeners, $basePath) + { + $listenerEvents = []; + + foreach ($listeners as $listener) { + try { + $listener = new ReflectionClass( + static::classFromFile($listener, $basePath) + ); + } catch (ReflectionException $e) { + continue; + } + + if (! $listener->isInstantiable()) { + continue; + } + + foreach ($listener->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { + if (! Str::is('handle*', $method->name) || + ! isset($method->getParameters()[0])) { + continue; + } + + $listenerEvents[$listener->name.'@'.$method->name] = + Reflector::getParameterClassName($method->getParameters()[0]); + } + } + + return array_filter($listenerEvents); + } + + /** + * Extract the class name from the given file path. + * + * @param \SplFileInfo $file + * @param string $basePath + * @return string + */ + protected static function classFromFile(SplFileInfo $file, $basePath) + { + $class = trim(Str::replaceFirst($basePath, '', $file->getRealPath()), DIRECTORY_SEPARATOR); + + return str_replace( + [DIRECTORY_SEPARATOR, ucfirst(basename(app()->path())).'\\'], + ['\\', app()->getNamespace()], + ucfirst(Str::replaceLast('.php', '', $class)) + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Events/Dispatchable.php b/vendor/laravel/framework/src/Illuminate/Foundation/Events/Dispatchable.php new file mode 100644 index 00000000..0018295b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Events/Dispatchable.php @@ -0,0 +1,26 @@ +locale = $locale; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php new file mode 100644 index 00000000..1bac2b30 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php @@ -0,0 +1,523 @@ +container = $container; + } + + /** + * Report or log an exception. + * + * @param \Exception $e + * @return void + * + * @throws \Exception + */ + public function report(Exception $e) + { + if ($this->shouldntReport($e)) { + return; + } + + if (Reflector::isCallable($reportCallable = [$e, 'report'])) { + if (($response = $this->container->call($reportCallable)) !== false) { + return $response; + } + } + + try { + $logger = $this->container->make(LoggerInterface::class); + } catch (Exception $ex) { + throw $e; + } + + $logger->error( + $e->getMessage(), + array_merge( + $this->exceptionContext($e), + $this->context(), + ['exception' => $e] + ) + ); + } + + /** + * Determine if the exception should be reported. + * + * @param \Exception $e + * @return bool + */ + public function shouldReport(Exception $e) + { + return ! $this->shouldntReport($e); + } + + /** + * Determine if the exception is in the "do not report" list. + * + * @param \Exception $e + * @return bool + */ + protected function shouldntReport(Exception $e) + { + $dontReport = array_merge($this->dontReport, $this->internalDontReport); + + return ! is_null(Arr::first($dontReport, function ($type) use ($e) { + return $e instanceof $type; + })); + } + + /** + * Get the default exception context variables for logging. + * + * @param \Exception $e + * @return array + */ + protected function exceptionContext(Exception $e) + { + return []; + } + + /** + * Get the default context variables for logging. + * + * @return array + */ + protected function context() + { + try { + return array_filter([ + 'userId' => Auth::id(), + // 'email' => optional(Auth::user())->email, + ]); + } catch (Throwable $e) { + return []; + } + } + + /** + * Render an exception into an HTTP response. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Symfony\Component\HttpFoundation\Response + * + * @throws \Exception + */ + public function render($request, Exception $e) + { + if (method_exists($e, 'render') && $response = $e->render($request)) { + return Router::toResponse($request, $response); + } elseif ($e instanceof Responsable) { + return $e->toResponse($request); + } + + $e = $this->prepareException($e); + + if ($e instanceof HttpResponseException) { + return $e->getResponse(); + } elseif ($e instanceof AuthenticationException) { + return $this->unauthenticated($request, $e); + } elseif ($e instanceof ValidationException) { + return $this->convertValidationExceptionToResponse($e, $request); + } + + return $request->expectsJson() + ? $this->prepareJsonResponse($request, $e) + : $this->prepareResponse($request, $e); + } + + /** + * Prepare exception for rendering. + * + * @param \Exception $e + * @return \Exception + */ + protected function prepareException(Exception $e) + { + if ($e instanceof ModelNotFoundException) { + $e = new NotFoundHttpException($e->getMessage(), $e); + } elseif ($e instanceof AuthorizationException) { + $e = new AccessDeniedHttpException($e->getMessage(), $e); + } elseif ($e instanceof TokenMismatchException) { + $e = new HttpException(419, $e->getMessage(), $e); + } elseif ($e instanceof SuspiciousOperationException) { + $e = new NotFoundHttpException('Bad hostname provided.', $e); + } + + return $e; + } + + /** + * Convert an authentication exception into a response. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Auth\AuthenticationException $exception + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function unauthenticated($request, AuthenticationException $exception) + { + return $request->expectsJson() + ? response()->json(['message' => $exception->getMessage()], 401) + : redirect()->guest($exception->redirectTo() ?? route('login')); + } + + /** + * Create a response object from the given validation exception. + * + * @param \Illuminate\Validation\ValidationException $e + * @param \Illuminate\Http\Request $request + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function convertValidationExceptionToResponse(ValidationException $e, $request) + { + if ($e->response) { + return $e->response; + } + + return $request->expectsJson() + ? $this->invalidJson($request, $e) + : $this->invalid($request, $e); + } + + /** + * Convert a validation exception into a response. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Validation\ValidationException $exception + * @return \Illuminate\Http\Response + */ + protected function invalid($request, ValidationException $exception) + { + return redirect($exception->redirectTo ?? url()->previous()) + ->withInput(Arr::except($request->input(), $this->dontFlash)) + ->withErrors($exception->errors(), $exception->errorBag); + } + + /** + * Convert a validation exception into a JSON response. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Validation\ValidationException $exception + * @return \Illuminate\Http\JsonResponse + */ + protected function invalidJson($request, ValidationException $exception) + { + return response()->json([ + 'message' => $exception->getMessage(), + 'errors' => $exception->errors(), + ], $exception->status); + } + + /** + * Prepare a response for the given exception. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function prepareResponse($request, Exception $e) + { + if (! $this->isHttpException($e) && config('app.debug')) { + return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e); + } + + if (! $this->isHttpException($e)) { + $e = new HttpException(500, $e->getMessage()); + } + + return $this->toIlluminateResponse( + $this->renderHttpException($e), $e + ); + } + + /** + * Create a Symfony response for the given exception. + * + * @param \Exception $e + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function convertExceptionToResponse(Exception $e) + { + return new SymfonyResponse( + $this->renderExceptionContent($e), + $this->isHttpException($e) ? $e->getStatusCode() : 500, + $this->isHttpException($e) ? $e->getHeaders() : [] + ); + } + + /** + * Get the response content for the given exception. + * + * @param \Exception $e + * @return string + */ + protected function renderExceptionContent(Exception $e) + { + try { + return config('app.debug') && class_exists(Whoops::class) + ? $this->renderExceptionWithWhoops($e) + : $this->renderExceptionWithSymfony($e, config('app.debug')); + } catch (Exception $e) { + return $this->renderExceptionWithSymfony($e, config('app.debug')); + } + } + + /** + * Render an exception to a string using "Whoops". + * + * @param \Exception $e + * @return string + */ + protected function renderExceptionWithWhoops(Exception $e) + { + return tap(new Whoops, function ($whoops) { + $whoops->appendHandler($this->whoopsHandler()); + + $whoops->writeToOutput(false); + + $whoops->allowQuit(false); + })->handleException($e); + } + + /** + * Get the Whoops handler for the application. + * + * @return \Whoops\Handler\Handler + */ + protected function whoopsHandler() + { + try { + return app(HandlerInterface::class); + } catch (BindingResolutionException $e) { + return (new WhoopsHandler)->forDebug(); + } + } + + /** + * Render an exception to a string using Symfony. + * + * @param \Exception $e + * @param bool $debug + * @return string + */ + protected function renderExceptionWithSymfony(Exception $e, $debug) + { + return (new SymfonyExceptionHandler($debug))->getHtml( + FlattenException::create($e) + ); + } + + /** + * Render the given HttpException. + * + * @param \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function renderHttpException(HttpExceptionInterface $e) + { + $this->registerErrorViewPaths(); + + if (view()->exists($view = $this->getHttpExceptionView($e))) { + return response()->view($view, [ + 'errors' => new ViewErrorBag, + 'exception' => $e, + ], $e->getStatusCode(), $e->getHeaders()); + } + + return $this->convertExceptionToResponse($e); + } + + /** + * Register the error template hint paths. + * + * @return void + */ + protected function registerErrorViewPaths() + { + $paths = collect(config('view.paths')); + + View::replaceNamespace('errors', $paths->map(function ($path) { + return "{$path}/errors"; + })->push(__DIR__.'/views')->all()); + } + + /** + * Get the view used to render HTTP exceptions. + * + * @param \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e + * @return string + */ + protected function getHttpExceptionView(HttpExceptionInterface $e) + { + return "errors::{$e->getStatusCode()}"; + } + + /** + * Map the given exception into an Illuminate response. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @param \Exception $e + * @return \Illuminate\Http\Response + */ + protected function toIlluminateResponse($response, Exception $e) + { + if ($response instanceof SymfonyRedirectResponse) { + $response = new RedirectResponse( + $response->getTargetUrl(), $response->getStatusCode(), $response->headers->all() + ); + } else { + $response = new Response( + $response->getContent(), $response->getStatusCode(), $response->headers->all() + ); + } + + return $response->withException($e); + } + + /** + * Prepare a JSON response for the given exception. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Illuminate\Http\JsonResponse + */ + protected function prepareJsonResponse($request, Exception $e) + { + return new JsonResponse( + $this->convertExceptionToArray($e), + $this->isHttpException($e) ? $e->getStatusCode() : 500, + $this->isHttpException($e) ? $e->getHeaders() : [], + JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES + ); + } + + /** + * Convert the given exception to an array. + * + * @param \Exception $e + * @return array + */ + protected function convertExceptionToArray(Exception $e) + { + return config('app.debug') ? [ + 'message' => $e->getMessage(), + 'exception' => get_class($e), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'trace' => collect($e->getTrace())->map(function ($trace) { + return Arr::except($trace, ['args']); + })->all(), + ] : [ + 'message' => $this->isHttpException($e) ? $e->getMessage() : 'Server Error', + ]; + } + + /** + * Render an exception to the console. + * + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @param \Exception $e + * @return void + */ + public function renderForConsole($output, Exception $e) + { + (new ConsoleApplication)->renderException($e, $output); + } + + /** + * Determine if the given exception is an HTTP exception. + * + * @param \Exception $e + * @return bool + */ + protected function isHttpException(Exception $e) + { + return $e instanceof HttpExceptionInterface; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/WhoopsHandler.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/WhoopsHandler.php new file mode 100644 index 00000000..2137f29b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/WhoopsHandler.php @@ -0,0 +1,86 @@ +handleUnconditionally(true); + + $this->registerApplicationPaths($handler) + ->registerBlacklist($handler) + ->registerEditor($handler); + }); + } + + /** + * Register the application paths with the handler. + * + * @param \Whoops\Handler\PrettyPageHandler $handler + * @return $this + */ + protected function registerApplicationPaths($handler) + { + $handler->setApplicationPaths( + array_flip($this->directoriesExceptVendor()) + ); + + return $this; + } + + /** + * Get the application paths except for the "vendor" directory. + * + * @return array + */ + protected function directoriesExceptVendor() + { + return Arr::except( + array_flip((new Filesystem)->directories(base_path())), + [base_path('vendor')] + ); + } + + /** + * Register the blacklist with the handler. + * + * @param \Whoops\Handler\PrettyPageHandler $handler + * @return $this + */ + protected function registerBlacklist($handler) + { + foreach (config('app.debug_blacklist', []) as $key => $secrets) { + foreach ($secrets as $secret) { + $handler->blacklist($key, $secret); + } + } + + return $this; + } + + /** + * Register the editor with the handler. + * + * @param \Whoops\Handler\PrettyPageHandler $handler + * @return $this + */ + protected function registerEditor($handler) + { + if (config('app.editor', false)) { + $handler->setEditor(config('app.editor')); + } + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/401.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/401.blade.php new file mode 100644 index 00000000..5c586db9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/401.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Unauthorized')) +@section('code', '401') +@section('message', __('Unauthorized')) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/403.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/403.blade.php new file mode 100644 index 00000000..a5506f01 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/403.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Forbidden')) +@section('code', '403') +@section('message', __($exception->getMessage() ?: 'Forbidden')) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/404.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/404.blade.php new file mode 100644 index 00000000..7549540d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/404.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Not Found')) +@section('code', '404') +@section('message', __('Not Found')) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/419.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/419.blade.php new file mode 100644 index 00000000..c09216e2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/419.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Page Expired')) +@section('code', '419') +@section('message', __('Page Expired')) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/429.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/429.blade.php new file mode 100644 index 00000000..f01b07b8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/429.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Too Many Requests')) +@section('code', '429') +@section('message', __('Too Many Requests')) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/500.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/500.blade.php new file mode 100644 index 00000000..d9e95d9b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/500.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Server Error')) +@section('code', '500') +@section('message', __('Server Error')) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/503.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/503.blade.php new file mode 100644 index 00000000..acd38100 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/503.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Service Unavailable')) +@section('code', '503') +@section('message', __($exception->getMessage() ?: 'Service Unavailable')) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php new file mode 100644 index 00000000..64eb7cbb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php @@ -0,0 +1,486 @@ + + + + + + + @yield('title') + + + + + + + + + +
+
+
+
+ @yield('code', __('Oh no')) +
+ +
+ +

+ @yield('message') +

+ + + + +
+
+ +
+ @yield('image') +
+
+ + diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/layout.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/layout.blade.php new file mode 100644 index 00000000..2c51d4f3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/layout.blade.php @@ -0,0 +1,57 @@ + + + + + + + @yield('title') + + + + + + + + + +
+
+
+ @yield('message') +
+
+
+ + diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/minimal.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/minimal.blade.php new file mode 100644 index 00000000..b63ac2b3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/minimal.blade.php @@ -0,0 +1,62 @@ + + + + + + + @yield('title') + + + + + + + + + +
+
+ @yield('code') +
+ +
+ @yield('message') +
+
+ + diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Events/RequestHandled.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Events/RequestHandled.php new file mode 100644 index 00000000..d6f71e03 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Events/RequestHandled.php @@ -0,0 +1,33 @@ +request = $request; + $this->response = $response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php new file mode 100644 index 00000000..45c76b22 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php @@ -0,0 +1,55 @@ +wentDownAt = Date::createFromTimestamp($time); + + if ($retryAfter) { + $this->retryAfter = $retryAfter; + + $this->willBeAvailableAt = Date::instance(Carbon::createFromTimestamp($time)->addRealSeconds($this->retryAfter)); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php new file mode 100644 index 00000000..96169f3c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php @@ -0,0 +1,249 @@ +validator) { + return $this->validator; + } + + $factory = $this->container->make(ValidationFactory::class); + + if (method_exists($this, 'validator')) { + $validator = $this->container->call([$this, 'validator'], compact('factory')); + } else { + $validator = $this->createDefaultValidator($factory); + } + + if (method_exists($this, 'withValidator')) { + $this->withValidator($validator); + } + + $this->setValidator($validator); + + return $this->validator; + } + + /** + * Create the default validator instance. + * + * @param \Illuminate\Contracts\Validation\Factory $factory + * @return \Illuminate\Contracts\Validation\Validator + */ + protected function createDefaultValidator(ValidationFactory $factory) + { + return $factory->make( + $this->validationData(), $this->container->call([$this, 'rules']), + $this->messages(), $this->attributes() + ); + } + + /** + * Get data to be validated from the request. + * + * @return array + */ + public function validationData() + { + return $this->all(); + } + + /** + * Handle a failed validation attempt. + * + * @param \Illuminate\Contracts\Validation\Validator $validator + * @return void + * + * @throws \Illuminate\Validation\ValidationException + */ + protected function failedValidation(Validator $validator) + { + throw (new ValidationException($validator)) + ->errorBag($this->errorBag) + ->redirectTo($this->getRedirectUrl()); + } + + /** + * Get the URL to redirect to on a validation error. + * + * @return string + */ + protected function getRedirectUrl() + { + $url = $this->redirector->getUrlGenerator(); + + if ($this->redirect) { + return $url->to($this->redirect); + } elseif ($this->redirectRoute) { + return $url->route($this->redirectRoute); + } elseif ($this->redirectAction) { + return $url->action($this->redirectAction); + } + + return $url->previous(); + } + + /** + * Determine if the request passes the authorization check. + * + * @return bool + */ + protected function passesAuthorization() + { + if (method_exists($this, 'authorize')) { + return $this->container->call([$this, 'authorize']); + } + + return true; + } + + /** + * Handle a failed authorization attempt. + * + * @return void + * + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + protected function failedAuthorization() + { + throw new AuthorizationException; + } + + /** + * Get the validated data from the request. + * + * @return array + */ + public function validated() + { + return $this->validator->validated(); + } + + /** + * Get custom messages for validator errors. + * + * @return array + */ + public function messages() + { + return []; + } + + /** + * Get custom attributes for validator errors. + * + * @return array + */ + public function attributes() + { + return []; + } + + /** + * Set the Validator instance. + * + * @param \Illuminate\Contracts\Validation\Validator $validator + * @return $this + */ + public function setValidator(Validator $validator) + { + $this->validator = $validator; + + return $this; + } + + /** + * Set the Redirector instance. + * + * @param \Illuminate\Routing\Redirector $redirector + * @return $this + */ + public function setRedirector(Redirector $redirector) + { + $this->redirector = $redirector; + + return $this; + } + + /** + * Set the container implementation. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return $this + */ + public function setContainer(Container $container) + { + $this->container = $container; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php new file mode 100644 index 00000000..01de7ede --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php @@ -0,0 +1,452 @@ +app = $app; + $this->router = $router; + + $this->syncMiddlewareToRouter(); + } + + /** + * Handle an incoming HTTP request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function handle($request) + { + try { + $request->enableHttpMethodParameterOverride(); + + $response = $this->sendRequestThroughRouter($request); + } catch (Exception $e) { + $this->reportException($e); + + $response = $this->renderException($request, $e); + } catch (Throwable $e) { + $this->reportException($e = new FatalThrowableError($e)); + + $response = $this->renderException($request, $e); + } + + $this->app['events']->dispatch( + new RequestHandled($request, $response) + ); + + return $response; + } + + /** + * Send the given request through the middleware / router. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + protected function sendRequestThroughRouter($request) + { + $this->app->instance('request', $request); + + Facade::clearResolvedInstance('request'); + + $this->bootstrap(); + + return (new Pipeline($this->app)) + ->send($request) + ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware) + ->then($this->dispatchToRouter()); + } + + /** + * Bootstrap the application for HTTP requests. + * + * @return void + */ + public function bootstrap() + { + if (! $this->app->hasBeenBootstrapped()) { + $this->app->bootstrapWith($this->bootstrappers()); + } + } + + /** + * Get the route dispatcher callback. + * + * @return \Closure + */ + protected function dispatchToRouter() + { + return function ($request) { + $this->app->instance('request', $request); + + return $this->router->dispatch($request); + }; + } + + /** + * Call the terminate method on any terminable middleware. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Response $response + * @return void + */ + public function terminate($request, $response) + { + $this->terminateMiddleware($request, $response); + + $this->app->terminate(); + } + + /** + * Call the terminate method on any terminable middleware. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Response $response + * @return void + */ + protected function terminateMiddleware($request, $response) + { + $middlewares = $this->app->shouldSkipMiddleware() ? [] : array_merge( + $this->gatherRouteMiddleware($request), + $this->middleware + ); + + foreach ($middlewares as $middleware) { + if (! is_string($middleware)) { + continue; + } + + [$name] = $this->parseMiddleware($middleware); + + $instance = $this->app->make($name); + + if (method_exists($instance, 'terminate')) { + $instance->terminate($request, $response); + } + } + } + + /** + * Gather the route middleware for the given request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function gatherRouteMiddleware($request) + { + if ($route = $request->route()) { + return $this->router->gatherRouteMiddleware($route); + } + + return []; + } + + /** + * Parse a middleware string to get the name and parameters. + * + * @param string $middleware + * @return array + */ + protected function parseMiddleware($middleware) + { + [$name, $parameters] = array_pad(explode(':', $middleware, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters]; + } + + /** + * Determine if the kernel has a given middleware. + * + * @param string $middleware + * @return bool + */ + public function hasMiddleware($middleware) + { + return in_array($middleware, $this->middleware); + } + + /** + * Add a new middleware to beginning of the stack if it does not already exist. + * + * @param string $middleware + * @return $this + */ + public function prependMiddleware($middleware) + { + if (array_search($middleware, $this->middleware) === false) { + array_unshift($this->middleware, $middleware); + } + + return $this; + } + + /** + * Add a new middleware to end of the stack if it does not already exist. + * + * @param string $middleware + * @return $this + */ + public function pushMiddleware($middleware) + { + if (array_search($middleware, $this->middleware) === false) { + $this->middleware[] = $middleware; + } + + return $this; + } + + /** + * Prepend the given middleware to the given middleware group. + * + * @param string $group + * @param string $middleware + * @return $this + * + * @throws \InvalidArgumentException + */ + public function prependMiddlewareToGroup($group, $middleware) + { + if (! isset($this->middlewareGroups[$group])) { + throw new InvalidArgumentException("The [{$group}] middleware group has not been defined."); + } + + if (array_search($middleware, $this->middlewareGroups[$group]) === false) { + array_unshift($this->middlewareGroups[$group], $middleware); + } + + $this->syncMiddlewareToRouter(); + + return $this; + } + + /** + * Append the given middleware to the given middleware group. + * + * @param string $group + * @param string $middleware + * @return $this + * + * @throws \InvalidArgumentException + */ + public function appendMiddlewareToGroup($group, $middleware) + { + if (! isset($this->middlewareGroups[$group])) { + throw new InvalidArgumentException("The [{$group}] middleware group has not been defined."); + } + + if (array_search($middleware, $this->middlewareGroups[$group]) === false) { + $this->middlewareGroups[$group][] = $middleware; + } + + $this->syncMiddlewareToRouter(); + + return $this; + } + + /** + * Prepend the given middleware to the middleware priority list. + * + * @param string $middleware + * @return $this + */ + public function prependToMiddlewarePriority($middleware) + { + if (! in_array($middleware, $this->middlewarePriority)) { + array_unshift($this->middlewarePriority, $middleware); + } + + $this->syncMiddlewareToRouter(); + + return $this; + } + + /** + * Append the given middleware to the middleware priority list. + * + * @param string $middleware + * @return $this + */ + public function appendToMiddlewarePriority($middleware) + { + if (! in_array($middleware, $this->middlewarePriority)) { + $this->middlewarePriority[] = $middleware; + } + + $this->syncMiddlewareToRouter(); + + return $this; + } + + /** + * Sync the current state of the middleware to the router. + * + * @return void + */ + protected function syncMiddlewareToRouter() + { + $this->router->middlewarePriority = $this->middlewarePriority; + + foreach ($this->middlewareGroups as $key => $middleware) { + $this->router->middlewareGroup($key, $middleware); + } + + foreach ($this->routeMiddleware as $key => $middleware) { + $this->router->aliasMiddleware($key, $middleware); + } + } + + /** + * Get the bootstrap classes for the application. + * + * @return array + */ + protected function bootstrappers() + { + return $this->bootstrappers; + } + + /** + * Report the exception to the exception handler. + * + * @param \Exception $e + * @return void + */ + protected function reportException(Exception $e) + { + $this->app[ExceptionHandler::class]->report($e); + } + + /** + * Render the exception to a response. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function renderException($request, Exception $e) + { + return $this->app[ExceptionHandler::class]->render($request, $e); + } + + /** + * Get the application's route middleware groups. + * + * @return array + */ + public function getMiddlewareGroups() + { + return $this->middlewareGroups; + } + + /** + * Get the application's route middleware. + * + * @return array + */ + public function getRouteMiddleware() + { + return $this->routeMiddleware; + } + + /** + * Get the Laravel application instance. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + public function getApplication() + { + return $this->app; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php new file mode 100644 index 00000000..5a34d186 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php @@ -0,0 +1,86 @@ +app = $app; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + * @throws \Illuminate\Foundation\Http\Exceptions\MaintenanceModeException + */ + public function handle($request, Closure $next) + { + if ($this->app->isDownForMaintenance()) { + $data = json_decode(file_get_contents($this->app->storagePath().'/framework/down'), true); + + if (isset($data['allowed']) && IpUtils::checkIp($request->ip(), (array) $data['allowed'])) { + return $next($request); + } + + if ($this->inExceptArray($request)) { + return $next($request); + } + + throw new MaintenanceModeException($data['time'], $data['retry'], $data['message']); + } + + return $next($request); + } + + /** + * Determine if the request has a URI that should be accessible in maintenance mode. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function inExceptArray($request) + { + foreach ($this->except as $except) { + if ($except !== '/') { + $except = trim($except, '/'); + } + + if ($request->fullUrlIs($except) || $request->is($except)) { + return true; + } + } + + return false; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php new file mode 100644 index 00000000..813c9cf1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php @@ -0,0 +1,18 @@ +clean($request); + + return $next($request); + } + + /** + * Clean the request's data. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function clean($request) + { + $this->cleanParameterBag($request->query); + + if ($request->isJson()) { + $this->cleanParameterBag($request->json()); + } elseif ($request->request !== $request->query) { + $this->cleanParameterBag($request->request); + } + } + + /** + * Clean the data in the parameter bag. + * + * @param \Symfony\Component\HttpFoundation\ParameterBag $bag + * @return void + */ + protected function cleanParameterBag(ParameterBag $bag) + { + $bag->replace($this->cleanArray($bag->all())); + } + + /** + * Clean the data in the given array. + * + * @param array $data + * @param string $keyPrefix + * @return array + */ + protected function cleanArray(array $data, $keyPrefix = '') + { + return collect($data)->map(function ($value, $key) use ($keyPrefix) { + return $this->cleanValue($keyPrefix.$key, $value); + })->all(); + } + + /** + * Clean the given value. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function cleanValue($key, $value) + { + if (is_array($value)) { + return $this->cleanArray($value, $key.'.'); + } + + return $this->transform($key, $value); + } + + /** + * Transform the given value. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function transform($key, $value) + { + return $value; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php new file mode 100644 index 00000000..4c8d1ddb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php @@ -0,0 +1,31 @@ +except, true)) { + return $value; + } + + return is_string($value) ? trim($value) : $value; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php new file mode 100644 index 00000000..adc5f5a3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php @@ -0,0 +1,55 @@ +getPostMaxSize(); + + if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) { + throw new PostTooLargeException; + } + + return $next($request); + } + + /** + * Determine the server 'post_max_size' as bytes. + * + * @return int + */ + protected function getPostMaxSize() + { + if (is_numeric($postMaxSize = ini_get('post_max_size'))) { + return (int) $postMaxSize; + } + + $metric = strtoupper(substr($postMaxSize, -1)); + $postMaxSize = (int) $postMaxSize; + + switch ($metric) { + case 'K': + return $postMaxSize * 1024; + case 'M': + return $postMaxSize * 1048576; + case 'G': + return $postMaxSize * 1073741824; + default: + return $postMaxSize; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php new file mode 100644 index 00000000..59483200 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php @@ -0,0 +1,210 @@ +app = $app; + $this->encrypter = $encrypter; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + * + * @throws \Illuminate\Session\TokenMismatchException + */ + public function handle($request, Closure $next) + { + if ( + $this->isReading($request) || + $this->runningUnitTests() || + $this->inExceptArray($request) || + $this->tokensMatch($request) + ) { + return tap($next($request), function ($response) use ($request) { + if ($this->shouldAddXsrfTokenCookie()) { + $this->addCookieToResponse($request, $response); + } + }); + } + + throw new TokenMismatchException('CSRF token mismatch.'); + } + + /** + * Determine if the HTTP request uses a ‘read’ verb. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function isReading($request) + { + return in_array($request->method(), ['HEAD', 'GET', 'OPTIONS']); + } + + /** + * Determine if the application is running unit tests. + * + * @return bool + */ + protected function runningUnitTests() + { + return $this->app->runningInConsole() && $this->app->runningUnitTests(); + } + + /** + * Determine if the request has a URI that should pass through CSRF verification. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function inExceptArray($request) + { + foreach ($this->except as $except) { + if ($except !== '/') { + $except = trim($except, '/'); + } + + if ($request->fullUrlIs($except) || $request->is($except)) { + return true; + } + } + + return false; + } + + /** + * Determine if the session and input CSRF tokens match. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function tokensMatch($request) + { + $token = $this->getTokenFromRequest($request); + + return is_string($request->session()->token()) && + is_string($token) && + hash_equals($request->session()->token(), $token); + } + + /** + * Get the CSRF token from the request. + * + * @param \Illuminate\Http\Request $request + * @return string + */ + protected function getTokenFromRequest($request) + { + $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN'); + + if (! $token && $header = $request->header('X-XSRF-TOKEN')) { + try { + $token = CookieValuePrefix::remove($this->encrypter->decrypt($header, static::serialized())); + } catch (DecryptException $e) { + $token = ''; + } + } + + return $token; + } + + /** + * Determine if the cookie should be added to the response. + * + * @return bool + */ + public function shouldAddXsrfTokenCookie() + { + return $this->addHttpCookie; + } + + /** + * Add the CSRF token to the response cookies. + * + * @param \Illuminate\Http\Request $request + * @param \Symfony\Component\HttpFoundation\Response $response + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function addCookieToResponse($request, $response) + { + $config = config('session'); + + if ($response instanceof Responsable) { + $response = $response->toResponse($request); + } + + $response->headers->setCookie( + new Cookie( + 'XSRF-TOKEN', $request->session()->token(), $this->availableAt(60 * $config['lifetime']), + $config['path'], $config['domain'], $config['secure'], false, false, $config['same_site'] ?? null + ) + ); + + return $response; + } + + /** + * Determine if the cookie contents should be serialized. + * + * @return bool + */ + public static function serialized() + { + return EncryptCookies::serialized('XSRF-TOKEN'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php b/vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php new file mode 100644 index 00000000..78504fd6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php @@ -0,0 +1,49 @@ +random(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Mix.php b/vendor/laravel/framework/src/Illuminate/Foundation/Mix.php new file mode 100644 index 00000000..271d7dbd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Mix.php @@ -0,0 +1,68 @@ +get('app.debug')) { + report($exception); + + return $path; + } else { + throw $exception; + } + } + + return new HtmlString(app('config')->get('app.mix_url').$manifestDirectory.$manifest[$path]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php b/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php new file mode 100644 index 00000000..df770aa2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php @@ -0,0 +1,184 @@ +files = $files; + $this->basePath = $basePath; + $this->manifestPath = $manifestPath; + $this->vendorPath = $basePath.'/vendor'; + } + + /** + * Get all of the service provider class names for all packages. + * + * @return array + */ + public function providers() + { + return $this->config('providers'); + } + + /** + * Get all of the aliases for all packages. + * + * @return array + */ + public function aliases() + { + return $this->config('aliases'); + } + + /** + * Get all of the values for all packages for the given configuration name. + * + * @param string $key + * @return array + */ + public function config($key) + { + return collect($this->getManifest())->flatMap(function ($configuration) use ($key) { + return (array) ($configuration[$key] ?? []); + })->filter()->all(); + } + + /** + * Get the current package manifest. + * + * @return array + */ + protected function getManifest() + { + if (! is_null($this->manifest)) { + return $this->manifest; + } + + if (! file_exists($this->manifestPath)) { + $this->build(); + } + + return $this->manifest = file_exists($this->manifestPath) ? + $this->files->getRequire($this->manifestPath) : []; + } + + /** + * Build the manifest and write it to disk. + * + * @return void + */ + public function build() + { + $packages = []; + + if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) { + $installed = json_decode($this->files->get($path), true); + + $packages = $installed['packages'] ?? $installed; + } + + $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore()); + + $this->write(collect($packages)->mapWithKeys(function ($package) { + return [$this->format($package['name']) => $package['extra']['laravel'] ?? []]; + })->each(function ($configuration) use (&$ignore) { + $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); + })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { + return $ignoreAll || in_array($package, $ignore); + })->filter()->all()); + } + + /** + * Format the given package name. + * + * @param string $package + * @return string + */ + protected function format($package) + { + return str_replace($this->vendorPath.'/', '', $package); + } + + /** + * Get all of the package names that should be ignored. + * + * @return array + */ + protected function packagesToIgnore() + { + if (! file_exists($this->basePath.'/composer.json')) { + return []; + } + + return json_decode(file_get_contents( + $this->basePath.'/composer.json' + ), true)['extra']['laravel']['dont-discover'] ?? []; + } + + /** + * Write the given manifest array to disk. + * + * @param array $manifest + * @return void + * + * @throws \Exception + */ + protected function write(array $manifest) + { + if (! is_writable(dirname($this->manifestPath))) { + throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.'); + } + + $this->files->replace( + $this->manifestPath, 'app = $app; + $this->files = $files; + $this->manifestPath = $manifestPath; + } + + /** + * Register the application service providers. + * + * @param array $providers + * @return void + */ + public function load(array $providers) + { + $manifest = $this->loadManifest(); + + // First we will load the service manifest, which contains information on all + // service providers registered with the application and which services it + // provides. This is used to know which services are "deferred" loaders. + if ($this->shouldRecompile($manifest, $providers)) { + $manifest = $this->compileManifest($providers); + } + + // Next, we will register events to load the providers for each of the events + // that it has requested. This allows the service provider to defer itself + // while still getting automatically loaded when a certain event occurs. + foreach ($manifest['when'] as $provider => $events) { + $this->registerLoadEvents($provider, $events); + } + + // We will go ahead and register all of the eagerly loaded providers with the + // application so their services can be registered with the application as + // a provided service. Then we will set the deferred service list on it. + foreach ($manifest['eager'] as $provider) { + $this->app->register($provider); + } + + $this->app->addDeferredServices($manifest['deferred']); + } + + /** + * Load the service provider manifest JSON file. + * + * @return array|null + */ + public function loadManifest() + { + // The service manifest is a file containing a JSON representation of every + // service provided by the application and whether its provider is using + // deferred loading or should be eagerly loaded on each request to us. + if ($this->files->exists($this->manifestPath)) { + $manifest = $this->files->getRequire($this->manifestPath); + + if ($manifest) { + return array_merge(['when' => []], $manifest); + } + } + } + + /** + * Determine if the manifest should be compiled. + * + * @param array $manifest + * @param array $providers + * @return bool + */ + public function shouldRecompile($manifest, $providers) + { + return is_null($manifest) || $manifest['providers'] != $providers; + } + + /** + * Register the load events for the given provider. + * + * @param string $provider + * @param array $events + * @return void + */ + protected function registerLoadEvents($provider, array $events) + { + if (count($events) < 1) { + return; + } + + $this->app->make('events')->listen($events, function () use ($provider) { + $this->app->register($provider); + }); + } + + /** + * Compile the application service manifest file. + * + * @param array $providers + * @return array + */ + protected function compileManifest($providers) + { + // The service manifest should contain a list of all of the providers for + // the application so we can compare it on each request to the service + // and determine if the manifest should be recompiled or is current. + $manifest = $this->freshManifest($providers); + + foreach ($providers as $provider) { + $instance = $this->createProvider($provider); + + // When recompiling the service manifest, we will spin through each of the + // providers and check if it's a deferred provider or not. If so we'll + // add it's provided services to the manifest and note the provider. + if ($instance->isDeferred()) { + foreach ($instance->provides() as $service) { + $manifest['deferred'][$service] = $provider; + } + + $manifest['when'][$provider] = $instance->when(); + } + + // If the service providers are not deferred, we will simply add it to an + // array of eagerly loaded providers that will get registered on every + // request to this application instead of "lazy" loading every time. + else { + $manifest['eager'][] = $provider; + } + } + + return $this->writeManifest($manifest); + } + + /** + * Create a fresh service manifest data structure. + * + * @param array $providers + * @return array + */ + protected function freshManifest(array $providers) + { + return ['providers' => $providers, 'eager' => [], 'deferred' => []]; + } + + /** + * Write the service manifest file to disk. + * + * @param array $manifest + * @return array + * + * @throws \Exception + */ + public function writeManifest($manifest) + { + if (! is_writable($dirname = dirname($this->manifestPath))) { + throw new Exception("The {$dirname} directory must be present and writable."); + } + + $this->files->replace( + $this->manifestPath, ' []], $manifest); + } + + /** + * Create a new provider instance. + * + * @param string $provider + * @return \Illuminate\Support\ServiceProvider + */ + public function createProvider($provider) + { + return new $provider($this->app); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php new file mode 100755 index 00000000..7c33b8d5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php @@ -0,0 +1,926 @@ + 'command.cache.clear', + 'CacheForget' => 'command.cache.forget', + 'ClearCompiled' => 'command.clear-compiled', + 'ClearResets' => 'command.auth.resets.clear', + 'ConfigCache' => 'command.config.cache', + 'ConfigClear' => 'command.config.clear', + 'DbWipe' => 'command.db.wipe', + 'Down' => 'command.down', + 'Environment' => 'command.environment', + 'EventCache' => 'command.event.cache', + 'EventClear' => 'command.event.clear', + 'EventList' => 'command.event.list', + 'KeyGenerate' => 'command.key.generate', + 'Optimize' => 'command.optimize', + 'OptimizeClear' => 'command.optimize.clear', + 'PackageDiscover' => 'command.package.discover', + 'Preset' => 'command.preset', + 'QueueFailed' => 'command.queue.failed', + 'QueueFlush' => 'command.queue.flush', + 'QueueForget' => 'command.queue.forget', + 'QueueListen' => 'command.queue.listen', + 'QueueRestart' => 'command.queue.restart', + 'QueueRetry' => 'command.queue.retry', + 'QueueWork' => 'command.queue.work', + 'RouteCache' => 'command.route.cache', + 'RouteClear' => 'command.route.clear', + 'RouteList' => 'command.route.list', + 'Seed' => 'command.seed', + 'ScheduleFinish' => ScheduleFinishCommand::class, + 'ScheduleRun' => ScheduleRunCommand::class, + 'StorageLink' => 'command.storage.link', + 'Up' => 'command.up', + 'ViewCache' => 'command.view.cache', + 'ViewClear' => 'command.view.clear', + ]; + + /** + * The commands to be registered. + * + * @var array + */ + protected $devCommands = [ + 'CacheTable' => 'command.cache.table', + 'ChannelMake' => 'command.channel.make', + 'ConsoleMake' => 'command.console.make', + 'ControllerMake' => 'command.controller.make', + 'EventGenerate' => 'command.event.generate', + 'EventMake' => 'command.event.make', + 'ExceptionMake' => 'command.exception.make', + 'FactoryMake' => 'command.factory.make', + 'JobMake' => 'command.job.make', + 'ListenerMake' => 'command.listener.make', + 'MailMake' => 'command.mail.make', + 'MiddlewareMake' => 'command.middleware.make', + 'ModelMake' => 'command.model.make', + 'NotificationMake' => 'command.notification.make', + 'NotificationTable' => 'command.notification.table', + 'ObserverMake' => 'command.observer.make', + 'PolicyMake' => 'command.policy.make', + 'ProviderMake' => 'command.provider.make', + 'QueueFailedTable' => 'command.queue.failed-table', + 'QueueTable' => 'command.queue.table', + 'RequestMake' => 'command.request.make', + 'ResourceMake' => 'command.resource.make', + 'RuleMake' => 'command.rule.make', + 'SeederMake' => 'command.seeder.make', + 'SessionTable' => 'command.session.table', + 'Serve' => 'command.serve', + 'TestMake' => 'command.test.make', + 'VendorPublish' => 'command.vendor.publish', + ]; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerCommands(array_merge( + $this->commands, $this->devCommands + )); + } + + /** + * Register the given commands. + * + * @param array $commands + * @return void + */ + protected function registerCommands(array $commands) + { + foreach (array_keys($commands) as $command) { + $this->{"register{$command}Command"}(); + } + + $this->commands(array_values($commands)); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerCacheClearCommand() + { + $this->app->singleton('command.cache.clear', function ($app) { + return new CacheClearCommand($app['cache'], $app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerCacheForgetCommand() + { + $this->app->singleton('command.cache.forget', function ($app) { + return new CacheForgetCommand($app['cache']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerCacheTableCommand() + { + $this->app->singleton('command.cache.table', function ($app) { + return new CacheTableCommand($app['files'], $app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerChannelMakeCommand() + { + $this->app->singleton('command.channel.make', function ($app) { + return new ChannelMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerClearCompiledCommand() + { + $this->app->singleton('command.clear-compiled', function () { + return new ClearCompiledCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerClearResetsCommand() + { + $this->app->singleton('command.auth.resets.clear', function () { + return new ClearResetsCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerConfigCacheCommand() + { + $this->app->singleton('command.config.cache', function ($app) { + return new ConfigCacheCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerConfigClearCommand() + { + $this->app->singleton('command.config.clear', function ($app) { + return new ConfigClearCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerConsoleMakeCommand() + { + $this->app->singleton('command.console.make', function ($app) { + return new ConsoleMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerControllerMakeCommand() + { + $this->app->singleton('command.controller.make', function ($app) { + return new ControllerMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerDbWipeCommand() + { + $this->app->singleton('command.db.wipe', function () { + return new WipeCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerEventGenerateCommand() + { + $this->app->singleton('command.event.generate', function () { + return new EventGenerateCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerEventMakeCommand() + { + $this->app->singleton('command.event.make', function ($app) { + return new EventMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerExceptionMakeCommand() + { + $this->app->singleton('command.exception.make', function ($app) { + return new ExceptionMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerFactoryMakeCommand() + { + $this->app->singleton('command.factory.make', function ($app) { + return new FactoryMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerDownCommand() + { + $this->app->singleton('command.down', function () { + return new DownCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerEnvironmentCommand() + { + $this->app->singleton('command.environment', function () { + return new EnvironmentCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerEventCacheCommand() + { + $this->app->singleton('command.event.cache', function () { + return new EventCacheCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerEventClearCommand() + { + $this->app->singleton('command.event.clear', function ($app) { + return new EventClearCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerEventListCommand() + { + $this->app->singleton('command.event.list', function () { + return new EventListCommand(); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerJobMakeCommand() + { + $this->app->singleton('command.job.make', function ($app) { + return new JobMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerKeyGenerateCommand() + { + $this->app->singleton('command.key.generate', function () { + return new KeyGenerateCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerListenerMakeCommand() + { + $this->app->singleton('command.listener.make', function ($app) { + return new ListenerMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMailMakeCommand() + { + $this->app->singleton('command.mail.make', function ($app) { + return new MailMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMiddlewareMakeCommand() + { + $this->app->singleton('command.middleware.make', function ($app) { + return new MiddlewareMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerModelMakeCommand() + { + $this->app->singleton('command.model.make', function ($app) { + return new ModelMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerNotificationMakeCommand() + { + $this->app->singleton('command.notification.make', function ($app) { + return new NotificationMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerNotificationTableCommand() + { + $this->app->singleton('command.notification.table', function ($app) { + return new NotificationTableCommand($app['files'], $app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerOptimizeCommand() + { + $this->app->singleton('command.optimize', function () { + return new OptimizeCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerObserverMakeCommand() + { + $this->app->singleton('command.observer.make', function ($app) { + return new ObserverMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerOptimizeClearCommand() + { + $this->app->singleton('command.optimize.clear', function () { + return new OptimizeClearCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerPackageDiscoverCommand() + { + $this->app->singleton('command.package.discover', function () { + return new PackageDiscoverCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerPolicyMakeCommand() + { + $this->app->singleton('command.policy.make', function ($app) { + return new PolicyMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerPresetCommand() + { + $this->app->singleton('command.preset', function () { + return new PresetCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerProviderMakeCommand() + { + $this->app->singleton('command.provider.make', function ($app) { + return new ProviderMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueFailedCommand() + { + $this->app->singleton('command.queue.failed', function () { + return new ListFailedQueueCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueForgetCommand() + { + $this->app->singleton('command.queue.forget', function () { + return new ForgetFailedQueueCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueFlushCommand() + { + $this->app->singleton('command.queue.flush', function () { + return new FlushFailedQueueCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueListenCommand() + { + $this->app->singleton('command.queue.listen', function ($app) { + return new QueueListenCommand($app['queue.listener']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueRestartCommand() + { + $this->app->singleton('command.queue.restart', function ($app) { + return new QueueRestartCommand($app['cache.store']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueRetryCommand() + { + $this->app->singleton('command.queue.retry', function () { + return new QueueRetryCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueWorkCommand() + { + $this->app->singleton('command.queue.work', function ($app) { + return new QueueWorkCommand($app['queue.worker'], $app['cache.store']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueFailedTableCommand() + { + $this->app->singleton('command.queue.failed-table', function ($app) { + return new FailedTableCommand($app['files'], $app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueTableCommand() + { + $this->app->singleton('command.queue.table', function ($app) { + return new TableCommand($app['files'], $app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRequestMakeCommand() + { + $this->app->singleton('command.request.make', function ($app) { + return new RequestMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerResourceMakeCommand() + { + $this->app->singleton('command.resource.make', function ($app) { + return new ResourceMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRuleMakeCommand() + { + $this->app->singleton('command.rule.make', function ($app) { + return new RuleMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerSeederMakeCommand() + { + $this->app->singleton('command.seeder.make', function ($app) { + return new SeederMakeCommand($app['files'], $app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerSessionTableCommand() + { + $this->app->singleton('command.session.table', function ($app) { + return new SessionTableCommand($app['files'], $app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerStorageLinkCommand() + { + $this->app->singleton('command.storage.link', function () { + return new StorageLinkCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRouteCacheCommand() + { + $this->app->singleton('command.route.cache', function ($app) { + return new RouteCacheCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRouteClearCommand() + { + $this->app->singleton('command.route.clear', function ($app) { + return new RouteClearCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRouteListCommand() + { + $this->app->singleton('command.route.list', function ($app) { + return new RouteListCommand($app['router']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerSeedCommand() + { + $this->app->singleton('command.seed', function ($app) { + return new SeedCommand($app['db']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerScheduleFinishCommand() + { + $this->app->singleton(ScheduleFinishCommand::class); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerScheduleRunCommand() + { + $this->app->singleton(ScheduleRunCommand::class); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerServeCommand() + { + $this->app->singleton('command.serve', function () { + return new ServeCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerTestMakeCommand() + { + $this->app->singleton('command.test.make', function ($app) { + return new TestMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerUpCommand() + { + $this->app->singleton('command.up', function () { + return new UpCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerVendorPublishCommand() + { + $this->app->singleton('command.vendor.publish', function ($app) { + return new VendorPublishCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerViewCacheCommand() + { + $this->app->singleton('command.view.cache', function () { + return new ViewCacheCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerViewClearCommand() + { + $this->app->singleton('command.view.clear', function ($app) { + return new ViewClearCommand($app['files']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return array_merge(array_values($this->commands), array_values($this->devCommands)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php new file mode 100755 index 00000000..8fe428b0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php @@ -0,0 +1,32 @@ +app->singleton('composer', function ($app) { + return new Composer($app['files'], $app->basePath()); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['composer']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php new file mode 100644 index 00000000..b23f1873 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php @@ -0,0 +1,21 @@ +app->afterResolving(ValidatesWhenResolved::class, function ($resolved) { + $resolved->validateResolved(); + }); + + $this->app->resolving(FormRequest::class, function ($request, $app) { + $request = FormRequest::createFrom($app['request'], $request); + + $request->setContainer($app)->setRedirector($app->make(Redirector::class)); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php new file mode 100644 index 00000000..df563249 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php @@ -0,0 +1,81 @@ +app->runningInConsole()) { + $this->publishes([ + __DIR__.'/../Exceptions/views' => $this->app->resourcePath('views/errors/'), + ], 'laravel-errors'); + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + parent::register(); + + $this->registerRequestValidation(); + $this->registerRequestSignatureValidation(); + } + + /** + * Register the "validate" macro on the request. + * + * @return void + */ + public function registerRequestValidation() + { + Request::macro('validate', function (array $rules, ...$params) { + return validator()->validate($this->all(), $rules, ...$params); + }); + + Request::macro('validateWithBag', function (string $errorBag, array $rules, ...$params) { + try { + return $this->validate($rules, ...$params); + } catch (ValidationException $e) { + $e->errorBag = $errorBag; + + throw $e; + } + }); + } + + /** + * Register the "hasValidSignature" macro on the request. + * + * @return void + */ + public function registerRequestSignatureValidation() + { + Request::macro('hasValidSignature', function ($absolute = true) { + return URL::hasValidSignature($this, $absolute); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php new file mode 100644 index 00000000..7ccd2d4b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php @@ -0,0 +1,38 @@ +policies() as $key => $value) { + Gate::policy($key, $value); + } + } + + /** + * Get the policies defined on the provider. + * + * @return array + */ + public function policies() + { + return $this->policies; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php new file mode 100644 index 00000000..11e63a8d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php @@ -0,0 +1,126 @@ +getEvents(); + + foreach ($events as $event => $listeners) { + foreach (array_unique($listeners) as $listener) { + Event::listen($event, $listener); + } + } + + foreach ($this->subscribe as $subscriber) { + Event::subscribe($subscriber); + } + } + + /** + * Get the events and handlers. + * + * @return array + */ + public function listens() + { + return $this->listen; + } + + /** + * Get the discovered events and listeners for the application. + * + * @return array + */ + public function getEvents() + { + if ($this->app->eventsAreCached()) { + $cache = require $this->app->getCachedEventsPath(); + + return $cache[get_class($this)] ?? []; + } else { + return array_merge_recursive( + $this->discoveredEvents(), + $this->listens() + ); + } + } + + /** + * Get the discovered events for the application. + * + * @return array + */ + protected function discoveredEvents() + { + return $this->shouldDiscoverEvents() + ? $this->discoverEvents() + : []; + } + + /** + * Determine if events and listeners should be automatically discovered. + * + * @return bool + */ + public function shouldDiscoverEvents() + { + return false; + } + + /** + * Discover the events and listeners for the application. + * + * @return array + */ + public function discoverEvents() + { + return collect($this->discoverEventsWithin()) + ->reject(function ($directory) { + return ! is_dir($directory); + }) + ->reduce(function ($discovered, $directory) { + return array_merge_recursive( + $discovered, + DiscoverEvents::within($directory, base_path()) + ); + }, []); + } + + /** + * Get the listener directories that should be used to discover events. + * + * @return array + */ + protected function discoverEventsWithin() + { + return [ + $this->app->path('Listeners'), + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php new file mode 100644 index 00000000..b281da1a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php @@ -0,0 +1,104 @@ +setRootControllerNamespace(); + + if ($this->routesAreCached()) { + $this->loadCachedRoutes(); + } else { + $this->loadRoutes(); + + $this->app->booted(function () { + $this->app['router']->getRoutes()->refreshNameLookups(); + $this->app['router']->getRoutes()->refreshActionLookups(); + }); + } + } + + /** + * Set the root controller namespace for the application. + * + * @return void + */ + protected function setRootControllerNamespace() + { + if (! is_null($this->namespace)) { + $this->app[UrlGenerator::class]->setRootControllerNamespace($this->namespace); + } + } + + /** + * Determine if the application routes are cached. + * + * @return bool + */ + protected function routesAreCached() + { + return $this->app->routesAreCached(); + } + + /** + * Load the cached routes for the application. + * + * @return void + */ + protected function loadCachedRoutes() + { + $this->app->booted(function () { + require $this->app->getCachedRoutesPath(); + }); + } + + /** + * Load the application routes. + * + * @return void + */ + protected function loadRoutes() + { + if (method_exists($this, 'map')) { + $this->app->call([$this, 'map']); + } + } + + /** + * Pass dynamic methods onto the router instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->forwardCallTo( + $this->app->make(Router::class), $method, $parameters + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Assert.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Assert.php new file mode 100644 index 00000000..8c655922 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Assert.php @@ -0,0 +1,148 @@ += 8) { + /** + * @internal This class is not meant to be used or overwritten outside the framework itself. + */ + abstract class Assert extends PHPUnit + { + /** + * Asserts that an array has a specified subset. + * + * @param \ArrayAccess|array $subset + * @param \ArrayAccess|array $array + * @param bool $checkForIdentity + * @param string $msg + * @return void + */ + public static function assertArraySubset($subset, $array, bool $checkForIdentity = false, string $msg = ''): void + { + if (! (is_array($subset) || $subset instanceof ArrayAccess)) { + if (class_exists(InvalidArgumentException::class)) { + throw InvalidArgumentException::create(1, 'array or ArrayAccess'); + } else { + throw InvalidArgumentHelper::factory(1, 'array or ArrayAccess'); + } + } + + if (! (is_array($array) || $array instanceof ArrayAccess)) { + if (class_exists(InvalidArgumentException::class)) { + throw InvalidArgumentException::create(2, 'array or ArrayAccess'); + } else { + throw InvalidArgumentHelper::factory(2, 'array or ArrayAccess'); + } + } + + $constraint = new ArraySubset($subset, $checkForIdentity); + + PHPUnit::assertThat($array, $constraint, $msg); + } + + /** + * Asserts that a file does not exist. + * + * @param string $filename + * @param string $message + * @return void + */ + public static function assertFileDoesNotExist(string $filename, string $message = ''): void + { + static::assertThat($filename, new LogicalNot(new FileExists), $message); + } + + /** + * Asserts that a directory does not exist. + * + * @param string $directory + * @param string $message + * @return void + */ + public static function assertDirectoryDoesNotExist(string $directory, string $message = ''): void + { + static::assertThat($directory, new LogicalNot(new DirectoryExists), $message); + } + + /** + * Asserts that a string matches a given regular expression. + * + * @param string $pattern + * @param string $string + * @param string $message + * @return void + */ + public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void + { + static::assertThat($string, new RegularExpression($pattern), $message); + } + } +} else { + /** + * @internal This class is not meant to be used or overwritten outside the framework itself. + */ + abstract class Assert extends PHPUnit + { + /** + * Asserts that an array has a specified subset. + * + * @param \ArrayAccess|array $subset + * @param \ArrayAccess|array $array + * @param bool $checkForIdentity + * @param string $msg + * @return void + */ + public static function assertArraySubset($subset, $array, bool $checkForIdentity = false, string $msg = ''): void + { + PHPUnit::assertArraySubset($subset, $array, $checkForIdentity, $msg); + } + + /** + * Asserts that a file does not exist. + * + * @param string $filename + * @param string $message + * @return void + */ + public static function assertFileDoesNotExist(string $filename, string $message = ''): void + { + static::assertThat($filename, new LogicalNot(new FileExists), $message); + } + + /** + * Asserts that a directory does not exist. + * + * @param string $directory + * @param string $message + * @return void + */ + public static function assertDirectoryDoesNotExist(string $directory, string $message = ''): void + { + static::assertThat($directory, new LogicalNot(new DirectoryExists), $message); + } + + /** + * Asserts that a string matches a given regular expression. + * + * @param string $pattern + * @param string $string + * @param string $message + * @return void + */ + public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void + { + static::assertThat($string, new RegularExpression($pattern), $message); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php new file mode 100644 index 00000000..404a8bfb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php @@ -0,0 +1,151 @@ +be($user, $driver); + } + + /** + * Set the currently logged in user for the application. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string|null $driver + * @return $this + */ + public function be(UserContract $user, $driver = null) + { + if (isset($user->wasRecentlyCreated) && $user->wasRecentlyCreated) { + $user->wasRecentlyCreated = false; + } + + $this->app['auth']->guard($driver)->setUser($user); + + $this->app['auth']->shouldUse($driver); + + return $this; + } + + /** + * Assert that the user is authenticated. + * + * @param string|null $guard + * @return $this + */ + public function assertAuthenticated($guard = null) + { + $this->assertTrue($this->isAuthenticated($guard), 'The user is not authenticated'); + + return $this; + } + + /** + * Assert that the user is not authenticated. + * + * @param string|null $guard + * @return $this + */ + public function assertGuest($guard = null) + { + $this->assertFalse($this->isAuthenticated($guard), 'The user is authenticated'); + + return $this; + } + + /** + * Return true if the user is authenticated, false otherwise. + * + * @param string|null $guard + * @return bool + */ + protected function isAuthenticated($guard = null) + { + return $this->app->make('auth')->guard($guard)->check(); + } + + /** + * Assert that the user is authenticated as the given user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string|null $guard + * @return $this + */ + public function assertAuthenticatedAs($user, $guard = null) + { + $expected = $this->app->make('auth')->guard($guard)->user(); + + $this->assertNotNull($expected, 'The current user is not authenticated.'); + + $this->assertInstanceOf( + get_class($expected), $user, + 'The currently authenticated user is not who was expected' + ); + + $this->assertSame( + $expected->getAuthIdentifier(), $user->getAuthIdentifier(), + 'The currently authenticated user is not who was expected' + ); + + return $this; + } + + /** + * Assert that the given credentials are valid. + * + * @param array $credentials + * @param string|null $guard + * @return $this + */ + public function assertCredentials(array $credentials, $guard = null) + { + $this->assertTrue( + $this->hasCredentials($credentials, $guard), 'The given credentials are invalid.' + ); + + return $this; + } + + /** + * Assert that the given credentials are invalid. + * + * @param array $credentials + * @param string|null $guard + * @return $this + */ + public function assertInvalidCredentials(array $credentials, $guard = null) + { + $this->assertFalse( + $this->hasCredentials($credentials, $guard), 'The given credentials are valid.' + ); + + return $this; + } + + /** + * Return true if the credentials are valid, false otherwise. + * + * @param array $credentials + * @param string|null $guard + * @return bool + */ + protected function hasCredentials(array $credentials, $guard = null) + { + $provider = $this->app->make('auth')->guard($guard)->getProvider(); + + $user = $provider->retrieveByCredentials($credentials); + + return $user && $provider->validateCredentials($user, $credentials); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php new file mode 100644 index 00000000..87e27c50 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php @@ -0,0 +1,72 @@ +mockConsoleOutput) { + return $this->app[Kernel::class]->call($command, $parameters); + } + + $this->beforeApplicationDestroyed(function () { + if (count($this->expectedQuestions)) { + $this->fail('Question "'.Arr::first($this->expectedQuestions)[0].'" was not asked.'); + } + + if (count($this->expectedOutput)) { + $this->fail('Output "'.Arr::first($this->expectedOutput).'" was not printed.'); + } + }); + + return new PendingCommand($this, $this->app, $command, $parameters); + } + + /** + * Disable mocking the console output. + * + * @return $this + */ + protected function withoutMockingConsoleOutput() + { + $this->mockConsoleOutput = false; + + $this->app->offsetUnset(OutputStyle::class); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php new file mode 100644 index 00000000..c84852e0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php @@ -0,0 +1,111 @@ +instance($abstract, $instance); + } + + /** + * Register an instance of an object in the container. + * + * @param string $abstract + * @param object $instance + * @return object + */ + protected function instance($abstract, $instance) + { + $this->app->instance($abstract, $instance); + + return $instance; + } + + /** + * Mock an instance of an object in the container. + * + * @param string $abstract + * @param \Closure|null $mock + * @return \Mockery\MockInterface + */ + protected function mock($abstract, Closure $mock = null) + { + return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args()))); + } + + /** + * Mock a partial instance of an object in the container. + * + * @param string $abstract + * @param \Closure|null $mock + * @return \Mockery\MockInterface + */ + protected function partialMock($abstract, Closure $mock = null) + { + return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args()))->makePartial()); + } + + /** + * Spy an instance of an object in the container. + * + * @param string $abstract + * @param \Closure|null $mock + * @return \Mockery\MockInterface + */ + protected function spy($abstract, Closure $mock = null) + { + return $this->instance($abstract, Mockery::spy(...array_filter(func_get_args()))); + } + + /** + * Register an empty handler for Laravel Mix in the container. + * + * @return $this + */ + protected function withoutMix() + { + if ($this->originalMix == null) { + $this->originalMix = app(Mix::class); + } + + $this->swap(Mix::class, function () { + return ''; + }); + + return $this; + } + + /** + * Register an empty handler for Laravel Mix in the container. + * + * @return $this + */ + protected function withMix() + { + if ($this->originalMix) { + $this->app->instance(Mix::class, $this->originalMix); + } + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php new file mode 100644 index 00000000..1da32f90 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php @@ -0,0 +1,132 @@ +assertThat( + $table, new HasInDatabase($this->getConnection($connection), $data) + ); + + return $this; + } + + /** + * Assert that a given where condition does not exist in the database. + * + * @param string $table + * @param array $data + * @param string|null $connection + * @return $this + */ + protected function assertDatabaseMissing($table, array $data, $connection = null) + { + $constraint = new ReverseConstraint( + new HasInDatabase($this->getConnection($connection), $data) + ); + + $this->assertThat($table, $constraint); + + return $this; + } + + /** + * Assert the given record has been deleted. + * + * @param \Illuminate\Database\Eloquent\Model|string $table + * @param array $data + * @param string|null $connection + * @return $this + */ + protected function assertDeleted($table, array $data = [], $connection = null) + { + if ($table instanceof Model) { + return $this->assertDatabaseMissing($table->getTable(), [$table->getKeyName() => $table->getKey()], $table->getConnectionName()); + } + + $this->assertDatabaseMissing($table, $data, $connection); + + return $this; + } + + /** + * Assert the given record has been "soft deleted". + * + * @param \Illuminate\Database\Eloquent\Model|string $table + * @param array $data + * @param string|null $connection + * @param string|null $deletedAtColumn + * @return $this + */ + protected function assertSoftDeleted($table, array $data = [], $connection = null, $deletedAtColumn = 'deleted_at') + { + if ($this->isSoftDeletableModel($table)) { + return $this->assertSoftDeleted($table->getTable(), [$table->getKeyName() => $table->getKey()], $table->getConnectionName(), $table->getDeletedAtColumn()); + } + + $this->assertThat( + $table, new SoftDeletedInDatabase($this->getConnection($connection), $data, $deletedAtColumn) + ); + + return $this; + } + + /** + * Determine if the argument is a soft deletable model. + * + * @param mixed $model + * @return bool + */ + protected function isSoftDeletableModel($model) + { + return $model instanceof Model + && in_array(SoftDeletes::class, class_uses_recursive($model)); + } + + /** + * Get the database connection. + * + * @param string|null $connection + * @return \Illuminate\Database\Connection + */ + protected function getConnection($connection = null) + { + $database = $this->app->make('db'); + + $connection = $connection ?: $database->getDefaultConnection(); + + return $database->connection($connection); + } + + /** + * Seed a given database connection. + * + * @param array|string $class + * @return $this + */ + public function seed($class = 'DatabaseSeeder') + { + foreach (Arr::wrap($class) as $class) { + $this->artisan('db:seed', ['--class' => $class, '--no-interaction' => true]); + } + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php new file mode 100644 index 00000000..aa3181cd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php @@ -0,0 +1,150 @@ +originalExceptionHandler) { + $this->app->instance(ExceptionHandler::class, $this->originalExceptionHandler); + } + + return $this; + } + + /** + * Only handle the given exceptions via the exception handler. + * + * @param array $exceptions + * @return $this + */ + protected function handleExceptions(array $exceptions) + { + return $this->withoutExceptionHandling($exceptions); + } + + /** + * Only handle validation exceptions via the exception handler. + * + * @return $this + */ + protected function handleValidationExceptions() + { + return $this->handleExceptions([ValidationException::class]); + } + + /** + * Disable exception handling for the test. + * + * @param array $except + * @return $this + */ + protected function withoutExceptionHandling(array $except = []) + { + if ($this->originalExceptionHandler == null) { + $this->originalExceptionHandler = app(ExceptionHandler::class); + } + + $this->app->instance(ExceptionHandler::class, new class($this->originalExceptionHandler, $except) implements ExceptionHandler + { + protected $except; + protected $originalHandler; + + /** + * Create a new class instance. + * + * @param \Illuminate\Contracts\Debug\ExceptionHandler $originalHandler + * @param array $except + * @return void + */ + public function __construct($originalHandler, $except = []) + { + $this->except = $except; + $this->originalHandler = $originalHandler; + } + + /** + * Report or log an exception. + * + * @param \Exception $e + * @return void + * + * @throws \Exception + */ + public function report(Exception $e) + { + // + } + + /** + * Determine if the exception should be reported. + * + * @param \Exception $e + * @return bool + */ + public function shouldReport(Exception $e) + { + return false; + } + + /** + * Render an exception into an HTTP response. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Symfony\Component\HttpFoundation\Response + * + * @throws \Exception + */ + public function render($request, Exception $e) + { + foreach ($this->except as $class) { + if ($e instanceof $class) { + return $this->originalHandler->render($request, $e); + } + } + + if ($e instanceof NotFoundHttpException) { + throw new NotFoundHttpException( + "{$request->method()} {$request->url()}", null, $e->getCode() + ); + } + + throw $e; + } + + /** + * Render an exception to the console. + * + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @param \Exception $e + * @return void + */ + public function renderForConsole($output, Exception $e) + { + (new ConsoleApplication)->renderException($e, $output); + } + }); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php new file mode 100644 index 00000000..a68995b0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php @@ -0,0 +1,115 @@ +app ?? new Application; + $host = Env::get('REDIS_HOST', '127.0.0.1'); + $port = Env::get('REDIS_PORT', 6379); + + if (! extension_loaded('redis')) { + $this->markTestSkipped('The redis extension is not installed. Please install the extension to enable '.__CLASS__); + + return; + } + + if (static::$connectionFailedOnceWithDefaultsSkip) { + $this->markTestSkipped('Trying default host/port failed, please set environment variable REDIS_HOST & REDIS_PORT to enable '.__CLASS__); + + return; + } + + foreach ($this->redisDriverProvider() as $driver) { + $this->redis[$driver[0]] = new RedisManager($app, $driver[0], [ + 'cluster' => false, + 'options' => [ + 'prefix' => 'test_', + ], + 'default' => [ + 'host' => $host, + 'port' => $port, + 'database' => 5, + 'timeout' => 0.5, + ], + ]); + } + + try { + $this->redis['phpredis']->connection()->flushdb(); + } catch (Exception $e) { + if ($host === '127.0.0.1' && $port === 6379 && Env::get('REDIS_HOST') === null) { + static::$connectionFailedOnceWithDefaultsSkip = true; + $this->markTestSkipped('Trying default host/port failed, please set environment variable REDIS_HOST & REDIS_PORT to enable '.__CLASS__); + } + } + } + + /** + * Teardown redis connection. + * + * @return void + */ + public function tearDownRedis() + { + $this->redis['phpredis']->connection()->flushdb(); + + foreach ($this->redisDriverProvider() as $driver) { + $this->redis[$driver[0]]->connection()->disconnect(); + } + } + + /** + * Get redis driver provider. + * + * @return array + */ + public function redisDriverProvider() + { + return [ + ['predis'], + ['phpredis'], + ]; + } + + /** + * Run test if redis is available. + * + * @param callable $callback + * @return void + */ + public function ifRedisAvailable($callback) + { + $this->setUpRedis(); + + $callback(); + + $this->tearDownRedis(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php new file mode 100644 index 00000000..9d72e7c3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php @@ -0,0 +1,64 @@ +session($data); + + return $this; + } + + /** + * Set the session to the given array. + * + * @param array $data + * @return $this + */ + public function session(array $data) + { + $this->startSession(); + + foreach ($data as $key => $value) { + $this->app['session']->put($key, $value); + } + + return $this; + } + + /** + * Start the session for the application. + * + * @return $this + */ + protected function startSession() + { + if (! $this->app['session']->isStarted()) { + $this->app['session']->start(); + } + + return $this; + } + + /** + * Flush all of the current session data. + * + * @return $this + */ + public function flushSession() + { + $this->startSession(); + + $this->app['session']->flush(); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php new file mode 100644 index 00000000..b124c01a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php @@ -0,0 +1,597 @@ +defaultHeaders = array_merge($this->defaultHeaders, $headers); + + return $this; + } + + /** + * Add a header to be sent with the request. + * + * @param string $name + * @param string $value + * @return $this + */ + public function withHeader(string $name, string $value) + { + $this->defaultHeaders[$name] = $value; + + return $this; + } + + /** + * Flush all the configured headers. + * + * @return $this + */ + public function flushHeaders() + { + $this->defaultHeaders = []; + + return $this; + } + + /** + * Define a set of server variables to be sent with the requests. + * + * @param array $server + * @return $this + */ + public function withServerVariables(array $server) + { + $this->serverVariables = $server; + + return $this; + } + + /** + * Disable middleware for the test. + * + * @param string|array|null $middleware + * @return $this + */ + public function withoutMiddleware($middleware = null) + { + if (is_null($middleware)) { + $this->app->instance('middleware.disable', true); + + return $this; + } + + foreach ((array) $middleware as $abstract) { + $this->app->instance($abstract, new class + { + public function handle($request, $next) + { + return $next($request); + } + }); + } + + return $this; + } + + /** + * Enable the given middleware for the test. + * + * @param string|array|null $middleware + * @return $this + */ + public function withMiddleware($middleware = null) + { + if (is_null($middleware)) { + unset($this->app['middleware.disable']); + + return $this; + } + + foreach ((array) $middleware as $abstract) { + unset($this->app[$abstract]); + } + + return $this; + } + + /** + * Define additional cookies to be sent with the request. + * + * @param array $cookies + * @return $this + */ + public function withCookies(array $cookies) + { + $this->defaultCookies = array_merge($this->defaultCookies, $cookies); + + return $this; + } + + /** + * Add a cookie to be sent with the request. + * + * @param string $name + * @param string $value + * @return $this + */ + public function withCookie(string $name, string $value) + { + $this->defaultCookies[$name] = $value; + + return $this; + } + + /** + * Define additional cookies will not be encrypted before sending with the request. + * + * @param array $cookies + * @return $this + */ + public function withUnencryptedCookies(array $cookies) + { + $this->unencryptedCookies = array_merge($this->unencryptedCookies, $cookies); + + return $this; + } + + /** + * Add a cookie will not be encrypted before sending with the request. + * + * @param string $name + * @param string $value + * @return $this + */ + public function withUnencryptedCookie(string $name, string $value) + { + $this->unencryptedCookies[$name] = $value; + + return $this; + } + + /** + * Automatically follow any redirects returned from the response. + * + * @return $this + */ + public function followingRedirects() + { + $this->followRedirects = true; + + return $this; + } + + /** + * Disable automatic encryption of cookie values. + * + * @return $this + */ + public function disableCookieEncryption() + { + $this->encryptCookies = false; + + return $this; + } + + /** + * Set the referer header and previous URL session value in order to simulate a previous request. + * + * @param string $url + * @return $this + */ + public function from(string $url) + { + $this->app['session']->setPreviousUrl($url); + + return $this->withHeader('referer', $url); + } + + /** + * Visit the given URI with a GET request. + * + * @param string $uri + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function get($uri, array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + $cookies = $this->prepareCookiesForRequest(); + + return $this->call('GET', $uri, [], $cookies, [], $server); + } + + /** + * Visit the given URI with a GET request, expecting a JSON response. + * + * @param string $uri + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function getJson($uri, array $headers = []) + { + return $this->json('GET', $uri, [], $headers); + } + + /** + * Visit the given URI with a POST request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function post($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + $cookies = $this->prepareCookiesForRequest(); + + return $this->call('POST', $uri, $data, $cookies, [], $server); + } + + /** + * Visit the given URI with a POST request, expecting a JSON response. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function postJson($uri, array $data = [], array $headers = []) + { + return $this->json('POST', $uri, $data, $headers); + } + + /** + * Visit the given URI with a PUT request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function put($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + $cookies = $this->prepareCookiesForRequest(); + + return $this->call('PUT', $uri, $data, $cookies, [], $server); + } + + /** + * Visit the given URI with a PUT request, expecting a JSON response. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function putJson($uri, array $data = [], array $headers = []) + { + return $this->json('PUT', $uri, $data, $headers); + } + + /** + * Visit the given URI with a PATCH request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function patch($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + $cookies = $this->prepareCookiesForRequest(); + + return $this->call('PATCH', $uri, $data, $cookies, [], $server); + } + + /** + * Visit the given URI with a PATCH request, expecting a JSON response. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function patchJson($uri, array $data = [], array $headers = []) + { + return $this->json('PATCH', $uri, $data, $headers); + } + + /** + * Visit the given URI with a DELETE request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function delete($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + $cookies = $this->prepareCookiesForRequest(); + + return $this->call('DELETE', $uri, $data, $cookies, [], $server); + } + + /** + * Visit the given URI with a DELETE request, expecting a JSON response. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function deleteJson($uri, array $data = [], array $headers = []) + { + return $this->json('DELETE', $uri, $data, $headers); + } + + /** + * Visit the given URI with a OPTIONS request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function options($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + $cookies = $this->prepareCookiesForRequest(); + + return $this->call('OPTIONS', $uri, $data, $cookies, [], $server); + } + + /** + * Visit the given URI with a OPTIONS request, expecting a JSON response. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function optionsJson($uri, array $data = [], array $headers = []) + { + return $this->json('OPTIONS', $uri, $data, $headers); + } + + /** + * Call the given URI with a JSON request. + * + * @param string $method + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function json($method, $uri, array $data = [], array $headers = []) + { + $files = $this->extractFilesFromDataArray($data); + + $content = json_encode($data); + + $headers = array_merge([ + 'CONTENT_LENGTH' => mb_strlen($content, '8bit'), + 'CONTENT_TYPE' => 'application/json', + 'Accept' => 'application/json', + ], $headers); + + return $this->call( + $method, $uri, [], [], $files, $this->transformHeadersToServerVars($headers), $content + ); + } + + /** + * Call the given URI and return the Response. + * + * @param string $method + * @param string $uri + * @param array $parameters + * @param array $cookies + * @param array $files + * @param array $server + * @param string|null $content + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) + { + $kernel = $this->app->make(HttpKernel::class); + + $files = array_merge($files, $this->extractFilesFromDataArray($parameters)); + + $symfonyRequest = SymfonyRequest::create( + $this->prepareUrlForRequest($uri), $method, $parameters, + $cookies, $files, array_replace($this->serverVariables, $server), $content + ); + + $response = $kernel->handle( + $request = Request::createFromBase($symfonyRequest) + ); + + if ($this->followRedirects) { + $response = $this->followRedirects($response); + } + + $kernel->terminate($request, $response); + + return $this->createTestResponse($response); + } + + /** + * Turn the given URI into a fully qualified URL. + * + * @param string $uri + * @return string + */ + protected function prepareUrlForRequest($uri) + { + if (Str::startsWith($uri, '/')) { + $uri = substr($uri, 1); + } + + return trim(url($uri), '/'); + } + + /** + * Transform headers array to array of $_SERVER vars with HTTP_* format. + * + * @param array $headers + * @return array + */ + protected function transformHeadersToServerVars(array $headers) + { + return collect(array_merge($this->defaultHeaders, $headers))->mapWithKeys(function ($value, $name) { + $name = strtr(strtoupper($name), '-', '_'); + + return [$this->formatServerHeaderKey($name) => $value]; + })->all(); + } + + /** + * Format the header name for the server array. + * + * @param string $name + * @return string + */ + protected function formatServerHeaderKey($name) + { + if (! Str::startsWith($name, 'HTTP_') && $name !== 'CONTENT_TYPE' && $name !== 'REMOTE_ADDR') { + return 'HTTP_'.$name; + } + + return $name; + } + + /** + * Extract the file uploads from the given data array. + * + * @param array $data + * @return array + */ + protected function extractFilesFromDataArray(&$data) + { + $files = []; + + foreach ($data as $key => $value) { + if ($value instanceof SymfonyUploadedFile) { + $files[$key] = $value; + + unset($data[$key]); + } + + if (is_array($value)) { + $files[$key] = $this->extractFilesFromDataArray($value); + + $data[$key] = $value; + } + } + + return $files; + } + + /** + * If enabled, encrypt cookie values for request. + * + * @return array + */ + protected function prepareCookiesForRequest() + { + if (! $this->encryptCookies) { + return array_merge($this->defaultCookies, $this->unencryptedCookies); + } + + return collect($this->defaultCookies)->map(function ($value, $key) { + return encrypt(CookieValuePrefix::create($key, app('encrypter')->getKey()).$value, false); + })->merge($this->unencryptedCookies)->all(); + } + + /** + * Follow a redirect chain until a non-redirect is received. + * + * @param \Illuminate\Http\Response $response + * @return \Illuminate\Http\Response|\Illuminate\Foundation\Testing\TestResponse + */ + protected function followRedirects($response) + { + while ($response->isRedirect()) { + $response = $this->get($response->headers->get('Location')); + } + + $this->followRedirects = false; + + return $response; + } + + /** + * Create the test response instance from the given response. + * + * @param \Illuminate\Http\Response $response + * @return \Illuminate\Foundation\Testing\TestResponse + */ + protected function createTestResponse($response) + { + return TestResponse::fromBaseResponse($response); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php new file mode 100644 index 00000000..7fc360e7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php @@ -0,0 +1,286 @@ +withoutEvents(); + + $this->beforeApplicationDestroyed(function () use ($events) { + $fired = $this->getFiredEvents($events); + + $this->assertEmpty( + $eventsNotFired = array_diff($events, $fired), + 'These expected events were not fired: ['.implode(', ', $eventsNotFired).']' + ); + }); + + return $this; + } + + /** + * Specify a list of events that should not be fired for the given operation. + * + * These events will be mocked, so that handlers will not actually be executed. + * + * @param array|string $events + * @return $this + */ + public function doesntExpectEvents($events) + { + $events = is_array($events) ? $events : func_get_args(); + + $this->withoutEvents(); + + $this->beforeApplicationDestroyed(function () use ($events) { + $this->assertEmpty( + $fired = $this->getFiredEvents($events), + 'These unexpected events were fired: ['.implode(', ', $fired).']' + ); + }); + + return $this; + } + + /** + * Mock the event dispatcher so all events are silenced and collected. + * + * @return $this + */ + protected function withoutEvents() + { + $mock = Mockery::mock(EventsDispatcherContract::class)->shouldIgnoreMissing(); + + $mock->shouldReceive('dispatch', 'until')->andReturnUsing(function ($called) { + $this->firedEvents[] = $called; + }); + + Event::clearResolvedInstances(); + + $this->app->instance('events', $mock); + + return $this; + } + + /** + * Filter the given events against the fired events. + * + * @param array $events + * @return array + */ + protected function getFiredEvents(array $events) + { + return $this->getDispatched($events, $this->firedEvents); + } + + /** + * Specify a list of jobs that should be dispatched for the given operation. + * + * These jobs will be mocked, so that handlers will not actually be executed. + * + * @param array|string $jobs + * @return $this + */ + protected function expectsJobs($jobs) + { + $jobs = is_array($jobs) ? $jobs : func_get_args(); + + $this->withoutJobs(); + + $this->beforeApplicationDestroyed(function () use ($jobs) { + $dispatched = $this->getDispatchedJobs($jobs); + + $this->assertEmpty( + $jobsNotDispatched = array_diff($jobs, $dispatched), + 'These expected jobs were not dispatched: ['.implode(', ', $jobsNotDispatched).']' + ); + }); + + return $this; + } + + /** + * Specify a list of jobs that should not be dispatched for the given operation. + * + * These jobs will be mocked, so that handlers will not actually be executed. + * + * @param array|string $jobs + * @return $this + */ + protected function doesntExpectJobs($jobs) + { + $jobs = is_array($jobs) ? $jobs : func_get_args(); + + $this->withoutJobs(); + + $this->beforeApplicationDestroyed(function () use ($jobs) { + $this->assertEmpty( + $dispatched = $this->getDispatchedJobs($jobs), + 'These unexpected jobs were dispatched: ['.implode(', ', $dispatched).']' + ); + }); + + return $this; + } + + /** + * Mock the job dispatcher so all jobs are silenced and collected. + * + * @return $this + */ + protected function withoutJobs() + { + $mock = Mockery::mock(BusDispatcherContract::class)->shouldIgnoreMissing(); + + $mock->shouldReceive('dispatch', 'dispatchNow')->andReturnUsing(function ($dispatched) { + $this->dispatchedJobs[] = $dispatched; + }); + + $this->app->instance( + BusDispatcherContract::class, $mock + ); + + return $this; + } + + /** + * Filter the given jobs against the dispatched jobs. + * + * @param array $jobs + * @return array + */ + protected function getDispatchedJobs(array $jobs) + { + return $this->getDispatched($jobs, $this->dispatchedJobs); + } + + /** + * Filter the given classes against an array of dispatched classes. + * + * @param array $classes + * @param array $dispatched + * @return array + */ + protected function getDispatched(array $classes, array $dispatched) + { + return array_filter($classes, function ($class) use ($dispatched) { + return $this->wasDispatched($class, $dispatched); + }); + } + + /** + * Check if the given class exists in an array of dispatched classes. + * + * @param string $needle + * @param array $haystack + * @return bool + */ + protected function wasDispatched($needle, array $haystack) + { + foreach ($haystack as $dispatched) { + if ((is_string($dispatched) && ($dispatched === $needle || is_subclass_of($dispatched, $needle))) || + $dispatched instanceof $needle) { + return true; + } + } + + return false; + } + + /** + * Mock the notification dispatcher so all notifications are silenced. + * + * @return $this + */ + protected function withoutNotifications() + { + $mock = Mockery::mock(NotificationDispatcher::class); + + $mock->shouldReceive('send')->andReturnUsing(function ($notifiable, $instance, $channels = []) { + $this->dispatchedNotifications[] = compact( + 'notifiable', 'instance', 'channels' + ); + }); + + $this->app->instance(NotificationDispatcher::class, $mock); + + return $this; + } + + /** + * Specify a notification that is expected to be dispatched. + * + * @param mixed $notifiable + * @param string $notification + * @return $this + */ + protected function expectsNotification($notifiable, $notification) + { + $this->withoutNotifications(); + + $this->beforeApplicationDestroyed(function () use ($notifiable, $notification) { + foreach ($this->dispatchedNotifications as $dispatched) { + $notified = $dispatched['notifiable']; + + if (($notified === $notifiable || + $notified->getKey() == $notifiable->getKey()) && + get_class($dispatched['instance']) === $notification + ) { + return $this; + } + } + + $this->fail('The following expected notification were not dispatched: ['.$notification.']'); + }); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/ArraySubset.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/ArraySubset.php new file mode 100644 index 00000000..c2517142 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/ArraySubset.php @@ -0,0 +1,279 @@ += 9) { + /** + * @internal This class is not meant to be used or overwritten outside the framework itself. + */ + final class ArraySubset extends Constraint + { + /** + * @var iterable + */ + private $subset; + + /** + * @var bool + */ + private $strict; + + /** + * Create a new array subset constraint instance. + * + * @param iterable $subset + * @param bool $strict + * @return void + */ + public function __construct(iterable $subset, bool $strict = false) + { + $this->strict = $strict; + $this->subset = $subset; + } + + /** + * Evaluates the constraint for parameter $other. + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other + * @param string $description + * @param bool $returnResult + * @return bool|null + * + * @throws \PHPUnit\Framework\ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function evaluate($other, string $description = '', bool $returnResult = false): ?bool + { + // type cast $other & $this->subset as an array to allow + // support in standard array functions. + $other = $this->toArray($other); + $this->subset = $this->toArray($this->subset); + + $patched = array_replace_recursive($other, $this->subset); + + if ($this->strict) { + $result = $other === $patched; + } else { + $result = $other == $patched; + } + + if ($returnResult) { + return $result; + } + + if (! $result) { + $f = new ComparisonFailure( + $patched, + $other, + var_export($patched, true), + var_export($other, true) + ); + + $this->fail($other, $description, $f); + } + + return null; + } + + /** + * Returns a string representation of the constraint. + * + * @return string + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function toString(): string + { + return 'has the subset '.$this->exporter()->export($this->subset); + } + + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other + * @return string + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function failureDescription($other): string + { + return 'an array '.$this->toString(); + } + + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param iterable $other + * @return array + */ + private function toArray(iterable $other): array + { + if (is_array($other)) { + return $other; + } + + if ($other instanceof ArrayObject) { + return $other->getArrayCopy(); + } + + if ($other instanceof Traversable) { + return iterator_to_array($other); + } + + // Keep BC even if we know that array would not be the expected one + return (array) $other; + } + } +} elseif (class_exists(Version::class) && (int) Version::series()[0] >= 8) { + /** + * @internal This class is not meant to be used or overwritten outside the framework itself. + */ + final class ArraySubset extends Constraint + { + /** + * @var iterable + */ + private $subset; + + /** + * @var bool + */ + private $strict; + + /** + * Create a new array subset constraint instance. + * + * @param iterable $subset + * @param bool $strict + * @return void + */ + public function __construct(iterable $subset, bool $strict = false) + { + $this->strict = $strict; + $this->subset = $subset; + } + + /** + * Evaluates the constraint for parameter $other. + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other + * @param string $description + * @param bool $returnResult + * @return bool|null + * + * @throws \PHPUnit\Framework\ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function evaluate($other, string $description = '', bool $returnResult = false) + { + // type cast $other & $this->subset as an array to allow + // support in standard array functions. + $other = $this->toArray($other); + $this->subset = $this->toArray($this->subset); + + $patched = array_replace_recursive($other, $this->subset); + + if ($this->strict) { + $result = $other === $patched; + } else { + $result = $other == $patched; + } + + if ($returnResult) { + return $result; + } + + if (! $result) { + $f = new ComparisonFailure( + $patched, + $other, + var_export($patched, true), + var_export($other, true) + ); + + $this->fail($other, $description, $f); + } + } + + /** + * Returns a string representation of the constraint. + * + * @return string + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function toString(): string + { + return 'has the subset '.$this->exporter()->export($this->subset); + } + + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other + * @return string + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function failureDescription($other): string + { + return 'an array '.$this->toString(); + } + + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param iterable $other + * @return array + */ + private function toArray(iterable $other): array + { + if (is_array($other)) { + return $other; + } + + if ($other instanceof ArrayObject) { + return $other->getArrayCopy(); + } + + if ($other instanceof Traversable) { + return iterator_to_array($other); + } + + // Keep BC even if we know that array would not be the expected one + return (array) $other; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php new file mode 100644 index 00000000..c523a003 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php @@ -0,0 +1,116 @@ +data = $data; + + $this->database = $database; + } + + /** + * Check if the data is found in the given table. + * + * @param string $table + * @return bool + */ + public function matches($table): bool + { + return $this->database->table($table)->where($this->data)->count() > 0; + } + + /** + * Get the description of the failure. + * + * @param string $table + * @return string + */ + public function failureDescription($table): string + { + return sprintf( + "a row in the table [%s] matches the attributes %s.\n\n%s", + $table, $this->toString(JSON_PRETTY_PRINT), $this->getAdditionalInfo($table) + ); + } + + /** + * Get additional info about the records found in the database table. + * + * @param string $table + * @return string + */ + protected function getAdditionalInfo($table) + { + $query = $this->database->table($table); + + $similarResults = $query->where( + array_key_first($this->data), + $this->data[array_key_first($this->data)] + )->limit($this->show)->get(); + + if ($similarResults->isNotEmpty()) { + $description = 'Found similar results: '.json_encode($similarResults, JSON_PRETTY_PRINT); + } else { + $query = $this->database->table($table); + + $results = $query->limit($this->show)->get(); + + if ($results->isEmpty()) { + return 'The table is empty.'; + } + + $description = 'Found: '.json_encode($results, JSON_PRETTY_PRINT); + } + + if ($query->count() > $this->show) { + $description .= sprintf(' and %s others', $query->count() - $this->show); + } + + return $description; + } + + /** + * Get a string representation of the object. + * + * @param int $options + * @return string + */ + public function toString($options = 0): string + { + return json_encode($this->data, $options); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SeeInOrder.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SeeInOrder.php new file mode 100644 index 00000000..809eb59b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SeeInOrder.php @@ -0,0 +1,88 @@ +content = $content; + } + + /** + * Determine if the rule passes validation. + * + * @param array $values + * @return bool + */ + public function matches($values): bool + { + $position = 0; + + foreach ($values as $value) { + if (empty($value)) { + continue; + } + + $valuePosition = mb_strpos($this->content, $value, $position); + + if ($valuePosition === false || $valuePosition < $position) { + $this->failedValue = $value; + + return false; + } + + $position = $valuePosition + mb_strlen($value); + } + + return true; + } + + /** + * Get the description of the failure. + * + * @param array $values + * @return string + */ + public function failureDescription($values): string + { + return sprintf( + 'Failed asserting that \'%s\' contains "%s" in specified order.', + $this->content, + $this->failedValue + ); + } + + /** + * Get a string representation of the object. + * + * @return string + */ + public function toString(): string + { + return (new ReflectionClass($this))->name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SoftDeletedInDatabase.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SoftDeletedInDatabase.php new file mode 100644 index 00000000..f99b9311 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SoftDeletedInDatabase.php @@ -0,0 +1,117 @@ +data = $data; + + $this->database = $database; + + $this->deletedAtColumn = $deletedAtColumn; + } + + /** + * Check if the data is found in the given table. + * + * @param string $table + * @return bool + */ + public function matches($table): bool + { + return $this->database->table($table) + ->where($this->data) + ->whereNotNull($this->deletedAtColumn) + ->count() > 0; + } + + /** + * Get the description of the failure. + * + * @param string $table + * @return string + */ + public function failureDescription($table): string + { + return sprintf( + "any soft deleted row in the table [%s] matches the attributes %s.\n\n%s", + $table, $this->toString(), $this->getAdditionalInfo($table) + ); + } + + /** + * Get additional info about the records found in the database table. + * + * @param string $table + * @return string + */ + protected function getAdditionalInfo($table) + { + $query = $this->database->table($table); + + $results = $query->limit($this->show)->get(); + + if ($results->isEmpty()) { + return 'The table is empty'; + } + + $description = 'Found: '.json_encode($results, JSON_PRETTY_PRINT); + + if ($query->count() > $this->show) { + $description .= sprintf(' and %s others', $query->count() - $this->show); + } + + return $description; + } + + /** + * Get a string representation of the object. + * + * @return string + */ + public function toString(): string + { + return json_encode($this->data); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseMigrations.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseMigrations.php new file mode 100644 index 00000000..889a4532 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseMigrations.php @@ -0,0 +1,26 @@ +artisan('migrate:fresh'); + + $this->app[Kernel::class]->setArtisan(null); + + $this->beforeApplicationDestroyed(function () { + $this->artisan('migrate:rollback'); + + RefreshDatabaseState::$migrated = false; + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseTransactions.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseTransactions.php new file mode 100644 index 00000000..9870153b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseTransactions.php @@ -0,0 +1,40 @@ +app->make('db'); + + foreach ($this->connectionsToTransact() as $name) { + $database->connection($name)->beginTransaction(); + } + + $this->beforeApplicationDestroyed(function () use ($database) { + foreach ($this->connectionsToTransact() as $name) { + $connection = $database->connection($name); + + $connection->rollBack(); + $connection->disconnect(); + } + }); + } + + /** + * The database connections that should have transactions. + * + * @return array + */ + protected function connectionsToTransact() + { + return property_exists($this, 'connectionsToTransact') + ? $this->connectionsToTransact : [null]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/PendingCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/PendingCommand.php new file mode 100644 index 00000000..79f9ce4f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/PendingCommand.php @@ -0,0 +1,225 @@ +app = $app; + $this->test = $test; + $this->command = $command; + $this->parameters = $parameters; + } + + /** + * Specify a question that should be asked when the command runs. + * + * @param string $question + * @param string $answer + * @return $this + */ + public function expectsQuestion($question, $answer) + { + $this->test->expectedQuestions[] = [$question, $answer]; + + return $this; + } + + /** + * Specify output that should be printed when the command runs. + * + * @param string $output + * @return $this + */ + public function expectsOutput($output) + { + $this->test->expectedOutput[] = $output; + + return $this; + } + + /** + * Assert that the command has the given exit code. + * + * @param int $exitCode + * @return $this + */ + public function assertExitCode($exitCode) + { + $this->expectedExitCode = $exitCode; + + return $this; + } + + /** + * Execute the command. + * + * @return int + */ + public function execute() + { + return $this->run(); + } + + /** + * Execute the command. + * + * @return int + */ + public function run() + { + $this->hasExecuted = true; + + $mock = $this->mockConsoleOutput(); + + try { + $exitCode = $this->app[Kernel::class]->call($this->command, $this->parameters, $mock); + } catch (NoMatchingExpectationException $e) { + if ($e->getMethodName() === 'askQuestion') { + $this->test->fail('Unexpected question "'.$e->getActualArguments()[0]->getQuestion().'" was asked.'); + } + + throw $e; + } + + if ($this->expectedExitCode !== null) { + $this->test->assertEquals( + $this->expectedExitCode, $exitCode, + "Expected status code {$this->expectedExitCode} but received {$exitCode}." + ); + } + + return $exitCode; + } + + /** + * Mock the application's console output. + * + * @return \Mockery\MockInterface + */ + protected function mockConsoleOutput() + { + $mock = Mockery::mock(OutputStyle::class.'[askQuestion]', [ + (new ArrayInput($this->parameters)), $this->createABufferedOutputMock(), + ]); + + foreach ($this->test->expectedQuestions as $i => $question) { + $mock->shouldReceive('askQuestion') + ->once() + ->ordered() + ->with(Mockery::on(function ($argument) use ($question) { + return $argument->getQuestion() == $question[0]; + })) + ->andReturnUsing(function () use ($question, $i) { + unset($this->test->expectedQuestions[$i]); + + return $question[1]; + }); + } + + $this->app->bind(OutputStyle::class, function () use ($mock) { + return $mock; + }); + + return $mock; + } + + /** + * Create a mock for the buffered output. + * + * @return \Mockery\MockInterface + */ + private function createABufferedOutputMock() + { + $mock = Mockery::mock(BufferedOutput::class.'[doWrite]') + ->shouldAllowMockingProtectedMethods() + ->shouldIgnoreMissing(); + + foreach ($this->test->expectedOutput as $i => $output) { + $mock->shouldReceive('doWrite') + ->once() + ->ordered() + ->with($output, Mockery::any()) + ->andReturnUsing(function () use ($i) { + unset($this->test->expectedOutput[$i]); + }); + } + + return $mock; + } + + /** + * Handle the object's destruction. + * + * @return void + */ + public function __destruct() + { + if ($this->hasExecuted) { + return; + } + + $this->run(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php new file mode 100644 index 00000000..e968ad90 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php @@ -0,0 +1,129 @@ +usingInMemoryDatabase() + ? $this->refreshInMemoryDatabase() + : $this->refreshTestDatabase(); + } + + /** + * Determine if an in-memory database is being used. + * + * @return bool + */ + protected function usingInMemoryDatabase() + { + $default = config('database.default'); + + return config("database.connections.$default.database") === ':memory:'; + } + + /** + * Refresh the in-memory database. + * + * @return void + */ + protected function refreshInMemoryDatabase() + { + $this->artisan('migrate'); + + $this->app[Kernel::class]->setArtisan(null); + } + + /** + * Refresh a conventional test database. + * + * @return void + */ + protected function refreshTestDatabase() + { + if (! RefreshDatabaseState::$migrated) { + $this->artisan('migrate:fresh', [ + '--drop-views' => $this->shouldDropViews(), + '--drop-types' => $this->shouldDropTypes(), + ]); + + $this->app[Kernel::class]->setArtisan(null); + + RefreshDatabaseState::$migrated = true; + } + + $this->beginDatabaseTransaction(); + } + + /** + * Begin a database transaction on the testing database. + * + * @return void + */ + public function beginDatabaseTransaction() + { + $database = $this->app->make('db'); + + foreach ($this->connectionsToTransact() as $name) { + $connection = $database->connection($name); + $dispatcher = $connection->getEventDispatcher(); + + $connection->unsetEventDispatcher(); + $connection->beginTransaction(); + $connection->setEventDispatcher($dispatcher); + } + + $this->beforeApplicationDestroyed(function () use ($database) { + foreach ($this->connectionsToTransact() as $name) { + $connection = $database->connection($name); + $dispatcher = $connection->getEventDispatcher(); + + $connection->unsetEventDispatcher(); + $connection->rollback(); + $connection->setEventDispatcher($dispatcher); + $connection->disconnect(); + } + }); + } + + /** + * The database connections that should have transactions. + * + * @return array + */ + protected function connectionsToTransact() + { + return property_exists($this, 'connectionsToTransact') + ? $this->connectionsToTransact : [null]; + } + + /** + * Determine if views should be dropped when refreshing the database. + * + * @return bool + */ + protected function shouldDropViews() + { + return property_exists($this, 'dropViews') + ? $this->dropViews : false; + } + + /** + * Determine if types should be dropped when refreshing the database. + * + * @return bool + */ + protected function shouldDropTypes() + { + return property_exists($this, 'dropTypes') + ? $this->dropTypes : false; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabaseState.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabaseState.php new file mode 100644 index 00000000..1f330873 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabaseState.php @@ -0,0 +1,13 @@ +app) { + $this->refreshApplication(); + } + + $this->setUpTraits(); + + foreach ($this->afterApplicationCreatedCallbacks as $callback) { + $callback(); + } + + Model::setEventDispatcher($this->app['events']); + + $this->setUpHasRun = true; + } + + /** + * Refresh the application instance. + * + * @return void + */ + protected function refreshApplication() + { + $this->app = $this->createApplication(); + } + + /** + * Boot the testing helper traits. + * + * @return array + */ + protected function setUpTraits() + { + $uses = array_flip(class_uses_recursive(static::class)); + + if (isset($uses[RefreshDatabase::class])) { + $this->refreshDatabase(); + } + + if (isset($uses[DatabaseMigrations::class])) { + $this->runDatabaseMigrations(); + } + + if (isset($uses[DatabaseTransactions::class])) { + $this->beginDatabaseTransaction(); + } + + if (isset($uses[WithoutMiddleware::class])) { + $this->disableMiddlewareForAllTests(); + } + + if (isset($uses[WithoutEvents::class])) { + $this->disableEventsForAllTests(); + } + + if (isset($uses[WithFaker::class])) { + $this->setUpFaker(); + } + + return $uses; + } + + /** + * Clean up the testing environment before the next test. + * + * @return void + */ + protected function tearDown(): void + { + if ($this->app) { + $this->callBeforeApplicationDestroyedCallbacks(); + + $this->app->flush(); + + $this->app = null; + } + + $this->setUpHasRun = false; + + if (property_exists($this, 'serverVariables')) { + $this->serverVariables = []; + } + + if (property_exists($this, 'defaultHeaders')) { + $this->defaultHeaders = []; + } + + if (class_exists('Mockery')) { + if ($container = Mockery::getContainer()) { + $this->addToAssertionCount($container->mockery_getExpectationCount()); + } + + try { + Mockery::close(); + } catch (InvalidCountException $e) { + if (! Str::contains($e->getMethodName(), ['doWrite', 'askQuestion'])) { + throw $e; + } + } + } + + if (class_exists(Carbon::class)) { + Carbon::setTestNow(); + } + + if (class_exists(CarbonImmutable::class)) { + CarbonImmutable::setTestNow(); + } + + $this->afterApplicationCreatedCallbacks = []; + $this->beforeApplicationDestroyedCallbacks = []; + + Artisan::forgetBootstrappers(); + + if ($this->callbackException) { + throw $this->callbackException; + } + } + + /** + * Register a callback to be run after the application is created. + * + * @param callable $callback + * @return void + */ + public function afterApplicationCreated(callable $callback) + { + $this->afterApplicationCreatedCallbacks[] = $callback; + + if ($this->setUpHasRun) { + $callback(); + } + } + + /** + * Register a callback to be run before the application is destroyed. + * + * @param callable $callback + * @return void + */ + protected function beforeApplicationDestroyed(callable $callback) + { + $this->beforeApplicationDestroyedCallbacks[] = $callback; + } + + /** + * Execute the application's pre-destruction callbacks. + * + * @return void + */ + protected function callBeforeApplicationDestroyedCallbacks() + { + foreach ($this->beforeApplicationDestroyedCallbacks as $callback) { + try { + $callback(); + } catch (Throwable $e) { + if (! $this->callbackException) { + $this->callbackException = $e; + } + } + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php new file mode 100644 index 00000000..db8e0ff0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php @@ -0,0 +1,1300 @@ +baseResponse = $response; + } + + /** + * Create a new TestResponse from another response. + * + * @param \Illuminate\Http\Response $response + * @return static + */ + public static function fromBaseResponse($response) + { + return new static($response); + } + + /** + * Assert that the response has a successful status code. + * + * @return $this + */ + public function assertSuccessful() + { + PHPUnit::assertTrue( + $this->isSuccessful(), + 'Response status code ['.$this->getStatusCode().'] is not a successful status code.' + ); + + return $this; + } + + /** + * Assert that the response has a 200 status code. + * + * @return $this + */ + public function assertOk() + { + PHPUnit::assertTrue( + $this->isOk(), + 'Response status code ['.$this->getStatusCode().'] does not match expected 200 status code.' + ); + + return $this; + } + + /** + * Assert that the response has a 201 status code. + * + * @return $this + */ + public function assertCreated() + { + $actual = $this->getStatusCode(); + + PHPUnit::assertTrue( + 201 === $actual, + 'Response status code ['.$actual.'] does not match expected 201 status code.' + ); + + return $this; + } + + /** + * Assert that the response has the given status code and no content. + * + * @param int $status + * @return $this + */ + public function assertNoContent($status = 204) + { + $this->assertStatus($status); + + PHPUnit::assertEmpty($this->getContent(), 'Response content is not empty.'); + + return $this; + } + + /** + * Assert that the response has a not found status code. + * + * @return $this + */ + public function assertNotFound() + { + PHPUnit::assertTrue( + $this->isNotFound(), + 'Response status code ['.$this->getStatusCode().'] is not a not found status code.' + ); + + return $this; + } + + /** + * Assert that the response has a forbidden status code. + * + * @return $this + */ + public function assertForbidden() + { + PHPUnit::assertTrue( + $this->isForbidden(), + 'Response status code ['.$this->getStatusCode().'] is not a forbidden status code.' + ); + + return $this; + } + + /** + * Assert that the response has an unauthorized status code. + * + * @return $this + */ + public function assertUnauthorized() + { + $actual = $this->getStatusCode(); + + PHPUnit::assertTrue( + 401 === $actual, + 'Response status code ['.$actual.'] is not an unauthorized status code.' + ); + + return $this; + } + + /** + * Assert that the response has the given status code. + * + * @param int $status + * @return $this + */ + public function assertStatus($status) + { + $actual = $this->getStatusCode(); + + PHPUnit::assertTrue( + $actual === $status, + "Expected status code {$status} but received {$actual}." + ); + + return $this; + } + + /** + * Assert whether the response is redirecting to a given URI. + * + * @param string|null $uri + * @return $this + */ + public function assertRedirect($uri = null) + { + PHPUnit::assertTrue( + $this->isRedirect(), 'Response status code ['.$this->getStatusCode().'] is not a redirect status code.' + ); + + if (! is_null($uri)) { + $this->assertLocation($uri); + } + + return $this; + } + + /** + * Asserts that the response contains the given header and equals the optional value. + * + * @param string $headerName + * @param mixed $value + * @return $this + */ + public function assertHeader($headerName, $value = null) + { + PHPUnit::assertTrue( + $this->headers->has($headerName), "Header [{$headerName}] not present on response." + ); + + $actual = $this->headers->get($headerName); + + if (! is_null($value)) { + PHPUnit::assertEquals( + $value, $this->headers->get($headerName), + "Header [{$headerName}] was found, but value [{$actual}] does not match [{$value}]." + ); + } + + return $this; + } + + /** + * Asserts that the response does not contains the given header. + * + * @param string $headerName + * @return $this + */ + public function assertHeaderMissing($headerName) + { + PHPUnit::assertFalse( + $this->headers->has($headerName), "Unexpected header [{$headerName}] is present on response." + ); + + return $this; + } + + /** + * Assert that the current location header matches the given URI. + * + * @param string $uri + * @return $this + */ + public function assertLocation($uri) + { + PHPUnit::assertEquals( + app('url')->to($uri), app('url')->to($this->headers->get('Location')) + ); + + return $this; + } + + /** + * Asserts that the response contains the given cookie and equals the optional value. + * + * @param string $cookieName + * @param mixed $value + * @return $this + */ + public function assertPlainCookie($cookieName, $value = null) + { + $this->assertCookie($cookieName, $value, false); + + return $this; + } + + /** + * Asserts that the response contains the given cookie and equals the optional value. + * + * @param string $cookieName + * @param mixed $value + * @param bool $encrypted + * @param bool $unserialize + * @return $this + */ + public function assertCookie($cookieName, $value = null, $encrypted = true, $unserialize = false) + { + PHPUnit::assertNotNull( + $cookie = $this->getCookie($cookieName), + "Cookie [{$cookieName}] not present on response." + ); + + if (! $cookie || is_null($value)) { + return $this; + } + + $cookieValue = $cookie->getValue(); + + $actual = $encrypted + ? CookieValuePrefix::remove(app('encrypter')->decrypt($cookieValue, $unserialize)) + : $cookieValue; + + PHPUnit::assertEquals( + $value, $actual, + "Cookie [{$cookieName}] was found, but value [{$actual}] does not match [{$value}]." + ); + + return $this; + } + + /** + * Asserts that the response contains the given cookie and is expired. + * + * @param string $cookieName + * @return $this + */ + public function assertCookieExpired($cookieName) + { + PHPUnit::assertNotNull( + $cookie = $this->getCookie($cookieName), + "Cookie [{$cookieName}] not present on response." + ); + + $expiresAt = Carbon::createFromTimestamp($cookie->getExpiresTime()); + + PHPUnit::assertTrue( + $expiresAt->lessThan(Carbon::now()), + "Cookie [{$cookieName}] is not expired, it expires at [{$expiresAt}]." + ); + + return $this; + } + + /** + * Asserts that the response contains the given cookie and is not expired. + * + * @param string $cookieName + * @return $this + */ + public function assertCookieNotExpired($cookieName) + { + PHPUnit::assertNotNull( + $cookie = $this->getCookie($cookieName), + "Cookie [{$cookieName}] not present on response." + ); + + $expiresAt = Carbon::createFromTimestamp($cookie->getExpiresTime()); + + PHPUnit::assertTrue( + $expiresAt->greaterThan(Carbon::now()), + "Cookie [{$cookieName}] is expired, it expired at [{$expiresAt}]." + ); + + return $this; + } + + /** + * Asserts that the response does not contains the given cookie. + * + * @param string $cookieName + * @return $this + */ + public function assertCookieMissing($cookieName) + { + PHPUnit::assertNull( + $this->getCookie($cookieName), + "Cookie [{$cookieName}] is present on response." + ); + + return $this; + } + + /** + * Get the given cookie from the response. + * + * @param string $cookieName + * @return \Symfony\Component\HttpFoundation\Cookie|null + */ + protected function getCookie($cookieName) + { + foreach ($this->headers->getCookies() as $cookie) { + if ($cookie->getName() === $cookieName) { + return $cookie; + } + } + } + + /** + * Assert that the given string is contained within the response. + * + * @param string $value + * @return $this + */ + public function assertSee($value) + { + PHPUnit::assertStringContainsString((string) $value, $this->getContent()); + + return $this; + } + + /** + * Assert that the given strings are contained in order within the response. + * + * @param array $values + * @return $this + */ + public function assertSeeInOrder(array $values) + { + PHPUnit::assertThat($values, new SeeInOrder($this->getContent())); + + return $this; + } + + /** + * Assert that the given string is contained within the response text. + * + * @param string $value + * @return $this + */ + public function assertSeeText($value) + { + PHPUnit::assertStringContainsString((string) $value, strip_tags($this->getContent())); + + return $this; + } + + /** + * Assert that the given strings are contained in order within the response text. + * + * @param array $values + * @return $this + */ + public function assertSeeTextInOrder(array $values) + { + PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->getContent()))); + + return $this; + } + + /** + * Assert that the given string is not contained within the response. + * + * @param string $value + * @return $this + */ + public function assertDontSee($value) + { + PHPUnit::assertStringNotContainsString((string) $value, $this->getContent()); + + return $this; + } + + /** + * Assert that the given string is not contained within the response text. + * + * @param string $value + * @return $this + */ + public function assertDontSeeText($value) + { + PHPUnit::assertStringNotContainsString((string) $value, strip_tags($this->getContent())); + + return $this; + } + + /** + * Assert that the response is a superset of the given JSON. + * + * @param array $data + * @param bool $strict + * @return $this + */ + public function assertJson(array $data, $strict = false) + { + PHPUnit::assertArraySubset( + $data, $this->decodeResponseJson(), $strict, $this->assertJsonMessage($data) + ); + + return $this; + } + + /** + * Get the assertion message for assertJson. + * + * @param array $data + * @return string + */ + protected function assertJsonMessage(array $data) + { + $expected = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); + + $actual = json_encode($this->decodeResponseJson(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); + + return 'Unable to find JSON: '.PHP_EOL.PHP_EOL. + "[{$expected}]".PHP_EOL.PHP_EOL. + 'within response JSON:'.PHP_EOL.PHP_EOL. + "[{$actual}].".PHP_EOL.PHP_EOL; + } + + /** + * Assert that the expected value exists at the given path in the response. + * + * @param string $path + * @param mixed $expect + * @param bool $strict + * @return $this + */ + public function assertJsonPath($path, $expect, $strict = false) + { + if ($strict) { + PHPUnit::assertSame($expect, $this->json($path)); + } else { + PHPUnit::assertEquals($expect, $this->json($path)); + } + + return $this; + } + + /** + * Assert that the response has the exact given JSON. + * + * @param array $data + * @return $this + */ + public function assertExactJson(array $data) + { + $actual = json_encode(Arr::sortRecursive( + (array) $this->decodeResponseJson() + )); + + PHPUnit::assertEquals(json_encode(Arr::sortRecursive($data)), $actual); + + return $this; + } + + /** + * Assert that the response contains the given JSON fragment. + * + * @param array $data + * @return $this + */ + public function assertJsonFragment(array $data) + { + $actual = json_encode(Arr::sortRecursive( + (array) $this->decodeResponseJson() + )); + + foreach (Arr::sortRecursive($data) as $key => $value) { + $expected = $this->jsonSearchStrings($key, $value); + + PHPUnit::assertTrue( + Str::contains($actual, $expected), + 'Unable to find JSON fragment: '.PHP_EOL.PHP_EOL. + '['.json_encode([$key => $value]).']'.PHP_EOL.PHP_EOL. + 'within'.PHP_EOL.PHP_EOL. + "[{$actual}]." + ); + } + + return $this; + } + + /** + * Assert that the response does not contain the given JSON fragment. + * + * @param array $data + * @param bool $exact + * @return $this + */ + public function assertJsonMissing(array $data, $exact = false) + { + if ($exact) { + return $this->assertJsonMissingExact($data); + } + + $actual = json_encode(Arr::sortRecursive( + (array) $this->decodeResponseJson() + )); + + foreach (Arr::sortRecursive($data) as $key => $value) { + $unexpected = $this->jsonSearchStrings($key, $value); + + PHPUnit::assertFalse( + Str::contains($actual, $unexpected), + 'Found unexpected JSON fragment: '.PHP_EOL.PHP_EOL. + '['.json_encode([$key => $value]).']'.PHP_EOL.PHP_EOL. + 'within'.PHP_EOL.PHP_EOL. + "[{$actual}]." + ); + } + + return $this; + } + + /** + * Assert that the response does not contain the exact JSON fragment. + * + * @param array $data + * @return $this + */ + public function assertJsonMissingExact(array $data) + { + $actual = json_encode(Arr::sortRecursive( + (array) $this->decodeResponseJson() + )); + + foreach (Arr::sortRecursive($data) as $key => $value) { + $unexpected = $this->jsonSearchStrings($key, $value); + + if (! Str::contains($actual, $unexpected)) { + return $this; + } + } + + PHPUnit::fail( + 'Found unexpected JSON fragment: '.PHP_EOL.PHP_EOL. + '['.json_encode($data).']'.PHP_EOL.PHP_EOL. + 'within'.PHP_EOL.PHP_EOL. + "[{$actual}]." + ); + } + + /** + * Get the strings we need to search for when examining the JSON. + * + * @param string $key + * @param string $value + * @return array + */ + protected function jsonSearchStrings($key, $value) + { + $needle = substr(json_encode([$key => $value]), 1, -1); + + return [ + $needle.']', + $needle.'}', + $needle.',', + ]; + } + + /** + * Assert that the response has a given JSON structure. + * + * @param array|null $structure + * @param array|null $responseData + * @return $this + */ + public function assertJsonStructure(array $structure = null, $responseData = null) + { + if (is_null($structure)) { + return $this->assertExactJson($this->json()); + } + + if (is_null($responseData)) { + $responseData = $this->decodeResponseJson(); + } + + foreach ($structure as $key => $value) { + if (is_array($value) && $key === '*') { + PHPUnit::assertIsArray($responseData); + + foreach ($responseData as $responseDataItem) { + $this->assertJsonStructure($structure['*'], $responseDataItem); + } + } elseif (is_array($value)) { + PHPUnit::assertArrayHasKey($key, $responseData); + + $this->assertJsonStructure($structure[$key], $responseData[$key]); + } else { + PHPUnit::assertArrayHasKey($value, $responseData); + } + } + + return $this; + } + + /** + * Assert that the response JSON has the expected count of items at the given key. + * + * @param int $count + * @param string|null $key + * @return $this + */ + public function assertJsonCount(int $count, $key = null) + { + if (! is_null($key)) { + PHPUnit::assertCount( + $count, data_get($this->json(), $key), + "Failed to assert that the response count matched the expected {$count}" + ); + + return $this; + } + + PHPUnit::assertCount($count, + $this->json(), + "Failed to assert that the response count matched the expected {$count}" + ); + + return $this; + } + + /** + * Assert that the response has the given JSON validation errors. + * + * @param string|array $errors + * @param string $responseKey + * @return $this + */ + public function assertJsonValidationErrors($errors, $responseKey = 'errors') + { + $errors = Arr::wrap($errors); + + PHPUnit::assertNotEmpty($errors, 'No validation errors were provided.'); + + $jsonErrors = $this->json()[$responseKey] ?? []; + + $errorMessage = $jsonErrors + ? 'Response has the following JSON validation errors:'. + PHP_EOL.PHP_EOL.json_encode($jsonErrors, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE).PHP_EOL + : 'Response does not have JSON validation errors.'; + + foreach ($errors as $key => $value) { + PHPUnit::assertArrayHasKey( + (is_int($key)) ? $value : $key, + $jsonErrors, + "Failed to find a validation error in the response for key: '{$value}'".PHP_EOL.PHP_EOL.$errorMessage + ); + + if (! is_int($key)) { + $hasError = false; + + foreach (Arr::wrap($jsonErrors[$key]) as $jsonErrorMessage) { + if (Str::contains($jsonErrorMessage, $value)) { + $hasError = true; + + break; + } + } + + if (! $hasError) { + PHPUnit::fail( + "Failed to find a validation error in the response for key and message: '$key' => '$value'".PHP_EOL.PHP_EOL.$errorMessage + ); + } + } + } + + return $this; + } + + /** + * Assert that the response has no JSON validation errors for the given keys. + * + * @param string|array|null $keys + * @param string $responseKey + * @return $this + */ + public function assertJsonMissingValidationErrors($keys = null, $responseKey = 'errors') + { + if ($this->getContent() === '') { + PHPUnit::assertTrue(true); + + return $this; + } + + $json = $this->json(); + + if (! array_key_exists($responseKey, $json)) { + PHPUnit::assertArrayNotHasKey($responseKey, $json); + + return $this; + } + + $errors = $json[$responseKey]; + + if (is_null($keys) && count($errors) > 0) { + PHPUnit::fail( + 'Response has unexpected validation errors: '.PHP_EOL.PHP_EOL. + json_encode($errors, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) + ); + } + + foreach (Arr::wrap($keys) as $key) { + PHPUnit::assertFalse( + isset($errors[$key]), + "Found unexpected validation error for key: '{$key}'" + ); + } + + return $this; + } + + /** + * Validate and return the decoded response JSON. + * + * @param string|null $key + * @return mixed + */ + public function decodeResponseJson($key = null) + { + $decodedResponse = json_decode($this->getContent(), true); + + if (is_null($decodedResponse) || $decodedResponse === false) { + if ($this->exception) { + throw $this->exception; + } else { + PHPUnit::fail('Invalid JSON was returned from the route.'); + } + } + + return data_get($decodedResponse, $key); + } + + /** + * Validate and return the decoded response JSON. + * + * @param string|null $key + * @return mixed + */ + public function json($key = null) + { + return $this->decodeResponseJson($key); + } + + /** + * Assert that the response view equals the given value. + * + * @param string $value + * @return $this + */ + public function assertViewIs($value) + { + $this->ensureResponseHasView(); + + PHPUnit::assertEquals($value, $this->original->name()); + + return $this; + } + + /** + * Assert that the response view has a given piece of bound data. + * + * @param string|array $key + * @param mixed $value + * @return $this + */ + public function assertViewHas($key, $value = null) + { + if (is_array($key)) { + return $this->assertViewHasAll($key); + } + + $this->ensureResponseHasView(); + + if (is_null($value)) { + PHPUnit::assertTrue(Arr::has($this->original->gatherData(), $key)); + } elseif ($value instanceof Closure) { + PHPUnit::assertTrue($value(Arr::get($this->original->gatherData(), $key))); + } elseif ($value instanceof Model) { + PHPUnit::assertTrue($value->is(Arr::get($this->original->gatherData(), $key))); + } else { + PHPUnit::assertEquals($value, Arr::get($this->original->gatherData(), $key)); + } + + return $this; + } + + /** + * Assert that the response view has a given list of bound data. + * + * @param array $bindings + * @return $this + */ + public function assertViewHasAll(array $bindings) + { + foreach ($bindings as $key => $value) { + if (is_int($key)) { + $this->assertViewHas($value); + } else { + $this->assertViewHas($key, $value); + } + } + + return $this; + } + + /** + * Get a piece of data from the original view. + * + * @param string $key + * @return mixed + */ + public function viewData($key) + { + $this->ensureResponseHasView(); + + return $this->original->gatherData()[$key]; + } + + /** + * Assert that the response view is missing a piece of bound data. + * + * @param string $key + * @return $this + */ + public function assertViewMissing($key) + { + $this->ensureResponseHasView(); + + PHPUnit::assertFalse(Arr::has($this->original->gatherData(), $key)); + + return $this; + } + + /** + * Ensure that the response has a view as its original content. + * + * @return $this + */ + protected function ensureResponseHasView() + { + if (! isset($this->original) || ! $this->original instanceof View) { + return PHPUnit::fail('The response is not a view.'); + } + + return $this; + } + + /** + * Assert that the session has a given value. + * + * @param string|array $key + * @param mixed $value + * @return $this + */ + public function assertSessionHas($key, $value = null) + { + if (is_array($key)) { + return $this->assertSessionHasAll($key); + } + + if (is_null($value)) { + PHPUnit::assertTrue( + $this->session()->has($key), + "Session is missing expected key [{$key}]." + ); + } elseif ($value instanceof Closure) { + PHPUnit::assertTrue($value($this->session()->get($key))); + } else { + PHPUnit::assertEquals($value, $this->session()->get($key)); + } + + return $this; + } + + /** + * Assert that the session has a given list of values. + * + * @param array $bindings + * @return $this + */ + public function assertSessionHasAll(array $bindings) + { + foreach ($bindings as $key => $value) { + if (is_int($key)) { + $this->assertSessionHas($value); + } else { + $this->assertSessionHas($key, $value); + } + } + + return $this; + } + + /** + * Assert that the session has a given value in the flashed input array. + * + * @param string|array $key + * @param mixed $value + * @return $this + */ + public function assertSessionHasInput($key, $value = null) + { + if (is_array($key)) { + foreach ($key as $k => $v) { + if (is_int($k)) { + $this->assertSessionHasInput($v); + } else { + $this->assertSessionHasInput($k, $v); + } + } + + return $this; + } + + if (is_null($value)) { + PHPUnit::assertTrue( + $this->session()->hasOldInput($key), + "Session is missing expected key [{$key}]." + ); + } elseif ($value instanceof Closure) { + PHPUnit::assertTrue($value($this->session()->getOldInput($key))); + } else { + PHPUnit::assertEquals($value, $this->session()->getOldInput($key)); + } + + return $this; + } + + /** + * Assert that the session has the given errors. + * + * @param string|array $keys + * @param mixed $format + * @param string $errorBag + * @return $this + */ + public function assertSessionHasErrors($keys = [], $format = null, $errorBag = 'default') + { + $this->assertSessionHas('errors'); + + $keys = (array) $keys; + + $errors = $this->session()->get('errors')->getBag($errorBag); + + foreach ($keys as $key => $value) { + if (is_int($key)) { + PHPUnit::assertTrue($errors->has($value), "Session missing error: $value"); + } else { + PHPUnit::assertContains(is_bool($value) ? (string) $value : $value, $errors->get($key, $format)); + } + } + + return $this; + } + + /** + * Assert that the session is missing the given errors. + * + * @param string|array $keys + * @param string|null $format + * @param string $errorBag + * @return $this + */ + public function assertSessionDoesntHaveErrors($keys = [], $format = null, $errorBag = 'default') + { + $keys = (array) $keys; + + if (empty($keys)) { + return $this->assertSessionHasNoErrors(); + } + + if (is_null($this->session()->get('errors'))) { + PHPUnit::assertTrue(true); + + return $this; + } + + $errors = $this->session()->get('errors')->getBag($errorBag); + + foreach ($keys as $key => $value) { + if (is_int($key)) { + PHPUnit::assertFalse($errors->has($value), "Session has unexpected error: $value"); + } else { + PHPUnit::assertNotContains($value, $errors->get($key, $format)); + } + } + + return $this; + } + + /** + * Assert that the session has no errors. + * + * @return $this + */ + public function assertSessionHasNoErrors() + { + $hasErrors = $this->session()->has('errors'); + + $errors = $hasErrors ? $this->session()->get('errors')->all() : []; + + PHPUnit::assertFalse( + $hasErrors, + 'Session has unexpected errors: '.PHP_EOL.PHP_EOL. + json_encode($errors, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) + ); + + return $this; + } + + /** + * Assert that the session has the given errors. + * + * @param string $errorBag + * @param string|array $keys + * @param mixed $format + * @return $this + */ + public function assertSessionHasErrorsIn($errorBag, $keys = [], $format = null) + { + return $this->assertSessionHasErrors($keys, $format, $errorBag); + } + + /** + * Assert that the session does not have a given key. + * + * @param string|array $key + * @return $this + */ + public function assertSessionMissing($key) + { + if (is_array($key)) { + foreach ($key as $value) { + $this->assertSessionMissing($value); + } + } else { + PHPUnit::assertFalse( + $this->session()->has($key), + "Session has unexpected key [{$key}]." + ); + } + + return $this; + } + + /** + * Get the current session store. + * + * @return \Illuminate\Session\Store + */ + protected function session() + { + return app('session.store'); + } + + /** + * Dump the content from the response. + * + * @return $this + */ + public function dump() + { + $content = $this->getContent(); + + $json = json_decode($content); + + if (json_last_error() === JSON_ERROR_NONE) { + $content = $json; + } + + dump($content); + + return $this; + } + + /** + * Dump the headers from the response. + * + * @return $this + */ + public function dumpHeaders() + { + dump($this->headers->all()); + + return $this; + } + + /** + * Dump the session from the response. + * + * @param string|array $keys + * @return $this + */ + public function dumpSession($keys = []) + { + $keys = (array) $keys; + + if (empty($keys)) { + dump($this->session()->all()); + } else { + dump($this->session()->only($keys)); + } + + return $this; + } + + /** + * Get the streamed content from the response. + * + * @return string + */ + public function streamedContent() + { + if (! is_null($this->streamedContent)) { + return $this->streamedContent; + } + + if (! $this->baseResponse instanceof StreamedResponse) { + PHPUnit::fail('The response is not a streamed response.'); + } + + ob_start(); + + $this->sendContent(); + + return $this->streamedContent = ob_get_clean(); + } + + /** + * Dynamically access base response parameters. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->baseResponse->{$key}; + } + + /** + * Proxy isset() checks to the underlying base response. + * + * @param string $key + * @return mixed + */ + public function __isset($key) + { + return isset($this->baseResponse->{$key}); + } + + /** + * Determine if the given offset exists. + * + * @param string $offset + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->json()[$offset]); + } + + /** + * Get the value for a given offset. + * + * @param string $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->json()[$offset]; + } + + /** + * Set the value at the given offset. + * + * @param string $offset + * @param mixed $value + * @return void + * + * @throws \LogicException + */ + public function offsetSet($offset, $value) + { + throw new LogicException('Response data may not be mutated using array access.'); + } + + /** + * Unset the value at the given offset. + * + * @param string $offset + * @return void + * + * @throws \LogicException + */ + public function offsetUnset($offset) + { + throw new LogicException('Response data may not be mutated using array access.'); + } + + /** + * Handle dynamic calls into macros or pass missing methods to the base response. + * + * @param string $method + * @param array $args + * @return mixed + */ + public function __call($method, $args) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $args); + } + + return $this->baseResponse->{$method}(...$args); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithFaker.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithFaker.php new file mode 100644 index 00000000..cd276fbd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithFaker.php @@ -0,0 +1,54 @@ +faker = $this->makeFaker(); + } + + /** + * Get the default Faker instance for a given locale. + * + * @param string|null $locale + * @return \Faker\Generator + */ + protected function faker($locale = null) + { + return is_null($locale) ? $this->faker : $this->makeFaker($locale); + } + + /** + * Create a Faker instance for the given locale. + * + * @param string|null $locale + * @return \Faker\Generator + */ + protected function makeFaker($locale = null) + { + $locale = $locale ?? config('app.faker_locale', Factory::DEFAULT_LOCALE); + + if (isset($this->app) && $this->app->bound(Generator::class)) { + return $this->app->make(Generator::class, ['locale' => $locale]); + } + + return Factory::create($locale); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutEvents.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutEvents.php new file mode 100644 index 00000000..fa5df3ce --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutEvents.php @@ -0,0 +1,22 @@ +withoutEvents(); + } else { + throw new Exception('Unable to disable events. ApplicationTrait not used.'); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutMiddleware.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutMiddleware.php new file mode 100644 index 00000000..269b532d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutMiddleware.php @@ -0,0 +1,22 @@ +withoutMiddleware(); + } else { + throw new Exception('Unable to disable middleware. MakesHttpRequests trait not used.'); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php b/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php new file mode 100644 index 00000000..2a1593a2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php @@ -0,0 +1,83 @@ +getValidationFactory()->make($request->all(), $validator); + } + + return $validator->validate(); + } + + /** + * Validate the given request with the given rules. + * + * @param \Illuminate\Http\Request $request + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return array + * + * @throws \Illuminate\Validation\ValidationException + */ + public function validate(Request $request, array $rules, + array $messages = [], array $customAttributes = []) + { + return $this->getValidationFactory()->make( + $request->all(), $rules, $messages, $customAttributes + )->validate(); + } + + /** + * Validate the given request with the given rules. + * + * @param string $errorBag + * @param \Illuminate\Http\Request $request + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return array + * + * @throws \Illuminate\Validation\ValidationException + */ + public function validateWithBag($errorBag, Request $request, array $rules, + array $messages = [], array $customAttributes = []) + { + try { + return $this->validate($request, $rules, $messages, $customAttributes); + } catch (ValidationException $e) { + $e->errorBag = $errorBag; + + throw $e; + } + } + + /** + * Get a validation factory instance. + * + * @return \Illuminate\Contracts\Validation\Factory + */ + protected function getValidationFactory() + { + return app(Factory::class); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php b/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php new file mode 100644 index 00000000..4d161219 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php @@ -0,0 +1,972 @@ +toResponse(request())); + } + + app()->abort($code, $message, $headers); + } +} + +if (! function_exists('abort_if')) { + /** + * Throw an HttpException with the given data if the given condition is true. + * + * @param bool $boolean + * @param int $code + * @param string $message + * @param array $headers + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + function abort_if($boolean, $code, $message = '', array $headers = []) + { + if ($boolean) { + abort($code, $message, $headers); + } + } +} + +if (! function_exists('abort_unless')) { + /** + * Throw an HttpException with the given data unless the given condition is true. + * + * @param bool $boolean + * @param int $code + * @param string $message + * @param array $headers + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + function abort_unless($boolean, $code, $message = '', array $headers = []) + { + if (! $boolean) { + abort($code, $message, $headers); + } + } +} + +if (! function_exists('action')) { + /** + * Generate the URL to a controller action. + * + * @param string|array $name + * @param mixed $parameters + * @param bool $absolute + * @return string + */ + function action($name, $parameters = [], $absolute = true) + { + return app('url')->action($name, $parameters, $absolute); + } +} + +if (! function_exists('app')) { + /** + * Get the available container instance. + * + * @param string|null $abstract + * @param array $parameters + * @return mixed|\Illuminate\Contracts\Foundation\Application + */ + function app($abstract = null, array $parameters = []) + { + if (is_null($abstract)) { + return Container::getInstance(); + } + + return Container::getInstance()->make($abstract, $parameters); + } +} + +if (! function_exists('app_path')) { + /** + * Get the path to the application folder. + * + * @param string $path + * @return string + */ + function app_path($path = '') + { + return app()->path($path); + } +} + +if (! function_exists('asset')) { + /** + * Generate an asset path for the application. + * + * @param string $path + * @param bool|null $secure + * @return string + */ + function asset($path, $secure = null) + { + return app('url')->asset($path, $secure); + } +} + +if (! function_exists('auth')) { + /** + * Get the available auth instance. + * + * @param string|null $guard + * @return \Illuminate\Contracts\Auth\Factory|\Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard + */ + function auth($guard = null) + { + if (is_null($guard)) { + return app(AuthFactory::class); + } + + return app(AuthFactory::class)->guard($guard); + } +} + +if (! function_exists('back')) { + /** + * Create a new redirect response to the previous location. + * + * @param int $status + * @param array $headers + * @param mixed $fallback + * @return \Illuminate\Http\RedirectResponse + */ + function back($status = 302, $headers = [], $fallback = false) + { + return app('redirect')->back($status, $headers, $fallback); + } +} + +if (! function_exists('base_path')) { + /** + * Get the path to the base of the install. + * + * @param string $path + * @return string + */ + function base_path($path = '') + { + return app()->basePath($path); + } +} + +if (! function_exists('bcrypt')) { + /** + * Hash the given value against the bcrypt algorithm. + * + * @param string $value + * @param array $options + * @return string + */ + function bcrypt($value, $options = []) + { + return app('hash')->driver('bcrypt')->make($value, $options); + } +} + +if (! function_exists('broadcast')) { + /** + * Begin broadcasting an event. + * + * @param mixed|null $event + * @return \Illuminate\Broadcasting\PendingBroadcast + */ + function broadcast($event = null) + { + return app(BroadcastFactory::class)->event($event); + } +} + +if (! function_exists('cache')) { + /** + * Get / set the specified cache value. + * + * If an array is passed, we'll assume you want to put to the cache. + * + * @param dynamic key|key,default|data,expiration|null + * @return mixed|\Illuminate\Cache\CacheManager + * + * @throws \Exception + */ + function cache() + { + $arguments = func_get_args(); + + if (empty($arguments)) { + return app('cache'); + } + + if (is_string($arguments[0])) { + return app('cache')->get(...$arguments); + } + + if (! is_array($arguments[0])) { + throw new Exception( + 'When setting a value in the cache, you must pass an array of key / value pairs.' + ); + } + + return app('cache')->put(key($arguments[0]), reset($arguments[0]), $arguments[1] ?? null); + } +} + +if (! function_exists('config')) { + /** + * Get / set the specified configuration value. + * + * If an array is passed as the key, we will assume you want to set an array of values. + * + * @param array|string|null $key + * @param mixed $default + * @return mixed|\Illuminate\Config\Repository + */ + function config($key = null, $default = null) + { + if (is_null($key)) { + return app('config'); + } + + if (is_array($key)) { + return app('config')->set($key); + } + + return app('config')->get($key, $default); + } +} + +if (! function_exists('config_path')) { + /** + * Get the configuration path. + * + * @param string $path + * @return string + */ + function config_path($path = '') + { + return app()->configPath($path); + } +} + +if (! function_exists('cookie')) { + /** + * Create a new cookie instance. + * + * @param string|null $name + * @param string|null $value + * @param int $minutes + * @param string|null $path + * @param string|null $domain + * @param bool|null $secure + * @param bool $httpOnly + * @param bool $raw + * @param string|null $sameSite + * @return \Illuminate\Cookie\CookieJar|\Symfony\Component\HttpFoundation\Cookie + */ + function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null) + { + $cookie = app(CookieFactory::class); + + if (is_null($name)) { + return $cookie; + } + + return $cookie->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly, $raw, $sameSite); + } +} + +if (! function_exists('csrf_field')) { + /** + * Generate a CSRF token form field. + * + * @return \Illuminate\Support\HtmlString + */ + function csrf_field() + { + return new HtmlString(''); + } +} + +if (! function_exists('csrf_token')) { + /** + * Get the CSRF token value. + * + * @return string + * + * @throws \RuntimeException + */ + function csrf_token() + { + $session = app('session'); + + if (isset($session)) { + return $session->token(); + } + + throw new RuntimeException('Application session store not set.'); + } +} + +if (! function_exists('database_path')) { + /** + * Get the database path. + * + * @param string $path + * @return string + */ + function database_path($path = '') + { + return app()->databasePath($path); + } +} + +if (! function_exists('decrypt')) { + /** + * Decrypt the given value. + * + * @param string $value + * @param bool $unserialize + * @return mixed + */ + function decrypt($value, $unserialize = true) + { + return app('encrypter')->decrypt($value, $unserialize); + } +} + +if (! function_exists('dispatch')) { + /** + * Dispatch a job to its appropriate handler. + * + * @param mixed $job + * @return \Illuminate\Foundation\Bus\PendingDispatch + */ + function dispatch($job) + { + if ($job instanceof Closure) { + $job = CallQueuedClosure::create($job); + } + + return new PendingDispatch($job); + } +} + +if (! function_exists('dispatch_now')) { + /** + * Dispatch a command to its appropriate handler in the current process. + * + * @param mixed $job + * @param mixed $handler + * @return mixed + */ + function dispatch_now($job, $handler = null) + { + return app(Dispatcher::class)->dispatchNow($job, $handler); + } +} + +if (! function_exists('elixir')) { + /** + * Get the path to a versioned Elixir file. + * + * @param string $file + * @param string $buildDirectory + * @return string + * + * @throws \InvalidArgumentException + * + * @deprecated Use Laravel Mix instead. + */ + function elixir($file, $buildDirectory = 'build') + { + static $manifest = []; + static $manifestPath; + + if (empty($manifest) || $manifestPath !== $buildDirectory) { + $path = public_path($buildDirectory.'/rev-manifest.json'); + + if (file_exists($path)) { + $manifest = json_decode(file_get_contents($path), true); + $manifestPath = $buildDirectory; + } + } + + $file = ltrim($file, '/'); + + if (isset($manifest[$file])) { + return '/'.trim($buildDirectory.'/'.$manifest[$file], '/'); + } + + $unversioned = public_path($file); + + if (file_exists($unversioned)) { + return '/'.trim($file, '/'); + } + + throw new InvalidArgumentException("File {$file} not defined in asset manifest."); + } +} + +if (! function_exists('encrypt')) { + /** + * Encrypt the given value. + * + * @param mixed $value + * @param bool $serialize + * @return string + */ + function encrypt($value, $serialize = true) + { + return app('encrypter')->encrypt($value, $serialize); + } +} + +if (! function_exists('event')) { + /** + * Dispatch an event and call the listeners. + * + * @param string|object $event + * @param mixed $payload + * @param bool $halt + * @return array|null + */ + function event(...$args) + { + return app('events')->dispatch(...$args); + } +} + +if (! function_exists('factory')) { + /** + * Create a model factory builder for a given class, name, and amount. + * + * @param dynamic class|class,name|class,amount|class,name,amount + * @return \Illuminate\Database\Eloquent\FactoryBuilder + */ + function factory() + { + $factory = app(EloquentFactory::class); + + $arguments = func_get_args(); + + if (isset($arguments[1]) && is_string($arguments[1])) { + return $factory->of($arguments[0], $arguments[1])->times($arguments[2] ?? null); + } elseif (isset($arguments[1])) { + return $factory->of($arguments[0])->times($arguments[1]); + } + + return $factory->of($arguments[0]); + } +} + +if (! function_exists('info')) { + /** + * Write some information to the log. + * + * @param string $message + * @param array $context + * @return void + */ + function info($message, $context = []) + { + app('log')->info($message, $context); + } +} + +if (! function_exists('logger')) { + /** + * Log a debug message to the logs. + * + * @param string|null $message + * @param array $context + * @return \Illuminate\Log\LogManager|null + */ + function logger($message = null, array $context = []) + { + if (is_null($message)) { + return app('log'); + } + + return app('log')->debug($message, $context); + } +} + +if (! function_exists('logs')) { + /** + * Get a log driver instance. + * + * @param string|null $driver + * @return \Illuminate\Log\LogManager|\Psr\Log\LoggerInterface + */ + function logs($driver = null) + { + return $driver ? app('log')->driver($driver) : app('log'); + } +} + +if (! function_exists('method_field')) { + /** + * Generate a form field to spoof the HTTP verb used by forms. + * + * @param string $method + * @return \Illuminate\Support\HtmlString + */ + function method_field($method) + { + return new HtmlString(''); + } +} + +if (! function_exists('mix')) { + /** + * Get the path to a versioned Mix file. + * + * @param string $path + * @param string $manifestDirectory + * @return \Illuminate\Support\HtmlString|string + * + * @throws \Exception + */ + function mix($path, $manifestDirectory = '') + { + return app(Mix::class)(...func_get_args()); + } +} + +if (! function_exists('now')) { + /** + * Create a new Carbon instance for the current time. + * + * @param \DateTimeZone|string|null $tz + * @return \Illuminate\Support\Carbon + */ + function now($tz = null) + { + return Date::now($tz); + } +} + +if (! function_exists('old')) { + /** + * Retrieve an old input item. + * + * @param string|null $key + * @param mixed $default + * @return mixed + */ + function old($key = null, $default = null) + { + return app('request')->old($key, $default); + } +} + +if (! function_exists('policy')) { + /** + * Get a policy instance for a given class. + * + * @param object|string $class + * @return mixed + * + * @throws \InvalidArgumentException + */ + function policy($class) + { + return app(Gate::class)->getPolicyFor($class); + } +} + +if (! function_exists('public_path')) { + /** + * Get the path to the public folder. + * + * @param string $path + * @return string + */ + function public_path($path = '') + { + return app()->make('path.public').($path ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : $path); + } +} + +if (! function_exists('redirect')) { + /** + * Get an instance of the redirector. + * + * @param string|null $to + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse + */ + function redirect($to = null, $status = 302, $headers = [], $secure = null) + { + if (is_null($to)) { + return app('redirect'); + } + + return app('redirect')->to($to, $status, $headers, $secure); + } +} + +if (! function_exists('report')) { + /** + * Report an exception. + * + * @param \Throwable $exception + * @return void + */ + function report($exception) + { + if ($exception instanceof Throwable && + ! $exception instanceof Exception) { + $exception = new FatalThrowableError($exception); + } + + app(ExceptionHandler::class)->report($exception); + } +} + +if (! function_exists('request')) { + /** + * Get an instance of the current request or an input item from the request. + * + * @param array|string|null $key + * @param mixed $default + * @return \Illuminate\Http\Request|string|array + */ + function request($key = null, $default = null) + { + if (is_null($key)) { + return app('request'); + } + + if (is_array($key)) { + return app('request')->only($key); + } + + $value = app('request')->__get($key); + + return is_null($value) ? value($default) : $value; + } +} + +if (! function_exists('rescue')) { + /** + * Catch a potential exception and return a default value. + * + * @param callable $callback + * @param mixed $rescue + * @param bool $report + * @return mixed + */ + function rescue(callable $callback, $rescue = null, $report = true) + { + try { + return $callback(); + } catch (Throwable $e) { + if ($report) { + report($e); + } + + return $rescue instanceof Closure ? $rescue($e) : $rescue; + } + } +} + +if (! function_exists('resolve')) { + /** + * Resolve a service from the container. + * + * @param string $name + * @param array $parameters + * @return mixed + */ + function resolve($name, array $parameters = []) + { + return app($name, $parameters); + } +} + +if (! function_exists('resource_path')) { + /** + * Get the path to the resources folder. + * + * @param string $path + * @return string + */ + function resource_path($path = '') + { + return app()->resourcePath($path); + } +} + +if (! function_exists('response')) { + /** + * Return a new response from the application. + * + * @param \Illuminate\View\View|string|array|null $content + * @param int $status + * @param array $headers + * @return \Illuminate\Http\Response|\Illuminate\Contracts\Routing\ResponseFactory + */ + function response($content = '', $status = 200, array $headers = []) + { + $factory = app(ResponseFactory::class); + + if (func_num_args() === 0) { + return $factory; + } + + return $factory->make($content, $status, $headers); + } +} + +if (! function_exists('route')) { + /** + * Generate the URL to a named route. + * + * @param array|string $name + * @param mixed $parameters + * @param bool $absolute + * @return string + */ + function route($name, $parameters = [], $absolute = true) + { + return app('url')->route($name, $parameters, $absolute); + } +} + +if (! function_exists('secure_asset')) { + /** + * Generate an asset path for the application. + * + * @param string $path + * @return string + */ + function secure_asset($path) + { + return asset($path, true); + } +} + +if (! function_exists('secure_url')) { + /** + * Generate a HTTPS url for the application. + * + * @param string $path + * @param mixed $parameters + * @return string + */ + function secure_url($path, $parameters = []) + { + return url($path, $parameters, true); + } +} + +if (! function_exists('session')) { + /** + * Get / set the specified session value. + * + * If an array is passed as the key, we will assume you want to set an array of values. + * + * @param array|string|null $key + * @param mixed $default + * @return mixed|\Illuminate\Session\Store|\Illuminate\Session\SessionManager + */ + function session($key = null, $default = null) + { + if (is_null($key)) { + return app('session'); + } + + if (is_array($key)) { + return app('session')->put($key); + } + + return app('session')->get($key, $default); + } +} + +if (! function_exists('storage_path')) { + /** + * Get the path to the storage folder. + * + * @param string $path + * @return string + */ + function storage_path($path = '') + { + return app('path.storage').($path ? DIRECTORY_SEPARATOR.$path : $path); + } +} + +if (! function_exists('today')) { + /** + * Create a new Carbon instance for the current date. + * + * @param \DateTimeZone|string|null $tz + * @return \Illuminate\Support\Carbon + */ + function today($tz = null) + { + return Date::today($tz); + } +} + +if (! function_exists('trans')) { + /** + * Translate the given message. + * + * @param string|null $key + * @param array $replace + * @param string|null $locale + * @return \Illuminate\Contracts\Translation\Translator|string|array|null + */ + function trans($key = null, $replace = [], $locale = null) + { + if (is_null($key)) { + return app('translator'); + } + + return app('translator')->get($key, $replace, $locale); + } +} + +if (! function_exists('trans_choice')) { + /** + * Translates the given message based on a count. + * + * @param string $key + * @param \Countable|int|array $number + * @param array $replace + * @param string|null $locale + * @return string + */ + function trans_choice($key, $number, array $replace = [], $locale = null) + { + return app('translator')->choice($key, $number, $replace, $locale); + } +} + +if (! function_exists('__')) { + /** + * Translate the given message. + * + * @param string|null $key + * @param array $replace + * @param string|null $locale + * @return string|array|null + */ + function __($key = null, $replace = [], $locale = null) + { + if (is_null($key)) { + return $key; + } + + return trans($key, $replace, $locale); + } +} + +if (! function_exists('url')) { + /** + * Generate a url for the application. + * + * @param string|null $path + * @param mixed $parameters + * @param bool|null $secure + * @return \Illuminate\Contracts\Routing\UrlGenerator|string + */ + function url($path = null, $parameters = [], $secure = null) + { + if (is_null($path)) { + return app(UrlGenerator::class); + } + + return app(UrlGenerator::class)->to($path, $parameters, $secure); + } +} + +if (! function_exists('validator')) { + /** + * Create a new Validator instance. + * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return \Illuminate\Contracts\Validation\Validator|\Illuminate\Contracts\Validation\Factory + */ + function validator(array $data = [], array $rules = [], array $messages = [], array $customAttributes = []) + { + $factory = app(ValidationFactory::class); + + if (func_num_args() === 0) { + return $factory; + } + + return $factory->make($data, $rules, $messages, $customAttributes); + } +} + +if (! function_exists('view')) { + /** + * Get the evaluated view contents for the given view. + * + * @param string|null $view + * @param \Illuminate\Contracts\Support\Arrayable|array $data + * @param array $mergeData + * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory + */ + function view($view = null, $data = [], $mergeData = []) + { + $factory = app(ViewFactory::class); + + if (func_num_args() === 0) { + return $factory; + } + + return $factory->make($view, $data, $mergeData); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/stubs/facade.stub b/vendor/laravel/framework/src/Illuminate/Foundation/stubs/facade.stub new file mode 100644 index 00000000..aadbe746 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/stubs/facade.stub @@ -0,0 +1,21 @@ +verifyAlgorithm && $this->info($hashedValue)['algoName'] !== 'argon2id') { + throw new RuntimeException('This password does not use the Argon2id algorithm.'); + } + + if (strlen($hashedValue) === 0) { + return false; + } + + return password_verify($value, $hashedValue); + } + + /** + * Get the algorithm that should be used for hashing. + * + * @return int + */ + protected function algorithm() + { + return PASSWORD_ARGON2ID; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Hashing/ArgonHasher.php b/vendor/laravel/framework/src/Illuminate/Hashing/ArgonHasher.php new file mode 100644 index 00000000..41109c9b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Hashing/ArgonHasher.php @@ -0,0 +1,192 @@ +time = $options['time'] ?? $this->time; + $this->memory = $options['memory'] ?? $this->memory; + $this->threads = $options['threads'] ?? $this->threads; + $this->verifyAlgorithm = $options['verify'] ?? $this->verifyAlgorithm; + } + + /** + * Hash the given value. + * + * @param string $value + * @param array $options + * @return string + * + * @throws \RuntimeException + */ + public function make($value, array $options = []) + { + $hash = @password_hash($value, $this->algorithm(), [ + 'memory_cost' => $this->memory($options), + 'time_cost' => $this->time($options), + 'threads' => $this->threads($options), + ]); + + if (! is_string($hash)) { + throw new RuntimeException('Argon2 hashing not supported.'); + } + + return $hash; + } + + /** + * Get the algorithm that should be used for hashing. + * + * @return int + */ + protected function algorithm() + { + return PASSWORD_ARGON2I; + } + + /** + * Check the given plain value against a hash. + * + * @param string $value + * @param string $hashedValue + * @param array $options + * @return bool + * + * @throws \RuntimeException + */ + public function check($value, $hashedValue, array $options = []) + { + if ($this->verifyAlgorithm && $this->info($hashedValue)['algoName'] !== 'argon2i') { + throw new RuntimeException('This password does not use the Argon2i algorithm.'); + } + + return parent::check($value, $hashedValue, $options); + } + + /** + * Check if the given hash has been hashed using the given options. + * + * @param string $hashedValue + * @param array $options + * @return bool + */ + public function needsRehash($hashedValue, array $options = []) + { + return password_needs_rehash($hashedValue, $this->algorithm(), [ + 'memory_cost' => $this->memory($options), + 'time_cost' => $this->time($options), + 'threads' => $this->threads($options), + ]); + } + + /** + * Set the default password memory factor. + * + * @param int $memory + * @return $this + */ + public function setMemory(int $memory) + { + $this->memory = $memory; + + return $this; + } + + /** + * Set the default password timing factor. + * + * @param int $time + * @return $this + */ + public function setTime(int $time) + { + $this->time = $time; + + return $this; + } + + /** + * Set the default password threads factor. + * + * @param int $threads + * @return $this + */ + public function setThreads(int $threads) + { + $this->threads = $threads; + + return $this; + } + + /** + * Extract the memory cost value from the options array. + * + * @param array $options + * @return int + */ + protected function memory(array $options) + { + return $options['memory'] ?? $this->memory; + } + + /** + * Extract the time cost value from the options array. + * + * @param array $options + * @return int + */ + protected function time(array $options) + { + return $options['time'] ?? $this->time; + } + + /** + * Extract the threads value from the options array. + * + * @param array $options + * @return int + */ + protected function threads(array $options) + { + return $options['threads'] ?? $this->threads; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php b/vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php new file mode 100755 index 00000000..26f928cb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php @@ -0,0 +1,114 @@ +rounds = $options['rounds'] ?? $this->rounds; + $this->verifyAlgorithm = $options['verify'] ?? $this->verifyAlgorithm; + } + + /** + * Hash the given value. + * + * @param string $value + * @param array $options + * @return string + * + * @throws \RuntimeException + */ + public function make($value, array $options = []) + { + $hash = password_hash($value, PASSWORD_BCRYPT, [ + 'cost' => $this->cost($options), + ]); + + if ($hash === false) { + throw new RuntimeException('Bcrypt hashing not supported.'); + } + + return $hash; + } + + /** + * Check the given plain value against a hash. + * + * @param string $value + * @param string $hashedValue + * @param array $options + * @return bool + * + * @throws \RuntimeException + */ + public function check($value, $hashedValue, array $options = []) + { + if ($this->verifyAlgorithm && $this->info($hashedValue)['algoName'] !== 'bcrypt') { + throw new RuntimeException('This password does not use the Bcrypt algorithm.'); + } + + return parent::check($value, $hashedValue, $options); + } + + /** + * Check if the given hash has been hashed using the given options. + * + * @param string $hashedValue + * @param array $options + * @return bool + */ + public function needsRehash($hashedValue, array $options = []) + { + return password_needs_rehash($hashedValue, PASSWORD_BCRYPT, [ + 'cost' => $this->cost($options), + ]); + } + + /** + * Set the default password work factor. + * + * @param int $rounds + * @return $this + */ + public function setRounds($rounds) + { + $this->rounds = (int) $rounds; + + return $this; + } + + /** + * Extract the cost value from the options array. + * + * @param array $options + * @return int + */ + protected function cost(array $options = []) + { + return $options['rounds'] ?? $this->rounds; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Hashing/HashManager.php b/vendor/laravel/framework/src/Illuminate/Hashing/HashManager.php new file mode 100644 index 00000000..977ef222 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Hashing/HashManager.php @@ -0,0 +1,97 @@ +config->get('hashing.bcrypt') ?? []); + } + + /** + * Create an instance of the Argon2i hash Driver. + * + * @return \Illuminate\Hashing\ArgonHasher + */ + public function createArgonDriver() + { + return new ArgonHasher($this->config->get('hashing.argon') ?? []); + } + + /** + * Create an instance of the Argon2id hash Driver. + * + * @return \Illuminate\Hashing\Argon2IdHasher + */ + public function createArgon2idDriver() + { + return new Argon2IdHasher($this->config->get('hashing.argon') ?? []); + } + + /** + * Get information about the given hashed value. + * + * @param string $hashedValue + * @return array + */ + public function info($hashedValue) + { + return $this->driver()->info($hashedValue); + } + + /** + * Hash the given value. + * + * @param string $value + * @param array $options + * @return string + */ + public function make($value, array $options = []) + { + return $this->driver()->make($value, $options); + } + + /** + * Check the given plain value against a hash. + * + * @param string $value + * @param string $hashedValue + * @param array $options + * @return bool + */ + public function check($value, $hashedValue, array $options = []) + { + return $this->driver()->check($value, $hashedValue, $options); + } + + /** + * Check if the given hash has been hashed using the given options. + * + * @param string $hashedValue + * @param array $options + * @return bool + */ + public function needsRehash($hashedValue, array $options = []) + { + return $this->driver()->needsRehash($hashedValue, $options); + } + + /** + * Get the default driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->config->get('hashing.driver', 'bcrypt'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php new file mode 100755 index 00000000..2ed56a42 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php @@ -0,0 +1,35 @@ +app->singleton('hash', function ($app) { + return new HashManager($app); + }); + + $this->app->singleton('hash.driver', function ($app) { + return $app['hash']->driver(); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['hash', 'hash.driver']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Hashing/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Hashing/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Hashing/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Hashing/composer.json b/vendor/laravel/framework/src/Illuminate/Hashing/composer.json new file mode 100755 index 00000000..80d47dde --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Hashing/composer.json @@ -0,0 +1,35 @@ +{ + "name": "illuminate/hashing", + "description": "The Illuminate Hashing package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Hashing\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php new file mode 100644 index 00000000..25d6ec1e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php @@ -0,0 +1,171 @@ +header('CONTENT_TYPE') ?? '', ['/json', '+json']); + } + + /** + * Determine if the current request probably expects a JSON response. + * + * @return bool + */ + public function expectsJson() + { + return ($this->ajax() && ! $this->pjax() && $this->acceptsAnyContentType()) || $this->wantsJson(); + } + + /** + * Determine if the current request is asking for JSON. + * + * @return bool + */ + public function wantsJson() + { + $acceptable = $this->getAcceptableContentTypes(); + + return isset($acceptable[0]) && Str::contains($acceptable[0], ['/json', '+json']); + } + + /** + * Determines whether the current requests accepts a given content type. + * + * @param string|array $contentTypes + * @return bool + */ + public function accepts($contentTypes) + { + $accepts = $this->getAcceptableContentTypes(); + + if (count($accepts) === 0) { + return true; + } + + $types = (array) $contentTypes; + + foreach ($accepts as $accept) { + if ($accept === '*/*' || $accept === '*') { + return true; + } + + foreach ($types as $type) { + if ($this->matchesType($accept, $type) || $accept === strtok($type, '/').'/*') { + return true; + } + } + } + + return false; + } + + /** + * Return the most suitable content type from the given array based on content negotiation. + * + * @param string|array $contentTypes + * @return string|null + */ + public function prefers($contentTypes) + { + $accepts = $this->getAcceptableContentTypes(); + + $contentTypes = (array) $contentTypes; + + foreach ($accepts as $accept) { + if (in_array($accept, ['*/*', '*'])) { + return $contentTypes[0]; + } + + foreach ($contentTypes as $contentType) { + $type = $contentType; + + if (! is_null($mimeType = $this->getMimeType($contentType))) { + $type = $mimeType; + } + + if ($this->matchesType($type, $accept) || $accept === strtok($type, '/').'/*') { + return $contentType; + } + } + } + } + + /** + * Determine if the current request accepts any content type. + * + * @return bool + */ + public function acceptsAnyContentType() + { + $acceptable = $this->getAcceptableContentTypes(); + + return count($acceptable) === 0 || ( + isset($acceptable[0]) && ($acceptable[0] === '*/*' || $acceptable[0] === '*') + ); + } + + /** + * Determines whether a request accepts JSON. + * + * @return bool + */ + public function acceptsJson() + { + return $this->accepts('application/json'); + } + + /** + * Determines whether a request accepts HTML. + * + * @return bool + */ + public function acceptsHtml() + { + return $this->accepts('text/html'); + } + + /** + * Get the data format expected in the response. + * + * @param string $default + * @return string + */ + public function format($default = 'html') + { + foreach ($this->getAcceptableContentTypes() as $type) { + if ($format = $this->getFormat($type)) { + return $format; + } + } + + return $default; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithFlashData.php b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithFlashData.php new file mode 100644 index 00000000..25e11a95 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithFlashData.php @@ -0,0 +1,64 @@ +hasSession() ? $this->session()->getOldInput($key, $default) : $default; + } + + /** + * Flash the input for the current request to the session. + * + * @return void + */ + public function flash() + { + $this->session()->flashInput($this->input()); + } + + /** + * Flash only some of the input to the session. + * + * @param array|mixed $keys + * @return void + */ + public function flashOnly($keys) + { + $this->session()->flashInput( + $this->only(is_array($keys) ? $keys : func_get_args()) + ); + } + + /** + * Flash only some of the input to the session. + * + * @param array|mixed $keys + * @return void + */ + public function flashExcept($keys) + { + $this->session()->flashInput( + $this->except(is_array($keys) ? $keys : func_get_args()) + ); + } + + /** + * Flush all of the old input from the session. + * + * @return void + */ + public function flush() + { + $this->session()->flashInput([]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithInput.php b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithInput.php new file mode 100644 index 00000000..12025eb0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithInput.php @@ -0,0 +1,414 @@ +retrieveItem('server', $key, $default); + } + + /** + * Determine if a header is set on the request. + * + * @param string $key + * @return bool + */ + public function hasHeader($key) + { + return ! is_null($this->header($key)); + } + + /** + * Retrieve a header from the request. + * + * @param string|null $key + * @param string|array|null $default + * @return string|array|null + */ + public function header($key = null, $default = null) + { + return $this->retrieveItem('headers', $key, $default); + } + + /** + * Get the bearer token from the request headers. + * + * @return string|null + */ + public function bearerToken() + { + $header = $this->header('Authorization', ''); + + if (Str::startsWith($header, 'Bearer ')) { + return Str::substr($header, 7); + } + } + + /** + * Determine if the request contains a given input item key. + * + * @param string|array $key + * @return bool + */ + public function exists($key) + { + return $this->has($key); + } + + /** + * Determine if the request contains a given input item key. + * + * @param string|array $key + * @return bool + */ + public function has($key) + { + $keys = is_array($key) ? $key : func_get_args(); + + $input = $this->all(); + + foreach ($keys as $value) { + if (! Arr::has($input, $value)) { + return false; + } + } + + return true; + } + + /** + * Determine if the request contains any of the given inputs. + * + * @param string|array $keys + * @return bool + */ + public function hasAny($keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + $input = $this->all(); + + return Arr::hasAny($input, $keys); + } + + /** + * Determine if the request contains a non-empty value for an input item. + * + * @param string|array $key + * @return bool + */ + public function filled($key) + { + $keys = is_array($key) ? $key : func_get_args(); + + foreach ($keys as $value) { + if ($this->isEmptyString($value)) { + return false; + } + } + + return true; + } + + /** + * Determine if the request contains a non-empty value for any of the given inputs. + * + * @param string|array $keys + * @return bool + */ + public function anyFilled($keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + foreach ($keys as $key) { + if ($this->filled($key)) { + return true; + } + } + + return false; + } + + /** + * Determine if the request is missing a given input item key. + * + * @param string|array $key + * @return bool + */ + public function missing($key) + { + $keys = is_array($key) ? $key : func_get_args(); + + return ! $this->has($keys); + } + + /** + * Determine if the given input key is an empty string for "has". + * + * @param string $key + * @return bool + */ + protected function isEmptyString($key) + { + $value = $this->input($key); + + return ! is_bool($value) && ! is_array($value) && trim((string) $value) === ''; + } + + /** + * Get the keys for all of the input and files. + * + * @return array + */ + public function keys() + { + return array_merge(array_keys($this->input()), $this->files->keys()); + } + + /** + * Get all of the input and files for the request. + * + * @param array|mixed|null $keys + * @return array + */ + public function all($keys = null) + { + $input = array_replace_recursive($this->input(), $this->allFiles()); + + if (! $keys) { + return $input; + } + + $results = []; + + foreach (is_array($keys) ? $keys : func_get_args() as $key) { + Arr::set($results, $key, Arr::get($input, $key)); + } + + return $results; + } + + /** + * Retrieve an input item from the request. + * + * @param string|null $key + * @param mixed $default + * @return mixed + */ + public function input($key = null, $default = null) + { + return data_get( + $this->getInputSource()->all() + $this->query->all(), $key, $default + ); + } + + /** + * Retrieve input as a boolean value. + * + * Returns true when value is "1", "true", "on", and "yes". Otherwise, returns false. + * + * @param string|null $key + * @param bool $default + * @return bool + */ + public function boolean($key = null, $default = false) + { + return filter_var($this->input($key, $default), FILTER_VALIDATE_BOOLEAN); + } + + /** + * Get a subset containing the provided keys with values from the input data. + * + * @param array|mixed $keys + * @return array + */ + public function only($keys) + { + $results = []; + + $input = $this->all(); + + $placeholder = new stdClass; + + foreach (is_array($keys) ? $keys : func_get_args() as $key) { + $value = data_get($input, $key, $placeholder); + + if ($value !== $placeholder) { + Arr::set($results, $key, $value); + } + } + + return $results; + } + + /** + * Get all of the input except for a specified array of items. + * + * @param array|mixed $keys + * @return array + */ + public function except($keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + $results = $this->all(); + + Arr::forget($results, $keys); + + return $results; + } + + /** + * Retrieve a query string item from the request. + * + * @param string|null $key + * @param string|array|null $default + * @return string|array|null + */ + public function query($key = null, $default = null) + { + return $this->retrieveItem('query', $key, $default); + } + + /** + * Retrieve a request payload item from the request. + * + * @param string|null $key + * @param string|array|null $default + * @return string|array|null + */ + public function post($key = null, $default = null) + { + return $this->retrieveItem('request', $key, $default); + } + + /** + * Determine if a cookie is set on the request. + * + * @param string $key + * @return bool + */ + public function hasCookie($key) + { + return ! is_null($this->cookie($key)); + } + + /** + * Retrieve a cookie from the request. + * + * @param string|null $key + * @param string|array|null $default + * @return string|array|null + */ + public function cookie($key = null, $default = null) + { + return $this->retrieveItem('cookies', $key, $default); + } + + /** + * Get an array of all of the files on the request. + * + * @return array + */ + public function allFiles() + { + $files = $this->files->all(); + + return $this->convertedFiles = $this->convertedFiles ?? $this->convertUploadedFiles($files); + } + + /** + * Convert the given array of Symfony UploadedFiles to custom Laravel UploadedFiles. + * + * @param array $files + * @return array + */ + protected function convertUploadedFiles(array $files) + { + return array_map(function ($file) { + if (is_null($file) || (is_array($file) && empty(array_filter($file)))) { + return $file; + } + + return is_array($file) + ? $this->convertUploadedFiles($file) + : UploadedFile::createFromBase($file); + }, $files); + } + + /** + * Determine if the uploaded data contains a file. + * + * @param string $key + * @return bool + */ + public function hasFile($key) + { + if (! is_array($files = $this->file($key))) { + $files = [$files]; + } + + foreach ($files as $file) { + if ($this->isValidFile($file)) { + return true; + } + } + + return false; + } + + /** + * Check that the given file is a valid file instance. + * + * @param mixed $file + * @return bool + */ + protected function isValidFile($file) + { + return $file instanceof SplFileInfo && $file->getPath() !== ''; + } + + /** + * Retrieve a file from the request. + * + * @param string|null $key + * @param mixed $default + * @return \Illuminate\Http\UploadedFile|\Illuminate\Http\UploadedFile[]|array|null + */ + public function file($key = null, $default = null) + { + return data_get($this->allFiles(), $key, $default); + } + + /** + * Retrieve a parameter item from a given source. + * + * @param string $source + * @param string $key + * @param string|array|null $default + * @return string|array|null + */ + protected function retrieveItem($source, $key, $default) + { + if (is_null($key)) { + return $this->$source->all(); + } + + return $this->$source->get($key, $default); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Exceptions/HttpResponseException.php b/vendor/laravel/framework/src/Illuminate/Http/Exceptions/HttpResponseException.php new file mode 100644 index 00000000..b27052f0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Exceptions/HttpResponseException.php @@ -0,0 +1,37 @@ +response = $response; + } + + /** + * Get the underlying response instance. + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function getResponse() + { + return $this->response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Exceptions/PostTooLargeException.php b/vendor/laravel/framework/src/Illuminate/Http/Exceptions/PostTooLargeException.php new file mode 100644 index 00000000..5c56e3bc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Exceptions/PostTooLargeException.php @@ -0,0 +1,23 @@ +getRealPath(); + } + + /** + * Get the file's extension. + * + * @return string + */ + public function extension() + { + return $this->guessExtension(); + } + + /** + * Get a filename for the file. + * + * @param string|null $path + * @return string + */ + public function hashName($path = null) + { + if ($path) { + $path = rtrim($path, '/').'/'; + } + + $hash = $this->hashName ?: $this->hashName = Str::random(40); + + if ($extension = $this->guessExtension()) { + $extension = '.'.$extension; + } + + return $path.$hash.$extension; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php b/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php new file mode 100755 index 00000000..9f87e6c3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php @@ -0,0 +1,121 @@ +encodingOptions = $options; + + parent::__construct($data, $status, $headers); + } + + /** + * Sets the JSONP callback. + * + * @param string|null $callback + * @return $this + */ + public function withCallback($callback = null) + { + return $this->setCallback($callback); + } + + /** + * Get the json_decoded data from the response. + * + * @param bool $assoc + * @param int $depth + * @return mixed + */ + public function getData($assoc = false, $depth = 512) + { + return json_decode($this->data, $assoc, $depth); + } + + /** + * {@inheritdoc} + */ + public function setData($data = []) + { + $this->original = $data; + + if ($data instanceof Jsonable) { + $this->data = $data->toJson($this->encodingOptions); + } elseif ($data instanceof JsonSerializable) { + $this->data = json_encode($data->jsonSerialize(), $this->encodingOptions); + } elseif ($data instanceof Arrayable) { + $this->data = json_encode($data->toArray(), $this->encodingOptions); + } else { + $this->data = json_encode($data, $this->encodingOptions); + } + + if (! $this->hasValidJson(json_last_error())) { + throw new InvalidArgumentException(json_last_error_msg()); + } + + return $this->update(); + } + + /** + * Determine if an error occurred during JSON encoding. + * + * @param int $jsonError + * @return bool + */ + protected function hasValidJson($jsonError) + { + if ($jsonError === JSON_ERROR_NONE) { + return true; + } + + return $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR) && + in_array($jsonError, [ + JSON_ERROR_RECURSION, + JSON_ERROR_INF_OR_NAN, + JSON_ERROR_UNSUPPORTED_TYPE, + ]); + } + + /** + * {@inheritdoc} + */ + public function setEncodingOptions($options) + { + $this->encodingOptions = (int) $options; + + return $this->setData($this->getData()); + } + + /** + * Determine if a JSON encoding option is set. + * + * @param int $option + * @return bool + */ + public function hasEncodingOption($option) + { + return (bool) ($this->encodingOptions & $option); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Http/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php b/vendor/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php new file mode 100644 index 00000000..2a93e21d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php @@ -0,0 +1,27 @@ +isNotModified($request); + } + + return $response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php b/vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php new file mode 100644 index 00000000..66edce44 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php @@ -0,0 +1,24 @@ +headers->set('X-Frame-Options', 'SAMEORIGIN', false); + + return $response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Middleware/SetCacheHeaders.php b/vendor/laravel/framework/src/Illuminate/Http/Middleware/SetCacheHeaders.php new file mode 100644 index 00000000..b6d964bc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Middleware/SetCacheHeaders.php @@ -0,0 +1,64 @@ +isMethodCacheable() || ! $response->getContent()) { + return $response; + } + + if (is_string($options)) { + $options = $this->parseOptions($options); + } + + if (isset($options['etag']) && $options['etag'] === true) { + $options['etag'] = md5($response->getContent()); + } + + if (isset($options['last_modified'])) { + if (is_numeric($options['last_modified'])) { + $options['last_modified'] = Carbon::createFromTimestamp($options['last_modified']); + } else { + $options['last_modified'] = Carbon::parse($options['last_modified']); + } + } + + $response->setCache($options); + $response->isNotModified($request); + + return $response; + } + + /** + * Parse the given header options. + * + * @param string $options + * @return array + */ + protected function parseOptions($options) + { + return collect(explode(';', $options))->mapWithKeys(function ($option) { + $data = explode('=', $option, 2); + + return [$data[0] => $data[1] ?? true]; + })->all(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustHosts.php b/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustHosts.php new file mode 100644 index 00000000..8b563151 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustHosts.php @@ -0,0 +1,73 @@ +app = $app; + } + + /** + * Get the host patterns that should be trusted. + * + * @return array + */ + abstract public function hosts(); + + /** + * Handle the incoming request. + * + * @param \Illuminate\Http\Request $request + * @param callable $next + * @return \Illuminate\Http\Response + */ + public function handle(Request $request, $next) + { + if ($this->shouldSpecifyTrustedHosts()) { + Request::setTrustedHosts(array_filter($this->hosts())); + } + + return $next($request); + } + + /** + * Determine if the application should specify trusted hosts. + * + * @return bool + */ + protected function shouldSpecifyTrustedHosts() + { + return config('app.env') !== 'local' && + ! $this->app->runningUnitTests(); + } + + /** + * Get a regular expression matching the application URL and all of its subdomains. + * + * @return string|null + */ + protected function allSubdomainsOfApplicationUrl() + { + if ($host = parse_url($this->app['config']->get('app.url'), PHP_URL_HOST)) { + return '^(.+\.)?'.preg_quote($host).'$'; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php b/vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php new file mode 100755 index 00000000..874dda49 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php @@ -0,0 +1,236 @@ + $value]; + + foreach ($key as $k => $v) { + $this->session->flash($k, $v); + } + + return $this; + } + + /** + * Add multiple cookies to the response. + * + * @param array $cookies + * @return $this + */ + public function withCookies(array $cookies) + { + foreach ($cookies as $cookie) { + $this->headers->setCookie($cookie); + } + + return $this; + } + + /** + * Flash an array of input to the session. + * + * @param array|null $input + * @return $this + */ + public function withInput(array $input = null) + { + $this->session->flashInput($this->removeFilesFromInput( + ! is_null($input) ? $input : $this->request->input() + )); + + return $this; + } + + /** + * Remove all uploaded files form the given input array. + * + * @param array $input + * @return array + */ + protected function removeFilesFromInput(array $input) + { + foreach ($input as $key => $value) { + if (is_array($value)) { + $input[$key] = $this->removeFilesFromInput($value); + } + + if ($value instanceof SymfonyUploadedFile) { + unset($input[$key]); + } + } + + return $input; + } + + /** + * Flash an array of input to the session. + * + * @return $this + */ + public function onlyInput() + { + return $this->withInput($this->request->only(func_get_args())); + } + + /** + * Flash an array of input to the session. + * + * @return $this + */ + public function exceptInput() + { + return $this->withInput($this->request->except(func_get_args())); + } + + /** + * Flash a container of errors to the session. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider + * @param string $key + * @return $this + */ + public function withErrors($provider, $key = 'default') + { + $value = $this->parseErrors($provider); + + $errors = $this->session->get('errors', new ViewErrorBag); + + if (! $errors instanceof ViewErrorBag) { + $errors = new ViewErrorBag; + } + + $this->session->flash( + 'errors', $errors->put($key, $value) + ); + + return $this; + } + + /** + * Parse the given errors into an appropriate value. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider + * @return \Illuminate\Support\MessageBag + */ + protected function parseErrors($provider) + { + if ($provider instanceof MessageProvider) { + return $provider->getMessageBag(); + } + + return new MessageBag((array) $provider); + } + + /** + * Get the original response content. + * + * @return null + */ + public function getOriginalContent() + { + // + } + + /** + * Get the request instance. + * + * @return \Illuminate\Http\Request|null + */ + public function getRequest() + { + return $this->request; + } + + /** + * Set the request instance. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + public function setRequest(Request $request) + { + $this->request = $request; + } + + /** + * Get the session store instance. + * + * @return \Illuminate\Session\Store|null + */ + public function getSession() + { + return $this->session; + } + + /** + * Set the session store instance. + * + * @param \Illuminate\Session\Store $session + * @return void + */ + public function setSession(SessionStore $session) + { + $this->session = $session; + } + + /** + * Dynamically bind flash data in the session. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + if (Str::startsWith($method, 'with')) { + return $this->with(Str::snake(substr($method, 4)), $parameters[0]); + } + + static::throwBadMethodCallException($method); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Request.php b/vendor/laravel/framework/src/Illuminate/Http/Request.php new file mode 100644 index 00000000..a4018c5c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Request.php @@ -0,0 +1,706 @@ +getMethod(); + } + + /** + * Get the root URL for the application. + * + * @return string + */ + public function root() + { + return rtrim($this->getSchemeAndHttpHost().$this->getBaseUrl(), '/'); + } + + /** + * Get the URL (no query string) for the request. + * + * @return string + */ + public function url() + { + return rtrim(preg_replace('/\?.*/', '', $this->getUri()), '/'); + } + + /** + * Get the full URL for the request. + * + * @return string + */ + public function fullUrl() + { + $query = $this->getQueryString(); + + $question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?'; + + return $query ? $this->url().$question.$query : $this->url(); + } + + /** + * Get the full URL for the request with the added query string parameters. + * + * @param array $query + * @return string + */ + public function fullUrlWithQuery(array $query) + { + $question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?'; + + return count($this->query()) > 0 + ? $this->url().$question.Arr::query(array_merge($this->query(), $query)) + : $this->fullUrl().$question.Arr::query($query); + } + + /** + * Get the current path info for the request. + * + * @return string + */ + public function path() + { + $pattern = trim($this->getPathInfo(), '/'); + + return $pattern == '' ? '/' : $pattern; + } + + /** + * Get the current decoded path info for the request. + * + * @return string + */ + public function decodedPath() + { + return rawurldecode($this->path()); + } + + /** + * Get a segment from the URI (1 based index). + * + * @param int $index + * @param string|null $default + * @return string|null + */ + public function segment($index, $default = null) + { + return Arr::get($this->segments(), $index - 1, $default); + } + + /** + * Get all of the segments for the request path. + * + * @return array + */ + public function segments() + { + $segments = explode('/', $this->decodedPath()); + + return array_values(array_filter($segments, function ($value) { + return $value !== ''; + })); + } + + /** + * Determine if the current request URI matches a pattern. + * + * @param mixed ...$patterns + * @return bool + */ + public function is(...$patterns) + { + $path = $this->decodedPath(); + + foreach ($patterns as $pattern) { + if (Str::is($pattern, $path)) { + return true; + } + } + + return false; + } + + /** + * Determine if the route name matches a given pattern. + * + * @param mixed ...$patterns + * @return bool + */ + public function routeIs(...$patterns) + { + return $this->route() && $this->route()->named(...$patterns); + } + + /** + * Determine if the current request URL and query string matches a pattern. + * + * @param mixed ...$patterns + * @return bool + */ + public function fullUrlIs(...$patterns) + { + $url = $this->fullUrl(); + + foreach ($patterns as $pattern) { + if (Str::is($pattern, $url)) { + return true; + } + } + + return false; + } + + /** + * Determine if the request is the result of an AJAX call. + * + * @return bool + */ + public function ajax() + { + return $this->isXmlHttpRequest(); + } + + /** + * Determine if the request is the result of an PJAX call. + * + * @return bool + */ + public function pjax() + { + return $this->headers->get('X-PJAX') == true; + } + + /** + * Determine if the request is the result of an prefetch call. + * + * @return bool + */ + public function prefetch() + { + return strcasecmp($this->server->get('HTTP_X_MOZ'), 'prefetch') === 0 || + strcasecmp($this->headers->get('Purpose'), 'prefetch') === 0; + } + + /** + * Determine if the request is over HTTPS. + * + * @return bool + */ + public function secure() + { + return $this->isSecure(); + } + + /** + * Get the client IP address. + * + * @return string|null + */ + public function ip() + { + return $this->getClientIp(); + } + + /** + * Get the client IP addresses. + * + * @return array + */ + public function ips() + { + return $this->getClientIps(); + } + + /** + * Get the client user agent. + * + * @return string|null + */ + public function userAgent() + { + return $this->headers->get('User-Agent'); + } + + /** + * Merge new input into the current request's input array. + * + * @param array $input + * @return $this + */ + public function merge(array $input) + { + $this->getInputSource()->add($input); + + return $this; + } + + /** + * Replace the input for the current request. + * + * @param array $input + * @return $this + */ + public function replace(array $input) + { + $this->getInputSource()->replace($input); + + return $this; + } + + /** + * This method belongs to Symfony HttpFoundation and is not usually needed when using Laravel. + * + * Instead, you may use the "input" method. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + return parent::get($key, $default); + } + + /** + * Get the JSON payload for the request. + * + * @param string|null $key + * @param mixed $default + * @return \Symfony\Component\HttpFoundation\ParameterBag|mixed + */ + public function json($key = null, $default = null) + { + if (! isset($this->json)) { + $this->json = new ParameterBag((array) json_decode($this->getContent(), true)); + } + + if (is_null($key)) { + return $this->json; + } + + return data_get($this->json->all(), $key, $default); + } + + /** + * Get the input source for the request. + * + * @return \Symfony\Component\HttpFoundation\ParameterBag + */ + protected function getInputSource() + { + if ($this->isJson()) { + return $this->json(); + } + + return in_array($this->getRealMethod(), ['GET', 'HEAD']) ? $this->query : $this->request; + } + + /** + * Create a new request instance from the given Laravel request. + * + * @param \Illuminate\Http\Request $from + * @param \Illuminate\Http\Request|null $to + * @return static + */ + public static function createFrom(self $from, $to = null) + { + $request = $to ?: new static; + + $files = $from->files->all(); + + $files = is_array($files) ? array_filter($files) : $files; + + $request->initialize( + $from->query->all(), + $from->request->all(), + $from->attributes->all(), + $from->cookies->all(), + $files, + $from->server->all(), + $from->getContent() + ); + + $request->headers->replace($from->headers->all()); + + $request->setJson($from->json()); + + if ($session = $from->getSession()) { + $request->setLaravelSession($session); + } + + $request->setUserResolver($from->getUserResolver()); + + $request->setRouteResolver($from->getRouteResolver()); + + return $request; + } + + /** + * Create an Illuminate request from a Symfony instance. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return static + */ + public static function createFromBase(SymfonyRequest $request) + { + if ($request instanceof static) { + return $request; + } + + $newRequest = (new static)->duplicate( + $request->query->all(), $request->request->all(), $request->attributes->all(), + $request->cookies->all(), $request->files->all(), $request->server->all() + ); + + $newRequest->headers->replace($request->headers->all()); + + $newRequest->content = $request->content; + + $newRequest->request = $newRequest->getInputSource(); + + return $newRequest; + } + + /** + * {@inheritdoc} + */ + public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) + { + return parent::duplicate($query, $request, $attributes, $cookies, $this->filterFiles($files), $server); + } + + /** + * Filter the given array of files, removing any empty values. + * + * @param mixed $files + * @return mixed + */ + protected function filterFiles($files) + { + if (! $files) { + return; + } + + foreach ($files as $key => $file) { + if (is_array($file)) { + $files[$key] = $this->filterFiles($files[$key]); + } + + if (empty($files[$key])) { + unset($files[$key]); + } + } + + return $files; + } + + /** + * Get the session associated with the request. + * + * @return \Illuminate\Session\Store + * + * @throws \RuntimeException + */ + public function session() + { + if (! $this->hasSession()) { + throw new RuntimeException('Session store not set on request.'); + } + + return $this->session; + } + + /** + * Get the session associated with the request. + * + * @return \Illuminate\Session\Store|null + */ + public function getSession() + { + return $this->session; + } + + /** + * Set the session instance on the request. + * + * @param \Illuminate\Contracts\Session\Session $session + * @return void + */ + public function setLaravelSession($session) + { + $this->session = $session; + } + + /** + * Get the user making the request. + * + * @param string|null $guard + * @return mixed + */ + public function user($guard = null) + { + return call_user_func($this->getUserResolver(), $guard); + } + + /** + * Get the route handling the request. + * + * @param string|null $param + * @param mixed $default + * @return \Illuminate\Routing\Route|object|string|null + */ + public function route($param = null, $default = null) + { + $route = call_user_func($this->getRouteResolver()); + + if (is_null($route) || is_null($param)) { + return $route; + } + + return $route->parameter($param, $default); + } + + /** + * Get a unique fingerprint for the request / route / IP address. + * + * @return string + * + * @throws \RuntimeException + */ + public function fingerprint() + { + if (! $route = $this->route()) { + throw new RuntimeException('Unable to generate fingerprint. Route unavailable.'); + } + + return sha1(implode('|', array_merge( + $route->methods(), + [$route->getDomain(), $route->uri(), $this->ip()] + ))); + } + + /** + * Set the JSON payload for the request. + * + * @param \Symfony\Component\HttpFoundation\ParameterBag $json + * @return $this + */ + public function setJson($json) + { + $this->json = $json; + + return $this; + } + + /** + * Get the user resolver callback. + * + * @return \Closure + */ + public function getUserResolver() + { + return $this->userResolver ?: function () { + // + }; + } + + /** + * Set the user resolver callback. + * + * @param \Closure $callback + * @return $this + */ + public function setUserResolver(Closure $callback) + { + $this->userResolver = $callback; + + return $this; + } + + /** + * Get the route resolver callback. + * + * @return \Closure + */ + public function getRouteResolver() + { + return $this->routeResolver ?: function () { + // + }; + } + + /** + * Set the route resolver callback. + * + * @param \Closure $callback + * @return $this + */ + public function setRouteResolver(Closure $callback) + { + $this->routeResolver = $callback; + + return $this; + } + + /** + * Get all of the input and files for the request. + * + * @return array + */ + public function toArray() + { + return $this->all(); + } + + /** + * Determine if the given offset exists. + * + * @param string $offset + * @return bool + */ + public function offsetExists($offset) + { + return Arr::has( + $this->all() + $this->route()->parameters(), + $offset + ); + } + + /** + * Get the value at the given offset. + * + * @param string $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->__get($offset); + } + + /** + * Set the value at the given offset. + * + * @param string $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value) + { + $this->getInputSource()->set($offset, $value); + } + + /** + * Remove the value at the given offset. + * + * @param string $offset + * @return void + */ + public function offsetUnset($offset) + { + $this->getInputSource()->remove($offset); + } + + /** + * Check if an input element is set on the request. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return ! is_null($this->__get($key)); + } + + /** + * Get an input element from the request. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return Arr::get($this->all(), $key, function () use ($key) { + return $this->route($key); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/CollectsResources.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/CollectsResources.php new file mode 100644 index 00000000..a5531f7a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/CollectsResources.php @@ -0,0 +1,64 @@ +collects(); + + $this->collection = $collects && ! $resource->first() instanceof $collects + ? $resource->mapInto($collects) + : $resource->toBase(); + + return $resource instanceof AbstractPaginator + ? $resource->setCollection($this->collection) + : $this->collection; + } + + /** + * Get the resource that this resource collects. + * + * @return string|null + */ + protected function collects() + { + if ($this->collects) { + return $this->collects; + } + + if (Str::endsWith(class_basename($this), 'Collection') && + class_exists($class = Str::replaceLast('Collection', '', get_class($this)))) { + return $class; + } + } + + /** + * Get an iterator for the resource collection. + * + * @return \ArrayIterator + */ + public function getIterator() + { + return $this->collection->getIterator(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php new file mode 100644 index 00000000..0f6e1889 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php @@ -0,0 +1,226 @@ + $value) { + $index++; + + if (is_array($value)) { + $data[$key] = $this->filter($value); + + continue; + } + + if (is_numeric($key) && $value instanceof MergeValue) { + return $this->mergeData( + $data, $index, $this->filter($value->data), + array_values($value->data) === $value->data + ); + } + + if ($value instanceof self && is_null($value->resource)) { + $data[$key] = null; + } + } + + return $this->removeMissingValues($data); + } + + /** + * Merge the given data in at the given index. + * + * @param array $data + * @param int $index + * @param array $merge + * @param bool $numericKeys + * @return array + */ + protected function mergeData($data, $index, $merge, $numericKeys) + { + if ($numericKeys) { + return $this->removeMissingValues(array_merge( + array_merge(array_slice($data, 0, $index, true), $merge), + $this->filter(array_values(array_slice($data, $index + 1, null, true))) + )); + } + + return $this->removeMissingValues(array_slice($data, 0, $index, true) + + $merge + + $this->filter(array_slice($data, $index + 1, null, true))); + } + + /** + * Remove the missing values from the filtered data. + * + * @param array $data + * @return array + */ + protected function removeMissingValues($data) + { + $numericKeys = true; + + foreach ($data as $key => $value) { + if (($value instanceof PotentiallyMissing && $value->isMissing()) || + ($value instanceof self && + $value->resource instanceof PotentiallyMissing && + $value->isMissing())) { + unset($data[$key]); + } else { + $numericKeys = $numericKeys && is_numeric($key); + } + } + + if (property_exists($this, 'preserveKeys') && $this->preserveKeys === true) { + return $data; + } + + return $numericKeys ? array_values($data) : $data; + } + + /** + * Retrieve a value based on a given condition. + * + * @param bool $condition + * @param mixed $value + * @param mixed $default + * @return \Illuminate\Http\Resources\MissingValue|mixed + */ + protected function when($condition, $value, $default = null) + { + if ($condition) { + return value($value); + } + + return func_num_args() === 3 ? value($default) : new MissingValue; + } + + /** + * Merge a value into the array. + * + * @param mixed $value + * @return \Illuminate\Http\Resources\MergeValue|mixed + */ + protected function merge($value) + { + return $this->mergeWhen(true, $value); + } + + /** + * Merge a value based on a given condition. + * + * @param bool $condition + * @param mixed $value + * @return \Illuminate\Http\Resources\MergeValue|mixed + */ + protected function mergeWhen($condition, $value) + { + return $condition ? new MergeValue(value($value)) : new MissingValue; + } + + /** + * Merge the given attributes. + * + * @param array $attributes + * @return \Illuminate\Http\Resources\MergeValue + */ + protected function attributes($attributes) + { + return new MergeValue( + Arr::only($this->resource->toArray(), $attributes) + ); + } + + /** + * Retrieve a relationship if it has been loaded. + * + * @param string $relationship + * @param mixed $value + * @param mixed $default + * @return \Illuminate\Http\Resources\MissingValue|mixed + */ + protected function whenLoaded($relationship, $value = null, $default = null) + { + if (func_num_args() < 3) { + $default = new MissingValue; + } + + if (! $this->resource->relationLoaded($relationship)) { + return value($default); + } + + if (func_num_args() === 1) { + return $this->resource->{$relationship}; + } + + if ($this->resource->{$relationship} === null) { + return; + } + + return value($value); + } + + /** + * Execute a callback if the given pivot table has been loaded. + * + * @param string $table + * @param mixed $value + * @param mixed $default + * @return \Illuminate\Http\Resources\MissingValue|mixed + */ + protected function whenPivotLoaded($table, $value, $default = null) + { + return $this->whenPivotLoadedAs('pivot', ...func_get_args()); + } + + /** + * Execute a callback if the given pivot table with a custom accessor has been loaded. + * + * @param string $accessor + * @param string $table + * @param mixed $value + * @param mixed $default + * @return \Illuminate\Http\Resources\MissingValue|mixed + */ + protected function whenPivotLoadedAs($accessor, $table, $value, $default = null) + { + if (func_num_args() === 3) { + $default = new MissingValue; + } + + return $this->when( + $this->resource->$accessor && + ($this->resource->$accessor instanceof $table || + $this->resource->$accessor->getTable() === $table), + ...[$value, $default] + ); + } + + /** + * Transform the given value if it is present. + * + * @param mixed $value + * @param callable $callback + * @param mixed $default + * @return mixed + */ + protected function transform($value, callable $callback, $default = null) + { + return transform( + $value, $callback, func_num_args() === 3 ? $default : new MissingValue + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/DelegatesToResource.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/DelegatesToResource.php new file mode 100644 index 00000000..036a1431 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/DelegatesToResource.php @@ -0,0 +1,134 @@ +resource->getRouteKey(); + } + + /** + * Get the route key for the resource. + * + * @return string + */ + public function getRouteKeyName() + { + return $this->resource->getRouteKeyName(); + } + + /** + * Retrieve the model for a bound value. + * + * @param mixed $value + * @return void + * + * @throws \Exception + */ + public function resolveRouteBinding($value) + { + throw new Exception('Resources may not be implicitly resolved from route bindings.'); + } + + /** + * Determine if the given attribute exists. + * + * @param mixed $offset + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->resource[$offset]); + } + + /** + * Get the value for a given offset. + * + * @param mixed $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->resource[$offset]; + } + + /** + * Set the value for a given offset. + * + * @param mixed $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value) + { + $this->resource[$offset] = $value; + } + + /** + * Unset the value for a given offset. + * + * @param mixed $offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->resource[$offset]); + } + + /** + * Determine if an attribute exists on the resource. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return isset($this->resource->{$key}); + } + + /** + * Unset an attribute on the resource. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + unset($this->resource->{$key}); + } + + /** + * Dynamically get properties from the underlying resource. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->resource->{$key}; + } + + /** + * Dynamically pass method calls to the underlying resource. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->forwardCallTo($this->resource, $method, $parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/AnonymousResourceCollection.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/AnonymousResourceCollection.php new file mode 100644 index 00000000..a5831364 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/AnonymousResourceCollection.php @@ -0,0 +1,27 @@ +collects = $collects; + + parent::__construct($resource); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/JsonResource.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/JsonResource.php new file mode 100644 index 00000000..42d8fb2a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/JsonResource.php @@ -0,0 +1,213 @@ +resource = $resource; + } + + /** + * Create a new resource instance. + * + * @param mixed ...$parameters + * @return static + */ + public static function make(...$parameters) + { + return new static(...$parameters); + } + + /** + * Create new anonymous resource collection. + * + * @param mixed $resource + * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection + */ + public static function collection($resource) + { + return tap(new AnonymousResourceCollection($resource, static::class), function ($collection) { + if (property_exists(static::class, 'preserveKeys')) { + $collection->preserveKeys = (new static([]))->preserveKeys === true; + } + }); + } + + /** + * Resolve the resource to an array. + * + * @param \Illuminate\Http\Request|null $request + * @return array + */ + public function resolve($request = null) + { + $data = $this->toArray( + $request = $request ?: Container::getInstance()->make('request') + ); + + if ($data instanceof Arrayable) { + $data = $data->toArray(); + } elseif ($data instanceof JsonSerializable) { + $data = $data->jsonSerialize(); + } + + return $this->filter((array) $data); + } + + /** + * Transform the resource into an array. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function toArray($request) + { + if (is_null($this->resource)) { + return []; + } + + return is_array($this->resource) + ? $this->resource + : $this->resource->toArray(); + } + + /** + * Get any additional data that should be returned with the resource array. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function with($request) + { + return $this->with; + } + + /** + * Add additional meta data to the resource response. + * + * @param array $data + * @return $this + */ + public function additional(array $data) + { + $this->additional = $data; + + return $this; + } + + /** + * Customize the response for a request. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\JsonResponse $response + * @return void + */ + public function withResponse($request, $response) + { + // + } + + /** + * Set the string that should wrap the outer-most resource array. + * + * @param string $value + * @return void + */ + public static function wrap($value) + { + static::$wrap = $value; + } + + /** + * Disable wrapping of the outer-most resource array. + * + * @return void + */ + public static function withoutWrapping() + { + static::$wrap = null; + } + + /** + * Transform the resource into an HTTP response. + * + * @param \Illuminate\Http\Request|null $request + * @return \Illuminate\Http\JsonResponse + */ + public function response($request = null) + { + return $this->toResponse( + $request ?: Container::getInstance()->make('request') + ); + } + + /** + * Create an HTTP response that represents the object. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\JsonResponse + */ + public function toResponse($request) + { + return (new ResourceResponse($this))->toResponse($request); + } + + /** + * Prepare the resource for JSON serialization. + * + * @return array + */ + public function jsonSerialize() + { + return $this->resolve(Container::getInstance()->make('request')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php new file mode 100644 index 00000000..b99ea962 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php @@ -0,0 +1,84 @@ +json( + $this->wrap( + $this->resource->resolve($request), + array_merge_recursive( + $this->paginationInformation($request), + $this->resource->with($request), + $this->resource->additional + ) + ), + $this->calculateStatus() + ), function ($response) use ($request) { + $response->original = $this->resource->resource->map(function ($item) { + return $item->resource; + }); + + $this->resource->withResponse($request, $response); + }); + } + + /** + * Add the pagination information to the response. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function paginationInformation($request) + { + $paginated = $this->resource->resource->toArray(); + + return [ + 'links' => $this->paginationLinks($paginated), + 'meta' => $this->meta($paginated), + ]; + } + + /** + * Get the pagination links for the response. + * + * @param array $paginated + * @return array + */ + protected function paginationLinks($paginated) + { + return [ + 'first' => $paginated['first_page_url'] ?? null, + 'last' => $paginated['last_page_url'] ?? null, + 'prev' => $paginated['prev_page_url'] ?? null, + 'next' => $paginated['next_page_url'] ?? null, + ]; + } + + /** + * Gather the meta data for the response. + * + * @param array $paginated + * @return array + */ + protected function meta($paginated) + { + return Arr::except($paginated, [ + 'data', + 'first_page_url', + 'last_page_url', + 'prev_page_url', + 'next_page_url', + ]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/Resource.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/Resource.php new file mode 100644 index 00000000..49f67441 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/Resource.php @@ -0,0 +1,8 @@ +resource = $this->collectResource($resource); + } + + /** + * Indicate that all current query parameters should be appended to pagination links. + * + * @return $this + */ + public function preserveQuery() + { + $this->preserveAllQueryParameters = true; + + return $this; + } + + /** + * Specify the query string parameters that should be present on pagination links. + * + * @param array $query + * @return $this + */ + public function withQuery(array $query) + { + $this->preserveAllQueryParameters = false; + + $this->queryParameters = $query; + + return $this; + } + + /** + * Return the count of items in the resource collection. + * + * @return int + */ + public function count() + { + return $this->collection->count(); + } + + /** + * Transform the resource into a JSON array. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function toArray($request) + { + return $this->collection->map->toArray($request)->all(); + } + + /** + * Create an HTTP response that represents the object. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\JsonResponse + */ + public function toResponse($request) + { + if ($this->resource instanceof AbstractPaginator) { + return $this->preparePaginatedResponse($request); + } + + return parent::toResponse($request); + } + + /** + * Create a paginate-aware HTTP response. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\JsonResponse + */ + protected function preparePaginatedResponse($request) + { + if ($this->preserveAllQueryParameters) { + $this->resource->appends($request->query()); + } elseif (! is_null($this->queryParameters)) { + $this->resource->appends($this->queryParameters); + } + + return (new PaginatedResourceResponse($this))->toResponse($request); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/ResourceResponse.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/ResourceResponse.php new file mode 100644 index 00000000..2e9d326d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/ResourceResponse.php @@ -0,0 +1,120 @@ +resource = $resource; + } + + /** + * Create an HTTP response that represents the object. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\JsonResponse + */ + public function toResponse($request) + { + return tap(response()->json( + $this->wrap( + $this->resource->resolve($request), + $this->resource->with($request), + $this->resource->additional + ), + $this->calculateStatus() + ), function ($response) use ($request) { + $response->original = $this->resource->resource; + + $this->resource->withResponse($request, $response); + }); + } + + /** + * Wrap the given data if necessary. + * + * @param array $data + * @param array $with + * @param array $additional + * @return array + */ + protected function wrap($data, $with = [], $additional = []) + { + if ($data instanceof Collection) { + $data = $data->all(); + } + + if ($this->haveDefaultWrapperAndDataIsUnwrapped($data)) { + $data = [$this->wrapper() => $data]; + } elseif ($this->haveAdditionalInformationAndDataIsUnwrapped($data, $with, $additional)) { + $data = [($this->wrapper() ?? 'data') => $data]; + } + + return array_merge_recursive($data, $with, $additional); + } + + /** + * Determine if we have a default wrapper and the given data is unwrapped. + * + * @param array $data + * @return bool + */ + protected function haveDefaultWrapperAndDataIsUnwrapped($data) + { + return $this->wrapper() && ! array_key_exists($this->wrapper(), $data); + } + + /** + * Determine if "with" data has been added and our data is unwrapped. + * + * @param array $data + * @param array $with + * @param array $additional + * @return bool + */ + protected function haveAdditionalInformationAndDataIsUnwrapped($data, $with, $additional) + { + return (! empty($with) || ! empty($additional)) && + (! $this->wrapper() || + ! array_key_exists($this->wrapper(), $data)); + } + + /** + * Get the default data wrapper for the resource. + * + * @return string + */ + protected function wrapper() + { + return get_class($this->resource)::$wrap; + } + + /** + * Calculate the appropriate status code for the response. + * + * @return int + */ + protected function calculateStatus() + { + return $this->resource->resource instanceof Model && + $this->resource->resource->wasRecentlyCreated ? 201 : 200; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/MergeValue.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/MergeValue.php new file mode 100644 index 00000000..ee557e8f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/MergeValue.php @@ -0,0 +1,33 @@ +data = $data->all(); + } elseif ($data instanceof JsonSerializable) { + $this->data = $data->jsonSerialize(); + } else { + $this->data = $data; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/MissingValue.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/MissingValue.php new file mode 100644 index 00000000..d0d8dfa7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/MissingValue.php @@ -0,0 +1,16 @@ +original = $content; + + // If the content is "JSONable" we will set the appropriate header and convert + // the content to JSON. This is useful when returning something like models + // from routes that will be automatically transformed to their JSON form. + if ($this->shouldBeJson($content)) { + $this->header('Content-Type', 'application/json'); + + $content = $this->morphToJson($content); + } + + // If this content implements the "Renderable" interface then we will call the + // render method on the object so we will avoid any "__toString" exceptions + // that might be thrown and have their errors obscured by PHP's handling. + elseif ($content instanceof Renderable) { + $content = $content->render(); + } + + parent::setContent($content); + + return $this; + } + + /** + * Determine if the given content should be turned into JSON. + * + * @param mixed $content + * @return bool + */ + protected function shouldBeJson($content) + { + return $content instanceof Arrayable || + $content instanceof Jsonable || + $content instanceof ArrayObject || + $content instanceof JsonSerializable || + is_array($content); + } + + /** + * Morph the given content into JSON. + * + * @param mixed $content + * @return string + */ + protected function morphToJson($content) + { + if ($content instanceof Jsonable) { + return $content->toJson(); + } elseif ($content instanceof Arrayable) { + return json_encode($content->toArray()); + } + + return json_encode($content); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php b/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php new file mode 100644 index 00000000..0858b40e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php @@ -0,0 +1,153 @@ +getStatusCode(); + } + + /** + * Get the content of the response. + * + * @return string + */ + public function content() + { + return $this->getContent(); + } + + /** + * Get the original response content. + * + * @return mixed + */ + public function getOriginalContent() + { + $original = $this->original; + + return $original instanceof self ? $original->{__FUNCTION__}() : $original; + } + + /** + * Set a header on the Response. + * + * @param string $key + * @param array|string $values + * @param bool $replace + * @return $this + */ + public function header($key, $values, $replace = true) + { + $this->headers->set($key, $values, $replace); + + return $this; + } + + /** + * Add an array of headers to the response. + * + * @param \Symfony\Component\HttpFoundation\HeaderBag|array $headers + * @return $this + */ + public function withHeaders($headers) + { + if ($headers instanceof HeaderBag) { + $headers = $headers->all(); + } + + foreach ($headers as $key => $value) { + $this->headers->set($key, $value); + } + + return $this; + } + + /** + * Add a cookie to the response. + * + * @param \Symfony\Component\HttpFoundation\Cookie|mixed $cookie + * @return $this + */ + public function cookie($cookie) + { + return $this->withCookie(...func_get_args()); + } + + /** + * Add a cookie to the response. + * + * @param \Symfony\Component\HttpFoundation\Cookie|mixed $cookie + * @return $this + */ + public function withCookie($cookie) + { + if (is_string($cookie) && function_exists('cookie')) { + $cookie = cookie(...func_get_args()); + } + + $this->headers->setCookie($cookie); + + return $this; + } + + /** + * Get the callback of the response. + * + * @return string|null + */ + public function getCallback() + { + return $this->callback ?? null; + } + + /** + * Set the exception to attach to the response. + * + * @param \Exception $e + * @return $this + */ + public function withException(Exception $e) + { + $this->exception = $e; + + return $this; + } + + /** + * Throws the response in a HttpResponseException instance. + * + * @return void + * + * @throws \Illuminate\Http\Exceptions\HttpResponseException + */ + public function throwResponse() + { + throw new HttpResponseException($this); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Testing/File.php b/vendor/laravel/framework/src/Illuminate/Http/Testing/File.php new file mode 100644 index 00000000..c1528268 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Testing/File.php @@ -0,0 +1,147 @@ +name = $name; + $this->tempFile = $tempFile; + + parent::__construct( + $this->tempFilePath(), $name, $this->getMimeType(), + null, true + ); + } + + /** + * Create a new fake file. + * + * @param string $name + * @param string|int $kilobytes + * @return \Illuminate\Http\Testing\File + */ + public static function create($name, $kilobytes = 0) + { + return (new FileFactory)->create($name, $kilobytes); + } + + /** + * Create a new fake file with content. + * + * @param string $name + * @param string $content + * @return \Illuminate\Http\Testing\File + */ + public static function createWithContent($name, $content) + { + return (new FileFactory)->createWithContent($name, $content); + } + + /** + * Create a new fake image. + * + * @param string $name + * @param int $width + * @param int $height + * @return \Illuminate\Http\Testing\File + */ + public static function image($name, $width = 10, $height = 10) + { + return (new FileFactory)->image($name, $width, $height); + } + + /** + * Set the "size" of the file in kilobytes. + * + * @param int $kilobytes + * @return $this + */ + public function size($kilobytes) + { + $this->sizeToReport = $kilobytes * 1024; + + return $this; + } + + /** + * Get the size of the file. + * + * @return int + */ + public function getSize() + { + return $this->sizeToReport ?: parent::getSize(); + } + + /** + * Set the "MIME type" for the file. + * + * @param string $mimeType + * @return $this + */ + public function mimeType($mimeType) + { + $this->mimeTypeToReport = $mimeType; + + return $this; + } + + /** + * Get the MIME type of the file. + * + * @return string + */ + public function getMimeType() + { + return $this->mimeTypeToReport ?: MimeType::from($this->name); + } + + /** + * Get the path to the temporary file. + * + * @return string + */ + protected function tempFilePath() + { + return stream_get_meta_data($this->tempFile)['uri']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Testing/FileFactory.php b/vendor/laravel/framework/src/Illuminate/Http/Testing/FileFactory.php new file mode 100644 index 00000000..5b729ee1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Testing/FileFactory.php @@ -0,0 +1,89 @@ +createWithContent($name, $kilobytes); + } + + return tap(new File($name, tmpfile()), function ($file) use ($kilobytes, $mimeType) { + $file->sizeToReport = $kilobytes * 1024; + $file->mimeTypeToReport = $mimeType; + }); + } + + /** + * Create a new fake file with content. + * + * @param string $name + * @param string $content + * @return \Illuminate\Http\Testing\File + */ + public function createWithContent($name, $content) + { + $tmpfile = tmpfile(); + + fwrite($tmpfile, $content); + + return tap(new File($name, $tmpfile), function ($file) use ($tmpfile) { + $file->sizeToReport = fstat($tmpfile)['size']; + }); + } + + /** + * Create a new fake image. + * + * @param string $name + * @param int $width + * @param int $height + * @return \Illuminate\Http\Testing\File + */ + public function image($name, $width = 10, $height = 10) + { + return new File($name, $this->generateImage( + $width, $height, Str::endsWith(Str::lower($name), ['.jpg', '.jpeg']) ? 'jpeg' : 'png' + )); + } + + /** + * Generate a dummy image of the given width and height. + * + * @param int $width + * @param int $height + * @param string $type + * @return resource + */ + protected function generateImage($width, $height, $type) + { + return tap(tmpfile(), function ($temp) use ($width, $height, $type) { + ob_start(); + + $image = imagecreatetruecolor($width, $height); + + switch ($type) { + case 'jpeg': + imagejpeg($image); + break; + case 'png': + imagepng($image); + break; + } + + fwrite($temp, ob_get_clean()); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Testing/MimeType.php b/vendor/laravel/framework/src/Illuminate/Http/Testing/MimeType.php new file mode 100644 index 00000000..af1fc602 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Testing/MimeType.php @@ -0,0 +1,827 @@ + 'application/andrew-inset', + 'aw' => 'application/applixware', + 'atom' => 'application/atom+xml', + 'atomcat' => 'application/atomcat+xml', + 'atomsvc' => 'application/atomsvc+xml', + 'ccxml' => 'application/ccxml+xml', + 'cdmia' => 'application/cdmi-capability', + 'cdmic' => 'application/cdmi-container', + 'cdmid' => 'application/cdmi-domain', + 'cdmio' => 'application/cdmi-object', + 'cdmiq' => 'application/cdmi-queue', + 'cu' => 'application/cu-seeme', + 'davmount' => 'application/davmount+xml', + 'dbk' => 'application/docbook+xml', + 'dssc' => 'application/dssc+der', + 'xdssc' => 'application/dssc+xml', + 'ecma' => 'application/ecmascript', + 'emma' => 'application/emma+xml', + 'epub' => 'application/epub+zip', + 'exi' => 'application/exi', + 'pfr' => 'application/font-tdpfr', + 'gml' => 'application/gml+xml', + 'gpx' => 'application/gpx+xml', + 'gxf' => 'application/gxf', + 'stk' => 'application/hyperstudio', + 'ink' => 'application/inkml+xml', + 'ipfix' => 'application/ipfix', + 'jar' => 'application/java-archive', + 'ser' => 'application/java-serialized-object', + 'class' => 'application/java-vm', + 'js' => 'application/javascript', + 'json' => 'application/json', + 'jsonml' => 'application/jsonml+json', + 'lostxml' => 'application/lost+xml', + 'hqx' => 'application/mac-binhex40', + 'cpt' => 'application/mac-compactpro', + 'mads' => 'application/mads+xml', + 'mrc' => 'application/marc', + 'mrcx' => 'application/marcxml+xml', + 'ma' => 'application/mathematica', + 'mathml' => 'application/mathml+xml', + 'mbox' => 'application/mbox', + 'mscml' => 'application/mediaservercontrol+xml', + 'metalink' => 'application/metalink+xml', + 'meta4' => 'application/metalink4+xml', + 'mets' => 'application/mets+xml', + 'mods' => 'application/mods+xml', + 'm21' => 'application/mp21', + 'mp4s' => 'application/mp4', + 'doc' => 'application/msword', + 'mxf' => 'application/mxf', + 'bin' => 'application/octet-stream', + 'oda' => 'application/oda', + 'opf' => 'application/oebps-package+xml', + 'ogx' => 'application/ogg', + 'omdoc' => 'application/omdoc+xml', + 'onetoc' => 'application/onenote', + 'oxps' => 'application/oxps', + 'xer' => 'application/patch-ops-error+xml', + 'pdf' => 'application/pdf', + 'pgp' => 'application/pgp-encrypted', + 'asc' => 'application/pgp-signature', + 'prf' => 'application/pics-rules', + 'p10' => 'application/pkcs10', + 'p7m' => 'application/pkcs7-mime', + 'p7s' => 'application/pkcs7-signature', + 'p8' => 'application/pkcs8', + 'ac' => 'application/pkix-attr-cert', + 'cer' => 'application/pkix-cert', + 'crl' => 'application/pkix-crl', + 'pkipath' => 'application/pkix-pkipath', + 'pki' => 'application/pkixcmp', + 'pls' => 'application/pls+xml', + 'ai' => 'application/postscript', + 'cww' => 'application/prs.cww', + 'pskcxml' => 'application/pskc+xml', + 'rdf' => 'application/rdf+xml', + 'rif' => 'application/reginfo+xml', + 'rnc' => 'application/relax-ng-compact-syntax', + 'rl' => 'application/resource-lists+xml', + 'rld' => 'application/resource-lists-diff+xml', + 'rs' => 'application/rls-services+xml', + 'gbr' => 'application/rpki-ghostbusters', + 'mft' => 'application/rpki-manifest', + 'roa' => 'application/rpki-roa', + 'rsd' => 'application/rsd+xml', + 'rss' => 'application/rss+xml', + 'sbml' => 'application/sbml+xml', + 'scq' => 'application/scvp-cv-request', + 'scs' => 'application/scvp-cv-response', + 'spq' => 'application/scvp-vp-request', + 'spp' => 'application/scvp-vp-response', + 'sdp' => 'application/sdp', + 'setpay' => 'application/set-payment-initiation', + 'setreg' => 'application/set-registration-initiation', + 'shf' => 'application/shf+xml', + 'smi' => 'application/smil+xml', + 'rq' => 'application/sparql-query', + 'srx' => 'application/sparql-results+xml', + 'gram' => 'application/srgs', + 'grxml' => 'application/srgs+xml', + 'sru' => 'application/sru+xml', + 'ssdl' => 'application/ssdl+xml', + 'ssml' => 'application/ssml+xml', + 'tei' => 'application/tei+xml', + 'tfi' => 'application/thraud+xml', + 'tsd' => 'application/timestamped-data', + 'plb' => 'application/vnd.3gpp.pic-bw-large', + 'psb' => 'application/vnd.3gpp.pic-bw-small', + 'pvb' => 'application/vnd.3gpp.pic-bw-var', + 'tcap' => 'application/vnd.3gpp2.tcap', + 'pwn' => 'application/vnd.3m.post-it-notes', + 'aso' => 'application/vnd.accpac.simply.aso', + 'imp' => 'application/vnd.accpac.simply.imp', + 'acu' => 'application/vnd.acucobol', + 'atc' => 'application/vnd.acucorp', + 'air' => 'application/vnd.adobe.air-application-installer-package+zip', + 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', + 'fxp' => 'application/vnd.adobe.fxp', + 'xdp' => 'application/vnd.adobe.xdp+xml', + 'xfdf' => 'application/vnd.adobe.xfdf', + 'ahead' => 'application/vnd.ahead.space', + 'azf' => 'application/vnd.airzip.filesecure.azf', + 'azs' => 'application/vnd.airzip.filesecure.azs', + 'azw' => 'application/vnd.amazon.ebook', + 'acc' => 'application/vnd.americandynamics.acc', + 'ami' => 'application/vnd.amiga.ami', + 'apk' => 'application/vnd.android.package-archive', + 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', + 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', + 'atx' => 'application/vnd.antix.game-component', + 'mpkg' => 'application/vnd.apple.installer+xml', + 'm3u8' => 'application/vnd.apple.mpegurl', + 'swi' => 'application/vnd.aristanetworks.swi', + 'iota' => 'application/vnd.astraea-software.iota', + 'aep' => 'application/vnd.audiograph', + 'mpm' => 'application/vnd.blueice.multipass', + 'bmi' => 'application/vnd.bmi', + 'rep' => 'application/vnd.businessobjects', + 'cdxml' => 'application/vnd.chemdraw+xml', + 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', + 'cdy' => 'application/vnd.cinderella', + 'cla' => 'application/vnd.claymore', + 'rp9' => 'application/vnd.cloanto.rp9', + 'c4g' => 'application/vnd.clonk.c4group', + 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', + 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', + 'csp' => 'application/vnd.commonspace', + 'cdbcmsg' => 'application/vnd.contact.cmsg', + 'cmc' => 'application/vnd.cosmocaller', + 'clkx' => 'application/vnd.crick.clicker', + 'clkk' => 'application/vnd.crick.clicker.keyboard', + 'clkp' => 'application/vnd.crick.clicker.palette', + 'clkt' => 'application/vnd.crick.clicker.template', + 'clkw' => 'application/vnd.crick.clicker.wordbank', + 'wbs' => 'application/vnd.criticaltools.wbs+xml', + 'pml' => 'application/vnd.ctc-posml', + 'ppd' => 'application/vnd.cups-ppd', + 'car' => 'application/vnd.curl.car', + 'pcurl' => 'application/vnd.curl.pcurl', + 'dart' => 'application/vnd.dart', + 'rdz' => 'application/vnd.data-vision.rdz', + 'uvf' => 'application/vnd.dece.data', + 'uvt' => 'application/vnd.dece.ttml+xml', + 'uvx' => 'application/vnd.dece.unspecified', + 'uvz' => 'application/vnd.dece.zip', + 'fe_launch' => 'application/vnd.denovo.fcselayout-link', + 'dna' => 'application/vnd.dna', + 'mlp' => 'application/vnd.dolby.mlp', + 'dpg' => 'application/vnd.dpgraph', + 'dfac' => 'application/vnd.dreamfactory', + 'kpxx' => 'application/vnd.ds-keypoint', + 'ait' => 'application/vnd.dvb.ait', + 'svc' => 'application/vnd.dvb.service', + 'geo' => 'application/vnd.dynageo', + 'mag' => 'application/vnd.ecowin.chart', + 'nml' => 'application/vnd.enliven', + 'esf' => 'application/vnd.epson.esf', + 'msf' => 'application/vnd.epson.msf', + 'qam' => 'application/vnd.epson.quickanime', + 'slt' => 'application/vnd.epson.salt', + 'ssf' => 'application/vnd.epson.ssf', + 'es3' => 'application/vnd.eszigno3+xml', + 'ez2' => 'application/vnd.ezpix-album', + 'ez3' => 'application/vnd.ezpix-package', + 'fdf' => 'application/vnd.fdf', + 'mseed' => 'application/vnd.fdsn.mseed', + 'seed' => 'application/vnd.fdsn.seed', + 'gph' => 'application/vnd.flographit', + 'ftc' => 'application/vnd.fluxtime.clip', + 'fm' => 'application/vnd.framemaker', + 'fnc' => 'application/vnd.frogans.fnc', + 'ltf' => 'application/vnd.frogans.ltf', + 'fsc' => 'application/vnd.fsc.weblaunch', + 'oas' => 'application/vnd.fujitsu.oasys', + 'oa2' => 'application/vnd.fujitsu.oasys2', + 'oa3' => 'application/vnd.fujitsu.oasys3', + 'fg5' => 'application/vnd.fujitsu.oasysgp', + 'bh2' => 'application/vnd.fujitsu.oasysprs', + 'ddd' => 'application/vnd.fujixerox.ddd', + 'xdw' => 'application/vnd.fujixerox.docuworks', + 'xbd' => 'application/vnd.fujixerox.docuworks.binder', + 'fzs' => 'application/vnd.fuzzysheet', + 'txd' => 'application/vnd.genomatix.tuxedo', + 'ggb' => 'application/vnd.geogebra.file', + 'ggt' => 'application/vnd.geogebra.tool', + 'gex' => 'application/vnd.geometry-explorer', + 'gxt' => 'application/vnd.geonext', + 'g2w' => 'application/vnd.geoplan', + 'g3w' => 'application/vnd.geospace', + 'gmx' => 'application/vnd.gmx', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'kmz' => 'application/vnd.google-earth.kmz', + 'gqf' => 'application/vnd.grafeq', + 'gac' => 'application/vnd.groove-account', + 'ghf' => 'application/vnd.groove-help', + 'gim' => 'application/vnd.groove-identity-message', + 'grv' => 'application/vnd.groove-injector', + 'gtm' => 'application/vnd.groove-tool-message', + 'tpl' => 'application/vnd.groove-tool-template', + 'vcg' => 'application/vnd.groove-vcard', + 'hal' => 'application/vnd.hal+xml', + 'zmm' => 'application/vnd.handheld-entertainment+xml', + 'hbci' => 'application/vnd.hbci', + 'les' => 'application/vnd.hhe.lesson-player', + 'hpgl' => 'application/vnd.hp-hpgl', + 'hpid' => 'application/vnd.hp-hpid', + 'hps' => 'application/vnd.hp-hps', + 'jlt' => 'application/vnd.hp-jlyt', + 'pcl' => 'application/vnd.hp-pcl', + 'pclxl' => 'application/vnd.hp-pclxl', + 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', + 'mpy' => 'application/vnd.ibm.minipay', + 'afp' => 'application/vnd.ibm.modcap', + 'irm' => 'application/vnd.ibm.rights-management', + 'sc' => 'application/vnd.ibm.secure-container', + 'icc' => 'application/vnd.iccprofile', + 'igl' => 'application/vnd.igloader', + 'ivp' => 'application/vnd.immervision-ivp', + 'ivu' => 'application/vnd.immervision-ivu', + 'igm' => 'application/vnd.insors.igm', + 'xpw' => 'application/vnd.intercon.formnet', + 'i2g' => 'application/vnd.intergeo', + 'qbo' => 'application/vnd.intu.qbo', + 'qfx' => 'application/vnd.intu.qfx', + 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', + 'irp' => 'application/vnd.irepository.package+xml', + 'xpr' => 'application/vnd.is-xpr', + 'fcs' => 'application/vnd.isac.fcs', + 'jam' => 'application/vnd.jam', + 'rms' => 'application/vnd.jcp.javame.midlet-rms', + 'jisp' => 'application/vnd.jisp', + 'joda' => 'application/vnd.joost.joda-archive', + 'ktz' => 'application/vnd.kahootz', + 'karbon' => 'application/vnd.kde.karbon', + 'chrt' => 'application/vnd.kde.kchart', + 'kfo' => 'application/vnd.kde.kformula', + 'flw' => 'application/vnd.kde.kivio', + 'kon' => 'application/vnd.kde.kontour', + 'kpr' => 'application/vnd.kde.kpresenter', + 'ksp' => 'application/vnd.kde.kspread', + 'kwd' => 'application/vnd.kde.kword', + 'htke' => 'application/vnd.kenameaapp', + 'kia' => 'application/vnd.kidspiration', + 'kne' => 'application/vnd.kinar', + 'skp' => 'application/vnd.koan', + 'sse' => 'application/vnd.kodak-descriptor', + 'lasxml' => 'application/vnd.las.las+xml', + 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', + 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', + '123' => 'application/vnd.lotus-1-2-3', + 'apr' => 'application/vnd.lotus-approach', + 'pre' => 'application/vnd.lotus-freelance', + 'nsf' => 'application/vnd.lotus-notes', + 'org' => 'application/vnd.lotus-organizer', + 'scm' => 'application/vnd.lotus-screencam', + 'lwp' => 'application/vnd.lotus-wordpro', + 'portpkg' => 'application/vnd.macports.portpkg', + 'mcd' => 'application/vnd.mcd', + 'mc1' => 'application/vnd.medcalcdata', + 'cdkey' => 'application/vnd.mediastation.cdkey', + 'mwf' => 'application/vnd.mfer', + 'mfm' => 'application/vnd.mfmp', + 'flo' => 'application/vnd.micrografx.flo', + 'igx' => 'application/vnd.micrografx.igx', + 'mif' => 'application/vnd.mif', + 'daf' => 'application/vnd.mobius.daf', + 'dis' => 'application/vnd.mobius.dis', + 'mbk' => 'application/vnd.mobius.mbk', + 'mqy' => 'application/vnd.mobius.mqy', + 'msl' => 'application/vnd.mobius.msl', + 'plc' => 'application/vnd.mobius.plc', + 'txf' => 'application/vnd.mobius.txf', + 'mpn' => 'application/vnd.mophun.application', + 'mpc' => 'application/vnd.mophun.certificate', + 'xul' => 'application/vnd.mozilla.xul+xml', + 'cil' => 'application/vnd.ms-artgalry', + 'cab' => 'application/vnd.ms-cab-compressed', + 'xls' => 'application/vnd.ms-excel', + 'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12', + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12', + 'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12', + 'xltm' => 'application/vnd.ms-excel.template.macroenabled.12', + 'eot' => 'application/vnd.ms-fontobject', + 'chm' => 'application/vnd.ms-htmlhelp', + 'ims' => 'application/vnd.ms-ims', + 'lrm' => 'application/vnd.ms-lrm', + 'thmx' => 'application/vnd.ms-officetheme', + 'cat' => 'application/vnd.ms-pki.seccat', + 'stl' => 'application/vnd.ms-pki.stl', + 'ppt' => 'application/vnd.ms-powerpoint', + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12', + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12', + 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', + 'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12', + 'mpp' => 'application/vnd.ms-project', + 'docm' => 'application/vnd.ms-word.document.macroenabled.12', + 'dotm' => 'application/vnd.ms-word.template.macroenabled.12', + 'wps' => 'application/vnd.ms-works', + 'wpl' => 'application/vnd.ms-wpl', + 'xps' => 'application/vnd.ms-xpsdocument', + 'mseq' => 'application/vnd.mseq', + 'mus' => 'application/vnd.musician', + 'msty' => 'application/vnd.muvee.style', + 'taglet' => 'application/vnd.mynfc', + 'nlu' => 'application/vnd.neurolanguage.nlu', + 'ntf' => 'application/vnd.nitf', + 'nnd' => 'application/vnd.noblenet-directory', + 'nns' => 'application/vnd.noblenet-sealer', + 'nnw' => 'application/vnd.noblenet-web', + 'ngdat' => 'application/vnd.nokia.n-gage.data', + 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', + 'rpst' => 'application/vnd.nokia.radio-preset', + 'rpss' => 'application/vnd.nokia.radio-presets', + 'edm' => 'application/vnd.novadigm.edm', + 'edx' => 'application/vnd.novadigm.edx', + 'ext' => 'application/vnd.novadigm.ext', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'otc' => 'application/vnd.oasis.opendocument.chart-template', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odft' => 'application/vnd.oasis.opendocument.formula-template', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'oti' => 'application/vnd.oasis.opendocument.image-template', + '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', + 'xo' => 'application/vnd.olpc-sugar', + 'dd2' => 'application/vnd.oma.dd2+xml', + 'oxt' => 'application/vnd.openofficeorg.extension', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'mgp' => 'application/vnd.osgeo.mapguide.package', + 'dp' => 'application/vnd.osgi.dp', + 'esa' => 'application/vnd.osgi.subsystem', + 'pdb' => 'application/vnd.palm', + 'paw' => 'application/vnd.pawaafile', + 'str' => 'application/vnd.pg.format', + 'ei6' => 'application/vnd.pg.osasli', + 'efif' => 'application/vnd.picsel', + 'wg' => 'application/vnd.pmi.widget', + 'plf' => 'application/vnd.pocketlearn', + 'pbd' => 'application/vnd.powerbuilder6', + 'box' => 'application/vnd.previewsystems.box', + 'mgz' => 'application/vnd.proteus.magazine', + 'qps' => 'application/vnd.publishare-delta-tree', + 'ptid' => 'application/vnd.pvi.ptid1', + 'qxd' => 'application/vnd.quark.quarkxpress', + 'bed' => 'application/vnd.realvnc.bed', + 'mxl' => 'application/vnd.recordare.musicxml', + 'musicxml' => 'application/vnd.recordare.musicxml+xml', + 'cryptonote' => 'application/vnd.rig.cryptonote', + 'cod' => 'application/vnd.rim.cod', + 'rm' => 'application/vnd.rn-realmedia', + 'rmvb' => 'application/vnd.rn-realmedia-vbr', + 'link66' => 'application/vnd.route66.link66+xml', + 'st' => 'application/vnd.sailingtracker.track', + 'see' => 'application/vnd.seemail', + 'sema' => 'application/vnd.sema', + 'semd' => 'application/vnd.semd', + 'semf' => 'application/vnd.semf', + 'ifm' => 'application/vnd.shana.informed.formdata', + 'itp' => 'application/vnd.shana.informed.formtemplate', + 'iif' => 'application/vnd.shana.informed.interchange', + 'ipk' => 'application/vnd.shana.informed.package', + 'twd' => 'application/vnd.simtech-mindmapper', + 'mmf' => 'application/vnd.smaf', + 'teacher' => 'application/vnd.smart.teacher', + 'sdkm' => 'application/vnd.solent.sdkm+xml', + 'dxp' => 'application/vnd.spotfire.dxp', + 'sfs' => 'application/vnd.spotfire.sfs', + 'sdc' => 'application/vnd.stardivision.calc', + 'sda' => 'application/vnd.stardivision.draw', + 'sdd' => 'application/vnd.stardivision.impress', + 'smf' => 'application/vnd.stardivision.math', + 'sdw' => 'application/vnd.stardivision.writer', + 'sgl' => 'application/vnd.stardivision.writer-global', + 'smzip' => 'application/vnd.stepmania.package', + 'sm' => 'application/vnd.stepmania.stepchart', + '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', + 'sxm' => 'application/vnd.sun.xml.math', + 'sxw' => 'application/vnd.sun.xml.writer', + 'sxg' => 'application/vnd.sun.xml.writer.global', + 'stw' => 'application/vnd.sun.xml.writer.template', + 'sus' => 'application/vnd.sus-calendar', + 'svd' => 'application/vnd.svd', + 'sis' => 'application/vnd.symbian.install', + 'xsm' => 'application/vnd.syncml+xml', + 'bdm' => 'application/vnd.syncml.dm+wbxml', + 'xdm' => 'application/vnd.syncml.dm+xml', + 'tao' => 'application/vnd.tao.intent-module-archive', + 'pcap' => 'application/vnd.tcpdump.pcap', + 'tmo' => 'application/vnd.tmobile-livetv', + 'tpt' => 'application/vnd.trid.tpt', + 'mxs' => 'application/vnd.triscape.mxs', + 'tra' => 'application/vnd.trueapp', + 'ufd' => 'application/vnd.ufdl', + 'utz' => 'application/vnd.uiq.theme', + 'umj' => 'application/vnd.umajin', + 'unityweb' => 'application/vnd.unity', + 'uoml' => 'application/vnd.uoml+xml', + 'vcx' => 'application/vnd.vcx', + 'vsd' => 'application/vnd.visio', + 'vis' => 'application/vnd.visionary', + 'vsf' => 'application/vnd.vsf', + 'wbxml' => 'application/vnd.wap.wbxml', + 'wmlc' => 'application/vnd.wap.wmlc', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'wtb' => 'application/vnd.webturbo', + 'nbp' => 'application/vnd.wolfram.player', + 'wpd' => 'application/vnd.wordperfect', + 'wqd' => 'application/vnd.wqd', + 'stf' => 'application/vnd.wt.stf', + 'xar' => 'application/vnd.xara', + 'xfdl' => 'application/vnd.xfdl', + 'hvd' => 'application/vnd.yamaha.hv-dic', + 'hvs' => 'application/vnd.yamaha.hv-script', + 'hvp' => 'application/vnd.yamaha.hv-voice', + 'osf' => 'application/vnd.yamaha.openscoreformat', + 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', + 'saf' => 'application/vnd.yamaha.smaf-audio', + 'spf' => 'application/vnd.yamaha.smaf-phrase', + 'cmp' => 'application/vnd.yellowriver-custom-menu', + 'zir' => 'application/vnd.zul', + 'zaz' => 'application/vnd.zzazz.deck+xml', + 'vxml' => 'application/voicexml+xml', + 'wgt' => 'application/widget', + 'hlp' => 'application/winhlp', + 'wsdl' => 'application/wsdl+xml', + 'wspolicy' => 'application/wspolicy+xml', + '7z' => 'application/x-7z-compressed', + 'abw' => 'application/x-abiword', + 'ace' => 'application/x-ace-compressed', + 'dmg' => 'application/x-apple-diskimage', + 'aab' => 'application/x-authorware-bin', + 'aam' => 'application/x-authorware-map', + 'aas' => 'application/x-authorware-seg', + 'bcpio' => 'application/x-bcpio', + 'torrent' => 'application/x-bittorrent', + 'blb' => 'application/x-blorb', + 'bz' => 'application/x-bzip', + 'bz2' => 'application/x-bzip2', + 'cbr' => 'application/x-cbr', + 'vcd' => 'application/x-cdlink', + 'cfs' => 'application/x-cfs-compressed', + 'chat' => 'application/x-chat', + 'pgn' => 'application/x-chess-pgn', + 'nsc' => 'application/x-conference', + 'cpio' => 'application/x-cpio', + 'csh' => 'application/x-csh', + 'deb' => 'application/x-debian-package', + 'dgc' => 'application/x-dgc-compressed', + 'dir' => 'application/x-director', + 'wad' => 'application/x-doom', + 'ncx' => 'application/x-dtbncx+xml', + 'dtb' => 'application/x-dtbook+xml', + 'res' => 'application/x-dtbresource+xml', + 'dvi' => 'application/x-dvi', + 'evy' => 'application/x-envoy', + 'eva' => 'application/x-eva', + 'bdf' => 'application/x-font-bdf', + 'gsf' => 'application/x-font-ghostscript', + 'psf' => 'application/x-font-linux-psf', + 'otf' => 'application/x-font-otf', + 'pcf' => 'application/x-font-pcf', + 'snf' => 'application/x-font-snf', + 'ttf' => 'application/x-font-ttf', + 'pfa' => 'application/x-font-type1', + 'woff' => 'application/x-font-woff', + 'arc' => 'application/x-freearc', + 'spl' => 'application/x-futuresplash', + 'gca' => 'application/x-gca-compressed', + 'ulx' => 'application/x-glulx', + 'gnumeric' => 'application/x-gnumeric', + 'gramps' => 'application/x-gramps-xml', + 'gtar' => 'application/x-gtar', + 'hdf' => 'application/x-hdf', + 'install' => 'application/x-install-instructions', + 'iso' => 'application/x-iso9660-image', + 'jnlp' => 'application/x-java-jnlp-file', + 'latex' => 'application/x-latex', + 'lzh' => 'application/x-lzh-compressed', + 'mie' => 'application/x-mie', + 'prc' => 'application/x-mobipocket-ebook', + 'application' => 'application/x-ms-application', + 'lnk' => 'application/x-ms-shortcut', + 'wmd' => 'application/x-ms-wmd', + 'wmz' => 'application/x-ms-wmz', + 'xbap' => 'application/x-ms-xbap', + 'mdb' => 'application/x-msaccess', + 'obd' => 'application/x-msbinder', + 'crd' => 'application/x-mscardfile', + 'clp' => 'application/x-msclip', + 'exe' => 'application/x-msdownload', + 'mvb' => 'application/x-msmediaview', + 'wmf' => 'application/x-msmetafile', + 'mny' => 'application/x-msmoney', + 'pub' => 'application/x-mspublisher', + 'scd' => 'application/x-msschedule', + 'trm' => 'application/x-msterminal', + 'wri' => 'application/x-mswrite', + 'nc' => 'application/x-netcdf', + 'nzb' => 'application/x-nzb', + 'p12' => 'application/x-pkcs12', + 'p7b' => 'application/x-pkcs7-certificates', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'rar' => 'application/x-rar', + 'ris' => 'application/x-research-info-systems', + 'sh' => 'application/x-sh', + 'shar' => 'application/x-shar', + 'swf' => 'application/x-shockwave-flash', + 'xap' => 'application/x-silverlight-app', + 'sql' => 'application/x-sql', + 'sit' => 'application/x-stuffit', + 'sitx' => 'application/x-stuffitx', + 'srt' => 'application/x-subrip', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 't3' => 'application/x-t3vm-image', + 'gam' => 'application/x-tads', + 'tar' => 'application/x-tar', + 'tcl' => 'application/x-tcl', + 'tex' => 'application/x-tex', + 'tfm' => 'application/x-tex-tfm', + 'texinfo' => 'application/x-texinfo', + 'obj' => 'application/x-tgif', + 'ustar' => 'application/x-ustar', + 'src' => 'application/x-wais-source', + 'der' => 'application/x-x509-ca-cert', + 'fig' => 'application/x-xfig', + 'xlf' => 'application/x-xliff+xml', + 'xpi' => 'application/x-xpinstall', + 'xz' => 'application/x-xz', + 'z1' => 'application/x-zmachine', + 'xaml' => 'application/xaml+xml', + 'xdf' => 'application/xcap-diff+xml', + 'xenc' => 'application/xenc+xml', + 'xhtml' => 'application/xhtml+xml', + 'xml' => 'application/xml', + 'dtd' => 'application/xml-dtd', + 'xop' => 'application/xop+xml', + 'xpl' => 'application/xproc+xml', + 'xslt' => 'application/xslt+xml', + 'xspf' => 'application/xspf+xml', + 'mxml' => 'application/xv+xml', + 'yang' => 'application/yang', + 'yin' => 'application/yin+xml', + 'zip' => 'application/zip', + 'adp' => 'audio/adpcm', + 'au' => 'audio/basic', + 'mid' => 'audio/midi', + 'mp3' => 'audio/mpeg', + 'mp4a' => 'audio/mp4', + 'mpga' => 'audio/mpeg', + 'oga' => 'audio/ogg', + 's3m' => 'audio/s3m', + 'sil' => 'audio/silk', + 'uva' => 'audio/vnd.dece.audio', + 'eol' => 'audio/vnd.digital-winds', + 'dra' => 'audio/vnd.dra', + 'dts' => 'audio/vnd.dts', + 'dtshd' => 'audio/vnd.dts.hd', + 'lvp' => 'audio/vnd.lucent.voice', + 'pya' => 'audio/vnd.ms-playready.media.pya', + 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', + 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', + 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', + 'rip' => 'audio/vnd.rip', + 'weba' => 'audio/webm', + 'aac' => 'audio/x-aac', + 'aif' => 'audio/x-aiff', + 'caf' => 'audio/x-caf', + 'flac' => 'audio/x-flac', + 'mka' => 'audio/x-matroska', + 'm3u' => 'audio/x-mpegurl', + 'wax' => 'audio/x-ms-wax', + 'wma' => 'audio/x-ms-wma', + 'ram' => 'audio/x-pn-realaudio', + 'rmp' => 'audio/x-pn-realaudio-plugin', + 'wav' => 'audio/x-wav', + 'xm' => 'audio/xm', + 'cdx' => 'chemical/x-cdx', + 'cif' => 'chemical/x-cif', + 'cmdf' => 'chemical/x-cmdf', + 'cml' => 'chemical/x-cml', + 'csml' => 'chemical/x-csml', + 'xyz' => 'chemical/x-xyz', + 'bmp' => 'image/bmp', + 'cgm' => 'image/cgm', + 'g3' => 'image/g3fax', + 'gif' => 'image/gif', + 'ief' => 'image/ief', + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'ktx' => 'image/ktx', + 'png' => 'image/png', + 'btif' => 'image/prs.btif', + 'sgi' => 'image/sgi', + 'svg' => 'image/svg+xml', + 'tiff' => 'image/tiff', + 'psd' => 'image/vnd.adobe.photoshop', + 'uvi' => 'image/vnd.dece.graphic', + 'djvu' => 'image/vnd.djvu', + 'dwg' => 'image/vnd.dwg', + 'dxf' => 'image/vnd.dxf', + 'fbs' => 'image/vnd.fastbidsheet', + 'fpx' => 'image/vnd.fpx', + 'fst' => 'image/vnd.fst', + 'mmr' => 'image/vnd.fujixerox.edmics-mmr', + 'rlc' => 'image/vnd.fujixerox.edmics-rlc', + 'mdi' => 'image/vnd.ms-modi', + 'wdp' => 'image/vnd.ms-photo', + 'npx' => 'image/vnd.net-fpx', + 'wbmp' => 'image/vnd.wap.wbmp', + 'xif' => 'image/vnd.xiff', + 'webp' => 'image/webp', + '3ds' => 'image/x-3ds', + 'ras' => 'image/x-cmu-raster', + 'cmx' => 'image/x-cmx', + 'fh' => 'image/x-freehand', + 'ico' => 'image/x-icon', + 'sid' => 'image/x-mrsid-image', + 'pcx' => 'image/x-pcx', + 'pic' => 'image/x-pict', + 'pnm' => 'image/x-portable-anymap', + 'pbm' => 'image/x-portable-bitmap', + 'pgm' => 'image/x-portable-graymap', + 'ppm' => 'image/x-portable-pixmap', + 'rgb' => 'image/x-rgb', + 'tga' => 'image/x-tga', + 'xbm' => 'image/x-xbitmap', + 'xpm' => 'image/x-xpixmap', + 'xwd' => 'image/x-xwindowdump', + 'eml' => 'message/rfc822', + 'igs' => 'model/iges', + 'msh' => 'model/mesh', + 'dae' => 'model/vnd.collada+xml', + 'dwf' => 'model/vnd.dwf', + 'gdl' => 'model/vnd.gdl', + 'gtw' => 'model/vnd.gtw', + 'mts' => 'model/vnd.mts', + 'vtu' => 'model/vnd.vtu', + 'wrl' => 'model/vrml', + 'x3db' => 'model/x3d+binary', + 'x3dv' => 'model/x3d+vrml', + 'x3d' => 'model/x3d+xml', + 'appcache' => 'text/cache-manifest', + 'ics' => 'text/calendar', + 'css' => 'text/css', + 'csv' => 'text/csv', + 'html' => 'text/html', + 'n3' => 'text/n3', + 'txt' => 'text/plain', + 'dsc' => 'text/prs.lines.tag', + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'sgml' => 'text/sgml', + 'tsv' => 'text/tab-separated-values', + 't' => 'text/troff', + 'ttl' => 'text/turtle', + 'uri' => 'text/uri-list', + 'vcard' => 'text/vcard', + 'curl' => 'text/vnd.curl', + 'dcurl' => 'text/vnd.curl.dcurl', + 'scurl' => 'text/vnd.curl.scurl', + 'mcurl' => 'text/vnd.curl.mcurl', + 'sub' => 'text/vnd.dvb.subtitle', + 'fly' => 'text/vnd.fly', + 'flx' => 'text/vnd.fmi.flexstor', + 'gv' => 'text/vnd.graphviz', + '3dml' => 'text/vnd.in3d.3dml', + 'spot' => 'text/vnd.in3d.spot', + 'jad' => 'text/vnd.sun.j2me.app-descriptor', + 'wml' => 'text/vnd.wap.wml', + 'wmls' => 'text/vnd.wap.wmlscript', + 's' => 'text/x-asm', + 'c' => 'text/x-c', + 'f' => 'text/x-fortran', + 'p' => 'text/x-pascal', + 'java' => 'text/x-java-source', + 'opml' => 'text/x-opml', + 'nfo' => 'text/x-nfo', + 'etx' => 'text/x-setext', + 'sfv' => 'text/x-sfv', + 'uu' => 'text/x-uuencode', + 'vcs' => 'text/x-vcalendar', + 'vcf' => 'text/x-vcard', + '3gp' => 'video/3gpp', + '3g2' => 'video/3gpp2', + 'h261' => 'video/h261', + 'h263' => 'video/h263', + 'h264' => 'video/h264', + 'jpgv' => 'video/jpeg', + 'jpm' => 'video/jpm', + 'mj2' => 'video/mj2', + 'mp4' => 'video/mp4', + 'mpeg' => 'video/mpeg', + 'ogv' => 'video/ogg', + 'mov' => 'video/quicktime', + 'qt' => 'video/quicktime', + 'uvh' => 'video/vnd.dece.hd', + 'uvm' => 'video/vnd.dece.mobile', + 'uvp' => 'video/vnd.dece.pd', + 'uvs' => 'video/vnd.dece.sd', + 'uvv' => 'video/vnd.dece.video', + 'dvb' => 'video/vnd.dvb.file', + 'fvt' => 'video/vnd.fvt', + 'mxu' => 'video/vnd.mpegurl', + 'pyv' => 'video/vnd.ms-playready.media.pyv', + 'uvu' => 'video/vnd.uvvu.mp4', + 'viv' => 'video/vnd.vivo', + 'webm' => 'video/webm', + 'f4v' => 'video/x-f4v', + 'fli' => 'video/x-fli', + 'flv' => 'video/x-flv', + 'm4v' => 'video/x-m4v', + 'mkv' => 'video/x-matroska', + 'mng' => 'video/x-mng', + 'asf' => 'video/x-ms-asf', + 'vob' => 'video/x-ms-vob', + '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', + 'smv' => 'video/x-smv', + 'ice' => 'x-conference/x-cooltalk', + ]; + + /** + * Get the MIME type for a file based on the file's extension. + * + * @param string $filename + * @return string + */ + public static function from($filename) + { + $extension = pathinfo($filename, PATHINFO_EXTENSION); + + return self::getMimeTypeFromExtension($extension); + } + + /** + * Get the MIME type for a given extension or return all mimes. + * + * @param string|null $extension + * @return string|array + */ + public static function get($extension = null) + { + return $extension ? self::getMimeTypeFromExtension($extension) : self::$mimes; + } + + /** + * Search for the extension of a given MIME type. + * + * @param string $mimeType + * @return string|null + */ + public static function search($mimeType) + { + return array_search($mimeType, self::$mimes) ?: null; + } + + /** + * Get the MIME type for a given extension. + * + * @param string $extension + * @return string + */ + protected static function getMimeTypeFromExtension($extension) + { + return self::$mimes[$extension] ?? 'application/octet-stream'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/UploadedFile.php b/vendor/laravel/framework/src/Illuminate/Http/UploadedFile.php new file mode 100644 index 00000000..c3a8eab1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/UploadedFile.php @@ -0,0 +1,149 @@ +storeAs($path, $this->hashName(), $this->parseOptions($options)); + } + + /** + * Store the uploaded file on a filesystem disk with public visibility. + * + * @param string $path + * @param array|string $options + * @return string|false + */ + public function storePublicly($path, $options = []) + { + $options = $this->parseOptions($options); + + $options['visibility'] = 'public'; + + return $this->storeAs($path, $this->hashName(), $options); + } + + /** + * Store the uploaded file on a filesystem disk with public visibility. + * + * @param string $path + * @param string $name + * @param array|string $options + * @return string|false + */ + public function storePubliclyAs($path, $name, $options = []) + { + $options = $this->parseOptions($options); + + $options['visibility'] = 'public'; + + return $this->storeAs($path, $name, $options); + } + + /** + * Store the uploaded file on a filesystem disk. + * + * @param string $path + * @param string $name + * @param array|string $options + * @return string|false + */ + public function storeAs($path, $name, $options = []) + { + $options = $this->parseOptions($options); + + $disk = Arr::pull($options, 'disk'); + + return Container::getInstance()->make(FilesystemFactory::class)->disk($disk)->putFileAs( + $path, $this, $name, $options + ); + } + + /** + * Get the contents of the uploaded file. + * + * @return bool|string + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function get() + { + if (! $this->isValid()) { + throw new FileNotFoundException("File does not exist at path {$this->getPathname()}"); + } + + return file_get_contents($this->getPathname()); + } + + /** + * Get the file's extension supplied by the client. + * + * @return string + */ + public function clientExtension() + { + return $this->guessClientExtension(); + } + + /** + * Create a new file instance from a base instance. + * + * @param \Symfony\Component\HttpFoundation\File\UploadedFile $file + * @param bool $test + * @return static + */ + public static function createFromBase(SymfonyUploadedFile $file, $test = false) + { + return $file instanceof static ? $file : new static( + $file->getPathname(), + $file->getClientOriginalName(), + $file->getClientMimeType(), + $file->getError(), + $test + ); + } + + /** + * Parse and format the given options. + * + * @param array|string $options + * @return array + */ + protected function parseOptions($options) + { + if (is_string($options)) { + $options = ['disk' => $options]; + } + + return $options; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/composer.json b/vendor/laravel/framework/src/Illuminate/Http/composer.json new file mode 100755 index 00000000..c53a73b9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/composer.json @@ -0,0 +1,41 @@ +{ + "name": "illuminate/http", + "description": "The Illuminate Http package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "ext-json": "*", + "illuminate/session": "^6.0", + "illuminate/support": "^6.0", + "symfony/http-foundation": "^4.3.4", + "symfony/http-kernel": "^4.3.4" + }, + "autoload": { + "psr-4": { + "Illuminate\\Http\\": "" + } + }, + "suggest": { + "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image()." + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Log/Events/MessageLogged.php b/vendor/laravel/framework/src/Illuminate/Log/Events/MessageLogged.php new file mode 100644 index 00000000..312b343a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/Events/MessageLogged.php @@ -0,0 +1,42 @@ +level = $level; + $this->message = $message; + $this->context = $context; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Log/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Log/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Log/LogManager.php b/vendor/laravel/framework/src/Illuminate/Log/LogManager.php new file mode 100644 index 00000000..53bc54ee --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/LogManager.php @@ -0,0 +1,623 @@ +app = $app; + } + + /** + * Create a new, on-demand aggregate logger instance. + * + * @param array $channels + * @param string|null $channel + * @return \Psr\Log\LoggerInterface + */ + public function stack(array $channels, $channel = null) + { + return new Logger( + $this->createStackDriver(compact('channels', 'channel')), + $this->app['events'] + ); + } + + /** + * Get a log channel instance. + * + * @param string|null $channel + * @return \Psr\Log\LoggerInterface + */ + public function channel($channel = null) + { + return $this->driver($channel); + } + + /** + * Get a log driver instance. + * + * @param string|null $driver + * @return \Psr\Log\LoggerInterface + */ + public function driver($driver = null) + { + return $this->get($driver ?? $this->getDefaultDriver()); + } + + /** + * @return array + */ + public function getChannels() + { + return $this->channels; + } + + /** + * Attempt to get the log from the local cache. + * + * @param string $name + * @return \Psr\Log\LoggerInterface + */ + protected function get($name) + { + try { + return $this->channels[$name] ?? with($this->resolve($name), function ($logger) use ($name) { + return $this->channels[$name] = $this->tap($name, new Logger($logger, $this->app['events'])); + }); + } catch (Throwable $e) { + return tap($this->createEmergencyLogger(), function ($logger) use ($e) { + $logger->emergency('Unable to create configured logger. Using emergency logger.', [ + 'exception' => $e, + ]); + }); + } + } + + /** + * Apply the configured taps for the logger. + * + * @param string $name + * @param \Illuminate\Log\Logger $logger + * @return \Illuminate\Log\Logger + */ + protected function tap($name, Logger $logger) + { + foreach ($this->configurationFor($name)['tap'] ?? [] as $tap) { + [$class, $arguments] = $this->parseTap($tap); + + $this->app->make($class)->__invoke($logger, ...explode(',', $arguments)); + } + + return $logger; + } + + /** + * Parse the given tap class string into a class name and arguments string. + * + * @param string $tap + * @return array + */ + protected function parseTap($tap) + { + return Str::contains($tap, ':') ? explode(':', $tap, 2) : [$tap, '']; + } + + /** + * Create an emergency log handler to avoid white screens of death. + * + * @return \Psr\Log\LoggerInterface + */ + protected function createEmergencyLogger() + { + $config = $this->configurationFor('emergency'); + + $handler = new StreamHandler( + $config['path'] ?? $this->app->storagePath().'/logs/laravel.log', + $this->level(['level' => 'debug']) + ); + + return new Logger( + new Monolog('laravel', $this->prepareHandlers([$handler])), + $this->app['events'] + ); + } + + /** + * Resolve the given log instance by name. + * + * @param string $name + * @return \Psr\Log\LoggerInterface + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->configurationFor($name); + + if (is_null($config)) { + throw new InvalidArgumentException("Log [{$name}] is not defined."); + } + + if (isset($this->customCreators[$config['driver']])) { + return $this->callCustomCreator($config); + } + + $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; + + if (method_exists($this, $driverMethod)) { + return $this->{$driverMethod}($config); + } + + throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); + } + + /** + * Call a custom driver creator. + * + * @param array $config + * @return mixed + */ + protected function callCustomCreator(array $config) + { + return $this->customCreators[$config['driver']]($this->app, $config); + } + + /** + * Create a custom log driver instance. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createCustomDriver(array $config) + { + $factory = is_callable($via = $config['via']) ? $via : $this->app->make($via); + + return $factory($config); + } + + /** + * Create an aggregate log driver instance. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createStackDriver(array $config) + { + $handlers = collect($config['channels'])->flatMap(function ($channel) { + return $this->channel($channel)->getHandlers(); + })->all(); + + if ($config['ignore_exceptions'] ?? false) { + $handlers = [new WhatFailureGroupHandler($handlers)]; + } + + return new Monolog($this->parseChannel($config), $handlers); + } + + /** + * Create an instance of the single file log driver. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createSingleDriver(array $config) + { + return new Monolog($this->parseChannel($config), [ + $this->prepareHandler( + new StreamHandler( + $config['path'], $this->level($config), + $config['bubble'] ?? true, $config['permission'] ?? null, $config['locking'] ?? false + ), $config + ), + ]); + } + + /** + * Create an instance of the daily file log driver. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createDailyDriver(array $config) + { + return new Monolog($this->parseChannel($config), [ + $this->prepareHandler(new RotatingFileHandler( + $config['path'], $config['days'] ?? 7, $this->level($config), + $config['bubble'] ?? true, $config['permission'] ?? null, $config['locking'] ?? false + ), $config), + ]); + } + + /** + * Create an instance of the Slack log driver. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createSlackDriver(array $config) + { + return new Monolog($this->parseChannel($config), [ + $this->prepareHandler(new SlackWebhookHandler( + $config['url'], + $config['channel'] ?? null, + $config['username'] ?? 'Laravel', + $config['attachment'] ?? true, + $config['emoji'] ?? ':boom:', + $config['short'] ?? false, + $config['context'] ?? true, + $this->level($config), + $config['bubble'] ?? true, + $config['exclude_fields'] ?? [] + ), $config), + ]); + } + + /** + * Create an instance of the syslog log driver. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createSyslogDriver(array $config) + { + return new Monolog($this->parseChannel($config), [ + $this->prepareHandler(new SyslogHandler( + Str::snake($this->app['config']['app.name'], '-'), + $config['facility'] ?? LOG_USER, $this->level($config) + ), $config), + ]); + } + + /** + * Create an instance of the "error log" log driver. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createErrorlogDriver(array $config) + { + return new Monolog($this->parseChannel($config), [ + $this->prepareHandler(new ErrorLogHandler( + $config['type'] ?? ErrorLogHandler::OPERATING_SYSTEM, $this->level($config) + )), + ]); + } + + /** + * Create an instance of any handler available in Monolog. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + * + * @throws \InvalidArgumentException + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function createMonologDriver(array $config) + { + if (! is_a($config['handler'], HandlerInterface::class, true)) { + throw new InvalidArgumentException( + $config['handler'].' must be an instance of '.HandlerInterface::class + ); + } + + $with = array_merge( + ['level' => $this->level($config)], + $config['with'] ?? [], + $config['handler_with'] ?? [] + ); + + return new Monolog($this->parseChannel($config), [$this->prepareHandler( + $this->app->make($config['handler'], $with), $config + )]); + } + + /** + * Prepare the handlers for usage by Monolog. + * + * @param array $handlers + * @return array + */ + protected function prepareHandlers(array $handlers) + { + foreach ($handlers as $key => $handler) { + $handlers[$key] = $this->prepareHandler($handler); + } + + return $handlers; + } + + /** + * Prepare the handler for usage by Monolog. + * + * @param \Monolog\Handler\HandlerInterface $handler + * @param array $config + * @return \Monolog\Handler\HandlerInterface + */ + protected function prepareHandler(HandlerInterface $handler, array $config = []) + { + $isHandlerFormattable = false; + + if (Monolog::API === 1) { + $isHandlerFormattable = true; + } elseif (Monolog::API === 2 && $handler instanceof FormattableHandlerInterface) { + $isHandlerFormattable = true; + } + + if ($isHandlerFormattable && ! isset($config['formatter'])) { + $handler->setFormatter($this->formatter()); + } elseif ($isHandlerFormattable && $config['formatter'] !== 'default') { + $handler->setFormatter($this->app->make($config['formatter'], $config['formatter_with'] ?? [])); + } + + return $handler; + } + + /** + * Get a Monolog formatter instance. + * + * @return \Monolog\Formatter\FormatterInterface + */ + protected function formatter() + { + return tap(new LineFormatter(null, $this->dateFormat, true, true), function ($formatter) { + $formatter->includeStacktraces(); + }); + } + + /** + * Get fallback log channel name. + * + * @return string + */ + protected function getFallbackChannelName() + { + return $this->app->bound('env') ? $this->app->environment() : 'production'; + } + + /** + * Get the log connection configuration. + * + * @param string $name + * @return array + */ + protected function configurationFor($name) + { + return $this->app['config']["logging.channels.{$name}"]; + } + + /** + * Get the default log driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['logging.default']; + } + + /** + * Set the default log driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['logging.default'] = $name; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback->bindTo($this, $this); + + return $this; + } + + /** + * Unset the given channel instance. + * + * @param string|null $driver + * @return $this + */ + public function forgetChannel($driver = null) + { + $driver = $driver ?? $this->getDefaultDriver(); + + if (isset($this->channels[$driver])) { + unset($this->channels[$driver]); + } + } + + /** + * System is unusable. + * + * @param string $message + * @param array $context + * @return void + */ + public function emergency($message, array $context = []) + { + $this->driver()->emergency($message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param array $context + * @return void + */ + public function alert($message, array $context = []) + { + $this->driver()->alert($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->driver()->critical($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->driver()->error($message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param array $context + * @return void + */ + public function warning($message, array $context = []) + { + $this->driver()->warning($message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param array $context + * @return void + */ + public function notice($message, array $context = []) + { + $this->driver()->notice($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->driver()->info($message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param array $context + * @return void + */ + public function debug($message, array $context = []) + { + $this->driver()->debug($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->driver()->log($level, $message, $context); + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->driver()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php new file mode 100644 index 00000000..cd073921 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php @@ -0,0 +1,20 @@ +app->singleton('log', function () { + return new LogManager($this->app); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Log/Logger.php b/vendor/laravel/framework/src/Illuminate/Log/Logger.php new file mode 100755 index 00000000..57f2c983 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/Logger.php @@ -0,0 +1,275 @@ +logger = $logger; + $this->dispatcher = $dispatcher; + } + + /** + * Log an emergency message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function emergency($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log an alert message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function alert($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a critical message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function critical($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log an error message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function error($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a warning message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function warning($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a notice to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function notice($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log an informational message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function info($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a debug message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function debug($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a message to the logs. + * + * @param string $level + * @param string $message + * @param array $context + * @return void + */ + public function log($level, $message, array $context = []) + { + $this->writeLog($level, $message, $context); + } + + /** + * Dynamically pass log calls into the writer. + * + * @param string $level + * @param string $message + * @param array $context + * @return void + */ + public function write($level, $message, array $context = []) + { + $this->writeLog($level, $message, $context); + } + + /** + * Write a message to the log. + * + * @param string $level + * @param string $message + * @param array $context + * @return void + */ + protected function writeLog($level, $message, $context) + { + $this->fireLogEvent($level, $message = $this->formatMessage($message), $context); + + $this->logger->{$level}($message, $context); + } + + /** + * Register a new callback handler for when a log event is triggered. + * + * @param \Closure $callback + * @return void + * + * @throws \RuntimeException + */ + public function listen(Closure $callback) + { + if (! isset($this->dispatcher)) { + throw new RuntimeException('Events dispatcher has not been set.'); + } + + $this->dispatcher->listen(MessageLogged::class, $callback); + } + + /** + * Fires a log event. + * + * @param string $level + * @param string $message + * @param array $context + * @return void + */ + protected function fireLogEvent($level, $message, array $context = []) + { + // If the event dispatcher is set, we will pass along the parameters to the + // log listeners. These are useful for building profilers or other tools + // that aggregate all of the log messages for a given "request" cycle. + if (isset($this->dispatcher)) { + $this->dispatcher->dispatch(new MessageLogged($level, $message, $context)); + } + } + + /** + * Format the parameters for the logger. + * + * @param mixed $message + * @return mixed + */ + protected function formatMessage($message) + { + if (is_array($message)) { + return var_export($message, true); + } elseif ($message instanceof Jsonable) { + return $message->toJson(); + } elseif ($message instanceof Arrayable) { + return var_export($message->toArray(), true); + } + + return $message; + } + + /** + * Get the underlying logger implementation. + * + * @return \Psr\Log\LoggerInterface + */ + public function getLogger() + { + return $this->logger; + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getEventDispatcher() + { + return $this->dispatcher; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher + * @return void + */ + public function setEventDispatcher(Dispatcher $dispatcher) + { + $this->dispatcher = $dispatcher; + } + + /** + * Dynamically proxy method calls to the underlying logger. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->logger->{$method}(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Log/ParsesLogConfiguration.php b/vendor/laravel/framework/src/Illuminate/Log/ParsesLogConfiguration.php new file mode 100644 index 00000000..f40cf6b5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/ParsesLogConfiguration.php @@ -0,0 +1,62 @@ + Monolog::DEBUG, + 'info' => Monolog::INFO, + 'notice' => Monolog::NOTICE, + 'warning' => Monolog::WARNING, + 'error' => Monolog::ERROR, + 'critical' => Monolog::CRITICAL, + 'alert' => Monolog::ALERT, + 'emergency' => Monolog::EMERGENCY, + ]; + + /** + * Get fallback log channel name. + * + * @return string + */ + abstract protected function getFallbackChannelName(); + + /** + * Parse the string level into a Monolog constant. + * + * @param array $config + * @return int + * + * @throws \InvalidArgumentException + */ + protected function level(array $config) + { + $level = $config['level'] ?? 'debug'; + + if (isset($this->levels[$level])) { + return $this->levels[$level]; + } + + throw new InvalidArgumentException('Invalid log level.'); + } + + /** + * Extract the log channel from the given configuration. + * + * @param array $config + * @return string + */ + protected function parseChannel(array $config) + { + return $config['name'] ?? $this->getFallbackChannelName(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Log/composer.json b/vendor/laravel/framework/src/Illuminate/Log/composer.json new file mode 100755 index 00000000..3bd21d0a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/composer.json @@ -0,0 +1,36 @@ +{ + "name": "illuminate/log", + "description": "The Illuminate Log package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0", + "monolog/monolog": "^1.12|^2.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Log\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php b/vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php new file mode 100644 index 00000000..bf5bccfd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php @@ -0,0 +1,33 @@ +data = $data; + $this->message = $message; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php b/vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php new file mode 100644 index 00000000..64aef943 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php @@ -0,0 +1,74 @@ +data = $data; + $this->message = $message; + } + + /** + * Get the serializable representation of the object. + * + * @return array + */ + public function __serialize() + { + $hasAttachments = collect($this->message->getChildren()) + ->whereInstanceOf(Swift_Attachment::class) + ->isNotEmpty(); + + return $hasAttachments ? [ + 'message' => base64_encode(serialize($this->message)), + 'data' => base64_encode(serialize($this->data)), + 'hasAttachments' => true, + ] : [ + 'message' => $this->message, + 'data' => $this->data, + 'hasAttachments' => false, + ]; + } + + /** + * Marshal the object from its serialized data. + * + * @param array $data + * @return void + */ + public function __unserialize(array $data) + { + if (isset($data['hasAttachments']) && $data['hasAttachments'] === true) { + $this->message = unserialize(base64_decode($data['message'])); + $this->data = unserialize(base64_decode($data['data'])); + } else { + $this->message = $data['message']; + $this->data = $data['data']; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Mail/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php new file mode 100755 index 00000000..0d123b89 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php @@ -0,0 +1,144 @@ +registerSwiftMailer(); + $this->registerIlluminateMailer(); + $this->registerMarkdownRenderer(); + } + + /** + * Register the Illuminate mailer instance. + * + * @return void + */ + protected function registerIlluminateMailer() + { + $this->app->singleton('mailer', function ($app) { + $config = $app->make('config')->get('mail'); + + // Once we have create the mailer instance, we will set a container instance + // on the mailer. This allows us to resolve mailer classes via containers + // for maximum testability on said classes instead of passing Closures. + $mailer = new Mailer( + $app['view'], $app['swift.mailer'], $app['events'] + ); + + if ($app->bound('queue')) { + $mailer->setQueue($app['queue']); + } + + // Next we will set all of the global addresses on this mailer, which allows + // for easy unification of all "from" addresses as well as easy debugging + // of sent messages since they get be sent into a single email address. + foreach (['from', 'reply_to', 'to'] as $type) { + $this->setGlobalAddress($mailer, $config, $type); + } + + return $mailer; + }); + } + + /** + * Set a global address on the mailer by type. + * + * @param \Illuminate\Mail\Mailer $mailer + * @param array $config + * @param string $type + * @return void + */ + protected function setGlobalAddress($mailer, array $config, $type) + { + $address = Arr::get($config, $type); + + if (is_array($address) && isset($address['address'])) { + $mailer->{'always'.Str::studly($type)}($address['address'], $address['name']); + } + } + + /** + * Register the Swift Mailer instance. + * + * @return void + */ + public function registerSwiftMailer() + { + $this->registerSwiftTransport(); + + // Once we have the transporter registered, we will register the actual Swift + // mailer instance, passing in the transport instances, which allows us to + // override this transporter instances during app start-up if necessary. + $this->app->singleton('swift.mailer', function ($app) { + if ($domain = $app->make('config')->get('mail.domain')) { + Swift_DependencyContainer::getInstance() + ->register('mime.idgenerator.idright') + ->asValue($domain); + } + + return new Swift_Mailer($app['swift.transport']->driver()); + }); + } + + /** + * Register the Swift Transport instance. + * + * @return void + */ + protected function registerSwiftTransport() + { + $this->app->singleton('swift.transport', function ($app) { + return new TransportManager($app); + }); + } + + /** + * Register the Markdown renderer instance. + * + * @return void + */ + protected function registerMarkdownRenderer() + { + if ($this->app->runningInConsole()) { + $this->publishes([ + __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/mail'), + ], 'laravel-mail'); + } + + $this->app->singleton(Markdown::class, function ($app) { + $config = $app->make('config'); + + return new Markdown($app->make('view'), [ + 'theme' => $config->get('mail.markdown.theme', 'default'), + 'paths' => $config->get('mail.markdown.paths', []), + ]); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'mailer', 'swift.mailer', 'swift.transport', Markdown::class, + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php b/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php new file mode 100644 index 00000000..177ef705 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php @@ -0,0 +1,864 @@ +withLocale($this->locale, function () use ($mailer) { + Container::getInstance()->call([$this, 'build']); + + return $mailer->send($this->buildView(), $this->buildViewData(), function ($message) { + $this->buildFrom($message) + ->buildRecipients($message) + ->buildSubject($message) + ->runCallbacks($message) + ->buildAttachments($message); + }); + }); + } + + /** + * Queue the message for sending. + * + * @param \Illuminate\Contracts\Queue\Factory $queue + * @return mixed + */ + public function queue(Queue $queue) + { + if (isset($this->delay)) { + return $this->later($this->delay, $queue); + } + + $connection = property_exists($this, 'connection') ? $this->connection : null; + + $queueName = property_exists($this, 'queue') ? $this->queue : null; + + return $queue->connection($connection)->pushOn( + $queueName ?: null, $this->newQueuedJob() + ); + } + + /** + * Deliver the queued message after the given delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param \Illuminate\Contracts\Queue\Factory $queue + * @return mixed + */ + public function later($delay, Queue $queue) + { + $connection = property_exists($this, 'connection') ? $this->connection : null; + + $queueName = property_exists($this, 'queue') ? $this->queue : null; + + return $queue->connection($connection)->laterOn( + $queueName ?: null, $delay, $this->newQueuedJob() + ); + } + + /** + * Make the queued mailable job instance. + * + * @return mixed + */ + protected function newQueuedJob() + { + return new SendQueuedMailable($this); + } + + /** + * Render the mailable into a view. + * + * @return string + * + * @throws \ReflectionException + */ + public function render() + { + return $this->withLocale($this->locale, function () { + Container::getInstance()->call([$this, 'build']); + + return Container::getInstance()->make('mailer')->render( + $this->buildView(), $this->buildViewData() + ); + }); + } + + /** + * Build the view for the message. + * + * @return array|string + * + * @throws \ReflectionException + */ + protected function buildView() + { + if (isset($this->html)) { + return array_filter([ + 'html' => new HtmlString($this->html), + 'text' => $this->textView ?? null, + ]); + } + + if (isset($this->markdown)) { + return $this->buildMarkdownView(); + } + + if (isset($this->view, $this->textView)) { + return [$this->view, $this->textView]; + } elseif (isset($this->textView)) { + return ['text' => $this->textView]; + } + + return $this->view; + } + + /** + * Build the Markdown view for the message. + * + * @return array + * + * @throws \ReflectionException + */ + protected function buildMarkdownView() + { + $markdown = Container::getInstance()->make(Markdown::class); + + if (isset($this->theme)) { + $markdown->theme($this->theme); + } + + $data = $this->buildViewData(); + + return [ + 'html' => $markdown->render($this->markdown, $data), + 'text' => $this->buildMarkdownText($markdown, $data), + ]; + } + + /** + * Build the view data for the message. + * + * @return array + * + * @throws \ReflectionException + */ + public function buildViewData() + { + $data = $this->viewData; + + if (static::$viewDataCallback) { + $data = array_merge($data, call_user_func(static::$viewDataCallback, $this)); + } + + foreach ((new ReflectionClass($this))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { + if ($property->getDeclaringClass()->getName() !== self::class) { + $data[$property->getName()] = $property->getValue($this); + } + } + + return $data; + } + + /** + * Build the text view for a Markdown message. + * + * @param \Illuminate\Mail\Markdown $markdown + * @param array $data + * @return string + */ + protected function buildMarkdownText($markdown, $data) + { + return $this->textView + ?? $markdown->renderText($this->markdown, $data); + } + + /** + * Add the sender to the message. + * + * @param \Illuminate\Mail\Message $message + * @return $this + */ + protected function buildFrom($message) + { + if (! empty($this->from)) { + $message->from($this->from[0]['address'], $this->from[0]['name']); + } + + return $this; + } + + /** + * Add all of the recipients to the message. + * + * @param \Illuminate\Mail\Message $message + * @return $this + */ + protected function buildRecipients($message) + { + foreach (['to', 'cc', 'bcc', 'replyTo'] as $type) { + foreach ($this->{$type} as $recipient) { + $message->{$type}($recipient['address'], $recipient['name']); + } + } + + return $this; + } + + /** + * Set the subject for the message. + * + * @param \Illuminate\Mail\Message $message + * @return $this + */ + protected function buildSubject($message) + { + if ($this->subject) { + $message->subject($this->subject); + } else { + $message->subject(Str::title(Str::snake(class_basename($this), ' '))); + } + + return $this; + } + + /** + * Add all of the attachments to the message. + * + * @param \Illuminate\Mail\Message $message + * @return $this + */ + protected function buildAttachments($message) + { + foreach ($this->attachments as $attachment) { + $message->attach($attachment['file'], $attachment['options']); + } + + foreach ($this->rawAttachments as $attachment) { + $message->attachData( + $attachment['data'], $attachment['name'], $attachment['options'] + ); + } + + $this->buildDiskAttachments($message); + + return $this; + } + + /** + * Add all of the disk attachments to the message. + * + * @param \Illuminate\Mail\Message $message + * @return void + */ + protected function buildDiskAttachments($message) + { + foreach ($this->diskAttachments as $attachment) { + $storage = Container::getInstance()->make( + FilesystemFactory::class + )->disk($attachment['disk']); + + $message->attachData( + $storage->get($attachment['path']), + $attachment['name'] ?? basename($attachment['path']), + array_merge(['mime' => $storage->mimeType($attachment['path'])], $attachment['options']) + ); + } + } + + /** + * Run the callbacks for the message. + * + * @param \Illuminate\Mail\Message $message + * @return $this + */ + protected function runCallbacks($message) + { + foreach ($this->callbacks as $callback) { + $callback($message->getSwiftMessage()); + } + + return $this; + } + + /** + * Set the locale of the message. + * + * @param string $locale + * @return $this + */ + public function locale($locale) + { + $this->locale = $locale; + + return $this; + } + + /** + * Set the priority of this message. + * + * The value is an integer where 1 is the highest priority and 5 is the lowest. + * + * @param int $level + * @return $this + */ + public function priority($level = 3) + { + $this->callbacks[] = function ($message) use ($level) { + $message->setPriority($level); + }; + + return $this; + } + + /** + * Set the sender of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return $this + */ + public function from($address, $name = null) + { + return $this->setAddress($address, $name, 'from'); + } + + /** + * Determine if the given recipient is set on the mailable. + * + * @param object|array|string $address + * @param string|null $name + * @return bool + */ + public function hasFrom($address, $name = null) + { + return $this->hasRecipient($address, $name, 'from'); + } + + /** + * Set the recipients of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return $this + */ + public function to($address, $name = null) + { + return $this->setAddress($address, $name, 'to'); + } + + /** + * Determine if the given recipient is set on the mailable. + * + * @param object|array|string $address + * @param string|null $name + * @return bool + */ + public function hasTo($address, $name = null) + { + return $this->hasRecipient($address, $name, 'to'); + } + + /** + * Set the recipients of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return $this + */ + public function cc($address, $name = null) + { + return $this->setAddress($address, $name, 'cc'); + } + + /** + * Determine if the given recipient is set on the mailable. + * + * @param object|array|string $address + * @param string|null $name + * @return bool + */ + public function hasCc($address, $name = null) + { + return $this->hasRecipient($address, $name, 'cc'); + } + + /** + * Set the recipients of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return $this + */ + public function bcc($address, $name = null) + { + return $this->setAddress($address, $name, 'bcc'); + } + + /** + * Determine if the given recipient is set on the mailable. + * + * @param object|array|string $address + * @param string|null $name + * @return bool + */ + public function hasBcc($address, $name = null) + { + return $this->hasRecipient($address, $name, 'bcc'); + } + + /** + * Set the "reply to" address of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return $this + */ + public function replyTo($address, $name = null) + { + return $this->setAddress($address, $name, 'replyTo'); + } + + /** + * Determine if the given replyTo is set on the mailable. + * + * @param object|array|string $address + * @param string|null $name + * @return bool + */ + public function hasReplyTo($address, $name = null) + { + return $this->hasRecipient($address, $name, 'replyTo'); + } + + /** + * Set the recipients of the message. + * + * All recipients are stored internally as [['name' => ?, 'address' => ?]] + * + * @param object|array|string $address + * @param string|null $name + * @param string $property + * @return $this + */ + protected function setAddress($address, $name = null, $property = 'to') + { + foreach ($this->addressesToArray($address, $name) as $recipient) { + $recipient = $this->normalizeRecipient($recipient); + + $this->{$property}[] = [ + 'name' => $recipient->name ?? null, + 'address' => $recipient->email, + ]; + } + + return $this; + } + + /** + * Convert the given recipient arguments to an array. + * + * @param object|array|string $address + * @param string|null $name + * @return array + */ + protected function addressesToArray($address, $name) + { + if (! is_array($address) && ! $address instanceof Collection) { + $address = is_string($name) ? [['name' => $name, 'email' => $address]] : [$address]; + } + + return $address; + } + + /** + * Convert the given recipient into an object. + * + * @param mixed $recipient + * @return object + */ + protected function normalizeRecipient($recipient) + { + if (is_array($recipient)) { + return (object) $recipient; + } elseif (is_string($recipient)) { + return (object) ['email' => $recipient]; + } + + return $recipient; + } + + /** + * Determine if the given recipient is set on the mailable. + * + * @param object|array|string $address + * @param string|null $name + * @param string $property + * @return bool + */ + protected function hasRecipient($address, $name = null, $property = 'to') + { + $expected = $this->normalizeRecipient( + $this->addressesToArray($address, $name)[0] + ); + + $expected = [ + 'name' => $expected->name ?? null, + 'address' => $expected->email, + ]; + + return collect($this->{$property})->contains(function ($actual) use ($expected) { + if (! isset($expected['name'])) { + return $actual['address'] == $expected['address']; + } + + return $actual == $expected; + }); + } + + /** + * Set the subject of the message. + * + * @param string $subject + * @return $this + */ + public function subject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * Set the Markdown template for the message. + * + * @param string $view + * @param array $data + * @return $this + */ + public function markdown($view, array $data = []) + { + $this->markdown = $view; + $this->viewData = array_merge($this->viewData, $data); + + return $this; + } + + /** + * Set the view and view data for the message. + * + * @param string $view + * @param array $data + * @return $this + */ + public function view($view, array $data = []) + { + $this->view = $view; + $this->viewData = array_merge($this->viewData, $data); + + return $this; + } + + /** + * Set the rendered HTML content for the message. + * + * @param string $html + * @return $this + */ + public function html($html) + { + $this->html = $html; + + return $this; + } + + /** + * Set the plain text view for the message. + * + * @param string $textView + * @param array $data + * @return $this + */ + public function text($textView, array $data = []) + { + $this->textView = $textView; + $this->viewData = array_merge($this->viewData, $data); + + return $this; + } + + /** + * Set the view data for the message. + * + * @param string|array $key + * @param mixed $value + * @return $this + */ + public function with($key, $value = null) + { + if (is_array($key)) { + $this->viewData = array_merge($this->viewData, $key); + } else { + $this->viewData[$key] = $value; + } + + return $this; + } + + /** + * Attach a file to the message. + * + * @param string $file + * @param array $options + * @return $this + */ + public function attach($file, array $options = []) + { + $this->attachments = collect($this->attachments) + ->push(compact('file', 'options')) + ->unique('file') + ->all(); + + return $this; + } + + /** + * Attach a file to the message from storage. + * + * @param string $path + * @param string|null $name + * @param array $options + * @return $this + */ + public function attachFromStorage($path, $name = null, array $options = []) + { + return $this->attachFromStorageDisk(null, $path, $name, $options); + } + + /** + * Attach a file to the message from storage. + * + * @param string $disk + * @param string $path + * @param string|null $name + * @param array $options + * @return $this + */ + public function attachFromStorageDisk($disk, $path, $name = null, array $options = []) + { + $this->diskAttachments = collect($this->diskAttachments)->push([ + 'disk' => $disk, + 'path' => $path, + 'name' => $name ?? basename($path), + 'options' => $options, + ])->unique(function ($file) { + return $file['name'].$file['disk'].$file['path']; + })->all(); + + return $this; + } + + /** + * Attach in-memory data as an attachment. + * + * @param string $data + * @param string $name + * @param array $options + * @return $this + */ + public function attachData($data, $name, array $options = []) + { + $this->rawAttachments = collect($this->rawAttachments) + ->push(compact('data', 'name', 'options')) + ->unique(function ($file) { + return $file['name'].$file['data']; + })->all(); + + return $this; + } + + /** + * Register a callback to be called with the Swift message instance. + * + * @param callable $callback + * @return $this + */ + public function withSwiftMessage($callback) + { + $this->callbacks[] = $callback; + + return $this; + } + + /** + * Register a callback to be called while building the view data. + * + * @param callable $callback + * @return void + */ + public static function buildViewDataUsing(callable $callback) + { + static::$viewDataCallback = $callback; + } + + /** + * Dynamically bind parameters to the message. + * + * @param string $method + * @param array $parameters + * @return $this + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (Str::startsWith($method, 'with')) { + return $this->with(Str::camel(substr($method, 4)), $parameters[0]); + } + + static::throwBadMethodCallException($method); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php b/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php new file mode 100755 index 00000000..7a11e58f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php @@ -0,0 +1,593 @@ +views = $views; + $this->swift = $swift; + $this->events = $events; + } + + /** + * Set the global from address and name. + * + * @param string $address + * @param string|null $name + * @return void + */ + public function alwaysFrom($address, $name = null) + { + $this->from = compact('address', 'name'); + } + + /** + * Set the global reply-to address and name. + * + * @param string $address + * @param string|null $name + * @return void + */ + public function alwaysReplyTo($address, $name = null) + { + $this->replyTo = compact('address', 'name'); + } + + /** + * Set the global to address and name. + * + * @param string $address + * @param string|null $name + * @return void + */ + public function alwaysTo($address, $name = null) + { + $this->to = compact('address', 'name'); + } + + /** + * Begin the process of mailing a mailable class instance. + * + * @param mixed $users + * @return \Illuminate\Mail\PendingMail + */ + public function to($users) + { + return (new PendingMail($this))->to($users); + } + + /** + * Begin the process of mailing a mailable class instance. + * + * @param mixed $users + * @return \Illuminate\Mail\PendingMail + */ + public function cc($users) + { + return (new PendingMail($this))->cc($users); + } + + /** + * Begin the process of mailing a mailable class instance. + * + * @param mixed $users + * @return \Illuminate\Mail\PendingMail + */ + public function bcc($users) + { + return (new PendingMail($this))->bcc($users); + } + + /** + * Send a new message with only an HTML part. + * + * @param string $html + * @param mixed $callback + * @return void + */ + public function html($html, $callback) + { + return $this->send(['html' => new HtmlString($html)], [], $callback); + } + + /** + * Send a new message with only a raw text part. + * + * @param string $text + * @param mixed $callback + * @return void + */ + public function raw($text, $callback) + { + return $this->send(['raw' => $text], [], $callback); + } + + /** + * Send a new message with only a plain part. + * + * @param string $view + * @param array $data + * @param mixed $callback + * @return void + */ + public function plain($view, array $data, $callback) + { + return $this->send(['text' => $view], $data, $callback); + } + + /** + * Render the given message as a view. + * + * @param string|array $view + * @param array $data + * @return string + */ + public function render($view, array $data = []) + { + // First we need to parse the view, which could either be a string or an array + // containing both an HTML and plain text versions of the view which should + // be used when sending an e-mail. We will extract both of them out here. + [$view, $plain, $raw] = $this->parseView($view); + + $data['message'] = $this->createMessage(); + + return $this->renderView($view ?: $plain, $data); + } + + /** + * Send a new message using a view. + * + * @param \Illuminate\Contracts\Mail\Mailable|string|array $view + * @param array $data + * @param \Closure|string|null $callback + * @return void + */ + public function send($view, array $data = [], $callback = null) + { + if ($view instanceof MailableContract) { + return $this->sendMailable($view); + } + + // First we need to parse the view, which could either be a string or an array + // containing both an HTML and plain text versions of the view which should + // be used when sending an e-mail. We will extract both of them out here. + [$view, $plain, $raw] = $this->parseView($view); + + $data['message'] = $message = $this->createMessage(); + + // Once we have retrieved the view content for the e-mail we will set the body + // of this message using the HTML type, which will provide a simple wrapper + // to creating view based emails that are able to receive arrays of data. + $callback($message); + + $this->addContent($message, $view, $plain, $raw, $data); + + // If a global "to" address has been set, we will set that address on the mail + // message. This is primarily useful during local development in which each + // message should be delivered into a single mail address for inspection. + if (isset($this->to['address'])) { + $this->setGlobalToAndRemoveCcAndBcc($message); + } + + // Next we will determine if the message should be sent. We give the developer + // one final chance to stop this message and then we will send it to all of + // its recipients. We will then fire the sent event for the sent message. + $swiftMessage = $message->getSwiftMessage(); + + if ($this->shouldSendMessage($swiftMessage, $data)) { + $this->sendSwiftMessage($swiftMessage); + + $this->dispatchSentEvent($message, $data); + } + } + + /** + * Send the given mailable. + * + * @param \Illuminate\Contracts\Mail\Mailable $mailable + * @return mixed + */ + protected function sendMailable(MailableContract $mailable) + { + return $mailable instanceof ShouldQueue + ? $mailable->queue($this->queue) + : $mailable->send($this); + } + + /** + * Parse the given view name or array. + * + * @param string|array $view + * @return array + * + * @throws \InvalidArgumentException + */ + protected function parseView($view) + { + if (is_string($view)) { + return [$view, null, null]; + } + + // If the given view is an array with numeric keys, we will just assume that + // both a "pretty" and "plain" view were provided, so we will return this + // array as is, since it should contain both views with numerical keys. + if (is_array($view) && isset($view[0])) { + return [$view[0], $view[1], null]; + } + + // If this view is an array but doesn't contain numeric keys, we will assume + // the views are being explicitly specified and will extract them via the + // named keys instead, allowing the developers to use one or the other. + if (is_array($view)) { + return [ + $view['html'] ?? null, + $view['text'] ?? null, + $view['raw'] ?? null, + ]; + } + + throw new InvalidArgumentException('Invalid view.'); + } + + /** + * Add the content to a given message. + * + * @param \Illuminate\Mail\Message $message + * @param string $view + * @param string $plain + * @param string $raw + * @param array $data + * @return void + */ + protected function addContent($message, $view, $plain, $raw, $data) + { + if (isset($view)) { + $message->setBody($this->renderView($view, $data) ?: ' ', 'text/html'); + } + + if (isset($plain)) { + $method = isset($view) ? 'addPart' : 'setBody'; + + $message->$method($this->renderView($plain, $data) ?: ' ', 'text/plain'); + } + + if (isset($raw)) { + $method = (isset($view) || isset($plain)) ? 'addPart' : 'setBody'; + + $message->$method($raw, 'text/plain'); + } + } + + /** + * Render the given view. + * + * @param string $view + * @param array $data + * @return string + */ + protected function renderView($view, $data) + { + return $view instanceof Htmlable + ? $view->toHtml() + : $this->views->make($view, $data)->render(); + } + + /** + * Set the global "to" address on the given message. + * + * @param \Illuminate\Mail\Message $message + * @return void + */ + protected function setGlobalToAndRemoveCcAndBcc($message) + { + $message->to($this->to['address'], $this->to['name'], true); + $message->cc(null, null, true); + $message->bcc(null, null, true); + } + + /** + * Queue a new e-mail message for sending. + * + * @param \Illuminate\Contracts\Mail\Mailable|string|array $view + * @param string|null $queue + * @return mixed + * + * @throws \InvalidArgumentException + */ + public function queue($view, $queue = null) + { + if (! $view instanceof MailableContract) { + throw new InvalidArgumentException('Only mailables may be queued.'); + } + + if (is_string($queue)) { + $view->onQueue($queue); + } + + return $view->queue($this->queue); + } + + /** + * Queue a new e-mail message for sending on the given queue. + * + * @param string $queue + * @param \Illuminate\Contracts\Mail\Mailable $view + * @return mixed + */ + public function onQueue($queue, $view) + { + return $this->queue($view, $queue); + } + + /** + * Queue a new e-mail message for sending on the given queue. + * + * This method didn't match rest of framework's "onQueue" phrasing. Added "onQueue". + * + * @param string $queue + * @param \Illuminate\Contracts\Mail\Mailable $view + * @return mixed + */ + public function queueOn($queue, $view) + { + return $this->onQueue($queue, $view); + } + + /** + * Queue a new e-mail message for sending after (n) seconds. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param \Illuminate\Contracts\Mail\Mailable $view + * @param string|null $queue + * @return mixed + * + * @throws \InvalidArgumentException + */ + public function later($delay, $view, $queue = null) + { + if (! $view instanceof MailableContract) { + throw new InvalidArgumentException('Only mailables may be queued.'); + } + + return $view->later($delay, is_null($queue) ? $this->queue : $queue); + } + + /** + * Queue a new e-mail message for sending after (n) seconds on the given queue. + * + * @param string $queue + * @param \DateTimeInterface|\DateInterval|int $delay + * @param \Illuminate\Contracts\Mail\Mailable $view + * @return mixed + */ + public function laterOn($queue, $delay, $view) + { + return $this->later($delay, $view, $queue); + } + + /** + * Create a new message instance. + * + * @return \Illuminate\Mail\Message + */ + protected function createMessage() + { + $message = new Message($this->swift->createMessage('message')); + + // If a global from address has been specified we will set it on every message + // instance so the developer does not have to repeat themselves every time + // they create a new message. We'll just go ahead and push this address. + if (! empty($this->from['address'])) { + $message->from($this->from['address'], $this->from['name']); + } + + // When a global reply address was specified we will set this on every message + // instance so the developer does not have to repeat themselves every time + // they create a new message. We will just go ahead and push this address. + if (! empty($this->replyTo['address'])) { + $message->replyTo($this->replyTo['address'], $this->replyTo['name']); + } + + return $message; + } + + /** + * Send a Swift Message instance. + * + * @param \Swift_Message $message + * @return int|null + */ + protected function sendSwiftMessage($message) + { + $this->failedRecipients = []; + + try { + return $this->swift->send($message, $this->failedRecipients); + } finally { + $this->forceReconnection(); + } + } + + /** + * Determines if the message can be sent. + * + * @param \Swift_Message $message + * @param array $data + * @return bool + */ + protected function shouldSendMessage($message, $data = []) + { + if (! $this->events) { + return true; + } + + return $this->events->until( + new MessageSending($message, $data) + ) !== false; + } + + /** + * Dispatch the message sent event. + * + * @param \Illuminate\Mail\Message $message + * @param array $data + * @return void + */ + protected function dispatchSentEvent($message, $data = []) + { + if ($this->events) { + $this->events->dispatch( + new MessageSent($message->getSwiftMessage(), $data) + ); + } + } + + /** + * Force the transport to re-connect. + * + * This will prevent errors in daemon queue situations. + * + * @return void + */ + protected function forceReconnection() + { + $this->getSwiftMailer()->getTransport()->stop(); + } + + /** + * Get the array of failed recipients. + * + * @return array + */ + public function failures() + { + return $this->failedRecipients; + } + + /** + * Get the Swift Mailer instance. + * + * @return \Swift_Mailer + */ + public function getSwiftMailer() + { + return $this->swift; + } + + /** + * Get the view factory instance. + * + * @return \Illuminate\Contracts\View\Factory + */ + public function getViewFactory() + { + return $this->views; + } + + /** + * Set the Swift Mailer instance. + * + * @param \Swift_Mailer $swift + * @return void + */ + public function setSwiftMailer($swift) + { + $this->swift = $swift; + } + + /** + * Set the queue manager instance. + * + * @param \Illuminate\Contracts\Queue\Factory $queue + * @return $this + */ + public function setQueue(QueueContract $queue) + { + $this->queue = $queue; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Markdown.php b/vendor/laravel/framework/src/Illuminate/Mail/Markdown.php new file mode 100644 index 00000000..65b6bdeb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Markdown.php @@ -0,0 +1,173 @@ +view = $view; + $this->theme = $options['theme'] ?? 'default'; + $this->loadComponentsFrom($options['paths'] ?? []); + } + + /** + * Render the Markdown template into HTML. + * + * @param string $view + * @param array $data + * @param \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles|null $inliner + * @return \Illuminate\Support\HtmlString + */ + public function render($view, array $data = [], $inliner = null) + { + $this->view->flushFinderCache(); + + $contents = $this->view->replaceNamespace( + 'mail', $this->htmlComponentPaths() + )->make($view, $data)->render(); + + $theme = Str::contains($this->theme, '::') + ? $this->theme + : 'mail::themes.'.$this->theme; + + return new HtmlString(($inliner ?: new CssToInlineStyles)->convert( + $contents, $this->view->make($theme, $data)->render() + )); + } + + /** + * Render the Markdown template into text. + * + * @param string $view + * @param array $data + * @return \Illuminate\Support\HtmlString + */ + public function renderText($view, array $data = []) + { + $this->view->flushFinderCache(); + + $contents = $this->view->replaceNamespace( + 'mail', $this->textComponentPaths() + )->make($view, $data)->render(); + + return new HtmlString( + html_entity_decode(preg_replace("/[\r\n]{2,}/", "\n\n", $contents), ENT_QUOTES, 'UTF-8') + ); + } + + /** + * Parse the given Markdown text into HTML. + * + * @param string $text + * @return \Illuminate\Support\HtmlString + */ + public static function parse($text) + { + $environment = Environment::createCommonMarkEnvironment(); + + $environment->addExtension(new TableExtension); + + $converter = new CommonMarkConverter([ + 'allow_unsafe_links' => false, + ], $environment); + + return new HtmlString($converter->convertToHtml($text)); + } + + /** + * Get the HTML component paths. + * + * @return array + */ + public function htmlComponentPaths() + { + return array_map(function ($path) { + return $path.'/html'; + }, $this->componentPaths()); + } + + /** + * Get the text component paths. + * + * @return array + */ + public function textComponentPaths() + { + return array_map(function ($path) { + return $path.'/text'; + }, $this->componentPaths()); + } + + /** + * Get the component paths. + * + * @return array + */ + protected function componentPaths() + { + return array_unique(array_merge($this->componentPaths, [ + __DIR__.'/resources/views', + ])); + } + + /** + * Register new mail component paths. + * + * @param array $paths + * @return void + */ + public function loadComponentsFrom(array $paths = []) + { + $this->componentPaths = $paths; + } + + /** + * Set the default theme to be used. + * + * @param string $theme + * @return $this + */ + public function theme($theme) + { + $this->theme = $theme; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Message.php b/vendor/laravel/framework/src/Illuminate/Mail/Message.php new file mode 100755 index 00000000..d701fba9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Message.php @@ -0,0 +1,329 @@ +swift = $swift; + } + + /** + * Add a "from" address to the message. + * + * @param string|array $address + * @param string|null $name + * @return $this + */ + public function from($address, $name = null) + { + $this->swift->setFrom($address, $name); + + return $this; + } + + /** + * Set the "sender" of the message. + * + * @param string|array $address + * @param string|null $name + * @return $this + */ + public function sender($address, $name = null) + { + $this->swift->setSender($address, $name); + + return $this; + } + + /** + * Set the "return path" of the message. + * + * @param string $address + * @return $this + */ + public function returnPath($address) + { + $this->swift->setReturnPath($address); + + return $this; + } + + /** + * Add a recipient to the message. + * + * @param string|array $address + * @param string|null $name + * @param bool $override + * @return $this + */ + public function to($address, $name = null, $override = false) + { + if ($override) { + $this->swift->setTo($address, $name); + + return $this; + } + + return $this->addAddresses($address, $name, 'To'); + } + + /** + * Add a carbon copy to the message. + * + * @param string|array $address + * @param string|null $name + * @param bool $override + * @return $this + */ + public function cc($address, $name = null, $override = false) + { + if ($override) { + $this->swift->setCc($address, $name); + + return $this; + } + + return $this->addAddresses($address, $name, 'Cc'); + } + + /** + * Add a blind carbon copy to the message. + * + * @param string|array $address + * @param string|null $name + * @param bool $override + * @return $this + */ + public function bcc($address, $name = null, $override = false) + { + if ($override) { + $this->swift->setBcc($address, $name); + + return $this; + } + + return $this->addAddresses($address, $name, 'Bcc'); + } + + /** + * Add a reply to address to the message. + * + * @param string|array $address + * @param string|null $name + * @return $this + */ + public function replyTo($address, $name = null) + { + return $this->addAddresses($address, $name, 'ReplyTo'); + } + + /** + * Add a recipient to the message. + * + * @param string|array $address + * @param string $name + * @param string $type + * @return $this + */ + protected function addAddresses($address, $name, $type) + { + if (is_array($address)) { + $this->swift->{"set{$type}"}($address, $name); + } else { + $this->swift->{"add{$type}"}($address, $name); + } + + return $this; + } + + /** + * Set the subject of the message. + * + * @param string $subject + * @return $this + */ + public function subject($subject) + { + $this->swift->setSubject($subject); + + return $this; + } + + /** + * Set the message priority level. + * + * @param int $level + * @return $this + */ + public function priority($level) + { + $this->swift->setPriority($level); + + return $this; + } + + /** + * Attach a file to the message. + * + * @param string $file + * @param array $options + * @return $this + */ + public function attach($file, array $options = []) + { + $attachment = $this->createAttachmentFromPath($file); + + return $this->prepAttachment($attachment, $options); + } + + /** + * Create a Swift Attachment instance. + * + * @param string $file + * @return \Swift_Mime_Attachment + */ + protected function createAttachmentFromPath($file) + { + return Swift_Attachment::fromPath($file); + } + + /** + * Attach in-memory data as an attachment. + * + * @param string $data + * @param string $name + * @param array $options + * @return $this + */ + public function attachData($data, $name, array $options = []) + { + $attachment = $this->createAttachmentFromData($data, $name); + + return $this->prepAttachment($attachment, $options); + } + + /** + * Create a Swift Attachment instance from data. + * + * @param string $data + * @param string $name + * @return \Swift_Attachment + */ + protected function createAttachmentFromData($data, $name) + { + return new Swift_Attachment($data, $name); + } + + /** + * Embed a file in the message and get the CID. + * + * @param string $file + * @return string + */ + public function embed($file) + { + if (isset($this->embeddedFiles[$file])) { + return $this->embeddedFiles[$file]; + } + + return $this->embeddedFiles[$file] = $this->swift->embed( + Swift_Image::fromPath($file) + ); + } + + /** + * Embed in-memory data in the message and get the CID. + * + * @param string $data + * @param string $name + * @param string|null $contentType + * @return string + */ + public function embedData($data, $name, $contentType = null) + { + $image = new Swift_Image($data, $name, $contentType); + + return $this->swift->embed($image); + } + + /** + * Prepare and attach the given attachment. + * + * @param \Swift_Attachment $attachment + * @param array $options + * @return $this + */ + protected function prepAttachment($attachment, $options = []) + { + // First we will check for a MIME type on the message, which instructs the + // mail client on what type of attachment the file is so that it may be + // downloaded correctly by the user. The MIME option is not required. + if (isset($options['mime'])) { + $attachment->setContentType($options['mime']); + } + + // If an alternative name was given as an option, we will set that on this + // attachment so that it will be downloaded with the desired names from + // the developer, otherwise the default file names will get assigned. + if (isset($options['as'])) { + $attachment->setFilename($options['as']); + } + + $this->swift->attach($attachment); + + return $this; + } + + /** + * Get the underlying Swift Message instance. + * + * @return \Swift_Message + */ + public function getSwiftMessage() + { + return $this->swift; + } + + /** + * Dynamically pass missing methods to the Swift instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->forwardCallTo($this->swift, $method, $parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php b/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php new file mode 100644 index 00000000..6124b3a0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php @@ -0,0 +1,176 @@ +mailer = $mailer; + } + + /** + * Set the locale of the message. + * + * @param string $locale + * @return $this + */ + public function locale($locale) + { + $this->locale = $locale; + + return $this; + } + + /** + * Set the recipients of the message. + * + * @param mixed $users + * @return $this + */ + public function to($users) + { + $this->to = $users; + + if (! $this->locale && $users instanceof HasLocalePreference) { + $this->locale($users->preferredLocale()); + } + + return $this; + } + + /** + * Set the recipients of the message. + * + * @param mixed $users + * @return $this + */ + public function cc($users) + { + $this->cc = $users; + + return $this; + } + + /** + * Set the recipients of the message. + * + * @param mixed $users + * @return $this + */ + public function bcc($users) + { + $this->bcc = $users; + + return $this; + } + + /** + * Send a new mailable message instance. + * + * @param \Illuminate\Contracts\Mail\Mailable $mailable + * @return mixed + */ + public function send(MailableContract $mailable) + { + return $this->mailer->send($this->fill($mailable)); + } + + /** + * Send a mailable message immediately. + * + * @param \Illuminate\Contracts\Mail\Mailable $mailable + * @return mixed + * + * @deprecated Use send() instead. + */ + public function sendNow(MailableContract $mailable) + { + return $this->mailer->send($this->fill($mailable)); + } + + /** + * Push the given mailable onto the queue. + * + * @param \Illuminate\Contracts\Mail\Mailable $mailable + * @return mixed + */ + public function queue(MailableContract $mailable) + { + return $this->mailer->queue($this->fill($mailable)); + } + + /** + * Deliver the queued message after the given delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param \Illuminate\Contracts\Mail\Mailable $mailable + * @return mixed + */ + public function later($delay, MailableContract $mailable) + { + return $this->mailer->later($delay, $this->fill($mailable)); + } + + /** + * Populate the mailable with the addresses. + * + * @param \Illuminate\Contracts\Mail\Mailable $mailable + * @return \Illuminate\Mail\Mailable + */ + protected function fill(MailableContract $mailable) + { + return tap($mailable->to($this->to) + ->cc($this->cc) + ->bcc($this->bcc), function ($mailable) { + if ($this->locale) { + $mailable->locale($this->locale); + } + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php b/vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php new file mode 100644 index 00000000..29198093 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php @@ -0,0 +1,101 @@ +mailable = $mailable; + $this->tries = property_exists($mailable, 'tries') ? $mailable->tries : null; + $this->timeout = property_exists($mailable, 'timeout') ? $mailable->timeout : null; + } + + /** + * Handle the queued job. + * + * @param \Illuminate\Contracts\Mail\Mailer $mailer + * @return void + */ + public function handle(MailerContract $mailer) + { + $this->mailable->send($mailer); + } + + /** + * Get the display name for the queued job. + * + * @return string + */ + public function displayName() + { + return get_class($this->mailable); + } + + /** + * Call the failed method on the mailable instance. + * + * @param \Exception $e + * @return void + */ + public function failed($e) + { + if (method_exists($this->mailable, 'failed')) { + $this->mailable->failed($e); + } + } + + /** + * Get the retry delay for the mailable object. + * + * @return mixed + */ + public function retryAfter() + { + if (! method_exists($this->mailable, 'retryAfter') && ! isset($this->mailable->retryAfter)) { + return; + } + + return $this->mailable->retryAfter ?? $this->mailable->retryAfter(); + } + + /** + * Prepare the instance for cloning. + * + * @return void + */ + public function __clone() + { + $this->mailable = clone $this->mailable; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/ArrayTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/ArrayTransport.php new file mode 100644 index 00000000..fbedec95 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Transport/ArrayTransport.php @@ -0,0 +1,58 @@ +messages = new Collection; + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $this->messages[] = $message; + + return $this->numberOfRecipients($message); + } + + /** + * Retrieve the collection of messages. + * + * @return \Illuminate\Support\Collection + */ + public function messages() + { + return $this->messages; + } + + /** + * Clear all of the messages from the local collection. + * + * @return \Illuminate\Support\Collection + */ + public function flush() + { + return $this->messages = new Collection; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php new file mode 100644 index 00000000..43a2faa2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php @@ -0,0 +1,69 @@ +logger = $logger; + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $this->logger->debug($this->getMimeEntityString($message)); + + $this->sendPerformed($message); + + return $this->numberOfRecipients($message); + } + + /** + * Get a loggable string out of a Swiftmailer entity. + * + * @param \Swift_Mime_SimpleMimeEntity $entity + * @return string + */ + protected function getMimeEntityString(Swift_Mime_SimpleMimeEntity $entity) + { + $string = (string) $entity->getHeaders().PHP_EOL.$entity->getBody(); + + foreach ($entity->getChildren() as $children) { + $string .= PHP_EOL.PHP_EOL.$this->getMimeEntityString($children); + } + + return $string; + } + + /** + * Get the logger for the LogTransport instance. + * + * @return \Psr\Log\LoggerInterface + */ + public function logger() + { + return $this->logger; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php new file mode 100644 index 00000000..195c0003 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php @@ -0,0 +1,215 @@ +key = $key; + $this->client = $client; + $this->endpoint = $endpoint ?? 'api.mailgun.net'; + + $this->setDomain($domain); + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $to = $this->getTo($message); + + $bcc = $message->getBcc(); + + $message->setBcc([]); + + $response = $this->client->request( + 'POST', + "https://{$this->endpoint}/v3/{$this->domain}/messages.mime", + $this->payload($message, $to) + ); + + $message->getHeaders()->addTextHeader( + 'X-Mailgun-Message-ID', $this->getMessageId($response) + ); + + $message->setBcc($bcc); + + $this->sendPerformed($message); + + return $this->numberOfRecipients($message); + } + + /** + * Get the HTTP payload for sending the Mailgun message. + * + * @param \Swift_Mime_SimpleMessage $message + * @param string $to + * @return array + */ + protected function payload(Swift_Mime_SimpleMessage $message, $to) + { + return [ + 'auth' => [ + 'api', + $this->key, + ], + 'multipart' => [ + [ + 'name' => 'to', + 'contents' => $to, + ], + [ + 'name' => 'message', + 'contents' => $message->toString(), + 'filename' => 'message.mime', + ], + ], + ]; + } + + /** + * Get the "to" payload field for the API request. + * + * @param \Swift_Mime_SimpleMessage $message + * @return string + */ + protected function getTo(Swift_Mime_SimpleMessage $message) + { + return collect($this->allContacts($message))->map(function ($display, $address) { + return $display ? $display." <{$address}>" : $address; + })->values()->implode(','); + } + + /** + * Get all of the contacts for the message. + * + * @param \Swift_Mime_SimpleMessage $message + * @return array + */ + protected function allContacts(Swift_Mime_SimpleMessage $message) + { + return array_merge( + (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc() + ); + } + + /** + * Get the message ID from the response. + * + * @param \Psr\Http\Message\ResponseInterface $response + * @return string + */ + protected function getMessageId($response) + { + return object_get( + json_decode($response->getBody()->getContents()), 'id' + ); + } + + /** + * Get the API key being used by the transport. + * + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Set the API key being used by the transport. + * + * @param string $key + * @return string + */ + public function setKey($key) + { + return $this->key = $key; + } + + /** + * Get the domain being used by the transport. + * + * @return string + */ + public function getDomain() + { + return $this->domain; + } + + /** + * Set the domain being used by the transport. + * + * @param string $domain + * @return string + */ + public function setDomain($domain) + { + return $this->domain = $domain; + } + + /** + * Get the API endpoint being used by the transport. + * + * @return string + */ + public function getEndpoint() + { + return $this->endpoint; + } + + /** + * Set the API endpoint being used by the transport. + * + * @param string $endpoint + * @return string + */ + public function setEndpoint($endpoint) + { + return $this->endpoint = $endpoint; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php new file mode 100644 index 00000000..0dc8584a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php @@ -0,0 +1,92 @@ +ses = $ses; + $this->options = $options; + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $result = $this->ses->sendRawEmail( + array_merge( + $this->options, [ + 'Source' => key($message->getSender() ?: $message->getFrom()), + 'RawMessage' => [ + 'Data' => $message->toString(), + ], + ] + ) + ); + + $message->getHeaders()->addTextHeader('X-SES-Message-ID', $result->get('MessageId')); + + $this->sendPerformed($message); + + return $this->numberOfRecipients($message); + } + + /** + * Get the Amazon SES client for the SesTransport instance. + * + * @return \Aws\Ses\SesClient + */ + public function ses() + { + return $this->ses; + } + + /** + * Get the transmission options being used by the transport. + * + * @return array + */ + public function getOptions() + { + return $this->options; + } + + /** + * Set the transmission options being used by the transport. + * + * @param array $options + * @return array + */ + public function setOptions(array $options) + { + return $this->options = $options; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php new file mode 100644 index 00000000..b26bff3f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php @@ -0,0 +1,108 @@ +plugins, $plugin); + } + + /** + * Iterate through registered plugins and execute plugins' methods. + * + * @param \Swift_Mime_SimpleMessage $message + * @return void + */ + protected function beforeSendPerformed(Swift_Mime_SimpleMessage $message) + { + $event = new Swift_Events_SendEvent($this, $message); + + foreach ($this->plugins as $plugin) { + if (method_exists($plugin, 'beforeSendPerformed')) { + $plugin->beforeSendPerformed($event); + } + } + } + + /** + * Iterate through registered plugins and execute plugins' methods. + * + * @param \Swift_Mime_SimpleMessage $message + * @return void + */ + protected function sendPerformed(Swift_Mime_SimpleMessage $message) + { + $event = new Swift_Events_SendEvent($this, $message); + + foreach ($this->plugins as $plugin) { + if (method_exists($plugin, 'sendPerformed')) { + $plugin->sendPerformed($event); + } + } + } + + /** + * Get the number of recipients. + * + * @param \Swift_Mime_SimpleMessage $message + * @return int + */ + protected function numberOfRecipients(Swift_Mime_SimpleMessage $message) + { + return count(array_merge( + (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc() + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php b/vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php new file mode 100644 index 00000000..e711bc5d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php @@ -0,0 +1,218 @@ +config->get('mail'); + + // The Swift SMTP transport instance will allow us to use any SMTP backend + // for delivering mail such as Sendgrid, Amazon SES, or a custom server + // a developer has available. We will just pass this configured host. + $transport = new SmtpTransport($config['host'], $config['port']); + + if (! empty($config['encryption'])) { + $transport->setEncryption($config['encryption']); + } + + // Once we have the transport we will check for the presence of a username + // and password. If we have it we will set the credentials on the Swift + // transporter instance so that we'll properly authenticate delivery. + if (isset($config['username'])) { + $transport->setUsername($config['username']); + + $transport->setPassword($config['password']); + } + + return $this->configureSmtpDriver($transport, $config); + } + + /** + * Configure the additional SMTP driver options. + * + * @param \Swift_SmtpTransport $transport + * @param array $config + * @return \Swift_SmtpTransport + */ + protected function configureSmtpDriver($transport, $config) + { + if (isset($config['stream'])) { + $transport->setStreamOptions($config['stream']); + } + + if (isset($config['source_ip'])) { + $transport->setSourceIp($config['source_ip']); + } + + if (isset($config['local_domain'])) { + $transport->setLocalDomain($config['local_domain']); + } + + return $transport; + } + + /** + * Create an instance of the Sendmail Swift Transport driver. + * + * @return \Swift_SendmailTransport + */ + protected function createSendmailDriver() + { + return new SendmailTransport($this->config->get('mail.sendmail')); + } + + /** + * Create an instance of the Amazon SES Swift Transport driver. + * + * @return \Illuminate\Mail\Transport\SesTransport + */ + protected function createSesDriver() + { + $config = array_merge($this->config->get('services.ses', []), [ + 'version' => 'latest', 'service' => 'email', + ]); + + return new SesTransport( + new SesClient($this->addSesCredentials($config)), + $config['options'] ?? [] + ); + } + + /** + * Add the SES credentials to the configuration array. + * + * @param array $config + * @return array + */ + protected function addSesCredentials(array $config) + { + if (! empty($config['key']) && ! empty($config['secret'])) { + $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); + } + + return $config; + } + + /** + * Create an instance of the Mail Swift Transport driver. + * + * @return \Swift_SendmailTransport + */ + protected function createMailDriver() + { + return new SendmailTransport; + } + + /** + * Create an instance of the Mailgun Swift Transport driver. + * + * @return \Illuminate\Mail\Transport\MailgunTransport + */ + protected function createMailgunDriver() + { + $config = $this->config->get('services.mailgun', []); + + return new MailgunTransport( + $this->guzzle($config), + $config['secret'], + $config['domain'], + $config['endpoint'] ?? null + ); + } + + /** + * Create an instance of the Postmark Swift Transport driver. + * + * @return \Swift_Transport + */ + protected function createPostmarkDriver() + { + return tap(new PostmarkTransport( + $this->config->get('services.postmark.token') + ), function ($transport) { + $transport->registerPlugin(new ThrowExceptionOnFailurePlugin()); + }); + } + + /** + * Create an instance of the Log Swift Transport driver. + * + * @return \Illuminate\Mail\Transport\LogTransport + */ + protected function createLogDriver() + { + $logger = $this->container->make(LoggerInterface::class); + + if ($logger instanceof LogManager) { + $logger = $logger->channel($this->config->get('mail.log_channel')); + } + + return new LogTransport($logger); + } + + /** + * Create an instance of the Array Swift Transport Driver. + * + * @return \Illuminate\Mail\Transport\ArrayTransport + */ + protected function createArrayDriver() + { + return new ArrayTransport; + } + + /** + * Get a fresh Guzzle HTTP client instance. + * + * @param array $config + * @return \GuzzleHttp\Client + */ + protected function guzzle($config) + { + return new HttpClient(Arr::add( + $config['guzzle'] ?? [], 'connect_timeout', 60 + )); + } + + /** + * Get the default mail driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->config->get('mail.driver'); + } + + /** + * Set the default mail driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->config->set('mail.driver', $name); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/composer.json b/vendor/laravel/framework/src/Illuminate/Mail/composer.json new file mode 100755 index 00000000..dfe6100d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/composer.json @@ -0,0 +1,46 @@ +{ + "name": "illuminate/mail", + "description": "The Illuminate Mail package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "ext-json": "*", + "illuminate/container": "^6.0", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0", + "league/commonmark": "^1.3", + "psr/log": "^1.0", + "swiftmailer/swiftmailer": "^6.0", + "tijsverkoyen/css-to-inline-styles": "^2.2.1" + }, + "autoload": { + "psr-4": { + "Illuminate\\Mail\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "suggest": { + "aws/aws-sdk-php": "Required to use the SES mail driver (^3.155).", + "guzzlehttp/guzzle": "Required to use the Mailgun mail driver (^6.3.1|^7.0.1).", + "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/button.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/button.blade.php new file mode 100644 index 00000000..d760329c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/button.blade.php @@ -0,0 +1,19 @@ +
+ + + + diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/footer.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/footer.blade.php new file mode 100644 index 00000000..3ff41f89 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/footer.blade.php @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php new file mode 100644 index 00000000..79971d9e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php @@ -0,0 +1,7 @@ + + + +{{ $slot }} + + + diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/layout.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/layout.blade.php new file mode 100644 index 00000000..02a54e2d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/layout.blade.php @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/message.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/message.blade.php new file mode 100644 index 00000000..deec4a1f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/message.blade.php @@ -0,0 +1,27 @@ +@component('mail::layout') +{{-- Header --}} +@slot('header') +@component('mail::header', ['url' => config('app.url')]) +{{ config('app.name') }} +@endcomponent +@endslot + +{{-- Body --}} +{{ $slot }} + +{{-- Subcopy --}} +@isset($subcopy) +@slot('subcopy') +@component('mail::subcopy') +{{ $subcopy }} +@endcomponent +@endslot +@endisset + +{{-- Footer --}} +@slot('footer') +@component('mail::footer') +© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') +@endcomponent +@endslot +@endcomponent diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/panel.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/panel.blade.php new file mode 100644 index 00000000..2975a60a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/panel.blade.php @@ -0,0 +1,14 @@ + + + + + + diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion.blade.php new file mode 100644 index 00000000..8fef44c9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion.blade.php @@ -0,0 +1,7 @@ + + + + + diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion/button.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion/button.blade.php new file mode 100644 index 00000000..1dcb2ee4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion/button.blade.php @@ -0,0 +1,13 @@ + + + + +
+ + + + +
+ {{ $slot }} +
+
diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/subcopy.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/subcopy.blade.php new file mode 100644 index 00000000..790ce6c2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/subcopy.blade.php @@ -0,0 +1,7 @@ + + + + + diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/table.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/table.blade.php new file mode 100644 index 00000000..a5f3348b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/table.blade.php @@ -0,0 +1,3 @@ +
+{{ Illuminate\Mail\Markdown::parse($slot) }} +
diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css new file mode 100644 index 00000000..37c3edd9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css @@ -0,0 +1,298 @@ +/* Base */ + +body, +body *:not(html):not(style):not(br):not(tr):not(code) { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, + 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; + box-sizing: border-box; +} + +body { + background-color: #f8fafc; + color: #74787e; + height: 100%; + hyphens: auto; + line-height: 1.4; + margin: 0; + -moz-hyphens: auto; + -ms-word-break: break-all; + width: 100% !important; + -webkit-hyphens: auto; + -webkit-text-size-adjust: none; + word-break: break-all; + word-break: break-word; +} + +p, +ul, +ol, +blockquote { + line-height: 1.4; + text-align: left; +} + +a { + color: #3869d4; +} + +a img { + border: none; +} + +/* Typography */ + +h1 { + color: #3d4852; + font-size: 19px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +h2 { + color: #3d4852; + font-size: 16px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +h3 { + color: #3d4852; + font-size: 14px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +p { + color: #3d4852; + font-size: 16px; + line-height: 1.5em; + margin-top: 0; + text-align: left; +} + +p.sub { + font-size: 12px; +} + +img { + max-width: 100%; +} + +/* Layout */ + +.wrapper { + background-color: #f8fafc; + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.content { + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +/* Header */ + +.header { + padding: 25px 0; + text-align: center; +} + +.header a { + color: #bbbfc3; + font-size: 19px; + font-weight: bold; + text-decoration: none; + text-shadow: 0 1px 0 white; +} + +/* Body */ + +.body { + background-color: #ffffff; + border-bottom: 1px solid #edeff2; + border-top: 1px solid #edeff2; + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.inner-body { + background-color: #ffffff; + margin: 0 auto; + padding: 0; + width: 570px; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 570px; +} + +/* Subcopy */ + +.subcopy { + border-top: 1px solid #edeff2; + margin-top: 25px; + padding-top: 25px; +} + +.subcopy p { + font-size: 12px; +} + +/* Footer */ + +.footer { + margin: 0 auto; + padding: 0; + text-align: center; + width: 570px; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 570px; +} + +.footer p { + color: #aeaeae; + font-size: 12px; + text-align: center; +} + +/* Tables */ + +.table table { + margin: 30px auto; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.table th { + border-bottom: 1px solid #edeff2; + padding-bottom: 8px; + margin: 0; +} + +.table td { + color: #74787e; + font-size: 15px; + line-height: 18px; + padding: 10px 0; + margin: 0; +} + +.content-cell { + padding: 35px; +} + +/* Buttons */ + +.action { + margin: 30px auto; + padding: 0; + text-align: center; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.button { + border-radius: 3px; + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16); + color: #fff; + display: inline-block; + text-decoration: none; + -webkit-text-size-adjust: none; +} + +.button-blue, +.button-primary { + background-color: #3490dc; + border-top: 10px solid #3490dc; + border-right: 18px solid #3490dc; + border-bottom: 10px solid #3490dc; + border-left: 18px solid #3490dc; +} + +.button-green, +.button-success { + background-color: #38c172; + border-top: 10px solid #38c172; + border-right: 18px solid #38c172; + border-bottom: 10px solid #38c172; + border-left: 18px solid #38c172; +} + +.button-red, +.button-error { + background-color: #e3342f; + border-top: 10px solid #e3342f; + border-right: 18px solid #e3342f; + border-bottom: 10px solid #e3342f; + border-left: 18px solid #e3342f; +} + +/* Panels */ + +.panel { + margin: 0 0 21px; +} + +.panel-content { + background-color: #f1f5f8; + padding: 16px; +} + +.panel-item { + padding: 0; +} + +.panel-item p:last-of-type { + margin-bottom: 0; + padding-bottom: 0; +} + +/* Promotions */ + +.promotion { + background-color: #ffffff; + border: 2px dashed #9ba2ab; + margin: 0; + margin-bottom: 25px; + margin-top: 25px; + padding: 24px; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.promotion h1 { + text-align: center; +} + +.promotion p { + font-size: 15px; + text-align: center; +} + +/* Utilities */ + +.break-all { + word-break: break-all; +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/button.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/button.blade.php new file mode 100644 index 00000000..97444ebd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/button.blade.php @@ -0,0 +1 @@ +{{ $slot }}: {{ $url }} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/footer.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/footer.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/footer.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/header.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/header.blade.php new file mode 100644 index 00000000..aaa3e575 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/header.blade.php @@ -0,0 +1 @@ +[{{ $slot }}]({{ $url }}) diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/layout.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/layout.blade.php new file mode 100644 index 00000000..9378baa0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/layout.blade.php @@ -0,0 +1,9 @@ +{!! strip_tags($header) !!} + +{!! strip_tags($slot) !!} +@isset($subcopy) + +{!! strip_tags($subcopy) !!} +@endisset + +{!! strip_tags($footer) !!} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/message.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/message.blade.php new file mode 100644 index 00000000..1ae9ed8f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/message.blade.php @@ -0,0 +1,27 @@ +@component('mail::layout') + {{-- Header --}} + @slot('header') + @component('mail::header', ['url' => config('app.url')]) + {{ config('app.name') }} + @endcomponent + @endslot + + {{-- Body --}} + {{ $slot }} + + {{-- Subcopy --}} + @isset($subcopy) + @slot('subcopy') + @component('mail::subcopy') + {{ $subcopy }} + @endcomponent + @endslot + @endisset + + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + © {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') + @endcomponent + @endslot +@endcomponent diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/panel.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/panel.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/panel.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/promotion.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/promotion.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/promotion.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/promotion/button.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/promotion/button.blade.php new file mode 100644 index 00000000..aaa3e575 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/promotion/button.blade.php @@ -0,0 +1 @@ +[{{ $slot }}]({{ $url }}) diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/subcopy.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/subcopy.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/subcopy.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/table.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/table.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/table.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Action.php b/vendor/laravel/framework/src/Illuminate/Notifications/Action.php new file mode 100644 index 00000000..071db2d9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Action.php @@ -0,0 +1,33 @@ +url = $url; + $this->text = $text; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/AnonymousNotifiable.php b/vendor/laravel/framework/src/Illuminate/Notifications/AnonymousNotifiable.php new file mode 100644 index 00000000..eab959b7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/AnonymousNotifiable.php @@ -0,0 +1,77 @@ +routes[$channel] = $route; + + return $this; + } + + /** + * Send the given notification. + * + * @param mixed $notification + * @return void + */ + public function notify($notification) + { + app(Dispatcher::class)->send($this, $notification); + } + + /** + * Send the given notification immediately. + * + * @param mixed $notification + * @return void + */ + public function notifyNow($notification) + { + app(Dispatcher::class)->sendNow($this, $notification); + } + + /** + * Get the notification routing information for the given driver. + * + * @param string $driver + * @return mixed + */ + public function routeNotificationFor($driver) + { + return $this->routes[$driver] ?? null; + } + + /** + * Get the value of the notifiable's primary key. + * + * @return mixed + */ + public function getKey() + { + // + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php b/vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php new file mode 100644 index 00000000..d2344ab6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php @@ -0,0 +1,162 @@ +container->make(Bus::class), $this->container->make(Dispatcher::class), $this->locale) + )->send($notifiables, $notification); + } + + /** + * Send the given notification immediately. + * + * @param \Illuminate\Support\Collection|array|mixed $notifiables + * @param mixed $notification + * @param array|null $channels + * @return void + */ + public function sendNow($notifiables, $notification, array $channels = null) + { + return (new NotificationSender( + $this, $this->container->make(Bus::class), $this->container->make(Dispatcher::class), $this->locale) + )->sendNow($notifiables, $notification, $channels); + } + + /** + * Get a channel instance. + * + * @param string|null $name + * @return mixed + */ + public function channel($name = null) + { + return $this->driver($name); + } + + /** + * Create an instance of the database driver. + * + * @return \Illuminate\Notifications\Channels\DatabaseChannel + */ + protected function createDatabaseDriver() + { + return $this->container->make(Channels\DatabaseChannel::class); + } + + /** + * Create an instance of the broadcast driver. + * + * @return \Illuminate\Notifications\Channels\BroadcastChannel + */ + protected function createBroadcastDriver() + { + return $this->container->make(Channels\BroadcastChannel::class); + } + + /** + * Create an instance of the mail driver. + * + * @return \Illuminate\Notifications\Channels\MailChannel + */ + protected function createMailDriver() + { + return $this->container->make(Channels\MailChannel::class); + } + + /** + * Create a new driver instance. + * + * @param string $driver + * @return mixed + * + * @throws \InvalidArgumentException + */ + protected function createDriver($driver) + { + try { + return parent::createDriver($driver); + } catch (InvalidArgumentException $e) { + if (class_exists($driver)) { + return $this->container->make($driver); + } + + throw $e; + } + } + + /** + * Get the default channel driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->defaultChannel; + } + + /** + * Get the default channel driver name. + * + * @return string + */ + public function deliversVia() + { + return $this->getDefaultDriver(); + } + + /** + * Set the default channel driver name. + * + * @param string $channel + * @return void + */ + public function deliverVia($channel) + { + $this->defaultChannel = $channel; + } + + /** + * Set the locale of notifications. + * + * @param string $locale + * @return $this + */ + public function locale($locale) + { + $this->locale = $locale; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Channels/BroadcastChannel.php b/vendor/laravel/framework/src/Illuminate/Notifications/Channels/BroadcastChannel.php new file mode 100644 index 00000000..d281b9b1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Channels/BroadcastChannel.php @@ -0,0 +1,75 @@ +events = $events; + } + + /** + * Send the given notification. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @return array|null + */ + public function send($notifiable, Notification $notification) + { + $message = $this->getData($notifiable, $notification); + + $event = new BroadcastNotificationCreated( + $notifiable, $notification, is_array($message) ? $message : $message->data + ); + + if ($message instanceof BroadcastMessage) { + $event->onConnection($message->connection) + ->onQueue($message->queue); + } + + return $this->events->dispatch($event); + } + + /** + * Get the data for the notification. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @return mixed + * + * @throws \RuntimeException + */ + protected function getData($notifiable, Notification $notification) + { + if (method_exists($notification, 'toBroadcast')) { + return $notification->toBroadcast($notifiable); + } + + if (method_exists($notification, 'toArray')) { + return $notification->toArray($notifiable); + } + + throw new RuntimeException('Notification is missing toArray method.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Channels/DatabaseChannel.php b/vendor/laravel/framework/src/Illuminate/Notifications/Channels/DatabaseChannel.php new file mode 100644 index 00000000..bd8af623 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Channels/DatabaseChannel.php @@ -0,0 +1,63 @@ +routeNotificationFor('database', $notification)->create( + $this->buildPayload($notifiable, $notification) + ); + } + + /** + * Get the data for the notification. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @return array + * + * @throws \RuntimeException + */ + protected function getData($notifiable, Notification $notification) + { + if (method_exists($notification, 'toDatabase')) { + return is_array($data = $notification->toDatabase($notifiable)) + ? $data : $data->data; + } + + if (method_exists($notification, 'toArray')) { + return $notification->toArray($notifiable); + } + + throw new RuntimeException('Notification is missing toDatabase / toArray method.'); + } + + /** + * Build an array payload for the DatabaseNotification Model. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @return array + */ + protected function buildPayload($notifiable, Notification $notification) + { + return [ + 'id' => $notification->id, + 'type' => get_class($notification), + 'data' => $this->getData($notifiable, $notification), + 'read_at' => null, + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php b/vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php new file mode 100644 index 00000000..d28241ac --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php @@ -0,0 +1,251 @@ +mailer = $mailer; + $this->markdown = $markdown; + } + + /** + * Send the given notification. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @return void + */ + public function send($notifiable, Notification $notification) + { + $message = $notification->toMail($notifiable); + + if (! $notifiable->routeNotificationFor('mail', $notification) && + ! $message instanceof Mailable) { + return; + } + + if ($message instanceof Mailable) { + return $message->send($this->mailer); + } + + $this->mailer->send( + $this->buildView($message), + array_merge($message->data(), $this->additionalMessageData($notification)), + $this->messageBuilder($notifiable, $notification, $message) + ); + } + + /** + * Get the mailer Closure for the message. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return \Closure + */ + protected function messageBuilder($notifiable, $notification, $message) + { + return function ($mailMessage) use ($notifiable, $notification, $message) { + $this->buildMessage($mailMessage, $notifiable, $notification, $message); + }; + } + + /** + * Build the notification's view. + * + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return string|array + */ + protected function buildView($message) + { + if ($message->view) { + return $message->view; + } + + if (property_exists($message, 'theme') && ! is_null($message->theme)) { + $this->markdown->theme($message->theme); + } + + return [ + 'html' => $this->markdown->render($message->markdown, $message->data()), + 'text' => $this->markdown->renderText($message->markdown, $message->data()), + ]; + } + + /** + * Get additional meta-data to pass along with the view data. + * + * @param \Illuminate\Notifications\Notification $notification + * @return array + */ + protected function additionalMessageData($notification) + { + return [ + '__laravel_notification_id' => $notification->id, + '__laravel_notification' => get_class($notification), + '__laravel_notification_queued' => in_array( + ShouldQueue::class, class_implements($notification) + ), + ]; + } + + /** + * Build the mail message. + * + * @param \Illuminate\Mail\Message $mailMessage + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return void + */ + protected function buildMessage($mailMessage, $notifiable, $notification, $message) + { + $this->addressMessage($mailMessage, $notifiable, $notification, $message); + + $mailMessage->subject($message->subject ?: Str::title( + Str::snake(class_basename($notification), ' ') + )); + + $this->addAttachments($mailMessage, $message); + + if (! is_null($message->priority)) { + $mailMessage->setPriority($message->priority); + } + + $this->runCallbacks($mailMessage, $message); + } + + /** + * Address the mail message. + * + * @param \Illuminate\Mail\Message $mailMessage + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return void + */ + protected function addressMessage($mailMessage, $notifiable, $notification, $message) + { + $this->addSender($mailMessage, $message); + + $mailMessage->to($this->getRecipients($notifiable, $notification, $message)); + + if (! empty($message->cc)) { + foreach ($message->cc as $cc) { + $mailMessage->cc($cc[0], Arr::get($cc, 1)); + } + } + + if (! empty($message->bcc)) { + foreach ($message->bcc as $bcc) { + $mailMessage->bcc($bcc[0], Arr::get($bcc, 1)); + } + } + } + + /** + * Add the "from" and "reply to" addresses to the message. + * + * @param \Illuminate\Mail\Message $mailMessage + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return void + */ + protected function addSender($mailMessage, $message) + { + if (! empty($message->from)) { + $mailMessage->from($message->from[0], Arr::get($message->from, 1)); + } + + if (! empty($message->replyTo)) { + foreach ($message->replyTo as $replyTo) { + $mailMessage->replyTo($replyTo[0], Arr::get($replyTo, 1)); + } + } + } + + /** + * Get the recipients of the given message. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return mixed + */ + protected function getRecipients($notifiable, $notification, $message) + { + if (is_string($recipients = $notifiable->routeNotificationFor('mail', $notification))) { + $recipients = [$recipients]; + } + + return collect($recipients)->mapWithKeys(function ($recipient, $email) { + return is_numeric($email) + ? [$email => (is_string($recipient) ? $recipient : $recipient->email)] + : [$email => $recipient]; + })->all(); + } + + /** + * Add the attachments to the message. + * + * @param \Illuminate\Mail\Message $mailMessage + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return void + */ + protected function addAttachments($mailMessage, $message) + { + foreach ($message->attachments as $attachment) { + $mailMessage->attach($attachment['file'], $attachment['options']); + } + + foreach ($message->rawAttachments as $attachment) { + $mailMessage->attachData($attachment['data'], $attachment['name'], $attachment['options']); + } + } + + /** + * Run the callbacks for the message. + * + * @param \Illuminate\Mail\Message $mailMessage + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return $this + */ + protected function runCallbacks($mailMessage, $message) + { + foreach ($message->callbacks as $callback) { + $callback($mailMessage->getSwiftMessage()); + } + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Console/NotificationTableCommand.php b/vendor/laravel/framework/src/Illuminate/Notifications/Console/NotificationTableCommand.php new file mode 100644 index 00000000..f447fc18 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Console/NotificationTableCommand.php @@ -0,0 +1,81 @@ +files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $fullPath = $this->createBaseMigration(); + + $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/notifications.stub')); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the notifications. + * + * @return string + */ + protected function createBaseMigration() + { + $name = 'create_notifications_table'; + + $path = $this->laravel->databasePath().'/migrations'; + + return $this->laravel['migration.creator']->create($name, $path); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Console/stubs/notifications.stub b/vendor/laravel/framework/src/Illuminate/Notifications/Console/stubs/notifications.stub new file mode 100644 index 00000000..9797596d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Console/stubs/notifications.stub @@ -0,0 +1,35 @@ +uuid('id')->primary(); + $table->string('type'); + $table->morphs('notifiable'); + $table->text('data'); + $table->timestamp('read_at')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('notifications'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotification.php b/vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotification.php new file mode 100644 index 00000000..0dfc7e53 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotification.php @@ -0,0 +1,111 @@ + 'array', + 'read_at' => 'datetime', + ]; + + /** + * Get the notifiable entity that the notification belongs to. + * + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + public function notifiable() + { + return $this->morphTo(); + } + + /** + * Mark the notification as read. + * + * @return void + */ + public function markAsRead() + { + if (is_null($this->read_at)) { + $this->forceFill(['read_at' => $this->freshTimestamp()])->save(); + } + } + + /** + * Mark the notification as unread. + * + * @return void + */ + public function markAsUnread() + { + if (! is_null($this->read_at)) { + $this->forceFill(['read_at' => null])->save(); + } + } + + /** + * Determine if a notification has been read. + * + * @return bool + */ + public function read() + { + return $this->read_at !== null; + } + + /** + * Determine if a notification has not been read. + * + * @return bool + */ + public function unread() + { + return $this->read_at === null; + } + + /** + * Create a new database notification collection instance. + * + * @param array $models + * @return \Illuminate\Notifications\DatabaseNotificationCollection + */ + public function newCollection(array $models = []) + { + return new DatabaseNotificationCollection($models); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotificationCollection.php b/vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotificationCollection.php new file mode 100644 index 00000000..05924ec6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotificationCollection.php @@ -0,0 +1,28 @@ +each->markAsRead(); + } + + /** + * Mark all notifications as unread. + * + * @return void + */ + public function markAsUnread() + { + $this->each->markAsUnread(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php b/vendor/laravel/framework/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php new file mode 100644 index 00000000..77498ea3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php @@ -0,0 +1,112 @@ +data = $data; + $this->notifiable = $notifiable; + $this->notification = $notification; + } + + /** + * Get the channels the event should broadcast on. + * + * @return array + */ + public function broadcastOn() + { + $channels = $this->notification->broadcastOn(); + + if (! empty($channels)) { + return $channels; + } + + if (is_string($channels = $this->channelName())) { + return [new PrivateChannel($channels)]; + } + + return collect($channels)->map(function ($channel) { + return new PrivateChannel($channel); + })->all(); + } + + /** + * Get the broadcast channel name for the event. + * + * @return array|string + */ + protected function channelName() + { + if (method_exists($this->notifiable, 'receivesBroadcastNotificationsOn')) { + return $this->notifiable->receivesBroadcastNotificationsOn($this->notification); + } + + $class = str_replace('\\', '.', get_class($this->notifiable)); + + return $class.'.'.$this->notifiable->getKey(); + } + + /** + * Get the data that should be sent with the broadcasted event. + * + * @return array + */ + public function broadcastWith() + { + return array_merge($this->data, [ + 'id' => $this->notification->id, + 'type' => $this->broadcastType(), + ]); + } + + /** + * Get the type of the notification being broadcast. + * + * @return string + */ + public function broadcastType() + { + return method_exists($this->notification, 'broadcastType') + ? $this->notification->broadcastType() + : get_class($this->notification); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationFailed.php b/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationFailed.php new file mode 100644 index 00000000..b69e1c54 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationFailed.php @@ -0,0 +1,56 @@ +data = $data; + $this->channel = $channel; + $this->notifiable = $notifiable; + $this->notification = $notification; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSending.php b/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSending.php new file mode 100644 index 00000000..6efd1d06 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSending.php @@ -0,0 +1,47 @@ +channel = $channel; + $this->notifiable = $notifiable; + $this->notification = $notification; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSent.php b/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSent.php new file mode 100644 index 00000000..4f090691 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSent.php @@ -0,0 +1,56 @@ +channel = $channel; + $this->response = $response; + $this->notifiable = $notifiable; + $this->notification = $notification; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/HasDatabaseNotifications.php b/vendor/laravel/framework/src/Illuminate/Notifications/HasDatabaseNotifications.php new file mode 100644 index 00000000..981d8e55 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/HasDatabaseNotifications.php @@ -0,0 +1,36 @@ +morphMany(DatabaseNotification::class, 'notifiable')->orderBy('created_at', 'desc'); + } + + /** + * Get the entity's read notifications. + * + * @return \Illuminate\Database\Query\Builder + */ + public function readNotifications() + { + return $this->notifications()->whereNotNull('read_at'); + } + + /** + * Get the entity's unread notifications. + * + * @return \Illuminate\Database\Query\Builder + */ + public function unreadNotifications() + { + return $this->notifications()->whereNull('read_at'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Notifications/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Notifications/Messages/BroadcastMessage.php b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/BroadcastMessage.php new file mode 100644 index 00000000..9884a8fb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/BroadcastMessage.php @@ -0,0 +1,41 @@ +data = $data; + } + + /** + * Set the message data. + * + * @param array $data + * @return $this + */ + public function data($data) + { + $this->data = $data; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Messages/DatabaseMessage.php b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/DatabaseMessage.php new file mode 100644 index 00000000..55707a7c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/DatabaseMessage.php @@ -0,0 +1,24 @@ +data = $data; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Messages/MailMessage.php b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/MailMessage.php new file mode 100644 index 00000000..08ee2f1f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/MailMessage.php @@ -0,0 +1,335 @@ +view = $view; + $this->viewData = $data; + + $this->markdown = null; + + return $this; + } + + /** + * Set the Markdown template for the notification. + * + * @param string $view + * @param array $data + * @return $this + */ + public function markdown($view, array $data = []) + { + $this->markdown = $view; + $this->viewData = $data; + + $this->view = null; + + return $this; + } + + /** + * Set the default markdown template. + * + * @param string $template + * @return $this + */ + public function template($template) + { + $this->markdown = $template; + + return $this; + } + + /** + * Set the theme to use with the Markdown template. + * + * @param string $theme + * @return $this + */ + public function theme($theme) + { + $this->theme = $theme; + + return $this; + } + + /** + * Set the from address for the mail message. + * + * @param string $address + * @param string|null $name + * @return $this + */ + public function from($address, $name = null) + { + $this->from = [$address, $name]; + + return $this; + } + + /** + * Set the "reply to" address of the message. + * + * @param array|string $address + * @param string|null $name + * @return $this + */ + public function replyTo($address, $name = null) + { + if ($this->arrayOfAddresses($address)) { + $this->replyTo += $this->parseAddresses($address); + } else { + $this->replyTo[] = [$address, $name]; + } + + return $this; + } + + /** + * Set the cc address for the mail message. + * + * @param array|string $address + * @param string|null $name + * @return $this + */ + public function cc($address, $name = null) + { + if ($this->arrayOfAddresses($address)) { + $this->cc += $this->parseAddresses($address); + } else { + $this->cc[] = [$address, $name]; + } + + return $this; + } + + /** + * Set the bcc address for the mail message. + * + * @param array|string $address + * @param string|null $name + * @return $this + */ + public function bcc($address, $name = null) + { + if ($this->arrayOfAddresses($address)) { + $this->bcc += $this->parseAddresses($address); + } else { + $this->bcc[] = [$address, $name]; + } + + return $this; + } + + /** + * Attach a file to the message. + * + * @param string $file + * @param array $options + * @return $this + */ + public function attach($file, array $options = []) + { + $this->attachments[] = compact('file', 'options'); + + return $this; + } + + /** + * Attach in-memory data as an attachment. + * + * @param string $data + * @param string $name + * @param array $options + * @return $this + */ + public function attachData($data, $name, array $options = []) + { + $this->rawAttachments[] = compact('data', 'name', 'options'); + + return $this; + } + + /** + * Set the priority of this message. + * + * The value is an integer where 1 is the highest priority and 5 is the lowest. + * + * @param int $level + * @return $this + */ + public function priority($level) + { + $this->priority = $level; + + return $this; + } + + /** + * Get the data array for the mail message. + * + * @return array + */ + public function data() + { + return array_merge($this->toArray(), $this->viewData); + } + + /** + * Parse the multi-address array into the necessary format. + * + * @param array $value + * @return array + */ + protected function parseAddresses($value) + { + return collect($value)->map(function ($address, $name) { + return [$address, is_numeric($name) ? null : $name]; + })->values()->all(); + } + + /** + * Determine if the given "address" is actually an array of addresses. + * + * @param mixed $address + * @return bool + */ + protected function arrayOfAddresses($address) + { + return is_array($address) || + $address instanceof Arrayable || + $address instanceof Traversable; + } + + /** + * Render the mail notification message into an HTML string. + * + * @return string + */ + public function render() + { + if (isset($this->view)) { + return Container::getInstance()->make('mailer')->render( + $this->view, $this->data() + ); + } + + return Container::getInstance() + ->make(Markdown::class) + ->render($this->markdown, $this->data()); + } + + /** + * Register a callback to be called with the Swift message instance. + * + * @param callable $callback + * @return $this + */ + public function withSwiftMessage($callback) + { + $this->callbacks[] = $callback; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Messages/SimpleMessage.php b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/SimpleMessage.php new file mode 100644 index 00000000..e506bc01 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/SimpleMessage.php @@ -0,0 +1,225 @@ +level = 'success'; + + return $this; + } + + /** + * Indicate that the notification gives information about an error. + * + * @return $this + */ + public function error() + { + $this->level = 'error'; + + return $this; + } + + /** + * Set the "level" of the notification (success, error, etc.). + * + * @param string $level + * @return $this + */ + public function level($level) + { + $this->level = $level; + + return $this; + } + + /** + * Set the subject of the notification. + * + * @param string $subject + * @return $this + */ + public function subject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * Set the greeting of the notification. + * + * @param string $greeting + * @return $this + */ + public function greeting($greeting) + { + $this->greeting = $greeting; + + return $this; + } + + /** + * Set the salutation of the notification. + * + * @param string $salutation + * @return $this + */ + public function salutation($salutation) + { + $this->salutation = $salutation; + + return $this; + } + + /** + * Add a line of text to the notification. + * + * @param mixed $line + * @return $this + */ + public function line($line) + { + return $this->with($line); + } + + /** + * Add a line of text to the notification. + * + * @param mixed $line + * @return $this + */ + public function with($line) + { + if ($line instanceof Action) { + $this->action($line->text, $line->url); + } elseif (! $this->actionText) { + $this->introLines[] = $this->formatLine($line); + } else { + $this->outroLines[] = $this->formatLine($line); + } + + return $this; + } + + /** + * Format the given line of text. + * + * @param \Illuminate\Contracts\Support\Htmlable|string|array $line + * @return \Illuminate\Contracts\Support\Htmlable|string + */ + protected function formatLine($line) + { + if ($line instanceof Htmlable) { + return $line; + } + + if (is_array($line)) { + return implode(' ', array_map('trim', $line)); + } + + return trim(implode(' ', array_map('trim', preg_split('/\\r\\n|\\r|\\n/', $line)))); + } + + /** + * Configure the "call to action" button. + * + * @param string $text + * @param string $url + * @return $this + */ + public function action($text, $url) + { + $this->actionText = $text; + $this->actionUrl = $url; + + return $this; + } + + /** + * Get an array representation of the message. + * + * @return array + */ + public function toArray() + { + return [ + 'level' => $this->level, + 'subject' => $this->subject, + 'greeting' => $this->greeting, + 'salutation' => $this->salutation, + 'introLines' => $this->introLines, + 'outroLines' => $this->outroLines, + 'actionText' => $this->actionText, + 'actionUrl' => $this->actionUrl, + 'displayableActionUrl' => str_replace(['mailto:', 'tel:'], '', $this->actionUrl), + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Notifiable.php b/vendor/laravel/framework/src/Illuminate/Notifications/Notifiable.php new file mode 100644 index 00000000..82381e1e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Notifiable.php @@ -0,0 +1,8 @@ +locale = $locale; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php b/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php new file mode 100644 index 00000000..19b9a7de --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php @@ -0,0 +1,226 @@ +bus = $bus; + $this->events = $events; + $this->locale = $locale; + $this->manager = $manager; + } + + /** + * Send the given notification to the given notifiable entities. + * + * @param \Illuminate\Support\Collection|array|mixed $notifiables + * @param mixed $notification + * @return void + */ + public function send($notifiables, $notification) + { + $notifiables = $this->formatNotifiables($notifiables); + + if ($notification instanceof ShouldQueue) { + return $this->queueNotification($notifiables, $notification); + } + + return $this->sendNow($notifiables, $notification); + } + + /** + * Send the given notification immediately. + * + * @param \Illuminate\Support\Collection|array|mixed $notifiables + * @param mixed $notification + * @param array|null $channels + * @return void + */ + public function sendNow($notifiables, $notification, array $channels = null) + { + $notifiables = $this->formatNotifiables($notifiables); + + $original = clone $notification; + + foreach ($notifiables as $notifiable) { + if (empty($viaChannels = $channels ?: $notification->via($notifiable))) { + continue; + } + + $this->withLocale($this->preferredLocale($notifiable, $notification), function () use ($viaChannels, $notifiable, $original) { + $notificationId = Str::uuid()->toString(); + + foreach ((array) $viaChannels as $channel) { + if (! ($notifiable instanceof AnonymousNotifiable && $channel === 'database')) { + $this->sendToNotifiable($notifiable, $notificationId, clone $original, $channel); + } + } + }); + } + } + + /** + * Get the notifiable's preferred locale for the notification. + * + * @param mixed $notifiable + * @param mixed $notification + * @return string|null + */ + protected function preferredLocale($notifiable, $notification) + { + return $notification->locale ?? $this->locale ?? value(function () use ($notifiable) { + if ($notifiable instanceof HasLocalePreference) { + return $notifiable->preferredLocale(); + } + }); + } + + /** + * Send the given notification to the given notifiable via a channel. + * + * @param mixed $notifiable + * @param string $id + * @param mixed $notification + * @param string $channel + * @return void + */ + protected function sendToNotifiable($notifiable, $id, $notification, $channel) + { + if (! $notification->id) { + $notification->id = $id; + } + + if (! $this->shouldSendNotification($notifiable, $notification, $channel)) { + return; + } + + $response = $this->manager->driver($channel)->send($notifiable, $notification); + + $this->events->dispatch( + new NotificationSent($notifiable, $notification, $channel, $response) + ); + } + + /** + * Determines if the notification can be sent. + * + * @param mixed $notifiable + * @param mixed $notification + * @param string $channel + * @return bool + */ + protected function shouldSendNotification($notifiable, $notification, $channel) + { + return $this->events->until( + new NotificationSending($notifiable, $notification, $channel) + ) !== false; + } + + /** + * Queue the given notification instances. + * + * @param mixed $notifiables + * @param \Illuminate\Notifications\Notification $notification + * @return void + */ + protected function queueNotification($notifiables, $notification) + { + $notifiables = $this->formatNotifiables($notifiables); + + $original = clone $notification; + + foreach ($notifiables as $notifiable) { + $notificationId = Str::uuid()->toString(); + + foreach ((array) $original->via($notifiable) as $channel) { + $notification = clone $original; + + $notification->id = $notificationId; + + if (! is_null($this->locale)) { + $notification->locale = $this->locale; + } + + $this->bus->dispatch( + (new SendQueuedNotifications($notifiable, $notification, [$channel])) + ->onConnection($notification->connection) + ->onQueue($notification->queue) + ->delay($notification->delay) + ->through( + array_merge( + method_exists($notification, 'middleware') ? $notification->middleware() : [], + $notification->middleware ?? [] + ) + ) + ); + } + } + } + + /** + * Format the notifiables into a Collection / array if necessary. + * + * @param mixed $notifiables + * @return \Illuminate\Database\Eloquent\Collection|array + */ + protected function formatNotifiables($notifiables) + { + if (! $notifiables instanceof Collection && ! is_array($notifiables)) { + return $notifiables instanceof Model + ? new ModelCollection([$notifiables]) : [$notifiables]; + } + + return $notifiables; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/NotificationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Notifications/NotificationServiceProvider.php new file mode 100644 index 00000000..fb202ed9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/NotificationServiceProvider.php @@ -0,0 +1,46 @@ +loadViewsFrom(__DIR__.'/resources/views', 'notifications'); + + if ($this->app->runningInConsole()) { + $this->publishes([ + __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/notifications'), + ], 'laravel-notifications'); + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton(ChannelManager::class, function ($app) { + return new ChannelManager($app); + }); + + $this->app->alias( + ChannelManager::class, DispatcherContract::class + ); + + $this->app->alias( + ChannelManager::class, FactoryContract::class + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/RoutesNotifications.php b/vendor/laravel/framework/src/Illuminate/Notifications/RoutesNotifications.php new file mode 100644 index 00000000..799845a7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/RoutesNotifications.php @@ -0,0 +1,53 @@ +send($this, $instance); + } + + /** + * Send the given notification immediately. + * + * @param mixed $instance + * @param array|null $channels + * @return void + */ + public function notifyNow($instance, array $channels = null) + { + app(Dispatcher::class)->sendNow($this, $instance, $channels); + } + + /** + * Get the notification routing information for the given driver. + * + * @param string $driver + * @param \Illuminate\Notifications\Notification|null $notification + * @return mixed + */ + public function routeNotificationFor($driver, $notification = null) + { + if (method_exists($this, $method = 'routeNotificationFor'.Str::studly($driver))) { + return $this->{$method}($notification); + } + + switch ($driver) { + case 'database': + return $this->notifications(); + case 'mail': + return $this->email; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php b/vendor/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php new file mode 100644 index 00000000..62daeb5b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php @@ -0,0 +1,138 @@ +channels = $channels; + $this->notifiables = $notifiables; + $this->notification = $notification; + $this->tries = property_exists($notification, 'tries') ? $notification->tries : null; + $this->timeout = property_exists($notification, 'timeout') ? $notification->timeout : null; + } + + /** + * Send the notifications. + * + * @param \Illuminate\Notifications\ChannelManager $manager + * @return void + */ + public function handle(ChannelManager $manager) + { + $manager->sendNow($this->notifiables, $this->notification, $this->channels); + } + + /** + * Get the display name for the queued job. + * + * @return string + */ + public function displayName() + { + return get_class($this->notification); + } + + /** + * Call the failed method on the notification instance. + * + * @param \Exception $e + * @return void + */ + public function failed($e) + { + if (method_exists($this->notification, 'failed')) { + $this->notification->failed($e); + } + } + + /** + * Get the retry delay for the notification. + * + * @return mixed + */ + public function retryAfter() + { + if (! method_exists($this->notification, 'retryAfter') && ! isset($this->notification->retryAfter)) { + return; + } + + return $this->notification->retryAfter ?? $this->notification->retryAfter(); + } + + /** + * Get the expiration for the notification. + * + * @return mixed + */ + public function retryUntil() + { + if (! method_exists($this->notification, 'retryUntil') && ! isset($this->notification->timeoutAt)) { + return; + } + + return $this->notification->timeoutAt ?? $this->notification->retryUntil(); + } + + /** + * Prepare the instance for cloning. + * + * @return void + */ + public function __clone() + { + $this->notifiables = clone $this->notifiables; + $this->notification = clone $this->notification; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/composer.json b/vendor/laravel/framework/src/Illuminate/Notifications/composer.json new file mode 100644 index 00000000..8a96b664 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/composer.json @@ -0,0 +1,44 @@ +{ + "name": "illuminate/notifications", + "description": "The Illuminate Notifications package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/broadcasting": "^6.0", + "illuminate/bus": "^6.0", + "illuminate/container": "^6.0", + "illuminate/contracts": "^6.0", + "illuminate/filesystem": "^6.0", + "illuminate/mail": "^6.0", + "illuminate/queue": "^6.0", + "illuminate/support": "^6.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Notifications\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "suggest": { + "illuminate/database": "Required to use the database transport (^6.0)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/resources/views/email.blade.php b/vendor/laravel/framework/src/Illuminate/Notifications/resources/views/email.blade.php new file mode 100644 index 00000000..e7a56b46 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/resources/views/email.blade.php @@ -0,0 +1,62 @@ +@component('mail::message') +{{-- Greeting --}} +@if (! empty($greeting)) +# {{ $greeting }} +@else +@if ($level === 'error') +# @lang('Whoops!') +@else +# @lang('Hello!') +@endif +@endif + +{{-- Intro Lines --}} +@foreach ($introLines as $line) +{{ $line }} + +@endforeach + +{{-- Action Button --}} +@isset($actionText) + +@component('mail::button', ['url' => $actionUrl, 'color' => $color]) +{{ $actionText }} +@endcomponent +@endisset + +{{-- Outro Lines --}} +@foreach ($outroLines as $line) +{{ $line }} + +@endforeach + +{{-- Salutation --}} +@if (! empty($salutation)) +{{ $salutation }} +@else +@lang('Regards'),
+{{ config('app.name') }} +@endif + +{{-- Subcopy --}} +@isset($actionText) +@slot('subcopy') +@lang( + "If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\n". + 'into your web browser:', + [ + 'actionText' => $actionText, + ] +) [{{ $displayableActionUrl }}]({{ $actionUrl }}) +@endslot +@endisset +@endcomponent diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php b/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php new file mode 100644 index 00000000..5fefab34 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php @@ -0,0 +1,669 @@ += 1 && filter_var($page, FILTER_VALIDATE_INT) !== false; + } + + /** + * Get the URL for the previous page. + * + * @return string|null + */ + public function previousPageUrl() + { + if ($this->currentPage() > 1) { + return $this->url($this->currentPage() - 1); + } + } + + /** + * Create a range of pagination URLs. + * + * @param int $start + * @param int $end + * @return array + */ + public function getUrlRange($start, $end) + { + return collect(range($start, $end))->mapWithKeys(function ($page) { + return [$page => $this->url($page)]; + })->all(); + } + + /** + * Get the URL for a given page number. + * + * @param int $page + * @return string + */ + public function url($page) + { + if ($page <= 0) { + $page = 1; + } + + // If we have any extra query string key / value pairs that need to be added + // onto the URL, we will put them in query string form and then attach it + // to the URL. This allows for extra information like sortings storage. + $parameters = [$this->pageName => $page]; + + if (count($this->query) > 0) { + $parameters = array_merge($this->query, $parameters); + } + + return $this->path() + .(Str::contains($this->path(), '?') ? '&' : '?') + .Arr::query($parameters) + .$this->buildFragment(); + } + + /** + * Get / set the URL fragment to be appended to URLs. + * + * @param string|null $fragment + * @return $this|string|null + */ + public function fragment($fragment = null) + { + if (is_null($fragment)) { + return $this->fragment; + } + + $this->fragment = $fragment; + + return $this; + } + + /** + * Add a set of query string values to the paginator. + * + * @param array|string|null $key + * @param string|null $value + * @return $this + */ + public function appends($key, $value = null) + { + if (is_null($key)) { + return $this; + } + + if (is_array($key)) { + return $this->appendArray($key); + } + + return $this->addQuery($key, $value); + } + + /** + * Add an array of query string values. + * + * @param array $keys + * @return $this + */ + protected function appendArray(array $keys) + { + foreach ($keys as $key => $value) { + $this->addQuery($key, $value); + } + + return $this; + } + + /** + * Add a query string value to the paginator. + * + * @param string $key + * @param string $value + * @return $this + */ + protected function addQuery($key, $value) + { + if ($key !== $this->pageName) { + $this->query[$key] = $value; + } + + return $this; + } + + /** + * Build the full fragment portion of a URL. + * + * @return string + */ + protected function buildFragment() + { + return $this->fragment ? '#'.$this->fragment : ''; + } + + /** + * Load a set of relationships onto the mixed relationship collection. + * + * @param string $relation + * @param array $relations + * @return $this + */ + public function loadMorph($relation, $relations) + { + $this->getCollection()->loadMorph($relation, $relations); + + return $this; + } + + /** + * Get the slice of items being paginated. + * + * @return array + */ + public function items() + { + return $this->items->all(); + } + + /** + * Get the number of the first item in the slice. + * + * @return int + */ + public function firstItem() + { + return count($this->items) > 0 ? ($this->currentPage - 1) * $this->perPage + 1 : null; + } + + /** + * Get the number of the last item in the slice. + * + * @return int + */ + public function lastItem() + { + return count($this->items) > 0 ? $this->firstItem() + $this->count() - 1 : null; + } + + /** + * Get the number of items shown per page. + * + * @return int + */ + public function perPage() + { + return $this->perPage; + } + + /** + * Determine if there are enough items to split into multiple pages. + * + * @return bool + */ + public function hasPages() + { + return $this->currentPage() != 1 || $this->hasMorePages(); + } + + /** + * Determine if the paginator is on the first page. + * + * @return bool + */ + public function onFirstPage() + { + return $this->currentPage() <= 1; + } + + /** + * Get the current page. + * + * @return int + */ + public function currentPage() + { + return $this->currentPage; + } + + /** + * Get the query string variable used to store the page. + * + * @return string + */ + public function getPageName() + { + return $this->pageName; + } + + /** + * Set the query string variable used to store the page. + * + * @param string $name + * @return $this + */ + public function setPageName($name) + { + $this->pageName = $name; + + return $this; + } + + /** + * Set the base path to assign to all URLs. + * + * @param string $path + * @return $this + */ + public function withPath($path) + { + return $this->setPath($path); + } + + /** + * Set the base path to assign to all URLs. + * + * @param string $path + * @return $this + */ + public function setPath($path) + { + $this->path = $path; + + return $this; + } + + /** + * Set the number of links to display on each side of current page link. + * + * @param int $count + * @return $this + */ + public function onEachSide($count) + { + $this->onEachSide = $count; + + return $this; + } + + /** + * Get the base path for paginator generated URLs. + * + * @return string|null + */ + public function path() + { + return $this->path; + } + + /** + * Resolve the current request path or return the default value. + * + * @param string $default + * @return string + */ + public static function resolveCurrentPath($default = '/') + { + if (isset(static::$currentPathResolver)) { + return call_user_func(static::$currentPathResolver); + } + + return $default; + } + + /** + * Set the current request path resolver callback. + * + * @param \Closure $resolver + * @return void + */ + public static function currentPathResolver(Closure $resolver) + { + static::$currentPathResolver = $resolver; + } + + /** + * Resolve the current page or return the default value. + * + * @param string $pageName + * @param int $default + * @return int + */ + public static function resolveCurrentPage($pageName = 'page', $default = 1) + { + if (isset(static::$currentPageResolver)) { + return (int) call_user_func(static::$currentPageResolver, $pageName); + } + + return $default; + } + + /** + * Set the current page resolver callback. + * + * @param \Closure $resolver + * @return void + */ + public static function currentPageResolver(Closure $resolver) + { + static::$currentPageResolver = $resolver; + } + + /** + * Get an instance of the view factory from the resolver. + * + * @return \Illuminate\Contracts\View\Factory + */ + public static function viewFactory() + { + return call_user_func(static::$viewFactoryResolver); + } + + /** + * Set the view factory resolver callback. + * + * @param \Closure $resolver + * @return void + */ + public static function viewFactoryResolver(Closure $resolver) + { + static::$viewFactoryResolver = $resolver; + } + + /** + * Set the default pagination view. + * + * @param string $view + * @return void + */ + public static function defaultView($view) + { + static::$defaultView = $view; + } + + /** + * Set the default "simple" pagination view. + * + * @param string $view + * @return void + */ + public static function defaultSimpleView($view) + { + static::$defaultSimpleView = $view; + } + + /** + * Indicate that Bootstrap 3 styling should be used for generated links. + * + * @return void + */ + public static function useBootstrapThree() + { + static::defaultView('pagination::default'); + static::defaultSimpleView('pagination::simple-default'); + } + + /** + * Get an iterator for the items. + * + * @return \ArrayIterator + */ + public function getIterator() + { + return $this->items->getIterator(); + } + + /** + * Determine if the list of items is empty. + * + * @return bool + */ + public function isEmpty() + { + return $this->items->isEmpty(); + } + + /** + * Determine if the list of items is not empty. + * + * @return bool + */ + public function isNotEmpty() + { + return $this->items->isNotEmpty(); + } + + /** + * Get the number of items for the current page. + * + * @return int + */ + public function count() + { + return $this->items->count(); + } + + /** + * Get the paginator's underlying collection. + * + * @return \Illuminate\Support\Collection + */ + public function getCollection() + { + return $this->items; + } + + /** + * Set the paginator's underlying collection. + * + * @param \Illuminate\Support\Collection $collection + * @return $this + */ + public function setCollection(Collection $collection) + { + $this->items = $collection; + + return $this; + } + + /** + * Get the paginator options. + * + * @return array + */ + public function getOptions() + { + return $this->options; + } + + /** + * Determine if the given item exists. + * + * @param mixed $key + * @return bool + */ + public function offsetExists($key) + { + return $this->items->has($key); + } + + /** + * Get the item at the given offset. + * + * @param mixed $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->items->get($key); + } + + /** + * Set the item at the given offset. + * + * @param mixed $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->items->put($key, $value); + } + + /** + * Unset the item at the given key. + * + * @param mixed $key + * @return void + */ + public function offsetUnset($key) + { + $this->items->forget($key); + } + + /** + * Render the contents of the paginator to HTML. + * + * @return string + */ + public function toHtml() + { + return (string) $this->render(); + } + + /** + * Make dynamic calls into the collection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->forwardCallTo($this->getCollection(), $method, $parameters); + } + + /** + * Render the contents of the paginator when casting to string. + * + * @return string + */ + public function __toString() + { + return (string) $this->render(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Pagination/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php b/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php new file mode 100644 index 00000000..1b381d64 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php @@ -0,0 +1,200 @@ +options = $options; + + foreach ($options as $key => $value) { + $this->{$key} = $value; + } + + $this->total = $total; + $this->perPage = $perPage; + $this->lastPage = max((int) ceil($total / $perPage), 1); + $this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path; + $this->currentPage = $this->setCurrentPage($currentPage, $this->pageName); + $this->items = $items instanceof Collection ? $items : Collection::make($items); + } + + /** + * Get the current page for the request. + * + * @param int $currentPage + * @param string $pageName + * @return int + */ + protected function setCurrentPage($currentPage, $pageName) + { + $currentPage = $currentPage ?: static::resolveCurrentPage($pageName); + + return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1; + } + + /** + * Render the paginator using the given view. + * + * @param string|null $view + * @param array $data + * @return \Illuminate\Contracts\Support\Htmlable + */ + public function links($view = null, $data = []) + { + return $this->render($view, $data); + } + + /** + * Render the paginator using the given view. + * + * @param string|null $view + * @param array $data + * @return \Illuminate\Contracts\Support\Htmlable + */ + public function render($view = null, $data = []) + { + return static::viewFactory()->make($view ?: static::$defaultView, array_merge($data, [ + 'paginator' => $this, + 'elements' => $this->elements(), + ])); + } + + /** + * Get the array of elements to pass to the view. + * + * @return array + */ + protected function elements() + { + $window = UrlWindow::make($this); + + return array_filter([ + $window['first'], + is_array($window['slider']) ? '...' : null, + $window['slider'], + is_array($window['last']) ? '...' : null, + $window['last'], + ]); + } + + /** + * Get the total number of items being paginated. + * + * @return int + */ + public function total() + { + return $this->total; + } + + /** + * Determine if there are more items in the data source. + * + * @return bool + */ + public function hasMorePages() + { + return $this->currentPage() < $this->lastPage(); + } + + /** + * Get the URL for the next page. + * + * @return string|null + */ + public function nextPageUrl() + { + if ($this->lastPage() > $this->currentPage()) { + return $this->url($this->currentPage() + 1); + } + } + + /** + * Get the last page. + * + * @return int + */ + public function lastPage() + { + return $this->lastPage; + } + + /** + * Get the instance as an array. + * + * @return array + */ + public function toArray() + { + return [ + 'current_page' => $this->currentPage(), + 'data' => $this->items->toArray(), + 'first_page_url' => $this->url(1), + 'from' => $this->firstItem(), + 'last_page' => $this->lastPage(), + 'last_page_url' => $this->url($this->lastPage()), + 'next_page_url' => $this->nextPageUrl(), + 'path' => $this->path(), + 'per_page' => $this->perPage(), + 'prev_page_url' => $this->previousPageUrl(), + 'to' => $this->lastItem(), + 'total' => $this->total(), + ]; + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Convert the object to its JSON representation. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->jsonSerialize(), $options); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php new file mode 100755 index 00000000..ed58ccf6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php @@ -0,0 +1,50 @@ +loadViewsFrom(__DIR__.'/resources/views', 'pagination'); + + if ($this->app->runningInConsole()) { + $this->publishes([ + __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/pagination'), + ], 'laravel-pagination'); + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + Paginator::viewFactoryResolver(function () { + return $this->app['view']; + }); + + Paginator::currentPathResolver(function () { + return $this->app['request']->url(); + }); + + Paginator::currentPageResolver(function ($pageName = 'page') { + $page = $this->app['request']->input($pageName); + + if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) { + return (int) $page; + } + + return 1; + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php b/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php new file mode 100644 index 00000000..eb664eef --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php @@ -0,0 +1,176 @@ +options = $options; + + foreach ($options as $key => $value) { + $this->{$key} = $value; + } + + $this->perPage = $perPage; + $this->currentPage = $this->setCurrentPage($currentPage); + $this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path; + + $this->setItems($items); + } + + /** + * Get the current page for the request. + * + * @param int $currentPage + * @return int + */ + protected function setCurrentPage($currentPage) + { + $currentPage = $currentPage ?: static::resolveCurrentPage(); + + return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1; + } + + /** + * Set the items for the paginator. + * + * @param mixed $items + * @return void + */ + protected function setItems($items) + { + $this->items = $items instanceof Collection ? $items : Collection::make($items); + + $this->hasMore = $this->items->count() > $this->perPage; + + $this->items = $this->items->slice(0, $this->perPage); + } + + /** + * Get the URL for the next page. + * + * @return string|null + */ + public function nextPageUrl() + { + if ($this->hasMorePages()) { + return $this->url($this->currentPage() + 1); + } + } + + /** + * Render the paginator using the given view. + * + * @param string|null $view + * @param array $data + * @return string + */ + public function links($view = null, $data = []) + { + return $this->render($view, $data); + } + + /** + * Render the paginator using the given view. + * + * @param string|null $view + * @param array $data + * @return \Illuminate\Contracts\Support\Htmlable + */ + public function render($view = null, $data = []) + { + return static::viewFactory()->make($view ?: static::$defaultSimpleView, array_merge($data, [ + 'paginator' => $this, + ])); + } + + /** + * Manually indicate that the paginator does have more pages. + * + * @param bool $hasMore + * @return $this + */ + public function hasMorePagesWhen($hasMore = true) + { + $this->hasMore = $hasMore; + + return $this; + } + + /** + * Determine if there are more items in the data source. + * + * @return bool + */ + public function hasMorePages() + { + return $this->hasMore; + } + + /** + * Get the instance as an array. + * + * @return array + */ + public function toArray() + { + return [ + 'current_page' => $this->currentPage(), + 'data' => $this->items->toArray(), + 'first_page_url' => $this->url(1), + 'from' => $this->firstItem(), + 'next_page_url' => $this->nextPageUrl(), + 'path' => $this->path(), + 'per_page' => $this->perPage(), + 'prev_page_url' => $this->previousPageUrl(), + 'to' => $this->lastItem(), + ]; + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Convert the object to its JSON representation. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->jsonSerialize(), $options); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindow.php b/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindow.php new file mode 100644 index 00000000..0fd3aa82 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindow.php @@ -0,0 +1,218 @@ +paginator = $paginator; + } + + /** + * Create a new URL window instance. + * + * @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator + * @return array + */ + public static function make(PaginatorContract $paginator) + { + return (new static($paginator))->get(); + } + + /** + * Get the window of URLs to be shown. + * + * @return array + */ + public function get() + { + $onEachSide = $this->paginator->onEachSide; + + if ($this->paginator->lastPage() < ($onEachSide * 2) + 6) { + return $this->getSmallSlider(); + } + + return $this->getUrlSlider($onEachSide); + } + + /** + * Get the slider of URLs there are not enough pages to slide. + * + * @return array + */ + protected function getSmallSlider() + { + return [ + 'first' => $this->paginator->getUrlRange(1, $this->lastPage()), + 'slider' => null, + 'last' => null, + ]; + } + + /** + * Create a URL slider links. + * + * @param int $onEachSide + * @return array + */ + protected function getUrlSlider($onEachSide) + { + $window = $onEachSide * 2; + + if (! $this->hasPages()) { + return ['first' => null, 'slider' => null, 'last' => null]; + } + + // If the current page is very close to the beginning of the page range, we will + // just render the beginning of the page range, followed by the last 2 of the + // links in this list, since we will not have room to create a full slider. + if ($this->currentPage() <= $window) { + return $this->getSliderTooCloseToBeginning($window); + } + + // If the current page is close to the ending of the page range we will just get + // this first couple pages, followed by a larger window of these ending pages + // since we're too close to the end of the list to create a full on slider. + elseif ($this->currentPage() > ($this->lastPage() - $window)) { + return $this->getSliderTooCloseToEnding($window); + } + + // If we have enough room on both sides of the current page to build a slider we + // will surround it with both the beginning and ending caps, with this window + // of pages in the middle providing a Google style sliding paginator setup. + return $this->getFullSlider($onEachSide); + } + + /** + * Get the slider of URLs when too close to beginning of window. + * + * @param int $window + * @return array + */ + protected function getSliderTooCloseToBeginning($window) + { + return [ + 'first' => $this->paginator->getUrlRange(1, $window + 2), + 'slider' => null, + 'last' => $this->getFinish(), + ]; + } + + /** + * Get the slider of URLs when too close to ending of window. + * + * @param int $window + * @return array + */ + protected function getSliderTooCloseToEnding($window) + { + $last = $this->paginator->getUrlRange( + $this->lastPage() - ($window + 2), + $this->lastPage() + ); + + return [ + 'first' => $this->getStart(), + 'slider' => null, + 'last' => $last, + ]; + } + + /** + * Get the slider of URLs when a full slider can be made. + * + * @param int $onEachSide + * @return array + */ + protected function getFullSlider($onEachSide) + { + return [ + 'first' => $this->getStart(), + 'slider' => $this->getAdjacentUrlRange($onEachSide), + 'last' => $this->getFinish(), + ]; + } + + /** + * Get the page range for the current page window. + * + * @param int $onEachSide + * @return array + */ + public function getAdjacentUrlRange($onEachSide) + { + return $this->paginator->getUrlRange( + $this->currentPage() - $onEachSide, + $this->currentPage() + $onEachSide + ); + } + + /** + * Get the starting URLs of a pagination slider. + * + * @return array + */ + public function getStart() + { + return $this->paginator->getUrlRange(1, 2); + } + + /** + * Get the ending URLs of a pagination slider. + * + * @return array + */ + public function getFinish() + { + return $this->paginator->getUrlRange( + $this->lastPage() - 1, + $this->lastPage() + ); + } + + /** + * Determine if the underlying paginator being presented has pages to show. + * + * @return bool + */ + public function hasPages() + { + return $this->paginator->lastPage() > 1; + } + + /** + * Get the current page from the paginator. + * + * @return int + */ + protected function currentPage() + { + return $this->paginator->currentPage(); + } + + /** + * Get the last page from the paginator. + * + * @return int + */ + protected function lastPage() + { + return $this->paginator->lastPage(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/composer.json b/vendor/laravel/framework/src/Illuminate/Pagination/composer.json new file mode 100755 index 00000000..c8f96651 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/composer.json @@ -0,0 +1,36 @@ +{ + "name": "illuminate/pagination", + "description": "The Illuminate Pagination package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "ext-json": "*", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Pagination\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php new file mode 100644 index 00000000..63c6f56b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php @@ -0,0 +1,46 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/default.blade.php b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/default.blade.php new file mode 100644 index 00000000..0db70b56 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/default.blade.php @@ -0,0 +1,46 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/semantic-ui.blade.php b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/semantic-ui.blade.php new file mode 100644 index 00000000..ef0dbb18 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/semantic-ui.blade.php @@ -0,0 +1,36 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php new file mode 100644 index 00000000..4bb49174 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php @@ -0,0 +1,27 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-default.blade.php b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-default.blade.php new file mode 100644 index 00000000..36bdbc18 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-default.blade.php @@ -0,0 +1,19 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/vendor/laravel/framework/src/Illuminate/Pipeline/Hub.php b/vendor/laravel/framework/src/Illuminate/Pipeline/Hub.php new file mode 100644 index 00000000..87331a57 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pipeline/Hub.php @@ -0,0 +1,74 @@ +container = $container; + } + + /** + * Define the default named pipeline. + * + * @param \Closure $callback + * @return void + */ + public function defaults(Closure $callback) + { + return $this->pipeline('default', $callback); + } + + /** + * Define a new named pipeline. + * + * @param string $name + * @param \Closure $callback + * @return void + */ + public function pipeline($name, Closure $callback) + { + $this->pipelines[$name] = $callback; + } + + /** + * Send an object through one of the available pipelines. + * + * @param mixed $object + * @param string|null $pipeline + * @return mixed + */ + public function pipe($object, $pipeline = null) + { + $pipeline = $pipeline ?: 'default'; + + return call_user_func( + $this->pipelines[$pipeline], new Pipeline($this->container), $object + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pipeline/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Pipeline/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pipeline/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Pipeline/Pipeline.php b/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php new file mode 100644 index 00000000..32b80e2a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php @@ -0,0 +1,251 @@ +container = $container; + } + + /** + * Set the object being sent through the pipeline. + * + * @param mixed $passable + * @return $this + */ + public function send($passable) + { + $this->passable = $passable; + + return $this; + } + + /** + * Set the array of pipes. + * + * @param array|mixed $pipes + * @return $this + */ + public function through($pipes) + { + $this->pipes = is_array($pipes) ? $pipes : func_get_args(); + + return $this; + } + + /** + * Set the method to call on the pipes. + * + * @param string $method + * @return $this + */ + public function via($method) + { + $this->method = $method; + + return $this; + } + + /** + * Run the pipeline with a final destination callback. + * + * @param \Closure $destination + * @return mixed + */ + public function then(Closure $destination) + { + $pipeline = array_reduce( + array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination) + ); + + return $pipeline($this->passable); + } + + /** + * Run the pipeline and return the result. + * + * @return mixed + */ + public function thenReturn() + { + return $this->then(function ($passable) { + return $passable; + }); + } + + /** + * Get the final piece of the Closure onion. + * + * @param \Closure $destination + * @return \Closure + */ + protected function prepareDestination(Closure $destination) + { + return function ($passable) use ($destination) { + try { + return $destination($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + if (is_callable($pipe)) { + // If the pipe is a callable, then we will call it directly, but otherwise we + // will resolve the pipes out of the dependency container and call it with + // the appropriate method and arguments, returning the results back out. + return $pipe($passable, $stack); + } elseif (! is_object($pipe)) { + [$name, $parameters] = $this->parsePipeString($pipe); + + // If the pipe is a string we will parse the string and resolve the class out + // of the dependency injection container. We can then build a callable and + // execute the pipe function giving in the parameters that are required. + $pipe = $this->getContainer()->make($name); + + $parameters = array_merge([$passable, $stack], $parameters); + } else { + // If the pipe is already an object we'll just make a callable and pass it to + // the pipe as-is. There is no need to do any extra parsing and formatting + // since the object we're given was already a fully instantiated object. + $parameters = [$passable, $stack]; + } + + $carry = method_exists($pipe, $this->method) + ? $pipe->{$this->method}(...$parameters) + : $pipe(...$parameters); + + return $this->handleCarry($carry); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + }; + } + + /** + * Parse full pipe string to get name and parameters. + * + * @param string $pipe + * @return array + */ + protected function parsePipeString($pipe) + { + [$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters]; + } + + /** + * Get the array of configured pipes. + * + * @return array + */ + protected function pipes() + { + return $this->pipes; + } + + /** + * Get the container instance. + * + * @return \Illuminate\Contracts\Container\Container + * + * @throws \RuntimeException + */ + protected function getContainer() + { + if (! $this->container) { + throw new RuntimeException('A container instance has not been passed to the Pipeline.'); + } + + return $this->container; + } + + /** + * Handle the value returned from each pipe before passing it to the next. + * + * @param mixed $carry + * @return mixed + */ + protected function handleCarry($carry) + { + return $carry; + } + + /** + * Handle the given exception. + * + * @param mixed $passable + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + protected function handleException($passable, Exception $e) + { + throw $e; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php new file mode 100644 index 00000000..982608b6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php @@ -0,0 +1,34 @@ +app->singleton( + PipelineHubContract::class, Hub::class + ); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + PipelineHubContract::class, + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json b/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json new file mode 100644 index 00000000..1d6a6b93 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json @@ -0,0 +1,36 @@ +{ + "name": "illuminate/pipeline", + "description": "The Illuminate Pipeline package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0", + "symfony/debug": "^4.3.4" + }, + "autoload": { + "psr-4": { + "Illuminate\\Pipeline\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php b/vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php new file mode 100755 index 00000000..49c36bda --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php @@ -0,0 +1,172 @@ +default = $default; + $this->blockFor = $blockFor; + $this->timeToRun = $timeToRun; + $this->pheanstalk = $pheanstalk; + } + + /** + * Get the size of the queue. + * + * @param string|null $queue + * @return int + */ + public function size($queue = null) + { + $queue = $this->getQueue($queue); + + return (int) $this->pheanstalk->statsTube($queue)->current_jobs_ready; + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string|null $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushRaw($this->createPayload($job, $this->getQueue($queue), $data), $queue); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string|null $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + return $this->pheanstalk->useTube($this->getQueue($queue))->put( + $payload, Pheanstalk::DEFAULT_PRIORITY, Pheanstalk::DEFAULT_DELAY, $this->timeToRun + ); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @param string|null $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + $pheanstalk = $this->pheanstalk->useTube($this->getQueue($queue)); + + return $pheanstalk->put( + $this->createPayload($job, $this->getQueue($queue), $data), + Pheanstalk::DEFAULT_PRIORITY, + $this->secondsUntil($delay), + $this->timeToRun + ); + } + + /** + * Pop the next job off of the queue. + * + * @param string|null $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + $queue = $this->getQueue($queue); + + $job = $this->pheanstalk->watchOnly($queue)->reserveWithTimeout($this->blockFor); + + if ($job instanceof PheanstalkJob) { + return new BeanstalkdJob( + $this->container, $this->pheanstalk, $job, $this->connectionName, $queue + ); + } + } + + /** + * Delete a message from the Beanstalk queue. + * + * @param string $queue + * @param string|int $id + * @return void + */ + public function deleteMessage($queue, $id) + { + $queue = $this->getQueue($queue); + + $this->pheanstalk->useTube($queue)->delete(new PheanstalkJob($id, '')); + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + public function getQueue($queue) + { + return $queue ?: $this->default; + } + + /** + * Get the underlying Pheanstalk instance. + * + * @return \Pheanstalk\Pheanstalk + */ + public function getPheanstalk() + { + return $this->pheanstalk; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedClosure.php b/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedClosure.php new file mode 100644 index 00000000..e653b255 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedClosure.php @@ -0,0 +1,74 @@ +closure = $closure; + } + + /** + * Create a new job instance. + * + * @param \Closure $job + * @return self + */ + public static function create(Closure $job) + { + return new self(new SerializableClosure($job)); + } + + /** + * Execute the job. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function handle(Container $container) + { + $container->call($this->closure->getClosure()); + } + + /** + * Get the display name for the queued job. + * + * @return string + */ + public function displayName() + { + $reflection = new ReflectionFunction($this->closure->getClosure()); + + return 'Closure ('.basename($reflection->getFileName()).':'.$reflection->getStartLine().')'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php b/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php new file mode 100644 index 00000000..a3241abb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php @@ -0,0 +1,177 @@ +container = $container; + $this->dispatcher = $dispatcher; + } + + /** + * Handle the queued job. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param array $data + * @return void + */ + public function call(Job $job, array $data) + { + try { + $command = $this->setJobInstanceIfNecessary( + $job, unserialize($data['command']) + ); + } catch (ModelNotFoundException $e) { + return $this->handleModelNotFound($job, $e); + } + + $this->dispatchThroughMiddleware($job, $command); + + if (! $job->hasFailed() && ! $job->isReleased()) { + $this->ensureNextJobInChainIsDispatched($command); + } + + if (! $job->isDeletedOrReleased()) { + $job->delete(); + } + } + + /** + * Dispatch the given job / command through its specified middleware. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param mixed $command + * @return mixed + */ + protected function dispatchThroughMiddleware(Job $job, $command) + { + return (new Pipeline($this->container))->send($command) + ->through(array_merge(method_exists($command, 'middleware') ? $command->middleware() : [], $command->middleware ?? [])) + ->then(function ($command) use ($job) { + return $this->dispatcher->dispatchNow( + $command, $this->resolveHandler($job, $command) + ); + }); + } + + /** + * Resolve the handler for the given command. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param mixed $command + * @return mixed + */ + protected function resolveHandler($job, $command) + { + $handler = $this->dispatcher->getCommandHandler($command) ?: null; + + if ($handler) { + $this->setJobInstanceIfNecessary($job, $handler); + } + + return $handler; + } + + /** + * Set the job instance of the given class if necessary. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param mixed $instance + * @return mixed + */ + protected function setJobInstanceIfNecessary(Job $job, $instance) + { + if (in_array(InteractsWithQueue::class, class_uses_recursive($instance))) { + $instance->setJob($job); + } + + return $instance; + } + + /** + * Ensure the next job in the chain is dispatched if applicable. + * + * @param mixed $command + * @return void + */ + protected function ensureNextJobInChainIsDispatched($command) + { + if (method_exists($command, 'dispatchNextJobInChain')) { + $command->dispatchNextJobInChain(); + } + } + + /** + * Handle a model not found exception. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param \Exception $e + * @return void + */ + protected function handleModelNotFound(Job $job, $e) + { + $class = $job->resolveName(); + + try { + $shouldDelete = (new ReflectionClass($class)) + ->getDefaultProperties()['deleteWhenMissingModels'] ?? false; + } catch (Exception $e) { + $shouldDelete = false; + } + + if ($shouldDelete) { + return $job->delete(); + } + + return $job->fail($e); + } + + /** + * Call the failed method on the job instance. + * + * The exception that caused the failure will be passed. + * + * @param array $data + * @param \Exception $e + * @return void + */ + public function failed(array $data, $e) + { + $command = unserialize($data['command']); + + if (method_exists($command, 'failed')) { + $command->failed($e); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Capsule/Manager.php b/vendor/laravel/framework/src/Illuminate/Queue/Capsule/Manager.php new file mode 100644 index 00000000..046555af --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Capsule/Manager.php @@ -0,0 +1,187 @@ +setupContainer($container ?: new Container); + + // Once we have the container setup, we will setup the default configuration + // options in the container "config" bindings. This just makes this queue + // manager behave correctly since all the correct binding are in place. + $this->setupDefaultConfiguration(); + + $this->setupManager(); + + $this->registerConnectors(); + } + + /** + * Setup the default queue configuration options. + * + * @return void + */ + protected function setupDefaultConfiguration() + { + $this->container['config']['queue.default'] = 'default'; + } + + /** + * Build the queue manager instance. + * + * @return void + */ + protected function setupManager() + { + $this->manager = new QueueManager($this->container); + } + + /** + * Register the default connectors that the component ships with. + * + * @return void + */ + protected function registerConnectors() + { + $provider = new QueueServiceProvider($this->container); + + $provider->registerConnectors($this->manager); + } + + /** + * Get a connection instance from the global manager. + * + * @param string|null $connection + * @return \Illuminate\Contracts\Queue\Queue + */ + public static function connection($connection = null) + { + return static::$instance->getConnection($connection); + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string|null $queue + * @param string|null $connection + * @return mixed + */ + public static function push($job, $data = '', $queue = null, $connection = null) + { + return static::$instance->connection($connection)->push($job, $data, $queue); + } + + /** + * Push a new an array of jobs onto the queue. + * + * @param array $jobs + * @param mixed $data + * @param string|null $queue + * @param string|null $connection + * @return mixed + */ + public static function bulk($jobs, $data = '', $queue = null, $connection = null) + { + return static::$instance->connection($connection)->bulk($jobs, $data, $queue); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @param string|null $queue + * @param string|null $connection + * @return mixed + */ + public static function later($delay, $job, $data = '', $queue = null, $connection = null) + { + return static::$instance->connection($connection)->later($delay, $job, $data, $queue); + } + + /** + * Get a registered connection instance. + * + * @param string|null $name + * @return \Illuminate\Contracts\Queue\Queue + */ + public function getConnection($name = null) + { + return $this->manager->connection($name); + } + + /** + * Register a connection with the manager. + * + * @param array $config + * @param string $name + * @return void + */ + public function addConnection(array $config, $name = 'default') + { + $this->container['config']["queue.connections.{$name}"] = $config; + } + + /** + * Get the queue manager instance. + * + * @return \Illuminate\Queue\QueueManager + */ + public function getQueueManager() + { + return $this->manager; + } + + /** + * Pass dynamic instance methods to the manager. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->manager->$method(...$parameters); + } + + /** + * Dynamically pass methods to the default connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + return static::connection()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php new file mode 100755 index 00000000..b54d8019 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php @@ -0,0 +1,41 @@ +pheanstalk($config), + $config['queue'], + $config['retry_after'] ?? Pheanstalk::DEFAULT_TTR, + $config['block_for'] ?? 0 + ); + } + + /** + * Create a Pheanstalk instance. + * + * @param array $config + * @return \Pheanstalk\Pheanstalk + */ + protected function pheanstalk(array $config) + { + return Pheanstalk::create( + $config['host'], + $config['port'] ?? Pheanstalk::DEFAULT_PORT, + $config['timeout'] ?? Connection::DEFAULT_CONNECT_TIMEOUT + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Connectors/ConnectorInterface.php b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/ConnectorInterface.php new file mode 100755 index 00000000..617bf09d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/ConnectorInterface.php @@ -0,0 +1,14 @@ +connections = $connections; + } + + /** + * Establish a queue connection. + * + * @param array $config + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connect(array $config) + { + return new DatabaseQueue( + $this->connections->connection($config['connection'] ?? null), + $config['table'], + $config['queue'], + $config['retry_after'] ?? 60 + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Connectors/NullConnector.php b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/NullConnector.php new file mode 100644 index 00000000..39de4800 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/NullConnector.php @@ -0,0 +1,19 @@ +redis = $redis; + $this->connection = $connection; + } + + /** + * Establish a queue connection. + * + * @param array $config + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connect(array $config) + { + return new RedisQueue( + $this->redis, $config['queue'], + $config['connection'] ?? $this->connection, + $config['retry_after'] ?? 60, + $config['block_for'] ?? null + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php new file mode 100755 index 00000000..9987f922 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php @@ -0,0 +1,46 @@ +getDefaultConfiguration($config); + + if (! empty($config['key']) && ! empty($config['secret'])) { + $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); + } + + return new SqsQueue( + new SqsClient($config), $config['queue'], $config['prefix'] ?? '' + ); + } + + /** + * Get the default configuration for SQS. + * + * @param array $config + * @return array + */ + protected function getDefaultConfiguration(array $config) + { + return array_merge([ + 'version' => 'latest', + 'http' => [ + 'timeout' => 60, + 'connect_timeout' => 60, + ], + ], $config); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SyncConnector.php b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SyncConnector.php new file mode 100755 index 00000000..4269b803 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SyncConnector.php @@ -0,0 +1,19 @@ +files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $table = $this->laravel['config']['queue.failed.table']; + + $this->replaceMigration( + $this->createBaseMigration($table), $table, Str::studly($table) + ); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the table. + * + * @param string $table + * @return string + */ + protected function createBaseMigration($table = 'failed_jobs') + { + return $this->laravel['migration.creator']->create( + 'create_'.$table.'_table', $this->laravel->databasePath().'/migrations' + ); + } + + /** + * Replace the generated migration with the failed job table stub. + * + * @param string $path + * @param string $table + * @param string $tableClassName + * @return void + */ + protected function replaceMigration($path, $table, $tableClassName) + { + $stub = str_replace( + ['{{table}}', '{{tableClassName}}'], + [$table, $tableClassName], + $this->files->get(__DIR__.'/stubs/failed_jobs.stub') + ); + + $this->files->put($path, $stub); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/FlushFailedCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/FlushFailedCommand.php new file mode 100644 index 00000000..550b8600 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/FlushFailedCommand.php @@ -0,0 +1,34 @@ +laravel['queue.failer']->flush(); + + $this->info('All failed jobs deleted successfully!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/ForgetFailedCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/ForgetFailedCommand.php new file mode 100644 index 00000000..b8eecb96 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/ForgetFailedCommand.php @@ -0,0 +1,36 @@ +laravel['queue.failer']->forget($this->argument('id'))) { + $this->info('Failed job deleted successfully!'); + } else { + $this->error('No failed job matches the given ID.'); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/ListFailedCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/ListFailedCommand.php new file mode 100644 index 00000000..614b8977 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/ListFailedCommand.php @@ -0,0 +1,114 @@ +getFailedJobs()) === 0) { + return $this->info('No failed jobs!'); + } + + $this->displayFailedJobs($jobs); + } + + /** + * Compile the failed jobs into a displayable format. + * + * @return array + */ + protected function getFailedJobs() + { + $failed = $this->laravel['queue.failer']->all(); + + return collect($failed)->map(function ($failed) { + return $this->parseFailedJob((array) $failed); + })->filter()->all(); + } + + /** + * Parse the failed job row. + * + * @param array $failed + * @return array + */ + protected function parseFailedJob(array $failed) + { + $row = array_values(Arr::except($failed, ['payload', 'exception'])); + + array_splice($row, 3, 0, $this->extractJobName($failed['payload'])); + + return $row; + } + + /** + * Extract the failed job name from payload. + * + * @param string $payload + * @return string|null + */ + private function extractJobName($payload) + { + $payload = json_decode($payload, true); + + if ($payload && (! isset($payload['data']['command']))) { + return $payload['job'] ?? null; + } elseif ($payload && isset($payload['data']['command'])) { + return $this->matchJobName($payload); + } + } + + /** + * Match the job name from the payload. + * + * @param array $payload + * @return string + */ + protected function matchJobName($payload) + { + preg_match('/"([^"]+)"/', $payload['data']['command'], $matches); + + return $matches[1] ?? $payload['job'] ?? null; + } + + /** + * Display the failed jobs in the console. + * + * @param array $jobs + * @return void + */ + protected function displayFailedJobs(array $jobs) + { + $this->table($this->headers, $jobs); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php new file mode 100755 index 00000000..ff4ed1af --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php @@ -0,0 +1,114 @@ +setOutputHandler($this->listener = $listener); + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + // We need to get the right queue for the connection which is set in the queue + // configuration file for the application. We will pull it based on the set + // connection being run for the queue operation currently being executed. + $queue = $this->getQueue( + $connection = $this->input->getArgument('connection') + ); + + $this->listener->listen( + $connection, $queue, $this->gatherOptions() + ); + } + + /** + * Get the name of the queue connection to listen on. + * + * @param string $connection + * @return string + */ + protected function getQueue($connection) + { + $connection = $connection ?: $this->laravel['config']['queue.default']; + + return $this->input->getOption('queue') ?: $this->laravel['config']->get( + "queue.connections.{$connection}.queue", 'default' + ); + } + + /** + * Get the listener options for the command. + * + * @return \Illuminate\Queue\ListenerOptions + */ + protected function gatherOptions() + { + return new ListenerOptions( + $this->option('env'), $this->option('delay'), + $this->option('memory'), $this->option('timeout'), + $this->option('sleep'), $this->option('tries'), + $this->option('force') + ); + } + + /** + * Set the options on the queue listener. + * + * @param \Illuminate\Queue\Listener $listener + * @return void + */ + protected function setOutputHandler(Listener $listener) + { + $listener->setOutputHandler(function ($type, $line) { + $this->output->write($line); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/RestartCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/RestartCommand.php new file mode 100644 index 00000000..9c610d92 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/RestartCommand.php @@ -0,0 +1,58 @@ +cache = $cache; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->cache->forever('illuminate:queue:restart', $this->currentTime()); + + $this->info('Broadcasting queue restart signal.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/RetryCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/RetryCommand.php new file mode 100644 index 00000000..c218ed48 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/RetryCommand.php @@ -0,0 +1,93 @@ +getJobIds() as $id) { + $job = $this->laravel['queue.failer']->find($id); + + if (is_null($job)) { + $this->error("Unable to find failed job with ID [{$id}]."); + } else { + $this->retryJob($job); + + $this->info("The failed job [{$id}] has been pushed back onto the queue!"); + + $this->laravel['queue.failer']->forget($id); + } + } + } + + /** + * Get the job IDs to be retried. + * + * @return array + */ + protected function getJobIds() + { + $ids = (array) $this->argument('id'); + + if (count($ids) === 1 && $ids[0] === 'all') { + $ids = Arr::pluck($this->laravel['queue.failer']->all(), 'id'); + } + + return $ids; + } + + /** + * Retry the queue job. + * + * @param \stdClass $job + * @return void + */ + protected function retryJob($job) + { + $this->laravel['queue']->connection($job->connection)->pushRaw( + $this->resetAttempts($job->payload), $job->queue + ); + } + + /** + * Reset the payload attempts. + * + * Applicable to Redis jobs which store attempts in their payload. + * + * @param string $payload + * @return string + */ + protected function resetAttempts($payload) + { + $payload = json_decode($payload, true); + + if (isset($payload['attempts'])) { + $payload['attempts'] = 0; + } + + return json_encode($payload); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/TableCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/TableCommand.php new file mode 100644 index 00000000..cc949d48 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/TableCommand.php @@ -0,0 +1,102 @@ +files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $table = $this->laravel['config']['queue.connections.database.table']; + + $this->replaceMigration( + $this->createBaseMigration($table), $table, Str::studly($table) + ); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the table. + * + * @param string $table + * @return string + */ + protected function createBaseMigration($table = 'jobs') + { + return $this->laravel['migration.creator']->create( + 'create_'.$table.'_table', $this->laravel->databasePath().'/migrations' + ); + } + + /** + * Replace the generated migration with the job table stub. + * + * @param string $path + * @param string $table + * @param string $tableClassName + * @return void + */ + protected function replaceMigration($path, $table, $tableClassName) + { + $stub = str_replace( + ['{{table}}', '{{tableClassName}}'], + [$table, $tableClassName], + $this->files->get(__DIR__.'/stubs/jobs.stub') + ); + + $this->files->put($path, $stub); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php new file mode 100644 index 00000000..0b9e7503 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php @@ -0,0 +1,226 @@ +cache = $cache; + $this->worker = $worker; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + if ($this->downForMaintenance() && $this->option('once')) { + return $this->worker->sleep($this->option('sleep')); + } + + // We'll listen to the processed and failed events so we can write information + // to the console as jobs are processed, which will let the developer watch + // which jobs are coming through a queue and be informed on its progress. + $this->listenForEvents(); + + $connection = $this->argument('connection') + ?: $this->laravel['config']['queue.default']; + + // We need to get the right queue for the connection which is set in the queue + // configuration file for the application. We will pull it based on the set + // connection being run for the queue operation currently being executed. + $queue = $this->getQueue($connection); + + $this->runWorker( + $connection, $queue + ); + } + + /** + * Run the worker instance. + * + * @param string $connection + * @param string $queue + * @return array + */ + protected function runWorker($connection, $queue) + { + $this->worker->setCache($this->cache); + + return $this->worker->{$this->option('once') ? 'runNextJob' : 'daemon'}( + $connection, $queue, $this->gatherWorkerOptions() + ); + } + + /** + * Gather all of the queue worker options as a single object. + * + * @return \Illuminate\Queue\WorkerOptions + */ + protected function gatherWorkerOptions() + { + return new WorkerOptions( + $this->option('delay'), $this->option('memory'), + $this->option('timeout'), $this->option('sleep'), + $this->option('tries'), $this->option('force'), + $this->option('stop-when-empty') + ); + } + + /** + * Listen for the queue events in order to update the console output. + * + * @return void + */ + protected function listenForEvents() + { + $this->laravel['events']->listen(JobProcessing::class, function ($event) { + $this->writeOutput($event->job, 'starting'); + }); + + $this->laravel['events']->listen(JobProcessed::class, function ($event) { + $this->writeOutput($event->job, 'success'); + }); + + $this->laravel['events']->listen(JobFailed::class, function ($event) { + $this->writeOutput($event->job, 'failed'); + + $this->logFailedJob($event); + }); + } + + /** + * Write the status output for the queue worker. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param string $status + * @return void + */ + protected function writeOutput(Job $job, $status) + { + switch ($status) { + case 'starting': + return $this->writeStatus($job, 'Processing', 'comment'); + case 'success': + return $this->writeStatus($job, 'Processed', 'info'); + case 'failed': + return $this->writeStatus($job, 'Failed', 'error'); + } + } + + /** + * Format the status output for the queue worker. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param string $status + * @param string $type + * @return void + */ + protected function writeStatus(Job $job, $status, $type) + { + $this->output->writeln(sprintf( + "<{$type}>[%s][%s] %s %s", + Carbon::now()->format('Y-m-d H:i:s'), + $job->getJobId(), + str_pad("{$status}:", 11), $job->resolveName() + )); + } + + /** + * Store a failed job event. + * + * @param \Illuminate\Queue\Events\JobFailed $event + * @return void + */ + protected function logFailedJob(JobFailed $event) + { + $this->laravel['queue.failer']->log( + $event->connectionName, $event->job->getQueue(), + $event->job->getRawBody(), $event->exception + ); + } + + /** + * Get the queue name for the worker. + * + * @param string $connection + * @return string + */ + protected function getQueue($connection) + { + return $this->option('queue') ?: $this->laravel['config']->get( + "queue.connections.{$connection}.queue", 'default' + ); + } + + /** + * Determine if the worker should run in maintenance mode. + * + * @return bool + */ + protected function downForMaintenance() + { + return $this->option('force') ? false : $this->laravel->isDownForMaintenance(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/failed_jobs.stub b/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/failed_jobs.stub new file mode 100644 index 00000000..a7e612f8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/failed_jobs.stub @@ -0,0 +1,35 @@ +bigIncrements('id'); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('{{table}}'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/jobs.stub b/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/jobs.stub new file mode 100644 index 00000000..45d6031d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/jobs.stub @@ -0,0 +1,36 @@ +bigIncrements('id'); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('{{table}}'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php b/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php new file mode 100644 index 00000000..aa52e8d5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php @@ -0,0 +1,344 @@ +table = $table; + $this->default = $default; + $this->database = $database; + $this->retryAfter = $retryAfter; + } + + /** + * Get the size of the queue. + * + * @param string|null $queue + * @return int + */ + public function size($queue = null) + { + return $this->database->table($this->table) + ->where('queue', $this->getQueue($queue)) + ->count(); + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string|null $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushToDatabase($queue, $this->createPayload( + $job, $this->getQueue($queue), $data + )); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string|null $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + return $this->pushToDatabase($queue, $payload); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @param string|null $queue + * @return void + */ + public function later($delay, $job, $data = '', $queue = null) + { + return $this->pushToDatabase($queue, $this->createPayload( + $job, $this->getQueue($queue), $data + ), $delay); + } + + /** + * Push an array of jobs onto the queue. + * + * @param array $jobs + * @param mixed $data + * @param string|null $queue + * @return mixed + */ + public function bulk($jobs, $data = '', $queue = null) + { + $queue = $this->getQueue($queue); + + $availableAt = $this->availableAt(); + + return $this->database->table($this->table)->insert(collect((array) $jobs)->map( + function ($job) use ($queue, $data, $availableAt) { + return $this->buildDatabaseRecord($queue, $this->createPayload($job, $this->getQueue($queue), $data), $availableAt); + } + )->all()); + } + + /** + * Release a reserved job back onto the queue. + * + * @param string $queue + * @param \Illuminate\Queue\Jobs\DatabaseJobRecord $job + * @param int $delay + * @return mixed + */ + public function release($queue, $job, $delay) + { + return $this->pushToDatabase($queue, $job->payload, $delay, $job->attempts); + } + + /** + * Push a raw payload to the database with a given delay. + * + * @param string|null $queue + * @param string $payload + * @param \DateTimeInterface|\DateInterval|int $delay + * @param int $attempts + * @return mixed + */ + protected function pushToDatabase($queue, $payload, $delay = 0, $attempts = 0) + { + return $this->database->table($this->table)->insertGetId($this->buildDatabaseRecord( + $this->getQueue($queue), $payload, $this->availableAt($delay), $attempts + )); + } + + /** + * Create an array to insert for the given job. + * + * @param string|null $queue + * @param string $payload + * @param int $availableAt + * @param int $attempts + * @return array + */ + protected function buildDatabaseRecord($queue, $payload, $availableAt, $attempts = 0) + { + return [ + 'queue' => $queue, + 'attempts' => $attempts, + 'reserved_at' => null, + 'available_at' => $availableAt, + 'created_at' => $this->currentTime(), + 'payload' => $payload, + ]; + } + + /** + * Pop the next job off of the queue. + * + * @param string|null $queue + * @return \Illuminate\Contracts\Queue\Job|null + * + * @throws \Exception|\Throwable + */ + public function pop($queue = null) + { + $queue = $this->getQueue($queue); + + return $this->database->transaction(function () use ($queue) { + if ($job = $this->getNextAvailableJob($queue)) { + return $this->marshalJob($queue, $job); + } + }); + } + + /** + * Get the next available job for the queue. + * + * @param string|null $queue + * @return \Illuminate\Queue\Jobs\DatabaseJobRecord|null + */ + protected function getNextAvailableJob($queue) + { + $job = $this->database->table($this->table) + ->lock($this->getLockForPopping()) + ->where('queue', $this->getQueue($queue)) + ->where(function ($query) { + $this->isAvailable($query); + $this->isReservedButExpired($query); + }) + ->orderBy('id', 'asc') + ->first(); + + return $job ? new DatabaseJobRecord((object) $job) : null; + } + + /** + * Get the lock required for popping the next job. + * + * @return string|bool + */ + protected function getLockForPopping() + { + $databaseEngine = $this->database->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME); + $databaseVersion = $this->database->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION); + + if ($databaseEngine == 'mysql' && ! strpos($databaseVersion, 'MariaDB') && version_compare($databaseVersion, '8.0.1', '>=') || + $databaseEngine == 'pgsql' && version_compare($databaseVersion, '9.5', '>=')) { + return 'FOR UPDATE SKIP LOCKED'; + } + + return true; + } + + /** + * Modify the query to check for available jobs. + * + * @param \Illuminate\Database\Query\Builder $query + * @return void + */ + protected function isAvailable($query) + { + $query->where(function ($query) { + $query->whereNull('reserved_at') + ->where('available_at', '<=', $this->currentTime()); + }); + } + + /** + * Modify the query to check for jobs that are reserved but have expired. + * + * @param \Illuminate\Database\Query\Builder $query + * @return void + */ + protected function isReservedButExpired($query) + { + $expiration = Carbon::now()->subSeconds($this->retryAfter)->getTimestamp(); + + $query->orWhere(function ($query) use ($expiration) { + $query->where('reserved_at', '<=', $expiration); + }); + } + + /** + * Marshal the reserved job into a DatabaseJob instance. + * + * @param string $queue + * @param \Illuminate\Queue\Jobs\DatabaseJobRecord $job + * @return \Illuminate\Queue\Jobs\DatabaseJob + */ + protected function marshalJob($queue, $job) + { + $job = $this->markJobAsReserved($job); + + return new DatabaseJob( + $this->container, $this, $job, $this->connectionName, $queue + ); + } + + /** + * Mark the given job ID as reserved. + * + * @param \Illuminate\Queue\Jobs\DatabaseJobRecord $job + * @return \Illuminate\Queue\Jobs\DatabaseJobRecord + */ + protected function markJobAsReserved($job) + { + $this->database->table($this->table)->where('id', $job->id)->update([ + 'reserved_at' => $job->touch(), + 'attempts' => $job->increment(), + ]); + + return $job; + } + + /** + * Delete a reserved job from the queue. + * + * @param string $queue + * @param string $id + * @return void + * + * @throws \Exception|\Throwable + */ + public function deleteReserved($queue, $id) + { + $this->database->transaction(function () use ($id) { + if ($this->database->table($this->table)->lockForUpdate()->find($id)) { + $this->database->table($this->table)->where('id', $id)->delete(); + } + }); + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + public function getQueue($queue) + { + return $queue ?: $this->default; + } + + /** + * Get the underlying database instance. + * + * @return \Illuminate\Database\Connection + */ + public function getDatabase() + { + return $this->database; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Events/JobExceptionOccurred.php b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobExceptionOccurred.php new file mode 100644 index 00000000..dc7940e1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobExceptionOccurred.php @@ -0,0 +1,42 @@ +job = $job; + $this->exception = $exception; + $this->connectionName = $connectionName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Events/JobFailed.php b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobFailed.php new file mode 100644 index 00000000..49b84f7b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobFailed.php @@ -0,0 +1,42 @@ +job = $job; + $this->exception = $exception; + $this->connectionName = $connectionName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessed.php b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessed.php new file mode 100644 index 00000000..f8abefb6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessed.php @@ -0,0 +1,33 @@ +job = $job; + $this->connectionName = $connectionName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessing.php b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessing.php new file mode 100644 index 00000000..3dd97248 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessing.php @@ -0,0 +1,33 @@ +job = $job; + $this->connectionName = $connectionName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Events/Looping.php b/vendor/laravel/framework/src/Illuminate/Queue/Events/Looping.php new file mode 100644 index 00000000..f9538e4c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Events/Looping.php @@ -0,0 +1,33 @@ +queue = $queue; + $this->connectionName = $connectionName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Events/WorkerStopping.php b/vendor/laravel/framework/src/Illuminate/Queue/Events/WorkerStopping.php new file mode 100644 index 00000000..6d49bb20 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Events/WorkerStopping.php @@ -0,0 +1,24 @@ +status = $status; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php b/vendor/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php new file mode 100644 index 00000000..6b7695a3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php @@ -0,0 +1,117 @@ +table = $table; + $this->resolver = $resolver; + $this->database = $database; + } + + /** + * Log a failed job into storage. + * + * @param string $connection + * @param string $queue + * @param string $payload + * @param \Exception $exception + * @return int|null + */ + public function log($connection, $queue, $payload, $exception) + { + $failed_at = Date::now(); + + $exception = (string) $exception; + + return $this->getTable()->insertGetId(compact( + 'connection', 'queue', 'payload', 'exception', 'failed_at' + )); + } + + /** + * Get a list of all of the failed jobs. + * + * @return array + */ + public function all() + { + return $this->getTable()->orderBy('id', 'desc')->get()->all(); + } + + /** + * Get a single failed job. + * + * @param mixed $id + * @return object|null + */ + public function find($id) + { + return $this->getTable()->find($id); + } + + /** + * Delete a single failed job from storage. + * + * @param mixed $id + * @return bool + */ + public function forget($id) + { + return $this->getTable()->where('id', $id)->delete() > 0; + } + + /** + * Flush all of the failed jobs from storage. + * + * @return void + */ + public function flush() + { + $this->getTable()->delete(); + } + + /** + * Get a new query builder instance for the table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function getTable() + { + return $this->resolver->connection($this->database)->table($this->table); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Failed/DynamoDbFailedJobProvider.php b/vendor/laravel/framework/src/Illuminate/Queue/Failed/DynamoDbFailedJobProvider.php new file mode 100644 index 00000000..97740cb7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Failed/DynamoDbFailedJobProvider.php @@ -0,0 +1,175 @@ +table = $table; + $this->dynamo = $dynamo; + $this->applicationName = $applicationName; + } + + /** + * Log a failed job into storage. + * + * @param string $connection + * @param string $queue + * @param string $payload + * @param \Exception $exception + * @return string|int|null + */ + public function log($connection, $queue, $payload, $exception) + { + $id = (string) Str::orderedUuid(); + + $failedAt = Date::now(); + + $this->dynamo->putItem([ + 'TableName' => $this->table, + 'Item' => [ + 'application' => ['S' => $this->applicationName], + 'uuid' => ['S' => $id], + 'connection' => ['S' => $connection], + 'queue' => ['S' => $queue], + 'payload' => ['S' => $payload], + 'exception' => ['S' => (string) $exception], + 'failed_at' => ['N' => (string) $failedAt->getTimestamp()], + 'expires_at' => ['N' => (string) $failedAt->addDays(3)->getTimestamp()], + ], + ]); + + return $id; + } + + /** + * Get a list of all of the failed jobs. + * + * @return array + */ + public function all() + { + $results = $this->dynamo->query([ + 'TableName' => $this->table, + 'Select' => 'ALL_ATTRIBUTES', + 'KeyConditionExpression' => 'application = :application', + 'ExpressionAttributeValues' => [ + ':application' => ['S' => $this->applicationName], + ], + 'ScanIndexForward' => false, + ]); + + return collect($results['Items'])->map(function ($result) { + return (object) [ + 'id' => $result['uuid']['S'], + 'connection' => $result['connection']['S'], + 'queue' => $result['queue']['S'], + 'payload' => $result['payload']['S'], + 'exception' => $result['exception']['S'], + 'failed_at' => Carbon::createFromTimestamp( + (int) $result['failed_at']['N'] + )->format(DateTimeInterface::ISO8601), + ]; + })->all(); + } + + /** + * Get a single failed job. + * + * @param mixed $id + * @return object|null + */ + public function find($id) + { + $result = $this->dynamo->getItem([ + 'TableName' => $this->table, + 'Key' => [ + 'application' => ['S' => $this->applicationName], + 'uuid' => ['S' => $id], + ], + ]); + + if (! isset($result['Item'])) { + return; + } + + return (object) [ + 'id' => $result['Item']['uuid']['S'], + 'connection' => $result['Item']['connection']['S'], + 'queue' => $result['Item']['queue']['S'], + 'payload' => $result['Item']['payload']['S'], + 'exception' => $result['Item']['exception']['S'], + 'failed_at' => Carbon::createFromTimestamp( + (int) $result['Item']['failed_at']['N'] + )->format(DateTimeInterface::ISO8601), + ]; + } + + /** + * Delete a single failed job from storage. + * + * @param mixed $id + * @return bool + */ + public function forget($id) + { + $this->dynamo->deleteItem([ + 'TableName' => $this->table, + 'Key' => [ + 'application' => ['S' => $this->applicationName], + 'uuid' => ['S' => $id], + ], + ]); + + return true; + } + + /** + * Flush all of the failed jobs from storage. + * + * @return void + * + * @throws \Exception + */ + public function flush() + { + throw new Exception("DynamoDb failed job storage may not be flushed. Please use DynamoDb's TTL features on your expires_at attribute."); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php b/vendor/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php new file mode 100644 index 00000000..8f73226d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php @@ -0,0 +1,47 @@ +job ? $this->job->attempts() : 1; + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + if ($this->job) { + return $this->job->delete(); + } + } + + /** + * Fail the job from the queue. + * + * @param \Throwable|null $exception + * @return void + */ + public function fail($exception = null) + { + if ($this->job) { + $this->job->fail($exception); + } + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + if ($this->job) { + return $this->job->release($delay); + } + } + + /** + * Set the base queue job instance. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @return $this + */ + public function setJob(JobContract $job) + { + $this->job = $job; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/InvalidPayloadException.php b/vendor/laravel/framework/src/Illuminate/Queue/InvalidPayloadException.php new file mode 100644 index 00000000..788fa660 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/InvalidPayloadException.php @@ -0,0 +1,19 @@ +job = $job; + $this->queue = $queue; + $this->container = $container; + $this->pheanstalk = $pheanstalk; + $this->connectionName = $connectionName; + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + + $priority = Pheanstalk::DEFAULT_PRIORITY; + + $this->pheanstalk->release($this->job, $priority, $delay); + } + + /** + * Bury the job in the queue. + * + * @return void + */ + public function bury() + { + parent::release(); + + $this->pheanstalk->bury($this->job); + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + $this->pheanstalk->delete($this->job); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + $stats = $this->pheanstalk->statsJob($this->job); + + return (int) $stats->reserves; + } + + /** + * Get the job identifier. + * + * @return int + */ + public function getJobId() + { + return $this->job->getId(); + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job->getData(); + } + + /** + * Get the underlying Pheanstalk instance. + * + * @return \Pheanstalk\Pheanstalk + */ + public function getPheanstalk() + { + return $this->pheanstalk; + } + + /** + * Get the underlying Pheanstalk job. + * + * @return \Pheanstalk\Job + */ + public function getPheanstalkJob() + { + return $this->job; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php new file mode 100644 index 00000000..18f3c069 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php @@ -0,0 +1,100 @@ +job = $job; + $this->queue = $queue; + $this->database = $database; + $this->container = $container; + $this->connectionName = $connectionName; + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return mixed + */ + public function release($delay = 0) + { + parent::release($delay); + + $this->delete(); + + return $this->database->release($this->queue, $this->job, $delay); + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + $this->database->deleteReserved($this->queue, $this->job->id); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return (int) $this->job->attempts; + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return $this->job->id; + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job->payload; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJobRecord.php b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJobRecord.php new file mode 100644 index 00000000..b4b57254 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJobRecord.php @@ -0,0 +1,63 @@ +record = $record; + } + + /** + * Increment the number of times the job has been attempted. + * + * @return int + */ + public function increment() + { + $this->record->attempts++; + + return $this->record->attempts; + } + + /** + * Update the "reserved at" timestamp of the job. + * + * @return int + */ + public function touch() + { + $this->record->reserved_at = $this->currentTime(); + + return $this->record->reserved_at; + } + + /** + * Dynamically access the underlying job information. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->record->{$key}; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php new file mode 100755 index 00000000..7795b96c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php @@ -0,0 +1,329 @@ +payload(); + + [$class, $method] = JobName::parse($payload['job']); + + ($this->instance = $this->resolve($class))->{$method}($this, $payload['data']); + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + $this->deleted = true; + } + + /** + * Determine if the job has been deleted. + * + * @return bool + */ + public function isDeleted() + { + return $this->deleted; + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + $this->released = true; + } + + /** + * Determine if the job was released back into the queue. + * + * @return bool + */ + public function isReleased() + { + return $this->released; + } + + /** + * Determine if the job has been deleted or released. + * + * @return bool + */ + public function isDeletedOrReleased() + { + return $this->isDeleted() || $this->isReleased(); + } + + /** + * Determine if the job has been marked as a failure. + * + * @return bool + */ + public function hasFailed() + { + return $this->failed; + } + + /** + * Mark the job as "failed". + * + * @return void + */ + public function markAsFailed() + { + $this->failed = true; + } + + /** + * Delete the job, call the "failed" method, and raise the failed job event. + * + * @param \Throwable|null $e + * @return void + */ + public function fail($e = null) + { + $this->markAsFailed(); + + if ($this->isDeleted()) { + return; + } + + try { + // If the job has failed, we will delete it, call the "failed" method and then call + // an event indicating the job has failed so it can be logged if needed. This is + // to allow every developer to better keep monitor of their failed queue jobs. + $this->delete(); + + $this->failed($e); + } finally { + $this->resolve(Dispatcher::class)->dispatch(new JobFailed( + $this->connectionName, $this, $e ?: new ManuallyFailedException + )); + } + } + + /** + * Process an exception that caused the job to fail. + * + * @param \Throwable|null $e + * @return void + */ + protected function failed($e) + { + $payload = $this->payload(); + + [$class, $method] = JobName::parse($payload['job']); + + if (method_exists($this->instance = $this->resolve($class), 'failed')) { + $this->instance->failed($payload['data'], $e); + } + } + + /** + * Resolve the given class. + * + * @param string $class + * @return mixed + */ + protected function resolve($class) + { + return $this->container->make($class); + } + + /** + * Get the resolved job handler instance. + * + * @return mixed + */ + public function getResolvedJob() + { + return $this->instance; + } + + /** + * Get the decoded body of the job. + * + * @return array + */ + public function payload() + { + return json_decode($this->getRawBody(), true); + } + + /** + * Get the number of times to attempt a job. + * + * @return int|null + */ + public function maxTries() + { + return $this->payload()['maxTries'] ?? null; + } + + /** + * Get the number of seconds to delay a failed job before retrying it. + * + * @return int|null + */ + public function delaySeconds() + { + return $this->payload()['delay'] ?? null; + } + + /** + * Get the number of seconds the job can run. + * + * @return int|null + */ + public function timeout() + { + return $this->payload()['timeout'] ?? null; + } + + /** + * Get the timestamp indicating when the job should timeout. + * + * @return int|null + */ + public function timeoutAt() + { + return $this->payload()['timeoutAt'] ?? null; + } + + /** + * Get the name of the queued job class. + * + * @return string + */ + public function getName() + { + return $this->payload()['job']; + } + + /** + * Get the resolved name of the queued job class. + * + * Resolves the name of "wrapped" jobs such as class-based handlers. + * + * @return string + */ + public function resolveName() + { + return JobName::resolve($this->getName(), $this->payload()); + } + + /** + * Get the name of the connection the job belongs to. + * + * @return string + */ + public function getConnectionName() + { + return $this->connectionName; + } + + /** + * Get the name of the queue the job belongs to. + * + * @return string + */ + public function getQueue() + { + return $this->queue; + } + + /** + * Get the service container instance. + * + * @return \Illuminate\Container\Container + */ + public function getContainer() + { + return $this->container; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Jobs/JobName.php b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/JobName.php new file mode 100644 index 00000000..0db53bb4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/JobName.php @@ -0,0 +1,35 @@ +job = $job; + $this->redis = $redis; + $this->queue = $queue; + $this->reserved = $reserved; + $this->container = $container; + $this->connectionName = $connectionName; + + $this->decoded = $this->payload(); + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job; + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + $this->redis->deleteReserved($this->queue, $this); + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + + $this->redis->deleteAndRelease($this->queue, $this, $delay); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return ($this->decoded['attempts'] ?? null) + 1; + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return $this->decoded['id'] ?? null; + } + + /** + * Get the underlying Redis factory implementation. + * + * @return \Illuminate\Queue\RedisQueue + */ + public function getRedisQueue() + { + return $this->redis; + } + + /** + * Get the underlying reserved Redis job. + * + * @return string + */ + public function getReservedJob() + { + return $this->reserved; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SqsJob.php b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SqsJob.php new file mode 100755 index 00000000..52538508 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SqsJob.php @@ -0,0 +1,124 @@ +sqs = $sqs; + $this->job = $job; + $this->queue = $queue; + $this->container = $container; + $this->connectionName = $connectionName; + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + + $this->sqs->changeMessageVisibility([ + 'QueueUrl' => $this->queue, + 'ReceiptHandle' => $this->job['ReceiptHandle'], + 'VisibilityTimeout' => $delay, + ]); + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + $this->sqs->deleteMessage([ + 'QueueUrl' => $this->queue, 'ReceiptHandle' => $this->job['ReceiptHandle'], + ]); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return (int) $this->job['Attributes']['ApproximateReceiveCount']; + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return $this->job['MessageId']; + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job['Body']; + } + + /** + * Get the underlying SQS client instance. + * + * @return \Aws\Sqs\SqsClient + */ + public function getSqs() + { + return $this->sqs; + } + + /** + * Get the underlying raw SQS job. + * + * @return array + */ + public function getSqsJob() + { + return $this->job; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php new file mode 100755 index 00000000..de6e5c6b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php @@ -0,0 +1,91 @@ +queue = $queue; + $this->payload = $payload; + $this->container = $container; + $this->connectionName = $connectionName; + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return 1; + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return ''; + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->payload; + } + + /** + * Get the name of the queue the job belongs to. + * + * @return string + */ + public function getQueue() + { + return 'sync'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Queue/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Queue/Listener.php b/vendor/laravel/framework/src/Illuminate/Queue/Listener.php new file mode 100755 index 00000000..885d683b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Listener.php @@ -0,0 +1,230 @@ +commandPath = $commandPath; + } + + /** + * Get the PHP binary. + * + * @return string + */ + protected function phpBinary() + { + return (new PhpExecutableFinder)->find(false); + } + + /** + * Get the Artisan binary. + * + * @return string + */ + protected function artisanBinary() + { + return defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan'; + } + + /** + * Listen to the given queue connection. + * + * @param string $connection + * @param string $queue + * @param \Illuminate\Queue\ListenerOptions $options + * @return void + */ + public function listen($connection, $queue, ListenerOptions $options) + { + $process = $this->makeProcess($connection, $queue, $options); + + while (true) { + $this->runProcess($process, $options->memory); + } + } + + /** + * Create a new Symfony process for the worker. + * + * @param string $connection + * @param string $queue + * @param \Illuminate\Queue\ListenerOptions $options + * @return \Symfony\Component\Process\Process + */ + public function makeProcess($connection, $queue, ListenerOptions $options) + { + $command = $this->createCommand( + $connection, + $queue, + $options + ); + + // If the environment is set, we will append it to the command array so the + // workers will run under the specified environment. Otherwise, they will + // just run under the production environment which is not always right. + if (isset($options->environment)) { + $command = $this->addEnvironment($command, $options); + } + + return new Process( + $command, + $this->commandPath, + null, + null, + $options->timeout + ); + } + + /** + * Add the environment option to the given command. + * + * @param array $command + * @param \Illuminate\Queue\ListenerOptions $options + * @return array + */ + protected function addEnvironment($command, ListenerOptions $options) + { + return array_merge($command, ["--env={$options->environment}"]); + } + + /** + * Create the command with the listener options. + * + * @param string $connection + * @param string $queue + * @param \Illuminate\Queue\ListenerOptions $options + * @return array + */ + protected function createCommand($connection, $queue, ListenerOptions $options) + { + return array_filter([ + $this->phpBinary(), + $this->artisanBinary(), + 'queue:work', + $connection, + '--once', + "--queue={$queue}", + "--delay={$options->delay}", + "--memory={$options->memory}", + "--sleep={$options->sleep}", + "--tries={$options->maxTries}", + ], function ($value) { + return ! is_null($value); + }); + } + + /** + * Run the given process. + * + * @param \Symfony\Component\Process\Process $process + * @param int $memory + * @return void + */ + public function runProcess(Process $process, $memory) + { + $process->run(function ($type, $line) { + $this->handleWorkerOutput($type, $line); + }); + + // Once we have run the job we'll go check if the memory limit has been exceeded + // for the script. If it has, we will kill this script so the process manager + // will restart this with a clean slate of memory automatically on exiting. + if ($this->memoryExceeded($memory)) { + $this->stop(); + } + } + + /** + * Handle output from the worker process. + * + * @param int $type + * @param string $line + * @return void + */ + protected function handleWorkerOutput($type, $line) + { + if (isset($this->outputHandler)) { + call_user_func($this->outputHandler, $type, $line); + } + } + + /** + * Determine if the memory limit has been exceeded. + * + * @param int $memoryLimit + * @return bool + */ + public function memoryExceeded($memoryLimit) + { + return (memory_get_usage(true) / 1024 / 1024) >= $memoryLimit; + } + + /** + * Stop listening and bail out of the script. + * + * @return void + */ + public function stop() + { + exit; + } + + /** + * Set the output handler callback. + * + * @param \Closure $outputHandler + * @return void + */ + public function setOutputHandler(Closure $outputHandler) + { + $this->outputHandler = $outputHandler; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/ListenerOptions.php b/vendor/laravel/framework/src/Illuminate/Queue/ListenerOptions.php new file mode 100644 index 00000000..22da0cd9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/ListenerOptions.php @@ -0,0 +1,32 @@ +environment = $environment; + + parent::__construct($delay, $memory, $timeout, $sleep, $maxTries, $force); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/LuaScripts.php b/vendor/laravel/framework/src/Illuminate/Queue/LuaScripts.php new file mode 100644 index 00000000..c031140c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/LuaScripts.php @@ -0,0 +1,129 @@ +push($job, $data, $queue); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param string $queue + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @return mixed + */ + public function laterOn($queue, $delay, $job, $data = '') + { + return $this->later($delay, $job, $data, $queue); + } + + /** + * Push an array of jobs onto the queue. + * + * @param array $jobs + * @param mixed $data + * @param string|null $queue + * @return void + */ + public function bulk($jobs, $data = '', $queue = null) + { + foreach ((array) $jobs as $job) { + $this->push($job, $data, $queue); + } + } + + /** + * Create a payload string from the given job and data. + * + * @param string|object $job + * @param string $queue + * @param mixed $data + * @return string + * + * @throws \Illuminate\Queue\InvalidPayloadException + */ + protected function createPayload($job, $queue, $data = '') + { + $payload = json_encode($this->createPayloadArray($job, $queue, $data)); + + if (JSON_ERROR_NONE !== json_last_error()) { + throw new InvalidPayloadException( + 'Unable to JSON encode payload. Error code: '.json_last_error() + ); + } + + return $payload; + } + + /** + * Create a payload array from the given job and data. + * + * @param string|object $job + * @param string $queue + * @param mixed $data + * @return array + */ + protected function createPayloadArray($job, $queue, $data = '') + { + return is_object($job) + ? $this->createObjectPayload($job, $queue) + : $this->createStringPayload($job, $queue, $data); + } + + /** + * Create a payload for an object-based queue handler. + * + * @param object $job + * @param string $queue + * @return array + */ + protected function createObjectPayload($job, $queue) + { + $payload = $this->withCreatePayloadHooks($queue, [ + 'displayName' => $this->getDisplayName($job), + 'job' => 'Illuminate\Queue\CallQueuedHandler@call', + 'maxTries' => $job->tries ?? null, + 'delay' => $this->getJobRetryDelay($job), + 'timeout' => $job->timeout ?? null, + 'timeoutAt' => $this->getJobExpiration($job), + 'data' => [ + 'commandName' => $job, + 'command' => $job, + ], + ]); + + return array_merge($payload, [ + 'data' => [ + 'commandName' => get_class($job), + 'command' => serialize(clone $job), + ], + ]); + } + + /** + * Get the display name for the given job. + * + * @param object $job + * @return string + */ + protected function getDisplayName($job) + { + return method_exists($job, 'displayName') + ? $job->displayName() : get_class($job); + } + + /** + * Get the retry delay for an object-based queue handler. + * + * @param mixed $job + * @return mixed + */ + public function getJobRetryDelay($job) + { + if (! method_exists($job, 'retryAfter') && ! isset($job->retryAfter)) { + return; + } + + $delay = $job->retryAfter ?? $job->retryAfter(); + + return $delay instanceof DateTimeInterface + ? $this->secondsUntil($delay) : $delay; + } + + /** + * Get the expiration timestamp for an object-based queue handler. + * + * @param mixed $job + * @return mixed + */ + public function getJobExpiration($job) + { + if (! method_exists($job, 'retryUntil') && ! isset($job->timeoutAt)) { + return; + } + + $expiration = $job->timeoutAt ?? $job->retryUntil(); + + return $expiration instanceof DateTimeInterface + ? $expiration->getTimestamp() : $expiration; + } + + /** + * Create a typical, string based queue payload array. + * + * @param string $job + * @param string $queue + * @param mixed $data + * @return array + */ + protected function createStringPayload($job, $queue, $data) + { + return $this->withCreatePayloadHooks($queue, [ + 'displayName' => is_string($job) ? explode('@', $job)[0] : null, + 'job' => $job, + 'maxTries' => null, + 'delay' => null, + 'timeout' => null, + 'data' => $data, + ]); + } + + /** + * Register a callback to be executed when creating job payloads. + * + * @param callable $callback + * @return void + */ + public static function createPayloadUsing($callback) + { + if (is_null($callback)) { + static::$createPayloadCallbacks = []; + } else { + static::$createPayloadCallbacks[] = $callback; + } + } + + /** + * Create the given payload using any registered payload hooks. + * + * @param string $queue + * @param array $payload + * @return array + */ + protected function withCreatePayloadHooks($queue, array $payload) + { + if (! empty(static::$createPayloadCallbacks)) { + foreach (static::$createPayloadCallbacks as $callback) { + $payload = array_merge($payload, call_user_func( + $callback, $this->getConnectionName(), $queue, $payload + )); + } + } + + return $payload; + } + + /** + * Get the connection name for the queue. + * + * @return string + */ + public function getConnectionName() + { + return $this->connectionName; + } + + /** + * Set the connection name for the queue. + * + * @param string $name + * @return $this + */ + public function setConnectionName($name) + { + $this->connectionName = $name; + + return $this; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php b/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php new file mode 100755 index 00000000..c13bee32 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php @@ -0,0 +1,260 @@ +app = $app; + } + + /** + * Register an event listener for the before job event. + * + * @param mixed $callback + * @return void + */ + public function before($callback) + { + $this->app['events']->listen(Events\JobProcessing::class, $callback); + } + + /** + * Register an event listener for the after job event. + * + * @param mixed $callback + * @return void + */ + public function after($callback) + { + $this->app['events']->listen(Events\JobProcessed::class, $callback); + } + + /** + * Register an event listener for the exception occurred job event. + * + * @param mixed $callback + * @return void + */ + public function exceptionOccurred($callback) + { + $this->app['events']->listen(Events\JobExceptionOccurred::class, $callback); + } + + /** + * Register an event listener for the daemon queue loop. + * + * @param mixed $callback + * @return void + */ + public function looping($callback) + { + $this->app['events']->listen(Events\Looping::class, $callback); + } + + /** + * Register an event listener for the failed job event. + * + * @param mixed $callback + * @return void + */ + public function failing($callback) + { + $this->app['events']->listen(Events\JobFailed::class, $callback); + } + + /** + * Register an event listener for the daemon queue stopping. + * + * @param mixed $callback + * @return void + */ + public function stopping($callback) + { + $this->app['events']->listen(Events\WorkerStopping::class, $callback); + } + + /** + * Determine if the driver is connected. + * + * @param string|null $name + * @return bool + */ + public function connected($name = null) + { + return isset($this->connections[$name ?: $this->getDefaultDriver()]); + } + + /** + * Resolve a queue connection instance. + * + * @param string|null $name + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connection($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + // If the connection has not been resolved yet we will resolve it now as all + // of the connections are resolved when they are actually needed so we do + // not make any unnecessary connection to the various queue end-points. + if (! isset($this->connections[$name])) { + $this->connections[$name] = $this->resolve($name); + + $this->connections[$name]->setContainer($this->app); + } + + return $this->connections[$name]; + } + + /** + * Resolve a queue connection. + * + * @param string $name + * @return \Illuminate\Contracts\Queue\Queue + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + return $this->getConnector($config['driver']) + ->connect($config) + ->setConnectionName($name); + } + + /** + * Get the connector for a given driver. + * + * @param string $driver + * @return \Illuminate\Queue\Connectors\ConnectorInterface + * + * @throws \InvalidArgumentException + */ + protected function getConnector($driver) + { + if (! isset($this->connectors[$driver])) { + throw new InvalidArgumentException("No connector for [$driver]"); + } + + return call_user_func($this->connectors[$driver]); + } + + /** + * Add a queue connection resolver. + * + * @param string $driver + * @param \Closure $resolver + * @return void + */ + public function extend($driver, Closure $resolver) + { + return $this->addConnector($driver, $resolver); + } + + /** + * Add a queue connection resolver. + * + * @param string $driver + * @param \Closure $resolver + * @return void + */ + public function addConnector($driver, Closure $resolver) + { + $this->connectors[$driver] = $resolver; + } + + /** + * Get the queue connection configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + if (! is_null($name) && $name !== 'null') { + return $this->app['config']["queue.connections.{$name}"]; + } + + return ['driver' => 'null']; + } + + /** + * Get the name of the default queue connection. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['queue.default']; + } + + /** + * Set the name of the default queue connection. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['queue.default'] = $name; + } + + /** + * Get the full name for the given connection. + * + * @param string|null $connection + * @return string + */ + public function getName($connection = null) + { + return $connection ?: $this->getDefaultDriver(); + } + + /** + * Dynamically pass calls to the default connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->connection()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php new file mode 100755 index 00000000..0720923b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php @@ -0,0 +1,278 @@ +registerManager(); + $this->registerConnection(); + $this->registerWorker(); + $this->registerListener(); + $this->registerFailedJobServices(); + $this->registerOpisSecurityKey(); + } + + /** + * Register the queue manager. + * + * @return void + */ + protected function registerManager() + { + $this->app->singleton('queue', function ($app) { + // Once we have an instance of the queue manager, we will register the various + // resolvers for the queue connectors. These connectors are responsible for + // creating the classes that accept queue configs and instantiate queues. + return tap(new QueueManager($app), function ($manager) { + $this->registerConnectors($manager); + }); + }); + } + + /** + * Register the default queue connection binding. + * + * @return void + */ + protected function registerConnection() + { + $this->app->singleton('queue.connection', function ($app) { + return $app['queue']->connection(); + }); + } + + /** + * Register the connectors on the queue manager. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + public function registerConnectors($manager) + { + foreach (['Null', 'Sync', 'Database', 'Redis', 'Beanstalkd', 'Sqs'] as $connector) { + $this->{"register{$connector}Connector"}($manager); + } + } + + /** + * Register the Null queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerNullConnector($manager) + { + $manager->addConnector('null', function () { + return new NullConnector; + }); + } + + /** + * Register the Sync queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerSyncConnector($manager) + { + $manager->addConnector('sync', function () { + return new SyncConnector; + }); + } + + /** + * Register the database queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerDatabaseConnector($manager) + { + $manager->addConnector('database', function () { + return new DatabaseConnector($this->app['db']); + }); + } + + /** + * Register the Redis queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerRedisConnector($manager) + { + $manager->addConnector('redis', function () { + return new RedisConnector($this->app['redis']); + }); + } + + /** + * Register the Beanstalkd queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerBeanstalkdConnector($manager) + { + $manager->addConnector('beanstalkd', function () { + return new BeanstalkdConnector; + }); + } + + /** + * Register the Amazon SQS queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerSqsConnector($manager) + { + $manager->addConnector('sqs', function () { + return new SqsConnector; + }); + } + + /** + * Register the queue worker. + * + * @return void + */ + protected function registerWorker() + { + $this->app->singleton('queue.worker', function () { + $isDownForMaintenance = function () { + return $this->app->isDownForMaintenance(); + }; + + return new Worker( + $this->app['queue'], + $this->app['events'], + $this->app[ExceptionHandler::class], + $isDownForMaintenance + ); + }); + } + + /** + * Register the queue listener. + * + * @return void + */ + protected function registerListener() + { + $this->app->singleton('queue.listener', function () { + return new Listener($this->app->basePath()); + }); + } + + /** + * Register the failed job services. + * + * @return void + */ + protected function registerFailedJobServices() + { + $this->app->singleton('queue.failer', function () { + $config = $this->app['config']['queue.failed']; + + if (isset($config['driver']) && $config['driver'] === 'dynamodb') { + return $this->dynamoFailedJobProvider($config); + } elseif (isset($config['table'])) { + return $this->databaseFailedJobProvider($config); + } else { + return new NullFailedJobProvider; + } + }); + } + + /** + * Create a new database failed job provider. + * + * @param array $config + * @return \Illuminate\Queue\Failed\DatabaseFailedJobProvider + */ + protected function databaseFailedJobProvider($config) + { + return new DatabaseFailedJobProvider( + $this->app['db'], $config['database'], $config['table'] + ); + } + + /** + * Create a new DynamoDb failed job provider. + * + * @param array $config + * @return \Illuminate\Queue\Failed\DynamoDbFailedJobProvider + */ + protected function dynamoFailedJobProvider($config) + { + $dynamoConfig = [ + 'region' => $config['region'], + 'version' => 'latest', + 'endpoint' => $config['endpoint'] ?? null, + ]; + + if (! empty($config['key']) && ! empty($config['secret'])) { + $dynamoConfig['credentials'] = Arr::only( + $config, ['key', 'secret', 'token'] + ); + } + + return new DynamoDbFailedJobProvider( + new DynamoDbClient($dynamoConfig), + $this->app['config']['app.name'], + $config['table'] + ); + } + + /** + * Configure Opis Closure signing for security. + * + * @return void + */ + protected function registerOpisSecurityKey() + { + if (Str::startsWith($key = $this->app['config']->get('app.key'), 'base64:')) { + $key = base64_decode(substr($key, 7)); + } + + SerializableClosure::setSecretKey($key); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'queue', 'queue.worker', 'queue.listener', + 'queue.failer', 'queue.connection', + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/README.md b/vendor/laravel/framework/src/Illuminate/Queue/README.md new file mode 100644 index 00000000..1999dd7d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/README.md @@ -0,0 +1,34 @@ +## Illuminate Queue + +The Laravel Queue component provides a unified API across a variety of different queue services. Queues allow you to defer the processing of a time consuming task, such as sending an e-mail, until a later time, thus drastically speeding up the web requests to your application. + +### Usage Instructions + +First, create a new Queue `Capsule` manager instance. Similar to the "Capsule" provided for the Eloquent ORM, the queue Capsule aims to make configuring the library for usage outside of the Laravel framework as easy as possible. + +```PHP +use Illuminate\Queue\Capsule\Manager as Queue; + +$queue = new Queue; + +$queue->addConnection([ + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', +]); + +// Make this Capsule instance available globally via static methods... (optional) +$queue->setAsGlobal(); +``` + +Once the Capsule instance has been registered. You may use it like so: + +```PHP +// As an instance... +$queue->push('SendEmail', ['message' => $message]); + +// If setAsGlobal has been called... +Queue::push('SendEmail', ['message' => $message]); +``` + +For further documentation on using the queue, consult the [Laravel framework documentation](https://laravel.com/docs). diff --git a/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php b/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php new file mode 100644 index 00000000..c5b38c1b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php @@ -0,0 +1,310 @@ +redis = $redis; + $this->default = $default; + $this->blockFor = $blockFor; + $this->connection = $connection; + $this->retryAfter = $retryAfter; + } + + /** + * Get the size of the queue. + * + * @param string|null $queue + * @return int + */ + public function size($queue = null) + { + $queue = $this->getQueue($queue); + + return $this->getConnection()->eval( + LuaScripts::size(), 3, $queue, $queue.':delayed', $queue.':reserved' + ); + } + + /** + * Push a new job onto the queue. + * + * @param object|string $job + * @param mixed $data + * @param string|null $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushRaw($this->createPayload($job, $this->getQueue($queue), $data), $queue); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string|null $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + $this->getConnection()->eval( + LuaScripts::push(), 2, $this->getQueue($queue), + $this->getQueue($queue).':notify', $payload + ); + + return json_decode($payload, true)['id'] ?? null; + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param object|string $job + * @param mixed $data + * @param string|null $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + return $this->laterRaw($delay, $this->createPayload($job, $this->getQueue($queue), $data), $queue); + } + + /** + * Push a raw job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $payload + * @param string|null $queue + * @return mixed + */ + protected function laterRaw($delay, $payload, $queue = null) + { + $this->getConnection()->zadd( + $this->getQueue($queue).':delayed', $this->availableAt($delay), $payload + ); + + return json_decode($payload, true)['id'] ?? null; + } + + /** + * Create a payload string from the given job and data. + * + * @param string $job + * @param string $queue + * @param mixed $data + * @return array + */ + protected function createPayloadArray($job, $queue, $data = '') + { + return array_merge(parent::createPayloadArray($job, $queue, $data), [ + 'id' => $this->getRandomId(), + 'attempts' => 0, + ]); + } + + /** + * Pop the next job off of the queue. + * + * @param string|null $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + $this->migrate($prefixed = $this->getQueue($queue)); + + if (empty($nextJob = $this->retrieveNextJob($prefixed))) { + return; + } + + [$job, $reserved] = $nextJob; + + if ($reserved) { + return new RedisJob( + $this->container, $this, $job, + $reserved, $this->connectionName, $queue ?: $this->default + ); + } + } + + /** + * Migrate any delayed or expired jobs onto the primary queue. + * + * @param string $queue + * @return void + */ + protected function migrate($queue) + { + $this->migrateExpiredJobs($queue.':delayed', $queue); + + if (! is_null($this->retryAfter)) { + $this->migrateExpiredJobs($queue.':reserved', $queue); + } + } + + /** + * Migrate the delayed jobs that are ready to the regular queue. + * + * @param string $from + * @param string $to + * @return array + */ + public function migrateExpiredJobs($from, $to) + { + return $this->getConnection()->eval( + LuaScripts::migrateExpiredJobs(), 3, $from, $to, $to.':notify', $this->currentTime() + ); + } + + /** + * Retrieve the next job from the queue. + * + * @param string $queue + * @param bool $block + * @return array + */ + protected function retrieveNextJob($queue, $block = true) + { + $nextJob = $this->getConnection()->eval( + LuaScripts::pop(), 3, $queue, $queue.':reserved', $queue.':notify', + $this->availableAt($this->retryAfter) + ); + + if (empty($nextJob)) { + return [null, null]; + } + + [$job, $reserved] = $nextJob; + + if (! $job && ! is_null($this->blockFor) && $block && + $this->getConnection()->blpop([$queue.':notify'], $this->blockFor)) { + return $this->retrieveNextJob($queue, false); + } + + return [$job, $reserved]; + } + + /** + * Delete a reserved job from the queue. + * + * @param string $queue + * @param \Illuminate\Queue\Jobs\RedisJob $job + * @return void + */ + public function deleteReserved($queue, $job) + { + $this->getConnection()->zrem($this->getQueue($queue).':reserved', $job->getReservedJob()); + } + + /** + * Delete a reserved job from the reserved queue and release it. + * + * @param string $queue + * @param \Illuminate\Queue\Jobs\RedisJob $job + * @param int $delay + * @return void + */ + public function deleteAndRelease($queue, $job, $delay) + { + $queue = $this->getQueue($queue); + + $this->getConnection()->eval( + LuaScripts::release(), 2, $queue.':delayed', $queue.':reserved', + $job->getReservedJob(), $this->availableAt($delay) + ); + } + + /** + * Get a random ID string. + * + * @return string + */ + protected function getRandomId() + { + return Str::random(32); + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + public function getQueue($queue) + { + return 'queues:'.($queue ?: $this->default); + } + + /** + * Get the connection for the queue. + * + * @return \Illuminate\Redis\Connections\Connection + */ + public function getConnection() + { + return $this->redis->connection($this->connection); + } + + /** + * Get the underlying Redis instance. + * + * @return \Illuminate\Contracts\Redis\Factory + */ + public function getRedis() + { + return $this->redis; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/SerializableClosure.php b/vendor/laravel/framework/src/Illuminate/Queue/SerializableClosure.php new file mode 100644 index 00000000..044c06a2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/SerializableClosure.php @@ -0,0 +1,40 @@ + $value) { + $data[$key] = $this->getSerializedPropertyValue($value); + } + + return $data; + } + + /** + * Resolve the use variables after unserialization. + * + * @param array $data + * @return array + */ + protected function resolveUseVariables($data) + { + foreach ($data as $key => $value) { + $data[$key] = $this->getRestoredPropertyValue($value); + } + + return $data; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php b/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php new file mode 100644 index 00000000..bf10754f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php @@ -0,0 +1,116 @@ +getQueueableClass(), + $value->getQueueableIds(), + $value->getQueueableRelations(), + $value->getQueueableConnection() + ); + } + + if ($value instanceof QueueableEntity) { + return new ModelIdentifier( + get_class($value), + $value->getQueueableId(), + $value->getQueueableRelations(), + $value->getQueueableConnection() + ); + } + + return $value; + } + + /** + * Get the restored property value after deserialization. + * + * @param mixed $value + * @return mixed + */ + protected function getRestoredPropertyValue($value) + { + if (! $value instanceof ModelIdentifier) { + return $value; + } + + return is_array($value->id) + ? $this->restoreCollection($value) + : $this->restoreModel($value); + } + + /** + * Restore a queueable collection instance. + * + * @param \Illuminate\Contracts\Database\ModelIdentifier $value + * @return \Illuminate\Database\Eloquent\Collection + */ + protected function restoreCollection($value) + { + if (! $value->class || count($value->id) === 0) { + return new EloquentCollection; + } + + $collection = $this->getQueryForModelRestoration( + (new $value->class)->setConnection($value->connection), $value->id + )->useWritePdo()->get(); + + if (is_a($value->class, Pivot::class, true) || + in_array(AsPivot::class, class_uses($value->class))) { + return $collection; + } + + $collection = $collection->keyBy->getKey(); + + $collectionClass = get_class($collection); + + return new $collectionClass( + collect($value->id)->map(function ($id) use ($collection) { + return $collection[$id] ?? null; + })->filter() + ); + } + + /** + * Restore the model from the model identifier instance. + * + * @param \Illuminate\Contracts\Database\ModelIdentifier $value + * @return \Illuminate\Database\Eloquent\Model + */ + public function restoreModel($value) + { + return $this->getQueryForModelRestoration( + (new $value->class)->setConnection($value->connection), $value->id + )->useWritePdo()->firstOrFail()->load($value->relations ?? []); + } + + /** + * Get the query for model restoration. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @param array|int $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function getQueryForModelRestoration($model, $ids) + { + return $model->newQueryForRestoration($ids); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php b/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php new file mode 100644 index 00000000..52c0f405 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php @@ -0,0 +1,141 @@ +getProperties(); + + foreach ($properties as $property) { + $property->setValue($this, $this->getSerializedPropertyValue( + $this->getPropertyValue($property) + )); + } + + return array_values(array_filter(array_map(function ($p) { + return $p->isStatic() ? null : $p->getName(); + }, $properties))); + } + + /** + * Restore the model after serialization. + * + * @return void + */ + public function __wakeup() + { + foreach ((new ReflectionClass($this))->getProperties() as $property) { + if ($property->isStatic()) { + continue; + } + + $property->setValue($this, $this->getRestoredPropertyValue( + $this->getPropertyValue($property) + )); + } + } + + /** + * Prepare the instance values for serialization. + * + * @return array + */ + public function __serialize() + { + $values = []; + + $properties = (new ReflectionClass($this))->getProperties(); + + $class = get_class($this); + + foreach ($properties as $property) { + if ($property->isStatic()) { + continue; + } + + $property->setAccessible(true); + + if (! $property->isInitialized($this)) { + continue; + } + + $name = $property->getName(); + + if ($property->isPrivate()) { + $name = "\0{$class}\0{$name}"; + } elseif ($property->isProtected()) { + $name = "\0*\0{$name}"; + } + + $values[$name] = $this->getSerializedPropertyValue( + $this->getPropertyValue($property) + ); + } + + return $values; + } + + /** + * Restore the model after serialization. + * + * @param array $values + * @return array + */ + public function __unserialize(array $values) + { + $properties = (new ReflectionClass($this))->getProperties(); + + $class = get_class($this); + + foreach ($properties as $property) { + if ($property->isStatic()) { + continue; + } + + $name = $property->getName(); + + if ($property->isPrivate()) { + $name = "\0{$class}\0{$name}"; + } elseif ($property->isProtected()) { + $name = "\0*\0{$name}"; + } + + if (! array_key_exists($name, $values)) { + continue; + } + + $property->setAccessible(true); + + $property->setValue( + $this, $this->getRestoredPropertyValue($values[$name]) + ); + } + + return $values; + } + + /** + * Get the property value for the given property. + * + * @param \ReflectionProperty $property + * @return mixed + */ + protected function getPropertyValue(ReflectionProperty $property) + { + $property->setAccessible(true); + + return $property->getValue($this); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php b/vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php new file mode 100755 index 00000000..badf5f98 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php @@ -0,0 +1,155 @@ +sqs = $sqs; + $this->prefix = $prefix; + $this->default = $default; + } + + /** + * Get the size of the queue. + * + * @param string|null $queue + * @return int + */ + public function size($queue = null) + { + $response = $this->sqs->getQueueAttributes([ + 'QueueUrl' => $this->getQueue($queue), + 'AttributeNames' => ['ApproximateNumberOfMessages'], + ]); + + $attributes = $response->get('Attributes'); + + return (int) $attributes['ApproximateNumberOfMessages']; + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string|null $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushRaw($this->createPayload($job, $queue ?: $this->default, $data), $queue); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string|null $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + return $this->sqs->sendMessage([ + 'QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload, + ])->get('MessageId'); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @param string|null $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + return $this->sqs->sendMessage([ + 'QueueUrl' => $this->getQueue($queue), + 'MessageBody' => $this->createPayload($job, $queue ?: $this->default, $data), + 'DelaySeconds' => $this->secondsUntil($delay), + ])->get('MessageId'); + } + + /** + * Pop the next job off of the queue. + * + * @param string|null $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + $response = $this->sqs->receiveMessage([ + 'QueueUrl' => $queue = $this->getQueue($queue), + 'AttributeNames' => ['ApproximateReceiveCount'], + ]); + + if (! is_null($response['Messages']) && count($response['Messages']) > 0) { + return new SqsJob( + $this->container, $this->sqs, $response['Messages'][0], + $this->connectionName, $queue + ); + } + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + public function getQueue($queue) + { + $queue = $queue ?: $this->default; + + return filter_var($queue, FILTER_VALIDATE_URL) === false + ? rtrim($this->prefix, '/').'/'.$queue : $queue; + } + + /** + * Get the underlying SQS instance. + * + * @return \Aws\Sqs\SqsClient + */ + public function getSqs() + { + return $this->sqs; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php b/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php new file mode 100755 index 00000000..812f7b3e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php @@ -0,0 +1,164 @@ +resolveJob($this->createPayload($job, $queue, $data), $queue); + + try { + $this->raiseBeforeJobEvent($queueJob); + + $queueJob->fire(); + + $this->raiseAfterJobEvent($queueJob); + } catch (Exception $e) { + $this->handleException($queueJob, $e); + } catch (Throwable $e) { + $this->handleException($queueJob, new FatalThrowableError($e)); + } + + return 0; + } + + /** + * Resolve a Sync job instance. + * + * @param string $payload + * @param string $queue + * @return \Illuminate\Queue\Jobs\SyncJob + */ + protected function resolveJob($payload, $queue) + { + return new SyncJob($this->container, $payload, $this->connectionName, $queue); + } + + /** + * Raise the before queue job event. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseBeforeJobEvent(Job $job) + { + if ($this->container->bound('events')) { + $this->container['events']->dispatch(new JobProcessing($this->connectionName, $job)); + } + } + + /** + * Raise the after queue job event. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseAfterJobEvent(Job $job) + { + if ($this->container->bound('events')) { + $this->container['events']->dispatch(new JobProcessed($this->connectionName, $job)); + } + } + + /** + * Raise the exception occurred queue job event. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param \Exception $e + * @return void + */ + protected function raiseExceptionOccurredJobEvent(Job $job, $e) + { + if ($this->container->bound('events')) { + $this->container['events']->dispatch(new JobExceptionOccurred($this->connectionName, $job, $e)); + } + } + + /** + * Handle an exception that occurred while processing a job. + * + * @param \Illuminate\Queue\Jobs\Job $queueJob + * @param \Exception $e + * @return void + * + * @throws \Exception + */ + protected function handleException($queueJob, $e) + { + $this->raiseExceptionOccurredJobEvent($queueJob, $e); + + $queueJob->fail($e); + + throw $e; + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string|null $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + // + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @param string|null $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + return $this->push($job, $data, $queue); + } + + /** + * Pop the next job off of the queue. + * + * @param string|null $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + // + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Worker.php b/vendor/laravel/framework/src/Illuminate/Queue/Worker.php new file mode 100644 index 00000000..80d17f16 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Worker.php @@ -0,0 +1,683 @@ +events = $events; + $this->manager = $manager; + $this->exceptions = $exceptions; + $this->isDownForMaintenance = $isDownForMaintenance; + } + + /** + * Listen to the given queue in a loop. + * + * @param string $connectionName + * @param string $queue + * @param \Illuminate\Queue\WorkerOptions $options + * @return void + */ + public function daemon($connectionName, $queue, WorkerOptions $options) + { + if ($this->supportsAsyncSignals()) { + $this->listenForSignals(); + } + + $lastRestart = $this->getTimestampOfLastQueueRestart(); + + while (true) { + // Before reserving any jobs, we will make sure this queue is not paused and + // if it is we will just pause this worker for a given amount of time and + // make sure we do not need to kill this worker process off completely. + if (! $this->daemonShouldRun($options, $connectionName, $queue)) { + $this->pauseWorker($options, $lastRestart); + + continue; + } + + // First, we will attempt to get the next job off of the queue. We will also + // register the timeout handler and reset the alarm for this job so it is + // not stuck in a frozen state forever. Then, we can fire off this job. + $job = $this->getNextJob( + $this->manager->connection($connectionName), $queue + ); + + if ($this->supportsAsyncSignals()) { + $this->registerTimeoutHandler($job, $options); + } + + // If the daemon should run (not in maintenance mode, etc.), then we can run + // fire off this job for processing. Otherwise, we will need to sleep the + // worker so no more jobs are processed until they should be processed. + if ($job) { + $this->runJob($job, $connectionName, $options); + } else { + $this->sleep($options->sleep); + } + + if ($this->supportsAsyncSignals()) { + $this->resetTimeoutHandler(); + } + + // Finally, we will check to see if we have exceeded our memory limits or if + // the queue should restart based on other indications. If so, we'll stop + // this worker and let whatever is "monitoring" it restart the process. + $this->stopIfNecessary($options, $lastRestart, $job); + } + } + + /** + * Register the worker timeout handler. + * + * @param \Illuminate\Contracts\Queue\Job|null $job + * @param \Illuminate\Queue\WorkerOptions $options + * @return void + */ + protected function registerTimeoutHandler($job, WorkerOptions $options) + { + // We will register a signal handler for the alarm signal so that we can kill this + // process if it is running too long because it has frozen. This uses the async + // signals supported in recent versions of PHP to accomplish it conveniently. + pcntl_signal(SIGALRM, function () use ($job, $options) { + if ($job) { + $this->markJobAsFailedIfWillExceedMaxAttempts( + $job->getConnectionName(), $job, (int) $options->maxTries, $this->maxAttemptsExceededException($job) + ); + } + + $this->kill(1); + }); + + pcntl_alarm( + max($this->timeoutForJob($job, $options), 0) + ); + } + + /** + * Reset the worker timeout handler. + * + * @return void + */ + protected function resetTimeoutHandler() + { + pcntl_alarm(0); + } + + /** + * Get the appropriate timeout for the given job. + * + * @param \Illuminate\Contracts\Queue\Job|null $job + * @param \Illuminate\Queue\WorkerOptions $options + * @return int + */ + protected function timeoutForJob($job, WorkerOptions $options) + { + return $job && ! is_null($job->timeout()) ? $job->timeout() : $options->timeout; + } + + /** + * Determine if the daemon should process on this iteration. + * + * @param \Illuminate\Queue\WorkerOptions $options + * @param string $connectionName + * @param string $queue + * @return bool + */ + protected function daemonShouldRun(WorkerOptions $options, $connectionName, $queue) + { + return ! ((($this->isDownForMaintenance)() && ! $options->force) || + $this->paused || + $this->events->until(new Looping($connectionName, $queue)) === false); + } + + /** + * Pause the worker for the current loop. + * + * @param \Illuminate\Queue\WorkerOptions $options + * @param int $lastRestart + * @return void + */ + protected function pauseWorker(WorkerOptions $options, $lastRestart) + { + $this->sleep($options->sleep > 0 ? $options->sleep : 1); + + $this->stopIfNecessary($options, $lastRestart); + } + + /** + * Stop the process if necessary. + * + * @param \Illuminate\Queue\WorkerOptions $options + * @param int $lastRestart + * @param mixed $job + * @return void + */ + protected function stopIfNecessary(WorkerOptions $options, $lastRestart, $job = null) + { + if ($this->shouldQuit) { + $this->stop(); + } elseif ($this->memoryExceeded($options->memory)) { + $this->stop(12); + } elseif ($this->queueShouldRestart($lastRestart)) { + $this->stop(); + } elseif ($options->stopWhenEmpty && is_null($job)) { + $this->stop(); + } + } + + /** + * Process the next job on the queue. + * + * @param string $connectionName + * @param string $queue + * @param \Illuminate\Queue\WorkerOptions $options + * @return void + */ + public function runNextJob($connectionName, $queue, WorkerOptions $options) + { + $job = $this->getNextJob( + $this->manager->connection($connectionName), $queue + ); + + // If we're able to pull a job off of the stack, we will process it and then return + // from this method. If there is no job on the queue, we will "sleep" the worker + // for the specified number of seconds, then keep processing jobs after sleep. + if ($job) { + return $this->runJob($job, $connectionName, $options); + } + + $this->sleep($options->sleep); + } + + /** + * Get the next job from the queue connection. + * + * @param \Illuminate\Contracts\Queue\Queue $connection + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + protected function getNextJob($connection, $queue) + { + try { + foreach (explode(',', $queue) as $queue) { + if (! is_null($job = $connection->pop($queue))) { + return $job; + } + } + } catch (Exception $e) { + $this->exceptions->report($e); + + $this->stopWorkerIfLostConnection($e); + + $this->sleep(1); + } catch (Throwable $e) { + $this->exceptions->report($e = new FatalThrowableError($e)); + + $this->stopWorkerIfLostConnection($e); + + $this->sleep(1); + } + } + + /** + * Process the given job. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param string $connectionName + * @param \Illuminate\Queue\WorkerOptions $options + * @return void + */ + protected function runJob($job, $connectionName, WorkerOptions $options) + { + try { + return $this->process($connectionName, $job, $options); + } catch (Exception $e) { + $this->exceptions->report($e); + + $this->stopWorkerIfLostConnection($e); + } catch (Throwable $e) { + $this->exceptions->report($e = new FatalThrowableError($e)); + + $this->stopWorkerIfLostConnection($e); + } + } + + /** + * Stop the worker if we have lost connection to a database. + * + * @param \Throwable $e + * @return void + */ + protected function stopWorkerIfLostConnection($e) + { + if ($this->causedByLostConnection($e)) { + $this->shouldQuit = true; + } + } + + /** + * Process the given job from the queue. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @param \Illuminate\Queue\WorkerOptions $options + * @return void + * + * @throws \Throwable + */ + public function process($connectionName, $job, WorkerOptions $options) + { + try { + // First we will raise the before job event and determine if the job has already ran + // over its maximum attempt limits, which could primarily happen when this job is + // continually timing out and not actually throwing any exceptions from itself. + $this->raiseBeforeJobEvent($connectionName, $job); + + $this->markJobAsFailedIfAlreadyExceedsMaxAttempts( + $connectionName, $job, (int) $options->maxTries + ); + + if ($job->isDeleted()) { + return $this->raiseAfterJobEvent($connectionName, $job); + } + + // Here we will fire off the job and let it process. We will catch any exceptions so + // they can be reported to the developers logs, etc. Once the job is finished the + // proper events will be fired to let any listeners know this job has finished. + $job->fire(); + + $this->raiseAfterJobEvent($connectionName, $job); + } catch (Exception $e) { + $this->handleJobException($connectionName, $job, $options, $e); + } catch (Throwable $e) { + $this->handleJobException( + $connectionName, $job, $options, new FatalThrowableError($e) + ); + } + } + + /** + * Handle an exception that occurred while the job was running. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @param \Illuminate\Queue\WorkerOptions $options + * @param \Exception $e + * @return void + * + * @throws \Exception + */ + protected function handleJobException($connectionName, $job, WorkerOptions $options, $e) + { + try { + // First, we will go ahead and mark the job as failed if it will exceed the maximum + // attempts it is allowed to run the next time we process it. If so we will just + // go ahead and mark it as failed now so we do not have to release this again. + if (! $job->hasFailed()) { + $this->markJobAsFailedIfWillExceedMaxAttempts( + $connectionName, $job, (int) $options->maxTries, $e + ); + } + + $this->raiseExceptionOccurredJobEvent( + $connectionName, $job, $e + ); + } finally { + // If we catch an exception, we will attempt to release the job back onto the queue + // so it is not lost entirely. This'll let the job be retried at a later time by + // another listener (or this same one). We will re-throw this exception after. + if (! $job->isDeleted() && ! $job->isReleased() && ! $job->hasFailed()) { + $job->release( + method_exists($job, 'delaySeconds') && ! is_null($job->delaySeconds()) + ? $job->delaySeconds() + : $options->delay + ); + } + } + + throw $e; + } + + /** + * Mark the given job as failed if it has exceeded the maximum allowed attempts. + * + * This will likely be because the job previously exceeded a timeout. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @param int $maxTries + * @return void + */ + protected function markJobAsFailedIfAlreadyExceedsMaxAttempts($connectionName, $job, $maxTries) + { + $maxTries = ! is_null($job->maxTries()) ? $job->maxTries() : $maxTries; + + $timeoutAt = $job->timeoutAt(); + + if ($timeoutAt && Carbon::now()->getTimestamp() <= $timeoutAt) { + return; + } + + if (! $timeoutAt && ($maxTries === 0 || $job->attempts() <= $maxTries)) { + return; + } + + $this->failJob($job, $e = $this->maxAttemptsExceededException($job)); + + throw $e; + } + + /** + * Mark the given job as failed if it has exceeded the maximum allowed attempts. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @param int $maxTries + * @param \Exception $e + * @return void + */ + protected function markJobAsFailedIfWillExceedMaxAttempts($connectionName, $job, $maxTries, $e) + { + $maxTries = ! is_null($job->maxTries()) ? $job->maxTries() : $maxTries; + + if ($job->timeoutAt() && $job->timeoutAt() <= Carbon::now()->getTimestamp()) { + $this->failJob($job, $e); + } + + if ($maxTries > 0 && $job->attempts() >= $maxTries) { + $this->failJob($job, $e); + } + } + + /** + * Mark the given job as failed and raise the relevant event. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param \Exception $e + * @return void + */ + protected function failJob($job, $e) + { + return $job->fail($e); + } + + /** + * Raise the before queue job event. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseBeforeJobEvent($connectionName, $job) + { + $this->events->dispatch(new JobProcessing( + $connectionName, $job + )); + } + + /** + * Raise the after queue job event. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseAfterJobEvent($connectionName, $job) + { + $this->events->dispatch(new JobProcessed( + $connectionName, $job + )); + } + + /** + * Raise the exception occurred queue job event. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @param \Exception $e + * @return void + */ + protected function raiseExceptionOccurredJobEvent($connectionName, $job, $e) + { + $this->events->dispatch(new JobExceptionOccurred( + $connectionName, $job, $e + )); + } + + /** + * Determine if the queue worker should restart. + * + * @param int|null $lastRestart + * @return bool + */ + protected function queueShouldRestart($lastRestart) + { + return $this->getTimestampOfLastQueueRestart() != $lastRestart; + } + + /** + * Get the last queue restart timestamp, or null. + * + * @return int|null + */ + protected function getTimestampOfLastQueueRestart() + { + if ($this->cache) { + return $this->cache->get('illuminate:queue:restart'); + } + } + + /** + * Enable async signals for the process. + * + * @return void + */ + protected function listenForSignals() + { + pcntl_async_signals(true); + + pcntl_signal(SIGTERM, function () { + $this->shouldQuit = true; + }); + + pcntl_signal(SIGUSR2, function () { + $this->paused = true; + }); + + pcntl_signal(SIGCONT, function () { + $this->paused = false; + }); + } + + /** + * Determine if "async" signals are supported. + * + * @return bool + */ + protected function supportsAsyncSignals() + { + return extension_loaded('pcntl'); + } + + /** + * Determine if the memory limit has been exceeded. + * + * @param int $memoryLimit + * @return bool + */ + public function memoryExceeded($memoryLimit) + { + return (memory_get_usage(true) / 1024 / 1024) >= $memoryLimit; + } + + /** + * Stop listening and bail out of the script. + * + * @param int $status + * @return void + */ + public function stop($status = 0) + { + $this->events->dispatch(new WorkerStopping($status)); + + exit($status); + } + + /** + * Kill the process. + * + * @param int $status + * @return void + */ + public function kill($status = 0) + { + $this->events->dispatch(new WorkerStopping($status)); + + if (extension_loaded('posix')) { + posix_kill(getmypid(), SIGKILL); + } + + exit($status); + } + + /** + * Create an instance of MaxAttemptsExceededException. + * + * @param \Illuminate\Contracts\Queue\Job|null $job + * @return \Illuminate\Queue\MaxAttemptsExceededException + */ + protected function maxAttemptsExceededException($job) + { + return new MaxAttemptsExceededException( + $job->resolveName().' has been attempted too many times or run too long. The job may have previously timed out.' + ); + } + + /** + * Sleep the script for a given number of seconds. + * + * @param int|float $seconds + * @return void + */ + public function sleep($seconds) + { + if ($seconds < 1) { + usleep($seconds * 1000000); + } else { + sleep($seconds); + } + } + + /** + * Set the cache repository implementation. + * + * @param \Illuminate\Contracts\Cache\Repository $cache + * @return void + */ + public function setCache(CacheContract $cache) + { + $this->cache = $cache; + } + + /** + * Get the queue manager instance. + * + * @return \Illuminate\Queue\QueueManager + */ + public function getManager() + { + return $this->manager; + } + + /** + * Set the queue manager instance. + * + * @param \Illuminate\Contracts\Queue\Factory $manager + * @return void + */ + public function setManager(QueueManager $manager) + { + $this->manager = $manager; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/WorkerOptions.php b/vendor/laravel/framework/src/Illuminate/Queue/WorkerOptions.php new file mode 100644 index 00000000..f4cb1f64 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/WorkerOptions.php @@ -0,0 +1,78 @@ +delay = $delay; + $this->sleep = $sleep; + $this->force = $force; + $this->memory = $memory; + $this->timeout = $timeout; + $this->maxTries = $maxTries; + $this->stopWhenEmpty = $stopWhenEmpty; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/composer.json b/vendor/laravel/framework/src/Illuminate/Queue/composer.json new file mode 100644 index 00000000..8e161601 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/composer.json @@ -0,0 +1,51 @@ +{ + "name": "illuminate/queue", + "description": "The Illuminate Queue package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "ext-json": "*", + "illuminate/console": "^6.0", + "illuminate/container": "^6.0", + "illuminate/contracts": "^6.0", + "illuminate/database": "^6.0", + "illuminate/filesystem": "^6.0", + "illuminate/pipeline": "^6.0", + "illuminate/support": "^6.0", + "opis/closure": "^3.6", + "symfony/debug": "^4.3.4", + "symfony/process": "^4.3.4" + }, + "autoload": { + "psr-4": { + "Illuminate\\Queue\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "suggest": { + "ext-pcntl": "Required to use all features of the queue worker.", + "ext-posix": "Required to use all features of the queue worker.", + "aws/aws-sdk-php": "Required to use the SQS queue driver and DynamoDb failed job storage (^3.155).", + "illuminate/redis": "Required to use the Redis queue driver (^6.0).", + "pda/pheanstalk": "Required to use the Beanstalk queue driver (^4.0)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php b/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php new file mode 100644 index 00000000..95af91e7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php @@ -0,0 +1,222 @@ +client; + } + + /** + * Subscribe to a set of given channels for messages. + * + * @param array|string $channels + * @param \Closure $callback + * @return void + */ + public function subscribe($channels, Closure $callback) + { + return $this->createSubscription($channels, $callback, __FUNCTION__); + } + + /** + * Subscribe to a set of given channels with wildcards. + * + * @param array|string $channels + * @param \Closure $callback + * @return void + */ + public function psubscribe($channels, Closure $callback) + { + return $this->createSubscription($channels, $callback, __FUNCTION__); + } + + /** + * Run a command against the Redis database. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function command($method, array $parameters = []) + { + $start = microtime(true); + + $result = $this->client->{$method}(...$parameters); + + $time = round((microtime(true) - $start) * 1000, 2); + + if (isset($this->events)) { + $this->event(new CommandExecuted($method, $parameters, $time, $this)); + } + + return $result; + } + + /** + * Fire the given event if possible. + * + * @param mixed $event + * @return void + */ + protected function event($event) + { + if (isset($this->events)) { + $this->events->dispatch($event); + } + } + + /** + * Register a Redis command listener with the connection. + * + * @param \Closure $callback + * @return void + */ + public function listen(Closure $callback) + { + if (isset($this->events)) { + $this->events->listen(CommandExecuted::class, $callback); + } + } + + /** + * Get the connection name. + * + * @return string|null + */ + public function getName() + { + return $this->name; + } + + /** + * Set the connections name. + * + * @param string $name + * @return $this + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get the event dispatcher used by the connection. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getEventDispatcher() + { + return $this->events; + } + + /** + * Set the event dispatcher instance on the connection. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function setEventDispatcher(Dispatcher $events) + { + $this->events = $events; + } + + /** + * Unset the event dispatcher instance on the connection. + * + * @return void + */ + public function unsetEventDispatcher() + { + $this->events = null; + } + + /** + * Pass other method calls down to the underlying client. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + return $this->command($method, $parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php b/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php new file mode 100644 index 00000000..e246fe6a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php @@ -0,0 +1,8 @@ +client = $client; + $this->config = $config; + $this->connector = $connector; + } + + /** + * Returns the value of the given key. + * + * @param string $key + * @return string|null + */ + public function get($key) + { + $result = $this->command('get', [$key]); + + return $result !== false ? $result : null; + } + + /** + * Get the values of all the given keys. + * + * @param array $keys + * @return array + */ + public function mget(array $keys) + { + return array_map(function ($value) { + return $value !== false ? $value : null; + }, $this->command('mget', [$keys])); + } + + /** + * Set the string value in argument as value of the key. + * + * @param string $key + * @param mixed $value + * @param string|null $expireResolution + * @param int|null $expireTTL + * @param string|null $flag + * @return bool + */ + public function set($key, $value, $expireResolution = null, $expireTTL = null, $flag = null) + { + return $this->command('set', [ + $key, + $value, + $expireResolution ? [$flag, $expireResolution => $expireTTL] : null, + ]); + } + + /** + * Set the given key if it doesn't exist. + * + * @param string $key + * @param string $value + * @return int + */ + public function setnx($key, $value) + { + return (int) $this->command('setnx', [$key, $value]); + } + + /** + * Get the value of the given hash fields. + * + * @param string $key + * @param mixed $dictionary + * @return array + */ + public function hmget($key, ...$dictionary) + { + if (count($dictionary) === 1) { + $dictionary = $dictionary[0]; + } + + return array_values($this->command('hmget', [$key, $dictionary])); + } + + /** + * Set the given hash fields to their respective values. + * + * @param string $key + * @param mixed $dictionary + * @return int + */ + public function hmset($key, ...$dictionary) + { + if (count($dictionary) === 1) { + $dictionary = $dictionary[0]; + } else { + $input = collect($dictionary); + + $dictionary = $input->nth(2)->combine($input->nth(2, 1))->toArray(); + } + + return $this->command('hmset', [$key, $dictionary]); + } + + /** + * Set the given hash field if it doesn't exist. + * + * @param string $hash + * @param string $key + * @param string $value + * @return int + */ + public function hsetnx($hash, $key, $value) + { + return (int) $this->command('hsetnx', [$hash, $key, $value]); + } + + /** + * Removes the first count occurrences of the value element from the list. + * + * @param string $key + * @param int $count + * @param mixed $value + * @return int|false + */ + public function lrem($key, $count, $value) + { + return $this->command('lrem', [$key, $value, $count]); + } + + /** + * Removes and returns the first element of the list stored at key. + * + * @param mixed $arguments + * @return array|null + */ + public function blpop(...$arguments) + { + $result = $this->command('blpop', $arguments); + + return empty($result) ? null : $result; + } + + /** + * Removes and returns the last element of the list stored at key. + * + * @param mixed $arguments + * @return array|null + */ + public function brpop(...$arguments) + { + $result = $this->command('brpop', $arguments); + + return empty($result) ? null : $result; + } + + /** + * Removes and returns a random element from the set value at key. + * + * @param string $key + * @param int|null $count + * @return mixed|false + */ + public function spop($key, $count = 1) + { + return $this->command('spop', func_get_args()); + } + + /** + * Add one or more members to a sorted set or update its score if it already exists. + * + * @param string $key + * @param mixed $dictionary + * @return int + */ + public function zadd($key, ...$dictionary) + { + if (is_array(end($dictionary))) { + foreach (array_pop($dictionary) as $member => $score) { + $dictionary[] = $score; + $dictionary[] = $member; + } + } + + $options = []; + + foreach (array_slice($dictionary, 0, 3) as $i => $value) { + if (in_array($value, ['nx', 'xx', 'ch', 'incr', 'NX', 'XX', 'CH', 'INCR'], true)) { + $options[] = $value; + + unset($dictionary[$i]); + } + } + + return $this->command('zadd', array_merge([$key], [$options], array_values($dictionary))); + } + + /** + * Return elements with score between $min and $max. + * + * @param string $key + * @param mixed $min + * @param mixed $max + * @param array $options + * @return array + */ + public function zrangebyscore($key, $min, $max, $options = []) + { + if (isset($options['limit'])) { + $options['limit'] = [ + $options['limit']['offset'], + $options['limit']['count'], + ]; + } + + return $this->command('zRangeByScore', [$key, $min, $max, $options]); + } + + /** + * Return elements with score between $min and $max. + * + * @param string $key + * @param mixed $min + * @param mixed $max + * @param array $options + * @return array + */ + public function zrevrangebyscore($key, $min, $max, $options = []) + { + if (isset($options['limit'])) { + $options['limit'] = [ + $options['limit']['offset'], + $options['limit']['count'], + ]; + } + + return $this->command('zRevRangeByScore', [$key, $min, $max, $options]); + } + + /** + * Find the intersection between sets and store in a new set. + * + * @param string $output + * @param array $keys + * @param array $options + * @return int + */ + public function zinterstore($output, $keys, $options = []) + { + return $this->command('zinterstore', [$output, $keys, + $options['weights'] ?? null, + $options['aggregate'] ?? 'sum', + ]); + } + + /** + * Find the union between sets and store in a new set. + * + * @param string $output + * @param array $keys + * @param array $options + * @return int + */ + public function zunionstore($output, $keys, $options = []) + { + return $this->command('zunionstore', [$output, $keys, + $options['weights'] ?? null, + $options['aggregate'] ?? 'sum', + ]); + } + + /** + * Scans the all keys based on options. + * + * @param mixed $cursor + * @param array $options + * @return mixed + */ + public function scan($cursor, $options = []) + { + $result = $this->client->scan($cursor, + $options['match'] ?? '*', + $options['count'] ?? 10 + ); + + return empty($result) ? $result : [$cursor, $result]; + } + + /** + * Scans the given set for all values based on options. + * + * @param string $key + * @param mixed $cursor + * @param array $options + * @return mixed + */ + public function zscan($key, $cursor, $options = []) + { + $result = $this->client->zscan($key, $cursor, + $options['match'] ?? '*', + $options['count'] ?? 10 + ); + + return $result === false ? [0, []] : [$cursor, $result]; + } + + /** + * Scans the given set for all values based on options. + * + * @param string $key + * @param mixed $cursor + * @param array $options + * @return mixed + */ + public function hscan($key, $cursor, $options = []) + { + $result = $this->client->hscan($key, $cursor, + $options['match'] ?? '*', + $options['count'] ?? 10 + ); + + return $result === false ? [0, []] : [$cursor, $result]; + } + + /** + * Scans the given set for all values based on options. + * + * @param string $key + * @param mixed $cursor + * @param array $options + * @return mixed + */ + public function sscan($key, $cursor, $options = []) + { + $result = $this->client->sscan($key, $cursor, + $options['match'] ?? '*', + $options['count'] ?? 10 + ); + + return $result === false ? [0, []] : [$cursor, $result]; + } + + /** + * Execute commands in a pipeline. + * + * @param callable|null $callback + * @return \Redis|array + */ + public function pipeline(callable $callback = null) + { + $pipeline = $this->client()->pipeline(); + + return is_null($callback) + ? $pipeline + : tap($pipeline, $callback)->exec(); + } + + /** + * Execute commands in a transaction. + * + * @param callable|null $callback + * @return \Redis|array + */ + public function transaction(callable $callback = null) + { + $transaction = $this->client()->multi(); + + return is_null($callback) + ? $transaction + : tap($transaction, $callback)->exec(); + } + + /** + * Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself. + * + * @param string $script + * @param int $numkeys + * @param mixed $arguments + * @return mixed + */ + public function evalsha($script, $numkeys, ...$arguments) + { + return $this->command('evalsha', [ + $this->script('load', $script), $arguments, $numkeys, + ]); + } + + /** + * Evaluate a script and return its result. + * + * @param string $script + * @param int $numberOfKeys + * @param dynamic $arguments + * @return mixed + */ + public function eval($script, $numberOfKeys, ...$arguments) + { + return $this->command('eval', [$script, $arguments, $numberOfKeys]); + } + + /** + * Subscribe to a set of given channels for messages. + * + * @param array|string $channels + * @param \Closure $callback + * @return void + */ + public function subscribe($channels, Closure $callback) + { + $this->client->subscribe((array) $channels, function ($redis, $channel, $message) use ($callback) { + $callback($message, $channel); + }); + } + + /** + * Subscribe to a set of given channels with wildcards. + * + * @param array|string $channels + * @param \Closure $callback + * @return void + */ + public function psubscribe($channels, Closure $callback) + { + $this->client->psubscribe((array) $channels, function ($redis, $pattern, $channel, $message) use ($callback) { + $callback($message, $channel); + }); + } + + /** + * Subscribe to a set of given channels for messages. + * + * @param array|string $channels + * @param \Closure $callback + * @param string $method + * @return void + */ + public function createSubscription($channels, Closure $callback, $method = 'subscribe') + { + // + } + + /** + * Flush the selected Redis database. + * + * @return void + */ + public function flushdb() + { + if (! $this->client instanceof RedisCluster) { + return $this->command('flushdb'); + } + + foreach ($this->client->_masters() as $master) { + $this->client->flushDb($master); + } + } + + /** + * Execute a raw command. + * + * @param array $parameters + * @return mixed + */ + public function executeRaw(array $parameters) + { + return $this->command('rawCommand', $parameters); + } + + /** + * Run a command against the Redis database. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function command($method, array $parameters = []) + { + try { + return parent::command($method, $parameters); + } catch (RedisException $e) { + if (Str::contains($e->getMessage(), 'went away')) { + $this->client = $this->connector ? call_user_func($this->connector) : $this->client; + } + + throw $e; + } + } + + /** + * Disconnects from the Redis instance. + * + * @return void + */ + public function disconnect() + { + $this->client->close(); + } + + /** + * Apply prefix to the given key if necessary. + * + * @param string $key + * @return string + */ + private function applyPrefix($key) + { + $prefix = (string) $this->client->getOption(Redis::OPT_PREFIX); + + return $prefix.$key; + } + + /** + * Pass other method calls down to the underlying client. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return parent::__call(strtolower($method), $parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connections/PredisClusterConnection.php b/vendor/laravel/framework/src/Illuminate/Redis/Connections/PredisClusterConnection.php new file mode 100644 index 00000000..399be1ea --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connections/PredisClusterConnection.php @@ -0,0 +1,8 @@ +client = $client; + } + + /** + * Subscribe to a set of given channels for messages. + * + * @param array|string $channels + * @param \Closure $callback + * @param string $method + * @return void + */ + public function createSubscription($channels, Closure $callback, $method = 'subscribe') + { + $loop = $this->pubSubLoop(); + + $loop->{$method}(...array_values((array) $channels)); + + foreach ($loop as $message) { + if ($message->kind === 'message' || $message->kind === 'pmessage') { + call_user_func($callback, $message->payload, $message->channel); + } + } + + unset($loop); + } + + /** + * Flush the selected Redis database. + * + * @return void + */ + public function flushdb() + { + if (! $this->client->getConnection() instanceof ClusterInterface) { + return $this->command('flushdb'); + } + + foreach ($this->getConnection() as $node) { + $node->executeCommand(new ServerFlushDatabase); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php b/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php new file mode 100644 index 00000000..684737b1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php @@ -0,0 +1,196 @@ +createClient(array_merge( + $config, $options, Arr::pull($config, 'options', []) + )); + }; + + return new PhpRedisConnection($connector(), $connector, $config); + } + + /** + * Create a new clustered PhpRedis connection. + * + * @param array $config + * @param array $clusterOptions + * @param array $options + * @return \Illuminate\Redis\Connections\PhpRedisClusterConnection + */ + public function connectToCluster(array $config, array $clusterOptions, array $options) + { + $options = array_merge($options, $clusterOptions, Arr::pull($config, 'options', [])); + + return new PhpRedisClusterConnection($this->createRedisClusterInstance( + array_map([$this, 'buildClusterConnectionString'], $config), $options + )); + } + + /** + * Build a single cluster seed string from array. + * + * @param array $server + * @return string + */ + protected function buildClusterConnectionString(array $server) + { + return $this->formatHost($server).':'.$server['port'].'?'.Arr::query(Arr::only($server, [ + 'database', 'password', 'prefix', 'read_timeout', + ])); + } + + /** + * Create the Redis client instance. + * + * @param array $config + * @return \Redis + * + * @throws \LogicException + */ + protected function createClient(array $config) + { + return tap(new Redis, function ($client) use ($config) { + if ($client instanceof RedisFacade) { + throw new LogicException( + extension_loaded('redis') + ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.' + : 'Please make sure the PHP Redis extension is installed and enabled.' + ); + } + + $this->establishConnection($client, $config); + + if (! empty($config['password'])) { + $client->auth($config['password']); + } + + if (isset($config['database'])) { + $client->select((int) $config['database']); + } + + if (! empty($config['prefix'])) { + $client->setOption(Redis::OPT_PREFIX, $config['prefix']); + } + + if (! empty($config['read_timeout'])) { + $client->setOption(Redis::OPT_READ_TIMEOUT, $config['read_timeout']); + } + + if (! empty($config['scan'])) { + $client->setOption(Redis::OPT_SCAN, $config['scan']); + } + }); + } + + /** + * Establish a connection with the Redis host. + * + * @param \Redis $client + * @param array $config + * @return void + */ + protected function establishConnection($client, array $config) + { + $persistent = $config['persistent'] ?? false; + + $parameters = [ + $this->formatHost($config), + $config['port'], + Arr::get($config, 'timeout', 0.0), + $persistent ? Arr::get($config, 'persistent_id', null) : null, + Arr::get($config, 'retry_interval', 0), + ]; + + if (version_compare(phpversion('redis'), '3.1.3', '>=')) { + $parameters[] = Arr::get($config, 'read_timeout', 0.0); + } + + if (version_compare(phpversion('redis'), '5.3.0', '>=')) { + if (! is_null($context = Arr::get($config, 'context'))) { + $parameters[] = $context; + } + } + + $client->{($persistent ? 'pconnect' : 'connect')}(...$parameters); + } + + /** + * Create a new redis cluster instance. + * + * @param array $servers + * @param array $options + * @return \RedisCluster + */ + protected function createRedisClusterInstance(array $servers, array $options) + { + $parameters = [ + null, + array_values($servers), + $options['timeout'] ?? 0, + $options['read_timeout'] ?? 0, + isset($options['persistent']) && $options['persistent'], + ]; + + if (version_compare(phpversion('redis'), '4.3.0', '>=')) { + $parameters[] = $options['password'] ?? null; + } + + if (version_compare(phpversion('redis'), '5.3.2', '>=')) { + if (! is_null($context = Arr::get($options, 'context'))) { + $parameters[] = $context; + } + } + + return tap(new RedisCluster(...$parameters), function ($client) use ($options) { + if (! empty($options['prefix'])) { + $client->setOption(RedisCluster::OPT_PREFIX, $options['prefix']); + } + + if (! empty($options['scan'])) { + $client->setOption(RedisCluster::OPT_SCAN, $options['scan']); + } + + if (! empty($options['failover'])) { + $client->setOption(RedisCluster::OPT_SLAVE_FAILOVER, $options['failover']); + } + }); + } + + /** + * Format the host using the scheme if available. + * + * @param array $options + * @return string + */ + protected function formatHost(array $options) + { + if (isset($options['scheme'])) { + return Str::start($options['host'], "{$options['scheme']}://"); + } + + return $options['host']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PredisConnector.php b/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PredisConnector.php new file mode 100644 index 00000000..e91e8956 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PredisConnector.php @@ -0,0 +1,45 @@ + 10.0], $options, Arr::pull($config, 'options', []) + ); + + return new PredisConnection(new Client($config, $formattedOptions)); + } + + /** + * Create a new clustered Predis connection. + * + * @param array $config + * @param array $clusterOptions + * @param array $options + * @return \Illuminate\Redis\Connections\PredisClusterConnection + */ + public function connectToCluster(array $config, array $clusterOptions, array $options) + { + $clusterSpecificOptions = Arr::pull($config, 'options', []); + + return new PredisClusterConnection(new Client(array_values($config), array_merge( + $options, $clusterOptions, $clusterSpecificOptions + ))); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Events/CommandExecuted.php b/vendor/laravel/framework/src/Illuminate/Redis/Events/CommandExecuted.php new file mode 100644 index 00000000..fa65719a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Events/CommandExecuted.php @@ -0,0 +1,59 @@ +time = $time; + $this->command = $command; + $this->parameters = $parameters; + $this->connection = $connection; + $this->connectionName = $connection->getName(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Redis/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php new file mode 100644 index 00000000..2dafa6c9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php @@ -0,0 +1,166 @@ +name = $name; + $this->redis = $redis; + $this->maxLocks = $maxLocks; + $this->releaseAfter = $releaseAfter; + } + + /** + * Attempt to acquire the lock for the given number of seconds. + * + * @param int $timeout + * @param callable|null $callback + * @return bool + * + * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException + * @throws \Exception + */ + public function block($timeout, $callback = null) + { + $starting = time(); + + $id = Str::random(20); + + while (! $slot = $this->acquire($id)) { + if (time() - $timeout >= $starting) { + throw new LimiterTimeoutException; + } + + usleep(250 * 1000); + } + + if (is_callable($callback)) { + try { + return tap($callback(), function () use ($slot, $id) { + $this->release($slot, $id); + }); + } catch (Exception $exception) { + $this->release($slot, $id); + + throw $exception; + } + } + + return true; + } + + /** + * Attempt to acquire the lock. + * + * @param string $id A unique identifier for this lock + * @return mixed + */ + protected function acquire($id) + { + $slots = array_map(function ($i) { + return $this->name.$i; + }, range(1, $this->maxLocks)); + + return $this->redis->eval(...array_merge( + [$this->lockScript(), count($slots)], + array_merge($slots, [$this->name, $this->releaseAfter, $id]) + )); + } + + /** + * Get the Lua script for acquiring a lock. + * + * KEYS - The keys that represent available slots + * ARGV[1] - The limiter name + * ARGV[2] - The number of seconds the slot should be reserved + * ARGV[3] - The unique identifier for this lock + * + * @return string + */ + protected function lockScript() + { + return <<<'LUA' +for index, value in pairs(redis.call('mget', unpack(KEYS))) do + if not value then + redis.call('set', KEYS[index], ARGV[3], "EX", ARGV[2]) + return ARGV[1]..index + end +end +LUA; + } + + /** + * Release the lock. + * + * @param string $key + * @param string $id + * @return void + */ + protected function release($key, $id) + { + $this->redis->eval($this->releaseScript(), 1, $key, $id); + } + + /** + * Get the Lua script to atomically release a lock. + * + * KEYS[1] - The name of the lock + * ARGV[1] - The unique identifier for this lock + * + * @return string + */ + protected function releaseScript() + { + return <<<'LUA' +if redis.call('get', KEYS[1]) == ARGV[1] +then + return redis.call('del', KEYS[1]) +else + return 0 +end +LUA; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php new file mode 100644 index 00000000..2ba7c916 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php @@ -0,0 +1,122 @@ +name = $name; + $this->connection = $connection; + } + + /** + * Set the maximum number of locks that can obtained per time window. + * + * @param int $maxLocks + * @return $this + */ + public function limit($maxLocks) + { + $this->maxLocks = $maxLocks; + + return $this; + } + + /** + * Set the number of seconds until the lock will be released. + * + * @param int $releaseAfter + * @return $this + */ + public function releaseAfter($releaseAfter) + { + $this->releaseAfter = $this->secondsUntil($releaseAfter); + + return $this; + } + + /** + * Set the amount of time to block until a lock is available. + * + * @param int $timeout + * @return $this + */ + public function block($timeout) + { + $this->timeout = $timeout; + + return $this; + } + + /** + * Execute the given callback if a lock is obtained, otherwise call the failure callback. + * + * @param callable $callback + * @param callable|null $failure + * @return mixed + * + * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException + */ + public function then(callable $callback, callable $failure = null) + { + try { + return (new ConcurrencyLimiter( + $this->connection, $this->name, $this->maxLocks, $this->releaseAfter + ))->block($this->timeout, $callback); + } catch (LimiterTimeoutException $e) { + if ($failure) { + return $failure($e); + } + + throw $e; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiter.php b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiter.php new file mode 100644 index 00000000..9aa594fb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiter.php @@ -0,0 +1,148 @@ +name = $name; + $this->decay = $decay; + $this->redis = $redis; + $this->maxLocks = $maxLocks; + } + + /** + * Attempt to acquire the lock for the given number of seconds. + * + * @param int $timeout + * @param callable|null $callback + * @return mixed + * + * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException + */ + public function block($timeout, $callback = null) + { + $starting = time(); + + while (! $this->acquire()) { + if (time() - $timeout >= $starting) { + throw new LimiterTimeoutException; + } + + usleep(750 * 1000); + } + + if (is_callable($callback)) { + return $callback(); + } + + return true; + } + + /** + * Attempt to acquire the lock. + * + * @return bool + */ + public function acquire() + { + $results = $this->redis->eval( + $this->luaScript(), 1, $this->name, microtime(true), time(), $this->decay, $this->maxLocks + ); + + $this->decaysAt = $results[1]; + + $this->remaining = max(0, $results[2]); + + return (bool) $results[0]; + } + + /** + * Get the Lua script for acquiring a lock. + * + * KEYS[1] - The limiter name + * ARGV[1] - Current time in microseconds + * ARGV[2] - Current time in seconds + * ARGV[3] - Duration of the bucket + * ARGV[4] - Allowed number of tasks + * + * @return string + */ + protected function luaScript() + { + return <<<'LUA' +local function reset() + redis.call('HMSET', KEYS[1], 'start', ARGV[2], 'end', ARGV[2] + ARGV[3], 'count', 1) + return redis.call('EXPIRE', KEYS[1], ARGV[3] * 2) +end + +if redis.call('EXISTS', KEYS[1]) == 0 then + return {reset(), ARGV[2] + ARGV[3], ARGV[4] - 1} +end + +if ARGV[1] >= redis.call('HGET', KEYS[1], 'start') and ARGV[1] <= redis.call('HGET', KEYS[1], 'end') then + return { + tonumber(redis.call('HINCRBY', KEYS[1], 'count', 1)) <= tonumber(ARGV[4]), + redis.call('HGET', KEYS[1], 'end'), + ARGV[4] - redis.call('HGET', KEYS[1], 'count') + } +end + +return {reset(), ARGV[2] + ARGV[3], ARGV[4] - 1} +LUA; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php new file mode 100644 index 00000000..9d5bfe7d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php @@ -0,0 +1,122 @@ +name = $name; + $this->connection = $connection; + } + + /** + * Set the maximum number of locks that can obtained per time window. + * + * @param int $maxLocks + * @return $this + */ + public function allow($maxLocks) + { + $this->maxLocks = $maxLocks; + + return $this; + } + + /** + * Set the amount of time the lock window is maintained. + * + * @param int $decay + * @return $this + */ + public function every($decay) + { + $this->decay = $this->secondsUntil($decay); + + return $this; + } + + /** + * Set the amount of time to block until a lock is available. + * + * @param int $timeout + * @return $this + */ + public function block($timeout) + { + $this->timeout = $timeout; + + return $this; + } + + /** + * Execute the given callback if a lock is obtained, otherwise call the failure callback. + * + * @param callable $callback + * @param callable|null $failure + * @return mixed + * + * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException + */ + public function then(callable $callback, callable $failure = null) + { + try { + return (new DurationLimiter( + $this->connection, $this->name, $this->maxLocks, $this->decay + ))->block($this->timeout, $callback); + } catch (LimiterTimeoutException $e) { + if ($failure) { + return $failure($e); + } + + throw $e; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php b/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php new file mode 100644 index 00000000..8a6c88d1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php @@ -0,0 +1,265 @@ +app = $app; + $this->driver = $driver; + $this->config = $config; + } + + /** + * Get a Redis connection by name. + * + * @param string|null $name + * @return \Illuminate\Redis\Connections\Connection + */ + public function connection($name = null) + { + $name = $name ?: 'default'; + + if (isset($this->connections[$name])) { + return $this->connections[$name]; + } + + return $this->connections[$name] = $this->configure( + $this->resolve($name), $name + ); + } + + /** + * Resolve the given connection by name. + * + * @param string|null $name + * @return \Illuminate\Redis\Connections\Connection + * + * @throws \InvalidArgumentException + */ + public function resolve($name = null) + { + $name = $name ?: 'default'; + + $options = $this->config['options'] ?? []; + + if (isset($this->config[$name])) { + return $this->connector()->connect( + $this->parseConnectionConfiguration($this->config[$name]), + $options + ); + } + + if (isset($this->config['clusters'][$name])) { + return $this->resolveCluster($name); + } + + throw new InvalidArgumentException("Redis connection [{$name}] not configured."); + } + + /** + * Resolve the given cluster connection by name. + * + * @param string $name + * @return \Illuminate\Redis\Connections\Connection + */ + protected function resolveCluster($name) + { + return $this->connector()->connectToCluster( + array_map(function ($config) { + return $this->parseConnectionConfiguration($config); + }, $this->config['clusters'][$name]), + $this->config['clusters']['options'] ?? [], + $this->config['options'] ?? [] + ); + } + + /** + * Configure the given connection to prepare it for commands. + * + * @param \Illuminate\Redis\Connections\Connection $connection + * @param string $name + * @return \Illuminate\Redis\Connections\Connection + */ + protected function configure(Connection $connection, $name) + { + $connection->setName($name); + + if ($this->events && $this->app->bound('events')) { + $connection->setEventDispatcher($this->app->make('events')); + } + + return $connection; + } + + /** + * Get the connector instance for the current driver. + * + * @return \Illuminate\Contracts\Redis\Connector + */ + protected function connector() + { + $customCreator = $this->customCreators[$this->driver] ?? null; + + if ($customCreator) { + return $customCreator(); + } + + switch ($this->driver) { + case 'predis': + return new PredisConnector; + case 'phpredis': + return new PhpRedisConnector; + } + } + + /** + * Parse the Redis connection configuration. + * + * @param mixed $config + * @return array + */ + protected function parseConnectionConfiguration($config) + { + $parsed = (new ConfigurationUrlParser)->parseConfiguration($config); + + $driver = strtolower($parsed['driver'] ?? ''); + + if (in_array($driver, ['tcp', 'tls'])) { + $parsed['scheme'] = $driver; + } + + return array_filter($parsed, function ($key) { + return ! in_array($key, ['driver'], true); + }, ARRAY_FILTER_USE_KEY); + } + + /** + * Return all of the created connections. + * + * @return array + */ + public function connections() + { + return $this->connections; + } + + /** + * Enable the firing of Redis command events. + * + * @return void + */ + public function enableEvents() + { + $this->events = true; + } + + /** + * Disable the firing of Redis command events. + * + * @return void + */ + public function disableEvents() + { + $this->events = false; + } + + /** + * Set the default driver. + * + * @param string $driver + * @return void + */ + public function setDriver($driver) + { + $this->driver = $driver; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback->bindTo($this, $this); + + return $this; + } + + /** + * Pass methods onto the default Redis connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->connection()->{$method}(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/RedisServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Redis/RedisServiceProvider.php new file mode 100755 index 00000000..66282e51 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/RedisServiceProvider.php @@ -0,0 +1,38 @@ +app->singleton('redis', function ($app) { + $config = $app->make('config')->get('database.redis', []); + + return new RedisManager($app, Arr::pull($config, 'client', 'phpredis'), $config); + }); + + $this->app->bind('redis.connection', function ($app) { + return $app['redis']->connection(); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['redis', 'redis.connection']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/composer.json b/vendor/laravel/framework/src/Illuminate/Redis/composer.json new file mode 100755 index 00000000..efb357a0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/composer.json @@ -0,0 +1,39 @@ +{ + "name": "illuminate/redis", + "description": "The Illuminate Redis package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Redis\\": "" + } + }, + "suggest": { + "ext-redis": "Required to use the phpredis connector (^4.0|^5.0).", + "predis/predis": "Required to use the predis connector (^1.1.2)." + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Console/ControllerMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Routing/Console/ControllerMakeCommand.php new file mode 100755 index 00000000..258ec5dd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Console/ControllerMakeCommand.php @@ -0,0 +1,187 @@ +option('parent')) { + $stub = '/stubs/controller.nested.stub'; + } elseif ($this->option('model')) { + $stub = '/stubs/controller.model.stub'; + } elseif ($this->option('invokable')) { + $stub = '/stubs/controller.invokable.stub'; + } elseif ($this->option('resource')) { + $stub = '/stubs/controller.stub'; + } + + if ($this->option('api') && is_null($stub)) { + $stub = '/stubs/controller.api.stub'; + } elseif ($this->option('api') && ! is_null($stub) && ! $this->option('invokable')) { + $stub = str_replace('.stub', '.api.stub', $stub); + } + + $stub = $stub ?? '/stubs/controller.plain.stub'; + + return __DIR__.$stub; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Http\Controllers'; + } + + /** + * Build the class with the given name. + * + * Remove the base controller import if we are already in base namespace. + * + * @param string $name + * @return string + */ + protected function buildClass($name) + { + $controllerNamespace = $this->getNamespace($name); + + $replace = []; + + if ($this->option('parent')) { + $replace = $this->buildParentReplacements(); + } + + if ($this->option('model')) { + $replace = $this->buildModelReplacements($replace); + } + + $replace["use {$controllerNamespace}\Controller;\n"] = ''; + + return str_replace( + array_keys($replace), array_values($replace), parent::buildClass($name) + ); + } + + /** + * Build the replacements for a parent controller. + * + * @return array + */ + protected function buildParentReplacements() + { + $parentModelClass = $this->parseModel($this->option('parent')); + + if (! class_exists($parentModelClass)) { + if ($this->confirm("A {$parentModelClass} model does not exist. Do you want to generate it?", true)) { + $this->call('make:model', ['name' => $parentModelClass]); + } + } + + return [ + 'ParentDummyFullModelClass' => $parentModelClass, + 'ParentDummyModelClass' => class_basename($parentModelClass), + 'ParentDummyModelVariable' => lcfirst(class_basename($parentModelClass)), + ]; + } + + /** + * Build the model replacement values. + * + * @param array $replace + * @return array + */ + protected function buildModelReplacements(array $replace) + { + $modelClass = $this->parseModel($this->option('model')); + + if (! class_exists($modelClass)) { + if ($this->confirm("A {$modelClass} model does not exist. Do you want to generate it?", true)) { + $this->call('make:model', ['name' => $modelClass]); + } + } + + return array_merge($replace, [ + 'DummyFullModelClass' => $modelClass, + 'DummyModelClass' => class_basename($modelClass), + 'DummyModelVariable' => lcfirst(class_basename($modelClass)), + ]); + } + + /** + * Get the fully-qualified model class name. + * + * @param string $model + * @return string + * + * @throws \InvalidArgumentException + */ + protected function parseModel($model) + { + if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) { + throw new InvalidArgumentException('Model name contains invalid characters.'); + } + + $model = trim(str_replace('/', '\\', $model), '\\'); + + if (! Str::startsWith($model, $rootNamespace = $this->laravel->getNamespace())) { + $model = $rootNamespace.$model; + } + + return $model; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['api', null, InputOption::VALUE_NONE, 'Exclude the create and edit methods from the controller.'], + ['force', null, InputOption::VALUE_NONE, 'Create the class even if the controller already exists'], + ['invokable', 'i', InputOption::VALUE_NONE, 'Generate a single method, invokable controller class.'], + ['model', 'm', InputOption::VALUE_OPTIONAL, 'Generate a resource controller for the given model.'], + ['parent', 'p', InputOption::VALUE_OPTIONAL, 'Generate a nested resource controller class.'], + ['resource', 'r', InputOption::VALUE_NONE, 'Generate a resource controller class.'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php new file mode 100644 index 00000000..e41813d3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php @@ -0,0 +1,50 @@ +middleware[] = [ + 'middleware' => $m, + 'options' => &$options, + ]; + } + + return new ControllerMiddlewareOptions($options); + } + + /** + * Get the middleware assigned to the controller. + * + * @return array + */ + public function getMiddleware() + { + return $this->middleware; + } + + /** + * Execute an action on the controller. + * + * @param string $method + * @param array $parameters + * @return \Symfony\Component\HttpFoundation\Response + */ + public function callAction($method, $parameters) + { + return $this->{$method}(...array_values($parameters)); + } + + /** + * Handle calls to missing methods on the controller. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php b/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php new file mode 100644 index 00000000..673a333f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php @@ -0,0 +1,81 @@ +container = $container; + } + + /** + * Dispatch a request to a given controller and method. + * + * @param \Illuminate\Routing\Route $route + * @param mixed $controller + * @param string $method + * @return mixed + */ + public function dispatch(Route $route, $controller, $method) + { + $parameters = $this->resolveClassMethodDependencies( + $route->parametersWithoutNulls(), $controller, $method + ); + + if (method_exists($controller, 'callAction')) { + return $controller->callAction($method, $parameters); + } + + return $controller->{$method}(...array_values($parameters)); + } + + /** + * Get the middleware for the controller instance. + * + * @param \Illuminate\Routing\Controller $controller + * @param string $method + * @return array + */ + public function getMiddleware($controller, $method) + { + if (! method_exists($controller, 'getMiddleware')) { + return []; + } + + return collect($controller->getMiddleware())->reject(function ($data) use ($method) { + return static::methodExcludedByOptions($method, $data['options']); + })->pluck('middleware')->all(); + } + + /** + * Determine if the given options exclude a particular method. + * + * @param string $method + * @param array $options + * @return bool + */ + protected static function methodExcludedByOptions($method, array $options) + { + return (isset($options['only']) && ! in_array($method, (array) $options['only'])) || + (! empty($options['except']) && in_array($method, (array) $options['except'])); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ControllerMiddlewareOptions.php b/vendor/laravel/framework/src/Illuminate/Routing/ControllerMiddlewareOptions.php new file mode 100644 index 00000000..13ef1898 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/ControllerMiddlewareOptions.php @@ -0,0 +1,50 @@ +options = &$options; + } + + /** + * Set the controller methods the middleware should apply to. + * + * @param array|string|dynamic $methods + * @return $this + */ + public function only($methods) + { + $this->options['only'] = is_array($methods) ? $methods : func_get_args(); + + return $this; + } + + /** + * Set the controller methods the middleware should exclude. + * + * @param array|string|dynamic $methods + * @return $this + */ + public function except($methods) + { + $this->options['except'] = is_array($methods) ? $methods : func_get_args(); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Events/RouteMatched.php b/vendor/laravel/framework/src/Illuminate/Routing/Events/RouteMatched.php new file mode 100644 index 00000000..c8486071 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Events/RouteMatched.php @@ -0,0 +1,33 @@ +route = $route; + $this->request = $request; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Exceptions/InvalidSignatureException.php b/vendor/laravel/framework/src/Illuminate/Routing/Exceptions/InvalidSignatureException.php new file mode 100644 index 00000000..06a35c5e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Exceptions/InvalidSignatureException.php @@ -0,0 +1,18 @@ +getName()}] [URI: {$route->uri()}]."); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php b/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php new file mode 100644 index 00000000..e30372da --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php @@ -0,0 +1,63 @@ +parameters(); + + foreach ($route->signatureParameters(UrlRoutable::class) as $parameter) { + if (! $parameterName = static::getParameterName($parameter->getName(), $parameters)) { + continue; + } + + $parameterValue = $parameters[$parameterName]; + + if ($parameterValue instanceof UrlRoutable) { + continue; + } + + $instance = $container->make(Reflector::getParameterClassName($parameter)); + + if (! $model = $instance->resolveRouteBinding($parameterValue)) { + throw (new ModelNotFoundException)->setModel(get_class($instance), [$parameterValue]); + } + + $route->setParameter($parameterName, $model); + } + } + + /** + * Return the parameter name if it exists in the given parameters. + * + * @param string $name + * @param array $parameters + * @return string|null + */ + protected static function getParameterName($name, $parameters) + { + if (array_key_exists($name, $parameters)) { + return $name; + } + + if (array_key_exists($snakedName = Str::snake($name), $parameters)) { + return $snakedName; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Routing/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php new file mode 100644 index 00000000..a0ea7210 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php @@ -0,0 +1,27 @@ +getCompiled()->getHostRegex(); + + if (is_null($hostRegex)) { + return true; + } + + return preg_match($hostRegex, $request->getHost()); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php new file mode 100644 index 00000000..f9cf155d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php @@ -0,0 +1,21 @@ +getMethod(), $route->methods()); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php new file mode 100644 index 00000000..fd5d5af8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php @@ -0,0 +1,27 @@ +httpOnly()) { + return ! $request->secure(); + } elseif ($route->secure()) { + return $request->secure(); + } + + return true; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php new file mode 100644 index 00000000..3aeb73b2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php @@ -0,0 +1,23 @@ +path() === '/' ? '/' : '/'.$request->path(); + + return preg_match($route->getCompiled()->getRegex(), rawurldecode($path)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php new file mode 100644 index 00000000..0f178f13 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php @@ -0,0 +1,18 @@ +router = $router; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + $this->router->substituteBindings($route = $request->route()); + + $this->router->substituteImplicitBindings($route); + + return $next($request); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php b/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php new file mode 100644 index 00000000..a06b2c29 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php @@ -0,0 +1,198 @@ +limiter = $limiter; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param int|string $maxAttempts + * @param float|int $decayMinutes + * @param string $prefix + * @return \Symfony\Component\HttpFoundation\Response + * + * @throws \Illuminate\Http\Exceptions\ThrottleRequestsException + */ + public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes = 1, $prefix = '') + { + $key = $prefix.$this->resolveRequestSignature($request); + + $maxAttempts = $this->resolveMaxAttempts($request, $maxAttempts); + + if ($this->limiter->tooManyAttempts($key, $maxAttempts)) { + throw $this->buildException($key, $maxAttempts); + } + + $this->limiter->hit($key, $decayMinutes * 60); + + $response = $next($request); + + return $this->addHeaders( + $response, $maxAttempts, + $this->calculateRemainingAttempts($key, $maxAttempts) + ); + } + + /** + * Resolve the number of attempts if the user is authenticated or not. + * + * @param \Illuminate\Http\Request $request + * @param int|string $maxAttempts + * @return int + */ + protected function resolveMaxAttempts($request, $maxAttempts) + { + if (Str::contains($maxAttempts, '|')) { + $maxAttempts = explode('|', $maxAttempts, 2)[$request->user() ? 1 : 0]; + } + + if (! is_numeric($maxAttempts) && $request->user()) { + $maxAttempts = $request->user()->{$maxAttempts}; + } + + return (int) $maxAttempts; + } + + /** + * Resolve request signature. + * + * @param \Illuminate\Http\Request $request + * @return string + * + * @throws \RuntimeException + */ + protected function resolveRequestSignature($request) + { + if ($user = $request->user()) { + return sha1($user->getAuthIdentifier()); + } + + if ($route = $request->route()) { + return sha1($route->getDomain().'|'.$request->ip()); + } + + throw new RuntimeException('Unable to generate the request signature. Route unavailable.'); + } + + /** + * Create a 'too many attempts' exception. + * + * @param string $key + * @param int $maxAttempts + * @return \Illuminate\Http\Exceptions\ThrottleRequestsException + */ + protected function buildException($key, $maxAttempts) + { + $retryAfter = $this->getTimeUntilNextRetry($key); + + $headers = $this->getHeaders( + $maxAttempts, + $this->calculateRemainingAttempts($key, $maxAttempts, $retryAfter), + $retryAfter + ); + + return new ThrottleRequestsException( + 'Too Many Attempts.', null, $headers + ); + } + + /** + * Get the number of seconds until the next retry. + * + * @param string $key + * @return int + */ + protected function getTimeUntilNextRetry($key) + { + return $this->limiter->availableIn($key); + } + + /** + * Add the limit header information to the given response. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @param int $maxAttempts + * @param int $remainingAttempts + * @param int|null $retryAfter + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function addHeaders(Response $response, $maxAttempts, $remainingAttempts, $retryAfter = null) + { + $response->headers->add( + $this->getHeaders($maxAttempts, $remainingAttempts, $retryAfter) + ); + + return $response; + } + + /** + * Get the limit headers information. + * + * @param int $maxAttempts + * @param int $remainingAttempts + * @param int|null $retryAfter + * @return array + */ + protected function getHeaders($maxAttempts, $remainingAttempts, $retryAfter = null) + { + $headers = [ + 'X-RateLimit-Limit' => $maxAttempts, + 'X-RateLimit-Remaining' => $remainingAttempts, + ]; + + if (! is_null($retryAfter)) { + $headers['Retry-After'] = $retryAfter; + $headers['X-RateLimit-Reset'] = $this->availableAt($retryAfter); + } + + return $headers; + } + + /** + * Calculate the number of remaining attempts. + * + * @param string $key + * @param int $maxAttempts + * @param int|null $retryAfter + * @return int + */ + protected function calculateRemainingAttempts($key, $maxAttempts, $retryAfter = null) + { + if (is_null($retryAfter)) { + return $this->limiter->retriesLeft($key, $maxAttempts); + } + + return 0; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php b/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php new file mode 100644 index 00000000..665f8828 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php @@ -0,0 +1,121 @@ +redis = $redis; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param int|string $maxAttempts + * @param float|int $decayMinutes + * @param string $prefix + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + */ + public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes = 1, $prefix = '') + { + $key = $prefix.$this->resolveRequestSignature($request); + + $maxAttempts = $this->resolveMaxAttempts($request, $maxAttempts); + + if ($this->tooManyAttempts($key, $maxAttempts, $decayMinutes)) { + throw $this->buildException($key, $maxAttempts); + } + + $response = $next($request); + + return $this->addHeaders( + $response, $maxAttempts, + $this->calculateRemainingAttempts($key, $maxAttempts) + ); + } + + /** + * Determine if the given key has been "accessed" too many times. + * + * @param string $key + * @param int $maxAttempts + * @param int $decayMinutes + * @return mixed + */ + protected function tooManyAttempts($key, $maxAttempts, $decayMinutes) + { + $limiter = new DurationLimiter( + $this->redis, $key, $maxAttempts, $decayMinutes * 60 + ); + + return tap(! $limiter->acquire(), function () use ($limiter) { + [$this->decaysAt, $this->remaining] = [ + $limiter->decaysAt, $limiter->remaining, + ]; + }); + } + + /** + * Calculate the number of remaining attempts. + * + * @param string $key + * @param int $maxAttempts + * @param int|null $retryAfter + * @return int + */ + protected function calculateRemainingAttempts($key, $maxAttempts, $retryAfter = null) + { + if (is_null($retryAfter)) { + return $this->remaining; + } + + return 0; + } + + /** + * Get the number of seconds until the lock is released. + * + * @param string $key + * @return int + */ + protected function getTimeUntilNextRetry($key) + { + return $this->decaysAt - $this->currentTime(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ValidateSignature.php b/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ValidateSignature.php new file mode 100644 index 00000000..85de9a24 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ValidateSignature.php @@ -0,0 +1,27 @@ +hasValidSignature()) { + return $next($request); + } + + throw new InvalidSignatureException; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/MiddlewareNameResolver.php b/vendor/laravel/framework/src/Illuminate/Routing/MiddlewareNameResolver.php new file mode 100644 index 00000000..87ab42d1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/MiddlewareNameResolver.php @@ -0,0 +1,85 @@ +name = $name; + $this->options = $options; + $this->registrar = $registrar; + $this->controller = $controller; + } + + /** + * Set the methods the controller should apply to. + * + * @param array|string|dynamic $methods + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function only($methods) + { + $this->options['only'] = is_array($methods) ? $methods : func_get_args(); + + return $this; + } + + /** + * Set the methods the controller should exclude. + * + * @param array|string|dynamic $methods + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function except($methods) + { + $this->options['except'] = is_array($methods) ? $methods : func_get_args(); + + return $this; + } + + /** + * Set the route names for controller actions. + * + * @param array|string $names + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function names($names) + { + $this->options['names'] = $names; + + return $this; + } + + /** + * Set the route name for a controller action. + * + * @param string $method + * @param string $name + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function name($method, $name) + { + $this->options['names'][$method] = $name; + + return $this; + } + + /** + * Override the route parameter names. + * + * @param array|string $parameters + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function parameters($parameters) + { + $this->options['parameters'] = $parameters; + + return $this; + } + + /** + * Override a route parameter's name. + * + * @param string $previous + * @param string $new + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function parameter($previous, $new) + { + $this->options['parameters'][$previous] = $new; + + return $this; + } + + /** + * Add middleware to the resource routes. + * + * @param mixed $middleware + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function middleware($middleware) + { + $this->options['middleware'] = $middleware; + + return $this; + } + + /** + * Indicate that the resource routes should have "shallow" nesting. + * + * @param bool $shallow + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function shallow($shallow = true) + { + $this->options['shallow'] = $shallow; + + return $this; + } + + /** + * Register the resource route. + * + * @return \Illuminate\Routing\RouteCollection + */ + public function register() + { + $this->registered = true; + + return $this->registrar->register( + $this->name, $this->controller, $this->options + ); + } + + /** + * Handle the object's destruction. + * + * @return void + */ + public function __destruct() + { + if (! $this->registered) { + $this->register(); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php b/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php new file mode 100644 index 00000000..3d4a684c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php @@ -0,0 +1,59 @@ +toResponse($this->getContainer()->make(Request::class)) + : $carry; + } + + /** + * Handle the given exception. + * + * @param mixed $passable + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + protected function handleException($passable, Exception $e) + { + if (! $this->container->bound(ExceptionHandler::class) || + ! $passable instanceof Request) { + throw $e; + } + + $handler = $this->container->make(ExceptionHandler::class); + + $handler->report($e); + + $response = $handler->render($passable, $e); + + if (is_object($response) && method_exists($response, 'withException')) { + $response->withException($e); + } + + return $response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RedirectController.php b/vendor/laravel/framework/src/Illuminate/Routing/RedirectController.php new file mode 100644 index 00000000..e98414ba --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RedirectController.php @@ -0,0 +1,44 @@ +route()->parameters()); + + $status = $parameters->get('status'); + + $destination = $parameters->get('destination'); + + $parameters->forget('status')->forget('destination'); + + $route = (new Route('GET', $destination, [ + 'as' => 'laravel_route_redirect_destination', + ]))->bind($request); + + $parameters = $parameters->only( + $route->getCompiled()->getPathVariables() + )->toArray(); + + $url = $url->toRoute($route, $parameters, false); + + if (! Str::startsWith($destination, '/') && Str::startsWith($url, '/')) { + $url = Str::after($url, '/'); + } + + return new RedirectResponse($url, $status); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Redirector.php b/vendor/laravel/framework/src/Illuminate/Routing/Redirector.php new file mode 100755 index 00000000..e522f519 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Redirector.php @@ -0,0 +1,232 @@ +generator = $generator; + } + + /** + * Create a new redirect response to the "home" route. + * + * @param int $status + * @return \Illuminate\Http\RedirectResponse + */ + public function home($status = 302) + { + return $this->to($this->generator->route('home'), $status); + } + + /** + * Create a new redirect response to the previous location. + * + * @param int $status + * @param array $headers + * @param mixed $fallback + * @return \Illuminate\Http\RedirectResponse + */ + public function back($status = 302, $headers = [], $fallback = false) + { + return $this->createRedirect($this->generator->previous($fallback), $status, $headers); + } + + /** + * Create a new redirect response to the current URI. + * + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function refresh($status = 302, $headers = []) + { + return $this->to($this->generator->getRequest()->path(), $status, $headers); + } + + /** + * Create a new redirect response, while putting the current URL in the session. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function guest($path, $status = 302, $headers = [], $secure = null) + { + $request = $this->generator->getRequest(); + + $intended = $request->method() === 'GET' && $request->route() && ! $request->expectsJson() + ? $this->generator->full() + : $this->generator->previous(); + + if ($intended) { + $this->setIntendedUrl($intended); + } + + return $this->to($path, $status, $headers, $secure); + } + + /** + * Create a new redirect response to the previously intended location. + * + * @param string $default + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function intended($default = '/', $status = 302, $headers = [], $secure = null) + { + $path = $this->session->pull('url.intended', $default); + + return $this->to($path, $status, $headers, $secure); + } + + /** + * Set the intended url. + * + * @param string $url + * @return void + */ + public function setIntendedUrl($url) + { + $this->session->put('url.intended', $url); + } + + /** + * Create a new redirect response to the given path. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function to($path, $status = 302, $headers = [], $secure = null) + { + return $this->createRedirect($this->generator->to($path, [], $secure), $status, $headers); + } + + /** + * Create a new redirect response to an external URL (no validation). + * + * @param string $path + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function away($path, $status = 302, $headers = []) + { + return $this->createRedirect($path, $status, $headers); + } + + /** + * Create a new redirect response to the given HTTPS path. + * + * @param string $path + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function secure($path, $status = 302, $headers = []) + { + return $this->to($path, $status, $headers, true); + } + + /** + * Create a new redirect response to a named route. + * + * @param string $route + * @param mixed $parameters + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function route($route, $parameters = [], $status = 302, $headers = []) + { + return $this->to($this->generator->route($route, $parameters), $status, $headers); + } + + /** + * Create a new redirect response to a controller action. + * + * @param string|array $action + * @param mixed $parameters + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function action($action, $parameters = [], $status = 302, $headers = []) + { + return $this->to($this->generator->action($action, $parameters), $status, $headers); + } + + /** + * Create a new redirect response. + * + * @param string $path + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + protected function createRedirect($path, $status, $headers) + { + return tap(new RedirectResponse($path, $status, $headers), function ($redirect) { + if (isset($this->session)) { + $redirect->setSession($this->session); + } + + $redirect->setRequest($this->generator->getRequest()); + }); + } + + /** + * Get the URL generator instance. + * + * @return \Illuminate\Routing\UrlGenerator + */ + public function getUrlGenerator() + { + return $this->generator; + } + + /** + * Set the active session store. + * + * @param \Illuminate\Session\Store $session + * @return void + */ + public function setSession(SessionStore $session) + { + $this->session = $session; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ResourceRegistrar.php b/vendor/laravel/framework/src/Illuminate/Routing/ResourceRegistrar.php new file mode 100644 index 00000000..f9353da0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/ResourceRegistrar.php @@ -0,0 +1,472 @@ + 'create', + 'edit' => 'edit', + ]; + + /** + * Create a new resource registrar instance. + * + * @param \Illuminate\Routing\Router $router + * @return void + */ + public function __construct(Router $router) + { + $this->router = $router; + } + + /** + * Route a resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\RouteCollection + */ + public function register($name, $controller, array $options = []) + { + if (isset($options['parameters']) && ! isset($this->parameters)) { + $this->parameters = $options['parameters']; + } + + // If the resource name contains a slash, we will assume the developer wishes to + // register these resource routes with a prefix so we will set that up out of + // the box so they don't have to mess with it. Otherwise, we will continue. + if (Str::contains($name, '/')) { + $this->prefixedResource($name, $controller, $options); + + return; + } + + // We need to extract the base resource from the resource name. Nested resources + // are supported in the framework, but we need to know what name to use for a + // place-holder on the route parameters, which should be the base resources. + $base = $this->getResourceWildcard(last(explode('.', $name))); + + $defaults = $this->resourceDefaults; + + $collection = new RouteCollection; + + foreach ($this->getResourceMethods($defaults, $options) as $m) { + $collection->add($this->{'addResource'.ucfirst($m)}( + $name, $base, $controller, $options + )); + } + + return $collection; + } + + /** + * Build a set of prefixed resource routes. + * + * @param string $name + * @param string $controller + * @param array $options + * @return void + */ + protected function prefixedResource($name, $controller, array $options) + { + [$name, $prefix] = $this->getResourcePrefix($name); + + // We need to extract the base resource from the resource name. Nested resources + // are supported in the framework, but we need to know what name to use for a + // place-holder on the route parameters, which should be the base resources. + $callback = function ($me) use ($name, $controller, $options) { + $me->resource($name, $controller, $options); + }; + + return $this->router->group(compact('prefix'), $callback); + } + + /** + * Extract the resource and prefix from a resource name. + * + * @param string $name + * @return array + */ + protected function getResourcePrefix($name) + { + $segments = explode('/', $name); + + // To get the prefix, we will take all of the name segments and implode them on + // a slash. This will generate a proper URI prefix for us. Then we take this + // last segment, which will be considered the final resources name we use. + $prefix = implode('/', array_slice($segments, 0, -1)); + + return [end($segments), $prefix]; + } + + /** + * Get the applicable resource methods. + * + * @param array $defaults + * @param array $options + * @return array + */ + protected function getResourceMethods($defaults, $options) + { + $methods = $defaults; + + if (isset($options['only'])) { + $methods = array_intersect($methods, (array) $options['only']); + } + + if (isset($options['except'])) { + $methods = array_diff($methods, (array) $options['except']); + } + + return $methods; + } + + /** + * Add the index method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceIndex($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name); + + $action = $this->getResourceAction($name, $controller, 'index', $options); + + return $this->router->get($uri, $action); + } + + /** + * Add the create method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceCreate($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name).'/'.static::$verbs['create']; + + $action = $this->getResourceAction($name, $controller, 'create', $options); + + return $this->router->get($uri, $action); + } + + /** + * Add the store method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceStore($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name); + + $action = $this->getResourceAction($name, $controller, 'store', $options); + + return $this->router->post($uri, $action); + } + + /** + * Add the show method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceShow($name, $base, $controller, $options) + { + $name = $this->getShallowName($name, $options); + + $uri = $this->getResourceUri($name).'/{'.$base.'}'; + + $action = $this->getResourceAction($name, $controller, 'show', $options); + + return $this->router->get($uri, $action); + } + + /** + * Add the edit method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceEdit($name, $base, $controller, $options) + { + $name = $this->getShallowName($name, $options); + + $uri = $this->getResourceUri($name).'/{'.$base.'}/'.static::$verbs['edit']; + + $action = $this->getResourceAction($name, $controller, 'edit', $options); + + return $this->router->get($uri, $action); + } + + /** + * Add the update method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceUpdate($name, $base, $controller, $options) + { + $name = $this->getShallowName($name, $options); + + $uri = $this->getResourceUri($name).'/{'.$base.'}'; + + $action = $this->getResourceAction($name, $controller, 'update', $options); + + return $this->router->match(['PUT', 'PATCH'], $uri, $action); + } + + /** + * Add the destroy method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceDestroy($name, $base, $controller, $options) + { + $name = $this->getShallowName($name, $options); + + $uri = $this->getResourceUri($name).'/{'.$base.'}'; + + $action = $this->getResourceAction($name, $controller, 'destroy', $options); + + return $this->router->delete($uri, $action); + } + + /** + * Get the name for a given resource with shallowness applied when applicable. + * + * @param string $name + * @param array $options + * @return string + */ + protected function getShallowName($name, $options) + { + return isset($options['shallow']) && $options['shallow'] + ? last(explode('.', $name)) + : $name; + } + + /** + * Get the base resource URI for a given resource. + * + * @param string $resource + * @return string + */ + public function getResourceUri($resource) + { + if (! Str::contains($resource, '.')) { + return $resource; + } + + // Once we have built the base URI, we'll remove the parameter holder for this + // base resource name so that the individual route adders can suffix these + // paths however they need to, as some do not have any parameters at all. + $segments = explode('.', $resource); + + $uri = $this->getNestedResourceUri($segments); + + return str_replace('/{'.$this->getResourceWildcard(end($segments)).'}', '', $uri); + } + + /** + * Get the URI for a nested resource segment array. + * + * @param array $segments + * @return string + */ + protected function getNestedResourceUri(array $segments) + { + // We will spin through the segments and create a place-holder for each of the + // resource segments, as well as the resource itself. Then we should get an + // entire string for the resource URI that contains all nested resources. + return implode('/', array_map(function ($s) { + return $s.'/{'.$this->getResourceWildcard($s).'}'; + }, $segments)); + } + + /** + * Format a resource parameter for usage. + * + * @param string $value + * @return string + */ + public function getResourceWildcard($value) + { + if (isset($this->parameters[$value])) { + $value = $this->parameters[$value]; + } elseif (isset(static::$parameterMap[$value])) { + $value = static::$parameterMap[$value]; + } elseif ($this->parameters === 'singular' || static::$singularParameters) { + $value = Str::singular($value); + } + + return str_replace('-', '_', $value); + } + + /** + * Get the action array for a resource route. + * + * @param string $resource + * @param string $controller + * @param string $method + * @param array $options + * @return array + */ + protected function getResourceAction($resource, $controller, $method, $options) + { + $name = $this->getResourceRouteName($resource, $method, $options); + + $action = ['as' => $name, 'uses' => $controller.'@'.$method]; + + if (isset($options['middleware'])) { + $action['middleware'] = $options['middleware']; + } + + return $action; + } + + /** + * Get the name for a given resource. + * + * @param string $resource + * @param string $method + * @param array $options + * @return string + */ + protected function getResourceRouteName($resource, $method, $options) + { + $name = $resource; + + // If the names array has been provided to us we will check for an entry in the + // array first. We will also check for the specific method within this array + // so the names may be specified on a more "granular" level using methods. + if (isset($options['names'])) { + if (is_string($options['names'])) { + $name = $options['names']; + } elseif (isset($options['names'][$method])) { + return $options['names'][$method]; + } + } + + // If a global prefix has been assigned to all names for this resource, we will + // grab that so we can prepend it onto the name when we create this name for + // the resource action. Otherwise we'll just use an empty string for here. + $prefix = isset($options['as']) ? $options['as'].'.' : ''; + + return trim(sprintf('%s%s.%s', $prefix, $name, $method), '.'); + } + + /** + * Set or unset the unmapped global parameters to singular. + * + * @param bool $singular + * @return void + */ + public static function singularParameters($singular = true) + { + static::$singularParameters = (bool) $singular; + } + + /** + * Get the global parameter map. + * + * @return array + */ + public static function getParameters() + { + return static::$parameterMap; + } + + /** + * Set the global parameter mapping. + * + * @param array $parameters + * @return void + */ + public static function setParameters(array $parameters = []) + { + static::$parameterMap = $parameters; + } + + /** + * Get or set the action verbs used in the resource URIs. + * + * @param array $verbs + * @return array + */ + public static function verbs(array $verbs = []) + { + if (empty($verbs)) { + return static::$verbs; + } else { + static::$verbs = array_merge(static::$verbs, $verbs); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php b/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php new file mode 100644 index 00000000..fa844774 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php @@ -0,0 +1,266 @@ +view = $view; + $this->redirector = $redirector; + } + + /** + * Create a new response instance. + * + * @param string $content + * @param int $status + * @param array $headers + * @return \Illuminate\Http\Response + */ + public function make($content = '', $status = 200, array $headers = []) + { + return new Response($content, $status, $headers); + } + + /** + * Create a new "no content" response. + * + * @param int $status + * @param array $headers + * @return \Illuminate\Http\Response + */ + public function noContent($status = 204, array $headers = []) + { + return $this->make('', $status, $headers); + } + + /** + * Create a new response for a given view. + * + * @param string|array $view + * @param array $data + * @param int $status + * @param array $headers + * @return \Illuminate\Http\Response + */ + public function view($view, $data = [], $status = 200, array $headers = []) + { + if (is_array($view)) { + return $this->make($this->view->first($view, $data), $status, $headers); + } + + return $this->make($this->view->make($view, $data), $status, $headers); + } + + /** + * Create a new JSON response instance. + * + * @param mixed $data + * @param int $status + * @param array $headers + * @param int $options + * @return \Illuminate\Http\JsonResponse + */ + public function json($data = [], $status = 200, array $headers = [], $options = 0) + { + return new JsonResponse($data, $status, $headers, $options); + } + + /** + * Create a new JSONP response instance. + * + * @param string $callback + * @param mixed $data + * @param int $status + * @param array $headers + * @param int $options + * @return \Illuminate\Http\JsonResponse + */ + public function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0) + { + return $this->json($data, $status, $headers, $options)->setCallback($callback); + } + + /** + * Create a new streamed response instance. + * + * @param \Closure $callback + * @param int $status + * @param array $headers + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function stream($callback, $status = 200, array $headers = []) + { + return new StreamedResponse($callback, $status, $headers); + } + + /** + * Create a new streamed response instance as a file download. + * + * @param \Closure $callback + * @param string|null $name + * @param array $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment') + { + $response = new StreamedResponse($callback, 200, $headers); + + if (! is_null($name)) { + $response->headers->set('Content-Disposition', $response->headers->makeDisposition( + $disposition, + $name, + $this->fallbackName($name) + )); + } + + return $response; + } + + /** + * Create a new file download response. + * + * @param \SplFileInfo|string $file + * @param string|null $name + * @param array $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + */ + public function download($file, $name = null, array $headers = [], $disposition = 'attachment') + { + $response = new BinaryFileResponse($file, 200, $headers, true, $disposition); + + if (! is_null($name)) { + return $response->setContentDisposition($disposition, $name, $this->fallbackName($name)); + } + + return $response; + } + + /** + * Convert the string to ASCII characters that are equivalent to the given name. + * + * @param string $name + * @return string + */ + protected function fallbackName($name) + { + return str_replace('%', '', Str::ascii($name)); + } + + /** + * Return the raw contents of a binary file. + * + * @param \SplFileInfo|string $file + * @param array $headers + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + */ + public function file($file, array $headers = []) + { + return new BinaryFileResponse($file, 200, $headers); + } + + /** + * Create a new redirect response to the given path. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectTo($path, $status = 302, $headers = [], $secure = null) + { + return $this->redirector->to($path, $status, $headers, $secure); + } + + /** + * Create a new redirect response to a named route. + * + * @param string $route + * @param array $parameters + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectToRoute($route, $parameters = [], $status = 302, $headers = []) + { + return $this->redirector->route($route, $parameters, $status, $headers); + } + + /** + * Create a new redirect response to a controller action. + * + * @param string $action + * @param array $parameters + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectToAction($action, $parameters = [], $status = 302, $headers = []) + { + return $this->redirector->action($action, $parameters, $status, $headers); + } + + /** + * Create a new redirect response, while putting the current URL in the session. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectGuest($path, $status = 302, $headers = [], $secure = null) + { + return $this->redirector->guest($path, $status, $headers, $secure); + } + + /** + * Create a new redirect response to the previously intended location. + * + * @param string $default + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectToIntended($default = '/', $status = 302, $headers = [], $secure = null) + { + return $this->redirector->intended($default, $status, $headers, $secure); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Route.php b/vendor/laravel/framework/src/Illuminate/Routing/Route.php new file mode 100755 index 00000000..9b31e619 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Route.php @@ -0,0 +1,935 @@ +uri = $uri; + $this->methods = (array) $methods; + $this->action = $this->parseAction($action); + + if (in_array('GET', $this->methods) && ! in_array('HEAD', $this->methods)) { + $this->methods[] = 'HEAD'; + } + + if (isset($this->action['prefix'])) { + $this->prefix($this->action['prefix']); + } + } + + /** + * Parse the route action into a standard array. + * + * @param callable|array|null $action + * @return array + * + * @throws \UnexpectedValueException + */ + protected function parseAction($action) + { + return RouteAction::parse($this->uri, $action); + } + + /** + * Run the route action and return the response. + * + * @return mixed + */ + public function run() + { + $this->container = $this->container ?: new Container; + + try { + if ($this->isControllerAction()) { + return $this->runController(); + } + + return $this->runCallable(); + } catch (HttpResponseException $e) { + return $e->getResponse(); + } + } + + /** + * Checks whether the route's action is a controller. + * + * @return bool + */ + protected function isControllerAction() + { + return is_string($this->action['uses']); + } + + /** + * Run the route action and return the response. + * + * @return mixed + */ + protected function runCallable() + { + $callable = $this->action['uses']; + + return $callable(...array_values($this->resolveMethodDependencies( + $this->parametersWithoutNulls(), new ReflectionFunction($this->action['uses']) + ))); + } + + /** + * Run the route action and return the response. + * + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + protected function runController() + { + return $this->controllerDispatcher()->dispatch( + $this, $this->getController(), $this->getControllerMethod() + ); + } + + /** + * Get the controller instance for the route. + * + * @return mixed + */ + public function getController() + { + if (! $this->controller) { + $class = $this->parseControllerCallback()[0]; + + $this->controller = $this->container->make(ltrim($class, '\\')); + } + + return $this->controller; + } + + /** + * Get the controller method used for the route. + * + * @return string + */ + protected function getControllerMethod() + { + return $this->parseControllerCallback()[1]; + } + + /** + * Parse the controller. + * + * @return array + */ + protected function parseControllerCallback() + { + return Str::parseCallback($this->action['uses']); + } + + /** + * Determine if the route matches given request. + * + * @param \Illuminate\Http\Request $request + * @param bool $includingMethod + * @return bool + */ + public function matches(Request $request, $includingMethod = true) + { + $this->compileRoute(); + + foreach ($this->getValidators() as $validator) { + if (! $includingMethod && $validator instanceof MethodValidator) { + continue; + } + + if (! $validator->matches($this, $request)) { + return false; + } + } + + return true; + } + + /** + * Compile the route into a Symfony CompiledRoute instance. + * + * @return \Symfony\Component\Routing\CompiledRoute + */ + protected function compileRoute() + { + if (! $this->compiled) { + $this->compiled = (new RouteCompiler($this))->compile(); + } + + return $this->compiled; + } + + /** + * Bind the route to a given request for execution. + * + * @param \Illuminate\Http\Request $request + * @return $this + */ + public function bind(Request $request) + { + $this->compileRoute(); + + $this->parameters = (new RouteParameterBinder($this)) + ->parameters($request); + + $this->originalParameters = $this->parameters; + + return $this; + } + + /** + * Determine if the route has parameters. + * + * @return bool + */ + public function hasParameters() + { + return isset($this->parameters); + } + + /** + * Determine a given parameter exists from the route. + * + * @param string $name + * @return bool + */ + public function hasParameter($name) + { + if ($this->hasParameters()) { + return array_key_exists($name, $this->parameters()); + } + + return false; + } + + /** + * Get a given parameter from the route. + * + * @param string $name + * @param mixed $default + * @return string|object + */ + public function parameter($name, $default = null) + { + return Arr::get($this->parameters(), $name, $default); + } + + /** + * Get original value of a given parameter from the route. + * + * @param string $name + * @param mixed $default + * @return string + */ + public function originalParameter($name, $default = null) + { + return Arr::get($this->originalParameters(), $name, $default); + } + + /** + * Set a parameter to the given value. + * + * @param string $name + * @param mixed $value + * @return void + */ + public function setParameter($name, $value) + { + $this->parameters(); + + $this->parameters[$name] = $value; + } + + /** + * Unset a parameter on the route if it is set. + * + * @param string $name + * @return void + */ + public function forgetParameter($name) + { + $this->parameters(); + + unset($this->parameters[$name]); + } + + /** + * Get the key / value list of parameters for the route. + * + * @return array + * + * @throws \LogicException + */ + public function parameters() + { + if (isset($this->parameters)) { + return $this->parameters; + } + + throw new LogicException('Route is not bound.'); + } + + /** + * Get the key / value list of original parameters for the route. + * + * @return array + * + * @throws \LogicException + */ + public function originalParameters() + { + if (isset($this->originalParameters)) { + return $this->originalParameters; + } + + throw new LogicException('Route is not bound.'); + } + + /** + * Get the key / value list of parameters without null values. + * + * @return array + */ + public function parametersWithoutNulls() + { + return array_filter($this->parameters(), function ($p) { + return ! is_null($p); + }); + } + + /** + * Get all of the parameter names for the route. + * + * @return array + */ + public function parameterNames() + { + if (isset($this->parameterNames)) { + return $this->parameterNames; + } + + return $this->parameterNames = $this->compileParameterNames(); + } + + /** + * Get the parameter names for the route. + * + * @return array + */ + protected function compileParameterNames() + { + preg_match_all('/\{(.*?)\}/', $this->getDomain().$this->uri, $matches); + + return array_map(function ($m) { + return trim($m, '?'); + }, $matches[1]); + } + + /** + * Get the parameters that are listed in the route / controller signature. + * + * @param string|null $subClass + * @return array + */ + public function signatureParameters($subClass = null) + { + return RouteSignatureParameters::fromAction($this->action, $subClass); + } + + /** + * Set a default value for the route. + * + * @param string $key + * @param mixed $value + * @return $this + */ + public function defaults($key, $value) + { + $this->defaults[$key] = $value; + + return $this; + } + + /** + * Set a regular expression requirement on the route. + * + * @param array|string $name + * @param string|null $expression + * @return $this + */ + public function where($name, $expression = null) + { + foreach ($this->parseWhere($name, $expression) as $name => $expression) { + $this->wheres[$name] = $expression; + } + + return $this; + } + + /** + * Parse arguments to the where method into an array. + * + * @param array|string $name + * @param string $expression + * @return array + */ + protected function parseWhere($name, $expression) + { + return is_array($name) ? $name : [$name => $expression]; + } + + /** + * Set a list of regular expression requirements on the route. + * + * @param array $wheres + * @return $this + */ + protected function whereArray(array $wheres) + { + foreach ($wheres as $name => $expression) { + $this->where($name, $expression); + } + + return $this; + } + + /** + * Mark this route as a fallback route. + * + * @return $this + */ + public function fallback() + { + $this->isFallback = true; + + return $this; + } + + /** + * Get the HTTP verbs the route responds to. + * + * @return array + */ + public function methods() + { + return $this->methods; + } + + /** + * Determine if the route only responds to HTTP requests. + * + * @return bool + */ + public function httpOnly() + { + return in_array('http', $this->action, true); + } + + /** + * Determine if the route only responds to HTTPS requests. + * + * @return bool + */ + public function httpsOnly() + { + return $this->secure(); + } + + /** + * Determine if the route only responds to HTTPS requests. + * + * @return bool + */ + public function secure() + { + return in_array('https', $this->action, true); + } + + /** + * Get or set the domain for the route. + * + * @param string|null $domain + * @return $this|string|null + */ + public function domain($domain = null) + { + if (is_null($domain)) { + return $this->getDomain(); + } + + $this->action['domain'] = $domain; + + return $this; + } + + /** + * Get the domain defined for the route. + * + * @return string|null + */ + public function getDomain() + { + return isset($this->action['domain']) + ? str_replace(['http://', 'https://'], '', $this->action['domain']) : null; + } + + /** + * Get the prefix of the route instance. + * + * @return string + */ + public function getPrefix() + { + return $this->action['prefix'] ?? null; + } + + /** + * Add a prefix to the route URI. + * + * @param string $prefix + * @return $this + */ + public function prefix($prefix) + { + $uri = rtrim($prefix, '/').'/'.ltrim($this->uri, '/'); + + $this->uri = trim($uri, '/'); + + return $this; + } + + /** + * Get the URI associated with the route. + * + * @return string + */ + public function uri() + { + return $this->uri; + } + + /** + * Set the URI that the route responds to. + * + * @param string $uri + * @return $this + */ + public function setUri($uri) + { + $this->uri = $uri; + + return $this; + } + + /** + * Get the name of the route instance. + * + * @return string + */ + public function getName() + { + return $this->action['as'] ?? null; + } + + /** + * Add or change the route name. + * + * @param string $name + * @return $this + */ + public function name($name) + { + $this->action['as'] = isset($this->action['as']) ? $this->action['as'].$name : $name; + + return $this; + } + + /** + * Determine whether the route's name matches the given patterns. + * + * @param mixed ...$patterns + * @return bool + */ + public function named(...$patterns) + { + if (is_null($routeName = $this->getName())) { + return false; + } + + foreach ($patterns as $pattern) { + if (Str::is($pattern, $routeName)) { + return true; + } + } + + return false; + } + + /** + * Set the handler for the route. + * + * @param \Closure|string $action + * @return $this + */ + public function uses($action) + { + $action = is_string($action) ? $this->addGroupNamespaceToStringUses($action) : $action; + + return $this->setAction(array_merge($this->action, $this->parseAction([ + 'uses' => $action, + 'controller' => $action, + ]))); + } + + /** + * Parse a string based action for the "uses" fluent method. + * + * @param string $action + * @return string + */ + protected function addGroupNamespaceToStringUses($action) + { + $groupStack = last($this->router->getGroupStack()); + + if (isset($groupStack['namespace']) && strpos($action, '\\') !== 0) { + return $groupStack['namespace'].'\\'.$action; + } + + return $action; + } + + /** + * Get the action name for the route. + * + * @return string + */ + public function getActionName() + { + return $this->action['controller'] ?? 'Closure'; + } + + /** + * Get the method name of the route action. + * + * @return string + */ + public function getActionMethod() + { + return Arr::last(explode('@', $this->getActionName())); + } + + /** + * Get the action array or one of its properties for the route. + * + * @param string|null $key + * @return mixed + */ + public function getAction($key = null) + { + return Arr::get($this->action, $key); + } + + /** + * Set the action array for the route. + * + * @param array $action + * @return $this + */ + public function setAction(array $action) + { + $this->action = $action; + + return $this; + } + + /** + * Get all middleware, including the ones from the controller. + * + * @return array + */ + public function gatherMiddleware() + { + if (! is_null($this->computedMiddleware)) { + return $this->computedMiddleware; + } + + $this->computedMiddleware = []; + + return $this->computedMiddleware = Router::uniqueMiddleware(array_merge( + $this->middleware(), $this->controllerMiddleware() + )); + } + + /** + * Get or set the middlewares attached to the route. + * + * @param array|string|null $middleware + * @return $this|array + */ + public function middleware($middleware = null) + { + if (is_null($middleware)) { + return (array) ($this->action['middleware'] ?? []); + } + + if (is_string($middleware)) { + $middleware = func_get_args(); + } + + $this->action['middleware'] = array_merge( + (array) ($this->action['middleware'] ?? []), $middleware + ); + + return $this; + } + + /** + * Get the middleware for the route's controller. + * + * @return array + */ + public function controllerMiddleware() + { + if (! $this->isControllerAction()) { + return []; + } + + return $this->controllerDispatcher()->getMiddleware( + $this->getController(), $this->getControllerMethod() + ); + } + + /** + * Get the dispatcher for the route's controller. + * + * @return \Illuminate\Routing\Contracts\ControllerDispatcher + */ + public function controllerDispatcher() + { + if ($this->container->bound(ControllerDispatcherContract::class)) { + return $this->container->make(ControllerDispatcherContract::class); + } + + return new ControllerDispatcher($this->container); + } + + /** + * Get the route validators for the instance. + * + * @return array + */ + public static function getValidators() + { + if (isset(static::$validators)) { + return static::$validators; + } + + // To match the route, we will use a chain of responsibility pattern with the + // validator implementations. We will spin through each one making sure it + // passes and then we will know if the route as a whole matches request. + return static::$validators = [ + new UriValidator, new MethodValidator, + new SchemeValidator, new HostValidator, + ]; + } + + /** + * Get the compiled version of the route. + * + * @return \Symfony\Component\Routing\CompiledRoute + */ + public function getCompiled() + { + return $this->compiled; + } + + /** + * Set the router instance on the route. + * + * @param \Illuminate\Routing\Router $router + * @return $this + */ + public function setRouter(Router $router) + { + $this->router = $router; + + return $this; + } + + /** + * Set the container instance on the route. + * + * @param \Illuminate\Container\Container $container + * @return $this + */ + public function setContainer(Container $container) + { + $this->container = $container; + + return $this; + } + + /** + * Prepare the route instance for serialization. + * + * @return void + * + * @throws \LogicException + */ + public function prepareForSerialization() + { + if ($this->action['uses'] instanceof Closure) { + throw new LogicException("Unable to prepare route [{$this->uri}] for serialization. Uses Closure."); + } + + $this->compileRoute(); + + unset($this->router, $this->container); + } + + /** + * Dynamically access route parameters. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->parameter($key); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php new file mode 100644 index 00000000..9d7eb76a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php @@ -0,0 +1,97 @@ + $action] : [ + 'uses' => $action[0].'@'.$action[1], + 'controller' => $action[0].'@'.$action[1], + ]; + } + + // If no "uses" property has been set, we will dig through the array to find a + // Closure instance within this list. We will set the first Closure we come + // across into the "uses" property that will get fired off by this route. + elseif (! isset($action['uses'])) { + $action['uses'] = static::findCallable($action); + } + + if (is_string($action['uses']) && ! Str::contains($action['uses'], '@')) { + $action['uses'] = static::makeInvokable($action['uses']); + } + + return $action; + } + + /** + * Get an action for a route that has no action. + * + * @param string $uri + * @return array + * + * @throws \LogicException + */ + protected static function missingAction($uri) + { + return ['uses' => function () use ($uri) { + throw new LogicException("Route for [{$uri}] has no action."); + }]; + } + + /** + * Find the callable in an action array. + * + * @param array $action + * @return callable + */ + protected static function findCallable(array $action) + { + return Arr::first($action, function ($value, $key) { + return Reflector::isCallable($value) && is_numeric($key); + }); + } + + /** + * Make an action for an invokable controller. + * + * @param string $action + * @return string + * + * @throws \UnexpectedValueException + */ + protected static function makeInvokable($action) + { + if (! method_exists($action, '__invoke')) { + throw new UnexpectedValueException("Invalid route action: [{$action}]."); + } + + return $action.'@__invoke'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteBinding.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteBinding.php new file mode 100644 index 00000000..133a84a4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteBinding.php @@ -0,0 +1,84 @@ +make($class), $method]; + + return $callable($value, $route); + }; + } + + /** + * Create a Route model binding for a model. + * + * @param \Illuminate\Container\Container $container + * @param string $class + * @param \Closure|null $callback + * @return \Closure + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public static function forModel($container, $class, $callback = null) + { + return function ($value) use ($container, $class, $callback) { + if (is_null($value)) { + return; + } + + // For model binders, we will attempt to retrieve the models using the first + // method on the model instance. If we cannot retrieve the models we'll + // throw a not found exception otherwise we will return the instance. + $instance = $container->make($class); + + if ($model = $instance->resolveRouteBinding($value)) { + return $model; + } + + // If a callback was supplied to the method we will call that to determine + // what we should do when the model is not found. This just gives these + // developer a little greater flexibility to decide what will happen. + if ($callback instanceof Closure) { + return $callback($value); + } + + throw (new ModelNotFoundException)->setModel($class); + }; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php new file mode 100644 index 00000000..08aa4464 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php @@ -0,0 +1,359 @@ +addToCollections($route); + + $this->addLookups($route); + + return $route; + } + + /** + * Add the given route to the arrays of routes. + * + * @param \Illuminate\Routing\Route $route + * @return void + */ + protected function addToCollections($route) + { + $domainAndUri = $route->getDomain().$route->uri(); + + foreach ($route->methods() as $method) { + $this->routes[$method][$domainAndUri] = $route; + } + + $this->allRoutes[$method.$domainAndUri] = $route; + } + + /** + * Add the route to any look-up tables if necessary. + * + * @param \Illuminate\Routing\Route $route + * @return void + */ + protected function addLookups($route) + { + // If the route has a name, we will add it to the name look-up table so that we + // will quickly be able to find any route associate with a name and not have + // to iterate through every route every time we need to perform a look-up. + if ($name = $route->getName()) { + $this->nameList[$name] = $route; + } + + // When the route is routing to a controller we will also store the action that + // is used by the route. This will let us reverse route to controllers while + // processing a request and easily generate URLs to the given controllers. + $action = $route->getAction(); + + if (isset($action['controller'])) { + $this->addToActionList($action, $route); + } + } + + /** + * Add a route to the controller action dictionary. + * + * @param array $action + * @param \Illuminate\Routing\Route $route + * @return void + */ + protected function addToActionList($action, $route) + { + $this->actionList[trim($action['controller'], '\\')] = $route; + } + + /** + * Refresh the name look-up table. + * + * This is done in case any names are fluently defined or if routes are overwritten. + * + * @return void + */ + public function refreshNameLookups() + { + $this->nameList = []; + + foreach ($this->allRoutes as $route) { + if ($route->getName()) { + $this->nameList[$route->getName()] = $route; + } + } + } + + /** + * Refresh the action look-up table. + * + * This is done in case any actions are overwritten with new controllers. + * + * @return void + */ + public function refreshActionLookups() + { + $this->actionList = []; + + foreach ($this->allRoutes as $route) { + if (isset($route->getAction()['controller'])) { + $this->addToActionList($route->getAction(), $route); + } + } + } + + /** + * Find the first route matching a given request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Routing\Route + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + public function match(Request $request) + { + $routes = $this->get($request->getMethod()); + + // First, we will see if we can find a matching route for this current request + // method. If we can, great, we can just return it so that it can be called + // by the consumer. Otherwise we will check for routes with another verb. + $route = $this->matchAgainstRoutes($routes, $request); + + if (! is_null($route)) { + return $route->bind($request); + } + + // If no route was found we will now check if a matching route is specified by + // another HTTP verb. If it is we will need to throw a MethodNotAllowed and + // inform the user agent of which HTTP verb it should use for this route. + $others = $this->checkForAlternateVerbs($request); + + if (count($others) > 0) { + return $this->getRouteForMethods($request, $others); + } + + throw new NotFoundHttpException; + } + + /** + * Determine if a route in the array matches the request. + * + * @param array $routes + * @param \Illuminate\Http\Request $request + * @param bool $includingMethod + * @return \Illuminate\Routing\Route|null + */ + protected function matchAgainstRoutes(array $routes, $request, $includingMethod = true) + { + [$fallbacks, $routes] = collect($routes)->partition(function ($route) { + return $route->isFallback; + }); + + return $routes->merge($fallbacks)->first(function ($value) use ($request, $includingMethod) { + return $value->matches($request, $includingMethod); + }); + } + + /** + * Determine if any routes match on another HTTP verb. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function checkForAlternateVerbs($request) + { + $methods = array_diff(Router::$verbs, [$request->getMethod()]); + + // Here we will spin through all verbs except for the current request verb and + // check to see if any routes respond to them. If they do, we will return a + // proper error response with the correct headers on the response string. + $others = []; + + foreach ($methods as $method) { + if (! is_null($this->matchAgainstRoutes($this->get($method), $request, false))) { + $others[] = $method; + } + } + + return $others; + } + + /** + * Get a route (if necessary) that responds when other available methods are present. + * + * @param \Illuminate\Http\Request $request + * @param array $methods + * @return \Illuminate\Routing\Route + * + * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException + */ + protected function getRouteForMethods($request, array $methods) + { + if ($request->method() === 'OPTIONS') { + return (new Route('OPTIONS', $request->path(), function () use ($methods) { + return new Response('', 200, ['Allow' => implode(',', $methods)]); + }))->bind($request); + } + + $this->methodNotAllowed($methods, $request->method()); + } + + /** + * Throw a method not allowed HTTP exception. + * + * @param array $others + * @param string $method + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException + */ + protected function methodNotAllowed(array $others, $method) + { + throw new MethodNotAllowedHttpException( + $others, + sprintf( + 'The %s method is not supported for this route. Supported methods: %s.', + $method, + implode(', ', $others) + ) + ); + } + + /** + * Get routes from the collection by method. + * + * @param string|null $method + * @return array + */ + public function get($method = null) + { + return is_null($method) ? $this->getRoutes() : Arr::get($this->routes, $method, []); + } + + /** + * Determine if the route collection contains a given named route. + * + * @param string $name + * @return bool + */ + public function hasNamedRoute($name) + { + return ! is_null($this->getByName($name)); + } + + /** + * Get a route instance by its name. + * + * @param string $name + * @return \Illuminate\Routing\Route|null + */ + public function getByName($name) + { + return $this->nameList[$name] ?? null; + } + + /** + * Get a route instance by its controller action. + * + * @param string $action + * @return \Illuminate\Routing\Route|null + */ + public function getByAction($action) + { + return $this->actionList[$action] ?? null; + } + + /** + * Get all of the routes in the collection. + * + * @return array + */ + public function getRoutes() + { + return array_values($this->allRoutes); + } + + /** + * Get all of the routes keyed by their HTTP verb / method. + * + * @return array + */ + public function getRoutesByMethod() + { + return $this->routes; + } + + /** + * Get all of the routes keyed by their name. + * + * @return array + */ + public function getRoutesByName() + { + return $this->nameList; + } + + /** + * Get an iterator for the items. + * + * @return \ArrayIterator + */ + public function getIterator() + { + return new ArrayIterator($this->getRoutes()); + } + + /** + * Count the number of items in the collection. + * + * @return int + */ + public function count() + { + return count($this->getRoutes()); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteCompiler.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteCompiler.php new file mode 100644 index 00000000..c191663b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteCompiler.php @@ -0,0 +1,54 @@ +route = $route; + } + + /** + * Compile the route. + * + * @return \Symfony\Component\Routing\CompiledRoute + */ + public function compile() + { + $optionals = $this->getOptionalParameters(); + + $uri = preg_replace('/\{(\w+?)\?\}/', '{$1}', $this->route->uri()); + + return ( + new SymfonyRoute($uri, $optionals, $this->route->wheres, ['utf8' => true], $this->route->getDomain() ?: '') + )->compile(); + } + + /** + * Get the optional parameters for the route. + * + * @return array + */ + protected function getOptionalParameters() + { + preg_match_all('/\{(\w+?)\?\}/', $this->route->uri(), $matches); + + return isset($matches[1]) ? array_fill_keys($matches[1], null) : []; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php new file mode 100644 index 00000000..b3e887b1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php @@ -0,0 +1,112 @@ +resolveMethodDependencies( + $parameters, new ReflectionMethod($instance, $method) + ); + } + + /** + * Resolve the given method's type-hinted dependencies. + * + * @param array $parameters + * @param \ReflectionFunctionAbstract $reflector + * @return array + */ + public function resolveMethodDependencies(array $parameters, ReflectionFunctionAbstract $reflector) + { + $instanceCount = 0; + + $values = array_values($parameters); + + foreach ($reflector->getParameters() as $key => $parameter) { + $instance = $this->transformDependency( + $parameter, $parameters + ); + + if (! is_null($instance)) { + $instanceCount++; + + $this->spliceIntoParameters($parameters, $key, $instance); + } elseif (! isset($values[$key - $instanceCount]) && + $parameter->isDefaultValueAvailable()) { + $this->spliceIntoParameters($parameters, $key, $parameter->getDefaultValue()); + } + } + + return $parameters; + } + + /** + * Attempt to transform the given parameter into a class instance. + * + * @param \ReflectionParameter $parameter + * @param array $parameters + * @return mixed + */ + protected function transformDependency(ReflectionParameter $parameter, $parameters) + { + $className = Reflector::getParameterClassName($parameter); + + // If the parameter has a type-hinted class, we will check to see if it is already in + // the list of parameters. If it is we will just skip it as it is probably a model + // binding and we do not want to mess with those; otherwise, we resolve it here. + if ($className && ! $this->alreadyInParameters($className, $parameters)) { + return $parameter->isDefaultValueAvailable() + ? $parameter->getDefaultValue() + : $this->container->make($className); + } + } + + /** + * Determine if an object of the given class is in a list of parameters. + * + * @param string $class + * @param array $parameters + * @return bool + */ + protected function alreadyInParameters($class, array $parameters) + { + return ! is_null(Arr::first($parameters, function ($value) use ($class) { + return $value instanceof $class; + })); + } + + /** + * Splice the given value into the parameter list. + * + * @param array $parameters + * @param string $offset + * @param mixed $value + * @return void + */ + protected function spliceIntoParameters(array &$parameters, $offset, $value) + { + array_splice( + $parameters, $offset, 0, [$value] + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteFileRegistrar.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteFileRegistrar.php new file mode 100644 index 00000000..7670b10e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteFileRegistrar.php @@ -0,0 +1,37 @@ +router = $router; + } + + /** + * Require the given routes file. + * + * @param string $routes + * @return void + */ + public function register($routes) + { + $router = $this->router; + + require $routes; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteGroup.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteGroup.php new file mode 100644 index 00000000..4041f1f7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteGroup.php @@ -0,0 +1,95 @@ + static::formatNamespace($new, $old), + 'prefix' => static::formatPrefix($new, $old), + 'where' => static::formatWhere($new, $old), + ]); + + return array_merge_recursive(Arr::except( + $old, ['namespace', 'prefix', 'where', 'as'] + ), $new); + } + + /** + * Format the namespace for the new group attributes. + * + * @param array $new + * @param array $old + * @return string|null + */ + protected static function formatNamespace($new, $old) + { + if (isset($new['namespace'])) { + return isset($old['namespace']) && strpos($new['namespace'], '\\') !== 0 + ? trim($old['namespace'], '\\').'\\'.trim($new['namespace'], '\\') + : trim($new['namespace'], '\\'); + } + + return $old['namespace'] ?? null; + } + + /** + * Format the prefix for the new group attributes. + * + * @param array $new + * @param array $old + * @return string|null + */ + protected static function formatPrefix($new, $old) + { + $old = $old['prefix'] ?? null; + + return isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old; + } + + /** + * Format the "wheres" for the new group attributes. + * + * @param array $new + * @param array $old + * @return array + */ + protected static function formatWhere($new, $old) + { + return array_merge( + $old['where'] ?? [], + $new['where'] ?? [] + ); + } + + /** + * Format the "as" clause of the new group attributes. + * + * @param array $new + * @param array $old + * @return array + */ + protected static function formatAs($new, $old) + { + if (isset($old['as'])) { + $new['as'] = $old['as'].($new['as'] ?? ''); + } + + return $new; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteParameterBinder.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteParameterBinder.php new file mode 100644 index 00000000..53e766ef --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteParameterBinder.php @@ -0,0 +1,120 @@ +route = $route; + } + + /** + * Get the parameters for the route. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function parameters($request) + { + // If the route has a regular expression for the host part of the URI, we will + // compile that and get the parameter matches for this domain. We will then + // merge them into this parameters array so that this array is completed. + $parameters = $this->bindPathParameters($request); + + // If the route has a regular expression for the host part of the URI, we will + // compile that and get the parameter matches for this domain. We will then + // merge them into this parameters array so that this array is completed. + if (! is_null($this->route->compiled->getHostRegex())) { + $parameters = $this->bindHostParameters( + $request, $parameters + ); + } + + return $this->replaceDefaults($parameters); + } + + /** + * Get the parameter matches for the path portion of the URI. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function bindPathParameters($request) + { + $path = '/'.ltrim($request->decodedPath(), '/'); + + preg_match($this->route->compiled->getRegex(), $path, $matches); + + return $this->matchToKeys(array_slice($matches, 1)); + } + + /** + * Extract the parameter list from the host part of the request. + * + * @param \Illuminate\Http\Request $request + * @param array $parameters + * @return array + */ + protected function bindHostParameters($request, $parameters) + { + preg_match($this->route->compiled->getHostRegex(), $request->getHost(), $matches); + + return array_merge($this->matchToKeys(array_slice($matches, 1)), $parameters); + } + + /** + * Combine a set of parameter matches with the route's keys. + * + * @param array $matches + * @return array + */ + protected function matchToKeys(array $matches) + { + if (empty($parameterNames = $this->route->parameterNames())) { + return []; + } + + $parameters = array_intersect_key($matches, array_flip($parameterNames)); + + return array_filter($parameters, function ($value) { + return is_string($value) && strlen($value) > 0; + }); + } + + /** + * Replace null parameters with their defaults. + * + * @param array $parameters + * @return array + */ + protected function replaceDefaults(array $parameters) + { + foreach ($parameters as $key => $value) { + $parameters[$key] = $value ?? Arr::get($this->route->defaults, $key); + } + + foreach ($this->route->defaults as $key => $value) { + if (! isset($parameters[$key])) { + $parameters[$key] = $value; + } + } + + return $parameters; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php new file mode 100644 index 00000000..dc28c9f4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php @@ -0,0 +1,210 @@ + 'as', + ]; + + /** + * Create a new route registrar instance. + * + * @param \Illuminate\Routing\Router $router + * @return void + */ + public function __construct(Router $router) + { + $this->router = $router; + } + + /** + * Set the value for a given attribute. + * + * @param string $key + * @param mixed $value + * @return $this + * + * @throws \InvalidArgumentException + */ + public function attribute($key, $value) + { + if (! in_array($key, $this->allowedAttributes)) { + throw new InvalidArgumentException("Attribute [{$key}] does not exist."); + } + + $this->attributes[Arr::get($this->aliases, $key, $key)] = $value; + + return $this; + } + + /** + * Route a resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function resource($name, $controller, array $options = []) + { + return $this->router->resource($name, $controller, $this->attributes + $options); + } + + /** + * Create a route group with shared attributes. + * + * @param \Closure|string $callback + * @return void + */ + public function group($callback) + { + $this->router->group($this->attributes, $callback); + } + + /** + * Register a new route with the given verbs. + * + * @param array|string $methods + * @param string $uri + * @param \Closure|array|string|null $action + * @return \Illuminate\Routing\Route + */ + public function match($methods, $uri, $action = null) + { + return $this->router->match($methods, $uri, $this->compileAction($action)); + } + + /** + * Register a new route with the router. + * + * @param string $method + * @param string $uri + * @param \Closure|array|string|null $action + * @return \Illuminate\Routing\Route + */ + protected function registerRoute($method, $uri, $action = null) + { + if (! is_array($action)) { + $action = array_merge($this->attributes, $action ? ['uses' => $action] : []); + } + + return $this->router->{$method}($uri, $this->compileAction($action)); + } + + /** + * Compile the action into an array including the attributes. + * + * @param \Closure|array|string|null $action + * @return array + */ + protected function compileAction($action) + { + if (is_null($action)) { + return $this->attributes; + } + + if (is_string($action) || $action instanceof Closure) { + $action = ['uses' => $action]; + } + + if (is_array($action) && + ! Arr::isAssoc($action) && + Reflector::isCallable($action)) { + $action = [ + 'uses' => $action[0].'@'.$action[1], + 'controller' => $action[0].'@'.$action[1], + ]; + } + + return array_merge($this->attributes, $action); + } + + /** + * Dynamically handle calls into the route registrar. + * + * @param string $method + * @param array $parameters + * @return \Illuminate\Routing\Route|$this + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (in_array($method, $this->passthru)) { + return $this->registerRoute($method, ...$parameters); + } + + if (in_array($method, $this->allowedAttributes)) { + if ($method === 'middleware') { + return $this->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters); + } + + return $this->attribute($method, $parameters[0]); + } + + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php new file mode 100644 index 00000000..bd7e932f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php @@ -0,0 +1,46 @@ +getParameters(); + + return is_null($subClass) ? $parameters : array_filter($parameters, function ($p) use ($subClass) { + return Reflector::isParameterSubclassOf($p, $subClass); + }); + } + + /** + * Get the parameters for the given class / method by string. + * + * @param string $uses + * @return array + */ + protected static function fromClassMethodString($uses) + { + [$class, $method] = Str::parseCallback($uses); + + if (! method_exists($class, $method) && Reflector::isCallable($class, $method)) { + return []; + } + + return (new ReflectionMethod($class, $method))->getParameters(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteUrlGenerator.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteUrlGenerator.php new file mode 100644 index 00000000..5cc03c1e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteUrlGenerator.php @@ -0,0 +1,321 @@ + '/', + '%40' => '@', + '%3A' => ':', + '%3B' => ';', + '%2C' => ',', + '%3D' => '=', + '%2B' => '+', + '%21' => '!', + '%2A' => '*', + '%7C' => '|', + '%3F' => '?', + '%26' => '&', + '%23' => '#', + '%25' => '%', + ]; + + /** + * Create a new Route URL generator. + * + * @param \Illuminate\Routing\UrlGenerator $url + * @param \Illuminate\Http\Request $request + * @return void + */ + public function __construct($url, $request) + { + $this->url = $url; + $this->request = $request; + } + + /** + * Generate a URL for the given route. + * + * @param \Illuminate\Routing\Route $route + * @param array $parameters + * @param bool $absolute + * @return string + * + * @throws \Illuminate\Routing\Exceptions\UrlGenerationException + */ + public function to($route, $parameters = [], $absolute = false) + { + $domain = $this->getRouteDomain($route, $parameters); + + // First we will construct the entire URI including the root and query string. Once it + // has been constructed, we'll make sure we don't have any missing parameters or we + // will need to throw the exception to let the developers know one was not given. + $uri = $this->addQueryString($this->url->format( + $root = $this->replaceRootParameters($route, $domain, $parameters), + $this->replaceRouteParameters($route->uri(), $parameters), + $route + ), $parameters); + + if (preg_match('/\{.*?\}/', $uri)) { + throw UrlGenerationException::forMissingParameters($route); + } + + // Once we have ensured that there are no missing parameters in the URI we will encode + // the URI and prepare it for returning to the developer. If the URI is supposed to + // be absolute, we will return it as-is. Otherwise we will remove the URL's root. + $uri = strtr(rawurlencode($uri), $this->dontEncode); + + if (! $absolute) { + $uri = preg_replace('#^(//|[^/?])+#', '', $uri); + + if ($base = $this->request->getBaseUrl()) { + $uri = preg_replace('#^'.$base.'#i', '', $uri); + } + + return '/'.ltrim($uri, '/'); + } + + return $uri; + } + + /** + * Get the formatted domain for a given route. + * + * @param \Illuminate\Routing\Route $route + * @param array $parameters + * @return string + */ + protected function getRouteDomain($route, &$parameters) + { + return $route->getDomain() ? $this->formatDomain($route, $parameters) : null; + } + + /** + * Format the domain and port for the route and request. + * + * @param \Illuminate\Routing\Route $route + * @param array $parameters + * @return string + */ + protected function formatDomain($route, &$parameters) + { + return $this->addPortToDomain( + $this->getRouteScheme($route).$route->getDomain() + ); + } + + /** + * Get the scheme for the given route. + * + * @param \Illuminate\Routing\Route $route + * @return string + */ + protected function getRouteScheme($route) + { + if ($route->httpOnly()) { + return 'http://'; + } elseif ($route->httpsOnly()) { + return 'https://'; + } + + return $this->url->formatScheme(); + } + + /** + * Add the port to the domain if necessary. + * + * @param string $domain + * @return string + */ + protected function addPortToDomain($domain) + { + $secure = $this->request->isSecure(); + + $port = (int) $this->request->getPort(); + + return ($secure && $port === 443) || (! $secure && $port === 80) + ? $domain : $domain.':'.$port; + } + + /** + * Replace the parameters on the root path. + * + * @param \Illuminate\Routing\Route $route + * @param string $domain + * @param array $parameters + * @return string + */ + protected function replaceRootParameters($route, $domain, &$parameters) + { + $scheme = $this->getRouteScheme($route); + + return $this->replaceRouteParameters( + $this->url->formatRoot($scheme, $domain), $parameters + ); + } + + /** + * Replace all of the wildcard parameters for a route path. + * + * @param string $path + * @param array $parameters + * @return string + */ + protected function replaceRouteParameters($path, array &$parameters) + { + $path = $this->replaceNamedParameters($path, $parameters); + + $path = preg_replace_callback('/\{.*?\}/', function ($match) use (&$parameters) { + // Reset only the numeric keys... + $parameters = array_merge($parameters); + + return (! isset($parameters[0]) && ! Str::endsWith($match[0], '?}')) + ? $match[0] + : Arr::pull($parameters, 0); + }, $path); + + return trim(preg_replace('/\{.*?\?\}/', '', $path), '/'); + } + + /** + * Replace all of the named parameters in the path. + * + * @param string $path + * @param array $parameters + * @return string + */ + protected function replaceNamedParameters($path, &$parameters) + { + return preg_replace_callback('/\{(.*?)(\?)?\}/', function ($m) use (&$parameters) { + if (isset($parameters[$m[1]]) && $parameters[$m[1]] !== '') { + return Arr::pull($parameters, $m[1]); + } elseif (isset($this->defaultParameters[$m[1]])) { + return $this->defaultParameters[$m[1]]; + } elseif (isset($parameters[$m[1]])) { + Arr::pull($parameters, $m[1]); + } + + return $m[0]; + }, $path); + } + + /** + * Add a query string to the URI. + * + * @param string $uri + * @param array $parameters + * @return mixed|string + */ + protected function addQueryString($uri, array $parameters) + { + // If the URI has a fragment we will move it to the end of this URI since it will + // need to come after any query string that may be added to the URL else it is + // not going to be available. We will remove it then append it back on here. + if (! is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) { + $uri = preg_replace('/#.*/', '', $uri); + } + + $uri .= $this->getRouteQueryString($parameters); + + return is_null($fragment) ? $uri : $uri."#{$fragment}"; + } + + /** + * Get the query string for a given route. + * + * @param array $parameters + * @return string + */ + protected function getRouteQueryString(array $parameters) + { + // First we will get all of the string parameters that are remaining after we + // have replaced the route wildcards. We'll then build a query string from + // these string parameters then use it as a starting point for the rest. + if (count($parameters) === 0) { + return ''; + } + + $query = Arr::query( + $keyed = $this->getStringParameters($parameters) + ); + + // Lastly, if there are still parameters remaining, we will fetch the numeric + // parameters that are in the array and add them to the query string or we + // will make the initial query string if it wasn't started with strings. + if (count($keyed) < count($parameters)) { + $query .= '&'.implode( + '&', $this->getNumericParameters($parameters) + ); + } + + $query = trim($query, '&'); + + return $query === '' ? '' : "?{$query}"; + } + + /** + * Get the string parameters from a given list. + * + * @param array $parameters + * @return array + */ + protected function getStringParameters(array $parameters) + { + return array_filter($parameters, 'is_string', ARRAY_FILTER_USE_KEY); + } + + /** + * Get the numeric parameters from a given list. + * + * @param array $parameters + * @return array + */ + protected function getNumericParameters(array $parameters) + { + return array_filter($parameters, 'is_numeric', ARRAY_FILTER_USE_KEY); + } + + /** + * Set the default named parameters used by the URL generator. + * + * @param array $defaults + * @return void + */ + public function defaults(array $defaults) + { + $this->defaultParameters = array_merge( + $this->defaultParameters, $defaults + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Router.php b/vendor/laravel/framework/src/Illuminate/Routing/Router.php new file mode 100644 index 00000000..8e762351 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Router.php @@ -0,0 +1,1318 @@ +events = $events; + $this->routes = new RouteCollection; + $this->container = $container ?: new Container; + } + + /** + * Register a new GET route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function get($uri, $action = null) + { + return $this->addRoute(['GET', 'HEAD'], $uri, $action); + } + + /** + * Register a new POST route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function post($uri, $action = null) + { + return $this->addRoute('POST', $uri, $action); + } + + /** + * Register a new PUT route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function put($uri, $action = null) + { + return $this->addRoute('PUT', $uri, $action); + } + + /** + * Register a new PATCH route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function patch($uri, $action = null) + { + return $this->addRoute('PATCH', $uri, $action); + } + + /** + * Register a new DELETE route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function delete($uri, $action = null) + { + return $this->addRoute('DELETE', $uri, $action); + } + + /** + * Register a new OPTIONS route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function options($uri, $action = null) + { + return $this->addRoute('OPTIONS', $uri, $action); + } + + /** + * Register a new route responding to all verbs. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function any($uri, $action = null) + { + return $this->addRoute(self::$verbs, $uri, $action); + } + + /** + * Register a new Fallback route with the router. + * + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function fallback($action) + { + $placeholder = 'fallbackPlaceholder'; + + return $this->addRoute( + 'GET', "{{$placeholder}}", $action + )->where($placeholder, '.*')->fallback(); + } + + /** + * Create a redirect from one URI to another. + * + * @param string $uri + * @param string $destination + * @param int $status + * @return \Illuminate\Routing\Route + */ + public function redirect($uri, $destination, $status = 302) + { + return $this->any($uri, '\Illuminate\Routing\RedirectController') + ->defaults('destination', $destination) + ->defaults('status', $status); + } + + /** + * Create a permanent redirect from one URI to another. + * + * @param string $uri + * @param string $destination + * @return \Illuminate\Routing\Route + */ + public function permanentRedirect($uri, $destination) + { + return $this->redirect($uri, $destination, 301); + } + + /** + * Register a new route that returns a view. + * + * @param string $uri + * @param string $view + * @param array $data + * @return \Illuminate\Routing\Route + */ + public function view($uri, $view, $data = []) + { + return $this->match(['GET', 'HEAD'], $uri, '\Illuminate\Routing\ViewController') + ->defaults('view', $view) + ->defaults('data', $data); + } + + /** + * Register a new route with the given verbs. + * + * @param array|string $methods + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function match($methods, $uri, $action = null) + { + return $this->addRoute(array_map('strtoupper', (array) $methods), $uri, $action); + } + + /** + * Register an array of resource controllers. + * + * @param array $resources + * @param array $options + * @return void + */ + public function resources(array $resources, array $options = []) + { + foreach ($resources as $name => $controller) { + $this->resource($name, $controller, $options); + } + } + + /** + * Route a resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function resource($name, $controller, array $options = []) + { + if ($this->container && $this->container->bound(ResourceRegistrar::class)) { + $registrar = $this->container->make(ResourceRegistrar::class); + } else { + $registrar = new ResourceRegistrar($this); + } + + return new PendingResourceRegistration( + $registrar, $name, $controller, $options + ); + } + + /** + * Register an array of API resource controllers. + * + * @param array $resources + * @param array $options + * @return void + */ + public function apiResources(array $resources, array $options = []) + { + foreach ($resources as $name => $controller) { + $this->apiResource($name, $controller, $options); + } + } + + /** + * Route an API resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function apiResource($name, $controller, array $options = []) + { + $only = ['index', 'show', 'store', 'update', 'destroy']; + + if (isset($options['except'])) { + $only = array_diff($only, (array) $options['except']); + } + + return $this->resource($name, $controller, array_merge([ + 'only' => $only, + ], $options)); + } + + /** + * Create a route group with shared attributes. + * + * @param array $attributes + * @param \Closure|string $routes + * @return void + */ + public function group(array $attributes, $routes) + { + $this->updateGroupStack($attributes); + + // Once we have updated the group stack, we'll load the provided routes and + // merge in the group's attributes when the routes are created. After we + // have created the routes, we will pop the attributes off the stack. + $this->loadRoutes($routes); + + array_pop($this->groupStack); + } + + /** + * Update the group stack with the given attributes. + * + * @param array $attributes + * @return void + */ + protected function updateGroupStack(array $attributes) + { + if ($this->hasGroupStack()) { + $attributes = $this->mergeWithLastGroup($attributes); + } + + $this->groupStack[] = $attributes; + } + + /** + * Merge the given array with the last group stack. + * + * @param array $new + * @return array + */ + public function mergeWithLastGroup($new) + { + return RouteGroup::merge($new, end($this->groupStack)); + } + + /** + * Load the provided routes. + * + * @param \Closure|string $routes + * @return void + */ + protected function loadRoutes($routes) + { + if ($routes instanceof Closure) { + $routes($this); + } else { + (new RouteFileRegistrar($this))->register($routes); + } + } + + /** + * Get the prefix from the last group on the stack. + * + * @return string + */ + public function getLastGroupPrefix() + { + if ($this->hasGroupStack()) { + $last = end($this->groupStack); + + return $last['prefix'] ?? ''; + } + + return ''; + } + + /** + * Add a route to the underlying route collection. + * + * @param array|string $methods + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function addRoute($methods, $uri, $action) + { + return $this->routes->add($this->createRoute($methods, $uri, $action)); + } + + /** + * Create a new route instance. + * + * @param array|string $methods + * @param string $uri + * @param mixed $action + * @return \Illuminate\Routing\Route + */ + protected function createRoute($methods, $uri, $action) + { + // If the route is routing to a controller we will parse the route action into + // an acceptable array format before registering it and creating this route + // instance itself. We need to build the Closure that will call this out. + if ($this->actionReferencesController($action)) { + $action = $this->convertToControllerAction($action); + } + + $route = $this->newRoute( + $methods, $this->prefix($uri), $action + ); + + // If we have groups that need to be merged, we will merge them now after this + // route has already been created and is ready to go. After we're done with + // the merge we will be ready to return the route back out to the caller. + if ($this->hasGroupStack()) { + $this->mergeGroupAttributesIntoRoute($route); + } + + $this->addWhereClausesToRoute($route); + + return $route; + } + + /** + * Determine if the action is routing to a controller. + * + * @param array $action + * @return bool + */ + protected function actionReferencesController($action) + { + if (! $action instanceof Closure) { + return is_string($action) || (isset($action['uses']) && is_string($action['uses'])); + } + + return false; + } + + /** + * Add a controller based route action to the action array. + * + * @param array|string $action + * @return array + */ + protected function convertToControllerAction($action) + { + if (is_string($action)) { + $action = ['uses' => $action]; + } + + // Here we'll merge any group "uses" statement if necessary so that the action + // has the proper clause for this property. Then we can simply set the name + // of the controller on the action and return the action array for usage. + if ($this->hasGroupStack()) { + $action['uses'] = $this->prependGroupNamespace($action['uses']); + } + + // Here we will set this controller name on the action array just so we always + // have a copy of it for reference if we need it. This can be used while we + // search for a controller name or do some other type of fetch operation. + $action['controller'] = $action['uses']; + + return $action; + } + + /** + * Prepend the last group namespace onto the use clause. + * + * @param string $class + * @return string + */ + protected function prependGroupNamespace($class) + { + $group = end($this->groupStack); + + return isset($group['namespace']) && strpos($class, '\\') !== 0 + ? $group['namespace'].'\\'.$class : $class; + } + + /** + * Create a new Route object. + * + * @param array|string $methods + * @param string $uri + * @param mixed $action + * @return \Illuminate\Routing\Route + */ + protected function newRoute($methods, $uri, $action) + { + return (new Route($methods, $uri, $action)) + ->setRouter($this) + ->setContainer($this->container); + } + + /** + * Prefix the given URI with the last prefix. + * + * @param string $uri + * @return string + */ + protected function prefix($uri) + { + return trim(trim($this->getLastGroupPrefix(), '/').'/'.trim($uri, '/'), '/') ?: '/'; + } + + /** + * Add the necessary where clauses to the route based on its initial registration. + * + * @param \Illuminate\Routing\Route $route + * @return \Illuminate\Routing\Route + */ + protected function addWhereClausesToRoute($route) + { + $route->where(array_merge( + $this->patterns, $route->getAction()['where'] ?? [] + )); + + return $route; + } + + /** + * Merge the group stack with the controller action. + * + * @param \Illuminate\Routing\Route $route + * @return void + */ + protected function mergeGroupAttributesIntoRoute($route) + { + $route->setAction($this->mergeWithLastGroup($route->getAction())); + } + + /** + * Return the response returned by the given route. + * + * @param string $name + * @return \Symfony\Component\HttpFoundation\Response + */ + public function respondWithRoute($name) + { + $route = tap($this->routes->getByName($name))->bind($this->currentRequest); + + return $this->runRoute($this->currentRequest, $route); + } + + /** + * Dispatch the request to the application. + * + * @param \Illuminate\Http\Request $request + * @return \Symfony\Component\HttpFoundation\Response + */ + public function dispatch(Request $request) + { + $this->currentRequest = $request; + + return $this->dispatchToRoute($request); + } + + /** + * Dispatch the request to a route and return the response. + * + * @param \Illuminate\Http\Request $request + * @return \Symfony\Component\HttpFoundation\Response + */ + public function dispatchToRoute(Request $request) + { + return $this->runRoute($request, $this->findRoute($request)); + } + + /** + * Find the route matching a given request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Routing\Route + */ + protected function findRoute($request) + { + $this->current = $route = $this->routes->match($request); + + $this->container->instance(Route::class, $route); + + return $route; + } + + /** + * Return the response for the given route. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Routing\Route $route + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function runRoute(Request $request, Route $route) + { + $request->setRouteResolver(function () use ($route) { + return $route; + }); + + $this->events->dispatch(new RouteMatched($route, $request)); + + return $this->prepareResponse($request, + $this->runRouteWithinStack($route, $request) + ); + } + + /** + * Run the given route within a Stack "onion" instance. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function runRouteWithinStack(Route $route, Request $request) + { + $shouldSkipMiddleware = $this->container->bound('middleware.disable') && + $this->container->make('middleware.disable') === true; + + $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route); + + return (new Pipeline($this->container)) + ->send($request) + ->through($middleware) + ->then(function ($request) use ($route) { + return $this->prepareResponse( + $request, $route->run() + ); + }); + } + + /** + * Gather the middleware for the given route with resolved class names. + * + * @param \Illuminate\Routing\Route $route + * @return array + */ + public function gatherRouteMiddleware(Route $route) + { + $middleware = collect($route->gatherMiddleware())->map(function ($name) { + return (array) MiddlewareNameResolver::resolve($name, $this->middleware, $this->middlewareGroups); + })->flatten(); + + return $this->sortMiddleware($middleware); + } + + /** + * Sort the given middleware by priority. + * + * @param \Illuminate\Support\Collection $middlewares + * @return array + */ + protected function sortMiddleware(Collection $middlewares) + { + return (new SortedMiddleware($this->middlewarePriority, $middlewares))->all(); + } + + /** + * Create a response instance from the given value. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param mixed $response + * @return \Symfony\Component\HttpFoundation\Response + */ + public function prepareResponse($request, $response) + { + return static::toResponse($request, $response); + } + + /** + * Static version of prepareResponse. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param mixed $response + * @return \Symfony\Component\HttpFoundation\Response + */ + public static function toResponse($request, $response) + { + if ($response instanceof Responsable) { + $response = $response->toResponse($request); + } + + if ($response instanceof PsrResponseInterface) { + $response = (new HttpFoundationFactory)->createResponse($response); + } elseif ($response instanceof Model && $response->wasRecentlyCreated) { + $response = new JsonResponse($response, 201); + } elseif (! $response instanceof SymfonyResponse && + ($response instanceof Arrayable || + $response instanceof Jsonable || + $response instanceof ArrayObject || + $response instanceof JsonSerializable || + is_array($response))) { + $response = new JsonResponse($response); + } elseif (! $response instanceof SymfonyResponse) { + $response = new Response($response, 200, ['Content-Type' => 'text/html']); + } + + if ($response->getStatusCode() === Response::HTTP_NOT_MODIFIED) { + $response->setNotModified(); + } + + return $response->prepare($request); + } + + /** + * Substitute the route bindings onto the route. + * + * @param \Illuminate\Routing\Route $route + * @return \Illuminate\Routing\Route + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function substituteBindings($route) + { + foreach ($route->parameters() as $key => $value) { + if (isset($this->binders[$key])) { + $route->setParameter($key, $this->performBinding($key, $value, $route)); + } + } + + return $route; + } + + /** + * Substitute the implicit Eloquent model bindings for the route. + * + * @param \Illuminate\Routing\Route $route + * @return void + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function substituteImplicitBindings($route) + { + ImplicitRouteBinding::resolveForRoute($this->container, $route); + } + + /** + * Call the binding callback for the given key. + * + * @param string $key + * @param string $value + * @param \Illuminate\Routing\Route $route + * @return mixed + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + protected function performBinding($key, $value, $route) + { + return call_user_func($this->binders[$key], $value, $route); + } + + /** + * Register a route matched event listener. + * + * @param string|callable $callback + * @return void + */ + public function matched($callback) + { + $this->events->listen(Events\RouteMatched::class, $callback); + } + + /** + * Get all of the defined middleware short-hand names. + * + * @return array + */ + public function getMiddleware() + { + return $this->middleware; + } + + /** + * Register a short-hand name for a middleware. + * + * @param string $name + * @param string $class + * @return $this + */ + public function aliasMiddleware($name, $class) + { + $this->middleware[$name] = $class; + + return $this; + } + + /** + * Check if a middlewareGroup with the given name exists. + * + * @param string $name + * @return bool + */ + public function hasMiddlewareGroup($name) + { + return array_key_exists($name, $this->middlewareGroups); + } + + /** + * Get all of the defined middleware groups. + * + * @return array + */ + public function getMiddlewareGroups() + { + return $this->middlewareGroups; + } + + /** + * Register a group of middleware. + * + * @param string $name + * @param array $middleware + * @return $this + */ + public function middlewareGroup($name, array $middleware) + { + $this->middlewareGroups[$name] = $middleware; + + return $this; + } + + /** + * Add a middleware to the beginning of a middleware group. + * + * If the middleware is already in the group, it will not be added again. + * + * @param string $group + * @param string $middleware + * @return $this + */ + public function prependMiddlewareToGroup($group, $middleware) + { + if (isset($this->middlewareGroups[$group]) && ! in_array($middleware, $this->middlewareGroups[$group])) { + array_unshift($this->middlewareGroups[$group], $middleware); + } + + return $this; + } + + /** + * Add a middleware to the end of a middleware group. + * + * If the middleware is already in the group, it will not be added again. + * + * @param string $group + * @param string $middleware + * @return $this + */ + public function pushMiddlewareToGroup($group, $middleware) + { + if (! array_key_exists($group, $this->middlewareGroups)) { + $this->middlewareGroups[$group] = []; + } + + if (! in_array($middleware, $this->middlewareGroups[$group])) { + $this->middlewareGroups[$group][] = $middleware; + } + + return $this; + } + + /** + * Add a new route parameter binder. + * + * @param string $key + * @param string|callable $binder + * @return void + */ + public function bind($key, $binder) + { + $this->binders[str_replace('-', '_', $key)] = RouteBinding::forCallback( + $this->container, $binder + ); + } + + /** + * Register a model binder for a wildcard. + * + * @param string $key + * @param string $class + * @param \Closure|null $callback + * @return void + */ + public function model($key, $class, Closure $callback = null) + { + $this->bind($key, RouteBinding::forModel($this->container, $class, $callback)); + } + + /** + * Get the binding callback for a given binding. + * + * @param string $key + * @return \Closure|null + */ + public function getBindingCallback($key) + { + if (isset($this->binders[$key = str_replace('-', '_', $key)])) { + return $this->binders[$key]; + } + } + + /** + * Get the global "where" patterns. + * + * @return array + */ + public function getPatterns() + { + return $this->patterns; + } + + /** + * Set a global where pattern on all routes. + * + * @param string $key + * @param string $pattern + * @return void + */ + public function pattern($key, $pattern) + { + $this->patterns[$key] = $pattern; + } + + /** + * Set a group of global where patterns on all routes. + * + * @param array $patterns + * @return void + */ + public function patterns($patterns) + { + foreach ($patterns as $key => $pattern) { + $this->pattern($key, $pattern); + } + } + + /** + * Determine if the router currently has a group stack. + * + * @return bool + */ + public function hasGroupStack() + { + return ! empty($this->groupStack); + } + + /** + * Get the current group stack for the router. + * + * @return array + */ + public function getGroupStack() + { + return $this->groupStack; + } + + /** + * Get a route parameter for the current route. + * + * @param string $key + * @param string|null $default + * @return mixed + */ + public function input($key, $default = null) + { + return $this->current()->parameter($key, $default); + } + + /** + * Get the request currently being dispatched. + * + * @return \Illuminate\Http\Request + */ + public function getCurrentRequest() + { + return $this->currentRequest; + } + + /** + * Get the currently dispatched route instance. + * + * @return \Illuminate\Routing\Route + */ + public function getCurrentRoute() + { + return $this->current(); + } + + /** + * Get the currently dispatched route instance. + * + * @return \Illuminate\Routing\Route|null + */ + public function current() + { + return $this->current; + } + + /** + * Check if a route with the given name exists. + * + * @param string $name + * @return bool + */ + public function has($name) + { + $names = is_array($name) ? $name : func_get_args(); + + foreach ($names as $value) { + if (! $this->routes->hasNamedRoute($value)) { + return false; + } + } + + return true; + } + + /** + * Get the current route name. + * + * @return string|null + */ + public function currentRouteName() + { + return $this->current() ? $this->current()->getName() : null; + } + + /** + * Alias for the "currentRouteNamed" method. + * + * @param mixed ...$patterns + * @return bool + */ + public function is(...$patterns) + { + return $this->currentRouteNamed(...$patterns); + } + + /** + * Determine if the current route matches a pattern. + * + * @param mixed ...$patterns + * @return bool + */ + public function currentRouteNamed(...$patterns) + { + return $this->current() && $this->current()->named(...$patterns); + } + + /** + * Get the current route action. + * + * @return string|null + */ + public function currentRouteAction() + { + if ($this->current()) { + return $this->current()->getAction()['controller'] ?? null; + } + } + + /** + * Alias for the "currentRouteUses" method. + * + * @param array ...$patterns + * @return bool + */ + public function uses(...$patterns) + { + foreach ($patterns as $pattern) { + if (Str::is($pattern, $this->currentRouteAction())) { + return true; + } + } + + return false; + } + + /** + * Determine if the current route action matches a given action. + * + * @param string $action + * @return bool + */ + public function currentRouteUses($action) + { + return $this->currentRouteAction() == $action; + } + + /** + * Register the typical authentication routes for an application. + * + * @param array $options + * @return void + */ + public function auth(array $options = []) + { + // Authentication Routes... + $this->get('login', 'Auth\LoginController@showLoginForm')->name('login'); + $this->post('login', 'Auth\LoginController@login'); + $this->post('logout', 'Auth\LoginController@logout')->name('logout'); + + // Registration Routes... + if ($options['register'] ?? true) { + $this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register'); + $this->post('register', 'Auth\RegisterController@register'); + } + + // Password Reset Routes... + if ($options['reset'] ?? true) { + $this->resetPassword(); + } + + // Password Confirmation Routes... + if ($options['confirm'] ?? + class_exists($this->prependGroupNamespace('Auth\ConfirmPasswordController'))) { + $this->confirmPassword(); + } + + // Email Verification Routes... + if ($options['verify'] ?? false) { + $this->emailVerification(); + } + } + + /** + * Register the typical reset password routes for an application. + * + * @return void + */ + public function resetPassword() + { + $this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request'); + $this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email'); + $this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); + $this->post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update'); + } + + /** + * Register the typical confirm password routes for an application. + * + * @return void + */ + public function confirmPassword() + { + $this->get('password/confirm', 'Auth\ConfirmPasswordController@showConfirmForm')->name('password.confirm'); + $this->post('password/confirm', 'Auth\ConfirmPasswordController@confirm'); + } + + /** + * Register the typical email verification routes for an application. + * + * @return void + */ + public function emailVerification() + { + $this->get('email/verify', 'Auth\VerificationController@show')->name('verification.notice'); + $this->get('email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('verification.verify'); + $this->post('email/resend', 'Auth\VerificationController@resend')->name('verification.resend'); + } + + /** + * Set the unmapped global resource parameters to singular. + * + * @param bool $singular + * @return void + */ + public function singularResourceParameters($singular = true) + { + ResourceRegistrar::singularParameters($singular); + } + + /** + * Set the global resource parameter mapping. + * + * @param array $parameters + * @return void + */ + public function resourceParameters(array $parameters = []) + { + ResourceRegistrar::setParameters($parameters); + } + + /** + * Get or set the verbs used in the resource URIs. + * + * @param array $verbs + * @return array|null + */ + public function resourceVerbs(array $verbs = []) + { + return ResourceRegistrar::verbs($verbs); + } + + /** + * Get the underlying route collection. + * + * @return \Illuminate\Routing\RouteCollection + */ + public function getRoutes() + { + return $this->routes; + } + + /** + * Set the route collection instance. + * + * @param \Illuminate\Routing\RouteCollection $routes + * @return void + */ + public function setRoutes(RouteCollection $routes) + { + foreach ($routes as $route) { + $route->setRouter($this)->setContainer($this->container); + } + + $this->routes = $routes; + + $this->container->instance('routes', $this->routes); + } + + /** + * Remove any duplicate middleware from the given array. + * + * @param array $middleware + * @return array + */ + public static function uniqueMiddleware(array $middleware) + { + $seen = []; + $result = []; + + foreach ($middleware as $value) { + $key = \is_object($value) ? \spl_object_id($value) : $value; + + if (! isset($seen[$key])) { + $seen[$key] = true; + $result[] = $value; + } + } + + return $result; + } + + /** + * Dynamically handle calls into the router instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + if ($method === 'middleware') { + return (new RouteRegistrar($this))->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters); + } + + return (new RouteRegistrar($this))->attribute($method, $parameters[0]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php new file mode 100755 index 00000000..deed73f6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php @@ -0,0 +1,194 @@ +registerRouter(); + $this->registerUrlGenerator(); + $this->registerRedirector(); + $this->registerPsrRequest(); + $this->registerPsrResponse(); + $this->registerResponseFactory(); + $this->registerControllerDispatcher(); + } + + /** + * Register the router instance. + * + * @return void + */ + protected function registerRouter() + { + $this->app->singleton('router', function ($app) { + return new Router($app['events'], $app); + }); + } + + /** + * Register the URL generator service. + * + * @return void + */ + protected function registerUrlGenerator() + { + $this->app->singleton('url', function ($app) { + $routes = $app['router']->getRoutes(); + + // The URL generator needs the route collection that exists on the router. + // Keep in mind this is an object, so we're passing by references here + // and all the registered routes will be available to the generator. + $app->instance('routes', $routes); + + return new UrlGenerator( + $routes, $app->rebinding( + 'request', $this->requestRebinder() + ), $app['config']['app.asset_url'] + ); + }); + + $this->app->extend('url', function (UrlGeneratorContract $url, $app) { + // Next we will set a few service resolvers on the URL generator so it can + // get the information it needs to function. This just provides some of + // the convenience features to this URL generator like "signed" URLs. + $url->setSessionResolver(function () { + return $this->app['session'] ?? null; + }); + + $url->setKeyResolver(function () { + return $this->app->make('config')->get('app.key'); + }); + + // If the route collection is "rebound", for example, when the routes stay + // cached for the application, we will need to rebind the routes on the + // URL generator instance so it has the latest version of the routes. + $app->rebinding('routes', function ($app, $routes) { + $app['url']->setRoutes($routes); + }); + + return $url; + }); + } + + /** + * Get the URL generator request rebinder. + * + * @return \Closure + */ + protected function requestRebinder() + { + return function ($app, $request) { + $app['url']->setRequest($request); + }; + } + + /** + * Register the Redirector service. + * + * @return void + */ + protected function registerRedirector() + { + $this->app->singleton('redirect', function ($app) { + $redirector = new Redirector($app['url']); + + // If the session is set on the application instance, we'll inject it into + // the redirector instance. This allows the redirect responses to allow + // for the quite convenient "with" methods that flash to the session. + if (isset($app['session.store'])) { + $redirector->setSession($app['session.store']); + } + + return $redirector; + }); + } + + /** + * Register a binding for the PSR-7 request implementation. + * + * @return void + */ + protected function registerPsrRequest() + { + $this->app->bind(ServerRequestInterface::class, function ($app) { + if (class_exists(Psr17Factory::class) && class_exists(PsrHttpFactory::class)) { + $psr17Factory = new Psr17Factory; + + return (new PsrHttpFactory($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory)) + ->createRequest($app->make('request')); + } + + if (class_exists(ServerRequestFactory::class) && class_exists(DiactorosFactory::class)) { + return (new DiactorosFactory)->createRequest($app->make('request')); + } + + throw new BindingResolutionException('Unable to resolve PSR request. Please install the symfony/psr-http-message-bridge and nyholm/psr7 packages.'); + }); + } + + /** + * Register a binding for the PSR-7 response implementation. + * + * @return void + */ + protected function registerPsrResponse() + { + $this->app->bind(ResponseInterface::class, function () { + if (class_exists(NyholmPsrResponse::class)) { + return new NyholmPsrResponse; + } + + if (class_exists(ZendPsrResponse::class)) { + return new ZendPsrResponse; + } + + throw new BindingResolutionException('Unable to resolve PSR response. Please install the nyholm/psr7 package.'); + }); + } + + /** + * Register the response factory implementation. + * + * @return void + */ + protected function registerResponseFactory() + { + $this->app->singleton(ResponseFactoryContract::class, function ($app) { + return new ResponseFactory($app[ViewFactoryContract::class], $app['redirect']); + }); + } + + /** + * Register the controller dispatcher. + * + * @return void + */ + protected function registerControllerDispatcher() + { + $this->app->singleton(ControllerDispatcherContract::class, function ($app) { + return new ControllerDispatcher($app); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/SortedMiddleware.php b/vendor/laravel/framework/src/Illuminate/Routing/SortedMiddleware.php new file mode 100644 index 00000000..57dbb073 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/SortedMiddleware.php @@ -0,0 +1,84 @@ +all(); + } + + $this->items = $this->sortMiddleware($priorityMap, $middlewares); + } + + /** + * Sort the middlewares by the given priority map. + * + * Each call to this method makes one discrete middleware movement if necessary. + * + * @param array $priorityMap + * @param array $middlewares + * @return array + */ + protected function sortMiddleware($priorityMap, $middlewares) + { + $lastIndex = 0; + + foreach ($middlewares as $index => $middleware) { + if (! is_string($middleware)) { + continue; + } + + $stripped = head(explode(':', $middleware)); + + if (in_array($stripped, $priorityMap)) { + $priorityIndex = array_search($stripped, $priorityMap); + + // This middleware is in the priority map. If we have encountered another middleware + // that was also in the priority map and was at a lower priority than the current + // middleware, we will move this middleware to be above the previous encounter. + if (isset($lastPriorityIndex) && $priorityIndex < $lastPriorityIndex) { + return $this->sortMiddleware( + $priorityMap, array_values($this->moveMiddleware($middlewares, $index, $lastIndex)) + ); + } + + // This middleware is in the priority map; but, this is the first middleware we have + // encountered from the map thus far. We'll save its current index plus its index + // from the priority map so we can compare against them on the next iterations. + $lastIndex = $index; + $lastPriorityIndex = $priorityIndex; + } + } + + return Router::uniqueMiddleware($middlewares); + } + + /** + * Splice a middleware into a new position and remove the old entry. + * + * @param array $middlewares + * @param int $from + * @param int $to + * @return array + */ + protected function moveMiddleware($middlewares, $from, $to) + { + array_splice($middlewares, $to, 0, $middlewares[$from]); + + unset($middlewares[$from + 1]); + + return $middlewares; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php b/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php new file mode 100755 index 00000000..e1dd34af --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php @@ -0,0 +1,779 @@ +routes = $routes; + $this->assetRoot = $assetRoot; + + $this->setRequest($request); + } + + /** + * Get the full URL for the current request. + * + * @return string + */ + public function full() + { + return $this->request->fullUrl(); + } + + /** + * Get the current URL for the request. + * + * @return string + */ + public function current() + { + return $this->to($this->request->getPathInfo()); + } + + /** + * Get the URL for the previous request. + * + * @param mixed $fallback + * @return string + */ + public function previous($fallback = false) + { + $referrer = $this->request->headers->get('referer'); + + $url = $referrer ? $this->to($referrer) : $this->getPreviousUrlFromSession(); + + if ($url) { + return $url; + } elseif ($fallback) { + return $this->to($fallback); + } + + return $this->to('/'); + } + + /** + * Get the previous URL from the session if possible. + * + * @return string|null + */ + protected function getPreviousUrlFromSession() + { + $session = $this->getSession(); + + return $session ? $session->previousUrl() : null; + } + + /** + * Generate an absolute URL to the given path. + * + * @param string $path + * @param mixed $extra + * @param bool|null $secure + * @return string + */ + public function to($path, $extra = [], $secure = null) + { + // First we will check if the URL is already a valid URL. If it is we will not + // try to generate a new one but will simply return the URL as is, which is + // convenient since developers do not always have to check if it's valid. + if ($this->isValidUrl($path)) { + return $path; + } + + $tail = implode('/', array_map( + 'rawurlencode', (array) $this->formatParameters($extra)) + ); + + // Once we have the scheme we will compile the "tail" by collapsing the values + // into a single string delimited by slashes. This just makes it convenient + // for passing the array of parameters to this URL as a list of segments. + $root = $this->formatRoot($this->formatScheme($secure)); + + [$path, $query] = $this->extractQueryString($path); + + return $this->format( + $root, '/'.trim($path.'/'.$tail, '/') + ).$query; + } + + /** + * Generate a secure, absolute URL to the given path. + * + * @param string $path + * @param array $parameters + * @return string + */ + public function secure($path, $parameters = []) + { + return $this->to($path, $parameters, true); + } + + /** + * Generate the URL to an application asset. + * + * @param string $path + * @param bool|null $secure + * @return string + */ + public function asset($path, $secure = null) + { + if ($this->isValidUrl($path)) { + return $path; + } + + // Once we get the root URL, we will check to see if it contains an index.php + // file in the paths. If it does, we will remove it since it is not needed + // for asset paths, but only for routes to endpoints in the application. + $root = $this->assetRoot + ? $this->assetRoot + : $this->formatRoot($this->formatScheme($secure)); + + return $this->removeIndex($root).'/'.trim($path, '/'); + } + + /** + * Generate the URL to a secure asset. + * + * @param string $path + * @return string + */ + public function secureAsset($path) + { + return $this->asset($path, true); + } + + /** + * Generate the URL to an asset from a custom root domain such as CDN, etc. + * + * @param string $root + * @param string $path + * @param bool|null $secure + * @return string + */ + public function assetFrom($root, $path, $secure = null) + { + // Once we get the root URL, we will check to see if it contains an index.php + // file in the paths. If it does, we will remove it since it is not needed + // for asset paths, but only for routes to endpoints in the application. + $root = $this->formatRoot($this->formatScheme($secure), $root); + + return $this->removeIndex($root).'/'.trim($path, '/'); + } + + /** + * Remove the index.php file from a path. + * + * @param string $root + * @return string + */ + protected function removeIndex($root) + { + $i = 'index.php'; + + return Str::contains($root, $i) ? str_replace('/'.$i, '', $root) : $root; + } + + /** + * Get the default scheme for a raw URL. + * + * @param bool|null $secure + * @return string + */ + public function formatScheme($secure = null) + { + if (! is_null($secure)) { + return $secure ? 'https://' : 'http://'; + } + + if (is_null($this->cachedScheme)) { + $this->cachedScheme = $this->forceScheme ?: $this->request->getScheme().'://'; + } + + return $this->cachedScheme; + } + + /** + * Create a signed route URL for a named route. + * + * @param string $name + * @param mixed $parameters + * @param \DateTimeInterface|\DateInterval|int|null $expiration + * @param bool $absolute + * @return string + * + * @throws \InvalidArgumentException + */ + public function signedRoute($name, $parameters = [], $expiration = null, $absolute = true) + { + $this->ensureSignedRouteParametersAreNotReserved( + $parameters = $this->formatParameters($parameters) + ); + + if ($expiration) { + $parameters = $parameters + ['expires' => $this->availableAt($expiration)]; + } + + ksort($parameters); + + $key = call_user_func($this->keyResolver); + + return $this->route($name, $parameters + [ + 'signature' => hash_hmac('sha256', $this->route($name, $parameters, $absolute), $key), + ], $absolute); + } + + /** + * Ensure the given signed route parameters are not reserved. + * + * @param mixed $parameters + * @return void + */ + protected function ensureSignedRouteParametersAreNotReserved($parameters) + { + if (array_key_exists('signature', $parameters)) { + throw new InvalidArgumentException( + '"Signature" is a reserved parameter when generating signed routes. Please rename your route parameter.' + ); + } + + if (array_key_exists('expires', $parameters)) { + throw new InvalidArgumentException( + '"Expires" is a reserved parameter when generating signed routes. Please rename your route parameter.' + ); + } + } + + /** + * Create a temporary signed route URL for a named route. + * + * @param string $name + * @param \DateTimeInterface|\DateInterval|int $expiration + * @param array $parameters + * @param bool $absolute + * @return string + */ + public function temporarySignedRoute($name, $expiration, $parameters = [], $absolute = true) + { + return $this->signedRoute($name, $parameters, $expiration, $absolute); + } + + /** + * Determine if the given request has a valid signature. + * + * @param \Illuminate\Http\Request $request + * @param bool $absolute + * @return bool + */ + public function hasValidSignature(Request $request, $absolute = true) + { + return $this->hasCorrectSignature($request, $absolute) + && $this->signatureHasNotExpired($request); + } + + /** + * Determine if the signature from the given request matches the URL. + * + * @param \Illuminate\Http\Request $request + * @param bool $absolute + * @return bool + */ + public function hasCorrectSignature(Request $request, $absolute = true) + { + $url = $absolute ? $request->url() : '/'.$request->path(); + + $original = rtrim($url.'?'.Arr::query( + Arr::except($request->query(), 'signature') + ), '?'); + + $signature = hash_hmac('sha256', $original, call_user_func($this->keyResolver)); + + return hash_equals($signature, (string) $request->query('signature', '')); + } + + /** + * Determine if the expires timestamp from the given request is not from the past. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + public function signatureHasNotExpired(Request $request) + { + $expires = $request->query('expires'); + + return ! ($expires && Carbon::now()->getTimestamp() > $expires); + } + + /** + * Get the URL to a named route. + * + * @param string $name + * @param mixed $parameters + * @param bool $absolute + * @return string + * + * @throws \Symfony\Component\Routing\Exception\RouteNotFoundException + */ + public function route($name, $parameters = [], $absolute = true) + { + if (! is_null($route = $this->routes->getByName($name))) { + return $this->toRoute($route, $parameters, $absolute); + } + + throw new RouteNotFoundException("Route [{$name}] not defined."); + } + + /** + * Get the URL for a given route instance. + * + * @param \Illuminate\Routing\Route $route + * @param mixed $parameters + * @param bool $absolute + * @return string + * + * @throws \Illuminate\Routing\Exceptions\UrlGenerationException + */ + public function toRoute($route, $parameters, $absolute) + { + return $this->routeUrl()->to( + $route, $this->formatParameters($parameters), $absolute + ); + } + + /** + * Get the URL to a controller action. + * + * @param string|array $action + * @param mixed $parameters + * @param bool $absolute + * @return string + * + * @throws \InvalidArgumentException + */ + public function action($action, $parameters = [], $absolute = true) + { + if (is_null($route = $this->routes->getByAction($action = $this->formatAction($action)))) { + throw new InvalidArgumentException("Action {$action} not defined."); + } + + return $this->toRoute($route, $parameters, $absolute); + } + + /** + * Format the given controller action. + * + * @param string|array $action + * @return string + */ + protected function formatAction($action) + { + if (is_array($action)) { + $action = '\\'.implode('@', $action); + } + + if ($this->rootNamespace && strpos($action, '\\') !== 0) { + return $this->rootNamespace.'\\'.$action; + } else { + return trim($action, '\\'); + } + } + + /** + * Format the array of URL parameters. + * + * @param mixed|array $parameters + * @return array + */ + public function formatParameters($parameters) + { + $parameters = Arr::wrap($parameters); + + foreach ($parameters as $key => $parameter) { + if ($parameter instanceof UrlRoutable) { + $parameters[$key] = $parameter->getRouteKey(); + } + } + + return $parameters; + } + + /** + * Extract the query string from the given path. + * + * @param string $path + * @return array + */ + protected function extractQueryString($path) + { + if (($queryPosition = strpos($path, '?')) !== false) { + return [ + substr($path, 0, $queryPosition), + substr($path, $queryPosition), + ]; + } + + return [$path, '']; + } + + /** + * Get the base URL for the request. + * + * @param string $scheme + * @param string|null $root + * @return string + */ + public function formatRoot($scheme, $root = null) + { + if (is_null($root)) { + if (is_null($this->cachedRoot)) { + $this->cachedRoot = $this->forcedRoot ?: $this->request->root(); + } + + $root = $this->cachedRoot; + } + + $start = Str::startsWith($root, 'http://') ? 'http://' : 'https://'; + + return preg_replace('~'.$start.'~', $scheme, $root, 1); + } + + /** + * Format the given URL segments into a single URL. + * + * @param string $root + * @param string $path + * @param \Illuminate\Routing\Route|null $route + * @return string + */ + public function format($root, $path, $route = null) + { + $path = '/'.trim($path, '/'); + + if ($this->formatHostUsing) { + $root = call_user_func($this->formatHostUsing, $root, $route); + } + + if ($this->formatPathUsing) { + $path = call_user_func($this->formatPathUsing, $path, $route); + } + + return trim($root.$path, '/'); + } + + /** + * Determine if the given path is a valid URL. + * + * @param string $path + * @return bool + */ + public function isValidUrl($path) + { + if (! preg_match('~^(#|//|https?://|(mailto|tel|sms):)~', $path)) { + return filter_var($path, FILTER_VALIDATE_URL) !== false; + } + + return true; + } + + /** + * Get the Route URL generator instance. + * + * @return \Illuminate\Routing\RouteUrlGenerator + */ + protected function routeUrl() + { + if (! $this->routeGenerator) { + $this->routeGenerator = new RouteUrlGenerator($this, $this->request); + } + + return $this->routeGenerator; + } + + /** + * Set the default named parameters used by the URL generator. + * + * @param array $defaults + * @return void + */ + public function defaults(array $defaults) + { + $this->routeUrl()->defaults($defaults); + } + + /** + * Get the default named parameters used by the URL generator. + * + * @return array + */ + public function getDefaultParameters() + { + return $this->routeUrl()->defaultParameters; + } + + /** + * Force the scheme for URLs. + * + * @param string $scheme + * @return void + */ + public function forceScheme($scheme) + { + $this->cachedScheme = null; + + $this->forceScheme = $scheme.'://'; + } + + /** + * Set the forced root URL. + * + * @param string $root + * @return void + */ + public function forceRootUrl($root) + { + $this->forcedRoot = rtrim($root, '/'); + + $this->cachedRoot = null; + } + + /** + * Set a callback to be used to format the host of generated URLs. + * + * @param \Closure $callback + * @return $this + */ + public function formatHostUsing(Closure $callback) + { + $this->formatHostUsing = $callback; + + return $this; + } + + /** + * Set a callback to be used to format the path of generated URLs. + * + * @param \Closure $callback + * @return $this + */ + public function formatPathUsing(Closure $callback) + { + $this->formatPathUsing = $callback; + + return $this; + } + + /** + * Get the path formatter being used by the URL generator. + * + * @return \Closure + */ + public function pathFormatter() + { + return $this->formatPathUsing ?: function ($path) { + return $path; + }; + } + + /** + * Get the request instance. + * + * @return \Illuminate\Http\Request + */ + public function getRequest() + { + return $this->request; + } + + /** + * Set the current request instance. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + public function setRequest(Request $request) + { + $this->request = $request; + + $this->cachedRoot = null; + $this->cachedScheme = null; + $this->routeGenerator = null; + } + + /** + * Set the route collection. + * + * @param \Illuminate\Routing\RouteCollection $routes + * @return $this + */ + public function setRoutes(RouteCollection $routes) + { + $this->routes = $routes; + + return $this; + } + + /** + * Get the session implementation from the resolver. + * + * @return \Illuminate\Session\Store|null + */ + protected function getSession() + { + if ($this->sessionResolver) { + return call_user_func($this->sessionResolver); + } + } + + /** + * Set the session resolver for the generator. + * + * @param callable $sessionResolver + * @return $this + */ + public function setSessionResolver(callable $sessionResolver) + { + $this->sessionResolver = $sessionResolver; + + return $this; + } + + /** + * Set the encryption key resolver. + * + * @param callable $keyResolver + * @return $this + */ + public function setKeyResolver(callable $keyResolver) + { + $this->keyResolver = $keyResolver; + + return $this; + } + + /** + * Set the root controller namespace. + * + * @param string $rootNamespace + * @return $this + */ + public function setRootControllerNamespace($rootNamespace) + { + $this->rootNamespace = $rootNamespace; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ViewController.php b/vendor/laravel/framework/src/Illuminate/Routing/ViewController.php new file mode 100644 index 00000000..232013f8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/ViewController.php @@ -0,0 +1,39 @@ +view = $view; + } + + /** + * Invoke the controller method. + * + * @param array $args + * @return \Illuminate\Contracts\View\View + */ + public function __invoke(...$args) + { + [$view, $data] = array_slice($args, -2); + + return $this->view->make($view, $data); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/composer.json b/vendor/laravel/framework/src/Illuminate/Routing/composer.json new file mode 100644 index 00000000..026fc965 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/composer.json @@ -0,0 +1,49 @@ +{ + "name": "illuminate/routing", + "description": "The Illuminate Routing package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "ext-json": "*", + "illuminate/container": "^6.0", + "illuminate/contracts": "^6.0", + "illuminate/http": "^6.0", + "illuminate/pipeline": "^6.0", + "illuminate/session": "^6.0", + "illuminate/support": "^6.0", + "symfony/debug": "^4.3.4", + "symfony/http-foundation": "^4.3.4", + "symfony/http-kernel": "^4.3.4", + "symfony/routing": "^4.3.4" + }, + "autoload": { + "psr-4": { + "Illuminate\\Routing\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "suggest": { + "illuminate/console": "Required to use the make commands (^6.0).", + "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^1.2)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php b/vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php new file mode 100755 index 00000000..5f35f757 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php @@ -0,0 +1,94 @@ +cache = $cache; + $this->minutes = $minutes; + } + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } + + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + return $this->cache->get($sessionId, ''); + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + return $this->cache->put($sessionId, $data, $this->minutes * 60); + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + return $this->cache->forget($sessionId); + } + + /** + * {@inheritdoc} + */ + public function gc($lifetime) + { + return true; + } + + /** + * Get the underlying cache repository. + * + * @return \Illuminate\Contracts\Cache\Repository + */ + public function getCache() + { + return $this->cache; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/Console/SessionTableCommand.php b/vendor/laravel/framework/src/Illuminate/Session/Console/SessionTableCommand.php new file mode 100644 index 00000000..1675c19c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/Console/SessionTableCommand.php @@ -0,0 +1,81 @@ +files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $fullPath = $this->createBaseMigration(); + + $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/database.stub')); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the session. + * + * @return string + */ + protected function createBaseMigration() + { + $name = 'create_sessions_table'; + + $path = $this->laravel->databasePath().'/migrations'; + + return $this->laravel['migration.creator']->create($name, $path); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/Console/stubs/database.stub b/vendor/laravel/framework/src/Illuminate/Session/Console/stubs/database.stub new file mode 100755 index 00000000..c7e23cd9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/Console/stubs/database.stub @@ -0,0 +1,35 @@ +string('id')->unique(); + $table->unsignedBigInteger('user_id')->nullable(); + $table->string('ip_address', 45)->nullable(); + $table->text('user_agent')->nullable(); + $table->text('payload'); + $table->integer('last_activity'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('sessions'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php b/vendor/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php new file mode 100755 index 00000000..998b78fa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php @@ -0,0 +1,121 @@ +cookie = $cookie; + $this->minutes = $minutes; + } + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } + + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + $value = $this->request->cookies->get($sessionId) ?: ''; + + if (! is_null($decoded = json_decode($value, true)) && is_array($decoded)) { + if (isset($decoded['expires']) && $this->currentTime() <= $decoded['expires']) { + return $decoded['data']; + } + } + + return ''; + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + $this->cookie->queue($sessionId, json_encode([ + 'data' => $data, + 'expires' => $this->availableAt($this->minutes * 60), + ]), $this->minutes); + + return true; + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + $this->cookie->queue($this->cookie->forget($sessionId)); + + return true; + } + + /** + * {@inheritdoc} + */ + public function gc($lifetime) + { + return true; + } + + /** + * Set the request instance. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return void + */ + public function setRequest(Request $request) + { + $this->request = $request; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php b/vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php new file mode 100644 index 00000000..7781a013 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php @@ -0,0 +1,294 @@ +table = $table; + $this->minutes = $minutes; + $this->container = $container; + $this->connection = $connection; + } + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } + + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + $session = (object) $this->getQuery()->find($sessionId); + + if ($this->expired($session)) { + $this->exists = true; + + return ''; + } + + if (isset($session->payload)) { + $this->exists = true; + + return base64_decode($session->payload); + } + + return ''; + } + + /** + * Determine if the session is expired. + * + * @param \stdClass $session + * @return bool + */ + protected function expired($session) + { + return isset($session->last_activity) && + $session->last_activity < Carbon::now()->subMinutes($this->minutes)->getTimestamp(); + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + $payload = $this->getDefaultPayload($data); + + if (! $this->exists) { + $this->read($sessionId); + } + + if ($this->exists) { + $this->performUpdate($sessionId, $payload); + } else { + $this->performInsert($sessionId, $payload); + } + + return $this->exists = true; + } + + /** + * Perform an insert operation on the session ID. + * + * @param string $sessionId + * @param string $payload + * @return bool|null + */ + protected function performInsert($sessionId, $payload) + { + try { + return $this->getQuery()->insert(Arr::set($payload, 'id', $sessionId)); + } catch (QueryException $e) { + $this->performUpdate($sessionId, $payload); + } + } + + /** + * Perform an update operation on the session ID. + * + * @param string $sessionId + * @param string $payload + * @return int + */ + protected function performUpdate($sessionId, $payload) + { + return $this->getQuery()->where('id', $sessionId)->update($payload); + } + + /** + * Get the default payload for the session. + * + * @param string $data + * @return array + */ + protected function getDefaultPayload($data) + { + $payload = [ + 'payload' => base64_encode($data), + 'last_activity' => $this->currentTime(), + ]; + + if (! $this->container) { + return $payload; + } + + return tap($payload, function (&$payload) { + $this->addUserInformation($payload) + ->addRequestInformation($payload); + }); + } + + /** + * Add the user information to the session payload. + * + * @param array $payload + * @return $this + */ + protected function addUserInformation(&$payload) + { + if ($this->container->bound(Guard::class)) { + $payload['user_id'] = $this->userId(); + } + + return $this; + } + + /** + * Get the currently authenticated user's ID. + * + * @return mixed + */ + protected function userId() + { + return $this->container->make(Guard::class)->id(); + } + + /** + * Add the request information to the session payload. + * + * @param array $payload + * @return $this + */ + protected function addRequestInformation(&$payload) + { + if ($this->container->bound('request')) { + $payload = array_merge($payload, [ + 'ip_address' => $this->ipAddress(), + 'user_agent' => $this->userAgent(), + ]); + } + + return $this; + } + + /** + * Get the IP address for the current request. + * + * @return string + */ + protected function ipAddress() + { + return $this->container->make('request')->ip(); + } + + /** + * Get the user agent for the current request. + * + * @return string + */ + protected function userAgent() + { + return substr((string) $this->container->make('request')->header('User-Agent'), 0, 500); + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + $this->getQuery()->where('id', $sessionId)->delete(); + + return true; + } + + /** + * {@inheritdoc} + */ + public function gc($lifetime) + { + $this->getQuery()->where('last_activity', '<=', $this->currentTime() - $lifetime)->delete(); + } + + /** + * Get a fresh query builder instance for the table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function getQuery() + { + return $this->connection->table($this->table); + } + + /** + * Set the existence state for the session. + * + * @param bool $value + * @return $this + */ + public function setExists($value) + { + $this->exists = $value; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php b/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php new file mode 100644 index 00000000..106fe135 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php @@ -0,0 +1,69 @@ +encrypter = $encrypter; + + parent::__construct($name, $handler, $id); + } + + /** + * Prepare the raw string data from the session for unserialization. + * + * @param string $data + * @return string + */ + protected function prepareForUnserialize($data) + { + try { + return $this->encrypter->decrypt($data); + } catch (DecryptException $e) { + return serialize([]); + } + } + + /** + * Prepare the serialized session data for storage. + * + * @param string $data + * @return string + */ + protected function prepareForStorage($data) + { + return $this->encrypter->encrypt($data); + } + + /** + * Get the encrypter instance. + * + * @return \Illuminate\Contracts\Encryption\Encrypter + */ + public function getEncrypter() + { + return $this->encrypter; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/ExistenceAwareInterface.php b/vendor/laravel/framework/src/Illuminate/Session/ExistenceAwareInterface.php new file mode 100644 index 00000000..4a6bd984 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/ExistenceAwareInterface.php @@ -0,0 +1,14 @@ +path = $path; + $this->files = $files; + $this->minutes = $minutes; + } + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } + + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + if ($this->files->isFile($path = $this->path.'/'.$sessionId)) { + if ($this->files->lastModified($path) >= Carbon::now()->subMinutes($this->minutes)->getTimestamp()) { + return $this->files->sharedGet($path); + } + } + + return ''; + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + $this->files->put($this->path.'/'.$sessionId, $data, true); + + return true; + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + $this->files->delete($this->path.'/'.$sessionId); + + return true; + } + + /** + * {@inheritdoc} + */ + public function gc($lifetime) + { + $files = Finder::create() + ->in($this->path) + ->files() + ->ignoreDotFiles(true) + ->date('<= now - '.$lifetime.' seconds'); + + foreach ($files as $file) { + $this->files->delete($file->getRealPath()); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Session/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php b/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php new file mode 100644 index 00000000..5da389ae --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php @@ -0,0 +1,96 @@ +auth = $auth; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + if (! $request->hasSession() || ! $request->user()) { + return $next($request); + } + + if ($this->auth->viaRemember()) { + $passwordHash = explode('|', $request->cookies->get($this->auth->getRecallerName()))[2] ?? null; + + if (! $passwordHash || $passwordHash != $request->user()->getAuthPassword()) { + $this->logout($request); + } + } + + if (! $request->session()->has('password_hash')) { + $this->storePasswordHashInSession($request); + } + + if ($request->session()->get('password_hash') !== $request->user()->getAuthPassword()) { + $this->logout($request); + } + + return tap($next($request), function () use ($request) { + $this->storePasswordHashInSession($request); + }); + } + + /** + * Store the user's current password hash in the session. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function storePasswordHashInSession($request) + { + if (! $request->user()) { + return; + } + + $request->session()->put([ + 'password_hash' => $request->user()->getAuthPassword(), + ]); + } + + /** + * Log the user out of the application. + * + * @param \Illuminate\Http\Request $request + * @return void + * + * @throws \Illuminate\Auth\AuthenticationException + */ + protected function logout($request) + { + $this->auth->logoutCurrentDevice(); + + $request->session()->flush(); + + throw new AuthenticationException; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php b/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php new file mode 100644 index 00000000..31e48c17 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php @@ -0,0 +1,219 @@ +manager = $manager; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + if (! $this->sessionConfigured()) { + return $next($request); + } + + // If a session driver has been configured, we will need to start the session here + // so that the data is ready for an application. Note that the Laravel sessions + // do not make use of PHP "native" sessions in any way since they are crappy. + $request->setLaravelSession( + $session = $this->startSession($request) + ); + + $this->collectGarbage($session); + + $response = $next($request); + + $this->storeCurrentUrl($request, $session); + + $this->addCookieToResponse($response, $session); + + // Again, if the session has been configured we will need to close out the session + // so that the attributes may be persisted to some storage medium. We will also + // add the session identifier cookie to the application response headers now. + $this->saveSession($request); + + return $response; + } + + /** + * Start the session for the given request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Contracts\Session\Session + */ + protected function startSession(Request $request) + { + return tap($this->getSession($request), function ($session) use ($request) { + $session->setRequestOnHandler($request); + + $session->start(); + }); + } + + /** + * Get the session implementation from the manager. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Contracts\Session\Session + */ + public function getSession(Request $request) + { + return tap($this->manager->driver(), function ($session) use ($request) { + $session->setId($request->cookies->get($session->getName())); + }); + } + + /** + * Remove the garbage from the session if necessary. + * + * @param \Illuminate\Contracts\Session\Session $session + * @return void + */ + protected function collectGarbage(Session $session) + { + $config = $this->manager->getSessionConfig(); + + // Here we will see if this request hits the garbage collection lottery by hitting + // the odds needed to perform garbage collection on any given request. If we do + // hit it, we'll call this handler to let it delete all the expired sessions. + if ($this->configHitsLottery($config)) { + $session->getHandler()->gc($this->getSessionLifetimeInSeconds()); + } + } + + /** + * Determine if the configuration odds hit the lottery. + * + * @param array $config + * @return bool + */ + protected function configHitsLottery(array $config) + { + return random_int(1, $config['lottery'][1]) <= $config['lottery'][0]; + } + + /** + * Store the current URL for the request if necessary. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Contracts\Session\Session $session + * @return void + */ + protected function storeCurrentUrl(Request $request, $session) + { + if ($request->method() === 'GET' && + $request->route() && + ! $request->ajax() && + ! $request->prefetch()) { + $session->setPreviousUrl($request->fullUrl()); + } + } + + /** + * Add the session cookie to the application response. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @param \Illuminate\Contracts\Session\Session $session + * @return void + */ + protected function addCookieToResponse(Response $response, Session $session) + { + if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) { + $response->headers->setCookie(new Cookie( + $session->getName(), $session->getId(), $this->getCookieExpirationDate(), + $config['path'], $config['domain'], $config['secure'] ?? false, + $config['http_only'] ?? true, false, $config['same_site'] ?? null + )); + } + } + + /** + * Save the session data to storage. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function saveSession($request) + { + $this->manager->driver()->save(); + } + + /** + * Get the session lifetime in seconds. + * + * @return int + */ + protected function getSessionLifetimeInSeconds() + { + return ($this->manager->getSessionConfig()['lifetime'] ?? null) * 60; + } + + /** + * Get the cookie lifetime in seconds. + * + * @return \DateTimeInterface|int + */ + protected function getCookieExpirationDate() + { + $config = $this->manager->getSessionConfig(); + + return $config['expire_on_close'] ? 0 : Date::instance( + Carbon::now()->addRealMinutes($config['lifetime']) + ); + } + + /** + * Determine if a session driver has been configured. + * + * @return bool + */ + protected function sessionConfigured() + { + return ! is_null($this->manager->getSessionConfig()['driver'] ?? null); + } + + /** + * Determine if the configured session driver is persistent. + * + * @param array|null $config + * @return bool + */ + protected function sessionIsPersistent(array $config = null) + { + $config = $config ?: $this->manager->getSessionConfig(); + + return ! in_array($config['driver'], [null, 'array']); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/NullSessionHandler.php b/vendor/laravel/framework/src/Illuminate/Session/NullSessionHandler.php new file mode 100644 index 00000000..56f567e7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/NullSessionHandler.php @@ -0,0 +1,56 @@ +buildSession(parent::callCustomCreator($driver)); + } + + /** + * Create an instance of the "array" session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createArrayDriver() + { + return $this->buildSession(new NullSessionHandler); + } + + /** + * Create an instance of the "cookie" session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createCookieDriver() + { + return $this->buildSession(new CookieSessionHandler( + $this->container->make('cookie'), $this->config->get('session.lifetime') + )); + } + + /** + * Create an instance of the file session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createFileDriver() + { + return $this->createNativeDriver(); + } + + /** + * Create an instance of the file session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createNativeDriver() + { + $lifetime = $this->config->get('session.lifetime'); + + return $this->buildSession(new FileSessionHandler( + $this->container->make('files'), $this->config->get('session.files'), $lifetime + )); + } + + /** + * Create an instance of the database session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createDatabaseDriver() + { + $table = $this->config->get('session.table'); + + $lifetime = $this->config->get('session.lifetime'); + + return $this->buildSession(new DatabaseSessionHandler( + $this->getDatabaseConnection(), $table, $lifetime, $this->container + )); + } + + /** + * Get the database connection for the database driver. + * + * @return \Illuminate\Database\Connection + */ + protected function getDatabaseConnection() + { + $connection = $this->config->get('session.connection'); + + return $this->container->make('db')->connection($connection); + } + + /** + * Create an instance of the APC session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createApcDriver() + { + return $this->createCacheBased('apc'); + } + + /** + * Create an instance of the Memcached session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createMemcachedDriver() + { + return $this->createCacheBased('memcached'); + } + + /** + * Create an instance of the Redis session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createRedisDriver() + { + $handler = $this->createCacheHandler('redis'); + + $handler->getCache()->getStore()->setConnection( + $this->config->get('session.connection') + ); + + return $this->buildSession($handler); + } + + /** + * Create an instance of the DynamoDB session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createDynamodbDriver() + { + return $this->createCacheBased('dynamodb'); + } + + /** + * Create an instance of a cache driven driver. + * + * @param string $driver + * @return \Illuminate\Session\Store + */ + protected function createCacheBased($driver) + { + return $this->buildSession($this->createCacheHandler($driver)); + } + + /** + * Create the cache based session handler instance. + * + * @param string $driver + * @return \Illuminate\Session\CacheBasedSessionHandler + */ + protected function createCacheHandler($driver) + { + $store = $this->config->get('session.store') ?: $driver; + + return new CacheBasedSessionHandler( + clone $this->container->make('cache')->store($store), + $this->config->get('session.lifetime') + ); + } + + /** + * Build the session instance. + * + * @param \SessionHandlerInterface $handler + * @return \Illuminate\Session\Store + */ + protected function buildSession($handler) + { + return $this->config->get('session.encrypt') + ? $this->buildEncryptedSession($handler) + : new Store($this->config->get('session.cookie'), $handler); + } + + /** + * Build the encrypted session instance. + * + * @param \SessionHandlerInterface $handler + * @return \Illuminate\Session\EncryptedStore + */ + protected function buildEncryptedSession($handler) + { + return new EncryptedStore( + $this->config->get('session.cookie'), $handler, $this->container['encrypter'] + ); + } + + /** + * Get the session configuration. + * + * @return array + */ + public function getSessionConfig() + { + return $this->config->get('session'); + } + + /** + * Get the default session driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->config->get('session.driver'); + } + + /** + * Set the default session driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->config->set('session.driver', $name); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php new file mode 100755 index 00000000..02363e3b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php @@ -0,0 +1,50 @@ +registerSessionManager(); + + $this->registerSessionDriver(); + + $this->app->singleton(StartSession::class); + } + + /** + * Register the session manager instance. + * + * @return void + */ + protected function registerSessionManager() + { + $this->app->singleton('session', function ($app) { + return new SessionManager($app); + }); + } + + /** + * Register the session driver instance. + * + * @return void + */ + protected function registerSessionDriver() + { + $this->app->singleton('session.store', function ($app) { + // First, we will create the session manager which is responsible for the + // creation of the various session drivers when they are needed by the + // application instance, and will resolve them on a lazy load basis. + return $app->make('session')->driver(); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/Store.php b/vendor/laravel/framework/src/Illuminate/Session/Store.php new file mode 100755 index 00000000..7251d259 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/Store.php @@ -0,0 +1,672 @@ +setId($id); + $this->name = $name; + $this->handler = $handler; + } + + /** + * Start the session, reading the data from a handler. + * + * @return bool + */ + public function start() + { + $this->loadSession(); + + if (! $this->has('_token')) { + $this->regenerateToken(); + } + + return $this->started = true; + } + + /** + * Load the session data from the handler. + * + * @return void + */ + protected function loadSession() + { + $this->attributes = array_merge($this->attributes, $this->readFromHandler()); + } + + /** + * Read the session data from the handler. + * + * @return array + */ + protected function readFromHandler() + { + if ($data = $this->handler->read($this->getId())) { + $data = @unserialize($this->prepareForUnserialize($data)); + + if ($data !== false && ! is_null($data) && is_array($data)) { + return $data; + } + } + + return []; + } + + /** + * Prepare the raw string data from the session for unserialization. + * + * @param string $data + * @return string + */ + protected function prepareForUnserialize($data) + { + return $data; + } + + /** + * Save the session data to storage. + * + * @return void + */ + public function save() + { + $this->ageFlashData(); + + $this->handler->write($this->getId(), $this->prepareForStorage( + serialize($this->attributes) + )); + + $this->started = false; + } + + /** + * Prepare the serialized session data for storage. + * + * @param string $data + * @return string + */ + protected function prepareForStorage($data) + { + return $data; + } + + /** + * Age the flash data for the session. + * + * @return void + */ + public function ageFlashData() + { + $this->forget($this->get('_flash.old', [])); + + $this->put('_flash.old', $this->get('_flash.new', [])); + + $this->put('_flash.new', []); + } + + /** + * Get all of the session data. + * + * @return array + */ + public function all() + { + return $this->attributes; + } + + /** + * Get a subset of the session data. + * + * @param array $keys + * @return array + */ + public function only(array $keys) + { + return Arr::only($this->attributes, $keys); + } + + /** + * Checks if a key exists. + * + * @param string|array $key + * @return bool + */ + public function exists($key) + { + $placeholder = new stdClass; + + return ! collect(is_array($key) ? $key : func_get_args())->contains(function ($key) use ($placeholder) { + return $this->get($key, $placeholder) === $placeholder; + }); + } + + /** + * Checks if a key is present and not null. + * + * @param string|array $key + * @return bool + */ + public function has($key) + { + return ! collect(is_array($key) ? $key : func_get_args())->contains(function ($key) { + return is_null($this->get($key)); + }); + } + + /** + * Get an item from the session. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + return Arr::get($this->attributes, $key, $default); + } + + /** + * Get the value of a given key and then forget it. + * + * @param string $key + * @param string|null $default + * @return mixed + */ + public function pull($key, $default = null) + { + return Arr::pull($this->attributes, $key, $default); + } + + /** + * Determine if the session contains old input. + * + * @param string|null $key + * @return bool + */ + public function hasOldInput($key = null) + { + $old = $this->getOldInput($key); + + return is_null($key) ? count($old) > 0 : ! is_null($old); + } + + /** + * Get the requested item from the flashed input array. + * + * @param string|null $key + * @param mixed $default + * @return mixed + */ + public function getOldInput($key = null, $default = null) + { + return Arr::get($this->get('_old_input', []), $key, $default); + } + + /** + * Replace the given session attributes entirely. + * + * @param array $attributes + * @return void + */ + public function replace(array $attributes) + { + $this->put($attributes); + } + + /** + * Put a key / value pair or array of key / value pairs in the session. + * + * @param string|array $key + * @param mixed $value + * @return void + */ + public function put($key, $value = null) + { + if (! is_array($key)) { + $key = [$key => $value]; + } + + foreach ($key as $arrayKey => $arrayValue) { + Arr::set($this->attributes, $arrayKey, $arrayValue); + } + } + + /** + * Get an item from the session, or store the default value. + * + * @param string $key + * @param \Closure $callback + * @return mixed + */ + public function remember($key, Closure $callback) + { + if (! is_null($value = $this->get($key))) { + return $value; + } + + return tap($callback(), function ($value) use ($key) { + $this->put($key, $value); + }); + } + + /** + * Push a value onto a session array. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function push($key, $value) + { + $array = $this->get($key, []); + + $array[] = $value; + + $this->put($key, $array); + } + + /** + * Increment the value of an item in the session. + * + * @param string $key + * @param int $amount + * @return mixed + */ + public function increment($key, $amount = 1) + { + $this->put($key, $value = $this->get($key, 0) + $amount); + + return $value; + } + + /** + * Decrement the value of an item in the session. + * + * @param string $key + * @param int $amount + * @return int + */ + public function decrement($key, $amount = 1) + { + return $this->increment($key, $amount * -1); + } + + /** + * Flash a key / value pair to the session. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function flash(string $key, $value = true) + { + $this->put($key, $value); + + $this->push('_flash.new', $key); + + $this->removeFromOldFlashData([$key]); + } + + /** + * Flash a key / value pair to the session for immediate use. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function now($key, $value) + { + $this->put($key, $value); + + $this->push('_flash.old', $key); + } + + /** + * Reflash all of the session flash data. + * + * @return void + */ + public function reflash() + { + $this->mergeNewFlashes($this->get('_flash.old', [])); + + $this->put('_flash.old', []); + } + + /** + * Reflash a subset of the current flash data. + * + * @param array|mixed $keys + * @return void + */ + public function keep($keys = null) + { + $this->mergeNewFlashes($keys = is_array($keys) ? $keys : func_get_args()); + + $this->removeFromOldFlashData($keys); + } + + /** + * Merge new flash keys into the new flash array. + * + * @param array $keys + * @return void + */ + protected function mergeNewFlashes(array $keys) + { + $values = array_unique(array_merge($this->get('_flash.new', []), $keys)); + + $this->put('_flash.new', $values); + } + + /** + * Remove the given keys from the old flash data. + * + * @param array $keys + * @return void + */ + protected function removeFromOldFlashData(array $keys) + { + $this->put('_flash.old', array_diff($this->get('_flash.old', []), $keys)); + } + + /** + * Flash an input array to the session. + * + * @param array $value + * @return void + */ + public function flashInput(array $value) + { + $this->flash('_old_input', $value); + } + + /** + * Remove an item from the session, returning its value. + * + * @param string $key + * @return mixed + */ + public function remove($key) + { + return Arr::pull($this->attributes, $key); + } + + /** + * Remove one or many items from the session. + * + * @param string|array $keys + * @return void + */ + public function forget($keys) + { + Arr::forget($this->attributes, $keys); + } + + /** + * Remove all of the items from the session. + * + * @return void + */ + public function flush() + { + $this->attributes = []; + } + + /** + * Flush the session data and regenerate the ID. + * + * @return bool + */ + public function invalidate() + { + $this->flush(); + + return $this->migrate(true); + } + + /** + * Generate a new session identifier. + * + * @param bool $destroy + * @return bool + */ + public function regenerate($destroy = false) + { + return tap($this->migrate($destroy), function () { + $this->regenerateToken(); + }); + } + + /** + * Generate a new session ID for the session. + * + * @param bool $destroy + * @return bool + */ + public function migrate($destroy = false) + { + if ($destroy) { + $this->handler->destroy($this->getId()); + } + + $this->setExists(false); + + $this->setId($this->generateSessionId()); + + return true; + } + + /** + * Determine if the session has been started. + * + * @return bool + */ + public function isStarted() + { + return $this->started; + } + + /** + * Get the name of the session. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set the name of the session. + * + * @param string $name + * @return void + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Get the current session ID. + * + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Set the session ID. + * + * @param string $id + * @return void + */ + public function setId($id) + { + $this->id = $this->isValidId($id) ? $id : $this->generateSessionId(); + } + + /** + * Determine if this is a valid session ID. + * + * @param string $id + * @return bool + */ + public function isValidId($id) + { + return is_string($id) && ctype_alnum($id) && strlen($id) === 40; + } + + /** + * Get a new, random session ID. + * + * @return string + */ + protected function generateSessionId() + { + return Str::random(40); + } + + /** + * Set the existence of the session on the handler if applicable. + * + * @param bool $value + * @return void + */ + public function setExists($value) + { + if ($this->handler instanceof ExistenceAwareInterface) { + $this->handler->setExists($value); + } + } + + /** + * Get the CSRF token value. + * + * @return string + */ + public function token() + { + return $this->get('_token'); + } + + /** + * Regenerate the CSRF token value. + * + * @return void + */ + public function regenerateToken() + { + $this->put('_token', Str::random(40)); + } + + /** + * Get the previous URL from the session. + * + * @return string|null + */ + public function previousUrl() + { + return $this->get('_previous.url'); + } + + /** + * Set the "previous" URL in the session. + * + * @param string $url + * @return void + */ + public function setPreviousUrl($url) + { + $this->put('_previous.url', $url); + } + + /** + * Get the underlying session handler implementation. + * + * @return \SessionHandlerInterface + */ + public function getHandler() + { + return $this->handler; + } + + /** + * Determine if the session handler needs a request. + * + * @return bool + */ + public function handlerNeedsRequest() + { + return $this->handler instanceof CookieSessionHandler; + } + + /** + * Set the request on the handler instance. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + public function setRequestOnHandler($request) + { + if ($this->handlerNeedsRequest()) { + $this->handler->setRequest($request); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/TokenMismatchException.php b/vendor/laravel/framework/src/Illuminate/Session/TokenMismatchException.php new file mode 100755 index 00000000..98d99a1e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/TokenMismatchException.php @@ -0,0 +1,10 @@ +instances = []; + + foreach ($this->providers as $provider) { + $this->instances[] = $this->app->register($provider); + } + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + $provides = []; + + foreach ($this->providers as $provider) { + $instance = $this->app->resolveProvider($provider); + + $provides = array_merge($provides, $instance->provides()); + } + + return $provides; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Arr.php b/vendor/laravel/framework/src/Illuminate/Support/Arr.php new file mode 100755 index 00000000..bf30467d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Arr.php @@ -0,0 +1,660 @@ +all(); + } elseif (! is_array($values)) { + continue; + } + + $results[] = $values; + } + + return array_merge([], ...$results); + } + + /** + * Cross join the given arrays, returning all possible permutations. + * + * @param iterable ...$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 iterable $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 iterable $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 ($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 iterable $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; + } else { + $values = $depth === 1 + ? array_values($item) + : static::flatten($item, $depth - 1); + + foreach ($values as $value) { + $result[] = $value; + } + } + } + + 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|int|null $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; + } + + /** + * Determine if any of the keys exist in an array using "dot" notation. + * + * @param \ArrayAccess|array $array + * @param string|array $keys + * @return bool + */ + public static function hasAny($array, $keys) + { + if (is_null($keys)) { + return false; + } + + $keys = (array) $keys; + + if (! $array) { + return false; + } + + if ($keys === []) { + return false; + } + + foreach ($keys as $key) { + if (static::has($array, $key)) { + return true; + } + } + + return false; + } + + /** + * 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 iterable $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 { + mt_srand($seed); + shuffle($array); + mt_srand(); + } + + 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)->sortBy($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, '', '&', 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]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Carbon.php b/vendor/laravel/framework/src/Illuminate/Support/Carbon.php new file mode 100644 index 00000000..9383c3fd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Carbon.php @@ -0,0 +1,10 @@ +items = $this->getArrayableItems($items); + } + + /** + * Create a new collection by invoking the callback a given amount of times. + * + * @param int $number + * @param callable $callback + * @return static + */ + public static function times($number, callable $callback = null) + { + if ($number < 1) { + return new static; + } + + if (is_null($callback)) { + return new static(range(1, $number)); + } + + return (new static(range(1, $number)))->map($callback); + } + + /** + * Get all of the items in the collection. + * + * @return array + */ + public function all() + { + return $this->items; + } + + /** + * Get a lazy collection for the items in this collection. + * + * @return \Illuminate\Support\LazyCollection + */ + public function lazy() + { + return new LazyCollection($this->items); + } + + /** + * Get the average value of a given key. + * + * @param callable|string|null $callback + * @return mixed + */ + public function avg($callback = null) + { + $callback = $this->valueRetriever($callback); + + $items = $this->map(function ($value) use ($callback) { + return $callback($value); + })->filter(function ($value) { + return ! is_null($value); + }); + + if ($count = $items->count()) { + return $items->sum() / $count; + } + } + + /** + * Get the median of a given key. + * + * @param string|array|null $key + * @return mixed + */ + public function median($key = null) + { + $values = (isset($key) ? $this->pluck($key) : $this) + ->filter(function ($item) { + return ! is_null($item); + })->sort()->values(); + + $count = $values->count(); + + if ($count === 0) { + return; + } + + $middle = (int) ($count / 2); + + if ($count % 2) { + return $values->get($middle); + } + + return (new static([ + $values->get($middle - 1), $values->get($middle), + ]))->average(); + } + + /** + * Get the mode of a given key. + * + * @param string|array|null $key + * @return array|null + */ + public function mode($key = null) + { + if ($this->count() === 0) { + return; + } + + $collection = isset($key) ? $this->pluck($key) : $this; + + $counts = new self; + + $collection->each(function ($value) use ($counts) { + $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1; + }); + + $sorted = $counts->sort(); + + $highestValue = $sorted->last(); + + return $sorted->filter(function ($value) use ($highestValue) { + return $value == $highestValue; + })->sort()->keys()->all(); + } + + /** + * Collapse the collection of items into a single array. + * + * @return static + */ + public function collapse() + { + return new static(Arr::collapse($this->items)); + } + + /** + * Determine if an item exists in the collection. + * + * @param mixed $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function contains($key, $operator = null, $value = null) + { + if (func_num_args() === 1) { + if ($this->useAsCallable($key)) { + $placeholder = new stdClass; + + return $this->first($key, $placeholder) !== $placeholder; + } + + return in_array($key, $this->items); + } + + return $this->contains($this->operatorForWhere(...func_get_args())); + } + + /** + * Cross join with the given lists, returning all possible permutations. + * + * @param mixed ...$lists + * @return static + */ + public function crossJoin(...$lists) + { + return new static(Arr::crossJoin( + $this->items, ...array_map([$this, 'getArrayableItems'], $lists) + )); + } + + /** + * Get the items in the collection that are not present in the given items. + * + * @param mixed $items + * @return static + */ + public function diff($items) + { + return new static(array_diff($this->items, $this->getArrayableItems($items))); + } + + /** + * Get the items in the collection that are not present in the given items, using the callback. + * + * @param mixed $items + * @param callable $callback + * @return static + */ + public function diffUsing($items, callable $callback) + { + return new static(array_udiff($this->items, $this->getArrayableItems($items), $callback)); + } + + /** + * Get the items in the collection whose keys and values are not present in the given items. + * + * @param mixed $items + * @return static + */ + public function diffAssoc($items) + { + return new static(array_diff_assoc($this->items, $this->getArrayableItems($items))); + } + + /** + * Get the items in the collection whose keys and values are not present in the given items, using the callback. + * + * @param mixed $items + * @param callable $callback + * @return static + */ + public function diffAssocUsing($items, callable $callback) + { + return new static(array_diff_uassoc($this->items, $this->getArrayableItems($items), $callback)); + } + + /** + * Get the items in the collection whose keys are not present in the given items. + * + * @param mixed $items + * @return static + */ + public function diffKeys($items) + { + return new static(array_diff_key($this->items, $this->getArrayableItems($items))); + } + + /** + * Get the items in the collection whose keys are not present in the given items, using the callback. + * + * @param mixed $items + * @param callable $callback + * @return static + */ + public function diffKeysUsing($items, callable $callback) + { + return new static(array_diff_ukey($this->items, $this->getArrayableItems($items), $callback)); + } + + /** + * Retrieve duplicate items from the collection. + * + * @param callable|null $callback + * @param bool $strict + * @return static + */ + public function duplicates($callback = null, $strict = false) + { + $items = $this->map($this->valueRetriever($callback)); + + $uniqueItems = $items->unique(null, $strict); + + $compare = $this->duplicateComparator($strict); + + $duplicates = new static; + + foreach ($items as $key => $value) { + if ($uniqueItems->isNotEmpty() && $compare($value, $uniqueItems->first())) { + $uniqueItems->shift(); + } else { + $duplicates[$key] = $value; + } + } + + return $duplicates; + } + + /** + * Retrieve duplicate items from the collection using strict comparison. + * + * @param callable|null $callback + * @return static + */ + public function duplicatesStrict($callback = null) + { + return $this->duplicates($callback, true); + } + + /** + * Get the comparison function to detect duplicates. + * + * @param bool $strict + * @return \Closure + */ + protected function duplicateComparator($strict) + { + if ($strict) { + return function ($a, $b) { + return $a === $b; + }; + } + + return function ($a, $b) { + return $a == $b; + }; + } + + /** + * Get all items except for those with the specified keys. + * + * @param \Illuminate\Support\Collection|mixed $keys + * @return static + */ + public function except($keys) + { + if ($keys instanceof Enumerable) { + $keys = $keys->all(); + } elseif (! is_array($keys)) { + $keys = func_get_args(); + } + + return new static(Arr::except($this->items, $keys)); + } + + /** + * Run a filter over each of the items. + * + * @param callable|null $callback + * @return static + */ + public function filter(callable $callback = null) + { + if ($callback) { + return new static(Arr::where($this->items, $callback)); + } + + return new static(array_filter($this->items)); + } + + /** + * Get the first item from the collection passing the given truth test. + * + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + public function first(callable $callback = null, $default = null) + { + return Arr::first($this->items, $callback, $default); + } + + /** + * Get a flattened array of the items in the collection. + * + * @param int $depth + * @return static + */ + public function flatten($depth = INF) + { + return new static(Arr::flatten($this->items, $depth)); + } + + /** + * Flip the items in the collection. + * + * @return static + */ + public function flip() + { + return new static(array_flip($this->items)); + } + + /** + * Remove an item from the collection by key. + * + * @param string|array $keys + * @return $this + */ + public function forget($keys) + { + foreach ((array) $keys as $key) { + $this->offsetUnset($key); + } + + return $this; + } + + /** + * Get an item from the collection by key. + * + * @param mixed $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + if ($this->offsetExists($key)) { + return $this->items[$key]; + } + + return value($default); + } + + /** + * Group an associative array by a field or using a callback. + * + * @param array|callable|string $groupBy + * @param bool $preserveKeys + * @return static + */ + public function groupBy($groupBy, $preserveKeys = false) + { + if (! $this->useAsCallable($groupBy) && is_array($groupBy)) { + $nextGroups = $groupBy; + + $groupBy = array_shift($nextGroups); + } + + $groupBy = $this->valueRetriever($groupBy); + + $results = []; + + foreach ($this->items as $key => $value) { + $groupKeys = $groupBy($value, $key); + + if (! is_array($groupKeys)) { + $groupKeys = [$groupKeys]; + } + + foreach ($groupKeys as $groupKey) { + $groupKey = is_bool($groupKey) ? (int) $groupKey : $groupKey; + + if (! array_key_exists($groupKey, $results)) { + $results[$groupKey] = new static; + } + + $results[$groupKey]->offsetSet($preserveKeys ? $key : null, $value); + } + } + + $result = new static($results); + + if (! empty($nextGroups)) { + return $result->map->groupBy($nextGroups, $preserveKeys); + } + + return $result; + } + + /** + * Key an associative array by a field or using a callback. + * + * @param callable|string $keyBy + * @return static + */ + public function keyBy($keyBy) + { + $keyBy = $this->valueRetriever($keyBy); + + $results = []; + + foreach ($this->items as $key => $item) { + $resolvedKey = $keyBy($item, $key); + + if (is_object($resolvedKey)) { + $resolvedKey = (string) $resolvedKey; + } + + $results[$resolvedKey] = $item; + } + + return new static($results); + } + + /** + * Determine if an item exists in the collection by key. + * + * @param mixed $key + * @return bool + */ + public function has($key) + { + $keys = is_array($key) ? $key : func_get_args(); + + foreach ($keys as $value) { + if (! $this->offsetExists($value)) { + return false; + } + } + + return true; + } + + /** + * Concatenate values of a given key as a string. + * + * @param string $value + * @param string $glue + * @return string + */ + public function implode($value, $glue = null) + { + $first = $this->first(); + + if (is_array($first) || is_object($first)) { + return implode($glue, $this->pluck($value)->all()); + } + + return implode($value, $this->items); + } + + /** + * Intersect the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function intersect($items) + { + return new static(array_intersect($this->items, $this->getArrayableItems($items))); + } + + /** + * Intersect the collection with the given items by key. + * + * @param mixed $items + * @return static + */ + public function intersectByKeys($items) + { + return new static(array_intersect_key( + $this->items, $this->getArrayableItems($items) + )); + } + + /** + * Determine if the collection is empty or not. + * + * @return bool + */ + public function isEmpty() + { + return empty($this->items); + } + + /** + * Join all items from the collection using a string. The final items can use a separate glue string. + * + * @param string $glue + * @param string $finalGlue + * @return string + */ + public function join($glue, $finalGlue = '') + { + if ($finalGlue === '') { + return $this->implode($glue); + } + + $count = $this->count(); + + if ($count === 0) { + return ''; + } + + if ($count === 1) { + return $this->last(); + } + + $collection = new static($this->items); + + $finalItem = $collection->pop(); + + return $collection->implode($glue).$finalGlue.$finalItem; + } + + /** + * Get the keys of the collection items. + * + * @return static + */ + public function keys() + { + return new static(array_keys($this->items)); + } + + /** + * Get the last item from the collection. + * + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + public function last(callable $callback = null, $default = null) + { + return Arr::last($this->items, $callback, $default); + } + + /** + * Get the values of a given key. + * + * @param string|array $value + * @param string|null $key + * @return static + */ + public function pluck($value, $key = null) + { + return new static(Arr::pluck($this->items, $value, $key)); + } + + /** + * Run a map over each of the items. + * + * @param callable $callback + * @return static + */ + public function map(callable $callback) + { + $keys = array_keys($this->items); + + $items = array_map($callback, $this->items, $keys); + + return new static(array_combine($keys, $items)); + } + + /** + * Run a dictionary map over the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @param callable $callback + * @return static + */ + public function mapToDictionary(callable $callback) + { + $dictionary = []; + + foreach ($this->items as $key => $item) { + $pair = $callback($item, $key); + + $key = key($pair); + + $value = reset($pair); + + if (! isset($dictionary[$key])) { + $dictionary[$key] = []; + } + + $dictionary[$key][] = $value; + } + + return new static($dictionary); + } + + /** + * Run an associative map over each of the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @param callable $callback + * @return static + */ + public function mapWithKeys(callable $callback) + { + $result = []; + + foreach ($this->items as $key => $value) { + $assoc = $callback($value, $key); + + foreach ($assoc as $mapKey => $mapValue) { + $result[$mapKey] = $mapValue; + } + } + + return new static($result); + } + + /** + * Merge the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function merge($items) + { + return new static(array_merge($this->items, $this->getArrayableItems($items))); + } + + /** + * Recursively merge the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function mergeRecursive($items) + { + return new static(array_merge_recursive($this->items, $this->getArrayableItems($items))); + } + + /** + * Create a collection by using this collection for keys and another for its values. + * + * @param mixed $values + * @return static + */ + public function combine($values) + { + return new static(array_combine($this->all(), $this->getArrayableItems($values))); + } + + /** + * Union the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function union($items) + { + return new static($this->items + $this->getArrayableItems($items)); + } + + /** + * Create a new collection consisting of every n-th element. + * + * @param int $step + * @param int $offset + * @return static + */ + public function nth($step, $offset = 0) + { + $new = []; + + $position = 0; + + foreach ($this->items as $item) { + if ($position % $step === $offset) { + $new[] = $item; + } + + $position++; + } + + return new static($new); + } + + /** + * Get the items with the specified keys. + * + * @param mixed $keys + * @return static + */ + public function only($keys) + { + if (is_null($keys)) { + return new static($this->items); + } + + if ($keys instanceof Enumerable) { + $keys = $keys->all(); + } + + $keys = is_array($keys) ? $keys : func_get_args(); + + return new static(Arr::only($this->items, $keys)); + } + + /** + * Get and remove the last item from the collection. + * + * @return mixed + */ + public function pop() + { + return array_pop($this->items); + } + + /** + * Push an item onto the beginning of the collection. + * + * @param mixed $value + * @param mixed $key + * @return $this + */ + public function prepend($value, $key = null) + { + $this->items = Arr::prepend($this->items, $value, $key); + + return $this; + } + + /** + * Push an item onto the end of the collection. + * + * @param mixed $value + * @return $this + */ + public function push($value) + { + $this->items[] = $value; + + return $this; + } + + /** + * Push all of the given items onto the collection. + * + * @param iterable $source + * @return static + */ + public function concat($source) + { + $result = new static($this); + + foreach ($source as $item) { + $result->push($item); + } + + return $result; + } + + /** + * Get and remove an item from the collection. + * + * @param mixed $key + * @param mixed $default + * @return mixed + */ + public function pull($key, $default = null) + { + return Arr::pull($this->items, $key, $default); + } + + /** + * Put an item in the collection by key. + * + * @param mixed $key + * @param mixed $value + * @return $this + */ + public function put($key, $value) + { + $this->offsetSet($key, $value); + + return $this; + } + + /** + * Get one or a specified number of items randomly from the collection. + * + * @param int|null $number + * @return static|mixed + * + * @throws \InvalidArgumentException + */ + public function random($number = null) + { + if (is_null($number)) { + return Arr::random($this->items); + } + + return new static(Arr::random($this->items, $number)); + } + + /** + * Reduce the collection to a single value. + * + * @param callable $callback + * @param mixed $initial + * @return mixed + */ + public function reduce(callable $callback, $initial = null) + { + return array_reduce($this->items, $callback, $initial); + } + + /** + * Replace the collection items with the given items. + * + * @param mixed $items + * @return static + */ + public function replace($items) + { + return new static(array_replace($this->items, $this->getArrayableItems($items))); + } + + /** + * Recursively replace the collection items with the given items. + * + * @param mixed $items + * @return static + */ + public function replaceRecursive($items) + { + return new static(array_replace_recursive($this->items, $this->getArrayableItems($items))); + } + + /** + * Reverse items order. + * + * @return static + */ + public function reverse() + { + return new static(array_reverse($this->items, true)); + } + + /** + * Search the collection for a given value and return the corresponding key if successful. + * + * @param mixed $value + * @param bool $strict + * @return mixed + */ + public function search($value, $strict = false) + { + if (! $this->useAsCallable($value)) { + return array_search($value, $this->items, $strict); + } + + foreach ($this->items as $key => $item) { + if ($value($item, $key)) { + return $key; + } + } + + return false; + } + + /** + * Get and remove the first item from the collection. + * + * @return mixed + */ + public function shift() + { + return array_shift($this->items); + } + + /** + * Shuffle the items in the collection. + * + * @param int $seed + * @return static + */ + public function shuffle($seed = null) + { + return new static(Arr::shuffle($this->items, $seed)); + } + + /** + * Skip the first {$count} items. + * + * @param int $count + * @return static + */ + public function skip($count) + { + return $this->slice($count); + } + + /** + * Slice the underlying collection array. + * + * @param int $offset + * @param int $length + * @return static + */ + public function slice($offset, $length = null) + { + return new static(array_slice($this->items, $offset, $length, true)); + } + + /** + * Split a collection into a certain number of groups. + * + * @param int $numberOfGroups + * @return static + */ + public function split($numberOfGroups) + { + if ($this->isEmpty()) { + return new static; + } + + $groups = new static; + + $groupSize = floor($this->count() / $numberOfGroups); + + $remain = $this->count() % $numberOfGroups; + + $start = 0; + + for ($i = 0; $i < $numberOfGroups; $i++) { + $size = $groupSize; + + if ($i < $remain) { + $size++; + } + + if ($size) { + $groups->push(new static(array_slice($this->items, $start, $size))); + + $start += $size; + } + } + + return $groups; + } + + /** + * Chunk the collection into chunks of the given size. + * + * @param int $size + * @return static + */ + public function chunk($size) + { + if ($size <= 0) { + return new static; + } + + $chunks = []; + + foreach (array_chunk($this->items, $size, true) as $chunk) { + $chunks[] = new static($chunk); + } + + return new static($chunks); + } + + /** + * Sort through each item with a callback. + * + * @param callable|null $callback + * @return static + */ + public function sort(callable $callback = null) + { + $items = $this->items; + + $callback + ? uasort($items, $callback) + : asort($items); + + return new static($items); + } + + /** + * Sort the collection using the given callback. + * + * @param callable|string $callback + * @param int $options + * @param bool $descending + * @return static + */ + public function sortBy($callback, $options = SORT_REGULAR, $descending = false) + { + $results = []; + + $callback = $this->valueRetriever($callback); + + // First we will loop through the items and get the comparator from a callback + // function which we were given. Then, we will sort the returned values and + // and grab the corresponding values for the sorted keys from this array. + foreach ($this->items as $key => $value) { + $results[$key] = $callback($value, $key); + } + + $descending ? arsort($results, $options) + : asort($results, $options); + + // Once we have sorted all of the keys in the array, we will loop through them + // and grab the corresponding model so we can set the underlying items list + // to the sorted version. Then we'll just return the collection instance. + foreach (array_keys($results) as $key) { + $results[$key] = $this->items[$key]; + } + + return new static($results); + } + + /** + * Sort the collection in descending order using the given callback. + * + * @param callable|string $callback + * @param int $options + * @return static + */ + public function sortByDesc($callback, $options = SORT_REGULAR) + { + return $this->sortBy($callback, $options, true); + } + + /** + * Sort the collection keys. + * + * @param int $options + * @param bool $descending + * @return static + */ + public function sortKeys($options = SORT_REGULAR, $descending = false) + { + $items = $this->items; + + $descending ? krsort($items, $options) : ksort($items, $options); + + return new static($items); + } + + /** + * Sort the collection keys in descending order. + * + * @param int $options + * @return static + */ + public function sortKeysDesc($options = SORT_REGULAR) + { + return $this->sortKeys($options, true); + } + + /** + * Splice a portion of the underlying collection array. + * + * @param int $offset + * @param int|null $length + * @param mixed $replacement + * @return static + */ + public function splice($offset, $length = null, $replacement = []) + { + if (func_num_args() === 1) { + return new static(array_splice($this->items, $offset)); + } + + return new static(array_splice($this->items, $offset, $length, $replacement)); + } + + /** + * Take the first or last {$limit} items. + * + * @param int $limit + * @return static + */ + public function take($limit) + { + if ($limit < 0) { + return $this->slice($limit, abs($limit)); + } + + return $this->slice(0, $limit); + } + + /** + * Transform each item in the collection using a callback. + * + * @param callable $callback + * @return $this + */ + public function transform(callable $callback) + { + $this->items = $this->map($callback)->all(); + + return $this; + } + + /** + * Reset the keys on the underlying array. + * + * @return static + */ + public function values() + { + return new static(array_values($this->items)); + } + + /** + * Zip the collection together with one or more arrays. + * + * e.g. new Collection([1, 2, 3])->zip([4, 5, 6]); + * => [[1, 4], [2, 5], [3, 6]] + * + * @param mixed ...$items + * @return static + */ + public function zip($items) + { + $arrayableItems = array_map(function ($items) { + return $this->getArrayableItems($items); + }, func_get_args()); + + $params = array_merge([function () { + return new static(func_get_args()); + }, $this->items], $arrayableItems); + + return new static(array_map(...$params)); + } + + /** + * Pad collection to the specified length with a value. + * + * @param int $size + * @param mixed $value + * @return static + */ + public function pad($size, $value) + { + return new static(array_pad($this->items, $size, $value)); + } + + /** + * Get an iterator for the items. + * + * @return \ArrayIterator + */ + public function getIterator() + { + return new ArrayIterator($this->items); + } + + /** + * Count the number of items in the collection. + * + * @return int + */ + public function count() + { + return count($this->items); + } + + /** + * Add an item to the collection. + * + * @param mixed $item + * @return $this + */ + public function add($item) + { + $this->items[] = $item; + + return $this; + } + + /** + * Get a base Support collection instance from this collection. + * + * @return \Illuminate\Support\Collection + */ + public function toBase() + { + return new self($this); + } + + /** + * Determine if an item exists at an offset. + * + * @param mixed $key + * @return bool + */ + public function offsetExists($key) + { + return array_key_exists($key, $this->items); + } + + /** + * Get an item at a given offset. + * + * @param mixed $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->items[$key]; + } + + /** + * Set the item at a given offset. + * + * @param mixed $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + if (is_null($key)) { + $this->items[] = $value; + } else { + $this->items[$key] = $value; + } + } + + /** + * Unset the item at a given offset. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + unset($this->items[$key]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Composer.php b/vendor/laravel/framework/src/Illuminate/Support/Composer.php new file mode 100644 index 00000000..7eca930c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Composer.php @@ -0,0 +1,110 @@ +files = $files; + $this->workingPath = $workingPath; + } + + /** + * Regenerate the Composer autoloader files. + * + * @param string|array $extra + * @return void + */ + public function dumpAutoloads($extra = '') + { + $extra = $extra ? (array) $extra : []; + + $command = array_merge($this->findComposer(), ['dump-autoload'], $extra); + + $this->getProcess($command)->run(); + } + + /** + * Regenerate the optimized Composer autoloader files. + * + * @return void + */ + public function dumpOptimized() + { + $this->dumpAutoloads('--optimize'); + } + + /** + * Get the composer command for the environment. + * + * @return array + */ + protected function findComposer() + { + if ($this->files->exists($this->workingPath.'/composer.phar')) { + return [$this->phpBinary(), 'composer.phar']; + } + + return ['composer']; + } + + /** + * Get the PHP binary. + * + * @return string + */ + protected function phpBinary() + { + return ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); + } + + /** + * Get a new Symfony process instance. + * + * @param array $command + * @return \Symfony\Component\Process\Process + */ + protected function getProcess(array $command) + { + return (new Process($command, $this->workingPath))->setTimeout(null); + } + + /** + * Set the working path used by the class. + * + * @param string $path + * @return $this + */ + public function setWorkingPath($path) + { + $this->workingPath = realpath($path); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/ConfigurationUrlParser.php b/vendor/laravel/framework/src/Illuminate/Support/ConfigurationUrlParser.php new file mode 100644 index 00000000..c7861d5c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/ConfigurationUrlParser.php @@ -0,0 +1,195 @@ + 'sqlsrv', + 'mysql2' => 'mysql', // RDS + 'postgres' => 'pgsql', + 'postgresql' => 'pgsql', + 'sqlite3' => 'sqlite', + 'redis' => 'tcp', + 'rediss' => 'tls', + ]; + + /** + * Parse the database configuration, hydrating options using a database configuration URL if possible. + * + * @param array|string $config + * @return array + */ + public function parseConfiguration($config) + { + if (is_string($config)) { + $config = ['url' => $config]; + } + + $url = $config['url'] ?? null; + + $config = Arr::except($config, 'url'); + + if (! $url) { + return $config; + } + + $rawComponents = $this->parseUrl($url); + + $decodedComponents = $this->parseStringsToNativeTypes( + array_map('rawurldecode', $rawComponents) + ); + + return array_merge( + $config, + $this->getPrimaryOptions($decodedComponents), + $this->getQueryOptions($rawComponents) + ); + } + + /** + * Get the primary database connection options. + * + * @param array $url + * @return array + */ + protected function getPrimaryOptions($url) + { + return array_filter([ + 'driver' => $this->getDriver($url), + 'database' => $this->getDatabase($url), + 'host' => $url['host'] ?? null, + 'port' => $url['port'] ?? null, + 'username' => $url['user'] ?? null, + 'password' => $url['pass'] ?? null, + ], function ($value) { + return ! is_null($value); + }); + } + + /** + * Get the database driver from the URL. + * + * @param array $url + * @return string|null + */ + protected function getDriver($url) + { + $alias = $url['scheme'] ?? null; + + if (! $alias) { + return; + } + + return static::$driverAliases[$alias] ?? $alias; + } + + /** + * Get the database name from the URL. + * + * @param array $url + * @return string|null + */ + protected function getDatabase($url) + { + $path = $url['path'] ?? null; + + return $path && $path !== '/' ? substr($path, 1) : null; + } + + /** + * Get all of the additional database options from the query string. + * + * @param array $url + * @return array + */ + protected function getQueryOptions($url) + { + $queryString = $url['query'] ?? null; + + if (! $queryString) { + return []; + } + + $query = []; + + parse_str($queryString, $query); + + return $this->parseStringsToNativeTypes($query); + } + + /** + * Parse the string URL to an array of components. + * + * @param string $url + * @return array + * + * @throws \InvalidArgumentException + */ + protected function parseUrl($url) + { + $url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url); + + $parsedUrl = parse_url($url); + + if ($parsedUrl === false) { + throw new InvalidArgumentException('The database configuration URL is malformed.'); + } + + return $parsedUrl; + } + + /** + * Convert string casted values to their native types. + * + * @param mixed $value + * @return mixed + */ + protected function parseStringsToNativeTypes($value) + { + if (is_array($value)) { + return array_map([$this, 'parseStringsToNativeTypes'], $value); + } + + if (! is_string($value)) { + return $value; + } + + $parsedValue = json_decode($value, true); + + if (json_last_error() === JSON_ERROR_NONE) { + return $parsedValue; + } + + return $value; + } + + /** + * Get all of the current drivers aliases. + * + * @return array + */ + public static function getDriverAliases() + { + return static::$driverAliases; + } + + /** + * Add the given driver alias to the driver aliases array. + * + * @param string $alias + * @param string $driver + * @return void + */ + public static function addDriverAlias($alias, $driver) + { + static::$driverAliases[$alias] = $driver; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/DateFactory.php b/vendor/laravel/framework/src/Illuminate/Support/DateFactory.php new file mode 100644 index 00000000..72f22231 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/DateFactory.php @@ -0,0 +1,231 @@ +$method(...$parameters); + } + + $dateClass = static::$dateClass ?: $defaultClassName; + + // Check if date can be created using public class method... + if (method_exists($dateClass, $method) || + method_exists($dateClass, 'hasMacro') && $dateClass::hasMacro($method)) { + return $dateClass::$method(...$parameters); + } + + // If that fails, create the date with the default class.. + $date = $defaultClassName::$method(...$parameters); + + // If the configured class has an "instance" method, we'll try to pass our date into there... + if (method_exists($dateClass, 'instance')) { + return $dateClass::instance($date); + } + + // Otherwise, assume the configured class has a DateTime compatible constructor... + return new $dateClass($date->format('Y-m-d H:i:s.u'), $date->getTimezone()); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Enumerable.php b/vendor/laravel/framework/src/Illuminate/Support/Enumerable.php new file mode 100644 index 00000000..48991b37 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Enumerable.php @@ -0,0 +1,920 @@ +createImmutable(); + } + + return static::$variables; + } + + /** + * Gets the value of an environment variable. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public static function get($key, $default = null) + { + return Option::fromValue(static::getVariables()->get($key)) + ->map(function ($value) { + switch (strtolower($value)) { + case 'true': + case '(true)': + return true; + case 'false': + case '(false)': + return false; + case 'empty': + case '(empty)': + return ''; + case 'null': + case '(null)': + return; + } + + if (preg_match('/\A([\'"])(.*)\1\z/', $value, $matches)) { + return $matches[2]; + } + + return $value; + }) + ->getOrCall(function () use ($default) { + return value($default); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php new file mode 100755 index 00000000..0bc5b342 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php @@ -0,0 +1,59 @@ +make('router')->auth($options); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/Blade.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/Blade.php new file mode 100755 index 00000000..003176c7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/Blade.php @@ -0,0 +1,36 @@ +cookie($key, null)); + } + + /** + * Retrieve a cookie from the request. + * + * @param string|null $key + * @param mixed $default + * @return string|array|null + */ + public static function get($key = null, $default = null) + { + return static::$app['request']->cookie($key, $default); + } + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() + { + return 'cookie'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/Crypt.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/Crypt.php new file mode 100755 index 00000000..20f269d9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/Crypt.php @@ -0,0 +1,27 @@ +resolved($accessor) === true) { + $callback(static::getFacadeRoot()); + } + + static::$app->afterResolving($accessor, function ($service) use ($callback) { + $callback($service); + }); + } + + /** + * Convert the facade into a Mockery spy. + * + * @return \Mockery\MockInterface + */ + public static function spy() + { + if (! static::isMock()) { + $class = static::getMockableClass(); + + return tap($class ? Mockery::spy($class) : Mockery::spy(), function ($spy) { + static::swap($spy); + }); + } + } + + /** + * Initiate a partial mock on the facade. + * + * @return \Mockery\MockInterface + */ + public static function partialMock() + { + $name = static::getFacadeAccessor(); + + $mock = static::isMock() + ? static::$resolvedInstance[$name] + : static::createFreshMockInstance(); + + return $mock->makePartial(); + } + + /** + * Initiate a mock expectation on the facade. + * + * @return \Mockery\Expectation + */ + public static function shouldReceive() + { + $name = static::getFacadeAccessor(); + + $mock = static::isMock() + ? static::$resolvedInstance[$name] + : static::createFreshMockInstance(); + + return $mock->shouldReceive(...func_get_args()); + } + + /** + * Create a fresh mock instance for the given class. + * + * @return \Mockery\MockInterface + */ + protected static function createFreshMockInstance() + { + return tap(static::createMock(), function ($mock) { + static::swap($mock); + + $mock->shouldAllowMockingProtectedMethods(); + }); + } + + /** + * Create a fresh mock instance for the given class. + * + * @return \Mockery\MockInterface + */ + protected static function createMock() + { + $class = static::getMockableClass(); + + return $class ? Mockery::mock($class) : Mockery::mock(); + } + + /** + * Determines whether a mock is set as the instance of the facade. + * + * @return bool + */ + protected static function isMock() + { + $name = static::getFacadeAccessor(); + + return isset(static::$resolvedInstance[$name]) && + static::$resolvedInstance[$name] instanceof MockInterface; + } + + /** + * Get the mockable class for the bound instance. + * + * @return string|null + */ + protected static function getMockableClass() + { + if ($root = static::getFacadeRoot()) { + return get_class($root); + } + } + + /** + * Hotswap the underlying instance behind the facade. + * + * @param mixed $instance + * @return void + */ + public static function swap($instance) + { + static::$resolvedInstance[static::getFacadeAccessor()] = $instance; + + if (isset(static::$app)) { + static::$app->instance(static::getFacadeAccessor(), $instance); + } + } + + /** + * Get the root object behind the facade. + * + * @return mixed + */ + public static function getFacadeRoot() + { + return static::resolveFacadeInstance(static::getFacadeAccessor()); + } + + /** + * Get the registered name of the component. + * + * @return string + * + * @throws \RuntimeException + */ + protected static function getFacadeAccessor() + { + throw new RuntimeException('Facade does not implement getFacadeAccessor method.'); + } + + /** + * Resolve the facade root instance from the container. + * + * @param object|string $name + * @return mixed + */ + protected static function resolveFacadeInstance($name) + { + if (is_object($name)) { + return $name; + } + + if (isset(static::$resolvedInstance[$name])) { + return static::$resolvedInstance[$name]; + } + + if (static::$app) { + return static::$resolvedInstance[$name] = static::$app[$name]; + } + } + + /** + * Clear a resolved facade instance. + * + * @param string $name + * @return void + */ + public static function clearResolvedInstance($name) + { + unset(static::$resolvedInstance[$name]); + } + + /** + * Clear all of the resolved instances. + * + * @return void + */ + public static function clearResolvedInstances() + { + static::$resolvedInstance = []; + } + + /** + * Get the application instance behind the facade. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + public static function getFacadeApplication() + { + return static::$app; + } + + /** + * Set the application instance. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public static function setFacadeApplication($app) + { + static::$app = $app; + } + + /** + * Handle dynamic, static calls to the object. + * + * @param string $method + * @param array $args + * @return mixed + * + * @throws \RuntimeException + */ + public static function __callStatic($method, $args) + { + $instance = static::getFacadeRoot(); + + if (! $instance) { + throw new RuntimeException('A facade root has not been set.'); + } + + return $instance->$method(...$args); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/File.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/File.php new file mode 100755 index 00000000..c23a1dc6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/File.php @@ -0,0 +1,58 @@ +route($channel, $route); + } + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() + { + return ChannelManager::class; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/Password.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/Password.php new file mode 100755 index 00000000..864b5e98 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/Password.php @@ -0,0 +1,59 @@ +connection($name)->getSchemaBuilder(); + } + + /** + * Get a schema builder instance for the default connection. + * + * @return \Illuminate\Database\Schema\Builder + */ + protected static function getFacadeAccessor() + { + return static::$app['db']->connection()->getSchemaBuilder(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/Session.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/Session.php new file mode 100755 index 00000000..63256520 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/Session.php @@ -0,0 +1,44 @@ +get('filesystems.default'); + + (new Filesystem)->cleanDirectory( + $root = storage_path('framework/testing/disks/'.$disk) + ); + + static::set($disk, $fake = static::createLocalDriver(array_merge($config, [ + 'root' => $root, + ]))); + + return $fake; + } + + /** + * Replace the given disk with a persistent local testing disk. + * + * @param string|null $disk + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public static function persistentFake($disk = null, array $config = []) + { + $disk = $disk ?: static::$app['config']->get('filesystems.default'); + + static::set($disk, $fake = static::createLocalDriver(array_merge($config, [ + 'root' => storage_path('framework/testing/disks/'.$disk), + ]))); + + return $fake; + } + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() + { + return 'filesystem'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/URL.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/URL.php new file mode 100755 index 00000000..1ef545c1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/URL.php @@ -0,0 +1,34 @@ + $value) { + $this->attributes[$key] = $value; + } + } + + /** + * Get an attribute from the fluent instance. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + if (array_key_exists($key, $this->attributes)) { + return $this->attributes[$key]; + } + + return value($default); + } + + /** + * Get the attributes from the fluent instance. + * + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Convert the fluent instance to an array. + * + * @return array + */ + public function toArray() + { + return $this->attributes; + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Convert the fluent instance to JSON. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->jsonSerialize(), $options); + } + + /** + * Determine if the given offset exists. + * + * @param string $offset + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->attributes[$offset]); + } + + /** + * Get the value for a given offset. + * + * @param string $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->get($offset); + } + + /** + * Set the value at the given offset. + * + * @param string $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value) + { + $this->attributes[$offset] = $value; + } + + /** + * Unset the value at the given offset. + * + * @param string $offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->attributes[$offset]); + } + + /** + * Handle dynamic calls to the fluent instance to set attributes. + * + * @param string $method + * @param array $parameters + * @return $this + */ + public function __call($method, $parameters) + { + $this->attributes[$method] = count($parameters) > 0 ? $parameters[0] : true; + + return $this; + } + + /** + * Dynamically retrieve the value of an attribute. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->get($key); + } + + /** + * Dynamically set the value of an attribute. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->offsetSet($key, $value); + } + + /** + * Dynamically check if an attribute is set. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return $this->offsetExists($key); + } + + /** + * Dynamically unset an attribute. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + $this->offsetUnset($key); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php b/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php new file mode 100644 index 00000000..106356c3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php @@ -0,0 +1,63 @@ +method = $method; + $this->collection = $collection; + } + + /** + * Proxy accessing an attribute onto the collection items. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->collection->{$this->method}(function ($value) use ($key) { + return is_array($value) ? $value[$key] : $value->{$key}; + }); + } + + /** + * Proxy a method call onto the collection items. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->collection->{$this->method}(function ($value) use ($method, $parameters) { + return $value->{$method}(...$parameters); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/HigherOrderTapProxy.php b/vendor/laravel/framework/src/Illuminate/Support/HigherOrderTapProxy.php new file mode 100644 index 00000000..bbf9b2e5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/HigherOrderTapProxy.php @@ -0,0 +1,38 @@ +target = $target; + } + + /** + * Dynamically pass method calls to the target. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + $this->target->{$method}(...$parameters); + + return $this->target; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/HtmlString.php b/vendor/laravel/framework/src/Illuminate/Support/HtmlString.php new file mode 100644 index 00000000..c13adfd4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/HtmlString.php @@ -0,0 +1,46 @@ +html = $html; + } + + /** + * Get the HTML string. + * + * @return string + */ + public function toHtml() + { + return $this->html; + } + + /** + * Get the HTML string. + * + * @return string + */ + public function __toString() + { + return $this->toHtml(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/InteractsWithTime.php b/vendor/laravel/framework/src/Illuminate/Support/InteractsWithTime.php new file mode 100644 index 00000000..2b617c39 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/InteractsWithTime.php @@ -0,0 +1,64 @@ +parseDateInterval($delay); + + return $delay instanceof DateTimeInterface + ? max(0, $delay->getTimestamp() - $this->currentTime()) + : (int) $delay; + } + + /** + * Get the "available at" UNIX timestamp. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @return int + */ + protected function availableAt($delay = 0) + { + $delay = $this->parseDateInterval($delay); + + return $delay instanceof DateTimeInterface + ? $delay->getTimestamp() + : Carbon::now()->addRealSeconds($delay)->getTimestamp(); + } + + /** + * If the given value is an interval, convert it to a DateTime instance. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @return \DateTimeInterface|int + */ + protected function parseDateInterval($delay) + { + if ($delay instanceof DateInterval) { + $delay = Carbon::now()->add($delay); + } + + return $delay; + } + + /** + * Get the current system time as a UNIX timestamp. + * + * @return int + */ + protected function currentTime() + { + return Carbon::now()->getTimestamp(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Support/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Support/LazyCollection.php b/vendor/laravel/framework/src/Illuminate/Support/LazyCollection.php new file mode 100644 index 00000000..b025a282 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/LazyCollection.php @@ -0,0 +1,1263 @@ +source = $source; + } elseif (is_null($source)) { + $this->source = static::empty(); + } else { + $this->source = $this->getArrayableItems($source); + } + } + + /** + * Create a new instance with no items. + * + * @return static + */ + public static function empty() + { + return new static([]); + } + + /** + * Create a new instance by invoking the callback a given amount of times. + * + * @param int $number + * @param callable $callback + * @return static + */ + public static function times($number, callable $callback = null) + { + if ($number < 1) { + return new static; + } + + $instance = new static(function () use ($number) { + for ($current = 1; $current <= $number; $current++) { + yield $current; + } + }); + + return is_null($callback) ? $instance : $instance->map($callback); + } + + /** + * Create an enumerable with the given range. + * + * @param int $from + * @param int $to + * @return static + */ + public static function range($from, $to) + { + return new static(function () use ($from, $to) { + for (; $from <= $to; $from++) { + yield $from; + } + }); + } + + /** + * Get all items in the enumerable. + * + * @return array + */ + public function all() + { + if (is_array($this->source)) { + return $this->source; + } + + return iterator_to_array($this->getIterator()); + } + + /** + * Eager load all items into a new lazy collection backed by an array. + * + * @return static + */ + public function eager() + { + return new static($this->all()); + } + + /** + * Cache values as they're enumerated. + * + * @return static + */ + public function remember() + { + $iterator = $this->getIterator(); + + $iteratorIndex = 0; + + $cache = []; + + return new static(function () use ($iterator, &$iteratorIndex, &$cache) { + for ($index = 0; true; $index++) { + if (array_key_exists($index, $cache)) { + yield $cache[$index][0] => $cache[$index][1]; + + continue; + } + + if ($iteratorIndex < $index) { + $iterator->next(); + + $iteratorIndex++; + } + + if (! $iterator->valid()) { + break; + } + + $cache[$index] = [$iterator->key(), $iterator->current()]; + + yield $cache[$index][0] => $cache[$index][1]; + } + }); + } + + /** + * Get the average value of a given key. + * + * @param callable|string|null $callback + * @return mixed + */ + public function avg($callback = null) + { + return $this->collect()->avg($callback); + } + + /** + * Get the median of a given key. + * + * @param string|array|null $key + * @return mixed + */ + public function median($key = null) + { + return $this->collect()->median($key); + } + + /** + * Get the mode of a given key. + * + * @param string|array|null $key + * @return array|null + */ + public function mode($key = null) + { + return $this->collect()->mode($key); + } + + /** + * Collapse the collection of items into a single array. + * + * @return static + */ + public function collapse() + { + return new static(function () { + foreach ($this as $values) { + if (is_array($values) || $values instanceof Enumerable) { + foreach ($values as $value) { + yield $value; + } + } + } + }); + } + + /** + * Determine if an item exists in the enumerable. + * + * @param mixed $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function contains($key, $operator = null, $value = null) + { + if (func_num_args() === 1 && $this->useAsCallable($key)) { + $placeholder = new stdClass; + + return $this->first($key, $placeholder) !== $placeholder; + } + + if (func_num_args() === 1) { + $needle = $key; + + foreach ($this as $value) { + if ($value == $needle) { + return true; + } + } + + return false; + } + + return $this->contains($this->operatorForWhere(...func_get_args())); + } + + /** + * Cross join the given iterables, returning all possible permutations. + * + * @param array ...$arrays + * @return static + */ + public function crossJoin(...$arrays) + { + return $this->passthru('crossJoin', func_get_args()); + } + + /** + * Get the items that are not present in the given items. + * + * @param mixed $items + * @return static + */ + public function diff($items) + { + return $this->passthru('diff', func_get_args()); + } + + /** + * Get the items that are not present in the given items, using the callback. + * + * @param mixed $items + * @param callable $callback + * @return static + */ + public function diffUsing($items, callable $callback) + { + return $this->passthru('diffUsing', func_get_args()); + } + + /** + * Get the items whose keys and values are not present in the given items. + * + * @param mixed $items + * @return static + */ + public function diffAssoc($items) + { + return $this->passthru('diffAssoc', func_get_args()); + } + + /** + * Get the items whose keys and values are not present in the given items, using the callback. + * + * @param mixed $items + * @param callable $callback + * @return static + */ + public function diffAssocUsing($items, callable $callback) + { + return $this->passthru('diffAssocUsing', func_get_args()); + } + + /** + * Get the items whose keys are not present in the given items. + * + * @param mixed $items + * @return static + */ + public function diffKeys($items) + { + return $this->passthru('diffKeys', func_get_args()); + } + + /** + * Get the items whose keys are not present in the given items, using the callback. + * + * @param mixed $items + * @param callable $callback + * @return static + */ + public function diffKeysUsing($items, callable $callback) + { + return $this->passthru('diffKeysUsing', func_get_args()); + } + + /** + * Retrieve duplicate items. + * + * @param callable|null $callback + * @param bool $strict + * @return static + */ + public function duplicates($callback = null, $strict = false) + { + return $this->passthru('duplicates', func_get_args()); + } + + /** + * Retrieve duplicate items using strict comparison. + * + * @param callable|null $callback + * @return static + */ + public function duplicatesStrict($callback = null) + { + return $this->passthru('duplicatesStrict', func_get_args()); + } + + /** + * Get all items except for those with the specified keys. + * + * @param mixed $keys + * @return static + */ + public function except($keys) + { + return $this->passthru('except', func_get_args()); + } + + /** + * Run a filter over each of the items. + * + * @param callable|null $callback + * @return static + */ + public function filter(callable $callback = null) + { + if (is_null($callback)) { + $callback = function ($value) { + return (bool) $value; + }; + } + + return new static(function () use ($callback) { + foreach ($this as $key => $value) { + if ($callback($value, $key)) { + yield $key => $value; + } + } + }); + } + + /** + * Get the first item from the enumerable passing the given truth test. + * + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + public function first(callable $callback = null, $default = null) + { + $iterator = $this->getIterator(); + + if (is_null($callback)) { + if (! $iterator->valid()) { + return value($default); + } + + return $iterator->current(); + } + + foreach ($iterator as $key => $value) { + if ($callback($value, $key)) { + return $value; + } + } + + return value($default); + } + + /** + * Get a flattened list of the items in the collection. + * + * @param int $depth + * @return static + */ + public function flatten($depth = INF) + { + $instance = new static(function () use ($depth) { + foreach ($this as $item) { + if (! is_array($item) && ! $item instanceof Enumerable) { + yield $item; + } elseif ($depth === 1) { + yield from $item; + } else { + yield from (new static($item))->flatten($depth - 1); + } + } + }); + + return $instance->values(); + } + + /** + * Flip the items in the collection. + * + * @return static + */ + public function flip() + { + return new static(function () { + foreach ($this as $key => $value) { + yield $value => $key; + } + }); + } + + /** + * Get an item by key. + * + * @param mixed $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + if (is_null($key)) { + return; + } + + foreach ($this as $outerKey => $outerValue) { + if ($outerKey == $key) { + return $outerValue; + } + } + + return value($default); + } + + /** + * Group an associative array by a field or using a callback. + * + * @param array|callable|string $groupBy + * @param bool $preserveKeys + * @return static + */ + public function groupBy($groupBy, $preserveKeys = false) + { + return $this->passthru('groupBy', func_get_args()); + } + + /** + * Key an associative array by a field or using a callback. + * + * @param callable|string $keyBy + * @return static + */ + public function keyBy($keyBy) + { + return new static(function () use ($keyBy) { + $keyBy = $this->valueRetriever($keyBy); + + foreach ($this as $key => $item) { + $resolvedKey = $keyBy($item, $key); + + if (is_object($resolvedKey)) { + $resolvedKey = (string) $resolvedKey; + } + + yield $resolvedKey => $item; + } + }); + } + + /** + * Determine if an item exists in the collection by key. + * + * @param mixed $key + * @return bool + */ + public function has($key) + { + $keys = array_flip(is_array($key) ? $key : func_get_args()); + $count = count($keys); + + foreach ($this as $key => $value) { + if (array_key_exists($key, $keys) && --$count == 0) { + return true; + } + } + + return false; + } + + /** + * Concatenate values of a given key as a string. + * + * @param string $value + * @param string $glue + * @return string + */ + public function implode($value, $glue = null) + { + return $this->collect()->implode(...func_get_args()); + } + + /** + * Intersect the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function intersect($items) + { + return $this->passthru('intersect', func_get_args()); + } + + /** + * Intersect the collection with the given items by key. + * + * @param mixed $items + * @return static + */ + public function intersectByKeys($items) + { + return $this->passthru('intersectByKeys', func_get_args()); + } + + /** + * Determine if the items is empty or not. + * + * @return bool + */ + public function isEmpty() + { + return ! $this->getIterator()->valid(); + } + + /** + * Join all items from the collection using a string. The final items can use a separate glue string. + * + * @param string $glue + * @param string $finalGlue + * @return string + */ + public function join($glue, $finalGlue = '') + { + return $this->collect()->join(...func_get_args()); + } + + /** + * Get the keys of the collection items. + * + * @return static + */ + public function keys() + { + return new static(function () { + foreach ($this as $key => $value) { + yield $key; + } + }); + } + + /** + * Get the last item from the collection. + * + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + public function last(callable $callback = null, $default = null) + { + $needle = $placeholder = new stdClass; + + foreach ($this as $key => $value) { + if (is_null($callback) || $callback($value, $key)) { + $needle = $value; + } + } + + return $needle === $placeholder ? value($default) : $needle; + } + + /** + * Get the values of a given key. + * + * @param string|array $value + * @param string|null $key + * @return static + */ + public function pluck($value, $key = null) + { + return new static(function () use ($value, $key) { + [$value, $key] = $this->explodePluckParameters($value, $key); + + foreach ($this as $item) { + $itemValue = data_get($item, $value); + + if (is_null($key)) { + yield $itemValue; + } else { + $itemKey = data_get($item, $key); + + if (is_object($itemKey) && method_exists($itemKey, '__toString')) { + $itemKey = (string) $itemKey; + } + + yield $itemKey => $itemValue; + } + } + }); + } + + /** + * Run a map over each of the items. + * + * @param callable $callback + * @return static + */ + public function map(callable $callback) + { + return new static(function () use ($callback) { + foreach ($this as $key => $value) { + yield $key => $callback($value, $key); + } + }); + } + + /** + * Run a dictionary map over the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @param callable $callback + * @return static + */ + public function mapToDictionary(callable $callback) + { + return $this->passthru('mapToDictionary', func_get_args()); + } + + /** + * Run an associative map over each of the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @param callable $callback + * @return static + */ + public function mapWithKeys(callable $callback) + { + return new static(function () use ($callback) { + foreach ($this as $key => $value) { + yield from $callback($value, $key); + } + }); + } + + /** + * Merge the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function merge($items) + { + return $this->passthru('merge', func_get_args()); + } + + /** + * Recursively merge the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function mergeRecursive($items) + { + return $this->passthru('mergeRecursive', func_get_args()); + } + + /** + * Create a collection by using this collection for keys and another for its values. + * + * @param mixed $values + * @return static + */ + public function combine($values) + { + return new static(function () use ($values) { + $values = $this->makeIterator($values); + + $errorMessage = 'Both parameters should have an equal number of elements'; + + foreach ($this as $key) { + if (! $values->valid()) { + trigger_error($errorMessage, E_USER_WARNING); + + break; + } + + yield $key => $values->current(); + + $values->next(); + } + + if ($values->valid()) { + trigger_error($errorMessage, E_USER_WARNING); + } + }); + } + + /** + * Union the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function union($items) + { + return $this->passthru('union', func_get_args()); + } + + /** + * Create a new collection consisting of every n-th element. + * + * @param int $step + * @param int $offset + * @return static + */ + public function nth($step, $offset = 0) + { + return new static(function () use ($step, $offset) { + $position = 0; + + foreach ($this as $item) { + if ($position % $step === $offset) { + yield $item; + } + + $position++; + } + }); + } + + /** + * Get the items with the specified keys. + * + * @param mixed $keys + * @return static + */ + public function only($keys) + { + if ($keys instanceof Enumerable) { + $keys = $keys->all(); + } elseif (! is_null($keys)) { + $keys = is_array($keys) ? $keys : func_get_args(); + } + + return new static(function () use ($keys) { + if (is_null($keys)) { + yield from $this; + } else { + $keys = array_flip($keys); + + foreach ($this as $key => $value) { + if (array_key_exists($key, $keys)) { + yield $key => $value; + + unset($keys[$key]); + + if (empty($keys)) { + break; + } + } + } + } + }); + } + + /** + * Push all of the given items onto the collection. + * + * @param iterable $source + * @return static + */ + public function concat($source) + { + return (new static(function () use ($source) { + yield from $this; + yield from $source; + }))->values(); + } + + /** + * Get one or a specified number of items randomly from the collection. + * + * @param int|null $number + * @return static|mixed + * + * @throws \InvalidArgumentException + */ + public function random($number = null) + { + $result = $this->collect()->random(...func_get_args()); + + return is_null($number) ? $result : new static($result); + } + + /** + * Reduce the collection to a single value. + * + * @param callable $callback + * @param mixed $initial + * @return mixed + */ + public function reduce(callable $callback, $initial = null) + { + $result = $initial; + + foreach ($this as $value) { + $result = $callback($result, $value); + } + + return $result; + } + + /** + * Replace the collection items with the given items. + * + * @param mixed $items + * @return static + */ + public function replace($items) + { + return new static(function () use ($items) { + $items = $this->getArrayableItems($items); + + foreach ($this as $key => $value) { + if (array_key_exists($key, $items)) { + yield $key => $items[$key]; + + unset($items[$key]); + } else { + yield $key => $value; + } + } + + foreach ($items as $key => $value) { + yield $key => $value; + } + }); + } + + /** + * Recursively replace the collection items with the given items. + * + * @param mixed $items + * @return static + */ + public function replaceRecursive($items) + { + return $this->passthru('replaceRecursive', func_get_args()); + } + + /** + * Reverse items order. + * + * @return static + */ + public function reverse() + { + return $this->passthru('reverse', func_get_args()); + } + + /** + * Search the collection for a given value and return the corresponding key if successful. + * + * @param mixed $value + * @param bool $strict + * @return mixed + */ + public function search($value, $strict = false) + { + $predicate = $this->useAsCallable($value) + ? $value + : function ($item) use ($value, $strict) { + return $strict ? $item === $value : $item == $value; + }; + + foreach ($this as $key => $item) { + if ($predicate($item, $key)) { + return $key; + } + } + + return false; + } + + /** + * Shuffle the items in the collection. + * + * @param int $seed + * @return static + */ + public function shuffle($seed = null) + { + return $this->passthru('shuffle', func_get_args()); + } + + /** + * Skip the first {$count} items. + * + * @param int $count + * @return static + */ + public function skip($count) + { + return new static(function () use ($count) { + $iterator = $this->getIterator(); + + while ($iterator->valid() && $count--) { + $iterator->next(); + } + + while ($iterator->valid()) { + yield $iterator->key() => $iterator->current(); + + $iterator->next(); + } + }); + } + + /** + * Get a slice of items from the enumerable. + * + * @param int $offset + * @param int $length + * @return static + */ + public function slice($offset, $length = null) + { + if ($offset < 0 || $length < 0) { + return $this->passthru('slice', func_get_args()); + } + + $instance = $this->skip($offset); + + return is_null($length) ? $instance : $instance->take($length); + } + + /** + * Split a collection into a certain number of groups. + * + * @param int $numberOfGroups + * @return static + */ + public function split($numberOfGroups) + { + return $this->passthru('split', func_get_args()); + } + + /** + * Chunk the collection into chunks of the given size. + * + * @param int $size + * @return static + */ + public function chunk($size) + { + if ($size <= 0) { + return static::empty(); + } + + return new static(function () use ($size) { + $iterator = $this->getIterator(); + + while ($iterator->valid()) { + $chunk = []; + + while (true) { + $chunk[$iterator->key()] = $iterator->current(); + + if (count($chunk) < $size) { + $iterator->next(); + + if (! $iterator->valid()) { + break; + } + } else { + break; + } + } + + yield new static($chunk); + + $iterator->next(); + } + }); + } + + /** + * Sort through each item with a callback. + * + * @param callable|null $callback + * @return static + */ + public function sort(callable $callback = null) + { + return $this->passthru('sort', func_get_args()); + } + + /** + * Sort the collection using the given callback. + * + * @param callable|string $callback + * @param int $options + * @param bool $descending + * @return static + */ + public function sortBy($callback, $options = SORT_REGULAR, $descending = false) + { + return $this->passthru('sortBy', func_get_args()); + } + + /** + * Sort the collection in descending order using the given callback. + * + * @param callable|string $callback + * @param int $options + * @return static + */ + public function sortByDesc($callback, $options = SORT_REGULAR) + { + return $this->passthru('sortByDesc', func_get_args()); + } + + /** + * Sort the collection keys. + * + * @param int $options + * @param bool $descending + * @return static + */ + public function sortKeys($options = SORT_REGULAR, $descending = false) + { + return $this->passthru('sortKeys', func_get_args()); + } + + /** + * Sort the collection keys in descending order. + * + * @param int $options + * @return static + */ + public function sortKeysDesc($options = SORT_REGULAR) + { + return $this->passthru('sortKeysDesc', func_get_args()); + } + + /** + * Take the first or last {$limit} items. + * + * @param int $limit + * @return static + */ + public function take($limit) + { + if ($limit < 0) { + return $this->passthru('take', func_get_args()); + } + + return new static(function () use ($limit) { + $iterator = $this->getIterator(); + + while ($limit--) { + if (! $iterator->valid()) { + break; + } + + yield $iterator->key() => $iterator->current(); + + if ($limit) { + $iterator->next(); + } + } + }); + } + + /** + * Pass each item in the collection to the given callback, lazily. + * + * @param callable $callback + * @return static + */ + public function tapEach(callable $callback) + { + return new static(function () use ($callback) { + foreach ($this as $key => $value) { + $callback($value, $key); + + yield $key => $value; + } + }); + } + + /** + * Reset the keys on the underlying array. + * + * @return static + */ + public function values() + { + return new static(function () { + foreach ($this as $item) { + yield $item; + } + }); + } + + /** + * Zip the collection together with one or more arrays. + * + * e.g. new LazyCollection([1, 2, 3])->zip([4, 5, 6]); + * => [[1, 4], [2, 5], [3, 6]] + * + * @param mixed ...$items + * @return static + */ + public function zip($items) + { + $iterables = func_get_args(); + + return new static(function () use ($iterables) { + $iterators = Collection::make($iterables)->map(function ($iterable) { + return $this->makeIterator($iterable); + })->prepend($this->getIterator()); + + while ($iterators->contains->valid()) { + yield new static($iterators->map->current()); + + $iterators->each->next(); + } + }); + } + + /** + * Pad collection to the specified length with a value. + * + * @param int $size + * @param mixed $value + * @return static + */ + public function pad($size, $value) + { + if ($size < 0) { + return $this->passthru('pad', func_get_args()); + } + + return new static(function () use ($size, $value) { + $yielded = 0; + + foreach ($this as $index => $item) { + yield $index => $item; + + $yielded++; + } + + while ($yielded++ < $size) { + yield $value; + } + }); + } + + /** + * Get the values iterator. + * + * @return \Traversable + */ + public function getIterator() + { + return $this->makeIterator($this->source); + } + + /** + * Count the number of items in the collection. + * + * @return int + */ + public function count() + { + if (is_array($this->source)) { + return count($this->source); + } + + return iterator_count($this->getIterator()); + } + + /** + * Make an iterator from the given source. + * + * @param mixed $source + * @return \Traversable + */ + protected function makeIterator($source) + { + if ($source instanceof IteratorAggregate) { + return $source->getIterator(); + } + + if (is_array($source)) { + return new ArrayIterator($source); + } + + return $source(); + } + + /** + * Explode the "value" and "key" arguments passed to "pluck". + * + * @param string|array $value + * @param string|array|null $key + * @return array + */ + protected function explodePluckParameters($value, $key) + { + $value = is_string($value) ? explode('.', $value) : $value; + + $key = is_null($key) || is_array($key) ? $key : explode('.', $key); + + return [$value, $key]; + } + + /** + * Pass this lazy collection through a method on the collection class. + * + * @param string $method + * @param array $params + * @return static + */ + protected function passthru($method, array $params) + { + return new static(function () use ($method, $params) { + yield from $this->collect()->$method(...$params); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Manager.php b/vendor/laravel/framework/src/Illuminate/Support/Manager.php new file mode 100755 index 00000000..917958ec --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Manager.php @@ -0,0 +1,168 @@ +app = $container; + $this->container = $container; + $this->config = $container->make('config'); + } + + /** + * Get the default driver name. + * + * @return string + */ + abstract public function getDefaultDriver(); + + /** + * Get a driver instance. + * + * @param string $driver + * @return mixed + * + * @throws \InvalidArgumentException + */ + public function driver($driver = null) + { + $driver = $driver ?: $this->getDefaultDriver(); + + if (is_null($driver)) { + throw new InvalidArgumentException(sprintf( + 'Unable to resolve NULL driver for [%s].', static::class + )); + } + + // If the given driver has not been created before, we will create the instances + // here and cache it so we can return it next time very quickly. If there is + // already a driver created by this name, we'll just return that instance. + if (! isset($this->drivers[$driver])) { + $this->drivers[$driver] = $this->createDriver($driver); + } + + return $this->drivers[$driver]; + } + + /** + * Create a new driver instance. + * + * @param string $driver + * @return mixed + * + * @throws \InvalidArgumentException + */ + protected function createDriver($driver) + { + // First, we will determine if a custom driver creator exists for the given driver and + // if it does not we will check for a creator method for the driver. Custom creator + // callbacks allow developers to build their own "drivers" easily using Closures. + if (isset($this->customCreators[$driver])) { + return $this->callCustomCreator($driver); + } else { + $method = 'create'.Str::studly($driver).'Driver'; + + if (method_exists($this, $method)) { + return $this->$method(); + } + } + + throw new InvalidArgumentException("Driver [$driver] not supported."); + } + + /** + * Call a custom driver creator. + * + * @param string $driver + * @return mixed + */ + protected function callCustomCreator($driver) + { + return $this->customCreators[$driver]($this->container); + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback; + + return $this; + } + + /** + * Get all of the created "drivers". + * + * @return array + */ + public function getDrivers() + { + return $this->drivers; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->driver()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/MessageBag.php b/vendor/laravel/framework/src/Illuminate/Support/MessageBag.php new file mode 100755 index 00000000..1fb862a5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/MessageBag.php @@ -0,0 +1,404 @@ + $value) { + $value = $value instanceof Arrayable ? $value->toArray() : (array) $value; + + $this->messages[$key] = array_unique($value); + } + } + + /** + * Get the keys present in the message bag. + * + * @return array + */ + public function keys() + { + return array_keys($this->messages); + } + + /** + * Add a message to the message bag. + * + * @param string $key + * @param string $message + * @return $this + */ + public function add($key, $message) + { + if ($this->isUnique($key, $message)) { + $this->messages[$key][] = $message; + } + + return $this; + } + + /** + * Determine if a key and message combination already exists. + * + * @param string $key + * @param string $message + * @return bool + */ + protected function isUnique($key, $message) + { + $messages = (array) $this->messages; + + return ! isset($messages[$key]) || ! in_array($message, $messages[$key]); + } + + /** + * Merge a new array of messages into the message bag. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array $messages + * @return $this + */ + public function merge($messages) + { + if ($messages instanceof MessageProvider) { + $messages = $messages->getMessageBag()->getMessages(); + } + + $this->messages = array_merge_recursive($this->messages, $messages); + + return $this; + } + + /** + * Determine if messages exist for all of the given keys. + * + * @param array|string $key + * @return bool + */ + public function has($key) + { + if ($this->isEmpty()) { + return false; + } + + if (is_null($key)) { + return $this->any(); + } + + $keys = is_array($key) ? $key : func_get_args(); + + foreach ($keys as $key) { + if ($this->first($key) === '') { + return false; + } + } + + return true; + } + + /** + * Determine if messages exist for any of the given keys. + * + * @param array|string $keys + * @return bool + */ + public function hasAny($keys = []) + { + if ($this->isEmpty()) { + return false; + } + + $keys = is_array($keys) ? $keys : func_get_args(); + + foreach ($keys as $key) { + if ($this->has($key)) { + return true; + } + } + + return false; + } + + /** + * Get the first message from the message bag for a given key. + * + * @param string|null $key + * @param string|null $format + * @return string + */ + public function first($key = null, $format = null) + { + $messages = is_null($key) ? $this->all($format) : $this->get($key, $format); + + $firstMessage = Arr::first($messages, null, ''); + + return is_array($firstMessage) ? Arr::first($firstMessage) : $firstMessage; + } + + /** + * Get all of the messages from the message bag for a given key. + * + * @param string $key + * @param string $format + * @return array + */ + public function get($key, $format = null) + { + // If the message exists in the message bag, we will transform it and return + // the message. Otherwise, we will check if the key is implicit & collect + // all the messages that match the given key and output it as an array. + if (array_key_exists($key, $this->messages)) { + return $this->transform( + $this->messages[$key], $this->checkFormat($format), $key + ); + } + + if (Str::contains($key, '*')) { + return $this->getMessagesForWildcardKey($key, $format); + } + + return []; + } + + /** + * Get the messages for a wildcard key. + * + * @param string $key + * @param string|null $format + * @return array + */ + protected function getMessagesForWildcardKey($key, $format) + { + return collect($this->messages) + ->filter(function ($messages, $messageKey) use ($key) { + return Str::is($key, $messageKey); + }) + ->map(function ($messages, $messageKey) use ($format) { + return $this->transform( + $messages, $this->checkFormat($format), $messageKey + ); + })->all(); + } + + /** + * Get all of the messages for every key in the message bag. + * + * @param string $format + * @return array + */ + public function all($format = null) + { + $format = $this->checkFormat($format); + + $all = []; + + foreach ($this->messages as $key => $messages) { + $all = array_merge($all, $this->transform($messages, $format, $key)); + } + + return $all; + } + + /** + * Get all of the unique messages for every key in the message bag. + * + * @param string $format + * @return array + */ + public function unique($format = null) + { + return array_unique($this->all($format)); + } + + /** + * Format an array of messages. + * + * @param array $messages + * @param string $format + * @param string $messageKey + * @return array + */ + protected function transform($messages, $format, $messageKey) + { + return collect((array) $messages) + ->map(function ($message) use ($format, $messageKey) { + // We will simply spin through the given messages and transform each one + // replacing the :message place holder with the real message allowing + // the messages to be easily formatted to each developer's desires. + return str_replace([':message', ':key'], [$message, $messageKey], $format); + })->all(); + } + + /** + * Get the appropriate format based on the given format. + * + * @param string $format + * @return string + */ + protected function checkFormat($format) + { + return $format ?: $this->format; + } + + /** + * Get the raw messages in the message bag. + * + * @return array + */ + public function messages() + { + return $this->messages; + } + + /** + * Get the raw messages in the message bag. + * + * @return array + */ + public function getMessages() + { + return $this->messages(); + } + + /** + * Get the messages for the instance. + * + * @return \Illuminate\Support\MessageBag + */ + public function getMessageBag() + { + return $this; + } + + /** + * Get the default message format. + * + * @return string + */ + public function getFormat() + { + return $this->format; + } + + /** + * Set the default message format. + * + * @param string $format + * @return \Illuminate\Support\MessageBag + */ + public function setFormat($format = ':message') + { + $this->format = $format; + + return $this; + } + + /** + * Determine if the message bag has any messages. + * + * @return bool + */ + public function isEmpty() + { + return ! $this->any(); + } + + /** + * Determine if the message bag has any messages. + * + * @return bool + */ + public function isNotEmpty() + { + return $this->any(); + } + + /** + * Determine if the message bag has any messages. + * + * @return bool + */ + public function any() + { + return $this->count() > 0; + } + + /** + * Get the number of messages in the message bag. + * + * @return int + */ + public function count() + { + return count($this->messages, COUNT_RECURSIVE) - count($this->messages); + } + + /** + * Get the instance as an array. + * + * @return array + */ + public function toArray() + { + return $this->getMessages(); + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Convert the object to its JSON representation. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->jsonSerialize(), $options); + } + + /** + * Convert the message bag to its string representation. + * + * @return string + */ + public function __toString() + { + return $this->toJson(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php b/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php new file mode 100755 index 00000000..e9251db6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php @@ -0,0 +1,102 @@ +parsed[$key])) { + return $this->parsed[$key]; + } + + // If the key does not contain a double colon, it means the key is not in a + // namespace, and is just a regular configuration item. Namespaces are a + // tool for organizing configuration items for things such as modules. + if (strpos($key, '::') === false) { + $segments = explode('.', $key); + + $parsed = $this->parseBasicSegments($segments); + } else { + $parsed = $this->parseNamespacedSegments($key); + } + + // Once we have the parsed array of this key's elements, such as its groups + // and namespace, we will cache each array inside a simple list that has + // the key and the parsed array for quick look-ups for later requests. + return $this->parsed[$key] = $parsed; + } + + /** + * Parse an array of basic segments. + * + * @param array $segments + * @return array + */ + protected function parseBasicSegments(array $segments) + { + // The first segment in a basic array will always be the group, so we can go + // ahead and grab that segment. If there is only one total segment we are + // just pulling an entire group out of the array and not a single item. + $group = $segments[0]; + + // If there is more than one segment in this group, it means we are pulling + // a specific item out of a group and will need to return this item name + // as well as the group so we know which item to pull from the arrays. + $item = count($segments) === 1 + ? null + : implode('.', array_slice($segments, 1)); + + return [null, $group, $item]; + } + + /** + * Parse an array of namespaced segments. + * + * @param string $key + * @return array + */ + protected function parseNamespacedSegments($key) + { + [$namespace, $item] = explode('::', $key); + + // First we'll just explode the first segment to get the namespace and group + // since the item should be in the remaining segments. Once we have these + // two pieces of data we can proceed with parsing out the item's value. + $itemSegments = explode('.', $item); + + $groupAndItem = array_slice( + $this->parseBasicSegments($itemSegments), 1 + ); + + return array_merge([$namespace], $groupAndItem); + } + + /** + * Set the parsed value of a key. + * + * @param string $key + * @param array $parsed + * @return void + */ + public function setParsedKey($key, $parsed) + { + $this->parsed[$key] = $parsed; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Optional.php b/vendor/laravel/framework/src/Illuminate/Support/Optional.php new file mode 100644 index 00000000..5e0b7d9c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Optional.php @@ -0,0 +1,130 @@ +value = $value; + } + + /** + * Dynamically access a property on the underlying object. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + if (is_object($this->value)) { + return $this->value->{$key} ?? null; + } + } + + /** + * Dynamically check a property exists on the underlying object. + * + * @param mixed $name + * @return bool + */ + public function __isset($name) + { + if (is_object($this->value)) { + return isset($this->value->{$name}); + } + + if (is_array($this->value) || $this->value instanceof ArrayObject) { + return isset($this->value[$name]); + } + + return false; + } + + /** + * Determine if an item exists at an offset. + * + * @param mixed $key + * @return bool + */ + public function offsetExists($key) + { + return Arr::accessible($this->value) && Arr::exists($this->value, $key); + } + + /** + * Get an item at a given offset. + * + * @param mixed $key + * @return mixed + */ + public function offsetGet($key) + { + return Arr::get($this->value, $key); + } + + /** + * Set the item at a given offset. + * + * @param mixed $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + if (Arr::accessible($this->value)) { + $this->value[$key] = $value; + } + } + + /** + * Unset the item at a given offset. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + if (Arr::accessible($this->value)) { + unset($this->value[$key]); + } + } + + /** + * Dynamically pass a method to the underlying object. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + if (is_object($this->value)) { + return $this->value->{$method}(...$parameters); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php b/vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php new file mode 100755 index 00000000..03719d4e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php @@ -0,0 +1,147 @@ +pluralize($value); + + return static::matchCase($plural, $value); + } + + /** + * Get the singular form of an English word. + * + * @param string $value + * @return string + */ + public static function singular($value) + { + $singular = static::inflector()->singularize($value); + + return static::matchCase($singular, $value); + } + + /** + * Determine if the given value is uncountable. + * + * @param string $value + * @return bool + */ + protected static function uncountable($value) + { + return in_array(strtolower($value), static::$uncountable); + } + + /** + * Attempt to match the case on two strings. + * + * @param string $value + * @param string $comparison + * @return string + */ + protected static function matchCase($value, $comparison) + { + $functions = ['mb_strtolower', 'mb_strtoupper', 'ucfirst', 'ucwords']; + + foreach ($functions as $function) { + if ($function($comparison) === $comparison) { + return $function($value); + } + } + + return $value; + } + + /** + * Get the inflector instance. + * + * @return \Doctrine\Inflector\Inflector + */ + public static function inflector() + { + static $inflector; + + if (is_null($inflector)) { + $inflector = new Inflector( + new CachedWordInflector(new RulesetInflector( + English\Rules::getSingularRuleset() + )), + new CachedWordInflector(new RulesetInflector( + English\Rules::getPluralRuleset() + )) + ); + } + + return $inflector; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/ProcessUtils.php b/vendor/laravel/framework/src/Illuminate/Support/ProcessUtils.php new file mode 100644 index 00000000..1caa9e16 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/ProcessUtils.php @@ -0,0 +1,69 @@ +isPublic(); + } + + if (is_object($var[0]) && method_exists($class, '__call')) { + return (new ReflectionMethod($class, '__call'))->isPublic(); + } + + if (! is_object($var[0]) && method_exists($class, '__callStatic')) { + return (new ReflectionMethod($class, '__callStatic'))->isPublic(); + } + + return false; + } + + /** + * Get the class name of the given parameter's type, if possible. + * + * @param \ReflectionParameter $parameter + * @return string|null + */ + public static function getParameterClassName($parameter) + { + $type = $parameter->getType(); + + if (! $type instanceof ReflectionNamedType || $type->isBuiltin()) { + return; + } + + $name = $type->getName(); + + if (! is_null($class = $parameter->getDeclaringClass())) { + if ($name === 'self') { + return $class->getName(); + } + + if ($name === 'parent' && $parent = $class->getParentClass()) { + return $parent->getName(); + } + } + + return $name; + } + + /** + * Determine if the parameter's type is a subclass of the given type. + * + * @param \ReflectionParameter $parameter + * @param string $className + * @return bool + */ + public static function isParameterSubclassOf($parameter, $className) + { + $paramClassName = static::getParameterClassName($parameter); + + return ($paramClassName && class_exists($paramClassName)) + ? (new ReflectionClass($paramClassName))->isSubclassOf($className) + : false; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php new file mode 100755 index 00000000..983940bd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php @@ -0,0 +1,345 @@ +app = $app; + } + + /** + * Register any application services. + * + * @return void + */ + public function register() + { + // + } + + /** + * Merge the given configuration with the existing configuration. + * + * @param string $path + * @param string $key + * @return void + */ + protected function mergeConfigFrom($path, $key) + { + if (! $this->app->configurationIsCached()) { + $this->app['config']->set($key, array_merge( + require $path, $this->app['config']->get($key, []) + )); + } + } + + /** + * Load the given routes file if routes are not already cached. + * + * @param string $path + * @return void + */ + protected function loadRoutesFrom($path) + { + if (! $this->app->routesAreCached()) { + require $path; + } + } + + /** + * Register a view file namespace. + * + * @param string|array $path + * @param string $namespace + * @return void + */ + protected function loadViewsFrom($path, $namespace) + { + $this->callAfterResolving('view', function ($view) use ($path, $namespace) { + if (isset($this->app->config['view']['paths']) && + is_array($this->app->config['view']['paths'])) { + foreach ($this->app->config['view']['paths'] as $viewPath) { + if (is_dir($appPath = $viewPath.'/vendor/'.$namespace)) { + $view->addNamespace($namespace, $appPath); + } + } + } + + $view->addNamespace($namespace, $path); + }); + } + + /** + * Register a translation file namespace. + * + * @param string $path + * @param string $namespace + * @return void + */ + protected function loadTranslationsFrom($path, $namespace) + { + $this->callAfterResolving('translator', function ($translator) use ($path, $namespace) { + $translator->addNamespace($namespace, $path); + }); + } + + /** + * Register a JSON translation file path. + * + * @param string $path + * @return void + */ + protected function loadJsonTranslationsFrom($path) + { + $this->callAfterResolving('translator', function ($translator) use ($path) { + $translator->addJsonPath($path); + }); + } + + /** + * Register database migration paths. + * + * @param array|string $paths + * @return void + */ + protected function loadMigrationsFrom($paths) + { + $this->callAfterResolving('migrator', function ($migrator) use ($paths) { + foreach ((array) $paths as $path) { + $migrator->path($path); + } + }); + } + + /** + * Register Eloquent model factory paths. + * + * @param array|string $paths + * @return void + */ + protected function loadFactoriesFrom($paths) + { + $this->callAfterResolving(ModelFactory::class, function ($factory) use ($paths) { + foreach ((array) $paths as $path) { + $factory->load($path); + } + }); + } + + /** + * Setup an after resolving listener, or fire immediately if already resolved. + * + * @param string $name + * @param callable $callback + * @return void + */ + protected function callAfterResolving($name, $callback) + { + $this->app->afterResolving($name, $callback); + + if ($this->app->resolved($name)) { + $callback($this->app->make($name), $this->app); + } + } + + /** + * Register paths to be published by the publish command. + * + * @param array $paths + * @param mixed $groups + * @return void + */ + protected function publishes(array $paths, $groups = null) + { + $this->ensurePublishArrayInitialized($class = static::class); + + static::$publishes[$class] = array_merge(static::$publishes[$class], $paths); + + foreach ((array) $groups as $group) { + $this->addPublishGroup($group, $paths); + } + } + + /** + * Ensure the publish array for the service provider is initialized. + * + * @param string $class + * @return void + */ + protected function ensurePublishArrayInitialized($class) + { + if (! array_key_exists($class, static::$publishes)) { + static::$publishes[$class] = []; + } + } + + /** + * Add a publish group / tag to the service provider. + * + * @param string $group + * @param array $paths + * @return void + */ + protected function addPublishGroup($group, $paths) + { + if (! array_key_exists($group, static::$publishGroups)) { + static::$publishGroups[$group] = []; + } + + static::$publishGroups[$group] = array_merge( + static::$publishGroups[$group], $paths + ); + } + + /** + * Get the paths to publish. + * + * @param string|null $provider + * @param string|null $group + * @return array + */ + public static function pathsToPublish($provider = null, $group = null) + { + if (! is_null($paths = static::pathsForProviderOrGroup($provider, $group))) { + return $paths; + } + + return collect(static::$publishes)->reduce(function ($paths, $p) { + return array_merge($paths, $p); + }, []); + } + + /** + * Get the paths for the provider or group (or both). + * + * @param string|null $provider + * @param string|null $group + * @return array + */ + protected static function pathsForProviderOrGroup($provider, $group) + { + if ($provider && $group) { + return static::pathsForProviderAndGroup($provider, $group); + } elseif ($group && array_key_exists($group, static::$publishGroups)) { + return static::$publishGroups[$group]; + } elseif ($provider && array_key_exists($provider, static::$publishes)) { + return static::$publishes[$provider]; + } elseif ($group || $provider) { + return []; + } + } + + /** + * Get the paths for the provider and group. + * + * @param string $provider + * @param string $group + * @return array + */ + protected static function pathsForProviderAndGroup($provider, $group) + { + if (! empty(static::$publishes[$provider]) && ! empty(static::$publishGroups[$group])) { + return array_intersect_key(static::$publishes[$provider], static::$publishGroups[$group]); + } + + return []; + } + + /** + * Get the service providers available for publishing. + * + * @return array + */ + public static function publishableProviders() + { + return array_keys(static::$publishes); + } + + /** + * Get the groups available for publishing. + * + * @return array + */ + public static function publishableGroups() + { + return array_keys(static::$publishGroups); + } + + /** + * Register the package's custom Artisan commands. + * + * @param array|mixed $commands + * @return void + */ + public function commands($commands) + { + $commands = is_array($commands) ? $commands : func_get_args(); + + Artisan::starting(function ($artisan) use ($commands) { + $artisan->resolveCommands($commands); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return []; + } + + /** + * Get the events that trigger this service provider to register. + * + * @return array + */ + public function when() + { + return []; + } + + /** + * Determine if the provider is deferred. + * + * @return bool + */ + public function isDeferred() + { + return $this instanceof DeferrableProvider; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Str.php b/vendor/laravel/framework/src/Illuminate/Support/Str.php new file mode 100644 index 00000000..3497e851 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Str.php @@ -0,0 +1,867 @@ + $val) { + $value = str_replace($val, $key, $value); + } + + return preg_replace('/[^\x20-\x7E]/u', '', $value); + } + + /** + * Get the portion of a string before the first occurrence of a given value. + * + * @param string $subject + * @param string $search + * @return string + */ + public static function before($subject, $search) + { + return $search === '' ? $subject : explode($search, $subject)[0]; + } + + /** + * Get the portion of a string before the last occurrence of a given value. + * + * @param string $subject + * @param string $search + * @return string + */ + public static function beforeLast($subject, $search) + { + if ($search === '') { + return $subject; + } + + $pos = mb_strrpos($subject, $search); + + if ($pos === false) { + return $subject; + } + + return static::substr($subject, 0, $pos); + } + + /** + * Convert a value to camel case. + * + * @param string $value + * @return string + */ + public static function camel($value) + { + if (isset(static::$camelCache[$value])) { + return static::$camelCache[$value]; + } + + return static::$camelCache[$value] = lcfirst(static::studly($value)); + } + + /** + * Determine if a given string contains a given substring. + * + * @param string $haystack + * @param string|string[] $needles + * @return bool + */ + public static function contains($haystack, $needles) + { + foreach ((array) $needles as $needle) { + if ($needle !== '' && mb_strpos($haystack, $needle) !== false) { + return true; + } + } + + return false; + } + + /** + * Determine if a given string contains all array values. + * + * @param string $haystack + * @param string[] $needles + * @return bool + */ + public static function containsAll($haystack, array $needles) + { + foreach ($needles as $needle) { + if (! static::contains($haystack, $needle)) { + return false; + } + } + + return true; + } + + /** + * Determine if a given string ends with a given substring. + * + * @param string $haystack + * @param string|string[] $needles + * @return bool + */ + public static function endsWith($haystack, $needles) + { + foreach ((array) $needles as $needle) { + if (substr($haystack, -strlen($needle)) === (string) $needle) { + return true; + } + } + + return false; + } + + /** + * Cap a string with a single instance of a given value. + * + * @param string $value + * @param string $cap + * @return string + */ + public static function finish($value, $cap) + { + $quoted = preg_quote($cap, '/'); + + return preg_replace('/(?:'.$quoted.')+$/u', '', $value).$cap; + } + + /** + * Determine if a given string matches a given pattern. + * + * @param string|array $pattern + * @param string $value + * @return bool + */ + public static function is($pattern, $value) + { + $patterns = Arr::wrap($pattern); + + if (empty($patterns)) { + return false; + } + + foreach ($patterns as $pattern) { + // If the given value is an exact match we can of course return true right + // from the beginning. Otherwise, we will translate asterisks and do an + // actual pattern match against the two strings to see if they match. + if ($pattern == $value) { + return true; + } + + $pattern = preg_quote($pattern, '#'); + + // Asterisks are translated into zero-or-more regular expression wildcards + // to make it convenient to check if the strings starts with the given + // pattern such as "library/*", making any string check convenient. + $pattern = str_replace('\*', '.*', $pattern); + + if (preg_match('#^'.$pattern.'\z#u', $value) === 1) { + return true; + } + } + + return false; + } + + /** + * Determine if a given string is a valid UUID. + * + * @param string $value + * @return bool + */ + public static function isUuid($value) + { + if (! is_string($value)) { + return false; + } + + return preg_match('/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iD', $value) > 0; + } + + /** + * Convert a string to kebab case. + * + * @param string $value + * @return string + */ + public static function kebab($value) + { + return static::snake($value, '-'); + } + + /** + * Return the length of the given string. + * + * @param string $value + * @param string|null $encoding + * @return int + */ + public static function length($value, $encoding = null) + { + if ($encoding) { + return mb_strlen($value, $encoding); + } + + return mb_strlen($value); + } + + /** + * Limit the number of characters in a string. + * + * @param string $value + * @param int $limit + * @param string $end + * @return string + */ + public static function limit($value, $limit = 100, $end = '...') + { + if (mb_strwidth($value, 'UTF-8') <= $limit) { + return $value; + } + + return rtrim(mb_strimwidth($value, 0, $limit, '', 'UTF-8')).$end; + } + + /** + * Convert the given string to lower-case. + * + * @param string $value + * @return string + */ + public static function lower($value) + { + return mb_strtolower($value, 'UTF-8'); + } + + /** + * Limit the number of words in a string. + * + * @param string $value + * @param int $words + * @param string $end + * @return string + */ + public static function words($value, $words = 100, $end = '...') + { + preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches); + + if (! isset($matches[0]) || static::length($value) === static::length($matches[0])) { + return $value; + } + + return rtrim($matches[0]).$end; + } + + /** + * Parse a Class[@]method style callback into class and method. + * + * @param string $callback + * @param string|null $default + * @return array + */ + public static function parseCallback($callback, $default = null) + { + return static::contains($callback, '@') ? explode('@', $callback, 2) : [$callback, $default]; + } + + /** + * Get the plural form of an English word. + * + * @param string $value + * @param int $count + * @return string + */ + public static function plural($value, $count = 2) + { + return Pluralizer::plural($value, $count); + } + + /** + * Pluralize the last word of an English, studly caps case string. + * + * @param string $value + * @param int $count + * @return string + */ + public static function pluralStudly($value, $count = 2) + { + $parts = preg_split('/(.)(?=[A-Z])/u', $value, -1, PREG_SPLIT_DELIM_CAPTURE); + + $lastWord = array_pop($parts); + + return implode('', $parts).self::plural($lastWord, $count); + } + + /** + * Generate a more truly "random" alpha-numeric string. + * + * @param int $length + * @return string + */ + public static function random($length = 16) + { + $string = ''; + + while (($len = strlen($string)) < $length) { + $size = $length - $len; + + $bytes = random_bytes($size); + + $string .= substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $size); + } + + return $string; + } + + /** + * Replace a given value in the string sequentially with an array. + * + * @param string $search + * @param array $replace + * @param string $subject + * @return string + */ + public static function replaceArray($search, array $replace, $subject) + { + $segments = explode($search, $subject); + + $result = array_shift($segments); + + foreach ($segments as $segment) { + $result .= (array_shift($replace) ?? $search).$segment; + } + + return $result; + } + + /** + * Replace the first occurrence of a given value in the string. + * + * @param string $search + * @param string $replace + * @param string $subject + * @return string + */ + public static function replaceFirst($search, $replace, $subject) + { + if ($search == '') { + return $subject; + } + + $position = strpos($subject, $search); + + if ($position !== false) { + return substr_replace($subject, $replace, $position, strlen($search)); + } + + return $subject; + } + + /** + * Replace the last occurrence of a given value in the string. + * + * @param string $search + * @param string $replace + * @param string $subject + * @return string + */ + public static function replaceLast($search, $replace, $subject) + { + if ($search === '') { + return $subject; + } + + $position = strrpos($subject, $search); + + if ($position !== false) { + return substr_replace($subject, $replace, $position, strlen($search)); + } + + return $subject; + } + + /** + * Begin a string with a single instance of a given value. + * + * @param string $value + * @param string $prefix + * @return string + */ + public static function start($value, $prefix) + { + $quoted = preg_quote($prefix, '/'); + + return $prefix.preg_replace('/^(?:'.$quoted.')+/u', '', $value); + } + + /** + * Convert the given string to upper-case. + * + * @param string $value + * @return string + */ + public static function upper($value) + { + return mb_strtoupper($value, 'UTF-8'); + } + + /** + * Convert the given string to title case. + * + * @param string $value + * @return string + */ + public static function title($value) + { + return mb_convert_case($value, MB_CASE_TITLE, 'UTF-8'); + } + + /** + * Get the singular form of an English word. + * + * @param string $value + * @return string + */ + public static function singular($value) + { + return Pluralizer::singular($value); + } + + /** + * Generate a URL friendly "slug" from a given string. + * + * @param string $title + * @param string $separator + * @param string|null $language + * @return string + */ + public static function slug($title, $separator = '-', $language = 'en') + { + $title = $language ? static::ascii($title, $language) : $title; + + // Convert all dashes/underscores into separator + $flip = $separator === '-' ? '_' : '-'; + + $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title); + + // Replace @ with the word 'at' + $title = str_replace('@', $separator.'at'.$separator, $title); + + // Remove all characters that are not the separator, letters, numbers, or whitespace. + $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', static::lower($title)); + + // Replace all separator characters and whitespace by a single separator + $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title); + + return trim($title, $separator); + } + + /** + * Convert a string to snake case. + * + * @param string $value + * @param string $delimiter + * @return string + */ + public static function snake($value, $delimiter = '_') + { + $key = $value; + + if (isset(static::$snakeCache[$key][$delimiter])) { + return static::$snakeCache[$key][$delimiter]; + } + + if (! ctype_lower($value)) { + $value = preg_replace('/\s+/u', '', ucwords($value)); + + $value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value)); + } + + return static::$snakeCache[$key][$delimiter] = $value; + } + + /** + * Determine if a given string starts with a given substring. + * + * @param string $haystack + * @param string|string[] $needles + * @return bool + */ + public static function startsWith($haystack, $needles) + { + foreach ((array) $needles as $needle) { + if ($needle !== '' && substr($haystack, 0, strlen($needle)) === (string) $needle) { + return true; + } + } + + return false; + } + + /** + * Convert a value to studly caps case. + * + * @param string $value + * @return string + */ + public static function studly($value) + { + $key = $value; + + if (isset(static::$studlyCache[$key])) { + return static::$studlyCache[$key]; + } + + $value = ucwords(str_replace(['-', '_'], ' ', $value)); + + return static::$studlyCache[$key] = str_replace(' ', '', $value); + } + + /** + * Returns the portion of string specified by the start and length parameters. + * + * @param string $string + * @param int $start + * @param int|null $length + * @return string + */ + public static function substr($string, $start, $length = null) + { + return mb_substr($string, $start, $length, 'UTF-8'); + } + + /** + * Make a string's first character uppercase. + * + * @param string $string + * @return string + */ + public static function ucfirst($string) + { + return static::upper(static::substr($string, 0, 1)).static::substr($string, 1); + } + + /** + * Generate a UUID (version 4). + * + * @return \Ramsey\Uuid\UuidInterface + */ + public static function uuid() + { + return static::$uuidFactory + ? call_user_func(static::$uuidFactory) + : Uuid::uuid4(); + } + + /** + * Generate a time-ordered UUID (version 4). + * + * @return \Ramsey\Uuid\UuidInterface + */ + public static function orderedUuid() + { + if (static::$uuidFactory) { + return call_user_func(static::$uuidFactory); + } + + $factory = new UuidFactory(); + + $factory->setRandomGenerator(new CombGenerator( + $factory->getRandomGenerator(), + $factory->getNumberConverter() + )); + + $factory->setCodec(new TimestampFirstCombCodec( + $factory->getUuidBuilder() + )); + + return $factory->uuid4(); + } + + /** + * Set the callable that will be used to generate UUIDs. + * + * @param callable $factory + * @return void + */ + public static function createUuidsUsing(callable $factory = null) + { + static::$uuidFactory = $factory; + } + + /** + * Indicate that UUIDs should be created normally and not using a custom factory. + * + * @return void + */ + public static function createUuidsNormally() + { + static::$uuidFactory = null; + } + + /** + * Returns the replacements for the ascii method. + * + * Note: Adapted from Stringy\Stringy. + * + * @see https://github.com/danielstjules/Stringy/blob/3.1.0/LICENSE.txt + * + * @return array + */ + protected static 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' => ['ц', 'ც', 'წ'], + 'ue' => ['ü'], + '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 the language specific replacements for the ascii method. + * + * Note: Adapted from Stringy\Stringy. + * + * @see https://github.com/danielstjules/Stringy/blob/3.1.0/LICENSE.txt + * + * @param string $language + * @return array|null + */ + protected static function languageSpecificCharsArray($language) + { + static $languageSpecific; + + if (! isset($languageSpecific)) { + $languageSpecific = [ + 'bg' => [ + ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'], + ['h', 'H', 'sht', 'SHT', 'a', 'А', 'y', 'Y'], + ], + 'da' => [ + ['æ', 'ø', 'å', 'Æ', 'Ø', 'Å'], + ['ae', 'oe', 'aa', 'Ae', 'Oe', 'Aa'], + ], + 'de' => [ + ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'], + ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], + ], + 'he' => [ + ['א', 'ב', 'ג', 'ד', 'ה', 'ו'], + ['ז', 'ח', 'ט', 'י', 'כ', 'ל'], + ['מ', 'נ', 'ס', 'ע', 'פ', 'צ'], + ['ק', 'ר', 'ש', 'ת', 'ן', 'ץ', 'ך', 'ם', 'ף'], + ], + 'ro' => [ + ['ă', 'â', 'î', 'ș', 'ț', 'Ă', 'Â', 'Î', 'Ș', 'Ț'], + ['a', 'a', 'i', 's', 't', 'A', 'A', 'I', 'S', 'T'], + ], + ]; + } + + return $languageSpecific[$language] ?? null; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/BusFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/BusFake.php new file mode 100644 index 00000000..7a5f0eb2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/BusFake.php @@ -0,0 +1,336 @@ +dispatcher = $dispatcher; + + $this->jobsToFake = Arr::wrap($jobsToFake); + } + + /** + * Assert if a job was dispatched based on a truth-test callback. + * + * @param string $command + * @param callable|int|null $callback + * @return void + */ + public function assertDispatched($command, $callback = null) + { + if (is_numeric($callback)) { + return $this->assertDispatchedTimes($command, $callback); + } + + PHPUnit::assertTrue( + $this->dispatched($command, $callback)->count() > 0 || + $this->dispatchedAfterResponse($command, $callback)->count() > 0, + "The expected [{$command}] job was not dispatched." + ); + } + + /** + * Assert if a job was pushed a number of times. + * + * @param string $command + * @param int $times + * @return void + */ + public function assertDispatchedTimes($command, $times = 1) + { + $count = $this->dispatched($command)->count() + + $this->dispatchedAfterResponse($command)->count(); + + PHPUnit::assertTrue( + $count === $times, + "The expected [{$command}] job was pushed {$count} times instead of {$times} times." + ); + } + + /** + * Determine if a job was dispatched based on a truth-test callback. + * + * @param string $command + * @param callable|null $callback + * @return void + */ + public function assertNotDispatched($command, $callback = null) + { + PHPUnit::assertTrue( + $this->dispatched($command, $callback)->count() === 0 && + $this->dispatchedAfterResponse($command, $callback)->count() === 0, + "The unexpected [{$command}] job was dispatched." + ); + } + + /** + * Assert if a job was dispatched after the response was sent based on a truth-test callback. + * + * @param string $command + * @param callable|int|null $callback + * @return void + */ + public function assertDispatchedAfterResponse($command, $callback = null) + { + if (is_numeric($callback)) { + return $this->assertDispatchedAfterResponseTimes($command, $callback); + } + + PHPUnit::assertTrue( + $this->dispatchedAfterResponse($command, $callback)->count() > 0, + "The expected [{$command}] job was not dispatched for after sending the response." + ); + } + + /** + * Assert if a job was pushed after the response was sent a number of times. + * + * @param string $command + * @param int $times + * @return void + */ + public function assertDispatchedAfterResponseTimes($command, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->dispatchedAfterResponse($command)->count()) === $times, + "The expected [{$command}] job was pushed {$count} times instead of {$times} times." + ); + } + + /** + * Determine if a job was dispatched based on a truth-test callback. + * + * @param string $command + * @param callable|null $callback + * @return void + */ + public function assertNotDispatchedAfterResponse($command, $callback = null) + { + PHPUnit::assertTrue( + $this->dispatchedAfterResponse($command, $callback)->count() === 0, + "The unexpected [{$command}] job was dispatched for after sending the response." + ); + } + + /** + * Get all of the jobs matching a truth-test callback. + * + * @param string $command + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function dispatched($command, $callback = null) + { + if (! $this->hasDispatched($command)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + return collect($this->commands[$command])->filter(function ($command) use ($callback) { + return $callback($command); + }); + } + + /** + * Get all of the jobs dispatched after the response was sent matching a truth-test callback. + * + * @param string $command + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function dispatchedAfterResponse(string $command, $callback = null) + { + if (! $this->hasDispatchedAfterResponse($command)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + return collect($this->commandsAfterResponse[$command])->filter(function ($command) use ($callback) { + return $callback($command); + }); + } + + /** + * Determine if there are any stored commands for a given class. + * + * @param string $command + * @return bool + */ + public function hasDispatched($command) + { + return isset($this->commands[$command]) && ! empty($this->commands[$command]); + } + + /** + * Determine if there are any stored commands for a given class. + * + * @param string $command + * @return bool + */ + public function hasDispatchedAfterResponse($command) + { + return isset($this->commandsAfterResponse[$command]) && ! empty($this->commandsAfterResponse[$command]); + } + + /** + * Dispatch a command to its appropriate handler. + * + * @param mixed $command + * @return mixed + */ + public function dispatch($command) + { + if ($this->shouldFakeJob($command)) { + $this->commands[get_class($command)][] = $command; + } else { + return $this->dispatcher->dispatch($command); + } + } + + /** + * Dispatch a command to its appropriate handler in the current process. + * + * @param mixed $command + * @param mixed $handler + * @return mixed + */ + public function dispatchNow($command, $handler = null) + { + if ($this->shouldFakeJob($command)) { + $this->commands[get_class($command)][] = $command; + } else { + return $this->dispatcher->dispatchNow($command, $handler); + } + } + + /** + * Dispatch a command to its appropriate handler. + * + * @param mixed $command + * @return mixed + */ + public function dispatchAfterResponse($command) + { + if ($this->shouldFakeJob($command)) { + $this->commandsAfterResponse[get_class($command)][] = $command; + } else { + return $this->dispatcher->dispatch($command); + } + } + + /** + * Determine if an command should be faked or actually dispatched. + * + * @param mixed $command + * @return bool + */ + protected function shouldFakeJob($command) + { + if (empty($this->jobsToFake)) { + return true; + } + + return collect($this->jobsToFake) + ->filter(function ($job) use ($command) { + return $job instanceof Closure + ? $job($command) + : $job === get_class($command); + })->isNotEmpty(); + } + + /** + * Set the pipes commands should be piped through before dispatching. + * + * @param array $pipes + * @return $this + */ + public function pipeThrough(array $pipes) + { + $this->dispatcher->pipeThrough($pipes); + + return $this; + } + + /** + * Determine if the given command has a handler. + * + * @param mixed $command + * @return bool + */ + public function hasCommandHandler($command) + { + return $this->dispatcher->hasCommandHandler($command); + } + + /** + * Retrieve the handler for a command. + * + * @param mixed $command + * @return mixed + */ + public function getCommandHandler($command) + { + return $this->dispatcher->getCommandHandler($command); + } + + /** + * Map a command to a handler. + * + * @param array $map + * @return $this + */ + public function map(array $map) + { + $this->dispatcher->map($map); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/EventFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/EventFake.php new file mode 100644 index 00000000..7fe7ccc8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/EventFake.php @@ -0,0 +1,259 @@ +dispatcher = $dispatcher; + + $this->eventsToFake = Arr::wrap($eventsToFake); + } + + /** + * Assert if an event was dispatched based on a truth-test callback. + * + * @param string $event + * @param callable|int|null $callback + * @return void + */ + public function assertDispatched($event, $callback = null) + { + if (is_int($callback)) { + return $this->assertDispatchedTimes($event, $callback); + } + + PHPUnit::assertTrue( + $this->dispatched($event, $callback)->count() > 0, + "The expected [{$event}] event was not dispatched." + ); + } + + /** + * Assert if a event was dispatched a number of times. + * + * @param string $event + * @param int $times + * @return void + */ + public function assertDispatchedTimes($event, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->dispatched($event)->count()) === $times, + "The expected [{$event}] event was dispatched {$count} times instead of {$times} times." + ); + } + + /** + * Determine if an event was dispatched based on a truth-test callback. + * + * @param string $event + * @param callable|null $callback + * @return void + */ + public function assertNotDispatched($event, $callback = null) + { + PHPUnit::assertTrue( + $this->dispatched($event, $callback)->count() === 0, + "The unexpected [{$event}] event was dispatched." + ); + } + + /** + * Get all of the events matching a truth-test callback. + * + * @param string $event + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function dispatched($event, $callback = null) + { + if (! $this->hasDispatched($event)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + return collect($this->events[$event])->filter(function ($arguments) use ($callback) { + return $callback(...$arguments); + }); + } + + /** + * Determine if the given event has been dispatched. + * + * @param string $event + * @return bool + */ + public function hasDispatched($event) + { + return isset($this->events[$event]) && ! empty($this->events[$event]); + } + + /** + * Register an event listener with the dispatcher. + * + * @param string|array $events + * @param mixed $listener + * @return void + */ + public function listen($events, $listener) + { + $this->dispatcher->listen($events, $listener); + } + + /** + * Determine if a given event has listeners. + * + * @param string $eventName + * @return bool + */ + public function hasListeners($eventName) + { + return $this->dispatcher->hasListeners($eventName); + } + + /** + * Register an event and payload to be dispatched later. + * + * @param string $event + * @param array $payload + * @return void + */ + public function push($event, $payload = []) + { + // + } + + /** + * Register an event subscriber with the dispatcher. + * + * @param object|string $subscriber + * @return void + */ + public function subscribe($subscriber) + { + $this->dispatcher->subscribe($subscriber); + } + + /** + * Flush a set of pushed events. + * + * @param string $event + * @return void + */ + public function flush($event) + { + // + } + + /** + * Fire an event and call the listeners. + * + * @param string|object $event + * @param mixed $payload + * @param bool $halt + * @return array|null + */ + public function dispatch($event, $payload = [], $halt = false) + { + $name = is_object($event) ? get_class($event) : (string) $event; + + if ($this->shouldFakeEvent($name, $payload)) { + $this->events[$name][] = func_get_args(); + } else { + return $this->dispatcher->dispatch($event, $payload, $halt); + } + } + + /** + * Determine if an event should be faked or actually dispatched. + * + * @param string $eventName + * @param mixed $payload + * @return bool + */ + protected function shouldFakeEvent($eventName, $payload) + { + if (empty($this->eventsToFake)) { + return true; + } + + return collect($this->eventsToFake) + ->filter(function ($event) use ($eventName, $payload) { + return $event instanceof Closure + ? $event($eventName, $payload) + : $event === $eventName; + }) + ->isNotEmpty(); + } + + /** + * Remove a set of listeners from the dispatcher. + * + * @param string $event + * @return void + */ + public function forget($event) + { + // + } + + /** + * Forget all of the queued listeners. + * + * @return void + */ + public function forgetPushed() + { + // + } + + /** + * Dispatch an event and call the listeners. + * + * @param string|object $event + * @param mixed $payload + * @return void + */ + public function until($event, $payload = []) + { + return $this->dispatch($event, $payload, true); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/MailFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/MailFake.php new file mode 100644 index 00000000..48fa7b95 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/MailFake.php @@ -0,0 +1,344 @@ +assertSentTimes($mailable, $callback); + } + + $message = "The expected [{$mailable}] mailable was not sent."; + + if (count($this->queuedMailables) > 0) { + $message .= ' Did you mean to use assertQueued() instead?'; + } + + PHPUnit::assertTrue( + $this->sent($mailable, $callback)->count() > 0, + $message + ); + } + + /** + * Assert if a mailable was sent a number of times. + * + * @param string $mailable + * @param int $times + * @return void + */ + protected function assertSentTimes($mailable, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->sent($mailable)->count()) === $times, + "The expected [{$mailable}] mailable was sent {$count} times instead of {$times} times." + ); + } + + /** + * Determine if a mailable was not sent based on a truth-test callback. + * + * @param string $mailable + * @param callable|null $callback + * @return void + */ + public function assertNotSent($mailable, $callback = null) + { + PHPUnit::assertTrue( + $this->sent($mailable, $callback)->count() === 0, + "The unexpected [{$mailable}] mailable was sent." + ); + } + + /** + * Assert that no mailables were sent. + * + * @return void + */ + public function assertNothingSent() + { + $mailableNames = collect($this->mailables)->map(function ($mailable) { + return get_class($mailable); + })->join(', '); + + PHPUnit::assertEmpty($this->mailables, 'The following mailables were sent unexpectedly: '.$mailableNames); + } + + /** + * Assert if a mailable was queued based on a truth-test callback. + * + * @param string $mailable + * @param callable|int|null $callback + * @return void + */ + public function assertQueued($mailable, $callback = null) + { + if (is_numeric($callback)) { + return $this->assertQueuedTimes($mailable, $callback); + } + + PHPUnit::assertTrue( + $this->queued($mailable, $callback)->count() > 0, + "The expected [{$mailable}] mailable was not queued." + ); + } + + /** + * Assert if a mailable was queued a number of times. + * + * @param string $mailable + * @param int $times + * @return void + */ + protected function assertQueuedTimes($mailable, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->queued($mailable)->count()) === $times, + "The expected [{$mailable}] mailable was queued {$count} times instead of {$times} times." + ); + } + + /** + * Determine if a mailable was not queued based on a truth-test callback. + * + * @param string $mailable + * @param callable|null $callback + * @return void + */ + public function assertNotQueued($mailable, $callback = null) + { + PHPUnit::assertTrue( + $this->queued($mailable, $callback)->count() === 0, + "The unexpected [{$mailable}] mailable was queued." + ); + } + + /** + * Assert that no mailables were queued. + * + * @return void + */ + public function assertNothingQueued() + { + $mailableNames = collect($this->queuedMailables)->map(function ($mailable) { + return get_class($mailable); + })->join(', '); + + PHPUnit::assertEmpty($this->queuedMailables, 'The following mailables were queued unexpectedly: '.$mailableNames); + } + + /** + * Get all of the mailables matching a truth-test callback. + * + * @param string $mailable + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function sent($mailable, $callback = null) + { + if (! $this->hasSent($mailable)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + return $this->mailablesOf($mailable)->filter(function ($mailable) use ($callback) { + return $callback($mailable); + }); + } + + /** + * Determine if the given mailable has been sent. + * + * @param string $mailable + * @return bool + */ + public function hasSent($mailable) + { + return $this->mailablesOf($mailable)->count() > 0; + } + + /** + * Get all of the queued mailables matching a truth-test callback. + * + * @param string $mailable + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function queued($mailable, $callback = null) + { + if (! $this->hasQueued($mailable)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + return $this->queuedMailablesOf($mailable)->filter(function ($mailable) use ($callback) { + return $callback($mailable); + }); + } + + /** + * Determine if the given mailable has been queued. + * + * @param string $mailable + * @return bool + */ + public function hasQueued($mailable) + { + return $this->queuedMailablesOf($mailable)->count() > 0; + } + + /** + * Get all of the mailed mailables for a given type. + * + * @param string $type + * @return \Illuminate\Support\Collection + */ + protected function mailablesOf($type) + { + return collect($this->mailables)->filter(function ($mailable) use ($type) { + return $mailable instanceof $type; + }); + } + + /** + * Get all of the mailed mailables for a given type. + * + * @param string $type + * @return \Illuminate\Support\Collection + */ + protected function queuedMailablesOf($type) + { + return collect($this->queuedMailables)->filter(function ($mailable) use ($type) { + return $mailable instanceof $type; + }); + } + + /** + * Begin the process of mailing a mailable class instance. + * + * @param mixed $users + * @return \Illuminate\Mail\PendingMail + */ + public function to($users) + { + return (new PendingMailFake($this))->to($users); + } + + /** + * Begin the process of mailing a mailable class instance. + * + * @param mixed $users + * @return \Illuminate\Mail\PendingMail + */ + public function bcc($users) + { + return (new PendingMailFake($this))->bcc($users); + } + + /** + * Send a new message with only a raw text part. + * + * @param string $text + * @param \Closure|string $callback + * @return void + */ + public function raw($text, $callback) + { + // + } + + /** + * Send a new message using a view. + * + * @param string|array $view + * @param array $data + * @param \Closure|string $callback + * @return void + */ + public function send($view, array $data = [], $callback = null) + { + if (! $view instanceof Mailable) { + return; + } + + if ($view instanceof ShouldQueue) { + return $this->queue($view, $data); + } + + $this->mailables[] = $view; + } + + /** + * Queue a new e-mail message for sending. + * + * @param \Illuminate\Contracts\Mail\Mailable|string|array $view + * @param string|null $queue + * @return mixed + */ + public function queue($view, $queue = null) + { + if (! $view instanceof Mailable) { + return; + } + + $this->queuedMailables[] = $view; + } + + /** + * Queue a new e-mail message for sending after (n) seconds. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param \Illuminate\Contracts\Mail\Mailable|string|array $view + * @param string $queue + * @return mixed + */ + public function later($delay, $view, $queue = null) + { + $this->queue($view, $queue); + } + + /** + * Get the array of failed recipients. + * + * @return array + */ + public function failures() + { + return []; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/NotificationFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/NotificationFake.php new file mode 100644 index 00000000..95edd71a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/NotificationFake.php @@ -0,0 +1,259 @@ +assertSentTo($singleNotifiable, $notification, $callback); + } + + return; + } + + if (is_numeric($callback)) { + return $this->assertSentToTimes($notifiable, $notification, $callback); + } + + PHPUnit::assertTrue( + $this->sent($notifiable, $notification, $callback)->count() > 0, + "The expected [{$notification}] notification was not sent." + ); + } + + /** + * Assert if a notification was sent a number of times. + * + * @param mixed $notifiable + * @param string $notification + * @param int $times + * @return void + */ + public function assertSentToTimes($notifiable, $notification, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->sent($notifiable, $notification)->count()) === $times, + "Expected [{$notification}] to be sent {$times} times, but was sent {$count} times." + ); + } + + /** + * Determine if a notification was sent based on a truth-test callback. + * + * @param mixed $notifiable + * @param string $notification + * @param callable|null $callback + * @return void + * + * @throws \Exception + */ + public function assertNotSentTo($notifiable, $notification, $callback = null) + { + if (is_array($notifiable) || $notifiable instanceof Collection) { + if (count($notifiable) === 0) { + throw new Exception('No notifiable given.'); + } + + foreach ($notifiable as $singleNotifiable) { + $this->assertNotSentTo($singleNotifiable, $notification, $callback); + } + + return; + } + + PHPUnit::assertTrue( + $this->sent($notifiable, $notification, $callback)->count() === 0, + "The unexpected [{$notification}] notification was sent." + ); + } + + /** + * Assert that no notifications were sent. + * + * @return void + */ + public function assertNothingSent() + { + PHPUnit::assertEmpty($this->notifications, 'Notifications were sent unexpectedly.'); + } + + /** + * Assert the total amount of times a notification was sent. + * + * @param int $expectedCount + * @param string $notification + * @return void + */ + public function assertTimesSent($expectedCount, $notification) + { + $actualCount = collect($this->notifications) + ->flatten(1) + ->reduce(function ($count, $sent) use ($notification) { + return $count + count($sent[$notification] ?? []); + }, 0); + + PHPUnit::assertSame( + $expectedCount, $actualCount, + "Expected [{$notification}] to be sent {$expectedCount} times, but was sent {$actualCount} times." + ); + } + + /** + * Get all of the notifications matching a truth-test callback. + * + * @param mixed $notifiable + * @param string $notification + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function sent($notifiable, $notification, $callback = null) + { + if (! $this->hasSent($notifiable, $notification)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + $notifications = collect($this->notificationsFor($notifiable, $notification)); + + return $notifications->filter(function ($arguments) use ($callback) { + return $callback(...array_values($arguments)); + })->pluck('notification'); + } + + /** + * Determine if there are more notifications left to inspect. + * + * @param mixed $notifiable + * @param string $notification + * @return bool + */ + public function hasSent($notifiable, $notification) + { + return ! empty($this->notificationsFor($notifiable, $notification)); + } + + /** + * Get all of the notifications for a notifiable entity by type. + * + * @param mixed $notifiable + * @param string $notification + * @return array + */ + protected function notificationsFor($notifiable, $notification) + { + return $this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification] ?? []; + } + + /** + * Send the given notification to the given notifiable entities. + * + * @param \Illuminate\Support\Collection|array|mixed $notifiables + * @param mixed $notification + * @return void + */ + public function send($notifiables, $notification) + { + return $this->sendNow($notifiables, $notification); + } + + /** + * Send the given notification immediately. + * + * @param \Illuminate\Support\Collection|array|mixed $notifiables + * @param mixed $notification + * @param array|null $channels + * @return void + */ + public function sendNow($notifiables, $notification, array $channels = null) + { + if (! $notifiables instanceof Collection && ! is_array($notifiables)) { + $notifiables = [$notifiables]; + } + + foreach ($notifiables as $notifiable) { + if (! $notification->id) { + $notification->id = Str::uuid()->toString(); + } + + $this->notifications[get_class($notifiable)][$notifiable->getKey()][get_class($notification)][] = [ + 'notification' => $notification, + 'channels' => $channels ?: $notification->via($notifiable), + 'notifiable' => $notifiable, + 'locale' => $notification->locale ?? $this->locale ?? value(function () use ($notifiable) { + if ($notifiable instanceof HasLocalePreference) { + return $notifiable->preferredLocale(); + } + }), + ]; + } + } + + /** + * Get a channel instance by name. + * + * @param string|null $name + * @return mixed + */ + public function channel($name = null) + { + // + } + + /** + * Set the locale of notifications. + * + * @param string $locale + * @return $this + */ + public function locale($locale) + { + $this->locale = $locale; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php new file mode 100644 index 00000000..223dd443 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php @@ -0,0 +1,53 @@ +mailer = $mailer; + } + + /** + * Send a new mailable message instance. + * + * @param \Illuminate\Contracts\Mail\Mailable $mailable + * @return mixed + */ + public function send(Mailable $mailable) + { + return $this->sendNow($mailable); + } + + /** + * Send a mailable message immediately. + * + * @param \Illuminate\Contracts\Mail\Mailable $mailable + * @return mixed + */ + public function sendNow(Mailable $mailable) + { + return $this->mailer->send($this->fill($mailable)); + } + + /** + * Push the given mailable onto the queue. + * + * @param \Illuminate\Contracts\Mail\Mailable $mailable + * @return mixed + */ + public function queue(Mailable $mailable) + { + return $this->mailer->queue($this->fill($mailable)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/QueueFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/QueueFake.php new file mode 100644 index 00000000..30bf327d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/QueueFake.php @@ -0,0 +1,396 @@ +assertPushedTimes($job, $callback); + } + + PHPUnit::assertTrue( + $this->pushed($job, $callback)->count() > 0, + "The expected [{$job}] job was not pushed." + ); + } + + /** + * Assert if a job was pushed a number of times. + * + * @param string $job + * @param int $times + * @return void + */ + protected function assertPushedTimes($job, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->pushed($job)->count()) === $times, + "The expected [{$job}] job was pushed {$count} times instead of {$times} times." + ); + } + + /** + * Assert if a job was pushed based on a truth-test callback. + * + * @param string $queue + * @param string $job + * @param callable|null $callback + * @return void + */ + public function assertPushedOn($queue, $job, $callback = null) + { + return $this->assertPushed($job, function ($job, $pushedQueue) use ($callback, $queue) { + if ($pushedQueue !== $queue) { + return false; + } + + return $callback ? $callback(...func_get_args()) : true; + }); + } + + /** + * Assert if a job was pushed with chained jobs based on a truth-test callback. + * + * @param string $job + * @param array $expectedChain + * @param callable|null $callback + * @return void + */ + public function assertPushedWithChain($job, $expectedChain = [], $callback = null) + { + PHPUnit::assertTrue( + $this->pushed($job, $callback)->isNotEmpty(), + "The expected [{$job}] job was not pushed." + ); + + PHPUnit::assertTrue( + collect($expectedChain)->isNotEmpty(), + 'The expected chain can not be empty.' + ); + + $this->isChainOfObjects($expectedChain) + ? $this->assertPushedWithChainOfObjects($job, $expectedChain, $callback) + : $this->assertPushedWithChainOfClasses($job, $expectedChain, $callback); + } + + /** + * Assert if a job was pushed with an empty chain based on a truth-test callback. + * + * @param string $job + * @param callable|null $callback + * @return void + */ + public function assertPushedWithoutChain($job, $callback = null) + { + PHPUnit::assertTrue( + $this->pushed($job, $callback)->isNotEmpty(), + "The expected [{$job}] job was not pushed." + ); + + $this->assertPushedWithChainOfClasses($job, [], $callback); + } + + /** + * Assert if a job was pushed with chained jobs based on a truth-test callback. + * + * @param string $job + * @param array $expectedChain + * @param callable|null $callback + * @return void + */ + protected function assertPushedWithChainOfObjects($job, $expectedChain, $callback) + { + $chain = collect($expectedChain)->map(function ($job) { + return serialize($job); + })->all(); + + PHPUnit::assertTrue( + $this->pushed($job, $callback)->filter(function ($job) use ($chain) { + return $job->chained == $chain; + })->isNotEmpty(), + 'The expected chain was not pushed.' + ); + } + + /** + * Assert if a job was pushed with chained jobs based on a truth-test callback. + * + * @param string $job + * @param array $expectedChain + * @param callable|null $callback + * @return void + */ + protected function assertPushedWithChainOfClasses($job, $expectedChain, $callback) + { + $matching = $this->pushed($job, $callback)->map->chained->map(function ($chain) { + return collect($chain)->map(function ($job) { + return get_class(unserialize($job)); + }); + })->filter(function ($chain) use ($expectedChain) { + return $chain->all() === $expectedChain; + }); + + PHPUnit::assertTrue( + $matching->isNotEmpty(), 'The expected chain was not pushed.' + ); + } + + /** + * Determine if the given chain is entirely composed of objects. + * + * @param array $chain + * @return bool + */ + protected function isChainOfObjects($chain) + { + return ! collect($chain)->contains(function ($job) { + return ! is_object($job); + }); + } + + /** + * Determine if a job was pushed based on a truth-test callback. + * + * @param string $job + * @param callable|null $callback + * @return void + */ + public function assertNotPushed($job, $callback = null) + { + PHPUnit::assertTrue( + $this->pushed($job, $callback)->count() === 0, + "The unexpected [{$job}] job was pushed." + ); + } + + /** + * Assert that no jobs were pushed. + * + * @return void + */ + public function assertNothingPushed() + { + PHPUnit::assertEmpty($this->jobs, 'Jobs were pushed unexpectedly.'); + } + + /** + * Get all of the jobs matching a truth-test callback. + * + * @param string $job + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function pushed($job, $callback = null) + { + if (! $this->hasPushed($job)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + return collect($this->jobs[$job])->filter(function ($data) use ($callback) { + return $callback($data['job'], $data['queue']); + })->pluck('job'); + } + + /** + * Determine if there are any stored jobs for a given class. + * + * @param string $job + * @return bool + */ + public function hasPushed($job) + { + return isset($this->jobs[$job]) && ! empty($this->jobs[$job]); + } + + /** + * Resolve a queue connection instance. + * + * @param mixed $value + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connection($value = null) + { + return $this; + } + + /** + * Get the size of the queue. + * + * @param string|null $queue + * @return int + */ + public function size($queue = null) + { + return collect($this->jobs)->flatten(1)->filter(function ($job) use ($queue) { + return $job['queue'] === $queue; + })->count(); + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string|null $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + $this->jobs[is_object($job) ? get_class($job) : $job][] = [ + 'job' => $job, + 'queue' => $queue, + ]; + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string|null $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + // + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @param string|null $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + return $this->push($job, $data, $queue); + } + + /** + * Push a new job onto the queue. + * + * @param string $queue + * @param string $job + * @param mixed $data + * @return mixed + */ + public function pushOn($queue, $job, $data = '') + { + return $this->push($job, $data, $queue); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param string $queue + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @return mixed + */ + public function laterOn($queue, $delay, $job, $data = '') + { + return $this->push($job, $data, $queue); + } + + /** + * Pop the next job off of the queue. + * + * @param string|null $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + // + } + + /** + * Push an array of jobs onto the queue. + * + * @param array $jobs + * @param mixed $data + * @param string|null $queue + * @return mixed + */ + public function bulk($jobs, $data = '', $queue = null) + { + foreach ($jobs as $job) { + $this->push($job, $data, $queue); + } + } + + /** + * Get the jobs that have been pushed. + * + * @return array + */ + public function pushedJobs() + { + return $this->jobs; + } + + /** + * Get the connection name for the queue. + * + * @return string + */ + public function getConnectionName() + { + // + } + + /** + * Set the connection name for the queue. + * + * @param string $name + * @return $this + */ + public function setConnectionName($name) + { + return $this; + } + + /** + * Override the QueueManager to prevent circular dependency. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + throw new BadMethodCallException(sprintf( + 'Call to undefined method %s::%s()', static::class, $method + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/CapsuleManagerTrait.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/CapsuleManagerTrait.php new file mode 100644 index 00000000..05327552 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/CapsuleManagerTrait.php @@ -0,0 +1,69 @@ +container = $container; + + if (! $this->container->bound('config')) { + $this->container->instance('config', new Fluent); + } + } + + /** + * Make this capsule instance available globally. + * + * @return void + */ + public function setAsGlobal() + { + static::$instance = $this; + } + + /** + * Get the IoC container instance. + * + * @return \Illuminate\Contracts\Container\Container + */ + public function getContainer() + { + return $this->container; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php new file mode 100644 index 00000000..f7e9bfc6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php @@ -0,0 +1,922 @@ +all() : $value; + } + + /** + * Alias for the "avg" method. + * + * @param callable|string|null $callback + * @return mixed + */ + public function average($callback = null) + { + return $this->avg($callback); + } + + /** + * Alias for the "contains" method. + * + * @param mixed $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function some($key, $operator = null, $value = null) + { + return $this->contains(...func_get_args()); + } + + /** + * Determine if an item exists, using strict comparison. + * + * @param mixed $key + * @param mixed $value + * @return bool + */ + public function containsStrict($key, $value = null) + { + if (func_num_args() === 2) { + return $this->contains(function ($item) use ($key, $value) { + return data_get($item, $key) === $value; + }); + } + + if ($this->useAsCallable($key)) { + return ! is_null($this->first($key)); + } + + foreach ($this as $item) { + if ($item === $key) { + return true; + } + } + + return false; + } + + /** + * Dump the items and end the script. + * + * @param mixed ...$args + * @return void + */ + public function dd(...$args) + { + $this->dump(...$args); + + exit(1); + } + + /** + * Dump the items. + * + * @return $this + */ + public function dump() + { + (new static(func_get_args())) + ->push($this) + ->each(function ($item) { + VarDumper::dump($item); + }); + + return $this; + } + + /** + * Execute a callback over each item. + * + * @param callable $callback + * @return $this + */ + public function each(callable $callback) + { + foreach ($this as $key => $item) { + if ($callback($item, $key) === false) { + break; + } + } + + return $this; + } + + /** + * Execute a callback over each nested chunk of items. + * + * @param callable $callback + * @return static + */ + public function eachSpread(callable $callback) + { + return $this->each(function ($chunk, $key) use ($callback) { + $chunk[] = $key; + + return $callback(...$chunk); + }); + } + + /** + * Determine if all items pass the given truth test. + * + * @param string|callable $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function every($key, $operator = null, $value = null) + { + if (func_num_args() === 1) { + $callback = $this->valueRetriever($key); + + foreach ($this as $k => $v) { + if (! $callback($v, $k)) { + return false; + } + } + + return true; + } + + return $this->every($this->operatorForWhere(...func_get_args())); + } + + /** + * Get the first item by the given key value pair. + * + * @param string $key + * @param mixed $operator + * @param mixed $value + * @return mixed + */ + public function firstWhere($key, $operator = null, $value = null) + { + return $this->first($this->operatorForWhere(...func_get_args())); + } + + /** + * Determine if the collection is not empty. + * + * @return bool + */ + public function isNotEmpty() + { + return ! $this->isEmpty(); + } + + /** + * Run a map over each nested chunk of items. + * + * @param callable $callback + * @return static + */ + public function mapSpread(callable $callback) + { + return $this->map(function ($chunk, $key) use ($callback) { + $chunk[] = $key; + + return $callback(...$chunk); + }); + } + + /** + * Run a grouping map over the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @param callable $callback + * @return static + */ + public function mapToGroups(callable $callback) + { + $groups = $this->mapToDictionary($callback); + + return $groups->map([$this, 'make']); + } + + /** + * Map a collection and flatten the result by a single level. + * + * @param callable $callback + * @return static + */ + public function flatMap(callable $callback) + { + return $this->map($callback)->collapse(); + } + + /** + * Map the values into a new class. + * + * @param string $class + * @return static + */ + public function mapInto($class) + { + return $this->map(function ($value, $key) use ($class) { + return new $class($value, $key); + }); + } + + /** + * Get the min value of a given key. + * + * @param callable|string|null $callback + * @return mixed + */ + public function min($callback = null) + { + $callback = $this->valueRetriever($callback); + + return $this->map(function ($value) use ($callback) { + return $callback($value); + })->filter(function ($value) { + return ! is_null($value); + })->reduce(function ($result, $value) { + return is_null($result) || $value < $result ? $value : $result; + }); + } + + /** + * Get the max value of a given key. + * + * @param callable|string|null $callback + * @return mixed + */ + public function max($callback = null) + { + $callback = $this->valueRetriever($callback); + + return $this->filter(function ($value) { + return ! is_null($value); + })->reduce(function ($result, $item) use ($callback) { + $value = $callback($item); + + return is_null($result) || $value > $result ? $value : $result; + }); + } + + /** + * "Paginate" the collection by slicing it into a smaller collection. + * + * @param int $page + * @param int $perPage + * @return static + */ + public function forPage($page, $perPage) + { + $offset = max(0, ($page - 1) * $perPage); + + return $this->slice($offset, $perPage); + } + + /** + * Partition the collection into two arrays using the given callback or key. + * + * @param callable|string $key + * @param mixed $operator + * @param mixed $value + * @return static + */ + public function partition($key, $operator = null, $value = null) + { + $passed = []; + $failed = []; + + $callback = func_num_args() === 1 + ? $this->valueRetriever($key) + : $this->operatorForWhere(...func_get_args()); + + foreach ($this as $key => $item) { + if ($callback($item, $key)) { + $passed[$key] = $item; + } else { + $failed[$key] = $item; + } + } + + return new static([new static($passed), new static($failed)]); + } + + /** + * Get the sum of the given values. + * + * @param callable|string|null $callback + * @return mixed + */ + public function sum($callback = null) + { + if (is_null($callback)) { + $callback = function ($value) { + return $value; + }; + } else { + $callback = $this->valueRetriever($callback); + } + + return $this->reduce(function ($result, $item) use ($callback) { + return $result + $callback($item); + }, 0); + } + + /** + * Apply the callback if the value is truthy. + * + * @param bool|mixed $value + * @param callable $callback + * @param callable $default + * @return static|mixed + */ + public function when($value, callable $callback, callable $default = null) + { + if ($value) { + return $callback($this, $value); + } elseif ($default) { + return $default($this, $value); + } + + return $this; + } + + /** + * Apply the callback if the collection is empty. + * + * @param callable $callback + * @param callable $default + * @return static|mixed + */ + public function whenEmpty(callable $callback, callable $default = null) + { + return $this->when($this->isEmpty(), $callback, $default); + } + + /** + * Apply the callback if the collection is not empty. + * + * @param callable $callback + * @param callable $default + * @return static|mixed + */ + public function whenNotEmpty(callable $callback, callable $default = null) + { + return $this->when($this->isNotEmpty(), $callback, $default); + } + + /** + * Apply the callback if the value is falsy. + * + * @param bool $value + * @param callable $callback + * @param callable $default + * @return static|mixed + */ + public function unless($value, callable $callback, callable $default = null) + { + return $this->when(! $value, $callback, $default); + } + + /** + * Apply the callback unless the collection is empty. + * + * @param callable $callback + * @param callable $default + * @return static|mixed + */ + public function unlessEmpty(callable $callback, callable $default = null) + { + return $this->whenNotEmpty($callback, $default); + } + + /** + * Apply the callback unless the collection is not empty. + * + * @param callable $callback + * @param callable $default + * @return static|mixed + */ + public function unlessNotEmpty(callable $callback, callable $default = null) + { + return $this->whenEmpty($callback, $default); + } + + /** + * Filter items by the given key value pair. + * + * @param string $key + * @param mixed $operator + * @param mixed $value + * @return static + */ + public function where($key, $operator = null, $value = null) + { + return $this->filter($this->operatorForWhere(...func_get_args())); + } + + /** + * Filter items where the given key is not null. + * + * @param string|null $key + * @return static + */ + public function whereNull($key = null) + { + return $this->whereStrict($key, null); + } + + /** + * Filter items where the given key is null. + * + * @param string|null $key + * @return static + */ + public function whereNotNull($key = null) + { + return $this->where($key, '!==', null); + } + + /** + * Filter items by the given key value pair using strict comparison. + * + * @param string $key + * @param mixed $value + * @return static + */ + public function whereStrict($key, $value) + { + return $this->where($key, '===', $value); + } + + /** + * Filter items by the given key value pair. + * + * @param string $key + * @param mixed $values + * @param bool $strict + * @return static + */ + public function whereIn($key, $values, $strict = false) + { + $values = $this->getArrayableItems($values); + + return $this->filter(function ($item) use ($key, $values, $strict) { + return in_array(data_get($item, $key), $values, $strict); + }); + } + + /** + * Filter items by the given key value pair using strict comparison. + * + * @param string $key + * @param mixed $values + * @return static + */ + public function whereInStrict($key, $values) + { + return $this->whereIn($key, $values, true); + } + + /** + * Filter items such that the value of the given key is between the given values. + * + * @param string $key + * @param array $values + * @return static + */ + public function whereBetween($key, $values) + { + return $this->where($key, '>=', reset($values))->where($key, '<=', end($values)); + } + + /** + * Filter items such that the value of the given key is not between the given values. + * + * @param string $key + * @param array $values + * @return static + */ + public function whereNotBetween($key, $values) + { + return $this->filter(function ($item) use ($key, $values) { + return data_get($item, $key) < reset($values) || data_get($item, $key) > end($values); + }); + } + + /** + * Filter items by the given key value pair. + * + * @param string $key + * @param mixed $values + * @param bool $strict + * @return static + */ + public function whereNotIn($key, $values, $strict = false) + { + $values = $this->getArrayableItems($values); + + return $this->reject(function ($item) use ($key, $values, $strict) { + return in_array(data_get($item, $key), $values, $strict); + }); + } + + /** + * Filter items by the given key value pair using strict comparison. + * + * @param string $key + * @param mixed $values + * @return static + */ + public function whereNotInStrict($key, $values) + { + return $this->whereNotIn($key, $values, true); + } + + /** + * Filter the items, removing any items that don't match the given type. + * + * @param string $type + * @return static + */ + public function whereInstanceOf($type) + { + return $this->filter(function ($value) use ($type) { + return $value instanceof $type; + }); + } + + /** + * Pass the collection to the given callback and return the result. + * + * @param callable $callback + * @return mixed + */ + public function pipe(callable $callback) + { + return $callback($this); + } + + /** + * Pass the collection to the given callback and then return it. + * + * @param callable $callback + * @return $this + */ + public function tap(callable $callback) + { + $callback(clone $this); + + return $this; + } + + /** + * Create a collection of all elements that do not pass a given truth test. + * + * @param callable|mixed $callback + * @return static + */ + public function reject($callback = true) + { + $useAsCallable = $this->useAsCallable($callback); + + return $this->filter(function ($value, $key) use ($callback, $useAsCallable) { + return $useAsCallable + ? ! $callback($value, $key) + : $value != $callback; + }); + } + + /** + * Return only unique items from the collection array. + * + * @param string|callable|null $key + * @param bool $strict + * @return static + */ + public function unique($key = null, $strict = false) + { + $callback = $this->valueRetriever($key); + + $exists = []; + + return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) { + if (in_array($id = $callback($item, $key), $exists, $strict)) { + return true; + } + + $exists[] = $id; + }); + } + + /** + * Return only unique items from the collection array using strict comparison. + * + * @param string|callable|null $key + * @return static + */ + public function uniqueStrict($key = null) + { + return $this->unique($key, true); + } + + /** + * Collect the values into a collection. + * + * @return \Illuminate\Support\Collection + */ + public function collect() + { + return new Collection($this->all()); + } + + /** + * Get the collection of items as a plain array. + * + * @return array + */ + public function toArray() + { + return $this->map(function ($value) { + return $value instanceof Arrayable ? $value->toArray() : $value; + })->all(); + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return array_map(function ($value) { + if ($value instanceof JsonSerializable) { + return $value->jsonSerialize(); + } elseif ($value instanceof Jsonable) { + return json_decode($value->toJson(), true); + } elseif ($value instanceof Arrayable) { + return $value->toArray(); + } + + return $value; + }, $this->all()); + } + + /** + * Get the collection of items as JSON. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->jsonSerialize(), $options); + } + + /** + * Get a CachingIterator instance. + * + * @param int $flags + * @return \CachingIterator + */ + public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING) + { + return new CachingIterator($this->getIterator(), $flags); + } + + /** + * Count the number of items in the collection using a given truth test. + * + * @param callable|null $callback + * @return static + */ + public function countBy($callback = null) + { + if (is_null($callback)) { + $callback = function ($value) { + return $value; + }; + } + + return new static($this->groupBy($callback)->map(function ($value) { + return $value->count(); + })); + } + + /** + * Convert the collection to its string representation. + * + * @return string + */ + public function __toString() + { + return $this->toJson(); + } + + /** + * Add a method to the list of proxied methods. + * + * @param string $method + * @return void + */ + public static function proxy($method) + { + static::$proxies[] = $method; + } + + /** + * Dynamically access collection proxies. + * + * @param string $key + * @return mixed + * + * @throws \Exception + */ + public function __get($key) + { + if (! in_array($key, static::$proxies)) { + throw new Exception("Property [{$key}] does not exist on this collection instance."); + } + + return new HigherOrderCollectionProxy($this, $key); + } + + /** + * Results array of items from Collection or Arrayable. + * + * @param mixed $items + * @return array + */ + protected function getArrayableItems($items) + { + if (is_array($items)) { + return $items; + } elseif ($items instanceof Enumerable) { + return $items->all(); + } elseif ($items instanceof Arrayable) { + return $items->toArray(); + } elseif ($items instanceof Jsonable) { + return json_decode($items->toJson(), true); + } elseif ($items instanceof JsonSerializable) { + return (array) $items->jsonSerialize(); + } elseif ($items instanceof Traversable) { + return iterator_to_array($items); + } + + return (array) $items; + } + + /** + * Get an operator checker callback. + * + * @param string $key + * @param string|null $operator + * @param mixed $value + * @return \Closure + */ + protected function operatorForWhere($key, $operator = null, $value = null) + { + if (func_num_args() === 1) { + $value = true; + + $operator = '='; + } + + if (func_num_args() === 2) { + $value = $operator; + + $operator = '='; + } + + return function ($item) use ($key, $operator, $value) { + $retrieved = data_get($item, $key); + + $strings = array_filter([$retrieved, $value], function ($value) { + return is_string($value) || (is_object($value) && method_exists($value, '__toString')); + }); + + if (count($strings) < 2 && count(array_filter([$retrieved, $value], 'is_object')) == 1) { + return in_array($operator, ['!=', '<>', '!==']); + } + + switch ($operator) { + default: + case '=': + case '==': return $retrieved == $value; + case '!=': + case '<>': return $retrieved != $value; + case '<': return $retrieved < $value; + case '>': return $retrieved > $value; + case '<=': return $retrieved <= $value; + case '>=': return $retrieved >= $value; + case '===': return $retrieved === $value; + case '!==': return $retrieved !== $value; + } + }; + } + + /** + * Determine if the given value is callable, but not a string. + * + * @param mixed $value + * @return bool + */ + protected function useAsCallable($value) + { + return ! is_string($value) && is_callable($value); + } + + /** + * Get a value retrieving callback. + * + * @param callable|string|null $value + * @return callable + */ + protected function valueRetriever($value) + { + if ($this->useAsCallable($value)) { + return $value; + } + + return function ($item) use ($value) { + return data_get($item, $value); + }; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php new file mode 100644 index 00000000..8b7add86 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php @@ -0,0 +1,54 @@ +{$method}(...$parameters); + } catch (Error|BadMethodCallException $e) { + $pattern = '~^Call to undefined method (?P[^:]+)::(?P[^\(]+)\(\)$~'; + + if (! preg_match($pattern, $e->getMessage(), $matches)) { + throw $e; + } + + if ($matches['class'] != get_class($object) || + $matches['method'] != $method) { + throw $e; + } + + static::throwBadMethodCallException($method); + } + } + + /** + * Throw a bad method call exception for the given method. + * + * @param string $method + * @return void + * + * @throws \BadMethodCallException + */ + protected static function throwBadMethodCallException($method) + { + throw new BadMethodCallException(sprintf( + 'Call to undefined method %s::%s()', static::class, $method + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php new file mode 100644 index 00000000..1e9fa58c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php @@ -0,0 +1,34 @@ +getLocale(); + + try { + $app->setLocale($locale); + + return $callback(); + } finally { + $app->setLocale($original); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php new file mode 100644 index 00000000..406f65ed --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php @@ -0,0 +1,116 @@ +getMethods( + ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + if ($replace || ! static::hasMacro($method->name)) { + $method->setAccessible(true); + static::macro($method->name, $method->invoke($mixin)); + } + } + } + + /** + * Checks if macro is registered. + * + * @param string $name + * @return bool + */ + public static function hasMacro($name) + { + return isset(static::$macros[$name]); + } + + /** + * Dynamically handle calls to the class. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public static function __callStatic($method, $parameters) + { + if (! static::hasMacro($method)) { + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); + } + + $macro = static::$macros[$method]; + + if ($macro instanceof Closure) { + $macro = $macro->bindTo(null, static::class); + } + + return $macro(...$parameters); + } + + /** + * Dynamically handle calls to the class. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (! static::hasMacro($method)) { + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); + } + + $macro = static::$macros[$method]; + + if ($macro instanceof Closure) { + $macro = $macro->bindTo($this, static::class); + } + + return $macro(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/Tappable.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/Tappable.php new file mode 100644 index 00000000..e4a321cd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/Tappable.php @@ -0,0 +1,17 @@ +bags[$key]); + } + + /** + * Get a MessageBag instance from the bags. + * + * @param string $key + * @return \Illuminate\Contracts\Support\MessageBag + */ + public function getBag($key) + { + return Arr::get($this->bags, $key) ?: new MessageBag; + } + + /** + * Get all the bags. + * + * @return array + */ + public function getBags() + { + return $this->bags; + } + + /** + * Add a new MessageBag instance to the bags. + * + * @param string $key + * @param \Illuminate\Contracts\Support\MessageBag $bag + * @return $this + */ + public function put($key, MessageBagContract $bag) + { + $this->bags[$key] = $bag; + + return $this; + } + + /** + * Determine if the default message bag has any messages. + * + * @return bool + */ + public function any() + { + return $this->count() > 0; + } + + /** + * Get the number of messages in the default bag. + * + * @return int + */ + public function count() + { + return $this->getBag('default')->count(); + } + + /** + * Dynamically call methods on the default bag. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->getBag('default')->$method(...$parameters); + } + + /** + * Dynamically access a view error bag. + * + * @param string $key + * @return \Illuminate\Contracts\Support\MessageBag + */ + public function __get($key) + { + return $this->getBag($key); + } + + /** + * Dynamically set a view error bag. + * + * @param string $key + * @param \Illuminate\Contracts\Support\MessageBag $value + * @return void + */ + public function __set($key, $value) + { + $this->put($key, $value); + } + + /** + * Convert the default bag to its string representation. + * + * @return string + */ + public function __toString() + { + return (string) $this->getBag('default'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/composer.json b/vendor/laravel/framework/src/Illuminate/Support/composer.json new file mode 100644 index 00000000..850963e5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/composer.json @@ -0,0 +1,52 @@ +{ + "name": "illuminate/support", + "description": "The Illuminate Support package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "ext-json": "*", + "ext-mbstring": "*", + "doctrine/inflector": "^1.4|^2.0", + "illuminate/contracts": "^6.0", + "nesbot/carbon": "^2.31" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "autoload": { + "psr-4": { + "Illuminate\\Support\\": "" + }, + "files": [ + "helpers.php" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "suggest": { + "illuminate/filesystem": "Required to use the composer class (^6.0).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "ramsey/uuid": "Required to use Str::uuid() (^3.7).", + "symfony/process": "Required to use the composer class (^4.3.4).", + "symfony/var-dumper": "Required to use the dd function (^4.3.4).", + "vlucas/phpdotenv": "Required to use the Env class and env helper (^3.3)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/helpers.php b/vendor/laravel/framework/src/Illuminate/Support/helpers.php new file mode 100755 index 00000000..d968dba5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/helpers.php @@ -0,0 +1,549 @@ + $value) { + if (is_numeric($key)) { + $start++; + + $array[$start] = Arr::pull($array, $key); + } + } + + return $array; + } +} + +if (! function_exists('blank')) { + /** + * Determine if the given value is "blank". + * + * @param mixed $value + * @return bool + */ + function blank($value) + { + if (is_null($value)) { + return true; + } + + if (is_string($value)) { + return trim($value) === ''; + } + + if (is_numeric($value) || is_bool($value)) { + return false; + } + + if ($value instanceof Countable) { + return count($value) === 0; + } + + return empty($value); + } +} + +if (! function_exists('class_basename')) { + /** + * Get the class "basename" of the given object / class. + * + * @param string|object $class + * @return string + */ + function class_basename($class) + { + $class = is_object($class) ? get_class($class) : $class; + + return basename(str_replace('\\', '/', $class)); + } +} + +if (! function_exists('class_uses_recursive')) { + /** + * Returns all traits used by a class, its parent classes and trait of their traits. + * + * @param object|string $class + * @return array + */ + function class_uses_recursive($class) + { + if (is_object($class)) { + $class = get_class($class); + } + + $results = []; + + foreach (array_reverse(class_parents($class)) + [$class => $class] as $class) { + $results += trait_uses_recursive($class); + } + + return array_unique($results); + } +} + +if (! function_exists('collect')) { + /** + * Create a collection from the given value. + * + * @param mixed $value + * @return \Illuminate\Support\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('e')) { + /** + * Encode HTML special characters in a string. + * + * @param \Illuminate\Contracts\Support\Htmlable|string $value + * @param bool $doubleEncode + * @return string + */ + function e($value, $doubleEncode = true) + { + if ($value instanceof Htmlable) { + return $value->toHtml(); + } + + return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', $doubleEncode); + } +} + +if (! function_exists('env')) { + /** + * Gets the value of an environment variable. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + function env($key, $default = null) + { + return Env::get($key, $default); + } +} + +if (! function_exists('filled')) { + /** + * Determine if a value is "filled". + * + * @param mixed $value + * @return bool + */ + function filled($value) + { + return ! blank($value); + } +} + +if (! function_exists('head')) { + /** + * Get the first element of an array. Useful for method chaining. + * + * @param array $array + * @return mixed + */ + function head($array) + { + return reset($array); + } +} + +if (! function_exists('last')) { + /** + * Get the last element from an array. + * + * @param array $array + * @return mixed + */ + function last($array) + { + return end($array); + } +} + +if (! function_exists('object_get')) { + /** + * Get an item from an object using "dot" notation. + * + * @param object $object + * @param string $key + * @param mixed $default + * @return mixed + */ + function object_get($object, $key, $default = null) + { + if (is_null($key) || trim($key) == '') { + return $object; + } + + foreach (explode('.', $key) as $segment) { + if (! is_object($object) || ! isset($object->{$segment})) { + return value($default); + } + + $object = $object->{$segment}; + } + + return $object; + } +} + +if (! function_exists('optional')) { + /** + * Provide access to optional objects. + * + * @param mixed $value + * @param callable|null $callback + * @return mixed + */ + function optional($value = null, callable $callback = null) + { + if (is_null($callback)) { + return new Optional($value); + } elseif (! is_null($value)) { + return $callback($value); + } + } +} + +if (! function_exists('preg_replace_array')) { + /** + * Replace a given pattern with each value in the array in sequentially. + * + * @param string $pattern + * @param array $replacements + * @param string $subject + * @return string + */ + function preg_replace_array($pattern, array $replacements, $subject) + { + return preg_replace_callback($pattern, function () use (&$replacements) { + foreach ($replacements as $key => $value) { + return array_shift($replacements); + } + }, $subject); + } +} + +if (! function_exists('retry')) { + /** + * Retry an operation a given number of times. + * + * @param int $times + * @param callable $callback + * @param int $sleep + * @param callable $when + * @return mixed + * + * @throws \Exception + */ + function retry($times, callable $callback, $sleep = 0, $when = null) + { + $attempts = 0; + + beginning: + $attempts++; + $times--; + + try { + return $callback($attempts); + } catch (Exception $e) { + if ($times < 1 || ($when && ! $when($e))) { + throw $e; + } + + if ($sleep) { + usleep($sleep * 1000); + } + + goto beginning; + } + } +} + +if (! function_exists('tap')) { + /** + * Call the given Closure with the given value then return the value. + * + * @param mixed $value + * @param callable|null $callback + * @return mixed + */ + function tap($value, $callback = null) + { + if (is_null($callback)) { + return new HigherOrderTapProxy($value); + } + + $callback($value); + + return $value; + } +} + +if (! function_exists('throw_if')) { + /** + * Throw the given exception if the given condition is true. + * + * @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')) { + /** + * Throw the given exception unless the given condition is true. + * + * @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('trait_uses_recursive')) { + /** + * Returns all traits used by a trait and its traits. + * + * @param string $trait + * @return array + */ + function trait_uses_recursive($trait) + { + $traits = class_uses($trait); + + foreach ($traits as $trait) { + $traits += trait_uses_recursive($trait); + } + + return $traits; + } +} + +if (! function_exists('transform')) { + /** + * Transform the given value if it is present. + * + * @param mixed $value + * @param callable $callback + * @param mixed $default + * @return mixed|null + */ + function transform($value, callable $callback, $default = null) + { + if (filled($value)) { + return $callback($value); + } + + if (is_callable($default)) { + return $default($value); + } + + return $default; + } +} + +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('windows_os')) { + /** + * Determine whether the current environment is Windows based. + * + * @return bool + */ + function windows_os() + { + return PHP_OS_FAMILY === 'Windows'; + } +} + +if (! function_exists('with')) { + /** + * Return the given value, optionally passed through the given callback. + * + * @param mixed $value + * @param callable|null $callback + * @return mixed + */ + function with($value, callable $callback = null) + { + return is_null($callback) ? $value : $callback($value); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Translation/ArrayLoader.php b/vendor/laravel/framework/src/Illuminate/Translation/ArrayLoader.php new file mode 100644 index 00000000..117e0440 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/ArrayLoader.php @@ -0,0 +1,81 @@ +messages[$namespace][$locale][$group] ?? []; + } + + /** + * Add a new namespace to the loader. + * + * @param string $namespace + * @param string $hint + * @return void + */ + public function addNamespace($namespace, $hint) + { + // + } + + /** + * Add a new JSON path to the loader. + * + * @param string $path + * @return void + */ + public function addJsonPath($path) + { + // + } + + /** + * Add messages to the loader. + * + * @param string $locale + * @param string $group + * @param array $messages + * @param string|null $namespace + * @return $this + */ + public function addMessages($locale, $group, array $messages, $namespace = null) + { + $namespace = $namespace ?: '*'; + + $this->messages[$namespace][$locale][$group] = $messages; + + return $this; + } + + /** + * Get an array of all the registered namespaces. + * + * @return array + */ + public function namespaces() + { + return []; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php b/vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php new file mode 100755 index 00000000..17f6e59f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php @@ -0,0 +1,187 @@ +path = $path; + $this->files = $files; + } + + /** + * Load the messages for the given locale. + * + * @param string $locale + * @param string $group + * @param string|null $namespace + * @return array + */ + public function load($locale, $group, $namespace = null) + { + if ($group === '*' && $namespace === '*') { + return $this->loadJsonPaths($locale); + } + + if (is_null($namespace) || $namespace === '*') { + return $this->loadPath($this->path, $locale, $group); + } + + return $this->loadNamespaced($locale, $group, $namespace); + } + + /** + * Load a namespaced translation group. + * + * @param string $locale + * @param string $group + * @param string $namespace + * @return array + */ + protected function loadNamespaced($locale, $group, $namespace) + { + if (isset($this->hints[$namespace])) { + $lines = $this->loadPath($this->hints[$namespace], $locale, $group); + + return $this->loadNamespaceOverrides($lines, $locale, $group, $namespace); + } + + return []; + } + + /** + * Load a local namespaced translation group for overrides. + * + * @param array $lines + * @param string $locale + * @param string $group + * @param string $namespace + * @return array + */ + protected function loadNamespaceOverrides(array $lines, $locale, $group, $namespace) + { + $file = "{$this->path}/vendor/{$namespace}/{$locale}/{$group}.php"; + + if ($this->files->exists($file)) { + return array_replace_recursive($lines, $this->files->getRequire($file)); + } + + return $lines; + } + + /** + * Load a locale from a given path. + * + * @param string $path + * @param string $locale + * @param string $group + * @return array + */ + protected function loadPath($path, $locale, $group) + { + if ($this->files->exists($full = "{$path}/{$locale}/{$group}.php")) { + return $this->files->getRequire($full); + } + + return []; + } + + /** + * Load a locale from the given JSON file path. + * + * @param string $locale + * @return array + * + * @throws \RuntimeException + */ + protected function loadJsonPaths($locale) + { + return collect(array_merge($this->jsonPaths, [$this->path])) + ->reduce(function ($output, $path) use ($locale) { + if ($this->files->exists($full = "{$path}/{$locale}.json")) { + $decoded = json_decode($this->files->get($full), true); + + if (is_null($decoded) || json_last_error() !== JSON_ERROR_NONE) { + throw new RuntimeException("Translation file [{$full}] contains an invalid JSON structure."); + } + + $output = array_merge($output, $decoded); + } + + return $output; + }, []); + } + + /** + * Add a new namespace to the loader. + * + * @param string $namespace + * @param string $hint + * @return void + */ + public function addNamespace($namespace, $hint) + { + $this->hints[$namespace] = $hint; + } + + /** + * Add a new JSON path to the loader. + * + * @param string $path + * @return void + */ + public function addJsonPath($path) + { + $this->jsonPaths[] = $path; + } + + /** + * Get an array of all the registered namespaces. + * + * @return array + */ + public function namespaces() + { + return $this->hints; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Translation/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Translation/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Translation/MessageSelector.php b/vendor/laravel/framework/src/Illuminate/Translation/MessageSelector.php new file mode 100755 index 00000000..c1328d59 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/MessageSelector.php @@ -0,0 +1,412 @@ +extract($segments, $number)) !== null) { + return trim($value); + } + + $segments = $this->stripConditions($segments); + + $pluralIndex = $this->getPluralIndex($locale, $number); + + if (count($segments) === 1 || ! isset($segments[$pluralIndex])) { + return $segments[0]; + } + + return $segments[$pluralIndex]; + } + + /** + * Extract a translation string using inline conditions. + * + * @param array $segments + * @param int $number + * @return mixed + */ + private function extract($segments, $number) + { + foreach ($segments as $part) { + if (! is_null($line = $this->extractFromString($part, $number))) { + return $line; + } + } + } + + /** + * Get the translation string if the condition matches. + * + * @param string $part + * @param int $number + * @return mixed + */ + private function extractFromString($part, $number) + { + preg_match('/^[\{\[]([^\[\]\{\}]*)[\}\]](.*)/s', $part, $matches); + + if (count($matches) !== 3) { + return; + } + + $condition = $matches[1]; + + $value = $matches[2]; + + if (Str::contains($condition, ',')) { + [$from, $to] = explode(',', $condition, 2); + + if ($to === '*' && $number >= $from) { + return $value; + } elseif ($from === '*' && $number <= $to) { + return $value; + } elseif ($number >= $from && $number <= $to) { + return $value; + } + } + + return $condition == $number ? $value : null; + } + + /** + * Strip the inline conditions from each segment, just leaving the text. + * + * @param array $segments + * @return array + */ + private function stripConditions($segments) + { + return collect($segments)->map(function ($part) { + return preg_replace('/^[\{\[]([^\[\]\{\}]*)[\}\]]/', '', $part); + })->all(); + } + + /** + * Get the index to use for pluralization. + * + * The plural rules are derived from code of the Zend Framework (2010-09-25), which + * is subject to the new BSD license (https://framework.zend.com/license) + * Copyright (c) 2005-2010 - Zend Technologies USA Inc. (http://www.zend.com) + * + * @param string $locale + * @param int $number + * @return int + */ + public function getPluralIndex($locale, $number) + { + switch ($locale) { + case 'az': + case 'az_AZ': + case 'bo': + case 'bo_CN': + case 'bo_IN': + case 'dz': + case 'dz_BT': + case 'id': + case 'id_ID': + case 'ja': + case 'ja_JP': + case 'jv': + case 'ka': + case 'ka_GE': + case 'km': + case 'km_KH': + case 'kn': + case 'kn_IN': + case 'ko': + case 'ko_KR': + case 'ms': + case 'ms_MY': + case 'th': + case 'th_TH': + case 'tr': + case 'tr_CY': + case 'tr_TR': + case 'vi': + case 'vi_VN': + case 'zh': + case 'zh_CN': + case 'zh_HK': + case 'zh_SG': + case 'zh_TW': + return 0; + case 'af': + case 'af_ZA': + case 'bn': + case 'bn_BD': + case 'bn_IN': + case 'bg': + case 'bg_BG': + case 'ca': + case 'ca_AD': + case 'ca_ES': + case 'ca_FR': + case 'ca_IT': + case 'da': + case 'da_DK': + case 'de': + case 'de_AT': + case 'de_BE': + case 'de_CH': + case 'de_DE': + case 'de_LI': + case 'de_LU': + case 'el': + case 'el_CY': + case 'el_GR': + case 'en': + case 'en_AG': + case 'en_AU': + case 'en_BW': + case 'en_CA': + case 'en_DK': + case 'en_GB': + case 'en_HK': + case 'en_IE': + case 'en_IN': + case 'en_NG': + case 'en_NZ': + case 'en_PH': + case 'en_SG': + case 'en_US': + case 'en_ZA': + case 'en_ZM': + case 'en_ZW': + case 'eo': + case 'eo_US': + case 'es': + case 'es_AR': + case 'es_BO': + case 'es_CL': + case 'es_CO': + case 'es_CR': + case 'es_CU': + case 'es_DO': + case 'es_EC': + case 'es_ES': + case 'es_GT': + case 'es_HN': + case 'es_MX': + case 'es_NI': + case 'es_PA': + case 'es_PE': + case 'es_PR': + case 'es_PY': + case 'es_SV': + case 'es_US': + case 'es_UY': + case 'es_VE': + case 'et': + case 'et_EE': + case 'eu': + case 'eu_ES': + case 'eu_FR': + case 'fa': + case 'fa_IR': + case 'fi': + case 'fi_FI': + case 'fo': + case 'fo_FO': + case 'fur': + case 'fur_IT': + case 'fy': + case 'fy_DE': + case 'fy_NL': + case 'gl': + case 'gl_ES': + case 'gu': + case 'gu_IN': + case 'ha': + case 'ha_NG': + case 'he': + case 'he_IL': + case 'hu': + case 'hu_HU': + case 'is': + case 'is_IS': + case 'it': + case 'it_CH': + case 'it_IT': + case 'ku': + case 'ku_TR': + case 'lb': + case 'lb_LU': + case 'ml': + case 'ml_IN': + case 'mn': + case 'mn_MN': + case 'mr': + case 'mr_IN': + case 'nah': + case 'nb': + case 'nb_NO': + case 'ne': + case 'ne_NP': + case 'nl': + case 'nl_AW': + case 'nl_BE': + case 'nl_NL': + case 'nn': + case 'nn_NO': + case 'no': + case 'om': + case 'om_ET': + case 'om_KE': + case 'or': + case 'or_IN': + case 'pa': + case 'pa_IN': + case 'pa_PK': + case 'pap': + case 'pap_AN': + case 'pap_AW': + case 'pap_CW': + case 'ps': + case 'ps_AF': + case 'pt': + case 'pt_BR': + case 'pt_PT': + case 'so': + case 'so_DJ': + case 'so_ET': + case 'so_KE': + case 'so_SO': + case 'sq': + case 'sq_AL': + case 'sq_MK': + case 'sv': + case 'sv_FI': + case 'sv_SE': + case 'sw': + case 'sw_KE': + case 'sw_TZ': + case 'ta': + case 'ta_IN': + case 'ta_LK': + case 'te': + case 'te_IN': + case 'tk': + case 'tk_TM': + case 'ur': + case 'ur_IN': + case 'ur_PK': + case 'zu': + case 'zu_ZA': + return ($number == 1) ? 0 : 1; + case 'am': + case 'am_ET': + case 'bh': + case 'fil': + case 'fil_PH': + case 'fr': + case 'fr_BE': + case 'fr_CA': + case 'fr_CH': + case 'fr_FR': + case 'fr_LU': + case 'gun': + case 'hi': + case 'hi_IN': + case 'hy': + case 'hy_AM': + case 'ln': + case 'ln_CD': + case 'mg': + case 'mg_MG': + case 'nso': + case 'nso_ZA': + case 'ti': + case 'ti_ER': + case 'ti_ET': + case 'wa': + case 'wa_BE': + case 'xbr': + return (($number == 0) || ($number == 1)) ? 0 : 1; + case 'be': + case 'be_BY': + case 'bs': + case 'bs_BA': + case 'hr': + case 'hr_HR': + case 'ru': + case 'ru_RU': + case 'ru_UA': + case 'sr': + case 'sr_ME': + case 'sr_RS': + case 'uk': + case 'uk_UA': + return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); + case 'cs': + case 'cs_CZ': + case 'sk': + case 'sk_SK': + return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); + case 'ga': + case 'ga_IE': + return ($number == 1) ? 0 : (($number == 2) ? 1 : 2); + case 'lt': + case 'lt_LT': + return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); + case 'sl': + case 'sl_SI': + return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3)); + case 'mk': + case 'mk_MK': + return ($number % 10 == 1) ? 0 : 1; + case 'mt': + case 'mt_MT': + return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); + case 'lv': + case 'lv_LV': + return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2); + case 'pl': + case 'pl_PL': + return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); + case 'cy': + case 'cy_GB': + return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3)); + case 'ro': + case 'ro_RO': + return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); + case 'ar': + case 'ar_AE': + case 'ar_BH': + case 'ar_DZ': + case 'ar_EG': + case 'ar_IN': + case 'ar_IQ': + case 'ar_JO': + case 'ar_KW': + case 'ar_LB': + case 'ar_LY': + case 'ar_MA': + case 'ar_OM': + case 'ar_QA': + case 'ar_SA': + case 'ar_SD': + case 'ar_SS': + case 'ar_SY': + case 'ar_TN': + case 'ar_YE': + return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))); + default: + return 0; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Translation/TranslationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Translation/TranslationServiceProvider.php new file mode 100755 index 00000000..7455b52a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/TranslationServiceProvider.php @@ -0,0 +1,56 @@ +registerLoader(); + + $this->app->singleton('translator', function ($app) { + $loader = $app['translation.loader']; + + // When registering the translator component, we'll need to set the default + // locale as well as the fallback locale. So, we'll grab the application + // configuration so we can easily get both of these values from there. + $locale = $app['config']['app.locale']; + + $trans = new Translator($loader, $locale); + + $trans->setFallback($app['config']['app.fallback_locale']); + + return $trans; + }); + } + + /** + * Register the translation line loader. + * + * @return void + */ + protected function registerLoader() + { + $this->app->singleton('translation.loader', function ($app) { + return new FileLoader($app['files'], $app['path.lang']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['translator', 'translation.loader']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Translation/Translator.php b/vendor/laravel/framework/src/Illuminate/Translation/Translator.php new file mode 100755 index 00000000..0f1606e8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/Translator.php @@ -0,0 +1,449 @@ +loader = $loader; + + $this->setLocale($locale); + } + + /** + * Determine if a translation exists for a given locale. + * + * @param string $key + * @param string|null $locale + * @return bool + */ + public function hasForLocale($key, $locale = null) + { + return $this->has($key, $locale, false); + } + + /** + * Determine if a translation exists. + * + * @param string $key + * @param string|null $locale + * @param bool $fallback + * @return bool + */ + public function has($key, $locale = null, $fallback = true) + { + return $this->get($key, [], $locale, $fallback) !== $key; + } + + /** + * Get the translation for the given key. + * + * @param string $key + * @param array $replace + * @param string|null $locale + * @param bool $fallback + * @return string|array + */ + public function get($key, array $replace = [], $locale = null, $fallback = true) + { + $locale = $locale ?: $this->locale; + + // For JSON translations, there is only one file per locale, so we will simply load + // that file and then we will be ready to check the array for the key. These are + // only one level deep so we do not need to do any fancy searching through it. + $this->load('*', '*', $locale); + + $line = $this->loaded['*']['*'][$locale][$key] ?? null; + + // If we can't find a translation for the JSON key, we will attempt to translate it + // using the typical translation file. This way developers can always just use a + // helper such as __ instead of having to pick between trans or __ with views. + if (! isset($line)) { + [$namespace, $group, $item] = $this->parseKey($key); + + // Here we will get the locale that should be used for the language line. If one + // was not passed, we will use the default locales which was given to us when + // the translator was instantiated. Then, we can load the lines and return. + $locales = $fallback ? $this->localeArray($locale) : [$locale]; + + foreach ($locales as $locale) { + if (! is_null($line = $this->getLine( + $namespace, $group, $locale, $item, $replace + ))) { + return $line ?? $key; + } + } + } + + // If the line doesn't exist, we will return back the key which was requested as + // that will be quick to spot in the UI if language keys are wrong or missing + // from the application's language files. Otherwise we can return the line. + return $this->makeReplacements($line ?: $key, $replace); + } + + /** + * Get a translation according to an integer value. + * + * @param string $key + * @param \Countable|int|array $number + * @param array $replace + * @param string|null $locale + * @return string + */ + public function choice($key, $number, array $replace = [], $locale = null) + { + $line = $this->get( + $key, $replace, $locale = $this->localeForChoice($locale) + ); + + // If the given "number" is actually an array or countable we will simply count the + // number of elements in an instance. This allows developers to pass an array of + // items without having to count it on their end first which gives bad syntax. + if (is_array($number) || $number instanceof Countable) { + $number = count($number); + } + + $replace['count'] = $number; + + return $this->makeReplacements( + $this->getSelector()->choose($line, $number, $locale), $replace + ); + } + + /** + * Get the proper locale for a choice operation. + * + * @param string|null $locale + * @return string + */ + protected function localeForChoice($locale) + { + return $locale ?: $this->locale ?: $this->fallback; + } + + /** + * Retrieve a language line out the loaded array. + * + * @param string $namespace + * @param string $group + * @param string $locale + * @param string $item + * @param array $replace + * @return string|array|null + */ + protected function getLine($namespace, $group, $locale, $item, array $replace) + { + $this->load($namespace, $group, $locale); + + $line = Arr::get($this->loaded[$namespace][$group][$locale], $item); + + if (is_string($line)) { + return $this->makeReplacements($line, $replace); + } elseif (is_array($line) && count($line) > 0) { + foreach ($line as $key => $value) { + $line[$key] = $this->makeReplacements($value, $replace); + } + + return $line; + } + } + + /** + * Make the place-holder replacements on a line. + * + * @param string $line + * @param array $replace + * @return string + */ + protected function makeReplacements($line, array $replace) + { + if (empty($replace)) { + return $line; + } + + $replace = $this->sortReplacements($replace); + + foreach ($replace as $key => $value) { + $line = str_replace( + [':'.$key, ':'.Str::upper($key), ':'.Str::ucfirst($key)], + [$value, Str::upper($value), Str::ucfirst($value)], + $line + ); + } + + return $line; + } + + /** + * Sort the replacements array. + * + * @param array $replace + * @return array + */ + protected function sortReplacements(array $replace) + { + return (new Collection($replace))->sortBy(function ($value, $key) { + return mb_strlen($key) * -1; + })->all(); + } + + /** + * Add translation lines to the given locale. + * + * @param array $lines + * @param string $locale + * @param string $namespace + * @return void + */ + public function addLines(array $lines, $locale, $namespace = '*') + { + foreach ($lines as $key => $value) { + [$group, $item] = explode('.', $key, 2); + + Arr::set($this->loaded, "$namespace.$group.$locale.$item", $value); + } + } + + /** + * Load the specified language group. + * + * @param string $namespace + * @param string $group + * @param string $locale + * @return void + */ + public function load($namespace, $group, $locale) + { + if ($this->isLoaded($namespace, $group, $locale)) { + return; + } + + // The loader is responsible for returning the array of language lines for the + // given namespace, group, and locale. We'll set the lines in this array of + // lines that have already been loaded so that we can easily access them. + $lines = $this->loader->load($locale, $group, $namespace); + + $this->loaded[$namespace][$group][$locale] = $lines; + } + + /** + * Determine if the given group has been loaded. + * + * @param string $namespace + * @param string $group + * @param string $locale + * @return bool + */ + protected function isLoaded($namespace, $group, $locale) + { + return isset($this->loaded[$namespace][$group][$locale]); + } + + /** + * Add a new namespace to the loader. + * + * @param string $namespace + * @param string $hint + * @return void + */ + public function addNamespace($namespace, $hint) + { + $this->loader->addNamespace($namespace, $hint); + } + + /** + * Add a new JSON path to the loader. + * + * @param string $path + * @return void + */ + public function addJsonPath($path) + { + $this->loader->addJsonPath($path); + } + + /** + * Parse a key into namespace, group, and item. + * + * @param string $key + * @return array + */ + public function parseKey($key) + { + $segments = parent::parseKey($key); + + if (is_null($segments[0])) { + $segments[0] = '*'; + } + + return $segments; + } + + /** + * Get the array of locales to be checked. + * + * @param string|null $locale + * @return array + */ + protected function localeArray($locale) + { + return array_filter([$locale ?: $this->locale, $this->fallback]); + } + + /** + * Get the message selector instance. + * + * @return \Illuminate\Translation\MessageSelector + */ + public function getSelector() + { + if (! isset($this->selector)) { + $this->selector = new MessageSelector; + } + + return $this->selector; + } + + /** + * Set the message selector instance. + * + * @param \Illuminate\Translation\MessageSelector $selector + * @return void + */ + public function setSelector(MessageSelector $selector) + { + $this->selector = $selector; + } + + /** + * Get the language line loader implementation. + * + * @return \Illuminate\Contracts\Translation\Loader + */ + public function getLoader() + { + return $this->loader; + } + + /** + * Get the default locale being used. + * + * @return string + */ + public function locale() + { + return $this->getLocale(); + } + + /** + * Get the default locale being used. + * + * @return string + */ + public function getLocale() + { + return $this->locale; + } + + /** + * Set the default locale. + * + * @param string $locale + * @return void + */ + public function setLocale($locale) + { + if (Str::contains($locale, ['/', '\\'])) { + throw new InvalidArgumentException('Invalid characters present in locale.'); + } + + $this->locale = $locale; + } + + /** + * Get the fallback locale being used. + * + * @return string + */ + public function getFallback() + { + return $this->fallback; + } + + /** + * Set the fallback locale being used. + * + * @param string $fallback + * @return void + */ + public function setFallback($fallback) + { + $this->fallback = $fallback; + } + + /** + * Set the loaded translation groups. + * + * @param array $loaded + * @return void + */ + public function setLoaded(array $loaded) + { + $this->loaded = $loaded; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Translation/composer.json b/vendor/laravel/framework/src/Illuminate/Translation/composer.json new file mode 100755 index 00000000..598fdde3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/composer.json @@ -0,0 +1,37 @@ +{ + "name": "illuminate/translation", + "description": "The Illuminate Translation package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "ext-json": "*", + "illuminate/contracts": "^6.0", + "illuminate/filesystem": "^6.0", + "illuminate/support": "^6.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Translation\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/ClosureValidationRule.php b/vendor/laravel/framework/src/Illuminate/Validation/ClosureValidationRule.php new file mode 100644 index 00000000..8f247fc3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/ClosureValidationRule.php @@ -0,0 +1,70 @@ +callback = $callback; + } + + /** + * Determine if the validation rule passes. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function passes($attribute, $value) + { + $this->failed = false; + + $this->callback->__invoke($attribute, $value, function ($message) { + $this->failed = true; + + $this->message = $message; + }); + + return ! $this->failed; + } + + /** + * Get the validation error message. + * + * @return string + */ + public function message() + { + return $this->message; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Concerns/FilterEmailValidation.php b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/FilterEmailValidation.php new file mode 100644 index 00000000..88ca1546 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/FilterEmailValidation.php @@ -0,0 +1,41 @@ +getInlineMessage($attribute, $rule); + + // First we will retrieve the custom message for the validation rule if one + // exists. If a custom validation message is being used we'll return the + // custom message, otherwise we'll keep searching for a valid message. + if (! is_null($inlineMessage)) { + return $inlineMessage; + } + + $lowerRule = Str::snake($rule); + + $customMessage = $this->getCustomMessageFromTranslator( + $customKey = "validation.custom.{$attribute}.{$lowerRule}" + ); + + // First we check for a custom defined validation message for the attribute + // and rule. This allows the developer to specify specific messages for + // only some attributes and rules that need to get specially formed. + if ($customMessage !== $customKey) { + return $customMessage; + } + + // If the rule being validated is a "size" rule, we will need to gather the + // specific error message for the type of attribute being validated such + // as a number, file or string which all have different message types. + elseif (in_array($rule, $this->sizeRules)) { + return $this->getSizeMessage($attribute, $rule); + } + + // Finally, if no developer specified messages have been set, and no other + // special messages apply for this rule, we will just pull the default + // messages out of the translator service for this validation rule. + $key = "validation.{$lowerRule}"; + + if ($key != ($value = $this->translator->get($key))) { + return $value; + } + + return $this->getFromLocalArray( + $attribute, $lowerRule, $this->fallbackMessages + ) ?: $key; + } + + /** + * Get the proper inline error message for standard and size rules. + * + * @param string $attribute + * @param string $rule + * @return string|null + */ + protected function getInlineMessage($attribute, $rule) + { + $inlineEntry = $this->getFromLocalArray($attribute, Str::snake($rule)); + + return is_array($inlineEntry) && in_array($rule, $this->sizeRules) + ? $inlineEntry[$this->getAttributeType($attribute)] + : $inlineEntry; + } + + /** + * Get the inline message for a rule if it exists. + * + * @param string $attribute + * @param string $lowerRule + * @param array|null $source + * @return string|null + */ + protected function getFromLocalArray($attribute, $lowerRule, $source = null) + { + $source = $source ?: $this->customMessages; + + $keys = ["{$attribute}.{$lowerRule}", $lowerRule]; + + // First we will check for a custom message for an attribute specific rule + // message for the fields, then we will check for a general custom line + // that is not attribute specific. If we find either we'll return it. + foreach ($keys as $key) { + foreach (array_keys($source) as $sourceKey) { + if (strpos($sourceKey, '*') !== false) { + $pattern = str_replace('\*', '([^.]*)', preg_quote($sourceKey, '#')); + + if (preg_match('#^'.$pattern.'\z#u', $key) === 1) { + return $source[$sourceKey]; + } + + continue; + } + + if (Str::is($sourceKey, $key)) { + return $source[$sourceKey]; + } + } + } + } + + /** + * Get the custom error message from translator. + * + * @param string $key + * @return string + */ + protected function getCustomMessageFromTranslator($key) + { + if (($message = $this->translator->get($key)) !== $key) { + return $message; + } + + // If an exact match was not found for the key, we will collapse all of these + // messages and loop through them and try to find a wildcard match for the + // given key. Otherwise, we will simply return the key's value back out. + $shortKey = preg_replace( + '/^validation\.custom\./', '', $key + ); + + return $this->getWildcardCustomMessages(Arr::dot( + (array) $this->translator->get('validation.custom') + ), $shortKey, $key); + } + + /** + * Check the given messages for a wildcard key. + * + * @param array $messages + * @param string $search + * @param string $default + * @return string + */ + protected function getWildcardCustomMessages($messages, $search, $default) + { + foreach ($messages as $key => $message) { + if ($search === $key || (Str::contains($key, ['*']) && Str::is($key, $search))) { + return $message; + } + } + + return $default; + } + + /** + * Get the proper error message for an attribute and size rule. + * + * @param string $attribute + * @param string $rule + * @return string + */ + protected function getSizeMessage($attribute, $rule) + { + $lowerRule = Str::snake($rule); + + // There are three different types of size validations. The attribute may be + // either a number, file, or string so we will check a few things to know + // which type of value it is and return the correct line for that type. + $type = $this->getAttributeType($attribute); + + $key = "validation.{$lowerRule}.{$type}"; + + return $this->translator->get($key); + } + + /** + * Get the data type of the given attribute. + * + * @param string $attribute + * @return string + */ + protected function getAttributeType($attribute) + { + // We assume that the attributes present in the file array are files so that + // means that if the attribute does not have a numeric rule and the files + // list doesn't have it we'll just consider it a string by elimination. + if ($this->hasRule($attribute, $this->numericRules)) { + return 'numeric'; + } elseif ($this->hasRule($attribute, ['Array'])) { + return 'array'; + } elseif ($this->getValue($attribute) instanceof UploadedFile) { + return 'file'; + } + + return 'string'; + } + + /** + * Replace all error message place-holders with actual values. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + public function makeReplacements($message, $attribute, $rule, $parameters) + { + $message = $this->replaceAttributePlaceholder( + $message, $this->getDisplayableAttribute($attribute) + ); + + $message = $this->replaceInputPlaceholder($message, $attribute); + + if (isset($this->replacers[Str::snake($rule)])) { + return $this->callReplacer($message, $attribute, Str::snake($rule), $parameters, $this); + } elseif (method_exists($this, $replacer = "replace{$rule}")) { + return $this->$replacer($message, $attribute, $rule, $parameters); + } + + return $message; + } + + /** + * Get the displayable name of the attribute. + * + * @param string $attribute + * @return string + */ + public function getDisplayableAttribute($attribute) + { + $primaryAttribute = $this->getPrimaryAttribute($attribute); + + $expectedAttributes = $attribute != $primaryAttribute + ? [$attribute, $primaryAttribute] : [$attribute]; + + foreach ($expectedAttributes as $name) { + // The developer may dynamically specify the array of custom attributes on this + // validator instance. If the attribute exists in this array it is used over + // the other ways of pulling the attribute name for this given attributes. + if (isset($this->customAttributes[$name])) { + return $this->customAttributes[$name]; + } + + // We allow for a developer to specify language lines for any attribute in this + // application, which allows flexibility for displaying a unique displayable + // version of the attribute name instead of the name used in an HTTP POST. + if ($line = $this->getAttributeFromTranslations($name)) { + return $line; + } + } + + // When no language line has been specified for the attribute and it is also + // an implicit attribute we will display the raw attribute's name and not + // modify it with any of these replacements before we display the name. + if (isset($this->implicitAttributes[$primaryAttribute])) { + return ($formatter = $this->implicitAttributesFormatter) + ? $formatter($attribute) + : $attribute; + } + + return str_replace('_', ' ', Str::snake($attribute)); + } + + /** + * Get the given attribute from the attribute translations. + * + * @param string $name + * @return string + */ + protected function getAttributeFromTranslations($name) + { + return Arr::get($this->translator->get('validation.attributes'), $name); + } + + /** + * Replace the :attribute placeholder in the given message. + * + * @param string $message + * @param string $value + * @return string + */ + protected function replaceAttributePlaceholder($message, $value) + { + return str_replace( + [':attribute', ':ATTRIBUTE', ':Attribute'], + [$value, Str::upper($value), Str::ucfirst($value)], + $message + ); + } + + /** + * Replace the :input placeholder in the given message. + * + * @param string $message + * @param string $attribute + * @return string + */ + protected function replaceInputPlaceholder($message, $attribute) + { + $actualValue = $this->getValue($attribute); + + if (is_scalar($actualValue) || is_null($actualValue)) { + $message = str_replace(':input', $actualValue, $message); + } + + return $message; + } + + /** + * Get the displayable name of the value. + * + * @param string $attribute + * @param mixed $value + * @return string + */ + public function getDisplayableValue($attribute, $value) + { + if (isset($this->customValues[$attribute][$value])) { + return $this->customValues[$attribute][$value]; + } + + $key = "validation.values.{$attribute}.{$value}"; + + if (($line = $this->translator->get($key)) !== $key) { + return $line; + } + + if (is_bool($value)) { + return $value ? 'true' : 'false'; + } + + if (is_null($value)) { + return 'empty'; + } + + return $value; + } + + /** + * Transform an array of attributes to their displayable form. + * + * @param array $values + * @return array + */ + protected function getAttributeList(array $values) + { + $attributes = []; + + // For each attribute in the list we will simply get its displayable form as + // this is convenient when replacing lists of parameters like some of the + // replacement functions do when formatting out the validation message. + foreach ($values as $key => $value) { + $attributes[$key] = $this->getDisplayableAttribute($value); + } + + return $attributes; + } + + /** + * Call a custom validator message replacer. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @param \Illuminate\Validation\Validator $validator + * @return string|null + */ + protected function callReplacer($message, $attribute, $rule, $parameters, $validator) + { + $callback = $this->replacers[$rule]; + + if ($callback instanceof Closure) { + return $callback(...func_get_args()); + } elseif (is_string($callback)) { + return $this->callClassBasedReplacer($callback, $message, $attribute, $rule, $parameters, $validator); + } + } + + /** + * Call a class based validator message replacer. + * + * @param string $callback + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @param \Illuminate\Validation\Validator $validator + * @return string + */ + protected function callClassBasedReplacer($callback, $message, $attribute, $rule, $parameters, $validator) + { + [$class, $method] = Str::parseCallback($callback, 'replace'); + + return $this->container->make($class)->{$method}(...array_slice(func_get_args(), 1)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ReplacesAttributes.php b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ReplacesAttributes.php new file mode 100644 index 00000000..f5c3eb00 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ReplacesAttributes.php @@ -0,0 +1,508 @@ +replaceSame($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the digits rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDigits($message, $attribute, $rule, $parameters) + { + return str_replace(':digits', $parameters[0], $message); + } + + /** + * Replace all place-holders for the digits (between) rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDigitsBetween($message, $attribute, $rule, $parameters) + { + return $this->replaceBetween($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the min rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceMin($message, $attribute, $rule, $parameters) + { + return str_replace(':min', $parameters[0], $message); + } + + /** + * Replace all place-holders for the max rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceMax($message, $attribute, $rule, $parameters) + { + return str_replace(':max', $parameters[0], $message); + } + + /** + * Replace all place-holders for the in rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceIn($message, $attribute, $rule, $parameters) + { + foreach ($parameters as &$parameter) { + $parameter = $this->getDisplayableValue($attribute, $parameter); + } + + return str_replace(':values', implode(', ', $parameters), $message); + } + + /** + * Replace all place-holders for the not_in rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceNotIn($message, $attribute, $rule, $parameters) + { + return $this->replaceIn($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the in_array rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceInArray($message, $attribute, $rule, $parameters) + { + return str_replace(':other', $this->getDisplayableAttribute($parameters[0]), $message); + } + + /** + * Replace all place-holders for the mimetypes rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceMimetypes($message, $attribute, $rule, $parameters) + { + return str_replace(':values', implode(', ', $parameters), $message); + } + + /** + * Replace all place-holders for the mimes rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceMimes($message, $attribute, $rule, $parameters) + { + return str_replace(':values', implode(', ', $parameters), $message); + } + + /** + * Replace all place-holders for the required_with rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredWith($message, $attribute, $rule, $parameters) + { + return str_replace(':values', implode(' / ', $this->getAttributeList($parameters)), $message); + } + + /** + * Replace all place-holders for the required_with_all rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredWithAll($message, $attribute, $rule, $parameters) + { + return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the required_without rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredWithout($message, $attribute, $rule, $parameters) + { + return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the required_without_all rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredWithoutAll($message, $attribute, $rule, $parameters) + { + return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the size rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceSize($message, $attribute, $rule, $parameters) + { + return str_replace(':size', $parameters[0], $message); + } + + /** + * Replace all place-holders for the gt rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceGt($message, $attribute, $rule, $parameters) + { + if (is_null($value = $this->getValue($parameters[0]))) { + return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message); + } + + return str_replace(':value', $this->getSize($attribute, $value), $message); + } + + /** + * Replace all place-holders for the lt rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceLt($message, $attribute, $rule, $parameters) + { + if (is_null($value = $this->getValue($parameters[0]))) { + return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message); + } + + return str_replace(':value', $this->getSize($attribute, $value), $message); + } + + /** + * Replace all place-holders for the gte rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceGte($message, $attribute, $rule, $parameters) + { + if (is_null($value = $this->getValue($parameters[0]))) { + return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message); + } + + return str_replace(':value', $this->getSize($attribute, $value), $message); + } + + /** + * Replace all place-holders for the lte rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceLte($message, $attribute, $rule, $parameters) + { + if (is_null($value = $this->getValue($parameters[0]))) { + return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message); + } + + return str_replace(':value', $this->getSize($attribute, $value), $message); + } + + /** + * Replace all place-holders for the required_if rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredIf($message, $attribute, $rule, $parameters) + { + $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0])); + + $parameters[0] = $this->getDisplayableAttribute($parameters[0]); + + return str_replace([':other', ':value'], $parameters, $message); + } + + /** + * Replace all place-holders for the required_unless rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredUnless($message, $attribute, $rule, $parameters) + { + $other = $this->getDisplayableAttribute($parameters[0]); + + $values = []; + + foreach (array_slice($parameters, 1) as $value) { + $values[] = $this->getDisplayableValue($parameters[0], $value); + } + + return str_replace([':other', ':values'], [$other, implode(', ', $values)], $message); + } + + /** + * Replace all place-holders for the same rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceSame($message, $attribute, $rule, $parameters) + { + return str_replace(':other', $this->getDisplayableAttribute($parameters[0]), $message); + } + + /** + * Replace all place-holders for the before rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceBefore($message, $attribute, $rule, $parameters) + { + if (! strtotime($parameters[0])) { + return str_replace(':date', $this->getDisplayableAttribute($parameters[0]), $message); + } + + return str_replace(':date', $this->getDisplayableValue($attribute, $parameters[0]), $message); + } + + /** + * Replace all place-holders for the before_or_equal rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceBeforeOrEqual($message, $attribute, $rule, $parameters) + { + return $this->replaceBefore($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the after rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceAfter($message, $attribute, $rule, $parameters) + { + return $this->replaceBefore($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the after_or_equal rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceAfterOrEqual($message, $attribute, $rule, $parameters) + { + return $this->replaceBefore($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the date_equals rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDateEquals($message, $attribute, $rule, $parameters) + { + return $this->replaceBefore($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the dimensions rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDimensions($message, $attribute, $rule, $parameters) + { + $parameters = $this->parseNamedParameters($parameters); + + if (is_array($parameters)) { + foreach ($parameters as $key => $value) { + $message = str_replace(':'.$key, $value, $message); + } + } + + return $message; + } + + /** + * Replace all place-holders for the ends_with rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceEndsWith($message, $attribute, $rule, $parameters) + { + foreach ($parameters as &$parameter) { + $parameter = $this->getDisplayableValue($attribute, $parameter); + } + + return str_replace(':values', implode(', ', $parameters), $message); + } + + /** + * Replace all place-holders for the starts_with rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceStartsWith($message, $attribute, $rule, $parameters) + { + foreach ($parameters as &$parameter) { + $parameter = $this->getDisplayableValue($attribute, $parameter); + } + + return str_replace(':values', implode(', ', $parameters), $message); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php new file mode 100644 index 00000000..67526a81 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php @@ -0,0 +1,1944 @@ +validateRequired($attribute, $value) && in_array($value, $acceptable, true); + } + + /** + * Validate that an attribute is an active URL. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateActiveUrl($attribute, $value) + { + if (! is_string($value)) { + return false; + } + + if ($url = parse_url($value, PHP_URL_HOST)) { + try { + return count(dns_get_record($url.'.', DNS_A | DNS_AAAA)) > 0; + } catch (Exception $e) { + return false; + } + } + + return false; + } + + /** + * "Break" on first validation fail. + * + * Always returns true, just lets us put "bail" in rules. + * + * @return bool + */ + public function validateBail() + { + return true; + } + + /** + * Validate the date is before a given date. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateBefore($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'before'); + + return $this->compareDates($attribute, $value, $parameters, '<'); + } + + /** + * Validate the date is before or equal a given date. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateBeforeOrEqual($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'before_or_equal'); + + return $this->compareDates($attribute, $value, $parameters, '<='); + } + + /** + * Validate the date is after a given date. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateAfter($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'after'); + + return $this->compareDates($attribute, $value, $parameters, '>'); + } + + /** + * Validate the date is equal or after a given date. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateAfterOrEqual($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'after_or_equal'); + + return $this->compareDates($attribute, $value, $parameters, '>='); + } + + /** + * Compare a given date against another using an operator. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @param string $operator + * @return bool + */ + protected function compareDates($attribute, $value, $parameters, $operator) + { + if (! is_string($value) && ! is_numeric($value) && ! $value instanceof DateTimeInterface) { + return false; + } + + if ($format = $this->getDateFormat($attribute)) { + return $this->checkDateTimeOrder($format, $value, $parameters[0], $operator); + } + + if (! $date = $this->getDateTimestamp($parameters[0])) { + $date = $this->getDateTimestamp($this->getValue($parameters[0])); + } + + return $this->compare($this->getDateTimestamp($value), $date, $operator); + } + + /** + * Get the date format for an attribute if it has one. + * + * @param string $attribute + * @return string|null + */ + protected function getDateFormat($attribute) + { + if ($result = $this->getRule($attribute, 'DateFormat')) { + return $result[1][0]; + } + } + + /** + * Get the date timestamp. + * + * @param mixed $value + * @return int + */ + protected function getDateTimestamp($value) + { + if ($value instanceof DateTimeInterface) { + return $value->getTimestamp(); + } + + if ($this->isTestingRelativeDateTime($value)) { + $date = $this->getDateTime($value); + + if (! is_null($date)) { + return $date->getTimestamp(); + } + } + + return strtotime($value); + } + + /** + * Given two date/time strings, check that one is after the other. + * + * @param string $format + * @param string $first + * @param string $second + * @param string $operator + * @return bool + */ + protected function checkDateTimeOrder($format, $first, $second, $operator) + { + $firstDate = $this->getDateTimeWithOptionalFormat($format, $first); + + if (! $secondDate = $this->getDateTimeWithOptionalFormat($format, $second)) { + $secondDate = $this->getDateTimeWithOptionalFormat($format, $this->getValue($second)); + } + + return ($firstDate && $secondDate) && ($this->compare($firstDate, $secondDate, $operator)); + } + + /** + * Get a DateTime instance from a string. + * + * @param string $format + * @param string $value + * @return \DateTime|null + */ + protected function getDateTimeWithOptionalFormat($format, $value) + { + if ($date = DateTime::createFromFormat('!'.$format, $value)) { + return $date; + } + + return $this->getDateTime($value); + } + + /** + * Get a DateTime instance from a string with no format. + * + * @param string $value + * @return \DateTime|null + */ + protected function getDateTime($value) + { + try { + if ($this->isTestingRelativeDateTime($value)) { + return @Date::parse($value) ?: null; + } + + return date_create($value) ?: null; + } catch (Exception $e) { + // + } + } + + /** + * Check if the given value should be adjusted to Carbon::getTestNow(). + * + * @param mixed $value + * @return bool + */ + protected function isTestingRelativeDateTime($value) + { + return Carbon::hasTestNow() && is_string($value) && ( + $value === 'now' || Carbon::hasRelativeKeywords($value) + ); + } + + /** + * Validate that an attribute contains only alphabetic characters. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateAlpha($attribute, $value) + { + return is_string($value) && preg_match('/^[\pL\pM]+$/u', $value); + } + + /** + * Validate that an attribute contains only alpha-numeric characters, dashes, and underscores. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateAlphaDash($attribute, $value) + { + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + return preg_match('/^[\pL\pM\pN_-]+$/u', $value) > 0; + } + + /** + * Validate that an attribute contains only alpha-numeric characters. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateAlphaNum($attribute, $value) + { + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + return preg_match('/^[\pL\pM\pN]+$/u', $value) > 0; + } + + /** + * Validate that an attribute is an array. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateArray($attribute, $value) + { + return is_array($value); + } + + /** + * Validate the size of an attribute is between a set of values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateBetween($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'between'); + + $size = $this->getSize($attribute, $value); + + return $size >= $parameters[0] && $size <= $parameters[1]; + } + + /** + * Validate that an attribute is a boolean. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateBoolean($attribute, $value) + { + $acceptable = [true, false, 0, 1, '0', '1']; + + return in_array($value, $acceptable, true); + } + + /** + * Validate that an attribute has a matching confirmation. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateConfirmed($attribute, $value) + { + return $this->validateSame($attribute, $value, [$attribute.'_confirmation']); + } + + /** + * Validate that an attribute is a valid date. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateDate($attribute, $value) + { + if ($value instanceof DateTimeInterface) { + return true; + } + + if ((! is_string($value) && ! is_numeric($value)) || strtotime($value) === false) { + return false; + } + + $date = date_parse($value); + + return checkdate($date['month'], $date['day'], $date['year']); + } + + /** + * Validate that an attribute matches a date format. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDateFormat($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'date_format'); + + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + $format = $parameters[0]; + + $date = DateTime::createFromFormat('!'.$format, $value); + + return $date && $date->format($format) == $value; + } + + /** + * Validate that an attribute is equal to another date. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDateEquals($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'date_equals'); + + return $this->compareDates($attribute, $value, $parameters, '='); + } + + /** + * Validate that an attribute is different from another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDifferent($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'different'); + + foreach ($parameters as $parameter) { + if (! Arr::has($this->data, $parameter)) { + return false; + } + + $other = Arr::get($this->data, $parameter); + + if ($value === $other) { + return false; + } + } + + return true; + } + + /** + * Validate that an attribute has a given number of digits. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDigits($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'digits'); + + return ! preg_match('/[^0-9]/', $value) + && strlen((string) $value) == $parameters[0]; + } + + /** + * Validate that an attribute is between a given number of digits. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDigitsBetween($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'digits_between'); + + $length = strlen((string) $value); + + return ! preg_match('/[^0-9.]/', $value) + && $length >= $parameters[0] && $length <= $parameters[1]; + } + + /** + * Validate the dimensions of an image matches the given values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDimensions($attribute, $value, $parameters) + { + if ($this->isValidFileInstance($value) && in_array($value->getMimeType(), ['image/svg+xml', 'image/svg'])) { + return true; + } + + if (! $this->isValidFileInstance($value) || ! $sizeDetails = @getimagesize($value->getRealPath())) { + return false; + } + + $this->requireParameterCount(1, $parameters, 'dimensions'); + + [$width, $height] = $sizeDetails; + + $parameters = $this->parseNamedParameters($parameters); + + if ($this->failsBasicDimensionChecks($parameters, $width, $height) || + $this->failsRatioCheck($parameters, $width, $height)) { + return false; + } + + return true; + } + + /** + * Test if the given width and height fail any conditions. + * + * @param array $parameters + * @param int $width + * @param int $height + * @return bool + */ + protected function failsBasicDimensionChecks($parameters, $width, $height) + { + return (isset($parameters['width']) && $parameters['width'] != $width) || + (isset($parameters['min_width']) && $parameters['min_width'] > $width) || + (isset($parameters['max_width']) && $parameters['max_width'] < $width) || + (isset($parameters['height']) && $parameters['height'] != $height) || + (isset($parameters['min_height']) && $parameters['min_height'] > $height) || + (isset($parameters['max_height']) && $parameters['max_height'] < $height); + } + + /** + * Determine if the given parameters fail a dimension ratio check. + * + * @param array $parameters + * @param int $width + * @param int $height + * @return bool + */ + protected function failsRatioCheck($parameters, $width, $height) + { + if (! isset($parameters['ratio'])) { + return false; + } + + [$numerator, $denominator] = array_replace( + [1, 1], array_filter(sscanf($parameters['ratio'], '%f/%d')) + ); + + $precision = 1 / (max($width, $height) + 1); + + return abs($numerator / $denominator - $width / $height) > $precision; + } + + /** + * Validate an attribute is unique among other values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDistinct($attribute, $value, $parameters) + { + $data = Arr::except($this->getDistinctValues($attribute), $attribute); + + if (in_array('ignore_case', $parameters)) { + return empty(preg_grep('/^'.preg_quote($value, '/').'$/iu', $data)); + } + + return ! in_array($value, array_values($data)); + } + + /** + * Get the values to distinct between. + * + * @param string $attribute + * @return array + */ + protected function getDistinctValues($attribute) + { + $attributeName = $this->getPrimaryAttribute($attribute); + + if (! property_exists($this, 'distinctValues')) { + return $this->extractDistinctValues($attributeName); + } + + if (! array_key_exists($attributeName, $this->distinctValues)) { + $this->distinctValues[$attributeName] = $this->extractDistinctValues($attributeName); + } + + return $this->distinctValues[$attributeName]; + } + + /** + * Extract the distinct values from the data. + * + * @param string $attribute + * @return array + */ + protected function extractDistinctValues($attribute) + { + $attributeData = ValidationData::extractDataFromPath( + ValidationData::getLeadingExplicitAttributePath($attribute), $this->data + ); + + $pattern = str_replace('\*', '[^.]+', preg_quote($attribute, '#')); + + return Arr::where(Arr::dot($attributeData), function ($value, $key) use ($pattern) { + return (bool) preg_match('#^'.$pattern.'\z#u', $key); + }); + } + + /** + * Validate that an attribute is a valid e-mail address. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateEmail($attribute, $value, $parameters) + { + if (! is_string($value) && ! (is_object($value) && method_exists($value, '__toString'))) { + return false; + } + + $validations = collect($parameters) + ->unique() + ->map(function ($validation) { + if ($validation === 'rfc') { + return new RFCValidation(); + } elseif ($validation === 'strict') { + return new NoRFCWarningsValidation(); + } elseif ($validation === 'dns') { + return new DNSCheckValidation(); + } elseif ($validation === 'spoof') { + return new SpoofCheckValidation(); + } elseif ($validation === 'filter') { + return new FilterEmailValidation(); + } + }) + ->values() + ->all() ?: [new RFCValidation()]; + + return (new EmailValidator)->isValid($value, new MultipleValidationWithAnd($validations)); + } + + /** + * Validate the existence of an attribute value in a database table. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateExists($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'exists'); + + [$connection, $table] = $this->parseTable($parameters[0]); + + // The second parameter position holds the name of the column that should be + // verified as existing. If this parameter is not specified we will guess + // that the columns being "verified" shares the given attribute's name. + $column = $this->getQueryColumn($parameters, $attribute); + + $expected = is_array($value) ? count(array_unique($value)) : 1; + + return $this->getExistCount( + $connection, $table, $column, $value, $parameters + ) >= $expected; + } + + /** + * Get the number of records that exist in storage. + * + * @param mixed $connection + * @param string $table + * @param string $column + * @param mixed $value + * @param array $parameters + * @return int + */ + protected function getExistCount($connection, $table, $column, $value, $parameters) + { + $verifier = $this->getPresenceVerifierFor($connection); + + $extra = $this->getExtraConditions( + array_values(array_slice($parameters, 2)) + ); + + if ($this->currentRule instanceof Exists) { + $extra = array_merge($extra, $this->currentRule->queryCallbacks()); + } + + return is_array($value) + ? $verifier->getMultiCount($table, $column, $value, $extra) + : $verifier->getCount($table, $column, $value, null, null, $extra); + } + + /** + * Validate the uniqueness of an attribute value on a given database table. + * + * If a database column is not specified, the attribute will be used. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateUnique($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'unique'); + + [$connection, $table] = $this->parseTable($parameters[0]); + + // The second parameter position holds the name of the column that needs to + // be verified as unique. If this parameter isn't specified we will just + // assume that this column to be verified shares the attribute's name. + $column = $this->getQueryColumn($parameters, $attribute); + + [$idColumn, $id] = [null, null]; + + if (isset($parameters[2])) { + [$idColumn, $id] = $this->getUniqueIds($parameters); + + if (! is_null($id)) { + $id = stripslashes($id); + } + } + + // The presence verifier is responsible for counting rows within this store + // mechanism which might be a relational database or any other permanent + // data store like Redis, etc. We will use it to determine uniqueness. + $verifier = $this->getPresenceVerifierFor($connection); + + $extra = $this->getUniqueExtra($parameters); + + if ($this->currentRule instanceof Unique) { + $extra = array_merge($extra, $this->currentRule->queryCallbacks()); + } + + return $verifier->getCount( + $table, $column, $value, $id, $idColumn, $extra + ) == 0; + } + + /** + * Get the excluded ID column and value for the unique rule. + * + * @param array $parameters + * @return array + */ + protected function getUniqueIds($parameters) + { + $idColumn = $parameters[3] ?? 'id'; + + return [$idColumn, $this->prepareUniqueId($parameters[2])]; + } + + /** + * Prepare the given ID for querying. + * + * @param mixed $id + * @return int + */ + protected function prepareUniqueId($id) + { + if (preg_match('/\[(.*)\]/', $id, $matches)) { + $id = $this->getValue($matches[1]); + } + + if (strtolower($id) === 'null') { + $id = null; + } + + if (filter_var($id, FILTER_VALIDATE_INT) !== false) { + $id = (int) $id; + } + + return $id; + } + + /** + * Get the extra conditions for a unique rule. + * + * @param array $parameters + * @return array + */ + protected function getUniqueExtra($parameters) + { + if (isset($parameters[4])) { + return $this->getExtraConditions(array_slice($parameters, 4)); + } + + return []; + } + + /** + * Parse the connection / table for the unique / exists rules. + * + * @param string $table + * @return array + */ + public function parseTable($table) + { + [$connection, $table] = Str::contains($table, '.') ? explode('.', $table, 2) : [null, $table]; + + if (Str::contains($table, '\\') && class_exists($table) && is_a($table, Model::class, true)) { + $model = new $table; + + $table = $model->getTable(); + + $connection = $connection ?? $model->getConnectionName(); + } + + return [$connection, $table]; + } + + /** + * Get the column name for an exists / unique query. + * + * @param array $parameters + * @param string $attribute + * @return bool + */ + public function getQueryColumn($parameters, $attribute) + { + return isset($parameters[1]) && $parameters[1] !== 'NULL' + ? $parameters[1] : $this->guessColumnForQuery($attribute); + } + + /** + * Guess the database column from the given attribute name. + * + * @param string $attribute + * @return string + */ + public function guessColumnForQuery($attribute) + { + if (in_array($attribute, Arr::collapse($this->implicitAttributes)) + && ! is_numeric($last = last(explode('.', $attribute)))) { + return $last; + } + + return $attribute; + } + + /** + * Get the extra conditions for a unique / exists rule. + * + * @param array $segments + * @return array + */ + protected function getExtraConditions(array $segments) + { + $extra = []; + + $count = count($segments); + + for ($i = 0; $i < $count; $i += 2) { + $extra[$segments[$i]] = $segments[$i + 1]; + } + + return $extra; + } + + /** + * Validate the given value is a valid file. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateFile($attribute, $value) + { + return $this->isValidFileInstance($value); + } + + /** + * Validate the given attribute is filled if it is present. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateFilled($attribute, $value) + { + if (Arr::has($this->data, $attribute)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute is greater than another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateGt($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'gt'); + + $comparedToValue = $this->getValue($parameters[0]); + + $this->shouldBeNumeric($attribute, 'Gt'); + + if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { + return $this->getSize($attribute, $value) > $parameters[0]; + } + + if (is_numeric($parameters[0])) { + return false; + } + + if ($this->hasRule($attribute, $this->numericRules) && is_numeric($value) && is_numeric($comparedToValue)) { + return $value > $comparedToValue; + } + + if (! $this->isSameType($value, $comparedToValue)) { + return false; + } + + return $this->getSize($attribute, $value) > $this->getSize($attribute, $comparedToValue); + } + + /** + * Validate that an attribute is less than another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateLt($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'lt'); + + $comparedToValue = $this->getValue($parameters[0]); + + $this->shouldBeNumeric($attribute, 'Lt'); + + if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { + return $this->getSize($attribute, $value) < $parameters[0]; + } + + if (is_numeric($parameters[0])) { + return false; + } + + if ($this->hasRule($attribute, $this->numericRules) && is_numeric($value) && is_numeric($comparedToValue)) { + return $value < $comparedToValue; + } + + if (! $this->isSameType($value, $comparedToValue)) { + return false; + } + + return $this->getSize($attribute, $value) < $this->getSize($attribute, $comparedToValue); + } + + /** + * Validate that an attribute is greater than or equal another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateGte($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'gte'); + + $comparedToValue = $this->getValue($parameters[0]); + + $this->shouldBeNumeric($attribute, 'Gte'); + + if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { + return $this->getSize($attribute, $value) >= $parameters[0]; + } + + if (is_numeric($parameters[0])) { + return false; + } + + if ($this->hasRule($attribute, $this->numericRules) && is_numeric($value) && is_numeric($comparedToValue)) { + return $value >= $comparedToValue; + } + + if (! $this->isSameType($value, $comparedToValue)) { + return false; + } + + return $this->getSize($attribute, $value) >= $this->getSize($attribute, $comparedToValue); + } + + /** + * Validate that an attribute is less than or equal another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateLte($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'lte'); + + $comparedToValue = $this->getValue($parameters[0]); + + $this->shouldBeNumeric($attribute, 'Lte'); + + if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { + return $this->getSize($attribute, $value) <= $parameters[0]; + } + + if (is_numeric($parameters[0])) { + return false; + } + + if ($this->hasRule($attribute, $this->numericRules) && is_numeric($value) && is_numeric($comparedToValue)) { + return $value <= $comparedToValue; + } + + if (! $this->isSameType($value, $comparedToValue)) { + return false; + } + + return $this->getSize($attribute, $value) <= $this->getSize($attribute, $comparedToValue); + } + + /** + * Validate the MIME type of a file is an image MIME type. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateImage($attribute, $value) + { + return $this->validateMimes($attribute, $value, ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp']); + } + + /** + * Validate an attribute is contained within a list of values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateIn($attribute, $value, $parameters) + { + if (is_array($value) && $this->hasRule($attribute, 'Array')) { + foreach ($value as $element) { + if (is_array($element)) { + return false; + } + } + + return count(array_diff($value, $parameters)) === 0; + } + + return ! is_array($value) && in_array((string) $value, $parameters); + } + + /** + * Validate that the values of an attribute is in another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateInArray($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'in_array'); + + $explicitPath = ValidationData::getLeadingExplicitAttributePath($parameters[0]); + + $attributeData = ValidationData::extractDataFromPath($explicitPath, $this->data); + + $otherValues = Arr::where(Arr::dot($attributeData), function ($value, $key) use ($parameters) { + return Str::is($parameters[0], $key); + }); + + return in_array($value, $otherValues); + } + + /** + * Validate that an attribute is an integer. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateInteger($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_INT) !== false; + } + + /** + * Validate that an attribute is a valid IP. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateIp($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_IP) !== false; + } + + /** + * Validate that an attribute is a valid IPv4. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateIpv4($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false; + } + + /** + * Validate that an attribute is a valid IPv6. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateIpv6($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false; + } + + /** + * Validate the attribute is a valid JSON string. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateJson($attribute, $value) + { + if (is_array($value)) { + return false; + } + + if (! is_scalar($value) && ! is_null($value) && ! method_exists($value, '__toString')) { + return false; + } + + json_decode($value); + + return json_last_error() === JSON_ERROR_NONE; + } + + /** + * Validate the size of an attribute is less than a maximum value. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateMax($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'max'); + + if ($value instanceof UploadedFile && ! $value->isValid()) { + return false; + } + + return $this->getSize($attribute, $value) <= $parameters[0]; + } + + /** + * Validate the guessed extension of a file upload is in a set of file extensions. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateMimes($attribute, $value, $parameters) + { + if (! $this->isValidFileInstance($value)) { + return false; + } + + if ($this->shouldBlockPhpUpload($value, $parameters)) { + return false; + } + + if (in_array('jpg', $parameters) || in_array('jpeg', $parameters)) { + $parameters = array_unique(array_merge($parameters, ['jpg', 'jpeg'])); + } + + return $value->getPath() !== '' && in_array($value->guessExtension(), $parameters); + } + + /** + * Validate the MIME type of a file upload attribute is in a set of MIME types. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateMimetypes($attribute, $value, $parameters) + { + if (! $this->isValidFileInstance($value)) { + return false; + } + + if ($this->shouldBlockPhpUpload($value, $parameters)) { + return false; + } + + return $value->getPath() !== '' && + (in_array($value->getMimeType(), $parameters) || + in_array(explode('/', $value->getMimeType())[0].'/*', $parameters)); + } + + /** + * Check if PHP uploads are explicitly allowed. + * + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function shouldBlockPhpUpload($value, $parameters) + { + if (in_array('php', $parameters)) { + return false; + } + + $phpExtensions = [ + 'php', 'php3', 'php4', 'php5', 'phtml', 'phar', + ]; + + return ($value instanceof UploadedFile) + ? in_array(trim(strtolower($value->getClientOriginalExtension())), $phpExtensions) + : in_array(trim(strtolower($value->getExtension())), $phpExtensions); + } + + /** + * Validate the size of an attribute is greater than a minimum value. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateMin($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'min'); + + return $this->getSize($attribute, $value) >= $parameters[0]; + } + + /** + * "Indicate" validation should pass if value is null. + * + * Always returns true, just lets us put "nullable" in rules. + * + * @return bool + */ + public function validateNullable() + { + return true; + } + + /** + * Validate an attribute is not contained within a list of values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateNotIn($attribute, $value, $parameters) + { + return ! $this->validateIn($attribute, $value, $parameters); + } + + /** + * Validate that an attribute is numeric. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateNumeric($attribute, $value) + { + return is_numeric($value); + } + + /** + * Validate that the current logged in user's password matches the given value. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validatePassword($attribute, $value, $parameters) + { + $auth = $this->container->make('auth'); + $hasher = $this->container->make('hash'); + + $guard = $auth->guard(Arr::first($parameters)); + + if ($guard->guest()) { + return false; + } + + return $hasher->check($value, $guard->user()->getAuthPassword()); + } + + /** + * Validate that an attribute exists even if not filled. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validatePresent($attribute, $value) + { + return Arr::has($this->data, $attribute); + } + + /** + * Validate that an attribute passes a regular expression check. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateRegex($attribute, $value, $parameters) + { + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + $this->requireParameterCount(1, $parameters, 'regex'); + + return preg_match($parameters[0], $value) > 0; + } + + /** + * Validate that an attribute does not pass a regular expression check. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateNotRegex($attribute, $value, $parameters) + { + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + $this->requireParameterCount(1, $parameters, 'not_regex'); + + return preg_match($parameters[0], $value) < 1; + } + + /** + * Validate that a required attribute exists. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateRequired($attribute, $value) + { + if (is_null($value)) { + return false; + } elseif (is_string($value) && trim($value) === '') { + return false; + } elseif ((is_array($value) || $value instanceof Countable) && count($value) < 1) { + return false; + } elseif ($value instanceof File) { + return (string) $value->getPath() !== ''; + } + + return true; + } + + /** + * Validate that an attribute exists when another attribute has a given value. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredIf($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'required_if'); + + if (! Arr::has($this->data, $parameters[0])) { + return true; + } + + [$values, $other] = $this->prepareValuesAndOther($parameters); + + if (in_array($other, $values, is_bool($other) || is_null($other))) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Indicate that an attribute should be excluded when another attribute has a given value. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateExcludeIf($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'exclude_if'); + + if (! Arr::has($this->data, $parameters[0])) { + return true; + } + + [$values, $other] = $this->prepareValuesAndOther($parameters); + + return ! in_array($other, $values, is_bool($other) || is_null($other)); + } + + /** + * Indicate that an attribute should be excluded when another attribute does not have a given value. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateExcludeUnless($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'exclude_unless'); + + [$values, $other] = $this->prepareValuesAndOther($parameters); + + return in_array($other, $values, is_bool($other) || is_null($other)); + } + + /** + * Validate that an attribute exists when another attribute does not have a given value. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredUnless($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'required_unless'); + + [$values, $other] = $this->prepareValuesAndOther($parameters); + + if (! in_array($other, $values, is_bool($other) || is_null($other))) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Prepare the values and the other value for validation. + * + * @param array $parameters + * @return array + */ + protected function prepareValuesAndOther($parameters) + { + $other = Arr::get($this->data, $parameters[0]); + + $values = array_slice($parameters, 1); + + if ($this->shouldConvertToBoolean($parameters[0]) || is_bool($other)) { + $values = $this->convertValuesToBoolean($values); + } + + if (is_null($other)) { + $values = $this->convertValuesToNull($values); + } + + return [$values, $other]; + } + + /** + * Check if parameter should be converted to boolean. + * + * @param string $parameter + * @return bool + */ + protected function shouldConvertToBoolean($parameter) + { + return in_array('boolean', Arr::get($this->rules, $parameter, [])); + } + + /** + * Convert the given values to boolean if they are string "true" / "false". + * + * @param array $values + * @return array + */ + protected function convertValuesToBoolean($values) + { + return array_map(function ($value) { + if ($value === 'true') { + return true; + } elseif ($value === 'false') { + return false; + } + + return $value; + }, $values); + } + + /** + * Convert the given values to null if they are string "null". + * + * @param array $values + * @return array + */ + protected function convertValuesToNull($values) + { + return array_map(function ($value) { + return Str::lower($value) === 'null' ? null : $value; + }, $values); + } + + /** + * Validate that an attribute exists when any other attribute exists. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredWith($attribute, $value, $parameters) + { + if (! $this->allFailingRequired($parameters)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute exists when all other attributes exists. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredWithAll($attribute, $value, $parameters) + { + if (! $this->anyFailingRequired($parameters)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute exists when another attribute does not. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredWithout($attribute, $value, $parameters) + { + if ($this->anyFailingRequired($parameters)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute exists when all other attributes do not. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredWithoutAll($attribute, $value, $parameters) + { + if ($this->allFailingRequired($parameters)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Determine if any of the given attributes fail the required test. + * + * @param array $attributes + * @return bool + */ + protected function anyFailingRequired(array $attributes) + { + foreach ($attributes as $key) { + if (! $this->validateRequired($key, $this->getValue($key))) { + return true; + } + } + + return false; + } + + /** + * Determine if all of the given attributes fail the required test. + * + * @param array $attributes + * @return bool + */ + protected function allFailingRequired(array $attributes) + { + foreach ($attributes as $key) { + if ($this->validateRequired($key, $this->getValue($key))) { + return false; + } + } + + return true; + } + + /** + * Validate that two attributes match. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateSame($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'same'); + + $other = Arr::get($this->data, $parameters[0]); + + return $value === $other; + } + + /** + * Validate the size of an attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateSize($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'size'); + + return $this->getSize($attribute, $value) == $parameters[0]; + } + + /** + * "Validate" optional attributes. + * + * Always returns true, just lets us put sometimes in rules. + * + * @return bool + */ + public function validateSometimes() + { + return true; + } + + /** + * Validate the attribute starts with a given substring. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateStartsWith($attribute, $value, $parameters) + { + return Str::startsWith($value, $parameters); + } + + /** + * Validate the attribute ends with a given substring. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateEndsWith($attribute, $value, $parameters) + { + return Str::endsWith($value, $parameters); + } + + /** + * Validate that an attribute is a string. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateString($attribute, $value) + { + return is_string($value); + } + + /** + * Validate that an attribute is a valid timezone. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateTimezone($attribute, $value) + { + try { + new DateTimeZone($value); + } catch (Exception $e) { + return false; + } catch (Throwable $e) { + return false; + } + + return true; + } + + /** + * Validate that an attribute is a valid URL. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateUrl($attribute, $value) + { + if (! is_string($value)) { + return false; + } + + /* + * This pattern is derived from Symfony\Component\Validator\Constraints\UrlValidator (5.0.7). + * + * (c) Fabien Potencier http://symfony.com + */ + $pattern = '~^ + (aaa|aaas|about|acap|acct|acd|acr|adiumxtra|adt|afp|afs|aim|amss|android|appdata|apt|ark|attachment|aw|barion|beshare|bitcoin|bitcoincash|blob|bolo|browserext|calculator|callto|cap|cast|casts|chrome|chrome-extension|cid|coap|coap\+tcp|coap\+ws|coaps|coaps\+tcp|coaps\+ws|com-eventbrite-attendee|content|conti|crid|cvs|dab|data|dav|diaspora|dict|did|dis|dlna-playcontainer|dlna-playsingle|dns|dntp|dpp|drm|drop|dtn|dvb|ed2k|elsi|example|facetime|fax|feed|feedready|file|filesystem|finger|first-run-pen-experience|fish|fm|ftp|fuchsia-pkg|geo|gg|git|gizmoproject|go|gopher|graph|gtalk|h323|ham|hcap|hcp|http|https|hxxp|hxxps|hydrazone|iax|icap|icon|im|imap|info|iotdisco|ipn|ipp|ipps|irc|irc6|ircs|iris|iris\.beep|iris\.lwz|iris\.xpc|iris\.xpcs|isostore|itms|jabber|jar|jms|keyparc|lastfm|ldap|ldaps|leaptofrogans|lorawan|lvlt|magnet|mailserver|mailto|maps|market|message|mid|mms|modem|mongodb|moz|ms-access|ms-browser-extension|ms-calculator|ms-drive-to|ms-enrollment|ms-excel|ms-eyecontrolspeech|ms-gamebarservices|ms-gamingoverlay|ms-getoffice|ms-help|ms-infopath|ms-inputapp|ms-lockscreencomponent-config|ms-media-stream-id|ms-mixedrealitycapture|ms-mobileplans|ms-officeapp|ms-people|ms-project|ms-powerpoint|ms-publisher|ms-restoretabcompanion|ms-screenclip|ms-screensketch|ms-search|ms-search-repair|ms-secondary-screen-controller|ms-secondary-screen-setup|ms-settings|ms-settings-airplanemode|ms-settings-bluetooth|ms-settings-camera|ms-settings-cellular|ms-settings-cloudstorage|ms-settings-connectabledevices|ms-settings-displays-topology|ms-settings-emailandaccounts|ms-settings-language|ms-settings-location|ms-settings-lock|ms-settings-nfctransactions|ms-settings-notifications|ms-settings-power|ms-settings-privacy|ms-settings-proximity|ms-settings-screenrotation|ms-settings-wifi|ms-settings-workplace|ms-spd|ms-sttoverlay|ms-transit-to|ms-useractivityset|ms-virtualtouchpad|ms-visio|ms-walk-to|ms-whiteboard|ms-whiteboard-cmd|ms-word|msnim|msrp|msrps|mss|mtqp|mumble|mupdate|mvn|news|nfs|ni|nih|nntp|notes|ocf|oid|onenote|onenote-cmd|opaquelocktoken|openpgp4fpr|pack|palm|paparazzi|payto|pkcs11|platform|pop|pres|prospero|proxy|pwid|psyc|pttp|qb|query|redis|rediss|reload|res|resource|rmi|rsync|rtmfp|rtmp|rtsp|rtsps|rtspu|s3|secondlife|service|session|sftp|sgn|shttp|sieve|simpleledger|sip|sips|skype|smb|sms|smtp|snews|snmp|soap\.beep|soap\.beeps|soldat|spiffe|spotify|ssh|steam|stun|stuns|submit|svn|tag|teamspeak|tel|teliaeid|telnet|tftp|things|thismessage|tip|tn3270|tool|turn|turns|tv|udp|unreal|urn|ut2004|v-event|vemmi|ventrilo|videotex|vnc|view-source|wais|webcal|wpid|ws|wss|wtai|wyciwyg|xcon|xcon-userid|xfire|xmlrpc\.beep|xmlrpc\.beeps|xmpp|xri|ymsgr|z39\.50|z39\.50r|z39\.50s):// # protocol + (((?:[\_\.\pL\pN-]|%[0-9A-Fa-f]{2})+:)?((?:[\_\.\pL\pN-]|%[0-9A-Fa-f]{2})+)@)? # basic auth + ( + ([\pL\pN\pS\-\_\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name + | # or + \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address + | # or + \[ + (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::)))) + \] # an IPv6 address + ) + (:[0-9]+)? # a port (optional) + (?:/ (?:[\pL\pN\-._\~!$&\'()*+,;=:@]|%[0-9A-Fa-f]{2})* )* # a path + (?:\? (?:[\pL\pN\-._\~!$&\'\[\]()*+,;=:@/?]|%[0-9A-Fa-f]{2})* )? # a query (optional) + (?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%[0-9A-Fa-f]{2})* )? # a fragment (optional) + $~ixu'; + + return preg_match($pattern, $value) > 0; + } + + /** + * Validate that an attribute is a valid UUID. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateUuid($attribute, $value) + { + return Str::isUuid($value); + } + + /** + * Get the size of an attribute. + * + * @param string $attribute + * @param mixed $value + * @return mixed + */ + protected function getSize($attribute, $value) + { + $hasNumeric = $this->hasRule($attribute, $this->numericRules); + + // This method will determine if the attribute is a number, string, or file and + // return the proper size accordingly. If it is a number, then number itself + // is the size. If it is a file, we take kilobytes, and for a string the + // entire length of the string will be considered the attribute size. + if (is_numeric($value) && $hasNumeric) { + return $value; + } elseif (is_array($value)) { + return count($value); + } elseif ($value instanceof File) { + return $value->getSize() / 1024; + } + + return mb_strlen($value); + } + + /** + * Check that the given value is a valid file instance. + * + * @param mixed $value + * @return bool + */ + public function isValidFileInstance($value) + { + if ($value instanceof UploadedFile && ! $value->isValid()) { + return false; + } + + return $value instanceof File; + } + + /** + * Determine if a comparison passes between the given values. + * + * @param mixed $first + * @param mixed $second + * @param string $operator + * @return bool + * + * @throws \InvalidArgumentException + */ + protected function compare($first, $second, $operator) + { + switch ($operator) { + case '<': + return $first < $second; + case '>': + return $first > $second; + case '<=': + return $first <= $second; + case '>=': + return $first >= $second; + case '=': + return $first == $second; + default: + throw new InvalidArgumentException; + } + } + + /** + * Parse named parameters to $key => $value items. + * + * @param array $parameters + * @return array + */ + protected function parseNamedParameters($parameters) + { + return array_reduce($parameters, function ($result, $item) { + [$key, $value] = array_pad(explode('=', $item, 2), 2, null); + + $result[$key] = $value; + + return $result; + }); + } + + /** + * Require a certain number of parameters to be present. + * + * @param int $count + * @param array $parameters + * @param string $rule + * @return void + * + * @throws \InvalidArgumentException + */ + public function requireParameterCount($count, $parameters, $rule) + { + if (count($parameters) < $count) { + throw new InvalidArgumentException("Validation rule $rule requires at least $count parameters."); + } + } + + /** + * Check if the parameters are of the same type. + * + * @param mixed $first + * @param mixed $second + * @return bool + */ + protected function isSameType($first, $second) + { + return gettype($first) == gettype($second); + } + + /** + * Adds the existing rule to the numericRules array if the attribute's value is numeric. + * + * @param string $attribute + * @param string $rule + * @return void + */ + protected function shouldBeNumeric($attribute, $rule) + { + if (is_numeric($this->getValue($attribute))) { + $this->numericRules[] = $rule; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php b/vendor/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php new file mode 100755 index 00000000..15653648 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php @@ -0,0 +1,138 @@ +db = $db; + } + + /** + * Count the number of objects in a collection having the given value. + * + * @param string $collection + * @param string $column + * @param string $value + * @param int|null $excludeId + * @param string|null $idColumn + * @param array $extra + * @return int + */ + public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = []) + { + $query = $this->table($collection)->where($column, '=', $value); + + if (! is_null($excludeId) && $excludeId !== 'NULL') { + $query->where($idColumn ?: 'id', '<>', $excludeId); + } + + return $this->addConditions($query, $extra)->count(); + } + + /** + * Count the number of objects in a collection with the given values. + * + * @param string $collection + * @param string $column + * @param array $values + * @param array $extra + * @return int + */ + public function getMultiCount($collection, $column, array $values, array $extra = []) + { + $query = $this->table($collection)->whereIn($column, $values); + + return $this->addConditions($query, $extra)->distinct()->count($column); + } + + /** + * Add the given conditions to the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $conditions + * @return \Illuminate\Database\Query\Builder + */ + protected function addConditions($query, $conditions) + { + foreach ($conditions as $key => $value) { + if ($value instanceof Closure) { + $query->where(function ($query) use ($value) { + $value($query); + }); + } else { + $this->addWhere($query, $key, $value); + } + } + + return $query; + } + + /** + * Add a "where" clause to the given query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $key + * @param string $extraValue + * @return void + */ + protected function addWhere($query, $key, $extraValue) + { + if ($extraValue === 'NULL') { + $query->whereNull($key); + } elseif ($extraValue === 'NOT_NULL') { + $query->whereNotNull($key); + } elseif (Str::startsWith($extraValue, '!')) { + $query->where($key, '!=', mb_substr($extraValue, 1)); + } else { + $query->where($key, $extraValue); + } + } + + /** + * Get a query builder for the given table. + * + * @param string $table + * @return \Illuminate\Database\Query\Builder + */ + public function table($table) + { + return $this->db->connection($this->connection)->table($table)->useWritePdo(); + } + + /** + * Set the connection to be used. + * + * @param string $connection + * @return void + */ + public function setConnection($connection) + { + $this->connection = $connection; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Factory.php b/vendor/laravel/framework/src/Illuminate/Validation/Factory.php new file mode 100755 index 00000000..cd2ff706 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Factory.php @@ -0,0 +1,283 @@ +container = $container; + $this->translator = $translator; + } + + /** + * Create a new Validator instance. + * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return \Illuminate\Validation\Validator + */ + public function make(array $data, array $rules, array $messages = [], array $customAttributes = []) + { + $validator = $this->resolve( + $data, $rules, $messages, $customAttributes + ); + + // The presence verifier is responsible for checking the unique and exists data + // for the validator. It is behind an interface so that multiple versions of + // it may be written besides database. We'll inject it into the validator. + if (! is_null($this->verifier)) { + $validator->setPresenceVerifier($this->verifier); + } + + // Next we'll set the IoC container instance of the validator, which is used to + // resolve out class based validator extensions. If it is not set then these + // types of extensions will not be possible on these validation instances. + if (! is_null($this->container)) { + $validator->setContainer($this->container); + } + + $this->addExtensions($validator); + + return $validator; + } + + /** + * Validate the given data against the provided rules. + * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return array + * + * @throws \Illuminate\Validation\ValidationException + */ + public function validate(array $data, array $rules, array $messages = [], array $customAttributes = []) + { + return $this->make($data, $rules, $messages, $customAttributes)->validate(); + } + + /** + * Resolve a new Validator instance. + * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return \Illuminate\Validation\Validator + */ + protected function resolve(array $data, array $rules, array $messages, array $customAttributes) + { + if (is_null($this->resolver)) { + return new Validator($this->translator, $data, $rules, $messages, $customAttributes); + } + + return call_user_func($this->resolver, $this->translator, $data, $rules, $messages, $customAttributes); + } + + /** + * Add the extensions to a validator instance. + * + * @param \Illuminate\Validation\Validator $validator + * @return void + */ + protected function addExtensions(Validator $validator) + { + $validator->addExtensions($this->extensions); + + // Next, we will add the implicit extensions, which are similar to the required + // and accepted rule in that they are run even if the attributes is not in a + // array of data that is given to a validator instances via instantiation. + $validator->addImplicitExtensions($this->implicitExtensions); + + $validator->addDependentExtensions($this->dependentExtensions); + + $validator->addReplacers($this->replacers); + + $validator->setFallbackMessages($this->fallbackMessages); + } + + /** + * Register a custom validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string|null $message + * @return void + */ + public function extend($rule, $extension, $message = null) + { + $this->extensions[$rule] = $extension; + + if ($message) { + $this->fallbackMessages[Str::snake($rule)] = $message; + } + } + + /** + * Register a custom implicit validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string|null $message + * @return void + */ + public function extendImplicit($rule, $extension, $message = null) + { + $this->implicitExtensions[$rule] = $extension; + + if ($message) { + $this->fallbackMessages[Str::snake($rule)] = $message; + } + } + + /** + * Register a custom dependent validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string|null $message + * @return void + */ + public function extendDependent($rule, $extension, $message = null) + { + $this->dependentExtensions[$rule] = $extension; + + if ($message) { + $this->fallbackMessages[Str::snake($rule)] = $message; + } + } + + /** + * Register a custom validator message replacer. + * + * @param string $rule + * @param \Closure|string $replacer + * @return void + */ + public function replacer($rule, $replacer) + { + $this->replacers[$rule] = $replacer; + } + + /** + * Set the Validator instance resolver. + * + * @param \Closure $resolver + * @return void + */ + public function resolver(Closure $resolver) + { + $this->resolver = $resolver; + } + + /** + * Get the Translator implementation. + * + * @return \Illuminate\Contracts\Translation\Translator + */ + public function getTranslator() + { + return $this->translator; + } + + /** + * Get the Presence Verifier implementation. + * + * @return \Illuminate\Validation\PresenceVerifierInterface + */ + public function getPresenceVerifier() + { + return $this->verifier; + } + + /** + * Set the Presence Verifier implementation. + * + * @param \Illuminate\Validation\PresenceVerifierInterface $presenceVerifier + * @return void + */ + public function setPresenceVerifier(PresenceVerifierInterface $presenceVerifier) + { + $this->verifier = $presenceVerifier; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/LICENSE.md b/vendor/laravel/framework/src/Illuminate/Validation/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php b/vendor/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php new file mode 100755 index 00000000..da58a121 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php @@ -0,0 +1,30 @@ +toArray(); + } + + return new In(is_array($values) ? $values : func_get_args()); + } + + /** + * Get a not_in constraint builder instance. + * + * @param \Illuminate\Contracts\Support\Arrayable|array|string $values + * @return \Illuminate\Validation\Rules\NotIn + */ + public static function notIn($values) + { + if ($values instanceof Arrayable) { + $values = $values->toArray(); + } + + return new NotIn(is_array($values) ? $values : func_get_args()); + } + + /** + * Get a required_if constraint builder instance. + * + * @param callable|bool $callback + * @return \Illuminate\Validation\Rules\RequiredIf + */ + public static function requiredIf($callback) + { + return new RequiredIf($callback); + } + + /** + * Get a unique constraint builder instance. + * + * @param string $table + * @param string $column + * @return \Illuminate\Validation\Rules\Unique + */ + public static function unique($table, $column = 'NULL') + { + return new Unique($table, $column); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/DatabaseRule.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/DatabaseRule.php new file mode 100644 index 00000000..e9b110ba --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/DatabaseRule.php @@ -0,0 +1,194 @@ +column = $column; + + $this->table = $this->resolveTableName($table); + } + + /** + * Resolves the name of the table from the given string. + * + * @param string $table + * @return string + */ + public function resolveTableName($table) + { + if (! Str::contains($table, '\\') || ! class_exists($table)) { + return $table; + } + + if (is_subclass_of($table, Model::class)) { + return (new $table)->getTable(); + } + + return $table; + } + + /** + * Set a "where" constraint on the query. + * + * @param \Closure|string $column + * @param array|string|null $value + * @return $this + */ + public function where($column, $value = null) + { + if (is_array($value)) { + return $this->whereIn($column, $value); + } + + if ($column instanceof Closure) { + return $this->using($column); + } + + $this->wheres[] = compact('column', 'value'); + + return $this; + } + + /** + * Set a "where not" constraint on the query. + * + * @param string $column + * @param array|string $value + * @return $this + */ + public function whereNot($column, $value) + { + if (is_array($value)) { + return $this->whereNotIn($column, $value); + } + + return $this->where($column, '!'.$value); + } + + /** + * Set a "where null" constraint on the query. + * + * @param string $column + * @return $this + */ + public function whereNull($column) + { + return $this->where($column, 'NULL'); + } + + /** + * Set a "where not null" constraint on the query. + * + * @param string $column + * @return $this + */ + public function whereNotNull($column) + { + return $this->where($column, 'NOT_NULL'); + } + + /** + * Set a "where in" constraint on the query. + * + * @param string $column + * @param array $values + * @return $this + */ + public function whereIn($column, array $values) + { + return $this->where(function ($query) use ($column, $values) { + $query->whereIn($column, $values); + }); + } + + /** + * Set a "where not in" constraint on the query. + * + * @param string $column + * @param array $values + * @return $this + */ + public function whereNotIn($column, array $values) + { + return $this->where(function ($query) use ($column, $values) { + $query->whereNotIn($column, $values); + }); + } + + /** + * Register a custom query callback. + * + * @param \Closure $callback + * @return $this + */ + public function using(Closure $callback) + { + $this->using[] = $callback; + + return $this; + } + + /** + * Get the custom query callbacks for the rule. + * + * @return array + */ + public function queryCallbacks() + { + return $this->using; + } + + /** + * Format the where clauses. + * + * @return string + */ + protected function formatWheres() + { + return collect($this->wheres)->map(function ($where) { + return $where['column'].','.'"'.str_replace('"', '""', $where['value']).'"'; + })->implode(','); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/Dimensions.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Dimensions.php new file mode 100644 index 00000000..e2326c77 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Dimensions.php @@ -0,0 +1,131 @@ +constraints = $constraints; + } + + /** + * Set the "width" constraint. + * + * @param int $value + * @return $this + */ + public function width($value) + { + $this->constraints['width'] = $value; + + return $this; + } + + /** + * Set the "height" constraint. + * + * @param int $value + * @return $this + */ + public function height($value) + { + $this->constraints['height'] = $value; + + return $this; + } + + /** + * Set the "min width" constraint. + * + * @param int $value + * @return $this + */ + public function minWidth($value) + { + $this->constraints['min_width'] = $value; + + return $this; + } + + /** + * Set the "min height" constraint. + * + * @param int $value + * @return $this + */ + public function minHeight($value) + { + $this->constraints['min_height'] = $value; + + return $this; + } + + /** + * Set the "max width" constraint. + * + * @param int $value + * @return $this + */ + public function maxWidth($value) + { + $this->constraints['max_width'] = $value; + + return $this; + } + + /** + * Set the "max height" constraint. + * + * @param int $value + * @return $this + */ + public function maxHeight($value) + { + $this->constraints['max_height'] = $value; + + return $this; + } + + /** + * Set the "ratio" constraint. + * + * @param float $value + * @return $this + */ + public function ratio($value) + { + $this->constraints['ratio'] = $value; + + return $this; + } + + /** + * Convert the rule to a validation string. + * + * @return string + */ + public function __toString() + { + $result = ''; + + foreach ($this->constraints as $key => $value) { + $result .= "$key=$value,"; + } + + return 'dimensions:'.substr($result, 0, -1); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/Exists.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Exists.php new file mode 100644 index 00000000..72c37860 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Exists.php @@ -0,0 +1,22 @@ +table, + $this->column, + $this->formatWheres() + ), ','); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/In.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/In.php new file mode 100644 index 00000000..58086bfb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/In.php @@ -0,0 +1,45 @@ +values = $values; + } + + /** + * Convert the rule to a validation string. + * + * @return string + * + * @see \Illuminate\Validation\ValidationRuleParser::parseParameters + */ + public function __toString() + { + $values = array_map(function ($value) { + return '"'.str_replace('"', '""', $value).'"'; + }, $this->values); + + return $this->rule.':'.implode(',', $values); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/NotIn.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/NotIn.php new file mode 100644 index 00000000..edd1013c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/NotIn.php @@ -0,0 +1,43 @@ +values = $values; + } + + /** + * Convert the rule to a validation string. + * + * @return string + */ + public function __toString() + { + $values = array_map(function ($value) { + return '"'.str_replace('"', '""', $value).'"'; + }, $this->values); + + return $this->rule.':'.implode(',', $values); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php new file mode 100644 index 00000000..a1ab7491 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php @@ -0,0 +1,44 @@ +condition = $condition; + } else { + throw new InvalidArgumentException('The provided condition must be a callable or boolean.'); + } + } + + /** + * Convert the rule to a validation string. + * + * @return string + */ + public function __toString() + { + if (is_callable($this->condition)) { + return call_user_func($this->condition) ? 'required' : ''; + } + + return $this->condition ? 'required' : ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/Unique.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Unique.php new file mode 100644 index 00000000..64e91024 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Unique.php @@ -0,0 +1,74 @@ +ignoreModel($id, $idColumn); + } + + $this->ignore = $id; + $this->idColumn = $idColumn ?? 'id'; + + return $this; + } + + /** + * Ignore the given model during the unique check. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @param string|null $idColumn + * @return $this + */ + public function ignoreModel($model, $idColumn = null) + { + $this->idColumn = $idColumn ?? $model->getKeyName(); + $this->ignore = $model->{$this->idColumn}; + + return $this; + } + + /** + * Convert the rule to a validation string. + * + * @return string + */ + public function __toString() + { + return rtrim(sprintf('unique:%s,%s,%s,%s,%s', + $this->table, + $this->column, + $this->ignore ? '"'.addslashes($this->ignore).'"' : 'NULL', + $this->idColumn, + $this->formatWheres() + ), ','); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/UnauthorizedException.php b/vendor/laravel/framework/src/Illuminate/Validation/UnauthorizedException.php new file mode 100644 index 00000000..ea8a6ec0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/UnauthorizedException.php @@ -0,0 +1,10 @@ +prepareForValidation(); + + if (! $this->passesAuthorization()) { + $this->failedAuthorization(); + } + + $instance = $this->getValidatorInstance(); + + if ($instance->fails()) { + $this->failedValidation($instance); + } + + $this->passedValidation(); + } + + /** + * Prepare the data for validation. + * + * @return void + */ + protected function prepareForValidation() + { + // + } + + /** + * Get the validator instance for the request. + * + * @return \Illuminate\Validation\Validator + */ + protected function getValidatorInstance() + { + return $this->validator(); + } + + /** + * Handle a passed validation attempt. + * + * @return void + */ + protected function passedValidation() + { + // + } + + /** + * Handle a failed validation attempt. + * + * @param \Illuminate\Validation\Validator $validator + * @return void + * + * @throws \Illuminate\Validation\ValidationException + */ + protected function failedValidation(Validator $validator) + { + throw new ValidationException($validator); + } + + /** + * Determine if the request passes the authorization check. + * + * @return bool + */ + protected function passesAuthorization() + { + if (method_exists($this, 'authorize')) { + return $this->authorize(); + } + + return true; + } + + /** + * Handle a failed authorization attempt. + * + * @return void + * + * @throws \Illuminate\Validation\UnauthorizedException + */ + protected function failedAuthorization() + { + throw new UnauthorizedException; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/ValidationData.php b/vendor/laravel/framework/src/Illuminate/Validation/ValidationData.php new file mode 100644 index 00000000..74f55259 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/ValidationData.php @@ -0,0 +1,113 @@ + $value) { + if ((bool) preg_match('/^'.$pattern.'/', $key, $matches)) { + $keys[] = $matches[0]; + } + } + + $keys = array_unique($keys); + + $data = []; + + foreach ($keys as $key) { + $data[$key] = Arr::get($masterData, $key); + } + + return $data; + } + + /** + * Extract data based on the given dot-notated path. + * + * Used to extract a sub-section of the data for faster iteration. + * + * @param string $attribute + * @param array $masterData + * @return array + */ + public static function extractDataFromPath($attribute, $masterData) + { + $results = []; + + $value = Arr::get($masterData, $attribute, '__missing__'); + + if ($value !== '__missing__') { + Arr::set($results, $attribute, $value); + } + + return $results; + } + + /** + * Get the explicit part of the attribute name. + * + * E.g. 'foo.bar.*.baz' -> 'foo.bar' + * + * Allows us to not spin through all of the flattened data for some operations. + * + * @param string $attribute + * @return string + */ + public static function getLeadingExplicitAttributePath($attribute) + { + return rtrim(explode('*', $attribute)[0], '.') ?: null; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/ValidationException.php b/vendor/laravel/framework/src/Illuminate/Validation/ValidationException.php new file mode 100644 index 00000000..460f959f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/ValidationException.php @@ -0,0 +1,138 @@ +response = $response; + $this->errorBag = $errorBag; + $this->validator = $validator; + } + + /** + * Create a new validation exception from a plain array of messages. + * + * @param array $messages + * @return static + */ + public static function withMessages(array $messages) + { + return new static(tap(ValidatorFacade::make([], []), function ($validator) use ($messages) { + foreach ($messages as $key => $value) { + foreach (Arr::wrap($value) as $message) { + $validator->errors()->add($key, $message); + } + } + })); + } + + /** + * Get all of the validation error messages. + * + * @return array + */ + public function errors() + { + return $this->validator->errors()->messages(); + } + + /** + * Set the HTTP status code to be used for the response. + * + * @param int $status + * @return $this + */ + public function status($status) + { + $this->status = $status; + + return $this; + } + + /** + * Set the error bag on the exception. + * + * @param string $errorBag + * @return $this + */ + public function errorBag($errorBag) + { + $this->errorBag = $errorBag; + + return $this; + } + + /** + * Set the URL to redirect to on a validation error. + * + * @param string $url + * @return $this + */ + public function redirectTo($url) + { + $this->redirectTo = $url; + + return $this; + } + + /** + * Get the underlying response instance. + * + * @return \Symfony\Component\HttpFoundation\Response|null + */ + public function getResponse() + { + return $this->response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/ValidationRuleParser.php b/vendor/laravel/framework/src/Illuminate/Validation/ValidationRuleParser.php new file mode 100644 index 00000000..ed61c229 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/ValidationRuleParser.php @@ -0,0 +1,277 @@ +data = $data; + } + + /** + * Parse the human-friendly rules into a full rules array for the validator. + * + * @param array $rules + * @return \stdClass + */ + public function explode($rules) + { + $this->implicitAttributes = []; + + $rules = $this->explodeRules($rules); + + return (object) [ + 'rules' => $rules, + 'implicitAttributes' => $this->implicitAttributes, + ]; + } + + /** + * Explode the rules into an array of explicit rules. + * + * @param array $rules + * @return array + */ + protected function explodeRules($rules) + { + foreach ($rules as $key => $rule) { + if (Str::contains($key, '*')) { + $rules = $this->explodeWildcardRules($rules, $key, [$rule]); + + unset($rules[$key]); + } else { + $rules[$key] = $this->explodeExplicitRule($rule); + } + } + + return $rules; + } + + /** + * Explode the explicit rule into an array if necessary. + * + * @param mixed $rule + * @return array + */ + protected function explodeExplicitRule($rule) + { + if (is_string($rule)) { + return explode('|', $rule); + } elseif (is_object($rule)) { + return [$this->prepareRule($rule)]; + } + + return array_map([$this, 'prepareRule'], $rule); + } + + /** + * Prepare the given rule for the Validator. + * + * @param mixed $rule + * @return mixed + */ + protected function prepareRule($rule) + { + if ($rule instanceof Closure) { + $rule = new ClosureValidationRule($rule); + } + + if (! is_object($rule) || + $rule instanceof RuleContract || + ($rule instanceof Exists && $rule->queryCallbacks()) || + ($rule instanceof Unique && $rule->queryCallbacks())) { + return $rule; + } + + return (string) $rule; + } + + /** + * Define a set of rules that apply to each element in an array attribute. + * + * @param array $results + * @param string $attribute + * @param string|array $rules + * @return array + */ + protected function explodeWildcardRules($results, $attribute, $rules) + { + $pattern = str_replace('\*', '[^\.]*', preg_quote($attribute)); + + $data = ValidationData::initializeAndGatherData($attribute, $this->data); + + foreach ($data as $key => $value) { + if (Str::startsWith($key, $attribute) || (bool) preg_match('/^'.$pattern.'\z/', $key)) { + foreach ((array) $rules as $rule) { + $this->implicitAttributes[$attribute][] = (string) $key; + + $results = $this->mergeRules($results, $key, $rule); + } + } + } + + return $results; + } + + /** + * Merge additional rules into a given attribute(s). + * + * @param array $results + * @param string|array $attribute + * @param string|array $rules + * @return array + */ + public function mergeRules($results, $attribute, $rules = []) + { + if (is_array($attribute)) { + foreach ((array) $attribute as $innerAttribute => $innerRules) { + $results = $this->mergeRulesForAttribute($results, $innerAttribute, $innerRules); + } + + return $results; + } + + return $this->mergeRulesForAttribute( + $results, $attribute, $rules + ); + } + + /** + * Merge additional rules into a given attribute. + * + * @param array $results + * @param string $attribute + * @param string|array $rules + * @return array + */ + protected function mergeRulesForAttribute($results, $attribute, $rules) + { + $merge = head($this->explodeRules([$rules])); + + $results[$attribute] = array_merge( + isset($results[$attribute]) ? $this->explodeExplicitRule($results[$attribute]) : [], $merge + ); + + return $results; + } + + /** + * Extract the rule name and parameters from a rule. + * + * @param array|string $rules + * @return array + */ + public static function parse($rules) + { + if ($rules instanceof RuleContract) { + return [$rules, []]; + } + + if (is_array($rules)) { + $rules = static::parseArrayRule($rules); + } else { + $rules = static::parseStringRule($rules); + } + + $rules[0] = static::normalizeRule($rules[0]); + + return $rules; + } + + /** + * Parse an array based rule. + * + * @param array $rules + * @return array + */ + protected static function parseArrayRule(array $rules) + { + return [Str::studly(trim(Arr::get($rules, 0))), array_slice($rules, 1)]; + } + + /** + * Parse a string based rule. + * + * @param string $rules + * @return array + */ + protected static function parseStringRule($rules) + { + $parameters = []; + + // The format for specifying validation rules and parameters follows an + // easy {rule}:{parameters} formatting convention. For instance the + // rule "Max:3" states that the value may only be three letters. + if (strpos($rules, ':') !== false) { + [$rules, $parameter] = explode(':', $rules, 2); + + $parameters = static::parseParameters($rules, $parameter); + } + + return [Str::studly(trim($rules)), $parameters]; + } + + /** + * Parse a parameter list. + * + * @param string $rule + * @param string $parameter + * @return array + */ + protected static function parseParameters($rule, $parameter) + { + $rule = strtolower($rule); + + if (in_array($rule, ['regex', 'not_regex', 'notregex'], true)) { + return [$parameter]; + } + + return str_getcsv($parameter); + } + + /** + * Normalizes a rule so that we can accept short types. + * + * @param string $rule + * @return string + */ + protected static function normalizeRule($rule) + { + switch ($rule) { + case 'Int': + return 'Integer'; + case 'Bool': + return 'Boolean'; + default: + return $rule; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php new file mode 100755 index 00000000..ce04447e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php @@ -0,0 +1,66 @@ +registerPresenceVerifier(); + + $this->registerValidationFactory(); + } + + /** + * Register the validation factory. + * + * @return void + */ + protected function registerValidationFactory() + { + $this->app->singleton('validator', function ($app) { + $validator = new Factory($app['translator'], $app); + + // The validation presence verifier is responsible for determining the existence of + // values in a given data collection which is typically a relational database or + // other persistent data stores. It is used to check for "uniqueness" as well. + if (isset($app['db'], $app['validation.presence'])) { + $validator->setPresenceVerifier($app['validation.presence']); + } + + return $validator; + }); + } + + /** + * Register the database presence verifier. + * + * @return void + */ + protected function registerPresenceVerifier() + { + $this->app->singleton('validation.presence', function ($app) { + return new DatabasePresenceVerifier($app['db']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'validator', 'validation.presence', + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Validator.php b/vendor/laravel/framework/src/Illuminate/Validation/Validator.php new file mode 100755 index 00000000..d7dae353 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Validator.php @@ -0,0 +1,1311 @@ +dotPlaceholder = Str::random(); + + $this->initialRules = $rules; + $this->translator = $translator; + $this->customMessages = $messages; + $this->data = $this->parseData($data); + $this->customAttributes = $customAttributes; + + $this->setRules($rules); + } + + /** + * Parse the data array, converting dots to ->. + * + * @param array $data + * @return array + */ + public function parseData(array $data) + { + $newData = []; + + foreach ($data as $key => $value) { + if (is_array($value)) { + $value = $this->parseData($value); + } + + $key = str_replace( + ['.', '*'], + [$this->dotPlaceholder, '__asterisk__'], + $key + ); + + $newData[$key] = $value; + } + + return $newData; + } + + /** + * Add an after validation callback. + * + * @param callable|string $callback + * @return $this + */ + public function after($callback) + { + $this->after[] = function () use ($callback) { + return $callback($this); + }; + + return $this; + } + + /** + * Determine if the data passes the validation rules. + * + * @return bool + */ + public function passes() + { + $this->messages = new MessageBag; + + [$this->distinctValues, $this->failedRules] = [[], []]; + + // We'll spin through each rule, validating the attributes attached to that + // rule. Any error messages will be added to the containers with each of + // the other error messages, returning true if we don't have messages. + foreach ($this->rules as $attribute => $rules) { + if ($this->shouldBeExcluded($attribute)) { + $this->removeAttribute($attribute); + + continue; + } + + foreach ($rules as $rule) { + $this->validateAttribute($attribute, $rule); + + if ($this->shouldBeExcluded($attribute)) { + $this->removeAttribute($attribute); + + break; + } + + if ($this->shouldStopValidating($attribute)) { + break; + } + } + } + + // Here we will spin through all of the "after" hooks on this validator and + // fire them off. This gives the callbacks a chance to perform all kinds + // of other validation that needs to get wrapped up in this operation. + foreach ($this->after as $after) { + $after(); + } + + return $this->messages->isEmpty(); + } + + /** + * Determine if the data fails the validation rules. + * + * @return bool + */ + public function fails() + { + return ! $this->passes(); + } + + /** + * Determine if the attribute should be excluded. + * + * @param string $attribute + * @return bool + */ + protected function shouldBeExcluded($attribute) + { + foreach ($this->excludeAttributes as $excludeAttribute) { + if ($attribute === $excludeAttribute || + Str::startsWith($attribute, $excludeAttribute.'.')) { + return true; + } + } + + return false; + } + + /** + * Remove the given attribute. + * + * @param string $attribute + * @return void + */ + protected function removeAttribute($attribute) + { + Arr::forget($this->data, $attribute); + Arr::forget($this->rules, $attribute); + } + + /** + * Run the validator's rules against its data. + * + * @return array + * + * @throws \Illuminate\Validation\ValidationException + */ + public function validate() + { + if ($this->fails()) { + throw new ValidationException($this); + } + + return $this->validated(); + } + + /** + * Get the attributes and values that were validated. + * + * @return array + * + * @throws \Illuminate\Validation\ValidationException + */ + public function validated() + { + if ($this->invalid()) { + throw new ValidationException($this); + } + + $results = []; + + $missingValue = Str::random(10); + + foreach (array_keys($this->getRules()) as $key) { + $value = data_get($this->getData(), $key, $missingValue); + + if ($value !== $missingValue) { + Arr::set($results, $key, $value); + } + } + + return $results; + } + + /** + * Validate a given attribute against a rule. + * + * @param string $attribute + * @param string $rule + * @return void + */ + protected function validateAttribute($attribute, $rule) + { + $this->currentRule = $rule; + + [$rule, $parameters] = ValidationRuleParser::parse($rule); + + if ($rule == '') { + return; + } + + // First we will get the correct keys for the given attribute in case the field is nested in + // an array. Then we determine if the given rule accepts other field names as parameters. + // If so, we will replace any asterisks found in the parameters with the correct keys. + if (($keys = $this->getExplicitKeys($attribute)) && + $this->dependsOnOtherFields($rule)) { + $parameters = $this->replaceAsterisksInParameters($parameters, $keys); + } + + $value = $this->getValue($attribute); + + // If the attribute is a file, we will verify that the file upload was actually successful + // and if it wasn't we will add a failure for the attribute. Files may not successfully + // upload if they are too large based on PHP's settings so we will bail in this case. + if ($value instanceof UploadedFile && ! $value->isValid() && + $this->hasRule($attribute, array_merge($this->fileRules, $this->implicitRules)) + ) { + return $this->addFailure($attribute, 'uploaded', []); + } + + // If we have made it this far we will make sure the attribute is validatable and if it is + // we will call the validation method with the attribute. If a method returns false the + // attribute is invalid and we will add a failure message for this failing attribute. + $validatable = $this->isValidatable($rule, $attribute, $value); + + if ($rule instanceof RuleContract) { + return $validatable + ? $this->validateUsingCustomRule($attribute, $value, $rule) + : null; + } + + $method = "validate{$rule}"; + + if ($validatable && ! $this->$method($attribute, $value, $parameters, $this)) { + $this->addFailure($attribute, $rule, $parameters); + } + } + + /** + * Determine if the given rule depends on other fields. + * + * @param string $rule + * @return bool + */ + protected function dependsOnOtherFields($rule) + { + return in_array($rule, $this->dependentRules); + } + + /** + * Get the explicit keys from an attribute flattened with dot notation. + * + * E.g. 'foo.1.bar.spark.baz' -> [1, 'spark'] for 'foo.*.bar.*.baz' + * + * @param string $attribute + * @return array + */ + protected function getExplicitKeys($attribute) + { + $pattern = str_replace('\*', '([^\.]+)', preg_quote($this->getPrimaryAttribute($attribute), '/')); + + if (preg_match('/^'.$pattern.'/', $attribute, $keys)) { + array_shift($keys); + + return $keys; + } + + return []; + } + + /** + * Get the primary attribute name. + * + * For example, if "name.0" is given, "name.*" will be returned. + * + * @param string $attribute + * @return string + */ + protected function getPrimaryAttribute($attribute) + { + foreach ($this->implicitAttributes as $unparsed => $parsed) { + if (in_array($attribute, $parsed)) { + return $unparsed; + } + } + + return $attribute; + } + + /** + * Replace each field parameter which has asterisks with the given keys. + * + * @param array $parameters + * @param array $keys + * @return array + */ + protected function replaceAsterisksInParameters(array $parameters, array $keys) + { + return array_map(function ($field) use ($keys) { + return vsprintf(str_replace('*', '%s', $field), $keys); + }, $parameters); + } + + /** + * Determine if the attribute is validatable. + * + * @param object|string $rule + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function isValidatable($rule, $attribute, $value) + { + if (in_array($rule, $this->excludeRules)) { + return true; + } + + return $this->presentOrRuleIsImplicit($rule, $attribute, $value) && + $this->passesOptionalCheck($attribute) && + $this->isNotNullIfMarkedAsNullable($rule, $attribute) && + $this->hasNotFailedPreviousRuleIfPresenceRule($rule, $attribute); + } + + /** + * Determine if the field is present, or the rule implies required. + * + * @param object|string $rule + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function presentOrRuleIsImplicit($rule, $attribute, $value) + { + if (is_string($value) && trim($value) === '') { + return $this->isImplicit($rule); + } + + return $this->validatePresent($attribute, $value) || + $this->isImplicit($rule); + } + + /** + * Determine if a given rule implies the attribute is required. + * + * @param object|string $rule + * @return bool + */ + protected function isImplicit($rule) + { + return $rule instanceof ImplicitRule || + in_array($rule, $this->implicitRules); + } + + /** + * Determine if the attribute passes any optional check. + * + * @param string $attribute + * @return bool + */ + protected function passesOptionalCheck($attribute) + { + if (! $this->hasRule($attribute, ['Sometimes'])) { + return true; + } + + $data = ValidationData::initializeAndGatherData($attribute, $this->data); + + return array_key_exists($attribute, $data) + || array_key_exists($attribute, $this->data); + } + + /** + * Determine if the attribute fails the nullable check. + * + * @param string $rule + * @param string $attribute + * @return bool + */ + protected function isNotNullIfMarkedAsNullable($rule, $attribute) + { + if ($this->isImplicit($rule) || ! $this->hasRule($attribute, ['Nullable'])) { + return true; + } + + return ! is_null(Arr::get($this->data, $attribute, 0)); + } + + /** + * Determine if it's a necessary presence validation. + * + * This is to avoid possible database type comparison errors. + * + * @param string $rule + * @param string $attribute + * @return bool + */ + protected function hasNotFailedPreviousRuleIfPresenceRule($rule, $attribute) + { + return in_array($rule, ['Unique', 'Exists']) ? ! $this->messages->has($attribute) : true; + } + + /** + * Validate an attribute using a custom rule object. + * + * @param string $attribute + * @param mixed $value + * @param \Illuminate\Contracts\Validation\Rule $rule + * @return void + */ + protected function validateUsingCustomRule($attribute, $value, $rule) + { + if (! $rule->passes($attribute, $value)) { + $this->failedRules[$attribute][get_class($rule)] = []; + + $messages = $rule->message() ? (array) $rule->message() : [get_class($rule)]; + + foreach ($messages as $message) { + $this->messages->add($attribute, $this->makeReplacements( + $message, $attribute, get_class($rule), [] + )); + } + } + } + + /** + * Check if we should stop further validations on a given attribute. + * + * @param string $attribute + * @return bool + */ + protected function shouldStopValidating($attribute) + { + if ($this->hasRule($attribute, ['Bail'])) { + return $this->messages->has($attribute); + } + + if (isset($this->failedRules[$attribute]) && + array_key_exists('uploaded', $this->failedRules[$attribute])) { + return true; + } + + // In case the attribute has any rule that indicates that the field is required + // and that rule already failed then we should stop validation at this point + // as now there is no point in calling other rules with this field empty. + return $this->hasRule($attribute, $this->implicitRules) && + isset($this->failedRules[$attribute]) && + array_intersect(array_keys($this->failedRules[$attribute]), $this->implicitRules); + } + + /** + * Add a failed rule and error message to the collection. + * + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return void + */ + public function addFailure($attribute, $rule, $parameters = []) + { + if (! $this->messages) { + $this->passes(); + } + + $attribute = str_replace('__asterisk__', '*', $attribute); + + if (in_array($rule, $this->excludeRules)) { + return $this->excludeAttribute($attribute); + } + + $this->messages->add($attribute, $this->makeReplacements( + $this->getMessage($attribute, $rule), $attribute, $rule, $parameters + )); + + $this->failedRules[$attribute][$rule] = $parameters; + } + + /** + * Add the given attribute to the list of excluded attributes. + * + * @param string $attribute + * @return void + */ + protected function excludeAttribute(string $attribute) + { + $this->excludeAttributes[] = $attribute; + + $this->excludeAttributes = array_unique($this->excludeAttributes); + } + + /** + * Returns the data which was valid. + * + * @return array + */ + public function valid() + { + if (! $this->messages) { + $this->passes(); + } + + return array_diff_key( + $this->data, $this->attributesThatHaveMessages() + ); + } + + /** + * Returns the data which was invalid. + * + * @return array + */ + public function invalid() + { + if (! $this->messages) { + $this->passes(); + } + + $invalid = array_intersect_key( + $this->data, $this->attributesThatHaveMessages() + ); + + $result = []; + + $failed = Arr::only(Arr::dot($invalid), array_keys($this->failed())); + + foreach ($failed as $key => $failure) { + Arr::set($result, $key, $failure); + } + + return $result; + } + + /** + * Generate an array of all attributes that have messages. + * + * @return array + */ + protected function attributesThatHaveMessages() + { + return collect($this->messages()->toArray())->map(function ($message, $key) { + return explode('.', $key)[0]; + })->unique()->flip()->all(); + } + + /** + * Get the failed validation rules. + * + * @return array + */ + public function failed() + { + return $this->failedRules; + } + + /** + * Get the message container for the validator. + * + * @return \Illuminate\Support\MessageBag + */ + public function messages() + { + if (! $this->messages) { + $this->passes(); + } + + return $this->messages; + } + + /** + * An alternative more semantic shortcut to the message container. + * + * @return \Illuminate\Support\MessageBag + */ + public function errors() + { + return $this->messages(); + } + + /** + * Get the messages for the instance. + * + * @return \Illuminate\Support\MessageBag + */ + public function getMessageBag() + { + return $this->messages(); + } + + /** + * Determine if the given attribute has a rule in the given set. + * + * @param string $attribute + * @param string|array $rules + * @return bool + */ + public function hasRule($attribute, $rules) + { + return ! is_null($this->getRule($attribute, $rules)); + } + + /** + * Get a rule and its parameters for a given attribute. + * + * @param string $attribute + * @param string|array $rules + * @return array|null + */ + protected function getRule($attribute, $rules) + { + if (! array_key_exists($attribute, $this->rules)) { + return; + } + + $rules = (array) $rules; + + foreach ($this->rules[$attribute] as $rule) { + [$rule, $parameters] = ValidationRuleParser::parse($rule); + + if (in_array($rule, $rules)) { + return [$rule, $parameters]; + } + } + } + + /** + * Get the data under validation. + * + * @return array + */ + public function attributes() + { + return $this->getData(); + } + + /** + * Get the data under validation. + * + * @return array + */ + public function getData() + { + return $this->data; + } + + /** + * Set the data under validation. + * + * @param array $data + * @return $this + */ + public function setData(array $data) + { + $this->data = $this->parseData($data); + + $this->setRules($this->initialRules); + + return $this; + } + + /** + * Get the value of a given attribute. + * + * @param string $attribute + * @return mixed + */ + protected function getValue($attribute) + { + return Arr::get($this->data, $attribute); + } + + /** + * Get the validation rules. + * + * @return array + */ + public function getRules() + { + return $this->rules; + } + + /** + * Set the validation rules. + * + * @param array $rules + * @return $this + */ + public function setRules(array $rules) + { + $rules = collect($rules)->mapWithKeys(function ($value, $key) { + return [str_replace('\.', $this->dotPlaceholder, $key) => $value]; + })->toArray(); + + $this->initialRules = $rules; + + $this->rules = []; + + $this->addRules($rules); + + return $this; + } + + /** + * Parse the given rules and merge them into current rules. + * + * @param array $rules + * @return void + */ + public function addRules($rules) + { + // The primary purpose of this parser is to expand any "*" rules to the all + // of the explicit rules needed for the given data. For example the rule + // names.* would get expanded to names.0, names.1, etc. for this data. + $response = (new ValidationRuleParser($this->data)) + ->explode($rules); + + $this->rules = array_merge_recursive( + $this->rules, $response->rules + ); + + $this->implicitAttributes = array_merge( + $this->implicitAttributes, $response->implicitAttributes + ); + } + + /** + * Add conditions to a given field based on a Closure. + * + * @param string|array $attribute + * @param string|array $rules + * @param callable $callback + * @return $this + */ + public function sometimes($attribute, $rules, callable $callback) + { + $payload = new Fluent($this->getData()); + + if ($callback($payload)) { + foreach ((array) $attribute as $key) { + $this->addRules([$key => $rules]); + } + } + + return $this; + } + + /** + * Register an array of custom validator extensions. + * + * @param array $extensions + * @return void + */ + public function addExtensions(array $extensions) + { + if ($extensions) { + $keys = array_map([Str::class, 'snake'], array_keys($extensions)); + + $extensions = array_combine($keys, array_values($extensions)); + } + + $this->extensions = array_merge($this->extensions, $extensions); + } + + /** + * Register an array of custom implicit validator extensions. + * + * @param array $extensions + * @return void + */ + public function addImplicitExtensions(array $extensions) + { + $this->addExtensions($extensions); + + foreach ($extensions as $rule => $extension) { + $this->implicitRules[] = Str::studly($rule); + } + } + + /** + * Register an array of custom dependent validator extensions. + * + * @param array $extensions + * @return void + */ + public function addDependentExtensions(array $extensions) + { + $this->addExtensions($extensions); + + foreach ($extensions as $rule => $extension) { + $this->dependentRules[] = Str::studly($rule); + } + } + + /** + * Register a custom validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @return void + */ + public function addExtension($rule, $extension) + { + $this->extensions[Str::snake($rule)] = $extension; + } + + /** + * Register a custom implicit validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @return void + */ + public function addImplicitExtension($rule, $extension) + { + $this->addExtension($rule, $extension); + + $this->implicitRules[] = Str::studly($rule); + } + + /** + * Register a custom dependent validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @return void + */ + public function addDependentExtension($rule, $extension) + { + $this->addExtension($rule, $extension); + + $this->dependentRules[] = Str::studly($rule); + } + + /** + * Register an array of custom validator message replacers. + * + * @param array $replacers + * @return void + */ + public function addReplacers(array $replacers) + { + if ($replacers) { + $keys = array_map([Str::class, 'snake'], array_keys($replacers)); + + $replacers = array_combine($keys, array_values($replacers)); + } + + $this->replacers = array_merge($this->replacers, $replacers); + } + + /** + * Register a custom validator message replacer. + * + * @param string $rule + * @param \Closure|string $replacer + * @return void + */ + public function addReplacer($rule, $replacer) + { + $this->replacers[Str::snake($rule)] = $replacer; + } + + /** + * Set the custom messages for the validator. + * + * @param array $messages + * @return $this + */ + public function setCustomMessages(array $messages) + { + $this->customMessages = array_merge($this->customMessages, $messages); + + return $this; + } + + /** + * Set the custom attributes on the validator. + * + * @param array $attributes + * @return $this + */ + public function setAttributeNames(array $attributes) + { + $this->customAttributes = $attributes; + + return $this; + } + + /** + * Add custom attributes to the validator. + * + * @param array $customAttributes + * @return $this + */ + public function addCustomAttributes(array $customAttributes) + { + $this->customAttributes = array_merge($this->customAttributes, $customAttributes); + + return $this; + } + + /** + * Set the callback that used to format an implicit attribute.. + * + * @param callable|null $formatter + * @return $this + */ + public function setImplicitAttributesFormatter(callable $formatter = null) + { + $this->implicitAttributesFormatter = $formatter; + + return $this; + } + + /** + * Set the custom values on the validator. + * + * @param array $values + * @return $this + */ + public function setValueNames(array $values) + { + $this->customValues = $values; + + return $this; + } + + /** + * Add the custom values for the validator. + * + * @param array $customValues + * @return $this + */ + public function addCustomValues(array $customValues) + { + $this->customValues = array_merge($this->customValues, $customValues); + + return $this; + } + + /** + * Set the fallback messages for the validator. + * + * @param array $messages + * @return void + */ + public function setFallbackMessages(array $messages) + { + $this->fallbackMessages = $messages; + } + + /** + * Get the Presence Verifier implementation. + * + * @return \Illuminate\Validation\PresenceVerifierInterface + * + * @throws \RuntimeException + */ + public function getPresenceVerifier() + { + if (! isset($this->presenceVerifier)) { + throw new RuntimeException('Presence verifier has not been set.'); + } + + return $this->presenceVerifier; + } + + /** + * Get the Presence Verifier implementation. + * + * @param string $connection + * @return \Illuminate\Validation\PresenceVerifierInterface + * + * @throws \RuntimeException + */ + public function getPresenceVerifierFor($connection) + { + return tap($this->getPresenceVerifier(), function ($verifier) use ($connection) { + $verifier->setConnection($connection); + }); + } + + /** + * Set the Presence Verifier implementation. + * + * @param \Illuminate\Validation\PresenceVerifierInterface $presenceVerifier + * @return void + */ + public function setPresenceVerifier(PresenceVerifierInterface $presenceVerifier) + { + $this->presenceVerifier = $presenceVerifier; + } + + /** + * Get the Translator implementation. + * + * @return \Illuminate\Contracts\Translation\Translator + */ + public function getTranslator() + { + return $this->translator; + } + + /** + * Set the Translator implementation. + * + * @param \Illuminate\Contracts\Translation\Translator $translator + * @return void + */ + public function setTranslator(Translator $translator) + { + $this->translator = $translator; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } + + /** + * Call a custom validator extension. + * + * @param string $rule + * @param array $parameters + * @return bool|null + */ + protected function callExtension($rule, $parameters) + { + $callback = $this->extensions[$rule]; + + if (is_callable($callback)) { + return $callback(...array_values($parameters)); + } elseif (is_string($callback)) { + return $this->callClassBasedExtension($callback, $parameters); + } + } + + /** + * Call a class based validator extension. + * + * @param string $callback + * @param array $parameters + * @return bool + */ + protected function callClassBasedExtension($callback, $parameters) + { + [$class, $method] = Str::parseCallback($callback, 'validate'); + + return $this->container->make($class)->{$method}(...array_values($parameters)); + } + + /** + * Handle dynamic calls to class methods. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + $rule = Str::snake(substr($method, 8)); + + if (isset($this->extensions[$rule])) { + return $this->callExtension($rule, $parameters); + } + + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/composer.json b/vendor/laravel/framework/src/Illuminate/Validation/composer.json new file mode 100755 index 00000000..a879fd68 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/composer.json @@ -0,0 +1,43 @@ +{ + "name": "illuminate/validation", + "description": "The Illuminate Validation package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "ext-json": "*", + "egulias/email-validator": "^2.1.10", + "illuminate/container": "^6.0", + "illuminate/contracts": "^6.0", + "illuminate/support": "^6.0", + "illuminate/translation": "^6.0", + "symfony/http-foundation": "^4.3.4" + }, + "autoload": { + "psr-4": { + "Illuminate\\Validation\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "suggest": { + "illuminate/database": "Required to use the database presence verifier (^6.0)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php new file mode 100644 index 00000000..5eb431fa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php @@ -0,0 +1,582 @@ +setPath($path); + } + + if (! is_null($this->cachePath)) { + $contents = $this->compileString($this->files->get($this->getPath())); + + if (! empty($this->getPath())) { + $contents = $this->appendFilePath($contents); + } + + $this->files->put( + $this->getCompiledPath($this->getPath()), $contents + ); + } + } + + /** + * Append the file path to the compiled string. + * + * @param string $contents + * @return string + */ + protected function appendFilePath($contents) + { + $tokens = $this->getOpenAndClosingPhpTokens($contents); + + if ($tokens->isNotEmpty() && $tokens->last() !== T_CLOSE_TAG) { + $contents .= ' ?>'; + } + + return $contents."getPath()} ENDPATH**/ ?>"; + } + + /** + * Get the open and closing PHP tag tokens from the given string. + * + * @param string $contents + * @return \Illuminate\Support\Collection + */ + protected function getOpenAndClosingPhpTokens($contents) + { + return collect(token_get_all($contents)) + ->pluck(0) + ->filter(function ($token) { + return in_array($token, [T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO, T_CLOSE_TAG]); + }); + } + + /** + * Get the path currently being compiled. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set the path currently being compiled. + * + * @param string $path + * @return void + */ + public function setPath($path) + { + $this->path = $path; + } + + /** + * Compile the given Blade template contents. + * + * @param string $value + * @return string + */ + public function compileString($value) + { + [$this->footer, $result] = [[], '']; + + $value = $this->storeUncompiledBlocks($value); + + // Here we will loop through all of the tokens returned by the Zend lexer and + // parse each one into the corresponding valid PHP. We will then have this + // template as the correctly rendered PHP that can be rendered natively. + foreach (token_get_all($value) as $token) { + $result .= is_array($token) ? $this->parseToken($token) : $token; + } + + if (! empty($this->rawBlocks)) { + $result = $this->restoreRawContent($result); + } + + // If there are any footer lines that need to get added to a template we will + // add them here at the end of the template. This gets used mainly for the + // template inheritance via the extends keyword that should be appended. + if (count($this->footer) > 0) { + $result = $this->addFooters($result); + } + + return $result; + } + + /** + * Store the blocks that do not receive compilation. + * + * @param string $value + * @return string + */ + protected function storeUncompiledBlocks($value) + { + if (strpos($value, '@verbatim') !== false) { + $value = $this->storeVerbatimBlocks($value); + } + + if (strpos($value, '@php') !== false) { + $value = $this->storePhpBlocks($value); + } + + return $value; + } + + /** + * Store the verbatim blocks and replace them with a temporary placeholder. + * + * @param string $value + * @return string + */ + protected function storeVerbatimBlocks($value) + { + return preg_replace_callback('/(?storeRawBlock($matches[1]); + }, $value); + } + + /** + * Store the PHP blocks and replace them with a temporary placeholder. + * + * @param string $value + * @return string + */ + protected function storePhpBlocks($value) + { + return preg_replace_callback('/(?storeRawBlock(""); + }, $value); + } + + /** + * Store a raw block and return a unique raw placeholder. + * + * @param string $value + * @return string + */ + protected function storeRawBlock($value) + { + return $this->getRawPlaceholder( + array_push($this->rawBlocks, $value) - 1 + ); + } + + /** + * Replace the raw placeholders with the original code stored in the raw blocks. + * + * @param string $result + * @return string + */ + protected function restoreRawContent($result) + { + $result = preg_replace_callback('/'.$this->getRawPlaceholder('(\d+)').'/', function ($matches) { + return $this->rawBlocks[$matches[1]]; + }, $result); + + $this->rawBlocks = []; + + return $result; + } + + /** + * Get a placeholder to temporary mark the position of raw blocks. + * + * @param int|string $replace + * @return string + */ + protected function getRawPlaceholder($replace) + { + return str_replace('#', $replace, '@__raw_block_#__@'); + } + + /** + * Add the stored footers onto the given content. + * + * @param string $result + * @return string + */ + protected function addFooters($result) + { + return ltrim($result, PHP_EOL) + .PHP_EOL.implode(PHP_EOL, array_reverse($this->footer)); + } + + /** + * Parse the tokens from the template. + * + * @param array $token + * @return string + */ + protected function parseToken($token) + { + [$id, $content] = $token; + + if ($id == T_INLINE_HTML) { + foreach ($this->compilers as $type) { + $content = $this->{"compile{$type}"}($content); + } + } + + return $content; + } + + /** + * Execute the user defined extensions. + * + * @param string $value + * @return string + */ + protected function compileExtensions($value) + { + foreach ($this->extensions as $compiler) { + $value = $compiler($value, $this); + } + + return $value; + } + + /** + * Compile Blade statements that start with "@". + * + * @param string $value + * @return string + */ + protected function compileStatements($value) + { + return preg_replace_callback( + '/\B@(@?\w+(?:::\w+)?)([ \t]*)(\( ( (?>[^()]+) | (?3) )* \))?/x', function ($match) { + return $this->compileStatement($match); + }, $value + ); + } + + /** + * Compile a single Blade @ statement. + * + * @param array $match + * @return string + */ + protected function compileStatement($match) + { + if (Str::contains($match[1], '@')) { + $match[0] = isset($match[3]) ? $match[1].$match[3] : $match[1]; + } elseif (isset($this->customDirectives[$match[1]])) { + $match[0] = $this->callCustomDirective($match[1], Arr::get($match, 3)); + } elseif (method_exists($this, $method = 'compile'.ucfirst($match[1]))) { + $match[0] = $this->$method(Arr::get($match, 3)); + } + + return isset($match[3]) ? $match[0] : $match[0].$match[2]; + } + + /** + * Call the given directive with the given value. + * + * @param string $name + * @param string|null $value + * @return string + */ + protected function callCustomDirective($name, $value) + { + if (Str::startsWith($value, '(') && Str::endsWith($value, ')')) { + $value = Str::substr($value, 1, -1); + } + + return call_user_func($this->customDirectives[$name], trim($value)); + } + + /** + * Strip the parentheses from the given expression. + * + * @param string $expression + * @return string + */ + public function stripParentheses($expression) + { + if (Str::startsWith($expression, '(')) { + $expression = substr($expression, 1, -1); + } + + return $expression; + } + + /** + * Register a custom Blade compiler. + * + * @param callable $compiler + * @return void + */ + public function extend(callable $compiler) + { + $this->extensions[] = $compiler; + } + + /** + * Get the extensions used by the compiler. + * + * @return array + */ + public function getExtensions() + { + return $this->extensions; + } + + /** + * Register an "if" statement directive. + * + * @param string $name + * @param callable $callback + * @return void + */ + public function if($name, callable $callback) + { + $this->conditions[$name] = $callback; + + $this->directive($name, function ($expression) use ($name) { + return $expression !== '' + ? "" + : ""; + }); + + $this->directive('unless'.$name, function ($expression) use ($name) { + return $expression !== '' + ? "" + : ""; + }); + + $this->directive('else'.$name, function ($expression) use ($name) { + return $expression !== '' + ? "" + : ""; + }); + + $this->directive('end'.$name, function () { + return ''; + }); + } + + /** + * Check the result of a condition. + * + * @param string $name + * @param array $parameters + * @return bool + */ + public function check($name, ...$parameters) + { + return call_user_func($this->conditions[$name], ...$parameters); + } + + /** + * Register a component alias directive. + * + * @param string $path + * @param string|null $alias + * @return void + */ + public function component($path, $alias = null) + { + $alias = $alias ?: Arr::last(explode('.', $path)); + + $this->directive($alias, function ($expression) use ($path) { + return $expression + ? "startComponent('{$path}', {$expression}); ?>" + : "startComponent('{$path}'); ?>"; + }); + + $this->directive('end'.$alias, function ($expression) { + return 'renderComponent(); ?>'; + }); + } + + /** + * Register an include alias directive. + * + * @param string $path + * @param string|null $alias + * @return void + */ + public function include($path, $alias = null) + { + $alias = $alias ?: Arr::last(explode('.', $path)); + + $this->directive($alias, function ($expression) use ($path) { + $expression = $this->stripParentheses($expression) ?: '[]'; + + return "make('{$path}', {$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; + }); + } + + /** + * Register a handler for custom directives. + * + * @param string $name + * @param callable $handler + * @return void + * + * @throws \InvalidArgumentException + */ + public function directive($name, callable $handler) + { + if (! preg_match('/^\w+(?:::\w+)?$/x', $name)) { + throw new InvalidArgumentException("The directive name [{$name}] is not valid. Directive names must only contain alphanumeric characters and underscores."); + } + + $this->customDirectives[$name] = $handler; + } + + /** + * Get the list of custom directives. + * + * @return array + */ + public function getCustomDirectives() + { + return $this->customDirectives; + } + + /** + * Set the echo format to be used by the compiler. + * + * @param string $format + * @return void + */ + public function setEchoFormat($format) + { + $this->echoFormat = $format; + } + + /** + * Set the "echo" format to double encode entities. + * + * @return void + */ + public function withDoubleEncoding() + { + $this->setEchoFormat('e(%s, true)'); + } + + /** + * Set the "echo" format to not double encode entities. + * + * @return void + */ + public function withoutDoubleEncoding() + { + $this->setEchoFormat('e(%s, false)'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php new file mode 100755 index 00000000..d2a9f26c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php @@ -0,0 +1,74 @@ +files = $files; + $this->cachePath = $cachePath; + } + + /** + * Get the path to the compiled version of a view. + * + * @param string $path + * @return string + */ + public function getCompiledPath($path) + { + return $this->cachePath.'/'.sha1('v2'.$path).'.php'; + } + + /** + * Determine if the view at the given path is expired. + * + * @param string $path + * @return bool + */ + public function isExpired($path) + { + $compiled = $this->getCompiledPath($path); + + // If the compiled file doesn't exist we will indicate that the view is expired + // so that it can be re-compiled. Else, we will verify the last modification + // of the views is less than the modification times of the compiled views. + if (! $this->files->exists($compiled)) { + return true; + } + + return $this->files->lastModified($path) >= + $this->files->lastModified($compiled); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php new file mode 100755 index 00000000..dfcb023a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php @@ -0,0 +1,30 @@ +check{$expression}): ?>"; + } + + /** + * Compile the cannot statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileCannot($expression) + { + return "denies{$expression}): ?>"; + } + + /** + * Compile the canany statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileCanany($expression) + { + return "any{$expression}): ?>"; + } + + /** + * Compile the else-can statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileElsecan($expression) + { + return "check{$expression}): ?>"; + } + + /** + * Compile the else-cannot statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileElsecannot($expression) + { + return "denies{$expression}): ?>"; + } + + /** + * Compile the else-canany statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileElsecanany($expression) + { + return "any{$expression}): ?>"; + } + + /** + * Compile the end-can statements into valid PHP. + * + * @return string + */ + protected function compileEndcan() + { + return ''; + } + + /** + * Compile the end-cannot statements into valid PHP. + * + * @return string + */ + protected function compileEndcannot() + { + return ''; + } + + /** + * Compile the end-canany statements into valid PHP. + * + * @return string + */ + protected function compileEndcanany() + { + return ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComments.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComments.php new file mode 100644 index 00000000..104a9c81 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComments.php @@ -0,0 +1,19 @@ +contentTags[0], $this->contentTags[1]); + + return preg_replace($pattern, '', $value); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php new file mode 100644 index 00000000..1ed3b9c2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php @@ -0,0 +1,69 @@ +startComponent{$expression}; ?>"; + } + + /** + * Compile the end-component statements into valid PHP. + * + * @return string + */ + protected function compileEndComponent() + { + return 'renderComponent(); ?>'; + } + + /** + * Compile the slot statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileSlot($expression) + { + return "slot{$expression}; ?>"; + } + + /** + * Compile the end-slot statements into valid PHP. + * + * @return string + */ + protected function compileEndSlot() + { + return 'endSlot(); ?>'; + } + + /** + * Compile the component-first statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileComponentFirst($expression) + { + return "startComponentFirst{$expression}; ?>"; + } + + /** + * Compile the end-component-first statements into valid PHP. + * + * @return string + */ + protected function compileEndComponentFirst() + { + return $this->compileEndComponent(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php new file mode 100644 index 00000000..d592ef17 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php @@ -0,0 +1,230 @@ +guard{$guard}->check()): ?>"; + } + + /** + * Compile the else-auth statements into valid PHP. + * + * @param string|null $guard + * @return string + */ + protected function compileElseAuth($guard = null) + { + $guard = is_null($guard) ? '()' : $guard; + + return "guard{$guard}->check()): ?>"; + } + + /** + * Compile the end-auth statements into valid PHP. + * + * @return string + */ + protected function compileEndAuth() + { + return ''; + } + + /** + * Compile the if-guest statements into valid PHP. + * + * @param string|null $guard + * @return string + */ + protected function compileGuest($guard = null) + { + $guard = is_null($guard) ? '()' : $guard; + + return "guard{$guard}->guest()): ?>"; + } + + /** + * Compile the else-guest statements into valid PHP. + * + * @param string|null $guard + * @return string + */ + protected function compileElseGuest($guard = null) + { + $guard = is_null($guard) ? '()' : $guard; + + return "guard{$guard}->guest()): ?>"; + } + + /** + * Compile the end-guest statements into valid PHP. + * + * @return string + */ + protected function compileEndGuest() + { + return ''; + } + + /** + * Compile the has-section statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileHasSection($expression) + { + return "yieldContent{$expression}))): ?>"; + } + + /** + * Compile the if statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileIf($expression) + { + return ""; + } + + /** + * Compile the unless statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileUnless($expression) + { + return ""; + } + + /** + * Compile the else-if statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileElseif($expression) + { + return ""; + } + + /** + * Compile the else statements into valid PHP. + * + * @return string + */ + protected function compileElse() + { + return ''; + } + + /** + * Compile the end-if statements into valid PHP. + * + * @return string + */ + protected function compileEndif() + { + return ''; + } + + /** + * Compile the end-unless statements into valid PHP. + * + * @return string + */ + protected function compileEndunless() + { + return ''; + } + + /** + * Compile the if-isset statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileIsset($expression) + { + return ""; + } + + /** + * Compile the end-isset statements into valid PHP. + * + * @return string + */ + protected function compileEndIsset() + { + return ''; + } + + /** + * Compile the switch statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileSwitch($expression) + { + $this->firstCaseInSwitch = true; + + return "firstCaseInSwitch) { + $this->firstCaseInSwitch = false; + + return "case {$expression}: ?>"; + } + + return ""; + } + + /** + * Compile the default statements in switch case into valid PHP. + * + * @return string + */ + protected function compileDefault() + { + return ''; + } + + /** + * Compile the end switch statements into valid PHP. + * + * @return string + */ + protected function compileEndSwitch() + { + return ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesEchos.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesEchos.php new file mode 100644 index 00000000..86f352e2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesEchos.php @@ -0,0 +1,94 @@ +getEchoMethods() as $method) { + $value = $this->$method($value); + } + + return $value; + } + + /** + * Get the echo methods in the proper order for compilation. + * + * @return array + */ + protected function getEchoMethods() + { + return [ + 'compileRawEchos', + 'compileEscapedEchos', + 'compileRegularEchos', + ]; + } + + /** + * Compile the "raw" echo statements. + * + * @param string $value + * @return string + */ + protected function compileRawEchos($value) + { + $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->rawTags[0], $this->rawTags[1]); + + $callback = function ($matches) { + $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; + + return $matches[1] ? substr($matches[0], 1) : "{$whitespace}"; + }; + + return preg_replace_callback($pattern, $callback, $value); + } + + /** + * Compile the "regular" echo statements. + * + * @param string $value + * @return string + */ + protected function compileRegularEchos($value) + { + $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->contentTags[0], $this->contentTags[1]); + + $callback = function ($matches) { + $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; + + $wrapped = sprintf($this->echoFormat, $matches[2]); + + return $matches[1] ? substr($matches[0], 1) : "{$whitespace}"; + }; + + return preg_replace_callback($pattern, $callback, $value); + } + + /** + * Compile the escaped echo statements. + * + * @param string $value + * @return string + */ + protected function compileEscapedEchos($value) + { + $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->escapedTags[0], $this->escapedTags[1]); + + $callback = function ($matches) { + $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; + + return $matches[1] ? $matches[0] : "{$whitespace}"; + }; + + return preg_replace_callback($pattern, $callback, $value); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesErrors.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesErrors.php new file mode 100644 index 00000000..77edc4bf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesErrors.php @@ -0,0 +1,37 @@ +stripParentheses($expression); + + return 'getBag($__errorArgs[1] ?? \'default\'); +if ($__bag->has($__errorArgs[0])) : +if (isset($message)) { $__messageOriginal = $message; } +$message = $__bag->first($__errorArgs[0]); ?>'; + } + + /** + * Compile the enderror statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEnderror($expression) + { + return ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesHelpers.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesHelpers.php new file mode 100644 index 00000000..979cadc5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesHelpers.php @@ -0,0 +1,49 @@ +'; + } + + /** + * Compile the "dd" statements into valid PHP. + * + * @param string $arguments + * @return string + */ + protected function compileDd($arguments) + { + return ""; + } + + /** + * Compile the "dump" statements into valid PHP. + * + * @param string $arguments + * @return string + */ + protected function compileDump($arguments) + { + return ""; + } + + /** + * Compile the method statements into valid PHP. + * + * @param string $method + * @return string + */ + protected function compileMethod($method) + { + return ""; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesIncludes.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesIncludes.php new file mode 100644 index 00000000..b80a5b5d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesIncludes.php @@ -0,0 +1,82 @@ +renderEach{$expression}; ?>"; + } + + /** + * Compile the include statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileInclude($expression) + { + $expression = $this->stripParentheses($expression); + + return "make({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; + } + + /** + * Compile the include-if statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileIncludeIf($expression) + { + $expression = $this->stripParentheses($expression); + + return "exists({$expression})) echo \$__env->make({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; + } + + /** + * Compile the include-when statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileIncludeWhen($expression) + { + $expression = $this->stripParentheses($expression); + + return "renderWhen($expression, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path'])); ?>"; + } + + /** + * Compile the include-unless statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileIncludeUnless($expression) + { + $expression = $this->stripParentheses($expression); + + return "renderWhen(! $expression, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path'])); ?>"; + } + + /** + * Compile the include-first statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileIncludeFirst($expression) + { + $expression = $this->stripParentheses($expression); + + return "first({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesInjections.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesInjections.php new file mode 100644 index 00000000..c295bcd4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesInjections.php @@ -0,0 +1,23 @@ +"; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesJson.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesJson.php new file mode 100644 index 00000000..cf343e97 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesJson.php @@ -0,0 +1,30 @@ +stripParentheses($expression)); + + $options = isset($parts[1]) ? trim($parts[1]) : $this->encodingOptions; + + $depth = isset($parts[2]) ? trim($parts[2]) : 512; + + return ""; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php new file mode 100644 index 00000000..fc6a63af --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php @@ -0,0 +1,116 @@ +stripParentheses($expression); + + $echo = "make({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; + + $this->footer[] = $echo; + + return ''; + } + + /** + * Compile the section statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileSection($expression) + { + $this->lastSection = trim($expression, "()'\" "); + + return "startSection{$expression}; ?>"; + } + + /** + * Replace the @parent directive to a placeholder. + * + * @return string + */ + protected function compileParent() + { + $escapedLastSection = strtr($this->lastSection, ['\\' => '\\\\', "'" => "\\'"]); + + return ""; + } + + /** + * Compile the yield statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileYield($expression) + { + return "yieldContent{$expression}; ?>"; + } + + /** + * Compile the show statements into valid PHP. + * + * @return string + */ + protected function compileShow() + { + return 'yieldSection(); ?>'; + } + + /** + * Compile the append statements into valid PHP. + * + * @return string + */ + protected function compileAppend() + { + return 'appendSection(); ?>'; + } + + /** + * Compile the overwrite statements into valid PHP. + * + * @return string + */ + protected function compileOverwrite() + { + return 'stopSection(true); ?>'; + } + + /** + * Compile the stop statements into valid PHP. + * + * @return string + */ + protected function compileStop() + { + return 'stopSection(); ?>'; + } + + /** + * Compile the end-section statements into valid PHP. + * + * @return string + */ + protected function compileEndsection() + { + return 'stopSection(); ?>'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLoops.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLoops.php new file mode 100644 index 00000000..9f64c4f2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLoops.php @@ -0,0 +1,180 @@ +forElseCounter; + + preg_match('/\( *(.*) +as *(.*)\)$/is', $expression, $matches); + + $iteratee = trim($matches[1]); + + $iteration = trim($matches[2]); + + $initLoop = "\$__currentLoopData = {$iteratee}; \$__env->addLoop(\$__currentLoopData);"; + + $iterateLoop = '$__env->incrementLoopIndices(); $loop = $__env->getLastLoop();'; + + return ""; + } + + /** + * Compile the for-else-empty and empty statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEmpty($expression) + { + if ($expression) { + return ""; + } + + $empty = '$__empty_'.$this->forElseCounter--; + + return "popLoop(); \$loop = \$__env->getLastLoop(); if ({$empty}): ?>"; + } + + /** + * Compile the end-for-else statements into valid PHP. + * + * @return string + */ + protected function compileEndforelse() + { + return ''; + } + + /** + * Compile the end-empty statements into valid PHP. + * + * @return string + */ + protected function compileEndEmpty() + { + return ''; + } + + /** + * Compile the for statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileFor($expression) + { + return ""; + } + + /** + * Compile the for-each statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileForeach($expression) + { + preg_match('/\( *(.*) +as *(.*)\)$/is', $expression, $matches); + + $iteratee = trim($matches[1]); + + $iteration = trim($matches[2]); + + $initLoop = "\$__currentLoopData = {$iteratee}; \$__env->addLoop(\$__currentLoopData);"; + + $iterateLoop = '$__env->incrementLoopIndices(); $loop = $__env->getLastLoop();'; + + return ""; + } + + /** + * Compile the break statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileBreak($expression) + { + if ($expression) { + preg_match('/\(\s*(-?\d+)\s*\)$/', $expression, $matches); + + return $matches ? '' : ""; + } + + return ''; + } + + /** + * Compile the continue statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileContinue($expression) + { + if ($expression) { + preg_match('/\(\s*(-?\d+)\s*\)$/', $expression, $matches); + + return $matches ? '' : ""; + } + + return ''; + } + + /** + * Compile the end-for statements into valid PHP. + * + * @return string + */ + protected function compileEndfor() + { + return ''; + } + + /** + * Compile the end-for-each statements into valid PHP. + * + * @return string + */ + protected function compileEndforeach() + { + return 'popLoop(); $loop = $__env->getLastLoop(); ?>'; + } + + /** + * Compile the while statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileWhile($expression) + { + return ""; + } + + /** + * Compile the end-while statements into valid PHP. + * + * @return string + */ + protected function compileEndwhile() + { + return ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesRawPhp.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesRawPhp.php new file mode 100644 index 00000000..41c7edfd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesRawPhp.php @@ -0,0 +1,32 @@ +"; + } + + return '@php'; + } + + /** + * Compile the unset statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileUnset($expression) + { + return ""; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesStacks.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesStacks.php new file mode 100644 index 00000000..79a380e6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesStacks.php @@ -0,0 +1,59 @@ +yieldPushContent{$expression}; ?>"; + } + + /** + * Compile the push statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compilePush($expression) + { + return "startPush{$expression}; ?>"; + } + + /** + * Compile the end-push statements into valid PHP. + * + * @return string + */ + protected function compileEndpush() + { + return 'stopPush(); ?>'; + } + + /** + * Compile the prepend statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compilePrepend($expression) + { + return "startPrepend{$expression}; ?>"; + } + + /** + * Compile the end-prepend statements into valid PHP. + * + * @return string + */ + protected function compileEndprepend() + { + return 'stopPrepend(); ?>'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php new file mode 100644 index 00000000..c47c221c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php @@ -0,0 +1,44 @@ +startTranslation(); ?>'; + } elseif ($expression[1] === '[') { + return "startTranslation{$expression}; ?>"; + } + + return "get{$expression}; ?>"; + } + + /** + * Compile the end-lang statements into valid PHP. + * + * @return string + */ + protected function compileEndlang() + { + return 'renderTranslation(); ?>'; + } + + /** + * Compile the choice statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileChoice($expression) + { + return "choice{$expression}; ?>"; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesComponents.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesComponents.php new file mode 100644 index 00000000..32516fcd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesComponents.php @@ -0,0 +1,146 @@ +componentStack[] = $name; + + $this->componentData[$this->currentComponent()] = $data; + + $this->slots[$this->currentComponent()] = []; + } + } + + /** + * Get the first view that actually exists from the given list, and start a component. + * + * @param array $names + * @param array $data + * @return void + */ + public function startComponentFirst(array $names, array $data = []) + { + $name = Arr::first($names, function ($item) { + return $this->exists($item); + }); + + $this->startComponent($name, $data); + } + + /** + * Render the current component. + * + * @return string + */ + public function renderComponent() + { + $name = array_pop($this->componentStack); + + return $this->make($name, $this->componentData($name))->render(); + } + + /** + * Get the data for the given component. + * + * @param string $name + * @return array + */ + protected function componentData($name) + { + return array_merge( + $this->componentData[count($this->componentStack)], + ['slot' => new HtmlString(trim(ob_get_clean()))], + $this->slots[count($this->componentStack)] + ); + } + + /** + * Start the slot rendering process. + * + * @param string $name + * @param string|null $content + * @return void + */ + public function slot($name, $content = null) + { + if (func_num_args() > 2) { + throw new InvalidArgumentException('You passed too many arguments to the ['.$name.'] slot.'); + } elseif (func_num_args() === 2) { + $this->slots[$this->currentComponent()][$name] = $content; + } elseif (ob_start()) { + $this->slots[$this->currentComponent()][$name] = ''; + + $this->slotStack[$this->currentComponent()][] = $name; + } + } + + /** + * Save the slot content for rendering. + * + * @return void + */ + public function endSlot() + { + last($this->componentStack); + + $currentSlot = array_pop( + $this->slotStack[$this->currentComponent()] + ); + + $this->slots[$this->currentComponent()] + [$currentSlot] = new HtmlString(trim(ob_get_clean())); + } + + /** + * Get the index for the current component. + * + * @return int + */ + protected function currentComponent() + { + return count($this->componentStack) - 1; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php new file mode 100644 index 00000000..39902905 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php @@ -0,0 +1,190 @@ +addViewEvent($view, $callback, 'creating: '); + } + + return $creators; + } + + /** + * Register multiple view composers via an array. + * + * @param array $composers + * @return array + */ + public function composers(array $composers) + { + $registered = []; + + foreach ($composers as $callback => $views) { + $registered = array_merge($registered, $this->composer($views, $callback)); + } + + return $registered; + } + + /** + * Register a view composer event. + * + * @param array|string $views + * @param \Closure|string $callback + * @return array + */ + public function composer($views, $callback) + { + $composers = []; + + foreach ((array) $views as $view) { + $composers[] = $this->addViewEvent($view, $callback, 'composing: '); + } + + return $composers; + } + + /** + * Add an event for a given view. + * + * @param string $view + * @param \Closure|string $callback + * @param string $prefix + * @return \Closure|null + */ + protected function addViewEvent($view, $callback, $prefix = 'composing: ') + { + $view = $this->normalizeName($view); + + if ($callback instanceof Closure) { + $this->addEventListener($prefix.$view, $callback); + + return $callback; + } elseif (is_string($callback)) { + return $this->addClassEvent($view, $callback, $prefix); + } + } + + /** + * Register a class based view composer. + * + * @param string $view + * @param string $class + * @param string $prefix + * @return \Closure + */ + protected function addClassEvent($view, $class, $prefix) + { + $name = $prefix.$view; + + // When registering a class based view "composer", we will simply resolve the + // classes from the application IoC container then call the compose method + // on the instance. This allows for convenient, testable view composers. + $callback = $this->buildClassEventCallback( + $class, $prefix + ); + + $this->addEventListener($name, $callback); + + return $callback; + } + + /** + * Build a class based container callback Closure. + * + * @param string $class + * @param string $prefix + * @return \Closure + */ + protected function buildClassEventCallback($class, $prefix) + { + [$class, $method] = $this->parseClassEvent($class, $prefix); + + // Once we have the class and method name, we can build the Closure to resolve + // the instance out of the IoC container and call the method on it with the + // given arguments that are passed to the Closure as the composer's data. + return function () use ($class, $method) { + return $this->container->make($class)->{$method}(...func_get_args()); + }; + } + + /** + * Parse a class based composer name. + * + * @param string $class + * @param string $prefix + * @return array + */ + protected function parseClassEvent($class, $prefix) + { + return Str::parseCallback($class, $this->classEventMethodForPrefix($prefix)); + } + + /** + * Determine the class event method based on the given prefix. + * + * @param string $prefix + * @return string + */ + protected function classEventMethodForPrefix($prefix) + { + return Str::contains($prefix, 'composing') ? 'compose' : 'create'; + } + + /** + * Add a listener to the event dispatcher. + * + * @param string $name + * @param \Closure $callback + * @return void + */ + protected function addEventListener($name, $callback) + { + if (Str::contains($name, '*')) { + $callback = function ($name, array $data) use ($callback) { + return $callback($data[0]); + }; + } + + $this->events->listen($name, $callback); + } + + /** + * Call the composer for a given view. + * + * @param \Illuminate\Contracts\View\View $view + * @return void + */ + public function callComposer(ViewContract $view) + { + $this->events->dispatch('composing: '.$view->name(), [$view]); + } + + /** + * Call the creator for a given view. + * + * @param \Illuminate\Contracts\View\View $view + * @return void + */ + public function callCreator(ViewContract $view) + { + $this->events->dispatch('creating: '.$view->name(), [$view]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLayouts.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLayouts.php new file mode 100644 index 00000000..82fb77b0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLayouts.php @@ -0,0 +1,244 @@ +sectionStack[] = $section; + } + } else { + $this->extendSection($section, $content instanceof View ? $content : e($content)); + } + } + + /** + * Inject inline content into a section. + * + * @param string $section + * @param string $content + * @return void + */ + public function inject($section, $content) + { + $this->startSection($section, $content); + } + + /** + * Stop injecting content into a section and return its contents. + * + * @return string + */ + public function yieldSection() + { + if (empty($this->sectionStack)) { + return ''; + } + + return $this->yieldContent($this->stopSection()); + } + + /** + * Stop injecting content into a section. + * + * @param bool $overwrite + * @return string + * + * @throws \InvalidArgumentException + */ + public function stopSection($overwrite = false) + { + if (empty($this->sectionStack)) { + throw new InvalidArgumentException('Cannot end a section without first starting one.'); + } + + $last = array_pop($this->sectionStack); + + if ($overwrite) { + $this->sections[$last] = ob_get_clean(); + } else { + $this->extendSection($last, ob_get_clean()); + } + + return $last; + } + + /** + * Stop injecting content into a section and append it. + * + * @return string + * + * @throws \InvalidArgumentException + */ + public function appendSection() + { + if (empty($this->sectionStack)) { + throw new InvalidArgumentException('Cannot end a section without first starting one.'); + } + + $last = array_pop($this->sectionStack); + + if (isset($this->sections[$last])) { + $this->sections[$last] .= ob_get_clean(); + } else { + $this->sections[$last] = ob_get_clean(); + } + + return $last; + } + + /** + * Append content to a given section. + * + * @param string $section + * @param string $content + * @return void + */ + protected function extendSection($section, $content) + { + if (isset($this->sections[$section])) { + $content = str_replace(static::parentPlaceholder($section), $content, $this->sections[$section]); + } + + $this->sections[$section] = $content; + } + + /** + * Get the string contents of a section. + * + * @param string $section + * @param string $default + * @return string + */ + public function yieldContent($section, $default = '') + { + $sectionContent = $default instanceof View ? $default : e($default); + + if (isset($this->sections[$section])) { + $sectionContent = $this->sections[$section]; + } + + $sectionContent = str_replace('@@parent', '--parent--holder--', $sectionContent); + + return str_replace( + '--parent--holder--', '@parent', str_replace(static::parentPlaceholder($section), '', $sectionContent) + ); + } + + /** + * Get the parent placeholder for the current request. + * + * @param string $section + * @return string + */ + public static function parentPlaceholder($section = '') + { + if (! isset(static::$parentPlaceholder[$section])) { + $salt = static::parentPlaceholderSalt(); + + static::$parentPlaceholder[$section] = '##parent-placeholder-'.sha1($salt.$section).'##'; + } + + return static::$parentPlaceholder[$section]; + } + + /** + * Get the parent placeholder salt. + * + * @return string + */ + protected static function parentPlaceholderSalt() + { + if (! static::$parentPlaceholderSalt) { + return static::$parentPlaceholderSalt = Str::random(40); + } + + return static::$parentPlaceholderSalt; + } + + /** + * Check if section exists. + * + * @param string $name + * @return bool + */ + public function hasSection($name) + { + return array_key_exists($name, $this->sections); + } + + /** + * Get the contents of a section. + * + * @param string $name + * @param string|null $default + * @return mixed + */ + public function getSection($name, $default = null) + { + return $this->getSections()[$name] ?? $default; + } + + /** + * Get the entire array of sections. + * + * @return array + */ + public function getSections() + { + return $this->sections; + } + + /** + * Flush all of the sections. + * + * @return void + */ + public function flushSections() + { + $this->sections = []; + $this->sectionStack = []; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLoops.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLoops.php new file mode 100644 index 00000000..edd6363e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLoops.php @@ -0,0 +1,94 @@ +loopsStack); + + $this->loopsStack[] = [ + 'iteration' => 0, + 'index' => 0, + 'remaining' => $length ?? null, + 'count' => $length, + 'first' => true, + 'last' => isset($length) ? $length == 1 : null, + 'odd' => false, + 'even' => true, + 'depth' => count($this->loopsStack) + 1, + 'parent' => $parent ? (object) $parent : null, + ]; + } + + /** + * Increment the top loop's indices. + * + * @return void + */ + public function incrementLoopIndices() + { + $loop = $this->loopsStack[$index = count($this->loopsStack) - 1]; + + $this->loopsStack[$index] = array_merge($this->loopsStack[$index], [ + 'iteration' => $loop['iteration'] + 1, + 'index' => $loop['iteration'], + 'first' => $loop['iteration'] == 0, + 'odd' => ! $loop['odd'], + 'even' => ! $loop['even'], + 'remaining' => isset($loop['count']) ? $loop['remaining'] - 1 : null, + 'last' => isset($loop['count']) ? $loop['iteration'] == $loop['count'] - 1 : null, + ]); + } + + /** + * Pop a loop from the top of the loop stack. + * + * @return void + */ + public function popLoop() + { + array_pop($this->loopsStack); + } + + /** + * Get an instance of the last loop in the stack. + * + * @return \stdClass|null + */ + public function getLastLoop() + { + if ($last = Arr::last($this->loopsStack)) { + return (object) $last; + } + } + + /** + * Get the entire loop stack. + * + * @return array + */ + public function getLoopStack() + { + return $this->loopsStack; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesStacks.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesStacks.php new file mode 100644 index 00000000..4e063af1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesStacks.php @@ -0,0 +1,179 @@ +pushStack[] = $section; + } + } else { + $this->extendPush($section, $content); + } + } + + /** + * Stop injecting content into a push section. + * + * @return string + * + * @throws \InvalidArgumentException + */ + public function stopPush() + { + if (empty($this->pushStack)) { + throw new InvalidArgumentException('Cannot end a push stack without first starting one.'); + } + + return tap(array_pop($this->pushStack), function ($last) { + $this->extendPush($last, ob_get_clean()); + }); + } + + /** + * Append content to a given push section. + * + * @param string $section + * @param string $content + * @return void + */ + protected function extendPush($section, $content) + { + if (! isset($this->pushes[$section])) { + $this->pushes[$section] = []; + } + + if (! isset($this->pushes[$section][$this->renderCount])) { + $this->pushes[$section][$this->renderCount] = $content; + } else { + $this->pushes[$section][$this->renderCount] .= $content; + } + } + + /** + * Start prepending content into a push section. + * + * @param string $section + * @param string $content + * @return void + */ + public function startPrepend($section, $content = '') + { + if ($content === '') { + if (ob_start()) { + $this->pushStack[] = $section; + } + } else { + $this->extendPrepend($section, $content); + } + } + + /** + * Stop prepending content into a push section. + * + * @return string + * + * @throws \InvalidArgumentException + */ + public function stopPrepend() + { + if (empty($this->pushStack)) { + throw new InvalidArgumentException('Cannot end a prepend operation without first starting one.'); + } + + return tap(array_pop($this->pushStack), function ($last) { + $this->extendPrepend($last, ob_get_clean()); + }); + } + + /** + * Prepend content to a given stack. + * + * @param string $section + * @param string $content + * @return void + */ + protected function extendPrepend($section, $content) + { + if (! isset($this->prepends[$section])) { + $this->prepends[$section] = []; + } + + if (! isset($this->prepends[$section][$this->renderCount])) { + $this->prepends[$section][$this->renderCount] = $content; + } else { + $this->prepends[$section][$this->renderCount] = $content.$this->prepends[$section][$this->renderCount]; + } + } + + /** + * Get the string contents of a push section. + * + * @param string $section + * @param string $default + * @return string + */ + public function yieldPushContent($section, $default = '') + { + if (! isset($this->pushes[$section]) && ! isset($this->prepends[$section])) { + return $default; + } + + $output = ''; + + if (isset($this->prepends[$section])) { + $output .= implode(array_reverse($this->prepends[$section])); + } + + if (isset($this->pushes[$section])) { + $output .= implode($this->pushes[$section]); + } + + return $output; + } + + /** + * Flush all of the stacks. + * + * @return void + */ + public function flushStacks() + { + $this->pushes = []; + $this->prepends = []; + $this->pushStack = []; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesTranslations.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesTranslations.php new file mode 100644 index 00000000..a77fc26a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesTranslations.php @@ -0,0 +1,38 @@ +translationReplacements = $replacements; + } + + /** + * Render the current translation. + * + * @return string + */ + public function renderTranslation() + { + return $this->container->make('translator')->get( + trim(ob_get_clean()), $this->translationReplacements + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php b/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php new file mode 100755 index 00000000..cf6dac70 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php @@ -0,0 +1,102 @@ +compiler = $compiler; + } + + /** + * Get the evaluated contents of the view. + * + * @param string $path + * @param array $data + * @return string + */ + public function get($path, array $data = []) + { + $this->lastCompiled[] = $path; + + // If this given view has expired, which means it has simply been edited since + // it was last compiled, we will re-compile the views so we can evaluate a + // fresh copy of the view. We'll pass the compiler the path of the view. + if ($this->compiler->isExpired($path)) { + $this->compiler->compile($path); + } + + $compiled = $this->compiler->getCompiledPath($path); + + // Once we have the path to the compiled file, we will evaluate the paths with + // typical PHP just like any other templates. We also keep a stack of views + // which have been rendered for right exception messages to be generated. + $results = $this->evaluatePath($compiled, $data); + + array_pop($this->lastCompiled); + + return $results; + } + + /** + * Handle a view exception. + * + * @param \Exception $e + * @param int $obLevel + * @return void + * + * @throws \Exception + */ + protected function handleViewException(Exception $e, $obLevel) + { + $e = new ViewException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e); + + parent::handleViewException($e, $obLevel); + } + + /** + * Get the exception message for an exception. + * + * @param \Exception $e + * @return string + */ + protected function getMessage(Exception $e) + { + return $e->getMessage().' (View: '.realpath(last($this->lastCompiled)).')'; + } + + /** + * Get the compiler implementation. + * + * @return \Illuminate\View\Compilers\CompilerInterface + */ + public function getCompiler() + { + return $this->compiler; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Engines/Engine.php b/vendor/laravel/framework/src/Illuminate/View/Engines/Engine.php new file mode 100755 index 00000000..bf5c748d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Engines/Engine.php @@ -0,0 +1,23 @@ +lastRendered; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Engines/EngineResolver.php b/vendor/laravel/framework/src/Illuminate/View/Engines/EngineResolver.php new file mode 100755 index 00000000..d0edb736 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Engines/EngineResolver.php @@ -0,0 +1,60 @@ +resolved[$engine]); + + $this->resolvers[$engine] = $resolver; + } + + /** + * Resolve an engine instance by name. + * + * @param string $engine + * @return \Illuminate\Contracts\View\Engine + * + * @throws \InvalidArgumentException + */ + public function resolve($engine) + { + if (isset($this->resolved[$engine])) { + return $this->resolved[$engine]; + } + + if (isset($this->resolvers[$engine])) { + return $this->resolved[$engine] = call_user_func($this->resolvers[$engine]); + } + + throw new InvalidArgumentException("Engine [{$engine}] not found."); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Engines/FileEngine.php b/vendor/laravel/framework/src/Illuminate/View/Engines/FileEngine.php new file mode 100644 index 00000000..f73c4a79 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Engines/FileEngine.php @@ -0,0 +1,20 @@ +evaluatePath($path, $data); + } + + /** + * Get the evaluated contents of the view at the given path. + * + * @param string $__path + * @param array $__data + * @return string + */ + protected function evaluatePath($__path, $__data) + { + $obLevel = ob_get_level(); + + ob_start(); + + extract($__data, EXTR_SKIP); + + // We'll evaluate the contents of the view inside a try/catch block so we can + // flush out any stray output that might get out before an error occurs or + // an exception is thrown. This prevents any partial views from leaking. + try { + include $__path; + } catch (Exception $e) { + $this->handleViewException($e, $obLevel); + } catch (Throwable $e) { + $this->handleViewException(new FatalThrowableError($e), $obLevel); + } + + return ltrim(ob_get_clean()); + } + + /** + * Handle a view exception. + * + * @param \Exception $e + * @param int $obLevel + * @return void + * + * @throws \Exception + */ + protected function handleViewException(Exception $e, $obLevel) + { + while (ob_get_level() > $obLevel) { + ob_end_clean(); + } + + throw $e; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Factory.php b/vendor/laravel/framework/src/Illuminate/View/Factory.php new file mode 100755 index 00000000..e06741ce --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Factory.php @@ -0,0 +1,568 @@ + 'blade', + 'php' => 'php', + 'css' => 'file', + 'html' => 'file', + ]; + + /** + * The view composer events. + * + * @var array + */ + protected $composers = []; + + /** + * The number of active rendering operations. + * + * @var int + */ + protected $renderCount = 0; + + /** + * Create a new view factory instance. + * + * @param \Illuminate\View\Engines\EngineResolver $engines + * @param \Illuminate\View\ViewFinderInterface $finder + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function __construct(EngineResolver $engines, ViewFinderInterface $finder, Dispatcher $events) + { + $this->finder = $finder; + $this->events = $events; + $this->engines = $engines; + + $this->share('__env', $this); + } + + /** + * Get the evaluated view contents for the given view. + * + * @param string $path + * @param \Illuminate\Contracts\Support\Arrayable|array $data + * @param array $mergeData + * @return \Illuminate\Contracts\View\View + */ + public function file($path, $data = [], $mergeData = []) + { + $data = array_merge($mergeData, $this->parseData($data)); + + return tap($this->viewInstance($path, $path, $data), function ($view) { + $this->callCreator($view); + }); + } + + /** + * Get the evaluated view contents for the given view. + * + * @param string $view + * @param \Illuminate\Contracts\Support\Arrayable|array $data + * @param array $mergeData + * @return \Illuminate\Contracts\View\View + */ + public function make($view, $data = [], $mergeData = []) + { + $path = $this->finder->find( + $view = $this->normalizeName($view) + ); + + // Next, we will create the view instance and call the view creator for the view + // which can set any data, etc. Then we will return the view instance back to + // the caller for rendering or performing other view manipulations on this. + $data = array_merge($mergeData, $this->parseData($data)); + + return tap($this->viewInstance($view, $path, $data), function ($view) { + $this->callCreator($view); + }); + } + + /** + * Get the first view that actually exists from the given list. + * + * @param array $views + * @param \Illuminate\Contracts\Support\Arrayable|array $data + * @param array $mergeData + * @return \Illuminate\Contracts\View\View + * + * @throws \InvalidArgumentException + */ + public function first(array $views, $data = [], $mergeData = []) + { + $view = Arr::first($views, function ($view) { + return $this->exists($view); + }); + + if (! $view) { + throw new InvalidArgumentException('None of the views in the given array exist.'); + } + + return $this->make($view, $data, $mergeData); + } + + /** + * Get the rendered content of the view based on a given condition. + * + * @param bool $condition + * @param string $view + * @param \Illuminate\Contracts\Support\Arrayable|array $data + * @param array $mergeData + * @return string + */ + public function renderWhen($condition, $view, $data = [], $mergeData = []) + { + if (! $condition) { + return ''; + } + + return $this->make($view, $this->parseData($data), $mergeData)->render(); + } + + /** + * Get the rendered contents of a partial from a loop. + * + * @param string $view + * @param array $data + * @param string $iterator + * @param string $empty + * @return string + */ + public function renderEach($view, $data, $iterator, $empty = 'raw|') + { + $result = ''; + + // If is actually data in the array, we will loop through the data and append + // an instance of the partial view to the final result HTML passing in the + // iterated value of this data array, allowing the views to access them. + if (count($data) > 0) { + foreach ($data as $key => $value) { + $result .= $this->make( + $view, ['key' => $key, $iterator => $value] + )->render(); + } + } + + // If there is no data in the array, we will render the contents of the empty + // view. Alternatively, the "empty view" could be a raw string that begins + // with "raw|" for convenience and to let this know that it is a string. + else { + $result = Str::startsWith($empty, 'raw|') + ? substr($empty, 4) + : $this->make($empty)->render(); + } + + return $result; + } + + /** + * Normalize a view name. + * + * @param string $name + * @return string + */ + protected function normalizeName($name) + { + return ViewName::normalize($name); + } + + /** + * Parse the given data into a raw array. + * + * @param mixed $data + * @return array + */ + protected function parseData($data) + { + return $data instanceof Arrayable ? $data->toArray() : $data; + } + + /** + * Create a new view instance from the given arguments. + * + * @param string $view + * @param string $path + * @param \Illuminate\Contracts\Support\Arrayable|array $data + * @return \Illuminate\Contracts\View\View + */ + protected function viewInstance($view, $path, $data) + { + return new View($this, $this->getEngineFromPath($path), $view, $path, $data); + } + + /** + * Determine if a given view exists. + * + * @param string $view + * @return bool + */ + public function exists($view) + { + try { + $this->finder->find($view); + } catch (InvalidArgumentException $e) { + return false; + } + + return true; + } + + /** + * Get the appropriate view engine for the given path. + * + * @param string $path + * @return \Illuminate\Contracts\View\Engine + * + * @throws \InvalidArgumentException + */ + public function getEngineFromPath($path) + { + if (! $extension = $this->getExtension($path)) { + throw new InvalidArgumentException("Unrecognized extension in file: {$path}"); + } + + $engine = $this->extensions[$extension]; + + return $this->engines->resolve($engine); + } + + /** + * Get the extension used by the view file. + * + * @param string $path + * @return string + */ + protected function getExtension($path) + { + $extensions = array_keys($this->extensions); + + return Arr::first($extensions, function ($value) use ($path) { + return Str::endsWith($path, '.'.$value); + }); + } + + /** + * Add a piece of shared data to the environment. + * + * @param array|string $key + * @param mixed|null $value + * @return mixed + */ + public function share($key, $value = null) + { + $keys = is_array($key) ? $key : [$key => $value]; + + foreach ($keys as $key => $value) { + $this->shared[$key] = $value; + } + + return $value; + } + + /** + * Increment the rendering counter. + * + * @return void + */ + public function incrementRender() + { + $this->renderCount++; + } + + /** + * Decrement the rendering counter. + * + * @return void + */ + public function decrementRender() + { + $this->renderCount--; + } + + /** + * Check if there are no active render operations. + * + * @return bool + */ + public function doneRendering() + { + return $this->renderCount == 0; + } + + /** + * Add a location to the array of view locations. + * + * @param string $location + * @return void + */ + public function addLocation($location) + { + $this->finder->addLocation($location); + } + + /** + * Add a new namespace to the loader. + * + * @param string $namespace + * @param string|array $hints + * @return $this + */ + public function addNamespace($namespace, $hints) + { + $this->finder->addNamespace($namespace, $hints); + + return $this; + } + + /** + * Prepend a new namespace to the loader. + * + * @param string $namespace + * @param string|array $hints + * @return $this + */ + public function prependNamespace($namespace, $hints) + { + $this->finder->prependNamespace($namespace, $hints); + + return $this; + } + + /** + * Replace the namespace hints for the given namespace. + * + * @param string $namespace + * @param string|array $hints + * @return $this + */ + public function replaceNamespace($namespace, $hints) + { + $this->finder->replaceNamespace($namespace, $hints); + + return $this; + } + + /** + * Register a valid view extension and its engine. + * + * @param string $extension + * @param string $engine + * @param \Closure|null $resolver + * @return void + */ + public function addExtension($extension, $engine, $resolver = null) + { + $this->finder->addExtension($extension); + + if (isset($resolver)) { + $this->engines->register($engine, $resolver); + } + + unset($this->extensions[$extension]); + + $this->extensions = array_merge([$extension => $engine], $this->extensions); + } + + /** + * Flush all of the factory state like sections and stacks. + * + * @return void + */ + public function flushState() + { + $this->renderCount = 0; + + $this->flushSections(); + $this->flushStacks(); + } + + /** + * Flush all of the section contents if done rendering. + * + * @return void + */ + public function flushStateIfDoneRendering() + { + if ($this->doneRendering()) { + $this->flushState(); + } + } + + /** + * Get the extension to engine bindings. + * + * @return array + */ + public function getExtensions() + { + return $this->extensions; + } + + /** + * Get the engine resolver instance. + * + * @return \Illuminate\View\Engines\EngineResolver + */ + public function getEngineResolver() + { + return $this->engines; + } + + /** + * Get the view finder instance. + * + * @return \Illuminate\View\ViewFinderInterface + */ + public function getFinder() + { + return $this->finder; + } + + /** + * Set the view finder instance. + * + * @param \Illuminate\View\ViewFinderInterface $finder + * @return void + */ + public function setFinder(ViewFinderInterface $finder) + { + $this->finder = $finder; + } + + /** + * Flush the cache of views located by the finder. + * + * @return void + */ + public function flushFinderCache() + { + $this->getFinder()->flush(); + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getDispatcher() + { + return $this->events; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function setDispatcher(Dispatcher $events) + { + $this->events = $events; + } + + /** + * Get the IoC container instance. + * + * @return \Illuminate\Contracts\Container\Container + */ + public function getContainer() + { + return $this->container; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } + + /** + * Get an item from the shared data. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function shared($key, $default = null) + { + return Arr::get($this->shared, $key, $default); + } + + /** + * Get all of the shared data for the environment. + * + * @return array + */ + public function getShared() + { + return $this->shared; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php b/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php new file mode 100755 index 00000000..c518524f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php @@ -0,0 +1,332 @@ +files = $files; + $this->paths = array_map([$this, 'resolvePath'], $paths); + + if (isset($extensions)) { + $this->extensions = $extensions; + } + } + + /** + * Get the fully qualified location of the view. + * + * @param string $name + * @return string + */ + public function find($name) + { + if (isset($this->views[$name])) { + return $this->views[$name]; + } + + if ($this->hasHintInformation($name = trim($name))) { + return $this->views[$name] = $this->findNamespacedView($name); + } + + return $this->views[$name] = $this->findInPaths($name, $this->paths); + } + + /** + * Get the path to a template with a named path. + * + * @param string $name + * @return string + */ + protected function findNamespacedView($name) + { + [$namespace, $view] = $this->parseNamespaceSegments($name); + + return $this->findInPaths($view, $this->hints[$namespace]); + } + + /** + * Get the segments of a template with a named path. + * + * @param string $name + * @return array + * + * @throws \InvalidArgumentException + */ + protected function parseNamespaceSegments($name) + { + $segments = explode(static::HINT_PATH_DELIMITER, $name); + + if (count($segments) !== 2) { + throw new InvalidArgumentException("View [{$name}] has an invalid name."); + } + + if (! isset($this->hints[$segments[0]])) { + throw new InvalidArgumentException("No hint path defined for [{$segments[0]}]."); + } + + return $segments; + } + + /** + * Find the given view in the list of paths. + * + * @param string $name + * @param array $paths + * @return string + * + * @throws \InvalidArgumentException + */ + protected function findInPaths($name, $paths) + { + foreach ((array) $paths as $path) { + foreach ($this->getPossibleViewFiles($name) as $file) { + if ($this->files->exists($viewPath = $path.'/'.$file)) { + return $viewPath; + } + } + } + + throw new InvalidArgumentException("View [{$name}] not found."); + } + + /** + * Get an array of possible view files. + * + * @param string $name + * @return array + */ + protected function getPossibleViewFiles($name) + { + return array_map(function ($extension) use ($name) { + return str_replace('.', '/', $name).'.'.$extension; + }, $this->extensions); + } + + /** + * Add a location to the finder. + * + * @param string $location + * @return void + */ + public function addLocation($location) + { + $this->paths[] = $this->resolvePath($location); + } + + /** + * Prepend a location to the finder. + * + * @param string $location + * @return void + */ + public function prependLocation($location) + { + array_unshift($this->paths, $this->resolvePath($location)); + } + + /** + * Resolve the path. + * + * @param string $path + * @return string + */ + protected function resolvePath($path) + { + return realpath($path) ?: $path; + } + + /** + * Add a namespace hint to the finder. + * + * @param string $namespace + * @param string|array $hints + * @return void + */ + public function addNamespace($namespace, $hints) + { + $hints = (array) $hints; + + if (isset($this->hints[$namespace])) { + $hints = array_merge($this->hints[$namespace], $hints); + } + + $this->hints[$namespace] = $hints; + } + + /** + * Prepend a namespace hint to the finder. + * + * @param string $namespace + * @param string|array $hints + * @return void + */ + public function prependNamespace($namespace, $hints) + { + $hints = (array) $hints; + + if (isset($this->hints[$namespace])) { + $hints = array_merge($hints, $this->hints[$namespace]); + } + + $this->hints[$namespace] = $hints; + } + + /** + * Replace the namespace hints for the given namespace. + * + * @param string $namespace + * @param string|array $hints + * @return void + */ + public function replaceNamespace($namespace, $hints) + { + $this->hints[$namespace] = (array) $hints; + } + + /** + * Register an extension with the view finder. + * + * @param string $extension + * @return void + */ + public function addExtension($extension) + { + if (($index = array_search($extension, $this->extensions)) !== false) { + unset($this->extensions[$index]); + } + + array_unshift($this->extensions, $extension); + } + + /** + * Returns whether or not the view name has any hint information. + * + * @param string $name + * @return bool + */ + public function hasHintInformation($name) + { + return strpos($name, static::HINT_PATH_DELIMITER) > 0; + } + + /** + * Flush the cache of located views. + * + * @return void + */ + public function flush() + { + $this->views = []; + } + + /** + * Get the filesystem instance. + * + * @return \Illuminate\Filesystem\Filesystem + */ + public function getFilesystem() + { + return $this->files; + } + + /** + * Set the active view paths. + * + * @param array $paths + * @return $this + */ + public function setPaths($paths) + { + $this->paths = $paths; + + return $this; + } + + /** + * Get the active view paths. + * + * @return array + */ + public function getPaths() + { + return $this->paths; + } + + /** + * Get the views that have been located. + * + * @return array + */ + public function getViews() + { + return $this->views; + } + + /** + * Get the namespace to file path hints. + * + * @return array + */ + public function getHints() + { + return $this->hints; + } + + /** + * Get registered extensions. + * + * @return array + */ + public function getExtensions() + { + return $this->extensions; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/LICENSE.md b/vendor/laravel/framework/src/Illuminate/View/LICENSE.md new file mode 100644 index 00000000..79810c84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php b/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php new file mode 100644 index 00000000..64015d58 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php @@ -0,0 +1,51 @@ +view = $view; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + // If the current session has an "errors" variable bound to it, we will share + // its value with all view instances so the views can easily access errors + // without having to bind. An empty bag is set when there aren't errors. + $this->view->share( + 'errors', $request->session()->get('errors') ?: new ViewErrorBag + ); + + // Putting the errors in the view for every view allows the developer to just + // assume that some errors are always available, which is convenient since + // they don't have to continually run checks for the presence of errors. + + return $next($request); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/View.php b/vendor/laravel/framework/src/Illuminate/View/View.php new file mode 100755 index 00000000..ca246f78 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/View.php @@ -0,0 +1,440 @@ +view = $view; + $this->path = $path; + $this->engine = $engine; + $this->factory = $factory; + + $this->data = $data instanceof Arrayable ? $data->toArray() : (array) $data; + } + + /** + * Get the string contents of the view. + * + * @param callable|null $callback + * @return array|string + * + * @throws \Throwable + */ + public function render(callable $callback = null) + { + try { + $contents = $this->renderContents(); + + $response = isset($callback) ? $callback($this, $contents) : null; + + // Once we have the contents of the view, we will flush the sections if we are + // done rendering all views so that there is nothing left hanging over when + // another view gets rendered in the future by the application developer. + $this->factory->flushStateIfDoneRendering(); + + return ! is_null($response) ? $response : $contents; + } catch (Exception $e) { + $this->factory->flushState(); + + throw $e; + } catch (Throwable $e) { + $this->factory->flushState(); + + throw $e; + } + } + + /** + * Get the contents of the view instance. + * + * @return string + */ + protected function renderContents() + { + // We will keep track of the amount of views being rendered so we can flush + // the section after the complete rendering operation is done. This will + // clear out the sections for any separate views that may be rendered. + $this->factory->incrementRender(); + + $this->factory->callComposer($this); + + $contents = $this->getContents(); + + // Once we've finished rendering the view, we'll decrement the render count + // so that each sections get flushed out next time a view is created and + // no old sections are staying around in the memory of an environment. + $this->factory->decrementRender(); + + return $contents; + } + + /** + * Get the evaluated contents of the view. + * + * @return string + */ + protected function getContents() + { + return $this->engine->get($this->path, $this->gatherData()); + } + + /** + * Get the data bound to the view instance. + * + * @return array + */ + public function gatherData() + { + $data = array_merge($this->factory->getShared(), $this->data); + + foreach ($data as $key => $value) { + if ($value instanceof Renderable) { + $data[$key] = $value->render(); + } + } + + return $data; + } + + /** + * Get the sections of the rendered view. + * + * @return array + * + * @throws \Throwable + */ + public function renderSections() + { + return $this->render(function () { + return $this->factory->getSections(); + }); + } + + /** + * Add a piece of data to the view. + * + * @param string|array $key + * @param mixed $value + * @return $this + */ + public function with($key, $value = null) + { + if (is_array($key)) { + $this->data = array_merge($this->data, $key); + } else { + $this->data[$key] = $value; + } + + return $this; + } + + /** + * Add a view instance to the view data. + * + * @param string $key + * @param string $view + * @param array $data + * @return $this + */ + public function nest($key, $view, array $data = []) + { + return $this->with($key, $this->factory->make($view, $data)); + } + + /** + * Add validation errors to the view. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array $provider + * @return $this + */ + public function withErrors($provider) + { + $this->with('errors', $this->formatErrors($provider)); + + return $this; + } + + /** + * Format the given message provider into a MessageBag. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array $provider + * @return \Illuminate\Support\MessageBag + */ + protected function formatErrors($provider) + { + return $provider instanceof MessageProvider + ? $provider->getMessageBag() : new MessageBag((array) $provider); + } + + /** + * Get the name of the view. + * + * @return string + */ + public function name() + { + return $this->getName(); + } + + /** + * Get the name of the view. + * + * @return string + */ + public function getName() + { + return $this->view; + } + + /** + * Get the array of view data. + * + * @return array + */ + public function getData() + { + return $this->data; + } + + /** + * Get the path to the view file. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set the path to the view. + * + * @param string $path + * @return void + */ + public function setPath($path) + { + $this->path = $path; + } + + /** + * Get the view factory instance. + * + * @return \Illuminate\View\Factory + */ + public function getFactory() + { + return $this->factory; + } + + /** + * Get the view's rendering engine. + * + * @return \Illuminate\Contracts\View\Engine + */ + public function getEngine() + { + return $this->engine; + } + + /** + * Determine if a piece of data is bound. + * + * @param string $key + * @return bool + */ + public function offsetExists($key) + { + return array_key_exists($key, $this->data); + } + + /** + * Get a piece of bound data to the view. + * + * @param string $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->data[$key]; + } + + /** + * Set a piece of data on the view. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->with($key, $value); + } + + /** + * Unset a piece of data from the view. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + unset($this->data[$key]); + } + + /** + * Get a piece of data from the view. + * + * @param string $key + * @return mixed + */ + public function &__get($key) + { + return $this->data[$key]; + } + + /** + * Set a piece of data on the view. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->with($key, $value); + } + + /** + * Check if a piece of data is bound to the view. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return isset($this->data[$key]); + } + + /** + * Remove a piece of bound data from the view. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + unset($this->data[$key]); + } + + /** + * Dynamically bind parameters to the view. + * + * @param string $method + * @param array $parameters + * @return \Illuminate\View\View + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + if (! Str::startsWith($method, 'with')) { + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); + } + + return $this->with(Str::camel(substr($method, 4)), $parameters[0]); + } + + /** + * Get content as a string of HTML. + * + * @return string + */ + public function toHtml() + { + return $this->render(); + } + + /** + * Get the string contents of the view. + * + * @return string + * + * @throws \Throwable + */ + public function __toString() + { + return $this->render(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/ViewException.php b/vendor/laravel/framework/src/Illuminate/View/ViewException.php new file mode 100644 index 00000000..e6797a29 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/ViewException.php @@ -0,0 +1,41 @@ +getPrevious(); + + if (Reflector::isCallable($reportCallable = [$exception, 'report'])) { + return Container::getInstance()->call($reportCallable); + } + + return false; + } + + /** + * Render the exception into an HTTP response. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function render($request) + { + $exception = $this->getPrevious(); + + if ($exception && method_exists($exception, 'render')) { + return $exception->render($request); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/ViewFinderInterface.php b/vendor/laravel/framework/src/Illuminate/View/ViewFinderInterface.php new file mode 100755 index 00000000..7b8a849e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/ViewFinderInterface.php @@ -0,0 +1,71 @@ +registerFactory(); + + $this->registerViewFinder(); + + $this->registerBladeCompiler(); + + $this->registerEngineResolver(); + } + + /** + * Register the view environment. + * + * @return void + */ + public function registerFactory() + { + $this->app->singleton('view', function ($app) { + // Next we need to grab the engine resolver instance that will be used by the + // environment. The resolver will be used by an environment to get each of + // the various engine implementations such as plain PHP or Blade engine. + $resolver = $app['view.engine.resolver']; + + $finder = $app['view.finder']; + + $factory = $this->createFactory($resolver, $finder, $app['events']); + + // We will also set the container instance on this view environment since the + // view composers may be classes registered in the container, which allows + // for great testable, flexible composers for the application developer. + $factory->setContainer($app); + + $factory->share('app', $app); + + return $factory; + }); + } + + /** + * Create a new Factory Instance. + * + * @param \Illuminate\View\Engines\EngineResolver $resolver + * @param \Illuminate\View\ViewFinderInterface $finder + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return \Illuminate\View\Factory + */ + protected function createFactory($resolver, $finder, $events) + { + return new Factory($resolver, $finder, $events); + } + + /** + * Register the view finder implementation. + * + * @return void + */ + public function registerViewFinder() + { + $this->app->bind('view.finder', function ($app) { + return new FileViewFinder($app['files'], $app['config']['view.paths']); + }); + } + + /** + * Register the Blade compiler implementation. + * + * @return void + */ + public function registerBladeCompiler() + { + $this->app->singleton('blade.compiler', function () { + return new BladeCompiler( + $this->app['files'], $this->app['config']['view.compiled'] + ); + }); + } + + /** + * Register the engine resolver instance. + * + * @return void + */ + public function registerEngineResolver() + { + $this->app->singleton('view.engine.resolver', function () { + $resolver = new EngineResolver; + + // Next, we will register the various view engines with the resolver so that the + // environment will resolve the engines needed for various views based on the + // extension of view file. We call a method for each of the view's engines. + foreach (['file', 'php', 'blade'] as $engine) { + $this->{'register'.ucfirst($engine).'Engine'}($resolver); + } + + return $resolver; + }); + } + + /** + * Register the file engine implementation. + * + * @param \Illuminate\View\Engines\EngineResolver $resolver + * @return void + */ + public function registerFileEngine($resolver) + { + $resolver->register('file', function () { + return new FileEngine; + }); + } + + /** + * Register the PHP engine implementation. + * + * @param \Illuminate\View\Engines\EngineResolver $resolver + * @return void + */ + public function registerPhpEngine($resolver) + { + $resolver->register('php', function () { + return new PhpEngine; + }); + } + + /** + * Register the Blade engine implementation. + * + * @param \Illuminate\View\Engines\EngineResolver $resolver + * @return void + */ + public function registerBladeEngine($resolver) + { + $resolver->register('blade', function () { + return new CompilerEngine($this->app['blade.compiler']); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/composer.json b/vendor/laravel/framework/src/Illuminate/View/composer.json new file mode 100644 index 00000000..2ec1e832 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/composer.json @@ -0,0 +1,40 @@ +{ + "name": "illuminate/view", + "description": "The Illuminate View package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2.5|^8.0", + "ext-json": "*", + "illuminate/container": "^6.0", + "illuminate/contracts": "^6.0", + "illuminate/events": "^6.0", + "illuminate/filesystem": "^6.0", + "illuminate/support": "^6.0", + "symfony/debug": "^4.3.4" + }, + "autoload": { + "psr-4": { + "Illuminate\\View\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/league/commonmark/.phpstorm.meta.php b/vendor/league/commonmark/.phpstorm.meta.php new file mode 100644 index 00000000..13de8734 --- /dev/null +++ b/vendor/league/commonmark/.phpstorm.meta.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PHPSTORM_META +{ + expectedArguments(\League\CommonMark\HtmlElement::__construct(), 0, 'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kdb', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr'); + + expectedArguments(\League\CommonMark\Block\Element\Heading::__construct(), 0, 1, 2, 3, 4, 5, 6); + expectedReturnValues(\League\CommonMark\Block\Element\Heading::getLevel(), 1, 2, 3, 4, 5, 6); + + registerArgumentsSet('league_commonmark_htmlblock_types', \League\CommonMark\Block\Element\HtmlBlock::TYPE_1_CODE_CONTAINER, \League\CommonMark\Block\Element\HtmlBlock::TYPE_2_COMMENT, \League\CommonMark\Block\Element\HtmlBlock::TYPE_3, \League\CommonMark\Block\Element\HtmlBlock::TYPE_4, \League\CommonMark\Block\Element\HtmlBlock::TYPE_5_CDATA, \League\CommonMark\Block\Element\HtmlBlock::TYPE_6_BLOCK_ELEMENT, \League\CommonMark\Block\Element\HtmlBlock::TYPE_7_MISC_ELEMENT); + expectedArguments(\League\CommonMark\Block\Element\HtmlBlock::__construct(), 0, argumentsSet('league_commonmark_htmlblock_types')); + expectedArguments(\League\CommonMark\Block\Element\HtmlBlock::setType(), 0, argumentsSet('league_commonmark_htmlblock_types')); + expectedReturnValues(\League\CommonMark\Block\Element\HtmlBlock::getType(), argumentsSet('league_commonmark_htmlblock_types')); + expectedArguments(\League\CommonMark\Util\RegexHelper::getHtmlBlockOpenRegex(), 0, argumentsSet('league_commonmark_htmlblock_types')); + expectedArguments(\League\CommonMark\Util\RegexHelper::getHtmlBlockCloseRegex(), 0, argumentsSet('league_commonmark_htmlblock_types')); + + registerArgumentsSet('league_commonmark_newline_types', \League\CommonMark\Inline\Element\Newline::HARDBREAK, \League\CommonMark\Inline\Element\Newline::SOFTBREAK); + expectedArguments(\League\CommonMark\Inline\Element\Newline::__construct(), 0, argumentsSet('league_commonmark_newline_types')); + expectedReturnValues(\League\CommonMark\Inline\Element\Newline::getType(), argumentsSet('league_commonmark_newline_types')); + + registerArgumentsSet('league_commonmark_options', 'renderer', 'commonmark', 'commonmark/enable_em', 'commonmark/enable_strong', 'commonmark/use_asterisk', 'commonmark/use_underscore', 'commonmark/unordered_list_markers', 'html_input', 'allow_unsafe_links', 'max_nesting_level', 'external_link', 'external_link/nofollow', 'external_link/noopener', 'external_link/noreferrer', 'footnote', 'footnote/backref_class', 'footnote/container_add_hr', 'footnote/container_class', 'footnote/ref_class', 'footnote/ref_id_prefix', 'footnote/footnote_class', 'footnote/footnote_id_prefix', 'heading_permalink', 'heading_permalink/html_class', 'heading_permalink/id_prefix', 'heading_permalink/inner_contents', 'heading_permalink/insert', 'heading_permalink/slug_normalizer', 'heading_permalink/symbol', 'heading_permalink/title', 'table_of_contents', 'table_of_contents/style', 'table_of_contents/normalize', 'table_of_contents/position', 'table_of_contents/html_class', 'table_of_contents/min_heading_level', 'table_of_contents/max_heading_level', 'table_of_contents/placeholder'); + expectedArguments(\League\CommonMark\EnvironmentInterface::getConfig(), 0, argumentsSet('league_commonmark_options')); + expectedArguments(\League\CommonMark\Util\ConfigurationInterface::get(), 0, argumentsSet('league_commonmark_options')); + expectedArguments(\League\CommonMark\Util\ConfigurationInterface::set(), 0, argumentsSet('league_commonmark_options')); +} diff --git a/vendor/league/commonmark/CHANGELOG-0.x.md b/vendor/league/commonmark/CHANGELOG-0.x.md new file mode 100644 index 00000000..16f96dd1 --- /dev/null +++ b/vendor/league/commonmark/CHANGELOG-0.x.md @@ -0,0 +1,842 @@ +# Change Log +All notable changes to this project will be documented in this file. +Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) principles. + +## [0.19.3] - 2019-06-18 + +### Fixed + + - Fixed bug where elements with content of `"0"` wouldn't be rendered (#376) + +## [0.19.2] - 2019-05-19 + +### Fixed + + - Fixed bug where default values for nested configuration paths were inadvertently cast to strings + +## [0.19.1] - 2019-04-10 + +### Added + + - Added the missing `addExtension()` method to the new `ConfigurableEnvironmentInterface` + +### Fixed + + - Fixed extensions not being able to register other extensions + +## [0.19.0] - 2019-04-10 + +### Added + + - The priority of parsers, processors, and renderers can now be set when `add()`ing them; you no longer need to rely on the order in which they are added + - Added support for trying multiple parsers per block/inline + - Extracted two new base interfaces from `Environment`: + - `EnvironmentInterface` + - `ConfigurableEnvironmentInterface` + - Extracted a new `AbstractStringContainerBlock` base class and corresponding `StringContainerInterface` from `AbstractBlock` + - Added `Cursor::getEncoding()` method + - Added `.phpstorm.meta.php` file for better IDE code completion + - Made some minor optimizations here and there + +### Changed + + - Pretty much everything now has parameter and return types (#346) + - Attributes passed to `HtmlElement` will now be escaped by default + - `Environment` is now a `final` class + - `Environment::getBlockRendererForClass()` was replaced with `Environment::getBlockRenderersForClass()` (note the added `s`) + - `Environment::getInlineRendererForClass()` was replaced with `Environment::getInlineRenderersForClass()` (note the added `s`) + - The `Environment::get____()` methods now return an iterator instead of an array + - `Context::addBlock()` no longer returns the same block instance you passed into the method, as this served no useful purpose + - `RegexHelper::isEscapable()` no longer accepts `null` values + - `Node::replaceChildren()` now accepts any type of `iterable`, not just `array`s + - Some block elements now extend `AbstractStringContainerBlock` instead of `AbstractBlock` + - `InlineContainerInterface` now extends the new `StringContainerInterface` + - The `handleRemainingContents()` method (formerly on `AbstractBlock`, now on `AbstractStringContainerBlock`) is now an `abstract method + - The `InlineParserContext` constructor now requires an `AbstractStringContainerBlock` instead of an `AbstractBlock` + +### Removed + + - Removed support for PHP 5.6 and 7.0 (#346) + - Removed support for `add()`ing parsers with just the target block/inline class name - you need to include the full namespace now + - Removed the following unused methods from `Environment`: + - `getInlineParser($name)` + - `getInlineParsers()` + - `createInlineParserEngine()` + - Removed the unused `getName()` methods: + - `AbstractBlockParser::getName()` + - `AbstractInlineParser::getName()` + - `BlockParserInterface::getName()` + - `InlinerParserInterface::getName()` + - Removed the now-useless classes: + - `AbstractBlockParser` + - `AbstractInlinerParser` + - `InlineContainer` + - Removed the `AbstractBlock::acceptsLines()` method + - Removed the now-useless constructor from `AbstractBlock` + - Removed previously-deprecated functionality: + - `InlineContainer` class + - `RegexHelper::$instance` + - `RegexHelper::getInstance()` + - `RegexHelper::getPartialRegex()` + - `RegexHelper::getHtmlTagRegex()` + - `RegexHelper::getLinkTitleRegex()` + - `RegexHelper::getLinkDestinationBracesRegex()` + - `RegexHelper::getThematicBreakRegex()` + - Removed the second `$preserveEntities` parameter from `Xml:escape()` + +## [0.18.5] - 2019-03-28 + +### Fixed + + - Fixed the adjoining `Text` collapser not handling the full tree (thephpleague/commonmark-ext-autolink#10) + +## [0.18.4] - 2019-03-23 + +### Changed + + - Modified how URL normalization decodes certain characters in order to align with the JS library's output + - Disallowed unescaped `(` in parenthesized link title + +### Fixed + + - Fixed two exponential backtracking issues + +## [0.18.3] - 2019-03-21 + +This is a **security update** release. + +### Changed + + - XML/HTML entities in attributes will no longer be preserved when rendering (#353) + +### Fixed + + - Fix XSS vulnerability caused by improper preservation of entities when rendering (#353) + +### Deprecated + + - Deprecated the `$preserveEntites` argument of `Xml::escape()` for removal in the next release (#353) + +## [0.18.2] - 2019-03-16 + +### Fixed + + - Fixed adjoining `Text` elements not being collapsed after delimiter processing + +### Deprecated + + - Deprecated the `CommonmarkConverter::VERSION` constant for removal in 1.0.0 + +## [0.18.1] - 2018-12-29 + +This is a **security update** release. + +### Fixed + + - Fix XSS vulnerability caused by URL normalization not handling/encoding newlines properly (#337, CVE-2018-20583) + +## [0.18.0] - 2018-09-18 + +### Added + + - Added `ConverterInterface` to `Converter` and `CommonMarkConverter` (#330) + - Added `ListItem::getListData()` method (#329) + +### Changed + + - Links with `target="_blank"` will also get `rel="noopener noreferrer"` by default (#331) + - Implemented several performance optimizations (#324) + +## [0.17.5] - 2018-03-29 + +### Fixed + + - Fixed incorrect version constant value (again) + - Fixed release checklist to prevent the above from happening + - Fixed incorrect dates in CHANGELOG + +## [0.17.4] - 2018-03-28 + +### Added + + - Added `ListBlock::setTight()` method + +## [0.17.3] - 2018-03-26 + +### Fixed + + - Fixed incorrect version constant value + +## [0.17.2] - 2018-03-25 + +### Added + + - Added new `RegexHelper::isEscapable()` method + +### Fixed + + - Fixed spec compliance bug where escaped spaces should not be allowed in link destinations + +## [0.17.1] - 2018-03-18 + +### Added + + - Added a new constant containing the current version: `CommonMarkConverter::VERSION` (#314) + +## [0.17.0] - 2017-12-30 + +This release contains several breaking changes and a minimum PHP version bump - see for more details. + +### Added + + - Added new `max_nesting_level` setting (#243) + - Added minor performance optimizations to `Cursor` + +### Changed + + - Minimum PHP version is now 5.6.5. + - All full and partial regular expressions in `RegexHelper` are now defined as constants instead of being built on-the-fly. + - `Cursor::saveState()` now returns an `array` instead of a `CursorState` object. + - `Cursor::restoreState()` now accepts an `array` parameter instead of a `CursorState` object. + - Saving/restoring the Cursor state no longer tracks things that don't change (like the text content). + - `RegexHelper` is now `final`. + - References to `InlineContainer` changed to new `InlineContainerInterface` interface. + - `MiscExtension::addInlineParser()` and `MiscExtension::addBlockRenderer()` now return `$this` instead of nothing. + +### Fixed + - Fixed `Reference::normalizeReference()` not properly collapsing whitespace to a single space + +### Deprecated + + - `RegexHelper::getInstance()` and all instance (non-static) methods have been deprecated. + - The `InlineContainer` interface has been deprecated. Use `InlineContainerInterface` instead. + +### Removed + + - Removed support for PHP 5.4 and 5.5. + - Removed `CursorState` class + - Removed all previous deprecations: + - `Cursor::getFirstNonSpacePosition()` + - `Cursor::getFirstNonSpaceCharacter()` + - `Cursor::advanceWhileMatches()` + - `Cursor::advanceToFirstNonSpace()` + - `ElementRendererInterface::escape()` + - `HtmlRenderer::escape()` + - `RegexHelper::REGEX_UNICODE_WHITESPACE` + - `RegexHelper::getLinkDestinationRegex()` + +## [0.16.0] - 2017-10-30 + +This release contains breaking changes, several performance improvements, and two deprecations: + +### Added + + - Added new `Xml` utility class; moved HTML/XML escaping logic into there (see deprecations below) + +### Changed + + - `Environment::getInlineParsersForCharacter()` now returns an empty array (instead of `null`) when no matching parsers are found + - Three utility classes are now marked `final`: + - `Html5Entities` + - `LinkParserHelper` + - `UrlEncoder` + +### Fixed + + - Improved performance of several methods (for a 10% overall performance boost - #292) + +### Deprecated + +The following methods were deprecated and are scheduled for removal in 0.17.0 or 1.0.0 (whichever comes first). See for more information. + + - `Cursor::advanceWhileMatches()` deprecated; use `Cursor::match()` instead. + - `HtmlRenderer::escape()` deprecated; use `Xml::escape()` instead. + +### Removed + + - Removed `DelimiterStack::findFirstMatchingOpener()` which was previously deprecated in 0.15.0 + +## [0.15.7] - 2017-10-26 + +### Fixed + + - Improved performance of `Cursor::advanceBy()` (for a 16% performance boost) + +## [0.15.6] - 2017-08-08 + +### Fixed + + - Fixed URI normalization not properly encoding/decoding special characters in certain cases (#287) + +## [0.15.5] - 2017-08-05 + +This release bumps spec compliance to 0.28 without breaking changes to the API. + +### Added + + - Project is now tested against PHP 7.2 + +### Changed + + - Bumped CommonMark spec target to 0.28 + - Changed internal implementation of `LinkParserHelper::parseLinkDestination()` to allow nested parens + - Changed precedence of strong/emph when both nestings are possible (rule 14) + - Allow tabs before and after ATX closing header + +### Fixed + + - Fixed HTML type 6 block regex matching against `
` (it shouldn't) and not matching `