diff --git a/kms/api/README.md b/kms/README.md similarity index 97% rename from kms/api/README.md rename to kms/README.md index 0bc40720de..8b4d1ddad3 100644 --- a/kms/api/README.md +++ b/kms/README.md @@ -13,7 +13,7 @@ These samples show how to use the [Google Cloud KMS API] ``` $ git clone https://github.com/GoogleCloudPlatform/php-docs-samples - $ cd php-docs-samples/kms/api + $ cd php-docs-samples/kms ``` 5. **Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md). Run `php composer.phar install` (if composer is installed locally) or `composer install` diff --git a/kms/api/kms.php b/kms/api/kms.php deleted file mode 100644 index f8c9b8e3b3..0000000000 --- a/kms/api/kms.php +++ /dev/null @@ -1,32 +0,0 @@ -add(new EncryptionCommand()); -$application->add(new IamCommand()); -$application->add(new KeyCommand()); -$application->add(new KeyRingCommand()); -$application->add(new VersionCommand()); -$application->run(); diff --git a/kms/api/src/EncryptionCommand.php b/kms/api/src/EncryptionCommand.php deleted file mode 100644 index 6a85f11ce5..0000000000 --- a/kms/api/src/EncryptionCommand.php +++ /dev/null @@ -1,112 +0,0 @@ -setName('encryption') - ->setDescription('Manage encryption for KMS') - ->setHelp(<<%command.name% command uses the KMS API to encrypt and decrypt text in files. - -Encrypt the text of a file using the specified CryptoKey: - - php %command.full_name% my-keyring my-cryptokey file.txt file.txt.encrypted - -Decrypt the text of a file using the specified CryptoKey: - - php %command.full_name% my-keyring my-cryptokey file.txt.encrypted file.txt.decrypted --decrypt - -EOF - ) - ->addArgument( - 'keyring', - InputArgument::REQUIRED, - 'The name of the keyring.' - ) - ->addArgument( - 'cryptokey', - InputArgument::REQUIRED, - 'The name of the cryptokey.' - ) - ->addArgument( - 'infile', - InputArgument::REQUIRED, - 'The target file.' - ) - ->addArgument( - 'outfile', - InputArgument::REQUIRED, - 'The file to store the result.' - ) - ->addOption( - 'decrypt', - null, - InputOption::VALUE_NONE, - 'Performs the decrypt function instead of encrypt. ' - ) - ->addOption( - 'project', - null, - InputOption::VALUE_REQUIRED, - 'The Google Cloud Platform project name to use for this invocation. ' . - 'If omitted then the current gcloud project is assumed. ' - ) - ->addOption( - 'location', - null, - InputOption::VALUE_REQUIRED, - 'The location of the cryptokey or keyring.', - 'global' - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - if (!$projectId = $input->getOption('project')) { - $projectId = $this->getProjectIdFromGcloud(); - } - $keyRing = $input->getArgument('keyring'); - $cryptoKey = $input->getArgument('cryptokey'); - $infile = $input->getArgument('infile'); - $outfile = $input->getArgument('outfile'); - $location = $input->getOption('location'); - if ($input->getOption('decrypt')) { - decrypt($projectId, $keyRing, $cryptoKey, $infile, $outfile, $location); - } else { - encrypt($projectId, $keyRing, $cryptoKey, $infile, $outfile, $location); - } - } -} diff --git a/kms/api/src/IamCommand.php b/kms/api/src/IamCommand.php deleted file mode 100644 index 29cfb88d1a..0000000000 --- a/kms/api/src/IamCommand.php +++ /dev/null @@ -1,159 +0,0 @@ -setName('iam') - ->setDescription('Manage IAM for KMS') - ->setHelp(<<%command.name% command manages KMS IAM policies. - -List the IAM roles for a KeyRing: - - php %command.full_name% my-keyring - -List the IAM roles for a CryptoKey: - - php %command.full_name% my-keyring my-cryptokey - -Add a service account to a CryptoKey: - - php %command.full_name% my-keyring my-cryptokey \ - --service-account-email=example@my-project.gserviceaccount.com - -Add a service account to a CryptoKey for a specific role: - - php %command.full_name% my-keyring my-cryptokey \ - --service-account-email=example@my-project.gserviceaccount.com \ - --role=roles/cloudkms.admin - -EOF - ) - ->addArgument( - 'keyring', - InputArgument::REQUIRED, - 'The name of the keyring.' - ) - ->addArgument( - 'cryptokey', - InputArgument::OPTIONAL, - 'The name of the cryptokey.' - ) - ->addOption( - 'project', - null, - InputOption::VALUE_REQUIRED, - 'The Google Cloud Platform project name to use for this invocation. ' . - 'If omitted then the current gcloud project is assumed. ' - ) - ->addOption( - 'service-account-email', - null, - InputOption::VALUE_REQUIRED, - 'The service accunt email to add to the policy.' - ) - ->addOption( - 'user-email', - null, - InputOption::VALUE_REQUIRED, - 'The user email to add to the policy.' - ) - ->addOption( - 'role', - null, - InputOption::VALUE_REQUIRED, - 'The role of the policy.', - 'roles/cloudkms.cryptoKeyEncrypterDecrypter' - ) - ->addOption( - 'location', - null, - InputOption::VALUE_REQUIRED, - 'The location of the cryptokey or keyring.', - 'global' - ) - ->addOption( - 'remove', - null, - InputOption::VALUE_NONE, - 'If supplied, will remove the user or service account from the policy' - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - if (!$projectId = $input->getOption('project')) { - $projectId = $this->getProjectIdFromGcloud(); - } - $keyRing = $input->getArgument('keyring'); - $cryptoKey = $input->getArgument('cryptokey'); - $role = $input->getOption('role'); - $location = $input->getOption('location'); - $userEmail = $input->getOption('user-email'); - $serviceAccountEmail = $input->getOption('service-account-email'); - if ($cryptoKey) { - if (empty($userEmail) && empty($serviceAccountEmail)) { - get_cryptokey_policy($projectId, $keyRing, $cryptoKey, $location); - } else { - if ($userEmail) { - $member = 'user:' . $userEmail; - } else { - $member = 'serviceAccount:' . $serviceAccountEmail; - } - if ($input->getOption('remove')) { - remove_member_from_cryptokey_policy($projectId, $keyRing, $cryptoKey, $member, $role, $location); - } else { - add_member_to_cryptokey_policy($projectId, $keyRing, $cryptoKey, $member, $role, $location); - } - } - } else { - if (empty($userEmail) && empty($serviceAccountEmail)) { - get_keyring_policy($projectId, $keyRing, $location); - } else { - if ($userEmail) { - $member = 'user:' . $userEmail; - } else { - $member = 'serviceAccount:' . $serviceAccountEmail; - } - if ($input->getOption('remove')) { - remove_member_from_keyring_policy($projectId, $keyRing, $member, $role, $location); - } else { - add_member_to_keyring_policy($projectId, $keyRing, $member, $role, $location); - } - } - } - } -} diff --git a/kms/api/src/KeyCommand.php b/kms/api/src/KeyCommand.php deleted file mode 100644 index 1aa54b5c1a..0000000000 --- a/kms/api/src/KeyCommand.php +++ /dev/null @@ -1,109 +0,0 @@ -setName('key') - ->setDescription('Manage keys for KMS') - ->setHelp(<<%command.name% command manages KMS keys. - -List all CrytoKeys for the supplied KeyRing: - - php %command.full_name% my-keyring - -Display information about a CrytoKey: - - php %command.full_name% my-keyring my-cryptokey - -Create a CrytoKey: - - php %command.full_name% my-keyring new-cryptokey --create - -EOF - ) - ->addArgument( - 'keyring', - InputArgument::REQUIRED, - 'The name of the keyring.' - ) - ->addArgument( - 'cryptokey', - InputArgument::OPTIONAL, - 'The name of the cryptokey.' - ) - ->addOption( - 'project', - null, - InputOption::VALUE_REQUIRED, - 'The Google Cloud Platform project name to use for this invocation. ' . - 'If omitted then the current gcloud project is assumed. ' - ) - ->addOption( - 'create', - null, - InputOption::VALUE_NONE, - 'If supplied, will create the keyring, cryptokey, or cryptokey version' - ) - ->addOption( - 'location', - null, - InputOption::VALUE_REQUIRED, - 'The location of the cryptokey or keyring.', - 'global' - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - if (!$projectId = $input->getOption('project')) { - $projectId = $this->getProjectIdFromGcloud(); - } - $keyRing = $input->getArgument('keyring'); - $cryptoKey = $input->getArgument('cryptokey'); - $location = $input->getOption('location'); - - if ($cryptoKey) { - if ($input->getOption('create')) { - create_cryptokey($projectId, $keyRing, $cryptoKey, $location); - } else { - get_cryptokey($projectId, $keyRing, $cryptoKey, $location); - } - } else { - list_cryptokeys($projectId, $keyRing, $location); - } - } -} diff --git a/kms/api/src/KeyRingCommand.php b/kms/api/src/KeyRingCommand.php deleted file mode 100644 index b9aaab56e6..0000000000 --- a/kms/api/src/KeyRingCommand.php +++ /dev/null @@ -1,102 +0,0 @@ -setName('keyring') - ->setDescription('Manage keyrings for KMS') - ->setHelp(<<%command.name% command manages KMS keyrings. - -List all KeyRings for a project: - - php %command.full_name% - -Display information about a KeyRing: - - php %command.full_name% my-keyring - -Create a KeyRing: - - php %command.full_name% new-keyring --create - -EOF - ) - ->addArgument( - 'keyring', - InputArgument::OPTIONAL, - 'The name of the keyring.' - ) - ->addOption( - 'project', - null, - InputOption::VALUE_REQUIRED, - 'The Google Cloud Platform project name to use for this invocation. ' . - 'If omitted then the current gcloud project is assumed. ' - ) - ->addOption( - 'create', - null, - InputOption::VALUE_NONE, - 'If supplied, will create the keyring, cryptokey, or cryptokey version' - ) - ->addOption( - 'location', - null, - InputOption::VALUE_REQUIRED, - 'The location of the cryptokey or keyring.', - 'global' - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - if (!$projectId = $input->getOption('project')) { - $projectId = $this->getProjectIdFromGcloud(); - } - $ring = $input->getArgument('keyring'); - $location = $input->getOption('location'); - if ($ring) { - if ($input->getOption('create')) { - create_keyring($projectId, $ring, $location); - } else { - get_keyring($projectId, $ring, $location); - } - } else { - list_keyrings($projectId, $location); - } - } -} diff --git a/kms/api/src/KmsCommandTrait.php b/kms/api/src/KmsCommandTrait.php deleted file mode 100644 index 4d92943973..0000000000 --- a/kms/api/src/KmsCommandTrait.php +++ /dev/null @@ -1,47 +0,0 @@ -/dev/null", $output, $return_var); - - if (0 === $return_var) { - return array_pop($output); - } - - throw new Exception('Could not derive a project ID from gcloud. ' . - 'You must supply a project ID using --project'); - } - - private function getKmsClient() - { - // Instantiate the client, authenticate, and add scopes. - $client = new \Google_Client(); - $client->useApplicationDefaultCredentials(); - $client->addScope('https://www.googleapis.com/auth/cloud-platform'); - - // Create the Cloud KMS client - return new \Google_Service_CloudKMS($client); - } -} diff --git a/kms/api/src/VersionCommand.php b/kms/api/src/VersionCommand.php deleted file mode 100644 index 2d5a2bd3c8..0000000000 --- a/kms/api/src/VersionCommand.php +++ /dev/null @@ -1,154 +0,0 @@ -setName('version') - ->setDescription('Manage key versions for KMS') - ->setHelp(<<%command.name% command manages KMS key versions. - -List all versions of a CryptoKey: - - php %command.full_name% my-keyring my-cryptokey - -Display information about a specific CryptoKey version: - - php %command.full_name% my-keyring my-cryptokey 1 - -Create a new CryptoKey version: - - php %command.full_name% my-keyring my-cryptokey --create - -EOF - ) - ->addArgument( - 'keyring', - InputArgument::REQUIRED, - 'The name of the keyring.' - ) - ->addArgument( - 'cryptokey', - InputArgument::REQUIRED, - 'The name of the cryptokey.' - ) - ->addArgument( - 'version', - InputArgument::OPTIONAL, - 'The version of the cryptokey.' - ) - ->addOption( - 'project', - null, - InputOption::VALUE_REQUIRED, - 'The Google Cloud Platform project name to use for this invocation. ' . - 'If omitted then the current gcloud project is assumed. ' - ) - ->addOption( - 'create', - null, - InputOption::VALUE_NONE, - 'If supplied, will create the keyring, cryptokey, or cryptokey version' - ) - ->addOption( - 'destroy', - null, - InputOption::VALUE_NONE, - 'If supplied, will destroy the cryptokey version' - ) - ->addOption( - 'disable', - null, - InputOption::VALUE_NONE, - 'If supplied, will disable the cryptokey version' - ) - ->addOption( - 'enable', - null, - InputOption::VALUE_NONE, - 'If supplied, will enable the cryptokey version' - ) - ->addOption( - 'restore', - null, - InputOption::VALUE_NONE, - 'If supplied, will restore the cryptokey version' - ) - ->addOption( - 'set-primary', - null, - InputOption::VALUE_NONE, - 'If supplied, will disable the cryptokey version' - ) - ->addOption( - 'location', - null, - InputOption::VALUE_REQUIRED, - 'The location of the cryptokey or keyring.', - 'global' - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - if (!$projectId = $input->getOption('project')) { - $projectId = $this->getProjectIdFromGcloud(); - } - $keyRing = $input->getArgument('keyring'); - $cryptoKey = $input->getArgument('cryptokey'); - $cryptoKeyVersion = $input->getArgument('version'); - $location = $input->getOption('location'); - if ($input->getOption('create')) { - create_cryptokey_version($projectId, $keyRing, $cryptoKey, $location); - } elseif ($cryptoKeyVersion) { - if ($input->getOption('destroy')) { - destroy_cryptokey_version($projectId, $keyRing, $cryptoKey, $cryptoKeyVersion, $location); - } elseif ($input->getOption('disable')) { - disable_cryptokey_version($projectId, $keyRing, $cryptoKey, $cryptoKeyVersion, $location); - } elseif ($input->getOption('restore')) { - restore_cryptokey_version($projectId, $keyRing, $cryptoKey, $cryptoKeyVersion, $location); - } elseif ($input->getOption('enable')) { - enable_cryptokey_version($projectId, $keyRing, $cryptoKey, $cryptoKeyVersion, $location); - } elseif ($input->getOption('set-primary')) { - set_cryptokey_primary_version($projectId, $keyRing, $cryptoKey, $cryptoKeyVersion, $location); - } else { - get_cryptokey_version($projectId, $keyRing, $cryptoKey, $cryptoKeyVersion, $location); - } - } else { - list_cryptokey_versions($projectId, $keyRing, $cryptoKey, $location); - } - } -} diff --git a/kms/api/composer.json b/kms/composer.json similarity index 68% rename from kms/api/composer.json rename to kms/composer.json index 64e23e1221..47c8ef899d 100644 --- a/kms/api/composer.json +++ b/kms/composer.json @@ -1,10 +1,10 @@ { "require": { "google/apiclient": "^2.1", - "symfony/console": " ^3.0" + "symfony/console": " ^3.0", + "symfony/event-dispatcher": "^3.3" }, "autoload": { - "psr-4": { "Google\\Cloud\\Samples\\Kms\\": "src" }, "files": [ "src/functions.php" ] diff --git a/kms/api/composer.lock b/kms/composer.lock similarity index 87% rename from kms/api/composer.lock rename to kms/composer.lock index a1b01948ed..b72197ee84 100644 --- a/kms/api/composer.lock +++ b/kms/composer.lock @@ -4,25 +4,28 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "8415b41cc5fbf5b7e0cbdaa98bba0863", + "content-hash": "72055f6791350548d0b745742b3c4ca2", "packages": [ { "name": "firebase/php-jwt", - "version": "v4.0.0", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35" + "reference": "9984a4d3a32ae7673d6971ea00bae9d0a1abba0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/dccf163dc8ed7ed6a00afc06c51ee5186a428d35", - "reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/9984a4d3a32ae7673d6971ea00bae9d0a1abba0e", + "reference": "9984a4d3a32ae7673d6971ea00bae9d0a1abba0e", "shasum": "" }, "require": { "php": ">=5.3.0" }, + "require-dev": { + "phpunit/phpunit": " 4.8.35" + }, "type": "library", "autoload": { "psr-4": { @@ -47,27 +50,27 @@ ], "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", - "time": "2016-07-18T04:51:16+00:00" + "time": "2017-06-27T22:17:23+00:00" }, { "name": "google/apiclient", - "version": "v2.1.3", + "version": "v2.2.1", "source": { "type": "git", "url": "https://github.com/google/google-api-php-client.git", - "reference": "43996f09df274158fd04fce98e8a82effe5f3717" + "reference": "b69b8ac4bf6501793c389d4e013a79d09c85c5f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/google-api-php-client/zipball/43996f09df274158fd04fce98e8a82effe5f3717", - "reference": "43996f09df274158fd04fce98e8a82effe5f3717", + "url": "https://api.github.com/repos/google/google-api-php-client/zipball/b69b8ac4bf6501793c389d4e013a79d09c85c5f2", + "reference": "b69b8ac4bf6501793c389d4e013a79d09c85c5f2", "shasum": "" }, "require": { - "firebase/php-jwt": "~2.0|~3.0|~4.0", - "google/apiclient-services": "^0.11", - "google/auth": "^0.11", - "guzzlehttp/guzzle": "~5.2|~6.0", + "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0", + "google/apiclient-services": "~0.13", + "google/auth": "^1.0", + "guzzlehttp/guzzle": "~5.3.1|~6.0", "guzzlehttp/psr7": "^1.2", "monolog/monolog": "^1.17", "php": ">=5.4", @@ -106,20 +109,20 @@ "keywords": [ "google" ], - "time": "2017-03-22T18:32:04+00:00" + "time": "2017-11-03T01:19:53+00:00" }, { "name": "google/apiclient-services", - "version": "v0.11", + "version": "v0.36", "source": { "type": "git", "url": "https://github.com/google/google-api-php-client-services.git", - "reference": "48c554aee06f2fd5700d7bdfa4fa6b82d184eb52" + "reference": "2fd7d2876fbc0174faddba3241956a1393536159" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/google-api-php-client-services/zipball/48c554aee06f2fd5700d7bdfa4fa6b82d184eb52", - "reference": "48c554aee06f2fd5700d7bdfa4fa6b82d184eb52", + "url": "https://api.github.com/repos/google/google-api-php-client-services/zipball/2fd7d2876fbc0174faddba3241956a1393536159", + "reference": "2fd7d2876fbc0174faddba3241956a1393536159", "shasum": "" }, "require": { @@ -143,25 +146,25 @@ "keywords": [ "google" ], - "time": "2017-03-13T17:40:44+00:00" + "time": "2017-11-25T00:23:12+00:00" }, { "name": "google/auth", - "version": "v0.11.1", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/google/google-auth-library-php.git", - "reference": "a240674b08a09949fd5597f7590b3ed83663a12d" + "reference": "548d27d670f0236dc5258fa4cdde6e7b63464cfd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/a240674b08a09949fd5597f7590b3ed83663a12d", - "reference": "a240674b08a09949fd5597f7590b3ed83663a12d", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/548d27d670f0236dc5258fa4cdde6e7b63464cfd", + "reference": "548d27d670f0236dc5258fa4cdde6e7b63464cfd", "shasum": "" }, "require": { - "firebase/php-jwt": "~2.0|~3.0|~4.0", - "guzzlehttp/guzzle": "~5.3|~6.0", + "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0", + "guzzlehttp/guzzle": "~5.3.1|~6.0", "guzzlehttp/psr7": "~1.2", "php": ">=5.4", "psr/cache": "^1.0", @@ -173,9 +176,6 @@ }, "type": "library", "autoload": { - "classmap": [ - "src/" - ], "psr-4": { "Google\\Auth\\": "src" } @@ -191,20 +191,20 @@ "google", "oauth2" ], - "time": "2016-11-02T14:59:14+00:00" + "time": "2017-10-10T17:01:45+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "6.2.3", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006" + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", "shasum": "" }, "require": { @@ -214,9 +214,12 @@ }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0", + "phpunit/phpunit": "^4.0 || ^5.0", "psr/log": "^1.0" }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, "type": "library", "extra": { "branch-alias": { @@ -253,7 +256,7 @@ "rest", "web service" ], - "time": "2017-02-28T22:50:30+00:00" + "time": "2017-06-22T18:50:49+00:00" }, { "name": "guzzlehttp/promises", @@ -373,16 +376,16 @@ }, { "name": "monolog/monolog", - "version": "1.22.1", + "version": "1.23.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0" + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1e044bc4b34e91743943479f1be7a1d5eb93add0", - "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", "shasum": "" }, "require": { @@ -403,7 +406,7 @@ "phpunit/phpunit-mock-objects": "2.3.0", "ruflin/elastica": ">=0.90 <3.0", "sentry/sentry": "^0.13", - "swiftmailer/swiftmailer": "~5.3" + "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", @@ -447,20 +450,20 @@ "logging", "psr-3" ], - "time": "2017-03-13T07:08:03+00:00" + "time": "2017-06-19T01:22:40+00:00" }, { "name": "phpseclib/phpseclib", - "version": "2.0.4", + "version": "2.0.9", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf" + "reference": "c9a3fe35e20eb6eeaca716d6a23cde03f52d1558" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/ab8028c93c03cc8d9c824efa75dc94f1db2369bf", - "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/c9a3fe35e20eb6eeaca716d6a23cde03f52d1558", + "reference": "c9a3fe35e20eb6eeaca716d6a23cde03f52d1558", "shasum": "" }, "require": { @@ -539,7 +542,7 @@ "x.509", "x509" ], - "time": "2016-10-04T00:57:04+00:00" + "time": "2017-11-29T06:38:08+00:00" }, { "name": "psr/cache", @@ -686,25 +689,30 @@ }, { "name": "symfony/console", - "version": "v3.2.7", + "version": "v3.3.13", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c30243cc51f726812be3551316b109a2f5deaf8d" + "reference": "63cd7960a0a522c3537f6326706d7f3b8de65805" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c30243cc51f726812be3551316b109a2f5deaf8d", - "reference": "c30243cc51f726812be3551316b109a2f5deaf8d", + "url": "https://api.github.com/repos/symfony/console/zipball/63cd7960a0a522c3537f6326706d7f3b8de65805", + "reference": "63cd7960a0a522c3537f6326706d7f3b8de65805", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": "^5.5.9|>=7.0.8", "symfony/debug": "~2.8|~3.0", "symfony/polyfill-mbstring": "~1.0" }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, "require-dev": { "psr/log": "~1.0", + "symfony/config": "~3.3", + "symfony/dependency-injection": "~3.3", "symfony/event-dispatcher": "~2.8|~3.0", "symfony/filesystem": "~2.8|~3.0", "symfony/process": "~2.8|~3.0" @@ -718,7 +726,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -745,37 +753,36 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com/", - "time": "2017-04-04T14:33:42+00:00" + "time": "2017-11-16T15:24:32+00:00" }, { "name": "symfony/debug", - "version": "v3.2.7", + "version": "v3.3.13", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "56f613406446a4a0a031475cfd0a01751de22659" + "reference": "74557880e2846b5c84029faa96b834da37e29810" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/56f613406446a4a0a031475cfd0a01751de22659", - "reference": "56f613406446a4a0a031475cfd0a01751de22659", + "url": "https://api.github.com/repos/symfony/debug/zipball/74557880e2846b5c84029faa96b834da37e29810", + "reference": "74557880e2846b5c84029faa96b834da37e29810", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0" }, "conflict": { "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/class-loader": "~2.8|~3.0", "symfony/http-kernel": "~2.8|~3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -802,20 +809,83 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com/", - "time": "2017-03-28T21:38:24+00:00" + "time": "2017-11-10T16:38:39+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.3.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "271d8c27c3ec5ecee6e2ac06016232e249d638d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/271d8c27c3ec5ecee6e2ac06016232e249d638d9", + "reference": "271d8c27c3ec5ecee6e2ac06016232e249d638d9", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~3.3", + "symfony/expression-language": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com/", + "time": "2017-11-05T15:47:03+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.3.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", "shasum": "" }, "require": { @@ -827,7 +897,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -861,7 +931,7 @@ "portable", "shim" ], - "time": "2016-11-14T01:06:16+00:00" + "time": "2017-10-11T12:05:26+00:00" } ], "packages-dev": [ @@ -921,16 +991,16 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "1.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", "shasum": "" }, "require": { @@ -971,26 +1041,26 @@ "reflection", "static analysis" ], - "time": "2015-12-27T11:43:31+00:00" + "time": "2017-09-11T18:02:19+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bf329f6c1aadea3299f08ee804682b7c45b326a2", + "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2", "shasum": "" }, "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", + "php": "^5.6 || ^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -1016,24 +1086,24 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" + "time": "2017-11-10T14:09:06+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.2.1", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^5.5 || ^7.0", "phpdocumentor/reflection-common": "^1.0" }, "require-dev": { @@ -1063,37 +1133,37 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-11-25T06:54:22+00:00" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.7.0", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", "sebastian/comparator": "^1.1|^2.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { @@ -1126,7 +1196,7 @@ "spy", "stub" ], - "time": "2017-03-02T20:05:34+00:00" + "time": "2017-11-24T13:59:53+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1192,16 +1262,16 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -1235,7 +1305,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -1378,16 +1448,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.8.35", + "version": "4.8.36", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87" + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/791b1a67c25af50e230f841ee7a9c6eba507dc87", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", "shasum": "" }, "require": { @@ -1446,7 +1516,7 @@ "testing", "xunit" ], - "time": "2017-02-06T05:18:07+00:00" + "time": "2017-06-21T08:07:12+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -1570,23 +1640,23 @@ }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { @@ -1618,7 +1688,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08T07:14:41+00:00" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", @@ -1878,20 +1948,20 @@ }, { "name": "symfony/yaml", - "version": "v3.2.7", + "version": "v3.3.13", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "62b4cdb99d52cb1ff253c465eb1532a80cebb621" + "reference": "0938408c4faa518d95230deabb5f595bf0de31b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/62b4cdb99d52cb1ff253c465eb1532a80cebb621", - "reference": "62b4cdb99d52cb1ff253c465eb1532a80cebb621", + "url": "https://api.github.com/repos/symfony/yaml/zipball/0938408c4faa518d95230deabb5f595bf0de31b9", + "reference": "0938408c4faa518d95230deabb5f595bf0de31b9", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8" }, "require-dev": { "symfony/console": "~2.8|~3.0" @@ -1902,7 +1972,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -1929,7 +1999,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com/", - "time": "2017-03-20T09:45:15+00:00" + "time": "2017-11-10T18:26:04+00:00" }, { "name": "webmozart/assert", diff --git a/kms/kms.php b/kms/kms.php new file mode 100644 index 0000000000..93372289d4 --- /dev/null +++ b/kms/kms.php @@ -0,0 +1,326 @@ +setDispatcher($dispatcher = new EventDispatcher()); +$dispatcher->addListener(ConsoleEvents::COMMAND, function (ConsoleCommandEvent $event) { + $input = $event->getInput(); + // Try to get the default project ID from gcloud + if ($input->hasOption('project') && !$input->getOption('project')) { + exec( + "gcloud config list --format 'value(core.project)' 2>/dev/null", + $output, + $return_var + ); + + if (0 !== $return_var) { + throw new \Exception('Could not derive a project ID from gcloud. ' . + 'You must supply a project ID using --project'); + } + + $input->setOption('project', array_pop($output)); + } +}); + +$inputDefinition = new InputDefinition([ + new InputOption( + 'project', + 'p', + InputOption::VALUE_REQUIRED, + 'The Google Cloud Platform project name to use for this invocation. ' . + 'If omitted then the current gcloud project is assumed. ' + ), + new InputOption( + 'location', + null, + InputOption::VALUE_REQUIRED, + 'The location of the cryptokey or keyring.', + 'global' + ), +]); + +// Add Encryption Command +$application->add((new Command('encryption')) + ->setDescription('Manage encryption for KMS') + ->setDefinition(clone $inputDefinition) + ->addArgument('keyring', InputArgument::REQUIRED, 'The name of the keyring.') + ->addArgument('cryptokey', InputArgument::REQUIRED, 'The name of the cryptokey.') + ->addArgument('infile', InputArgument::REQUIRED, 'The target file.') + ->addArgument('outfile', InputArgument::REQUIRED, 'The file to store the result.') + ->addOption('decrypt', null, InputOption::VALUE_NONE, 'Performs the decrypt function instead of encrypt. ') + ->setHelp(<<%command.name% command uses the KMS API to encrypt and decrypt text in files. + +Encrypt the text of a file using the specified CryptoKey: + + php %command.full_name% my-keyring my-cryptokey file.txt file.txt.encrypted + +Decrypt the text of a file using the specified CryptoKey: + + php %command.full_name% my-keyring my-cryptokey file.txt.encrypted file.txt.decrypted --decrypt + +EOF + ) + ->setCode(function ($input, $output) { + $projectId = $input->getOption('project'); + $keyRing = $input->getArgument('keyring'); + $cryptoKey = $input->getArgument('cryptokey'); + $infile = $input->getArgument('infile'); + $outfile = $input->getArgument('outfile'); + $location = $input->getOption('location'); + if ($input->getOption('decrypt')) { + decrypt($projectId, $keyRing, $cryptoKey, $infile, $outfile, $location); + } else { + encrypt($projectId, $keyRing, $cryptoKey, $infile, $outfile, $location); + } + }) +); + +// Add IAM Command +$application->add((new Command('iam')) + ->setDescription('Manage IAM for KMS') + ->setDefinition(clone $inputDefinition) + ->addArgument('keyring', InputArgument::REQUIRED, 'The name of the keyring.') + ->addArgument('cryptokey', InputArgument::OPTIONAL, 'The name of the cryptokey.') + ->addOption('service-account-email', null, InputOption::VALUE_REQUIRED, 'The service accunt email to add to the policy.') + ->addOption('user-email', null, InputOption::VALUE_REQUIRED, 'The user email to add to the policy.') + ->addOption('role', null, InputOption::VALUE_REQUIRED, 'The role of the policy.', 'roles/cloudkms.cryptoKeyEncrypterDecrypter') + ->addOption('remove', null, InputOption::VALUE_NONE, 'If supplied, will remove the user or service account from the policy') + ->setHelp(<<%command.name% command manages KMS IAM policies. + +List the IAM roles for a KeyRing: + + php %command.full_name% my-keyring + +List the IAM roles for a CryptoKey: + + php %command.full_name% my-keyring my-cryptokey + +Add a service account to a CryptoKey: + + php %command.full_name% my-keyring my-cryptokey \ + --service-account-email=example@my-project.gserviceaccount.com + +Add a service account to a CryptoKey for a specific role: + + php %command.full_name% my-keyring my-cryptokey \ + --service-account-email=example@my-project.gserviceaccount.com \ + --role=roles/cloudkms.admin + +EOF + ) + ->setCode(function ($input, $output) { + $projectId = $input->getOption('project'); + $keyRing = $input->getArgument('keyring'); + $cryptoKey = $input->getArgument('cryptokey'); + $role = $input->getOption('role'); + $location = $input->getOption('location'); + $userEmail = $input->getOption('user-email'); + $serviceAccountEmail = $input->getOption('service-account-email'); + if ($cryptoKey) { + if (empty($userEmail) && empty($serviceAccountEmail)) { + get_cryptokey_policy($projectId, $keyRing, $cryptoKey, $location); + } else { + if ($userEmail) { + $member = 'user:' . $userEmail; + } else { + $member = 'serviceAccount:' . $serviceAccountEmail; + } + if ($input->getOption('remove')) { + remove_member_from_cryptokey_policy($projectId, $keyRing, $cryptoKey, $member, $role, $location); + } else { + add_member_to_cryptokey_policy($projectId, $keyRing, $cryptoKey, $member, $role, $location); + } + } + } else { + if (empty($userEmail) && empty($serviceAccountEmail)) { + get_keyring_policy($projectId, $keyRing, $location); + } else { + if ($userEmail) { + $member = 'user:' . $userEmail; + } else { + $member = 'serviceAccount:' . $serviceAccountEmail; + } + if ($input->getOption('remove')) { + remove_member_from_keyring_policy($projectId, $keyRing, $member, $role, $location); + } else { + add_member_to_keyring_policy($projectId, $keyRing, $member, $role, $location); + } + } + } + }) +); + +// Add Key Command +$application->add((new Command('key')) + ->setDescription('Manage keys for KMS') + ->setDefinition(clone $inputDefinition) + ->addArgument('keyring', InputArgument::REQUIRED, 'The name of the keyring.') + ->addArgument('cryptokey', InputArgument::OPTIONAL, 'The name of the cryptokey.') + ->addOption('create', null, InputOption::VALUE_NONE, 'If supplied, will create the keyring, cryptokey, or cryptokey version') + ->setHelp(<<%command.name% command manages KMS keys. + +List all CrytoKeys for the supplied KeyRing: + + php %command.full_name% my-keyring + +Display information about a CrytoKey: + + php %command.full_name% my-keyring my-cryptokey + +Create a CrytoKey: + + php %command.full_name% my-keyring new-cryptokey --create + +EOF + ) + ->setCode(function ($input, $output) { + $projectId = $input->getOption('project'); + $keyRing = $input->getArgument('keyring'); + $cryptoKey = $input->getArgument('cryptokey'); + $location = $input->getOption('location'); + + if ($cryptoKey) { + if ($input->getOption('create')) { + create_cryptokey($projectId, $keyRing, $cryptoKey, $location); + } else { + get_cryptokey($projectId, $keyRing, $cryptoKey, $location); + } + } else { + list_cryptokeys($projectId, $keyRing, $location); + } + }) +); + +// Add KeyRing Command +$application->add((new Command('keyring')) + ->setDescription('Manage keyrings for KMS') + ->setDefinition(clone $inputDefinition) + ->addArgument('keyring', InputArgument::OPTIONAL, 'The name of the keyring.') + ->addOption('create', null, InputOption::VALUE_NONE, 'If supplied, will create the keyring, cryptokey, or cryptokey version') + ->setHelp(<<%command.name% command manages KMS keyrings. + +List all KeyRings for a project: + + php %command.full_name% + +Display information about a KeyRing: + + php %command.full_name% my-keyring + +Create a KeyRing: + + php %command.full_name% new-keyring --create + +EOF + ) + ->setCode(function ($input, $output) { + $projectId = $input->getOption('project'); + $ring = $input->getArgument('keyring'); + $location = $input->getOption('location'); + if ($ring) { + if ($input->getOption('create')) { + create_keyring($projectId, $ring, $location); + } else { + get_keyring($projectId, $ring, $location); + } + } else { + list_keyrings($projectId, $location); + } + }) +); + +// Add Version Command +$application->add((new Command('version')) + ->setDescription('Manage key versions for KMS') + ->setDefinition(clone $inputDefinition) + ->addArgument('keyring', InputArgument::REQUIRED, 'The name of the keyring.') + ->addArgument('cryptokey', InputArgument::REQUIRED, 'The name of the cryptokey.') + ->addArgument('version', InputArgument::OPTIONAL, 'The version of the cryptokey.') + ->addOption('create', null, InputOption::VALUE_NONE, 'If supplied, will create the keyring, cryptokey, or cryptokey version') + ->addOption('destroy', null, InputOption::VALUE_NONE, 'If supplied, will destroy the cryptokey version') + ->addOption('disable', null, InputOption::VALUE_NONE, 'If supplied, will disable the cryptokey version') + ->addOption('enable', null, InputOption::VALUE_NONE, 'If supplied, will enable the cryptokey version') + ->addOption('restore', null, InputOption::VALUE_NONE, 'If supplied, will restore the cryptokey version') + ->addOption('set-primary', null, InputOption::VALUE_NONE, 'If supplied, will disable the cryptokey version') + ->setHelp(<<%command.name% command manages KMS key versions. + +List all versions of a CryptoKey: + + php %command.full_name% my-keyring my-cryptokey + +Display information about a specific CryptoKey version: + + php %command.full_name% my-keyring my-cryptokey 1 + +Create a new CryptoKey version: + + php %command.full_name% my-keyring my-cryptokey --create + +EOF + ) + ->setCode(function ($input, $output) { + $projectId = $input->getOption('project'); + $keyRing = $input->getArgument('keyring'); + $cryptoKey = $input->getArgument('cryptokey'); + $cryptoKeyVersion = $input->getArgument('version'); + $location = $input->getOption('location'); + if ($input->getOption('create')) { + create_cryptokey_version($projectId, $keyRing, $cryptoKey, $location); + } elseif ($cryptoKeyVersion) { + if ($input->getOption('destroy')) { + destroy_cryptokey_version($projectId, $keyRing, $cryptoKey, $cryptoKeyVersion, $location); + } elseif ($input->getOption('disable')) { + disable_cryptokey_version($projectId, $keyRing, $cryptoKey, $cryptoKeyVersion, $location); + } elseif ($input->getOption('restore')) { + restore_cryptokey_version($projectId, $keyRing, $cryptoKey, $cryptoKeyVersion, $location); + } elseif ($input->getOption('enable')) { + enable_cryptokey_version($projectId, $keyRing, $cryptoKey, $cryptoKeyVersion, $location); + } elseif ($input->getOption('set-primary')) { + set_cryptokey_primary_version($projectId, $keyRing, $cryptoKey, $cryptoKeyVersion, $location); + } else { + get_cryptokey_version($projectId, $keyRing, $cryptoKey, $cryptoKeyVersion, $location); + } + } else { + list_cryptokey_versions($projectId, $keyRing, $cryptoKey, $location); + } + }) +); + +// for testing +if (getenv('PHPUNIT_TESTS') === '1') { + return $application; +} + +$application->run(); diff --git a/kms/api/phpunit.xml.dist b/kms/phpunit.xml.dist similarity index 93% rename from kms/api/phpunit.xml.dist rename to kms/phpunit.xml.dist index 8719a22188..94b0adfe52 100644 --- a/kms/api/phpunit.xml.dist +++ b/kms/phpunit.xml.dist @@ -28,4 +28,7 @@ ./src + + + diff --git a/kms/quickstart/quickstart.php b/kms/quickstart.php similarity index 100% rename from kms/quickstart/quickstart.php rename to kms/quickstart.php diff --git a/kms/quickstart/composer.json b/kms/quickstart/composer.json deleted file mode 100644 index dc7652ad00..0000000000 --- a/kms/quickstart/composer.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "require": { - "google/apiclient": "^2.1" - }, - "require-dev": { - "phpunit/phpunit": "~4" - } -} diff --git a/kms/quickstart/composer.lock b/kms/quickstart/composer.lock deleted file mode 100644 index e69e6dee5b..0000000000 --- a/kms/quickstart/composer.lock +++ /dev/null @@ -1,1813 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "content-hash": "85984c5e88b71d71b69c9a3465d9875f", - "packages": [ - { - "name": "firebase/php-jwt", - "version": "v4.0.0", - "source": { - "type": "git", - "url": "https://github.com/firebase/php-jwt.git", - "reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/dccf163dc8ed7ed6a00afc06c51ee5186a428d35", - "reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "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", - "time": "2016-07-18T04:51:16+00:00" - }, - { - "name": "google/apiclient", - "version": "v2.1.3", - "source": { - "type": "git", - "url": "https://github.com/google/google-api-php-client.git", - "reference": "43996f09df274158fd04fce98e8a82effe5f3717" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/google/google-api-php-client/zipball/43996f09df274158fd04fce98e8a82effe5f3717", - "reference": "43996f09df274158fd04fce98e8a82effe5f3717", - "shasum": "" - }, - "require": { - "firebase/php-jwt": "~2.0|~3.0|~4.0", - "google/apiclient-services": "^0.11", - "google/auth": "^0.11", - "guzzlehttp/guzzle": "~5.2|~6.0", - "guzzlehttp/psr7": "^1.2", - "monolog/monolog": "^1.17", - "php": ">=5.4", - "phpseclib/phpseclib": "~0.3.10|~2.0" - }, - "require-dev": { - "cache/filesystem-adapter": "^0.3.2", - "phpunit/phpunit": "~4", - "squizlabs/php_codesniffer": "~2.3", - "symfony/css-selector": "~2.1", - "symfony/dom-crawler": "~2.1" - }, - "suggest": { - "cache/filesystem-adapter": "For caching certs and tokens (using Google_Client::setCache)" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-0": { - "Google_": "src/" - }, - "classmap": [ - "src/Google/Service/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "Client library for Google APIs", - "homepage": "http://developers.google.com/api-client-library/php", - "keywords": [ - "google" - ], - "time": "2017-03-22T18:32:04+00:00" - }, - { - "name": "google/apiclient-services", - "version": "v0.11", - "source": { - "type": "git", - "url": "https://github.com/google/google-api-php-client-services.git", - "reference": "48c554aee06f2fd5700d7bdfa4fa6b82d184eb52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/google/google-api-php-client-services/zipball/48c554aee06f2fd5700d7bdfa4fa6b82d184eb52", - "reference": "48c554aee06f2fd5700d7bdfa4fa6b82d184eb52", - "shasum": "" - }, - "require": { - "php": ">=5.4" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "type": "library", - "autoload": { - "psr-0": { - "Google_Service_": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "Client library for Google APIs", - "homepage": "http://developers.google.com/api-client-library/php", - "keywords": [ - "google" - ], - "time": "2017-03-13T17:40:44+00:00" - }, - { - "name": "google/auth", - "version": "v0.11.1", - "source": { - "type": "git", - "url": "https://github.com/google/google-auth-library-php.git", - "reference": "a240674b08a09949fd5597f7590b3ed83663a12d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/a240674b08a09949fd5597f7590b3ed83663a12d", - "reference": "a240674b08a09949fd5597f7590b3ed83663a12d", - "shasum": "" - }, - "require": { - "firebase/php-jwt": "~2.0|~3.0|~4.0", - "guzzlehttp/guzzle": "~5.3|~6.0", - "guzzlehttp/psr7": "~1.2", - "php": ">=5.4", - "psr/cache": "^1.0", - "psr/http-message": "^1.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^1.11", - "phpunit/phpunit": "3.7.*" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ], - "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" - ], - "time": "2016-11-02T14:59:14+00:00" - }, - { - "name": "guzzlehttp/guzzle", - "version": "6.2.3", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006", - "shasum": "" - }, - "require": { - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.4", - "php": ">=5.5" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.0", - "psr/log": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.2-dev" - } - }, - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2017-02-28T22:50:30+00:00" - }, - { - "name": "guzzlehttp/promises", - "version": "v1.3.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "shasum": "" - }, - "require": { - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "time": "2016-12-20T10:07:11+00:00" - }, - { - "name": "guzzlehttp/psr7", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Schultze", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "request", - "response", - "stream", - "uri", - "url" - ], - "time": "2017-03-20T17:10:46+00:00" - }, - { - "name": "monolog/monolog", - "version": "1.22.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1e044bc4b34e91743943479f1be7a1d5eb93add0", - "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/log-implementation": "1.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", - "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", - "jakub-onderka/php-parallel-lint": "0.9", - "php-amqplib/php-amqplib": "~2.4", - "php-console/php-console": "^3.1.3", - "phpunit/phpunit": "~4.5", - "phpunit/phpunit-mock-objects": "2.3.0", - "ruflin/elastica": ">=0.90 <3.0", - "sentry/sentry": "^0.13", - "swiftmailer/swiftmailer": "~5.3" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", - "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", - "sentry/sentry": "Allow sending log messages to a Sentry server" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.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": "http://seld.be/" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ], - "time": "2017-03-13T07:08:03+00:00" - }, - { - "name": "phpseclib/phpseclib", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/ab8028c93c03cc8d9c824efa75dc94f1db2369bf", - "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phing/phing": "~2.7", - "phpunit/phpunit": "~4.0", - "sami/sami": "~2.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "suggest": { - "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", - "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", - "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", - "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." - }, - "type": "library", - "autoload": { - "files": [ - "phpseclib/bootstrap.php" - ], - "psr-4": { - "phpseclib\\": "phpseclib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jim Wigginton", - "email": "terrafrost@php.net", - "role": "Lead Developer" - }, - { - "name": "Patrick Monnerat", - "email": "pm@datasphere.ch", - "role": "Developer" - }, - { - "name": "Andreas Fischer", - "email": "bantu@phpbb.com", - "role": "Developer" - }, - { - "name": "Hans-Jürgen Petrich", - "email": "petrich@tronic-media.com", - "role": "Developer" - }, - { - "name": "Graham Campbell", - "email": "graham@alt-three.com", - "role": "Developer" - } - ], - "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", - "homepage": "http://phpseclib.sourceforge.net/", - "keywords": [ - "BigInteger", - "aes", - "asn.1", - "asn1", - "blowfish", - "crypto", - "cryptography", - "encryption", - "rsa", - "security", - "sftp", - "signature", - "signing", - "ssh", - "twofish", - "x.509", - "x509" - ], - "time": "2016-10-04T00:57:04+00:00" - }, - { - "name": "psr/cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "time": "2016-08-06T20:24:11+00:00" - }, - { - "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" - ], - "time": "2016-08-06T14:39:51+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14T21:17:01+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org/", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2015-12-27T11:43:31+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.2.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2016-11-25T06:54:22+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.7.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1|^2.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com/" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2017-03-02T20:05:34+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2015-10-06T15:47:00+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2016-10-03T07:40:28+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.11", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-02-27T10:12:30+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "4.8.35", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/791b1a67c25af50e230f841ee7a9c6eba507dc87", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.8.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-02-06T05:18:07+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2015-10-02T06:51:40+00:00" - }, - { - "name": "sebastian/comparator", - "version": "1.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-01-29T09:50:25+00:00" - }, - { - "name": "sebastian/diff", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2015-12-08T07:14:41+00:00" - }, - { - "name": "sebastian/environment", - "version": "1.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-08-18T05:49:44+00:00" - }, - { - "name": "sebastian/exporter", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-06-17T09:04:28+00:00" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12T03:26:01+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03T07:41:43+00:00" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21T13:59:46+00:00" - }, - { - "name": "symfony/yaml", - "version": "v3.2.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "62b4cdb99d52cb1ff253c465eb1532a80cebb621" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/62b4cdb99d52cb1ff253c465eb1532a80cebb621", - "reference": "62b4cdb99d52cb1ff253c465eb1532a80cebb621", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "require-dev": { - "symfony/console": "~2.8|~3.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com/", - "time": "2017-03-20T09:45:15+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2016-11-23T20:04:58+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/kms/quickstart/phpunit.xml.dist b/kms/quickstart/phpunit.xml.dist deleted file mode 100644 index 466227d825..0000000000 --- a/kms/quickstart/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - test - - - - - - - - quickstart.php - - - diff --git a/kms/api/src/functions.php b/kms/src/functions.php similarity index 100% rename from kms/api/src/functions.php rename to kms/src/functions.php diff --git a/kms/api/test/EncryptionCommandTest.php b/kms/test/EncryptionCommandTest.php similarity index 96% rename from kms/api/test/EncryptionCommandTest.php rename to kms/test/EncryptionCommandTest.php index 92e41b75c2..adc166ec36 100644 --- a/kms/api/test/EncryptionCommandTest.php +++ b/kms/test/EncryptionCommandTest.php @@ -20,7 +20,6 @@ use Google_Client; use Google_Service_CloudKMS; use Google_Service_CloudKMS_DecryptRequest; -use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; class EncryptionCommandTest extends \PHPUnit_Framework_TestCase @@ -46,8 +45,7 @@ public function setUp() $this->ring = $ring; $this->key = $key; - $application = new Application(); - $application->add(new EncryptionCommand()); + $application = require __DIR__ . '/../kms.php'; $this->commandTester = new CommandTester($application->get('encryption')); } diff --git a/kms/api/test/IamCommandTest.php b/kms/test/IamCommandTest.php similarity index 81% rename from kms/api/test/IamCommandTest.php rename to kms/test/IamCommandTest.php index 6eb2c22bb5..ab774b6153 100644 --- a/kms/api/test/IamCommandTest.php +++ b/kms/test/IamCommandTest.php @@ -17,7 +17,6 @@ namespace Google\Cloud\Samples\Kms; -use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; class IamCommandTest extends \PHPUnit_Framework_TestCase @@ -43,8 +42,7 @@ public function setUp() $this->ring = $ring; $this->key = $key; - $application = new Application(); - $application->add(new IamCommand()); + $application = require __DIR__ . '/../kms.php'; $this->commandTester = new CommandTester($application->get('iam')); } @@ -61,9 +59,11 @@ public function testAddUserToKeyRing() ['interactive' => false] ); - $this->expectOutputString(sprintf('Member user:%s added to policy for keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Member user:%s added to policy for keyRing %s' . PHP_EOL, $userEmail, - $this->ring)); + $this->ring + )); } /** @@ -83,9 +83,11 @@ public function testRemoveUserFromKeyRing() ['interactive' => false] ); - $this->expectOutputString(sprintf('Member user:%s removed from policy for keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Member user:%s removed from policy for keyRing %s' . PHP_EOL, $userEmail, - $this->ring)); + $this->ring + )); } public function testAddUserToCryptoKey() @@ -102,10 +104,12 @@ public function testAddUserToCryptoKey() ['interactive' => false] ); - $this->expectOutputString(sprintf('Member user:%s added to policy for cryptoKey %s in keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Member user:%s added to policy for cryptoKey %s in keyRing %s' . PHP_EOL, $userEmail, $this->key, - $this->ring)); + $this->ring + )); } /** @@ -126,10 +130,12 @@ public function testRemoveUserFromCryptoKey() ['interactive' => false] ); - $this->expectOutputString(sprintf('Member user:%s removed from policy for cryptoKey %s in keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Member user:%s removed from policy for cryptoKey %s in keyRing %s' . PHP_EOL, $userEmail, $this->key, - $this->ring)); + $this->ring + )); } public function testAddServiceAccountToCryptoKey() @@ -148,10 +154,12 @@ public function testAddServiceAccountToCryptoKey() ['interactive' => false] ); - $this->expectOutputString(sprintf('Member serviceAccount:%s added to policy for cryptoKey %s in keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Member serviceAccount:%s added to policy for cryptoKey %s in keyRing %s' . PHP_EOL, $serviceAccountEmail, $this->key, - $this->ring)); + $this->ring + )); } /** @@ -174,10 +182,12 @@ public function testRemoveServiceAccountFromCryptoKey() ['interactive' => false] ); - $this->expectOutputString(sprintf('Member serviceAccount:%s removed from policy for cryptoKey %s in keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Member serviceAccount:%s removed from policy for cryptoKey %s in keyRing %s' . PHP_EOL, $serviceAccountEmail, $this->key, - $this->ring)); + $this->ring + )); } public function testAddServiceAccountToKeyRing() @@ -195,9 +205,11 @@ public function testAddServiceAccountToKeyRing() ['interactive' => false] ); - $this->expectOutputString(sprintf('Member serviceAccount:%s added to policy for keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Member serviceAccount:%s added to policy for keyRing %s' . PHP_EOL, $serviceAccountEmail, - $this->ring)); + $this->ring + )); } /** @@ -219,8 +231,10 @@ public function testRemoveServiceAccountFromKeyRing() ['interactive' => false] ); - $this->expectOutputString(sprintf('Member serviceAccount:%s removed from policy for keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Member serviceAccount:%s removed from policy for keyRing %s' . PHP_EOL, $serviceAccountEmail, - $this->ring)); + $this->ring + )); } } diff --git a/kms/api/test/KeyCommandTest.php b/kms/test/KeyCommandTest.php similarity index 93% rename from kms/api/test/KeyCommandTest.php rename to kms/test/KeyCommandTest.php index 369a3c7f6e..30deee2d61 100644 --- a/kms/api/test/KeyCommandTest.php +++ b/kms/test/KeyCommandTest.php @@ -17,7 +17,6 @@ namespace Google\Cloud\Samples\Kms; -use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; class KeyCommandTest extends \PHPUnit_Framework_TestCase @@ -37,8 +36,8 @@ public function setUp() } $this->projectId = $projectId; $this->ring = $ring; - $application = new Application(); - $application->add(new KeyCommand()); + + $application = require __DIR__ . '/../kms.php'; $this->commandTester = new CommandTester($application->get('key')); } @@ -75,7 +74,8 @@ public function testCreateCryptoKey() ['interactive' => false] ); - $this->expectOutputString(sprintf('Created cryptoKey %s in keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Created cryptoKey %s in keyRing %s' . PHP_EOL, self::$key, $this->ring )); diff --git a/kms/api/test/KeyRingCommandTest.php b/kms/test/KeyRingCommandTest.php similarity index 94% rename from kms/api/test/KeyRingCommandTest.php rename to kms/test/KeyRingCommandTest.php index 77dd55bbf1..f961558e1a 100644 --- a/kms/api/test/KeyRingCommandTest.php +++ b/kms/test/KeyRingCommandTest.php @@ -17,7 +17,6 @@ namespace Google\Cloud\Samples\Kms; -use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; class KeyRingCommandTest extends \PHPUnit_Framework_TestCase @@ -33,8 +32,8 @@ public function setUp() } $this->projectId = $projectId; - $application = new Application(); - $application->add(new KeyRingCommand()); + + $application = require __DIR__ . '/../kms.php'; $this->commandTester = new CommandTester($application->get('keyring')); } diff --git a/kms/api/test/VersionCommandTest.php b/kms/test/VersionCommandTest.php similarity index 88% rename from kms/api/test/VersionCommandTest.php rename to kms/test/VersionCommandTest.php index 36d7954351..fba6ee5f32 100644 --- a/kms/api/test/VersionCommandTest.php +++ b/kms/test/VersionCommandTest.php @@ -17,7 +17,6 @@ namespace Google\Cloud\Samples\Kms; -use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; class VersionCommandTest extends \PHPUnit_Framework_TestCase @@ -44,8 +43,7 @@ public function setUp() $this->ring = $ring; $this->key = $key; - $application = new Application(); - $application->add(new VersionCommand()); + $application = require __DIR__ . '/../kms.php'; $this->commandTester = new CommandTester($application->get('version')); } @@ -79,9 +77,11 @@ public function testCreateCryptoKeyVersion() ); $output = ob_get_clean(); - $regex = sprintf('/Created version (\d+) for cryptoKey %s in keyRing %s/' . PHP_EOL, + $regex = sprintf( + '/Created version (\d+) for cryptoKey %s in keyRing %s/' . PHP_EOL, $this->key, - $this->ring); + $this->ring + ); $this->assertEquals(1, preg_match($regex, $output, $matches)); self::$version = $matches[1]; } @@ -122,7 +122,8 @@ public function testDisableCryptoKeyVersion() ['interactive' => false] ); - $this->expectOutputString(sprintf('Disabled version %s for cryptoKey %s in keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Disabled version %s for cryptoKey %s in keyRing %s' . PHP_EOL, self::$version, $this->key, $this->ring @@ -145,7 +146,8 @@ public function testEnableCryptoKeyVersion() ['interactive' => false] ); - $this->expectOutputString(sprintf('Enabled version %s for cryptoKey %s in keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Enabled version %s for cryptoKey %s in keyRing %s' . PHP_EOL, self::$version, $this->key, $this->ring @@ -168,7 +170,8 @@ public function testDestroyCryptoKeyVersion() ['interactive' => false] ); - $this->expectOutputString(sprintf('Destroyed version %s for cryptoKey %s in keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Destroyed version %s for cryptoKey %s in keyRing %s' . PHP_EOL, self::$version, $this->key, $this->ring @@ -191,7 +194,8 @@ public function testRestoreCryptoKeyVersion() ['interactive' => false] ); - $this->expectOutputString(sprintf('Restored version %s for cryptoKey %s in keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Restored version %s for cryptoKey %s in keyRing %s' . PHP_EOL, self::$version, $this->key, $this->ring @@ -214,7 +218,8 @@ public function testSetPrimaryCryptoKeyVersion() ['interactive' => false] ); - $this->expectOutputString(sprintf('Set %s as primary version for cryptoKey %s in keyRing %s' . PHP_EOL, + $this->expectOutputString(sprintf( + 'Set %s as primary version for cryptoKey %s in keyRing %s' . PHP_EOL, self::$version, $this->key, $this->ring diff --git a/kms/api/test/data/plaintext.txt b/kms/test/data/plaintext.txt similarity index 100% rename from kms/api/test/data/plaintext.txt rename to kms/test/data/plaintext.txt diff --git a/kms/api/test/data/plaintext.txt.encrypted b/kms/test/data/plaintext.txt.encrypted similarity index 100% rename from kms/api/test/data/plaintext.txt.encrypted rename to kms/test/data/plaintext.txt.encrypted diff --git a/kms/quickstart/test/quickstartTest.php b/kms/test/quickstartTest.php similarity index 100% rename from kms/quickstart/test/quickstartTest.php rename to kms/test/quickstartTest.php