Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /home/nandedex/.cagefs/tmp/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : /home/nandedex/.cagefs/tmp/phpDkU6wi
<?php

namespace Google\Site_Kit_Dependencies;

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
/**
 * The "adSenseLinks" collection of methods.
 * Typical usage is:
 *  <code>
 *   $analyticsadminService = new Google_Service_GoogleAnalyticsAdmin(...);
 *   $adSenseLinks = $analyticsadminService->adSenseLinks;
 *  </code>
 */
class Google_Service_GoogleAnalyticsAdmin_PropertiesAdSenseLinks_Resource extends \Google\Site_Kit_Dependencies\Google_Service_Resource
{
    /**
     * Creates an AdSenseLink. (adSenseLinks.create)
     *
     * @param string $parent Required. The property for which to create an AdSense
     * Link. Format: properties/{propertyId} Example: properties/1234
     * @param Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaAdSenseLink $postBody
     * @param array $optParams Optional parameters.
     * @return Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaAdSenseLink
     */
    public function create($parent, \Google\Site_Kit_Dependencies\Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaAdSenseLink $postBody, $optParams = array())
    {
        $params = array('parent' => $parent, 'postBody' => $postBody);
        $params = \array_merge($params, $optParams);
        return $this->call('create', array($params), Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaAdSenseLink::class);
    }
    /**
     * Deletes an AdSenseLink. (adSenseLinks.delete)
     *
     * @param string $name Required. Unique identifier for the AdSense Link to be
     * deleted. Format: properties/{propertyId}/adSenseLinks/{linkId} Example:
     * properties/1234/adSenseLinks/5678
     * @param array $optParams Optional parameters.
     * @return Google_Service_GoogleAnalyticsAdmin_GoogleProtobufEmpty
     */
    public function delete($name, $optParams = array())
    {
        $params = array('name' => $name);
        $params = \array_merge($params, $optParams);
        return $this->call('delete', array($params), Google_Service_GoogleAnalyticsAdmin_GoogleProtobufEmpty::class);
    }
    /**
     * Looks up a single AdSenseLink. (adSenseLinks.get)
     *
     * @param string $name Required. Unique identifier for the AdSense Link
     * requested. Format: properties/{propertyId}/adSenseLinks/{linkId} Example:
     * properties/1234/adSenseLinks/5678
     * @param array $optParams Optional parameters.
     * @return Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaAdSenseLink
     */
    public function get($name, $optParams = array())
    {
        $params = array('name' => $name);
        $params = \array_merge($params, $optParams);
        return $this->call('get', array($params), Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaAdSenseLink::class);
    }
    /**
     * Lists AdSenseLinks on a property. (adSenseLinks.listPropertiesAdSenseLinks)
     *
     * @param string $parent Required. Resource name of the parent property. Format:
     * properties/{propertyId} Example: properties/1234
     * @param array $optParams Optional parameters.
     *
     * @opt_param int pageSize The maximum number of resources to return. If
     * unspecified, at most 50 resources will be returned. The maximum value is 200
     * (higher values will be coerced to the maximum).
     * @opt_param string pageToken A page token received from a previous
     * `ListAdSenseLinks` call. Provide this to retrieve the subsequent page. When
     * paginating, all other parameters provided to `ListAdSenseLinks` must match
     * the call that provided the page token.
     * @return Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaListAdSenseLinksResponse
     */
    public function listPropertiesAdSenseLinks($parent, $optParams = array())
    {
        $params = array('parent' => $parent);
        $params = \array_merge($params, $optParams);
        return $this->call('list', array($params), Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaListAdSenseLinksResponse::class);
    }
}
class Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaAdSenseLink extends \Google\Site_Kit_Dependencies\Google_Model
{
    protected $internal_gapi_mappings = array();
    public $adClientCode;
    public $name;
    public function setAdClientCode($adClientCode)
    {
        $this->adClientCode = $adClientCode;
    }
    public function getAdClientCode()
    {
        return $this->adClientCode;
    }
    public function setName($name)
    {
        $this->name = $name;
    }
    public function getName()
    {
        return $this->name;
    }
}
class Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaListAdSenseLinksResponse extends \Google\Site_Kit_Dependencies\Google_Collection
{
    protected $collection_key = 'adsenseLinks';
    protected $internal_gapi_mappings = array();
    protected $adsenseLinksType = 'Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaAdSenseLink';
    protected $adsenseLinksDataType = 'array';
    public $adsenseLinks;
    public $nextPageToken;
    public function setAdsenseLinks($adsenseLinks)
    {
        $this->adsenseLinks = $adsenseLinks;
    }
    public function getAdsenseLinks()
    {
        return $this->adsenseLinks;
    }
    public function setNextPageToken($nextPageToken)
    {
        $this->nextPageToken = $nextPageToken;
    }
    public function getNextPageToken()
    {
        return $this->nextPageToken;
    }
}
class Google_Service_GoogleAnalyticsAdmin_GoogleProtobufEmpty extends \Google\Site_Kit_Dependencies\Google_Model
{
}
{
  "extends": [
    "config:base",
    ":preserveSemverRanges"
  ]
}
<?php

namespace Google\Site_Kit_Dependencies;

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function oauth2client_php_autoload($className)
{
    $classPath = \explode('_', $className);
    if ($classPath[0] != 'Google') {
        return;
    }
    if (\count($classPath) > 3) {
        // Maximum class file path depth in this project is 3.
        $classPath = \array_slice($classPath, 0, 3);
    }
    $filePath = \dirname(__FILE__) . '/src/' . \implode('/', $classPath) . '.php';
    if (\file_exists($filePath)) {
        require_once $filePath;
    }
}
\spl_autoload_register('oauth2client_php_autoload');

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright 2015 Google Inc.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
<?php

/*
 * Copyright 2020 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

use Google\Site_Kit_Dependencies\Google\Auth\Credentials\GCECredentials;
use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface;
/**
 * A class to implement caching for calls to GCECredentials::onGce. This class
 * is used automatically when you pass a `Psr\Cache\CacheItemPoolInterface`
 * cache object to `ApplicationDefaultCredentials::getCredentials`.
 *
 * ```
 * $sysvCache = new Google\Auth\SysvCacheItemPool();
 * $creds = Google\Auth\ApplicationDefaultCredentials::getCredentials(
 *     $scope,
 *     null,
 *     null,
 *     $sysvCache
 * );
 * ```
 */
class GCECache
{
    const GCE_CACHE_KEY = 'google_auth_on_gce_cache';
    use CacheTrait;
    /**
     * @param array<mixed> $cacheConfig Configuration for the cache
     * @param CacheItemPoolInterface $cache
     */
    public function __construct(array $cacheConfig = null, \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface $cache = null)
    {
        $this->cache = $cache;
        $this->cacheConfig = \array_merge(['lifetime' => 1500, 'prefix' => ''], (array) $cacheConfig);
    }
    /**
     * Caches the result of onGce so the metadata server is not called multiple
     * times.
     *
     * @param callable $httpHandler callback which delivers psr7 request
     * @return bool True if this a GCEInstance, false otherwise
     */
    public function onGce(callable $httpHandler = null)
    {
        if (\is_null($this->cache)) {
            return \Google\Site_Kit_Dependencies\Google\Auth\Credentials\GCECredentials::onGce($httpHandler);
        }
        $cacheKey = self::GCE_CACHE_KEY;
        $onGce = $this->getCachedValue($cacheKey);
        if (\is_null($onGce)) {
            $onGce = \Google\Site_Kit_Dependencies\Google\Auth\Credentials\GCECredentials::onGce($httpHandler);
            $this->setCachedValue($cacheKey, $onGce);
        }
        return $onGce;
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

use Google\Site_Kit_Dependencies\Google\Auth\Credentials\ImpersonatedServiceAccountCredentials;
use Google\Site_Kit_Dependencies\Google\Auth\Credentials\InsecureCredentials;
use Google\Site_Kit_Dependencies\Google\Auth\Credentials\ServiceAccountCredentials;
use Google\Site_Kit_Dependencies\Google\Auth\Credentials\UserRefreshCredentials;
use RuntimeException;
use UnexpectedValueException;
/**
 * CredentialsLoader contains the behaviour used to locate and find default
 * credentials files on the file system.
 */
abstract class CredentialsLoader implements \Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface, \Google\Site_Kit_Dependencies\Google\Auth\UpdateMetadataInterface
{
    const TOKEN_CREDENTIAL_URI = 'https://oauth2.googleapis.com/token';
    const ENV_VAR = 'GOOGLE_APPLICATION_CREDENTIALS';
    const WELL_KNOWN_PATH = 'gcloud/application_default_credentials.json';
    const NON_WINDOWS_WELL_KNOWN_PATH_BASE = '.config';
    const MTLS_WELL_KNOWN_PATH = '.secureConnect/context_aware_metadata.json';
    const MTLS_CERT_ENV_VAR = 'GOOGLE_API_USE_CLIENT_CERTIFICATE';
    /**
     * @param string $cause
     * @return string
     */
    private static function unableToReadEnv($cause)
    {
        $msg = 'Unable to read the credential file specified by ';
        $msg .= ' GOOGLE_APPLICATION_CREDENTIALS: ';
        $msg .= $cause;
        return $msg;
    }
    /**
     * @return bool
     */
    private static function isOnWindows()
    {
        return \strtoupper(\substr(\PHP_OS, 0, 3)) === 'WIN';
    }
    /**
     * Load a JSON key from the path specified in the environment.
     *
     * Load a JSON key from the path specified in the environment
     * variable GOOGLE_APPLICATION_CREDENTIALS. Return null if
     * GOOGLE_APPLICATION_CREDENTIALS is not specified.
     *
     * @return array<mixed>|null JSON key | null
     */
    public static function fromEnv()
    {
        $path = \getenv(self::ENV_VAR);
        if (empty($path)) {
            return null;
        }
        if (!\file_exists($path)) {
            $cause = 'file ' . $path . ' does not exist';
            throw new \DomainException(self::unableToReadEnv($cause));
        }
        $jsonKey = \file_get_contents($path);
        return \json_decode((string) $jsonKey, \true);
    }
    /**
     * Load a JSON key from a well known path.
     *
     * The well known path is OS dependent:
     *
     * * windows: %APPDATA%/gcloud/application_default_credentials.json
     * * others: $HOME/.config/gcloud/application_default_credentials.json
     *
     * If the file does not exist, this returns null.
     *
     * @return array<mixed>|null JSON key | null
     */
    public static function fromWellKnownFile()
    {
        $rootEnv = self::isOnWindows() ? 'APPDATA' : 'HOME';
        $path = [\getenv($rootEnv)];
        if (!self::isOnWindows()) {
            $path[] = self::NON_WINDOWS_WELL_KNOWN_PATH_BASE;
        }
        $path[] = self::WELL_KNOWN_PATH;
        $path = \implode(\DIRECTORY_SEPARATOR, $path);
        if (!\file_exists($path)) {
            return null;
        }
        $jsonKey = \file_get_contents($path);
        return \json_decode((string) $jsonKey, \true);
    }
    /**
     * Create a new Credentials instance.
     *
     * @param string|string[] $scope the scope of the access request, expressed
     *        either as an Array or as a space-delimited String.
     * @param array<mixed> $jsonKey the JSON credentials.
     * @param string|string[] $defaultScope The default scope to use if no
     *   user-defined scopes exist, expressed either as an Array or as a
     *   space-delimited string.
     *
     * @return ServiceAccountCredentials|UserRefreshCredentials|ImpersonatedServiceAccountCredentials
     */
    public static function makeCredentials($scope, array $jsonKey, $defaultScope = null)
    {
        if (!\array_key_exists('type', $jsonKey)) {
            throw new \InvalidArgumentException('json key is missing the type field');
        }
        if ($jsonKey['type'] == 'service_account') {
            // Do not pass $defaultScope to ServiceAccountCredentials
            return new \Google\Site_Kit_Dependencies\Google\Auth\Credentials\ServiceAccountCredentials($scope, $jsonKey);
        }
        if ($jsonKey['type'] == 'authorized_user') {
            $anyScope = $scope ?: $defaultScope;
            return new \Google\Site_Kit_Dependencies\Google\Auth\Credentials\UserRefreshCredentials($anyScope, $jsonKey);
        }
        if ($jsonKey['type'] == 'impersonated_service_account') {
            $anyScope = $scope ?: $defaultScope;
            return new \Google\Site_Kit_Dependencies\Google\Auth\Credentials\ImpersonatedServiceAccountCredentials($anyScope, $jsonKey);
        }
        throw new \InvalidArgumentException('invalid value in the type field');
    }
    /**
     * Create an authorized HTTP Client from an instance of FetchAuthTokenInterface.
     *
     * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token
     * @param array<mixed> $httpClientOptions (optional) Array of request options to apply.
     * @param callable $httpHandler (optional) http client to fetch the token.
     * @param callable $tokenCallback (optional) function to be called when a new token is fetched.
     * @return \GuzzleHttp\Client
     */
    public static function makeHttpClient(\Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface $fetcher, array $httpClientOptions = [], callable $httpHandler = null, callable $tokenCallback = null)
    {
        $middleware = new \Google\Site_Kit_Dependencies\Google\Auth\Middleware\AuthTokenMiddleware($fetcher, $httpHandler, $tokenCallback);
        $stack = \Google\Site_Kit_Dependencies\GuzzleHttp\HandlerStack::create();
        $stack->push($middleware);
        return new \Google\Site_Kit_Dependencies\GuzzleHttp\Client(['handler' => $stack, 'auth' => 'google_auth'] + $httpClientOptions);
    }
    /**
     * Create a new instance of InsecureCredentials.
     *
     * @return InsecureCredentials
     */
    public static function makeInsecureCredentials()
    {
        return new \Google\Site_Kit_Dependencies\Google\Auth\Credentials\InsecureCredentials();
    }
    /**
     * export a callback function which updates runtime metadata.
     *
     * @return callable updateMetadata function
     * @deprecated
     */
    public function getUpdateMetadataFunc()
    {
        return [$this, 'updateMetadata'];
    }
    /**
     * Updates metadata with the authorization token.
     *
     * @param array<mixed> $metadata metadata hashmap
     * @param string $authUri optional auth uri
     * @param callable $httpHandler callback which delivers psr7 request
     * @return array<mixed> updated metadata hashmap
     */
    public function updateMetadata($metadata, $authUri = null, callable $httpHandler = null)
    {
        if (isset($metadata[self::AUTH_METADATA_KEY])) {
            // Auth metadata has already been set
            return $metadata;
        }
        $result = $this->fetchAuthToken($httpHandler);
        $metadata_copy = $metadata;
        if (isset($result['access_token'])) {
            $metadata_copy[self::AUTH_METADATA_KEY] = ['Bearer ' . $result['access_token']];
        } elseif (isset($result['id_token'])) {
            $metadata_copy[self::AUTH_METADATA_KEY] = ['Bearer ' . $result['id_token']];
        }
        return $metadata_copy;
    }
    /**
     * Gets a callable which returns the default device certification.
     *
     * @throws UnexpectedValueException
     * @return callable|null
     */
    public static function getDefaultClientCertSource()
    {
        if (!($clientCertSourceJson = self::loadDefaultClientCertSourceFile())) {
            return null;
        }
        $clientCertSourceCmd = $clientCertSourceJson['cert_provider_command'];
        return function () use($clientCertSourceCmd) {
            $cmd = \array_map('escapeshellarg', $clientCertSourceCmd);
            \exec(\implode(' ', $cmd), $output, $returnVar);
            if (0 === $returnVar) {
                return \implode(\PHP_EOL, $output);
            }
            throw new \RuntimeException('"cert_provider_command" failed with a nonzero exit code');
        };
    }
    /**
     * Determines whether or not the default device certificate should be loaded.
     *
     * @return bool
     */
    public static function shouldLoadClientCertSource()
    {
        return \filter_var(\getenv(self::MTLS_CERT_ENV_VAR), \FILTER_VALIDATE_BOOLEAN);
    }
    /**
     * @return array{cert_provider_command:string[]}|null
     */
    private static function loadDefaultClientCertSourceFile()
    {
        $rootEnv = self::isOnWindows() ? 'APPDATA' : 'HOME';
        $path = \sprintf('%s/%s', \getenv($rootEnv), self::MTLS_WELL_KNOWN_PATH);
        if (!\file_exists($path)) {
            return null;
        }
        $jsonKey = \file_get_contents($path);
        $clientCertSourceJson = \json_decode((string) $jsonKey, \true);
        if (!$clientCertSourceJson) {
            throw new \UnexpectedValueException('Invalid client cert source JSON');
        }
        if (!isset($clientCertSourceJson['cert_provider_command'])) {
            throw new \UnexpectedValueException('cert source requires "cert_provider_command"');
        }
        if (!\is_array($clientCertSourceJson['cert_provider_command'])) {
            throw new \UnexpectedValueException('cert source expects "cert_provider_command" to be an array');
        }
        return $clientCertSourceJson;
    }
}
<?php

/*
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

use Google\Site_Kit_Dependencies\phpseclib\Crypt\RSA;
/**
 * Sign a string using a Service Account private key.
 */
trait ServiceAccountSignerTrait
{
    /**
     * Sign a string using the service account private key.
     *
     * @param string $stringToSign
     * @param bool $forceOpenssl Whether to use OpenSSL regardless of
     *        whether phpseclib is installed. **Defaults to** `false`.
     * @return string
     */
    public function signBlob($stringToSign, $forceOpenssl = \false)
    {
        $privateKey = $this->auth->getSigningKey();
        $signedString = '';
        if (\class_exists('Google\\Site_Kit_Dependencies\\phpseclib\\Crypt\\RSA') && !$forceOpenssl) {
            $rsa = new \Google\Site_Kit_Dependencies\phpseclib\Crypt\RSA();
            $rsa->loadKey($privateKey);
            $rsa->setSignatureMode(\Google\Site_Kit_Dependencies\phpseclib\Crypt\RSA::SIGNATURE_PKCS1);
            $rsa->setHash('sha256');
            $signedString = $rsa->sign($stringToSign);
        } elseif (\extension_loaded('openssl')) {
            \openssl_sign($stringToSign, $signedString, $privateKey, 'sha256WithRSAEncryption');
        } else {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException('OpenSSL is not installed.');
        }
        // @codeCoverageIgnoreEnd
        return \base64_encode($signedString);
    }
}
<?php

/*
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

use DateTime;
use Exception;
use Google\Site_Kit_Dependencies\Firebase\JWT\ExpiredException;
use Google\Site_Kit_Dependencies\Firebase\JWT\JWT;
use Google\Site_Kit_Dependencies\Firebase\JWT\Key;
use Google\Site_Kit_Dependencies\Firebase\JWT\SignatureInvalidException;
use Google\Site_Kit_Dependencies\Google\Auth\Cache\MemoryCacheItemPool;
use Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache;
use Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory;
use Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Request;
use Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Utils;
use InvalidArgumentException;
use Google\Site_Kit_Dependencies\phpseclib\Crypt\RSA;
use Google\Site_Kit_Dependencies\phpseclib\Math\BigInteger as BigInteger2;
use Google\Site_Kit_Dependencies\phpseclib3\Crypt\PublicKeyLoader;
use Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger as BigInteger3;
use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface;
use RuntimeException;
use Google\Site_Kit_Dependencies\SimpleJWT\InvalidTokenException;
use Google\Site_Kit_Dependencies\SimpleJWT\JWT as SimpleJWT;
use Google\Site_Kit_Dependencies\SimpleJWT\Keys\KeyFactory;
use Google\Site_Kit_Dependencies\SimpleJWT\Keys\KeySet;
use UnexpectedValueException;
/**
 * Wrapper around Google Access Tokens which provides convenience functions.
 *
 * @experimental
 */
class AccessToken
{
    const FEDERATED_SIGNON_CERT_URL = 'https://www.googleapis.com/oauth2/v3/certs';
    const IAP_CERT_URL = 'https://www.gstatic.com/iap/verify/public_key-jwk';
    const IAP_ISSUER = 'https://cloud.google.com/iap';
    const OAUTH2_ISSUER = 'accounts.google.com';
    const OAUTH2_ISSUER_HTTPS = 'https://accounts.google.com';
    const OAUTH2_REVOKE_URI = 'https://oauth2.googleapis.com/revoke';
    /**
     * @var callable
     */
    private $httpHandler;
    /**
     * @var CacheItemPoolInterface
     */
    private $cache;
    /**
     * @param callable $httpHandler [optional] An HTTP Handler to deliver PSR-7 requests.
     * @param CacheItemPoolInterface $cache [optional] A PSR-6 compatible cache implementation.
     */
    public function __construct(callable $httpHandler = null, \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface $cache = null)
    {
        $this->httpHandler = $httpHandler ?: \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory::build(\Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache::getHttpClient());
        $this->cache = $cache ?: new \Google\Site_Kit_Dependencies\Google\Auth\Cache\MemoryCacheItemPool();
    }
    /**
     * Verifies an id token and returns the authenticated apiLoginTicket.
     * Throws an exception if the id token is not valid.
     * The audience parameter can be used to control which id tokens are
     * accepted.  By default, the id token must have been issued to this OAuth2 client.
     *
     * @param string $token The JSON Web Token to be verified.
     * @param array<mixed> $options [optional] {
     *     Configuration options.
     *     @type string $audience The indended recipient of the token.
     *     @type string $issuer The intended issuer of the token.
     *     @type string $cacheKey The cache key of the cached certs. Defaults to
     *        the sha1 of $certsLocation if provided, otherwise is set to
     *        "federated_signon_certs_v3".
     *     @type string $certsLocation The location (remote or local) from which
     *        to retrieve certificates, if not cached. This value should only be
     *        provided in limited circumstances in which you are sure of the
     *        behavior.
     *     @type bool $throwException Whether the function should throw an
     *        exception if the verification fails. This is useful for
     *        determining the reason verification failed.
     * }
     * @return array<mixed>|false the token payload, if successful, or false if not.
     * @throws InvalidArgumentException If certs could not be retrieved from a local file.
     * @throws InvalidArgumentException If received certs are in an invalid format.
     * @throws InvalidArgumentException If the cert alg is not supported.
     * @throws RuntimeException If certs could not be retrieved from a remote location.
     * @throws UnexpectedValueException If the token issuer does not match.
     * @throws UnexpectedValueException If the token audience does not match.
     */
    public function verify($token, array $options = [])
    {
        $audience = isset($options['audience']) ? $options['audience'] : null;
        $issuer = isset($options['issuer']) ? $options['issuer'] : null;
        $certsLocation = isset($options['certsLocation']) ? $options['certsLocation'] : self::FEDERATED_SIGNON_CERT_URL;
        $cacheKey = isset($options['cacheKey']) ? $options['cacheKey'] : $this->getCacheKeyFromCertLocation($certsLocation);
        $throwException = isset($options['throwException']) ? $options['throwException'] : \false;
        // for backwards compatibility
        // Check signature against each available cert.
        $certs = $this->getCerts($certsLocation, $cacheKey, $options);
        $alg = $this->determineAlg($certs);
        if (!\in_array($alg, ['RS256', 'ES256'])) {
            throw new \InvalidArgumentException('unrecognized "alg" in certs, expected ES256 or RS256');
        }
        try {
            if ($alg == 'RS256') {
                return $this->verifyRs256($token, $certs, $audience, $issuer);
            }
            return $this->verifyEs256($token, $certs, $audience, $issuer);
        } catch (\Google\Site_Kit_Dependencies\Firebase\JWT\ExpiredException $e) {
            // firebase/php-jwt 5+
        } catch (\Google\Site_Kit_Dependencies\Firebase\JWT\SignatureInvalidException $e) {
            // firebase/php-jwt 5+
        } catch (\Google\Site_Kit_Dependencies\SimpleJWT\InvalidTokenException $e) {
            // simplejwt
        } catch (\InvalidArgumentException $e) {
        } catch (\UnexpectedValueException $e) {
        }
        if ($throwException) {
            throw $e;
        }
        return \false;
    }
    /**
     * Identifies the expected algorithm to verify by looking at the "alg" key
     * of the provided certs.
     *
     * @param array<mixed> $certs Certificate array according to the JWK spec (see
     *                     https://tools.ietf.org/html/rfc7517).
     * @return string The expected algorithm, such as "ES256" or "RS256".
     */
    private function determineAlg(array $certs)
    {
        $alg = null;
        foreach ($certs as $cert) {
            if (empty($cert['alg'])) {
                throw new \InvalidArgumentException('certs expects "alg" to be set');
            }
            $alg = $alg ?: $cert['alg'];
            if ($alg != $cert['alg']) {
                throw new \InvalidArgumentException('More than one alg detected in certs');
            }
        }
        return $alg;
    }
    /**
     * Verifies an ES256-signed JWT.
     *
     * @param string $token The JSON Web Token to be verified.
     * @param array<mixed> $certs Certificate array according to the JWK spec (see
     *        https://tools.ietf.org/html/rfc7517).
     * @param string|null $audience If set, returns false if the provided
     *        audience does not match the "aud" claim on the JWT.
     * @param string|null $issuer If set, returns false if the provided
     *        issuer does not match the "iss" claim on the JWT.
     * @return array<mixed> the token payload, if successful, or false if not.
     */
    private function verifyEs256($token, array $certs, $audience = null, $issuer = null)
    {
        $this->checkSimpleJwt();
        $jwkset = new \Google\Site_Kit_Dependencies\SimpleJWT\Keys\KeySet();
        foreach ($certs as $cert) {
            $jwkset->add(\Google\Site_Kit_Dependencies\SimpleJWT\Keys\KeyFactory::create($cert, 'php'));
        }
        // Validate the signature using the key set and ES256 algorithm.
        $jwt = $this->callSimpleJwtDecode([$token, $jwkset, 'ES256']);
        $payload = $jwt->getClaims();
        if ($audience) {
            if (!isset($payload['aud']) || $payload['aud'] != $audience) {
                throw new \UnexpectedValueException('Audience does not match');
            }
        }
        // @see https://cloud.google.com/iap/docs/signed-headers-howto#verifying_the_jwt_payload
        $issuer = $issuer ?: self::IAP_ISSUER;
        if (!isset($payload['iss']) || $payload['iss'] !== $issuer) {
            throw new \UnexpectedValueException('Issuer does not match');
        }
        return $payload;
    }
    /**
     * Verifies an RS256-signed JWT.
     *
     * @param string $token The JSON Web Token to be verified.
     * @param array<mixed> $certs Certificate array according to the JWK spec (see
     *        https://tools.ietf.org/html/rfc7517).
     * @param string|null $audience If set, returns false if the provided
     *        audience does not match the "aud" claim on the JWT.
     * @param string|null $issuer If set, returns false if the provided
     *        issuer does not match the "iss" claim on the JWT.
     * @return array<mixed> the token payload, if successful, or false if not.
     */
    private function verifyRs256($token, array $certs, $audience = null, $issuer = null)
    {
        $this->checkAndInitializePhpsec();
        $keys = [];
        foreach ($certs as $cert) {
            if (empty($cert['kid'])) {
                throw new \InvalidArgumentException('certs expects "kid" to be set');
            }
            if (empty($cert['n']) || empty($cert['e'])) {
                throw new \InvalidArgumentException('RSA certs expects "n" and "e" to be set');
            }
            $publicKey = $this->loadPhpsecPublicKey($cert['n'], $cert['e']);
            // create an array of key IDs to certs for the JWT library
            $keys[$cert['kid']] = new \Google\Site_Kit_Dependencies\Firebase\JWT\Key($publicKey, 'RS256');
        }
        $payload = $this->callJwtStatic('decode', [$token, $keys]);
        if ($audience) {
            if (!\property_exists($payload, 'aud') || $payload->aud != $audience) {
                throw new \UnexpectedValueException('Audience does not match');
            }
        }
        // support HTTP and HTTPS issuers
        // @see https://developers.google.com/identity/sign-in/web/backend-auth
        $issuers = $issuer ? [$issuer] : [self::OAUTH2_ISSUER, self::OAUTH2_ISSUER_HTTPS];
        if (!isset($payload->iss) || !\in_array($payload->iss, $issuers)) {
            throw new \UnexpectedValueException('Issuer does not match');
        }
        return (array) $payload;
    }
    /**
     * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
     * token, if a token isn't provided.
     *
     * @param string|array<mixed> $token The token (access token or a refresh token) that should be revoked.
     * @param array<mixed> $options [optional] Configuration options.
     * @return bool Returns True if the revocation was successful, otherwise False.
     */
    public function revoke($token, array $options = [])
    {
        if (\is_array($token)) {
            if (isset($token['refresh_token'])) {
                $token = $token['refresh_token'];
            } else {
                $token = $token['access_token'];
            }
        }
        $body = \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Utils::streamFor(\http_build_query(['token' => $token]));
        $request = new \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Request('POST', self::OAUTH2_REVOKE_URI, ['Cache-Control' => 'no-store', 'Content-Type' => 'application/x-www-form-urlencoded'], $body);
        $httpHandler = $this->httpHandler;
        $response = $httpHandler($request, $options);
        return $response->getStatusCode() == 200;
    }
    /**
     * Gets federated sign-on certificates to use for verifying identity tokens.
     * Returns certs as array structure, where keys are key ids, and values
     * are PEM encoded certificates.
     *
     * @param string $location The location from which to retrieve certs.
     * @param string $cacheKey The key under which to cache the retrieved certs.
     * @param array<mixed> $options [optional] Configuration options.
     * @return array<mixed>
     * @throws InvalidArgumentException If received certs are in an invalid format.
     */
    private function getCerts($location, $cacheKey, array $options = [])
    {
        $cacheItem = $this->cache->getItem($cacheKey);
        $certs = $cacheItem ? $cacheItem->get() : null;
        $gotNewCerts = \false;
        if (!$certs) {
            $certs = $this->retrieveCertsFromLocation($location, $options);
            $gotNewCerts = \true;
        }
        if (!isset($certs['keys'])) {
            if ($location !== self::IAP_CERT_URL) {
                throw new \InvalidArgumentException('federated sign-on certs expects "keys" to be set');
            }
            throw new \InvalidArgumentException('certs expects "keys" to be set');
        }
        // Push caching off until after verifying certs are in a valid format.
        // Don't want to cache bad data.
        if ($gotNewCerts) {
            $cacheItem->expiresAt(new \DateTime('+1 hour'));
            $cacheItem->set($certs);
            $this->cache->save($cacheItem);
        }
        return $certs['keys'];
    }
    /**
     * Retrieve and cache a certificates file.
     *
     * @param string $url location
     * @param array<mixed> $options [optional] Configuration options.
     * @return array<mixed> certificates
     * @throws InvalidArgumentException If certs could not be retrieved from a local file.
     * @throws RuntimeException If certs could not be retrieved from a remote location.
     */
    private function retrieveCertsFromLocation($url, array $options = [])
    {
        // If we're retrieving a local file, just grab it.
        if (\strpos($url, 'http') !== 0) {
            if (!\file_exists($url)) {
                throw new \InvalidArgumentException(\sprintf('Failed to retrieve verification certificates from path: %s.', $url));
            }
            return \json_decode((string) \file_get_contents($url), \true);
        }
        $httpHandler = $this->httpHandler;
        $response = $httpHandler(new \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Request('GET', $url), $options);
        if ($response->getStatusCode() == 200) {
            return \json_decode((string) $response->getBody(), \true);
        }
        throw new \RuntimeException(\sprintf('Failed to retrieve verification certificates: "%s".', $response->getBody()->getContents()), $response->getStatusCode());
    }
    /**
     * @return void
     */
    private function checkAndInitializePhpsec()
    {
        if (!$this->checkAndInitializePhpsec2() && !$this->checkPhpsec3()) {
            throw new \RuntimeException('Please require phpseclib/phpseclib v2 or v3 to use this utility.');
        }
    }
    private function loadPhpsecPublicKey(string $modulus, string $exponent) : string
    {
        if (\class_exists(\Google\Site_Kit_Dependencies\phpseclib\Crypt\RSA::class) && \class_exists(\Google\Site_Kit_Dependencies\phpseclib\Math\BigInteger::class)) {
            $key = new \Google\Site_Kit_Dependencies\phpseclib\Crypt\RSA();
            $key->loadKey(['n' => new \Google\Site_Kit_Dependencies\phpseclib\Math\BigInteger($this->callJwtStatic('urlsafeB64Decode', [$modulus]), 256), 'e' => new \Google\Site_Kit_Dependencies\phpseclib\Math\BigInteger($this->callJwtStatic('urlsafeB64Decode', [$exponent]), 256)]);
            return $key->getPublicKey();
        }
        $key = \Google\Site_Kit_Dependencies\phpseclib3\Crypt\PublicKeyLoader::load(['n' => new \Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger($this->callJwtStatic('urlsafeB64Decode', [$modulus]), 256), 'e' => new \Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger($this->callJwtStatic('urlsafeB64Decode', [$exponent]), 256)]);
        return $key->toString('PKCS1');
    }
    /**
     * @return bool
     */
    private function checkAndInitializePhpsec2() : bool
    {
        if (!\class_exists('Google\\Site_Kit_Dependencies\\phpseclib\\Crypt\\RSA')) {
            return \false;
        }
        /**
         * phpseclib calls "phpinfo" by default, which requires special
         * whitelisting in the AppEngine VM environment. This function
         * sets constants to bypass the need for phpseclib to check phpinfo
         *
         * @see phpseclib/Math/BigInteger
         * @see https://github.com/GoogleCloudPlatform/getting-started-php/issues/85
         * @codeCoverageIgnore
         */
        if (\filter_var(\getenv('GAE_VM'), \FILTER_VALIDATE_BOOLEAN)) {
            if (!\defined('Google\\Site_Kit_Dependencies\\MATH_BIGINTEGER_OPENSSL_ENABLED')) {
                \define('Google\\Site_Kit_Dependencies\\MATH_BIGINTEGER_OPENSSL_ENABLED', \true);
            }
            if (!\defined('Google\\Site_Kit_Dependencies\\CRYPT_RSA_MODE')) {
                \define('Google\\Site_Kit_Dependencies\\CRYPT_RSA_MODE', \Google\Site_Kit_Dependencies\phpseclib\Crypt\RSA::MODE_OPENSSL);
            }
        }
        return \true;
    }
    /**
     * @return bool
     */
    private function checkPhpsec3() : bool
    {
        return \class_exists('Google\\Site_Kit_Dependencies\\phpseclib3\\Crypt\\RSA');
    }
    /**
     * @return void
     */
    private function checkSimpleJwt()
    {
        // @codeCoverageIgnoreStart
        if (!\class_exists(\Google\Site_Kit_Dependencies\SimpleJWT\JWT::class)) {
            throw new \RuntimeException('Please require kelvinmo/simplejwt ^0.2 to use this utility.');
        }
        // @codeCoverageIgnoreEnd
    }
    /**
     * Provide a hook to mock calls to the JWT static methods.
     *
     * @param string $method
     * @param array<mixed> $args
     * @return mixed
     */
    protected function callJwtStatic($method, array $args = [])
    {
        return \call_user_func_array([\Google\Site_Kit_Dependencies\Firebase\JWT\JWT::class, $method], $args);
        // @phpstan-ignore-line
    }
    /**
     * Provide a hook to mock calls to the JWT static methods.
     *
     * @param array<mixed> $args
     * @return mixed
     */
    protected function callSimpleJwtDecode(array $args = [])
    {
        return \call_user_func_array([\Google\Site_Kit_Dependencies\SimpleJWT\JWT::class, 'decode'], $args);
    }
    /**
     * Generate a cache key based on the cert location using sha1 with the
     * exception of using "federated_signon_certs_v3" to preserve BC.
     *
     * @param string $certsLocation
     * @return string
     */
    private function getCacheKeyFromCertLocation($certsLocation)
    {
        $key = $certsLocation === self::FEDERATED_SIGNON_CERT_URL ? 'federated_signon_certs_v3' : \sha1($certsLocation);
        return 'google_auth_certs_cache|' . $key;
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

use DomainException;
use Google\Site_Kit_Dependencies\Google\Auth\Credentials\AppIdentityCredentials;
use Google\Site_Kit_Dependencies\Google\Auth\Credentials\GCECredentials;
use Google\Site_Kit_Dependencies\Google\Auth\Credentials\ServiceAccountCredentials;
use Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache;
use Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory;
use Google\Site_Kit_Dependencies\Google\Auth\Middleware\AuthTokenMiddleware;
use Google\Site_Kit_Dependencies\Google\Auth\Middleware\ProxyAuthTokenMiddleware;
use Google\Site_Kit_Dependencies\Google\Auth\Subscriber\AuthTokenSubscriber;
use Google\Site_Kit_Dependencies\GuzzleHttp\Client;
use InvalidArgumentException;
use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface;
/**
 * ApplicationDefaultCredentials obtains the default credentials for
 * authorizing a request to a Google service.
 *
 * Application Default Credentials are described here:
 * https://developers.google.com/accounts/docs/application-default-credentials
 *
 * This class implements the search for the application default credentials as
 * described in the link.
 *
 * It provides three factory methods:
 * - #get returns the computed credentials object
 * - #getSubscriber returns an AuthTokenSubscriber built from the credentials object
 * - #getMiddleware returns an AuthTokenMiddleware built from the credentials object
 *
 * This allows it to be used as follows with GuzzleHttp\Client:
 *
 * ```
 * use Google\Auth\ApplicationDefaultCredentials;
 * use GuzzleHttp\Client;
 * use GuzzleHttp\HandlerStack;
 *
 * $middleware = ApplicationDefaultCredentials::getMiddleware(
 *     'https://www.googleapis.com/auth/taskqueue'
 * );
 * $stack = HandlerStack::create();
 * $stack->push($middleware);
 *
 * $client = new Client([
 *     'handler' => $stack,
 *     'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
 *     'auth' => 'google_auth' // authorize all requests
 * ]);
 *
 * $res = $client->get('myproject/taskqueues/myqueue');
 * ```
 */
class ApplicationDefaultCredentials
{
    /**
     * @deprecated
     *
     * Obtains an AuthTokenSubscriber that uses the default FetchAuthTokenInterface
     * implementation to use in this environment.
     *
     * If supplied, $scope is used to in creating the credentials instance if
     * this does not fallback to the compute engine defaults.
     *
     * @param string|string[] $scope the scope of the access request, expressed
     *        either as an Array or as a space-delimited String.
     * @param callable $httpHandler callback which delivers psr7 request
     * @param array<mixed> $cacheConfig configuration for the cache when it's present
     * @param CacheItemPoolInterface $cache A cache implementation, may be
     *        provided if you have one already available for use.
     * @return AuthTokenSubscriber
     * @throws DomainException if no implementation can be obtained.
     */
    public static function getSubscriber(
        // @phpstan-ignore-line
        $scope = null,
        callable $httpHandler = null,
        array $cacheConfig = null,
        \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface $cache = null
    )
    {
        $creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache);
        /** @phpstan-ignore-next-line */
        return new \Google\Site_Kit_Dependencies\Google\Auth\Subscriber\AuthTokenSubscriber($creds, $httpHandler);
    }
    /**
     * Obtains an AuthTokenMiddleware that uses the default FetchAuthTokenInterface
     * implementation to use in this environment.
     *
     * If supplied, $scope is used to in creating the credentials instance if
     * this does not fallback to the compute engine defaults.
     *
     * @param string|string[] $scope the scope of the access request, expressed
     *        either as an Array or as a space-delimited String.
     * @param callable $httpHandler callback which delivers psr7 request
     * @param array<mixed> $cacheConfig configuration for the cache when it's present
     * @param CacheItemPoolInterface $cache A cache implementation, may be
     *        provided if you have one already available for use.
     * @param string $quotaProject specifies a project to bill for access
     *   charges associated with the request.
     * @return AuthTokenMiddleware
     * @throws DomainException if no implementation can be obtained.
     */
    public static function getMiddleware($scope = null, callable $httpHandler = null, array $cacheConfig = null, \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface $cache = null, $quotaProject = null)
    {
        $creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache, $quotaProject);
        return new \Google\Site_Kit_Dependencies\Google\Auth\Middleware\AuthTokenMiddleware($creds, $httpHandler);
    }
    /**
     * Obtains the default FetchAuthTokenInterface implementation to use
     * in this environment.
     *
     * @param string|string[] $scope the scope of the access request, expressed
     *        either as an Array or as a space-delimited String.
     * @param callable $httpHandler callback which delivers psr7 request
     * @param array<mixed> $cacheConfig configuration for the cache when it's present
     * @param CacheItemPoolInterface $cache A cache implementation, may be
     *        provided if you have one already available for use.
     * @param string $quotaProject specifies a project to bill for access
     *   charges associated with the request.
     * @param string|string[] $defaultScope The default scope to use if no
     *   user-defined scopes exist, expressed either as an Array or as a
     *   space-delimited string.
     *
     * @return FetchAuthTokenInterface
     * @throws DomainException if no implementation can be obtained.
     */
    public static function getCredentials($scope = null, callable $httpHandler = null, array $cacheConfig = null, \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface $cache = null, $quotaProject = null, $defaultScope = null)
    {
        $creds = null;
        $jsonKey = \Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader::fromEnv() ?: \Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader::fromWellKnownFile();
        $anyScope = $scope ?: $defaultScope;
        if (!$httpHandler) {
            if (!($client = \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache::getHttpClient())) {
                $client = new \Google\Site_Kit_Dependencies\GuzzleHttp\Client();
                \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache::setHttpClient($client);
            }
            $httpHandler = \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory::build($client);
        }
        if (!\is_null($jsonKey)) {
            if ($quotaProject) {
                $jsonKey['quota_project_id'] = $quotaProject;
            }
            $creds = \Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader::makeCredentials($scope, $jsonKey, $defaultScope);
        } elseif (\Google\Site_Kit_Dependencies\Google\Auth\Credentials\AppIdentityCredentials::onAppEngine() && !\Google\Site_Kit_Dependencies\Google\Auth\Credentials\GCECredentials::onAppEngineFlexible()) {
            $creds = new \Google\Site_Kit_Dependencies\Google\Auth\Credentials\AppIdentityCredentials($anyScope);
        } elseif (self::onGce($httpHandler, $cacheConfig, $cache)) {
            $creds = new \Google\Site_Kit_Dependencies\Google\Auth\Credentials\GCECredentials(null, $anyScope, null, $quotaProject);
            $creds->setIsOnGce(\true);
            // save the credentials a trip to the metadata server
        }
        if (\is_null($creds)) {
            throw new \DomainException(self::notFound());
        }
        if (!\is_null($cache)) {
            $creds = new \Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenCache($creds, $cacheConfig, $cache);
        }
        return $creds;
    }
    /**
     * Obtains an AuthTokenMiddleware which will fetch an ID token to use in the
     * Authorization header. The middleware is configured with the default
     * FetchAuthTokenInterface implementation to use in this environment.
     *
     * If supplied, $targetAudience is used to set the "aud" on the resulting
     * ID token.
     *
     * @param string $targetAudience The audience for the ID token.
     * @param callable $httpHandler callback which delivers psr7 request
     * @param array<mixed> $cacheConfig configuration for the cache when it's present
     * @param CacheItemPoolInterface $cache A cache implementation, may be
     *        provided if you have one already available for use.
     * @return AuthTokenMiddleware
     * @throws DomainException if no implementation can be obtained.
     */
    public static function getIdTokenMiddleware($targetAudience, callable $httpHandler = null, array $cacheConfig = null, \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface $cache = null)
    {
        $creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache);
        return new \Google\Site_Kit_Dependencies\Google\Auth\Middleware\AuthTokenMiddleware($creds, $httpHandler);
    }
    /**
     * Obtains an ProxyAuthTokenMiddleware which will fetch an ID token to use in the
     * Authorization header. The middleware is configured with the default
     * FetchAuthTokenInterface implementation to use in this environment.
     *
     * If supplied, $targetAudience is used to set the "aud" on the resulting
     * ID token.
     *
     * @param string $targetAudience The audience for the ID token.
     * @param callable $httpHandler callback which delivers psr7 request
     * @param array<mixed> $cacheConfig configuration for the cache when it's present
     * @param CacheItemPoolInterface $cache A cache implementation, may be
     *        provided if you have one already available for use.
     * @return ProxyAuthTokenMiddleware
     * @throws DomainException if no implementation can be obtained.
     */
    public static function getProxyIdTokenMiddleware($targetAudience, callable $httpHandler = null, array $cacheConfig = null, \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface $cache = null)
    {
        $creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache);
        return new \Google\Site_Kit_Dependencies\Google\Auth\Middleware\ProxyAuthTokenMiddleware($creds, $httpHandler);
    }
    /**
     * Obtains the default FetchAuthTokenInterface implementation to use
     * in this environment, configured with a $targetAudience for fetching an ID
     * token.
     *
     * @param string $targetAudience The audience for the ID token.
     * @param callable $httpHandler callback which delivers psr7 request
     * @param array<mixed> $cacheConfig configuration for the cache when it's present
     * @param CacheItemPoolInterface $cache A cache implementation, may be
     *        provided if you have one already available for use.
     * @return FetchAuthTokenInterface
     * @throws DomainException if no implementation can be obtained.
     * @throws InvalidArgumentException if JSON "type" key is invalid
     */
    public static function getIdTokenCredentials($targetAudience, callable $httpHandler = null, array $cacheConfig = null, \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface $cache = null)
    {
        $creds = null;
        $jsonKey = \Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader::fromEnv() ?: \Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader::fromWellKnownFile();
        if (!$httpHandler) {
            if (!($client = \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache::getHttpClient())) {
                $client = new \Google\Site_Kit_Dependencies\GuzzleHttp\Client();
                \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache::setHttpClient($client);
            }
            $httpHandler = \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory::build($client);
        }
        if (!\is_null($jsonKey)) {
            if (!\array_key_exists('type', $jsonKey)) {
                throw new \InvalidArgumentException('json key is missing the type field');
            }
            if ($jsonKey['type'] == 'authorized_user') {
                throw new \InvalidArgumentException('ID tokens are not supported for end user credentials');
            }
            if ($jsonKey['type'] != 'service_account') {
                throw new \InvalidArgumentException('invalid value in the type field');
            }
            $creds = new \Google\Site_Kit_Dependencies\Google\Auth\Credentials\ServiceAccountCredentials(null, $jsonKey, null, $targetAudience);
        } elseif (self::onGce($httpHandler, $cacheConfig, $cache)) {
            $creds = new \Google\Site_Kit_Dependencies\Google\Auth\Credentials\GCECredentials(null, null, $targetAudience);
            $creds->setIsOnGce(\true);
            // save the credentials a trip to the metadata server
        }
        if (\is_null($creds)) {
            throw new \DomainException(self::notFound());
        }
        if (!\is_null($cache)) {
            $creds = new \Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenCache($creds, $cacheConfig, $cache);
        }
        return $creds;
    }
    /**
     * @return string
     */
    private static function notFound()
    {
        $msg = 'Your default credentials were not found. To set up ';
        $msg .= 'Application Default Credentials, see ';
        $msg .= 'https://cloud.google.com/docs/authentication/external/set-up-adc';
        return $msg;
    }
    /**
     * @param callable $httpHandler
     * @param array<mixed> $cacheConfig
     * @param CacheItemPoolInterface $cache
     * @return bool
     */
    private static function onGce(callable $httpHandler = null, array $cacheConfig = null, \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface $cache = null)
    {
        $gceCacheConfig = [];
        foreach (['lifetime', 'prefix'] as $key) {
            if (isset($cacheConfig['gce_' . $key])) {
                $gceCacheConfig[$key] = $cacheConfig['gce_' . $key];
            }
        }
        return (new \Google\Site_Kit_Dependencies\Google\Auth\GCECache($gceCacheConfig, $cache))->onGce($httpHandler);
    }
}
<?php

/*
 * Copyright 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Cache;

use Google\Site_Kit_Dependencies\Psr\Cache\InvalidArgumentException as PsrInvalidArgumentException;
class InvalidArgumentException extends \InvalidArgumentException implements \Google\Site_Kit_Dependencies\Psr\Cache\InvalidArgumentException
{
}
<?php

/**
 * Copyright 2018 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Cache;

use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemInterface;
use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface;
/**
 * SystemV shared memory based CacheItemPool implementation.
 *
 * This CacheItemPool implementation can be used among multiple processes, but
 * it doesn't provide any locking mechanism. If multiple processes write to
 * this ItemPool, you have to avoid race condition manually in your code.
 */
class SysVCacheItemPool implements \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface
{
    const VAR_KEY = 1;
    const DEFAULT_PROJ = 'A';
    const DEFAULT_MEMSIZE = 10000;
    const DEFAULT_PERM = 0600;
    /**
     * @var int
     */
    private $sysvKey;
    /**
     * @var CacheItemInterface[]
     */
    private $items;
    /**
     * @var CacheItemInterface[]
     */
    private $deferredItems;
    /**
     * @var array<mixed>
     */
    private $options;
    /**
     * @var bool
     */
    private $hasLoadedItems = \false;
    /**
     * Create a SystemV shared memory based CacheItemPool.
     *
     * @param array<mixed> $options {
     *     [optional] Configuration options.
     *
     *     @type int    $variableKey The variable key for getting the data from the shared memory. **Defaults to** 1.
     *     @type string $proj        The project identifier for ftok. This needs to be a one character string.
     *                               **Defaults to** 'A'.
     *     @type int    $memsize     The memory size in bytes for shm_attach. **Defaults to** 10000.
     *     @type int    $perm        The permission for shm_attach. **Defaults to** 0600.
     * }
     */
    public function __construct($options = [])
    {
        if (!\extension_loaded('sysvshm')) {
            throw new \RuntimeException('sysvshm extension is required to use this ItemPool');
        }
        $this->options = $options + ['variableKey' => self::VAR_KEY, 'proj' => self::DEFAULT_PROJ, 'memsize' => self::DEFAULT_MEMSIZE, 'perm' => self::DEFAULT_PERM];
        $this->items = [];
        $this->deferredItems = [];
        $this->sysvKey = \ftok(__FILE__, $this->options['proj']);
    }
    /**
     * @param mixed $key
     * @return CacheItemInterface
     */
    public function getItem($key) : \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemInterface
    {
        $this->loadItems();
        return \current($this->getItems([$key]));
        // @phpstan-ignore-line
    }
    /**
     * @param array<mixed> $keys
     * @return iterable<CacheItemInterface>
     */
    public function getItems(array $keys = []) : iterable
    {
        $this->loadItems();
        $items = [];
        $itemClass = \PHP_VERSION_ID >= 80000 ? \Google\Site_Kit_Dependencies\Google\Auth\Cache\TypedItem::class : \Google\Site_Kit_Dependencies\Google\Auth\Cache\Item::class;
        foreach ($keys as $key) {
            $items[$key] = $this->hasItem($key) ? clone $this->items[$key] : new $itemClass($key);
        }
        return $items;
    }
    /**
     * {@inheritdoc}
     */
    public function hasItem($key) : bool
    {
        $this->loadItems();
        return isset($this->items[$key]) && $this->items[$key]->isHit();
    }
    /**
     * {@inheritdoc}
     */
    public function clear() : bool
    {
        $this->items = [];
        $this->deferredItems = [];
        return $this->saveCurrentItems();
    }
    /**
     * {@inheritdoc}
     */
    public function deleteItem($key) : bool
    {
        return $this->deleteItems([$key]);
    }
    /**
     * {@inheritdoc}
     */
    public function deleteItems(array $keys) : bool
    {
        if (!$this->hasLoadedItems) {
            $this->loadItems();
        }
        foreach ($keys as $key) {
            unset($this->items[$key]);
        }
        return $this->saveCurrentItems();
    }
    /**
     * {@inheritdoc}
     */
    public function save(\Google\Site_Kit_Dependencies\Psr\Cache\CacheItemInterface $item) : bool
    {
        if (!$this->hasLoadedItems) {
            $this->loadItems();
        }
        $this->items[$item->getKey()] = $item;
        return $this->saveCurrentItems();
    }
    /**
     * {@inheritdoc}
     */
    public function saveDeferred(\Google\Site_Kit_Dependencies\Psr\Cache\CacheItemInterface $item) : bool
    {
        $this->deferredItems[$item->getKey()] = $item;
        return \true;
    }
    /**
     * {@inheritdoc}
     */
    public function commit() : bool
    {
        foreach ($this->deferredItems as $item) {
            if ($this->save($item) === \false) {
                return \false;
            }
        }
        $this->deferredItems = [];
        return \true;
    }
    /**
     * Save the current items.
     *
     * @return bool true when success, false upon failure
     */
    private function saveCurrentItems()
    {
        $shmid = \shm_attach($this->sysvKey, $this->options['memsize'], $this->options['perm']);
        if ($shmid !== \false) {
            $ret = \shm_put_var($shmid, $this->options['variableKey'], $this->items);
            \shm_detach($shmid);
            return $ret;
        }
        return \false;
    }
    /**
     * Load the items from the shared memory.
     *
     * @return bool true when success, false upon failure
     */
    private function loadItems()
    {
        $shmid = \shm_attach($this->sysvKey, $this->options['memsize'], $this->options['perm']);
        if ($shmid !== \false) {
            $data = @\shm_get_var($shmid, $this->options['variableKey']);
            if (!empty($data)) {
                $this->items = $data;
            } else {
                $this->items = [];
            }
            \shm_detach($shmid);
            $this->hasLoadedItems = \true;
            return \true;
        }
        return \false;
    }
}
<?php

/*
 * Copyright 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Cache;

use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemInterface;
use TypeError;
/**
 * A cache item.
 *
 * This class will be used by MemoryCacheItemPool and SysVCacheItemPool
 * on PHP 7.4 and below. It is compatible with psr/cache 1.0 and 2.0 (PSR-6).
 * @see TypedItem for compatiblity with psr/cache 3.0.
 */
final class Item implements \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemInterface
{
    /**
     * @var string
     */
    private $key;
    /**
     * @var mixed
     */
    private $value;
    /**
     * @var DateTimeInterface|null
     */
    private $expiration;
    /**
     * @var bool
     */
    private $isHit = \false;
    /**
     * @param string $key
     */
    public function __construct($key)
    {
        $this->key = $key;
    }
    /**
     * {@inheritdoc}
     */
    public function getKey()
    {
        return $this->key;
    }
    /**
     * {@inheritdoc}
     */
    public function get()
    {
        return $this->isHit() ? $this->value : null;
    }
    /**
     * {@inheritdoc}
     */
    public function isHit()
    {
        if (!$this->isHit) {
            return \false;
        }
        if ($this->expiration === null) {
            return \true;
        }
        return $this->currentTime()->getTimestamp() < $this->expiration->getTimestamp();
    }
    /**
     * {@inheritdoc}
     */
    public function set($value)
    {
        $this->isHit = \true;
        $this->value = $value;
        return $this;
    }
    /**
     * {@inheritdoc}
     */
    public function expiresAt($expiration)
    {
        if ($this->isValidExpiration($expiration)) {
            $this->expiration = $expiration;
            return $this;
        }
        $error = \sprintf('Argument 1 passed to %s::expiresAt() must implement interface DateTimeInterface, %s given', \get_class($this), \gettype($expiration));
        throw new \TypeError($error);
    }
    /**
     * {@inheritdoc}
     */
    public function expiresAfter($time)
    {
        if (\is_int($time)) {
            $this->expiration = $this->currentTime()->add(new \DateInterval("PT{$time}S"));
        } elseif ($time instanceof \DateInterval) {
            $this->expiration = $this->currentTime()->add($time);
        } elseif ($time === null) {
            $this->expiration = $time;
        } else {
            $message = 'Argument 1 passed to %s::expiresAfter() must be an ' . 'instance of DateInterval or of the type integer, %s given';
            $error = \sprintf($message, \get_class($this), \gettype($time));
            throw new \TypeError($error);
        }
        return $this;
    }
    /**
     * Determines if an expiration is valid based on the rules defined by PSR6.
     *
     * @param mixed $expiration
     * @return bool
     */
    private function isValidExpiration($expiration)
    {
        if ($expiration === null) {
            return \true;
        }
        if ($expiration instanceof \DateTimeInterface) {
            return \true;
        }
        return \false;
    }
    /**
     * @return DateTime
     */
    protected function currentTime()
    {
        return new \DateTime('now', new \DateTimeZone('UTC'));
    }
}
<?php

/*
 * Copyright 2022 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Cache;

use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemInterface;
/**
 * A cache item.
 *
 * This class will be used by MemoryCacheItemPool and SysVCacheItemPool
 * on PHP 8.0 and above. It is compatible with psr/cache 3.0 (PSR-6).
 * @see Item for compatiblity with previous versions of PHP.
 */
final class TypedItem implements \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemInterface
{
    /**
     * @var mixed
     */
    private mixed $value;
    /**
     * @var \DateTimeInterface|null
     */
    private ?\DateTimeInterface $expiration;
    /**
     * @var bool
     */
    private bool $isHit = \false;
    /**
     * @param string $key
     */
    public function __construct(private string $key)
    {
        $this->key = $key;
        $this->expiration = null;
    }
    /**
     * {@inheritdoc}
     */
    public function getKey() : string
    {
        return $this->key;
    }
    /**
     * {@inheritdoc}
     */
    public function get() : mixed
    {
        return $this->isHit() ? $this->value : null;
    }
    /**
     * {@inheritdoc}
     */
    public function isHit() : bool
    {
        if (!$this->isHit) {
            return \false;
        }
        if ($this->expiration === null) {
            return \true;
        }
        return $this->currentTime()->getTimestamp() < $this->expiration->getTimestamp();
    }
    /**
     * {@inheritdoc}
     */
    public function set(mixed $value) : static
    {
        $this->isHit = \true;
        $this->value = $value;
        return $this;
    }
    /**
     * {@inheritdoc}
     */
    public function expiresAt($expiration) : static
    {
        if ($this->isValidExpiration($expiration)) {
            $this->expiration = $expiration;
            return $this;
        }
        $error = \sprintf('Argument 1 passed to %s::expiresAt() must implement interface DateTimeInterface, %s given', \get_class($this), \gettype($expiration));
        throw new \TypeError($error);
    }
    /**
     * {@inheritdoc}
     */
    public function expiresAfter($time) : static
    {
        if (\is_int($time)) {
            $this->expiration = $this->currentTime()->add(new \DateInterval("PT{$time}S"));
        } elseif ($time instanceof \DateInterval) {
            $this->expiration = $this->currentTime()->add($time);
        } elseif ($time === null) {
            $this->expiration = $time;
        } else {
            $message = 'Argument 1 passed to %s::expiresAfter() must be an ' . 'instance of DateInterval or of the type integer, %s given';
            $error = \sprintf($message, \get_class($this), \gettype($time));
            throw new \TypeError($error);
        }
        return $this;
    }
    /**
     * Determines if an expiration is valid based on the rules defined by PSR6.
     *
     * @param mixed $expiration
     * @return bool
     */
    private function isValidExpiration($expiration)
    {
        if ($expiration === null) {
            return \true;
        }
        // We test for two types here due to the fact the DateTimeInterface
        // was not introduced until PHP 5.5. Checking for the DateTime type as
        // well allows us to support 5.4.
        if ($expiration instanceof \DateTimeInterface) {
            return \true;
        }
        return \false;
    }
    /**
     * @return \DateTime
     */
    protected function currentTime()
    {
        return new \DateTime('now', new \DateTimeZone('UTC'));
    }
}
<?php

/*
 * Copyright 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Cache;

use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemInterface;
use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface;
/**
 * Simple in-memory cache implementation.
 */
final class MemoryCacheItemPool implements \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface
{
    /**
     * @var CacheItemInterface[]
     */
    private $items;
    /**
     * @var CacheItemInterface[]
     */
    private $deferredItems;
    /**
     * {@inheritdoc}
     *
     * @return CacheItemInterface The corresponding Cache Item.
     */
    public function getItem($key) : \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemInterface
    {
        return \current($this->getItems([$key]));
        // @phpstan-ignore-line
    }
    /**
     * {@inheritdoc}
     *
     * @return iterable<CacheItemInterface>
     *   A traversable collection of Cache Items keyed by the cache keys of
     *   each item. A Cache item will be returned for each key, even if that
     *   key is not found. However, if no keys are specified then an empty
     *   traversable MUST be returned instead.
     */
    public function getItems(array $keys = []) : iterable
    {
        $items = [];
        $itemClass = \PHP_VERSION_ID >= 80000 ? \Google\Site_Kit_Dependencies\Google\Auth\Cache\TypedItem::class : \Google\Site_Kit_Dependencies\Google\Auth\Cache\Item::class;
        foreach ($keys as $key) {
            $items[$key] = $this->hasItem($key) ? clone $this->items[$key] : new $itemClass($key);
        }
        return $items;
    }
    /**
     * {@inheritdoc}
     *
     * @return bool
     *   True if item exists in the cache, false otherwise.
     */
    public function hasItem($key) : bool
    {
        $this->isValidKey($key);
        return isset($this->items[$key]) && $this->items[$key]->isHit();
    }
    /**
     * {@inheritdoc}
     *
     * @return bool
     *   True if the pool was successfully cleared. False if there was an error.
     */
    public function clear() : bool
    {
        $this->items = [];
        $this->deferredItems = [];
        return \true;
    }
    /**
     * {@inheritdoc}
     *
     * @return bool
     *   True if the item was successfully removed. False if there was an error.
     */
    public function deleteItem($key) : bool
    {
        return $this->deleteItems([$key]);
    }
    /**
     * {@inheritdoc}
     *
     * @return bool
     *   True if the items were successfully removed. False if there was an error.
     */
    public function deleteItems(array $keys) : bool
    {
        \array_walk($keys, [$this, 'isValidKey']);
        foreach ($keys as $key) {
            unset($this->items[$key]);
        }
        return \true;
    }
    /**
     * {@inheritdoc}
     *
     * @return bool
     *   True if the item was successfully persisted. False if there was an error.
     */
    public function save(\Google\Site_Kit_Dependencies\Psr\Cache\CacheItemInterface $item) : bool
    {
        $this->items[$item->getKey()] = $item;
        return \true;
    }
    /**
     * {@inheritdoc}
     *
     * @return bool
     *   False if the item could not be queued or if a commit was attempted and failed. True otherwise.
     */
    public function saveDeferred(\Google\Site_Kit_Dependencies\Psr\Cache\CacheItemInterface $item) : bool
    {
        $this->deferredItems[$item->getKey()] = $item;
        return \true;
    }
    /**
     * {@inheritdoc}
     *
     * @return bool
     *   True if all not-yet-saved items were successfully saved or there were none. False otherwise.
     */
    public function commit() : bool
    {
        foreach ($this->deferredItems as $item) {
            $this->save($item);
        }
        $this->deferredItems = [];
        return \true;
    }
    /**
     * Determines if the provided key is valid.
     *
     * @param string $key
     * @return bool
     * @throws InvalidArgumentException
     */
    private function isValidKey($key)
    {
        $invalidCharacters = '{}()/\\\\@:';
        if (!\is_string($key) || \preg_match("#[{$invalidCharacters}]#", $key)) {
            throw new \Google\Site_Kit_Dependencies\Google\Auth\Cache\InvalidArgumentException('The provided key is not valid: ' . \var_export($key, \true));
        }
        return \true;
    }
}
<?php

/*
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

/**
 * Describes a class which supports signing arbitrary strings.
 */
interface SignBlobInterface extends \Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface
{
    /**
     * Sign a string using the method which is best for a given credentials type.
     *
     * @param string $stringToSign The string to sign.
     * @param bool $forceOpenssl Require use of OpenSSL for local signing. Does
     *        not apply to signing done using external services. **Defaults to**
     *        `false`.
     * @return string The resulting signature. Value should be base64-encoded.
     */
    public function signBlob($stringToSign, $forceOpenssl = \false);
    /**
     * Returns the current Client Name.
     *
     * @param callable $httpHandler callback which delivers psr7 request, if
     *     one is required to obtain a client name.
     * @return string
     */
    public function getClientName(callable $httpHandler = null);
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Subscriber;

use Google\Site_Kit_Dependencies\GuzzleHttp\Event\BeforeEvent;
use Google\Site_Kit_Dependencies\GuzzleHttp\Event\RequestEvents;
use Google\Site_Kit_Dependencies\GuzzleHttp\Event\SubscriberInterface;
/**
 * SimpleSubscriber is a Guzzle Subscriber that implements Google's Simple API
 * access.
 *
 * Requests are accessed using the Simple API access developer key.
 */
class SimpleSubscriber implements \Google\Site_Kit_Dependencies\GuzzleHttp\Event\SubscriberInterface
{
    /**
     * @var array
     */
    private $config;
    /**
     * Create a new Simple plugin.
     *
     * The configuration array expects one option
     * - key: required, otherwise InvalidArgumentException is thrown
     *
     * @param array $config Configuration array
     */
    public function __construct(array $config)
    {
        if (!isset($config['key'])) {
            throw new \InvalidArgumentException('requires a key to have been set');
        }
        $this->config = \array_merge([], $config);
    }
    /**
     * @return array
     */
    public function getEvents()
    {
        return ['before' => ['onBefore', \Google\Site_Kit_Dependencies\GuzzleHttp\Event\RequestEvents::SIGN_REQUEST]];
    }
    /**
     * Updates the request query with the developer key if auth is set to simple.
     *
     * Example:
     * ```
     * use Google\Auth\Subscriber\SimpleSubscriber;
     * use GuzzleHttp\Client;
     *
     * $my_key = 'is not the same as yours';
     * $subscriber = new SimpleSubscriber(['key' => $my_key]);
     *
     * $client = new Client([
     *     'base_url' => 'https://www.googleapis.com/discovery/v1/',
     *     'defaults' => ['auth' => 'simple']
     * ]);
     * $client->getEmitter()->attach($subscriber);
     *
     * $res = $client->get('drive/v2/rest');
     * ```
     *
     * @param BeforeEvent $event
     */
    public function onBefore(\Google\Site_Kit_Dependencies\GuzzleHttp\Event\BeforeEvent $event)
    {
        // Requests using "auth"="simple" with the developer key.
        $request = $event->getRequest();
        if ($request->getConfig()['auth'] != 'simple') {
            return;
        }
        $request->getQuery()->overwriteWith($this->config);
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Subscriber;

use Google\Site_Kit_Dependencies\Google\Auth\CacheTrait;
use Google\Site_Kit_Dependencies\GuzzleHttp\Event\BeforeEvent;
use Google\Site_Kit_Dependencies\GuzzleHttp\Event\RequestEvents;
use Google\Site_Kit_Dependencies\GuzzleHttp\Event\SubscriberInterface;
use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface;
/**
 * ScopedAccessTokenSubscriber is a Guzzle Subscriber that adds an Authorization
 * header provided by a closure.
 *
 * The closure returns an access token, taking the scope, either a single
 * string or an array of strings, as its value.  If provided, a cache will be
 * used to preserve the access token for a given lifetime.
 *
 * Requests will be accessed with the authorization header:
 *
 * 'authorization' 'Bearer <access token obtained from the closure>'
 */
class ScopedAccessTokenSubscriber implements \Google\Site_Kit_Dependencies\GuzzleHttp\Event\SubscriberInterface
{
    use CacheTrait;
    const DEFAULT_CACHE_LIFETIME = 1500;
    /**
     * @var CacheItemPoolInterface
     */
    private $cache;
    /**
     * @var callable The access token generator function
     */
    private $tokenFunc;
    /**
     * @var array|string The scopes used to generate the token
     */
    private $scopes;
    /**
     * @var array
     */
    private $cacheConfig;
    /**
     * Creates a new ScopedAccessTokenSubscriber.
     *
     * @param callable $tokenFunc a token generator function
     * @param array|string $scopes the token authentication scopes
     * @param array $cacheConfig configuration for the cache when it's present
     * @param CacheItemPoolInterface $cache an implementation of CacheItemPoolInterface
     */
    public function __construct(callable $tokenFunc, $scopes, array $cacheConfig = null, \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface $cache = null)
    {
        $this->tokenFunc = $tokenFunc;
        if (!(\is_string($scopes) || \is_array($scopes))) {
            throw new \InvalidArgumentException('wants scope should be string or array');
        }
        $this->scopes = $scopes;
        if (!\is_null($cache)) {
            $this->cache = $cache;
            $this->cacheConfig = \array_merge(['lifetime' => self::DEFAULT_CACHE_LIFETIME, 'prefix' => ''], $cacheConfig);
        }
    }
    /**
     * @return array
     */
    public function getEvents()
    {
        return ['before' => ['onBefore', \Google\Site_Kit_Dependencies\GuzzleHttp\Event\RequestEvents::SIGN_REQUEST]];
    }
    /**
     * Updates the request with an Authorization header when auth is 'scoped'.
     *
     * E.g this could be used to authenticate using the AppEngine AppIdentityService.
     *
     * Example:
     * ```
     * use google\appengine\api\app_identity\AppIdentityService;
     * use Google\Auth\Subscriber\ScopedAccessTokenSubscriber;
     * use GuzzleHttp\Client;
     *
     * $scope = 'https://www.googleapis.com/auth/taskqueue'
     * $subscriber = new ScopedAccessToken(
     *     'AppIdentityService::getAccessToken',
     *     $scope,
     *     ['prefix' => 'Google\Auth\ScopedAccessToken::'],
     *     $cache = new Memcache()
     * );
     *
     * $client = new Client([
     *     'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
     *     'defaults' => ['auth' => 'scoped']
     * ]);
     * $client->getEmitter()->attach($subscriber);
     *
     * $res = $client->get('myproject/taskqueues/myqueue');
     * ```
     *
     * @param BeforeEvent $event
     */
    public function onBefore(\Google\Site_Kit_Dependencies\GuzzleHttp\Event\BeforeEvent $event)
    {
        // Requests using "auth"="scoped" will be authorized.
        $request = $event->getRequest();
        if ($request->getConfig()['auth'] != 'scoped') {
            return;
        }
        $auth_header = 'Bearer ' . $this->fetchToken();
        $request->setHeader('authorization', $auth_header);
    }
    /**
     * @return string
     */
    private function getCacheKey()
    {
        $key = null;
        if (\is_string($this->scopes)) {
            $key .= $this->scopes;
        } elseif (\is_array($this->scopes)) {
            $key .= \implode(':', $this->scopes);
        }
        return $key;
    }
    /**
     * Determine if token is available in the cache, if not call tokenFunc to
     * fetch it.
     *
     * @return string
     */
    private function fetchToken()
    {
        $cacheKey = $this->getCacheKey();
        $cached = $this->getCachedValue($cacheKey);
        if (!empty($cached)) {
            return $cached;
        }
        $token = \call_user_func($this->tokenFunc, $this->scopes);
        $this->setCachedValue($cacheKey, $token);
        return $token;
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Subscriber;

use Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface;
use Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface;
use Google\Site_Kit_Dependencies\GuzzleHttp\Event\BeforeEvent;
use Google\Site_Kit_Dependencies\GuzzleHttp\Event\RequestEvents;
use Google\Site_Kit_Dependencies\GuzzleHttp\Event\SubscriberInterface;
/**
 * AuthTokenSubscriber is a Guzzle Subscriber that adds an Authorization header
 * provided by an object implementing FetchAuthTokenInterface.
 *
 * The FetchAuthTokenInterface#fetchAuthToken is used to obtain a hash; one of
 * the values value in that hash is added as the authorization header.
 *
 * Requests will be accessed with the authorization header:
 *
 * 'authorization' 'Bearer <value of auth_token>'
 */
class AuthTokenSubscriber implements \Google\Site_Kit_Dependencies\GuzzleHttp\Event\SubscriberInterface
{
    /**
     * @var callable
     */
    private $httpHandler;
    /**
     * @var FetchAuthTokenInterface
     */
    private $fetcher;
    /**
     * @var callable
     */
    private $tokenCallback;
    /**
     * Creates a new AuthTokenSubscriber.
     *
     * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token
     * @param callable $httpHandler (optional) http client to fetch the token.
     * @param callable $tokenCallback (optional) function to be called when a new token is fetched.
     */
    public function __construct(\Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface $fetcher, callable $httpHandler = null, callable $tokenCallback = null)
    {
        $this->fetcher = $fetcher;
        $this->httpHandler = $httpHandler;
        $this->tokenCallback = $tokenCallback;
    }
    /**
     * @return array
     */
    public function getEvents()
    {
        return ['before' => ['onBefore', \Google\Site_Kit_Dependencies\GuzzleHttp\Event\RequestEvents::SIGN_REQUEST]];
    }
    /**
     * Updates the request with an Authorization header when auth is 'fetched_auth_token'.
     *
     * Example:
     * ```
     * use GuzzleHttp\Client;
     * use Google\Auth\OAuth2;
     * use Google\Auth\Subscriber\AuthTokenSubscriber;
     *
     * $config = [..<oauth config param>.];
     * $oauth2 = new OAuth2($config)
     * $subscriber = new AuthTokenSubscriber($oauth2);
     *
     * $client = new Client([
     *     'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
     *     'defaults' => ['auth' => 'google_auth']
     * ]);
     * $client->getEmitter()->attach($subscriber);
     *
     * $res = $client->get('myproject/taskqueues/myqueue');
     * ```
     *
     * @param BeforeEvent $event
     */
    public function onBefore(\Google\Site_Kit_Dependencies\GuzzleHttp\Event\BeforeEvent $event)
    {
        // Requests using "auth"="google_auth" will be authorized.
        $request = $event->getRequest();
        if ($request->getConfig()['auth'] != 'google_auth') {
            return;
        }
        // Fetch the auth token.
        $auth_tokens = $this->fetcher->fetchAuthToken($this->httpHandler);
        if (\array_key_exists('access_token', $auth_tokens)) {
            $request->setHeader('authorization', 'Bearer ' . $auth_tokens['access_token']);
            // notify the callback if applicable
            if ($this->tokenCallback) {
                \call_user_func($this->tokenCallback, $this->fetcher->getCacheKey(), $auth_tokens['access_token']);
            }
        }
        if ($quotaProject = $this->getQuotaProject()) {
            $request->setHeader(\Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER, $quotaProject);
        }
    }
    private function getQuotaProject()
    {
        if ($this->fetcher instanceof \Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface) {
            return $this->fetcher->getQuotaProject();
        }
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Credentials;

/**
 * Authenticates requests using IAM credentials.
 */
class IAMCredentials
{
    const SELECTOR_KEY = 'x-goog-iam-authority-selector';
    const TOKEN_KEY = 'x-goog-iam-authorization-token';
    /**
     * @var string
     */
    private $selector;
    /**
     * @var string
     */
    private $token;
    /**
     * @param string $selector the IAM selector
     * @param string $token the IAM token
     */
    public function __construct($selector, $token)
    {
        if (!\is_string($selector)) {
            throw new \InvalidArgumentException('selector must be a string');
        }
        if (!\is_string($token)) {
            throw new \InvalidArgumentException('token must be a string');
        }
        $this->selector = $selector;
        $this->token = $token;
    }
    /**
     * export a callback function which updates runtime metadata.
     *
     * @return callable updateMetadata function
     */
    public function getUpdateMetadataFunc()
    {
        return [$this, 'updateMetadata'];
    }
    /**
     * Updates metadata with the appropriate header metadata.
     *
     * @param array<mixed> $metadata metadata hashmap
     * @param string $unusedAuthUri optional auth uri
     * @param callable $httpHandler callback which delivers psr7 request
     *        Note: this param is unused here, only included here for
     *        consistency with other credentials class
     *
     * @return array<mixed> updated metadata hashmap
     */
    public function updateMetadata($metadata, $unusedAuthUri = null, callable $httpHandler = null)
    {
        $metadata_copy = $metadata;
        $metadata_copy[self::SELECTOR_KEY] = $this->selector;
        $metadata_copy[self::TOKEN_KEY] = $this->token;
        return $metadata_copy;
    }
}
<?php

/*
 * Copyright 2018 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Credentials;

use Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface;
/**
 * Provides a set of credentials that will always return an empty access token.
 * This is useful for APIs which do not require authentication, for local
 * service emulators, and for testing.
 */
class InsecureCredentials implements \Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface
{
    /**
     * @var array{access_token:string}
     */
    private $token = ['access_token' => ''];
    /**
     * Fetches the auth token. In this case it returns an empty string.
     *
     * @param callable $httpHandler
     * @return array{access_token:string} A set of auth related metadata
     */
    public function fetchAuthToken(callable $httpHandler = null)
    {
        return $this->token;
    }
    /**
     * Returns the cache key. In this case it returns a null value, disabling
     * caching.
     *
     * @return string|null
     */
    public function getCacheKey()
    {
        return null;
    }
    /**
     * Fetches the last received token. In this case, it returns the same empty string
     * auth token.
     *
     * @return array{access_token:string}
     */
    public function getLastReceivedToken()
    {
        return $this->token;
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Credentials;

use Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader;
use Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface;
use Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache;
use Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory;
use Google\Site_Kit_Dependencies\Google\Auth\Iam;
use Google\Site_Kit_Dependencies\Google\Auth\IamSignerTrait;
use Google\Site_Kit_Dependencies\Google\Auth\ProjectIdProviderInterface;
use Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface;
use Google\Site_Kit_Dependencies\GuzzleHttp\Exception\ClientException;
use Google\Site_Kit_Dependencies\GuzzleHttp\Exception\ConnectException;
use Google\Site_Kit_Dependencies\GuzzleHttp\Exception\RequestException;
use Google\Site_Kit_Dependencies\GuzzleHttp\Exception\ServerException;
use Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Request;
use InvalidArgumentException;
/**
 * GCECredentials supports authorization on Google Compute Engine.
 *
 * It can be used to authorize requests using the AuthTokenMiddleware, but will
 * only succeed if being run on GCE:
 *
 *   use Google\Auth\Credentials\GCECredentials;
 *   use Google\Auth\Middleware\AuthTokenMiddleware;
 *   use GuzzleHttp\Client;
 *   use GuzzleHttp\HandlerStack;
 *
 *   $gce = new GCECredentials();
 *   $middleware = new AuthTokenMiddleware($gce);
 *   $stack = HandlerStack::create();
 *   $stack->push($middleware);
 *
 *   $client = new Client([
 *      'handler' => $stack,
 *      'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
 *      'auth' => 'google_auth'
 *   ]);
 *
 *   $res = $client->get('myproject/taskqueues/myqueue');
 */
class GCECredentials extends \Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader implements \Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface, \Google\Site_Kit_Dependencies\Google\Auth\ProjectIdProviderInterface, \Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface
{
    use IamSignerTrait;
    // phpcs:disable
    const cacheKey = 'GOOGLE_AUTH_PHP_GCE';
    // phpcs:enable
    /**
     * The metadata IP address on appengine instances.
     *
     * The IP is used instead of the domain 'metadata' to avoid slow responses
     * when not on Compute Engine.
     */
    const METADATA_IP = '169.254.169.254';
    /**
     * The metadata path of the default token.
     */
    const TOKEN_URI_PATH = 'v1/instance/service-accounts/default/token';
    /**
     * The metadata path of the default id token.
     */
    const ID_TOKEN_URI_PATH = 'v1/instance/service-accounts/default/identity';
    /**
     * The metadata path of the client ID.
     */
    const CLIENT_ID_URI_PATH = 'v1/instance/service-accounts/default/email';
    /**
     * The metadata path of the project ID.
     */
    const PROJECT_ID_URI_PATH = 'v1/project/project-id';
    /**
     * The header whose presence indicates GCE presence.
     */
    const FLAVOR_HEADER = 'Metadata-Flavor';
    /**
     * Note: the explicit `timeout` and `tries` below is a workaround. The underlying
     * issue is that resolving an unknown host on some networks will take
     * 20-30 seconds; making this timeout short fixes the issue, but
     * could lead to false negatives in the event that we are on GCE, but
     * the metadata resolution was particularly slow. The latter case is
     * "unlikely" since the expected 4-nines time is about 0.5 seconds.
     * This allows us to limit the total ping maximum timeout to 1.5 seconds
     * for developer desktop scenarios.
     */
    const MAX_COMPUTE_PING_TRIES = 3;
    const COMPUTE_PING_CONNECTION_TIMEOUT_S = 0.5;
    /**
     * Flag used to ensure that the onGCE test is only done once;.
     *
     * @var bool
     */
    private $hasCheckedOnGce = \false;
    /**
     * Flag that stores the value of the onGCE check.
     *
     * @var bool
     */
    private $isOnGce = \false;
    /**
     * Result of fetchAuthToken.
     *
     * @var array<mixed>
     */
    protected $lastReceivedToken;
    /**
     * @var string|null
     */
    private $clientName;
    /**
     * @var string|null
     */
    private $projectId;
    /**
     * @var string
     */
    private $tokenUri;
    /**
     * @var string
     */
    private $targetAudience;
    /**
     * @var string|null
     */
    private $quotaProject;
    /**
     * @var string|null
     */
    private $serviceAccountIdentity;
    /**
     * @param Iam $iam [optional] An IAM instance.
     * @param string|string[] $scope [optional] the scope of the access request,
     *        expressed either as an array or as a space-delimited string.
     * @param string $targetAudience [optional] The audience for the ID token.
     * @param string $quotaProject [optional] Specifies a project to bill for access
     *   charges associated with the request.
     * @param string $serviceAccountIdentity [optional] Specify a service
     *   account identity name to use instead of "default".
     */
    public function __construct(\Google\Site_Kit_Dependencies\Google\Auth\Iam $iam = null, $scope = null, $targetAudience = null, $quotaProject = null, $serviceAccountIdentity = null)
    {
        $this->iam = $iam;
        if ($scope && $targetAudience) {
            throw new \InvalidArgumentException('Scope and targetAudience cannot both be supplied');
        }
        $tokenUri = self::getTokenUri($serviceAccountIdentity);
        if ($scope) {
            if (\is_string($scope)) {
                $scope = \explode(' ', $scope);
            }
            $scope = \implode(',', $scope);
            $tokenUri = $tokenUri . '?scopes=' . $scope;
        } elseif ($targetAudience) {
            $tokenUri = self::getIdTokenUri($serviceAccountIdentity);
            $tokenUri = $tokenUri . '?audience=' . $targetAudience;
            $this->targetAudience = $targetAudience;
        }
        $this->tokenUri = $tokenUri;
        $this->quotaProject = $quotaProject;
        $this->serviceAccountIdentity = $serviceAccountIdentity;
    }
    /**
     * The full uri for accessing the default token.
     *
     * @param string $serviceAccountIdentity [optional] Specify a service
     *   account identity name to use instead of "default".
     * @return string
     */
    public static function getTokenUri($serviceAccountIdentity = null)
    {
        $base = 'http://' . self::METADATA_IP . '/computeMetadata/';
        $base .= self::TOKEN_URI_PATH;
        if ($serviceAccountIdentity) {
            return \str_replace('/default/', '/' . $serviceAccountIdentity . '/', $base);
        }
        return $base;
    }
    /**
     * The full uri for accessing the default service account.
     *
     * @param string $serviceAccountIdentity [optional] Specify a service
     *   account identity name to use instead of "default".
     * @return string
     */
    public static function getClientNameUri($serviceAccountIdentity = null)
    {
        $base = 'http://' . self::METADATA_IP . '/computeMetadata/';
        $base .= self::CLIENT_ID_URI_PATH;
        if ($serviceAccountIdentity) {
            return \str_replace('/default/', '/' . $serviceAccountIdentity . '/', $base);
        }
        return $base;
    }
    /**
     * The full uri for accesesing the default identity token.
     *
     * @param string $serviceAccountIdentity [optional] Specify a service
     *   account identity name to use instead of "default".
     * @return string
     */
    private static function getIdTokenUri($serviceAccountIdentity = null)
    {
        $base = 'http://' . self::METADATA_IP . '/computeMetadata/';
        $base .= self::ID_TOKEN_URI_PATH;
        if ($serviceAccountIdentity) {
            return \str_replace('/default/', '/' . $serviceAccountIdentity . '/', $base);
        }
        return $base;
    }
    /**
     * The full uri for accessing the default project ID.
     *
     * @return string
     */
    private static function getProjectIdUri()
    {
        $base = 'http://' . self::METADATA_IP . '/computeMetadata/';
        return $base . self::PROJECT_ID_URI_PATH;
    }
    /**
     * Determines if this an App Engine Flexible instance, by accessing the
     * GAE_INSTANCE environment variable.
     *
     * @return bool true if this an App Engine Flexible Instance, false otherwise
     */
    public static function onAppEngineFlexible()
    {
        return \substr((string) \getenv('GAE_INSTANCE'), 0, 4) === 'aef-';
    }
    /**
     * Determines if this a GCE instance, by accessing the expected metadata
     * host.
     * If $httpHandler is not specified a the default HttpHandler is used.
     *
     * @param callable $httpHandler callback which delivers psr7 request
     * @return bool True if this a GCEInstance, false otherwise
     */
    public static function onGce(callable $httpHandler = null)
    {
        $httpHandler = $httpHandler ?: \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory::build(\Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache::getHttpClient());
        $checkUri = 'http://' . self::METADATA_IP;
        for ($i = 1; $i <= self::MAX_COMPUTE_PING_TRIES; $i++) {
            try {
                // Comment from: oauth2client/client.py
                //
                // Note: the explicit `timeout` below is a workaround. The underlying
                // issue is that resolving an unknown host on some networks will take
                // 20-30 seconds; making this timeout short fixes the issue, but
                // could lead to false negatives in the event that we are on GCE, but
                // the metadata resolution was particularly slow. The latter case is
                // "unlikely".
                $resp = $httpHandler(new \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Request('GET', $checkUri, [self::FLAVOR_HEADER => 'Google']), ['timeout' => self::COMPUTE_PING_CONNECTION_TIMEOUT_S]);
                return $resp->getHeaderLine(self::FLAVOR_HEADER) == 'Google';
            } catch (\Google\Site_Kit_Dependencies\GuzzleHttp\Exception\ClientException $e) {
            } catch (\Google\Site_Kit_Dependencies\GuzzleHttp\Exception\ServerException $e) {
            } catch (\Google\Site_Kit_Dependencies\GuzzleHttp\Exception\RequestException $e) {
            } catch (\Google\Site_Kit_Dependencies\GuzzleHttp\Exception\ConnectException $e) {
            }
        }
        return \false;
    }
    /**
     * Implements FetchAuthTokenInterface#fetchAuthToken.
     *
     * Fetches the auth tokens from the GCE metadata host if it is available.
     * If $httpHandler is not specified a the default HttpHandler is used.
     *
     * @param callable $httpHandler callback which delivers psr7 request
     *
     * @return array<mixed> {
     *     A set of auth related metadata, based on the token type.
     *
     *     @type string $access_token for access tokens
     *     @type int    $expires_in   for access tokens
     *     @type string $token_type   for access tokens
     *     @type string $id_token     for ID tokens
     * }
     * @throws \Exception
     */
    public function fetchAuthToken(callable $httpHandler = null)
    {
        $httpHandler = $httpHandler ?: \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory::build(\Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache::getHttpClient());
        if (!$this->hasCheckedOnGce) {
            $this->isOnGce = self::onGce($httpHandler);
            $this->hasCheckedOnGce = \true;
        }
        if (!$this->isOnGce) {
            return [];
            // return an empty array with no access token
        }
        $response = $this->getFromMetadata($httpHandler, $this->tokenUri);
        if ($this->targetAudience) {
            return ['id_token' => $response];
        }
        if (null === ($json = \json_decode($response, \true))) {
            throw new \Exception('Invalid JSON response');
        }
        $json['expires_at'] = \time() + $json['expires_in'];
        // store this so we can retrieve it later
        $this->lastReceivedToken = $json;
        return $json;
    }
    /**
     * @return string
     */
    public function getCacheKey()
    {
        return self::cacheKey;
    }
    /**
     * @return array{access_token:string,expires_at:int}|null
     */
    public function getLastReceivedToken()
    {
        if ($this->lastReceivedToken) {
            return ['access_token' => $this->lastReceivedToken['access_token'], 'expires_at' => $this->lastReceivedToken['expires_at']];
        }
        return null;
    }
    /**
     * Get the client name from GCE metadata.
     *
     * Subsequent calls will return a cached value.
     *
     * @param callable $httpHandler callback which delivers psr7 request
     * @return string
     */
    public function getClientName(callable $httpHandler = null)
    {
        if ($this->clientName) {
            return $this->clientName;
        }
        $httpHandler = $httpHandler ?: \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory::build(\Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache::getHttpClient());
        if (!$this->hasCheckedOnGce) {
            $this->isOnGce = self::onGce($httpHandler);
            $this->hasCheckedOnGce = \true;
        }
        if (!$this->isOnGce) {
            return '';
        }
        $this->clientName = $this->getFromMetadata($httpHandler, self::getClientNameUri($this->serviceAccountIdentity));
        return $this->clientName;
    }
    /**
     * Fetch the default Project ID from compute engine.
     *
     * Returns null if called outside GCE.
     *
     * @param callable $httpHandler Callback which delivers psr7 request
     * @return string|null
     */
    public function getProjectId(callable $httpHandler = null)
    {
        if ($this->projectId) {
            return $this->projectId;
        }
        $httpHandler = $httpHandler ?: \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory::build(\Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache::getHttpClient());
        if (!$this->hasCheckedOnGce) {
            $this->isOnGce = self::onGce($httpHandler);
            $this->hasCheckedOnGce = \true;
        }
        if (!$this->isOnGce) {
            return null;
        }
        $this->projectId = $this->getFromMetadata($httpHandler, self::getProjectIdUri());
        return $this->projectId;
    }
    /**
     * Fetch the value of a GCE metadata server URI.
     *
     * @param callable $httpHandler An HTTP Handler to deliver PSR7 requests.
     * @param string $uri The metadata URI.
     * @return string
     */
    private function getFromMetadata(callable $httpHandler, $uri)
    {
        $resp = $httpHandler(new \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Request('GET', $uri, [self::FLAVOR_HEADER => 'Google']));
        return (string) $resp->getBody();
    }
    /**
     * Get the quota project used for this API request
     *
     * @return string|null
     */
    public function getQuotaProject()
    {
        return $this->quotaProject;
    }
    /**
     * Set whether or not we've already checked the GCE environment.
     *
     * @param bool $isOnGce
     *
     * @return void
     */
    public function setIsOnGce($isOnGce)
    {
        // Implicitly set hasCheckedGce to true
        $this->hasCheckedOnGce = \true;
        // Set isOnGce
        $this->isOnGce = $isOnGce;
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Credentials;

use Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader;
use Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface;
use Google\Site_Kit_Dependencies\Google\Auth\OAuth2;
use Google\Site_Kit_Dependencies\Google\Auth\ProjectIdProviderInterface;
use Google\Site_Kit_Dependencies\Google\Auth\ServiceAccountSignerTrait;
use Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface;
/**
 * Authenticates requests using Google's Service Account credentials via
 * JWT Access.
 *
 * This class allows authorizing requests for service accounts directly
 * from credentials from a json key file downloaded from the developer
 * console (via 'Generate new Json Key').  It is not part of any OAuth2
 * flow, rather it creates a JWT and sends that as a credential.
 */
class ServiceAccountJwtAccessCredentials extends \Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader implements \Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface, \Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface, \Google\Site_Kit_Dependencies\Google\Auth\ProjectIdProviderInterface
{
    use ServiceAccountSignerTrait;
    /**
     * The OAuth2 instance used to conduct authorization.
     *
     * @var OAuth2
     */
    protected $auth;
    /**
     * The quota project associated with the JSON credentials
     *
     * @var string
     */
    protected $quotaProject;
    /**
     * @var string
     */
    public $projectId;
    /**
     * Create a new ServiceAccountJwtAccessCredentials.
     *
     * @param string|array<mixed> $jsonKey JSON credential file path or JSON credentials
     *   as an associative array
     * @param string|string[] $scope the scope of the access request, expressed
     *   either as an Array or as a space-delimited String.
     */
    public function __construct($jsonKey, $scope = null)
    {
        if (\is_string($jsonKey)) {
            if (!\file_exists($jsonKey)) {
                throw new \InvalidArgumentException('file does not exist');
            }
            $jsonKeyStream = \file_get_contents($jsonKey);
            if (!($jsonKey = \json_decode((string) $jsonKeyStream, \true))) {
                throw new \LogicException('invalid json for auth config');
            }
        }
        if (!\array_key_exists('client_email', $jsonKey)) {
            throw new \InvalidArgumentException('json key is missing the client_email field');
        }
        if (!\array_key_exists('private_key', $jsonKey)) {
            throw new \InvalidArgumentException('json key is missing the private_key field');
        }
        if (\array_key_exists('quota_project_id', $jsonKey)) {
            $this->quotaProject = (string) $jsonKey['quota_project_id'];
        }
        $this->auth = new \Google\Site_Kit_Dependencies\Google\Auth\OAuth2(['issuer' => $jsonKey['client_email'], 'sub' => $jsonKey['client_email'], 'signingAlgorithm' => 'RS256', 'signingKey' => $jsonKey['private_key'], 'scope' => $scope]);
        $this->projectId = isset($jsonKey['project_id']) ? $jsonKey['project_id'] : null;
    }
    /**
     * Updates metadata with the authorization token.
     *
     * @param array<mixed> $metadata metadata hashmap
     * @param string $authUri optional auth uri
     * @param callable $httpHandler callback which delivers psr7 request
     * @return array<mixed> updated metadata hashmap
     */
    public function updateMetadata($metadata, $authUri = null, callable $httpHandler = null)
    {
        $scope = $this->auth->getScope();
        if (empty($authUri) && empty($scope)) {
            return $metadata;
        }
        $this->auth->setAudience($authUri);
        return parent::updateMetadata($metadata, $authUri, $httpHandler);
    }
    /**
     * Implements FetchAuthTokenInterface#fetchAuthToken.
     *
     * @param callable $httpHandler
     *
     * @return null|array{access_token:string} A set of auth related metadata
     */
    public function fetchAuthToken(callable $httpHandler = null)
    {
        $audience = $this->auth->getAudience();
        $scope = $this->auth->getScope();
        if (empty($audience) && empty($scope)) {
            return null;
        }
        if (!empty($audience) && !empty($scope)) {
            throw new \UnexpectedValueException('Cannot sign both audience and scope in JwtAccess');
        }
        $access_token = $this->auth->toJwt();
        // Set the self-signed access token in OAuth2 for getLastReceivedToken
        $this->auth->setAccessToken($access_token);
        return ['access_token' => $access_token];
    }
    /**
     * @return string
     */
    public function getCacheKey()
    {
        return $this->auth->getCacheKey();
    }
    /**
     * @return array<mixed>
     */
    public function getLastReceivedToken()
    {
        return $this->auth->getLastReceivedToken();
    }
    /**
     * Get the project ID from the service account keyfile.
     *
     * Returns null if the project ID does not exist in the keyfile.
     *
     * @param callable $httpHandler Not used by this credentials type.
     * @return string|null
     */
    public function getProjectId(callable $httpHandler = null)
    {
        return $this->projectId;
    }
    /**
     * Get the client name from the keyfile.
     *
     * In this case, it returns the keyfile's client_email key.
     *
     * @param callable $httpHandler Not used by this credentials type.
     * @return string
     */
    public function getClientName(callable $httpHandler = null)
    {
        return $this->auth->getIssuer();
    }
    /**
     * Get the quota project used for this API request
     *
     * @return string|null
     */
    public function getQuotaProject()
    {
        return $this->quotaProject;
    }
}
<?php

/*
 * Copyright 2022 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Credentials;

use Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader;
use Google\Site_Kit_Dependencies\Google\Auth\IamSignerTrait;
use Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface;
class ImpersonatedServiceAccountCredentials extends \Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader implements \Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface
{
    use IamSignerTrait;
    /**
     * @var string
     */
    protected $impersonatedServiceAccountName;
    /**
     * @var UserRefreshCredentials
     */
    protected $sourceCredentials;
    /**
     * Instantiate an instance of ImpersonatedServiceAccountCredentials from a credentials file that has be created with
     * the --impersonated-service-account flag.
     *
     * @param string|string[] $scope the scope of the access request, expressed
     *   either as an Array or as a space-delimited String.
     * @param string|array<mixed> $jsonKey JSON credential file path or JSON credentials
     *   as an associative array
     */
    public function __construct($scope, $jsonKey)
    {
        if (\is_string($jsonKey)) {
            if (!\file_exists($jsonKey)) {
                throw new \InvalidArgumentException('file does not exist');
            }
            $json = \file_get_contents($jsonKey);
            if (!($jsonKey = \json_decode((string) $json, \true))) {
                throw new \LogicException('invalid json for auth config');
            }
        }
        if (!\array_key_exists('service_account_impersonation_url', $jsonKey)) {
            throw new \LogicException('json key is missing the service_account_impersonation_url field');
        }
        if (!\array_key_exists('source_credentials', $jsonKey)) {
            throw new \LogicException('json key is missing the source_credentials field');
        }
        $this->impersonatedServiceAccountName = $this->getImpersonatedServiceAccountNameFromUrl($jsonKey['service_account_impersonation_url']);
        $this->sourceCredentials = new \Google\Site_Kit_Dependencies\Google\Auth\Credentials\UserRefreshCredentials($scope, $jsonKey['source_credentials']);
    }
    /**
     * Helper function for extracting the Server Account Name from the URL saved in the account credentials file
     * @param $serviceAccountImpersonationUrl string URL from the 'service_account_impersonation_url' field
     * @return string Service account email or ID.
     */
    private function getImpersonatedServiceAccountNameFromUrl(string $serviceAccountImpersonationUrl)
    {
        $fields = \explode('/', $serviceAccountImpersonationUrl);
        $lastField = \end($fields);
        $splitter = \explode(':', $lastField);
        return $splitter[0];
    }
    /**
     * Get the client name from the keyfile
     *
     * In this implementation, it will return the issuers email from the oauth token.
     *
     * @param callable|null $unusedHttpHandler not used by this credentials type.
     * @return string Token issuer email
     */
    public function getClientName(callable $unusedHttpHandler = null)
    {
        return $this->impersonatedServiceAccountName;
    }
    /**
     * @param callable $httpHandler
     *
     * @return array<mixed> {
     *     A set of auth related metadata, containing the following
     *
     *     @type string $access_token
     *     @type int $expires_in
     *     @type string $scope
     *     @type string $token_type
     *     @type string $id_token
     * }
     */
    public function fetchAuthToken(callable $httpHandler = null)
    {
        return $this->sourceCredentials->fetchAuthToken($httpHandler);
    }
    /**
     * @return string
     */
    public function getCacheKey()
    {
        return $this->sourceCredentials->getCacheKey();
    }
    /**
     * @return array<mixed>
     */
    public function getLastReceivedToken()
    {
        return $this->sourceCredentials->getLastReceivedToken();
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Credentials;

use Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader;
use Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface;
use Google\Site_Kit_Dependencies\Google\Auth\OAuth2;
/**
 * Authenticates requests using User Refresh credentials.
 *
 * This class allows authorizing requests from user refresh tokens.
 *
 * This the end of the result of a 3LO flow.  E.g, the end result of
 * 'gcloud auth login' saves a file with these contents in well known
 * location
 *
 * @see [Application Default Credentials](http://goo.gl/mkAHpZ)
 */
class UserRefreshCredentials extends \Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader implements \Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface
{
    /**
     * The OAuth2 instance used to conduct authorization.
     *
     * @var OAuth2
     */
    protected $auth;
    /**
     * The quota project associated with the JSON credentials
     *
     * @var string
     */
    protected $quotaProject;
    /**
     * Create a new UserRefreshCredentials.
     *
     * @param string|string[] $scope the scope of the access request, expressed
     *   either as an Array or as a space-delimited String.
     * @param string|array<mixed> $jsonKey JSON credential file path or JSON credentials
     *   as an associative array
     */
    public function __construct($scope, $jsonKey)
    {
        if (\is_string($jsonKey)) {
            if (!\file_exists($jsonKey)) {
                throw new \InvalidArgumentException('file does not exist');
            }
            $json = \file_get_contents($jsonKey);
            if (!($jsonKey = \json_decode((string) $json, \true))) {
                throw new \LogicException('invalid json for auth config');
            }
        }
        if (!\array_key_exists('client_id', $jsonKey)) {
            throw new \InvalidArgumentException('json key is missing the client_id field');
        }
        if (!\array_key_exists('client_secret', $jsonKey)) {
            throw new \InvalidArgumentException('json key is missing the client_secret field');
        }
        if (!\array_key_exists('refresh_token', $jsonKey)) {
            throw new \InvalidArgumentException('json key is missing the refresh_token field');
        }
        $this->auth = new \Google\Site_Kit_Dependencies\Google\Auth\OAuth2(['clientId' => $jsonKey['client_id'], 'clientSecret' => $jsonKey['client_secret'], 'refresh_token' => $jsonKey['refresh_token'], 'scope' => $scope, 'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI]);
        if (\array_key_exists('quota_project_id', $jsonKey)) {
            $this->quotaProject = (string) $jsonKey['quota_project_id'];
        }
    }
    /**
     * @param callable $httpHandler
     *
     * @return array<mixed> {
     *     A set of auth related metadata, containing the following
     *
     *     @type string $access_token
     *     @type int $expires_in
     *     @type string $scope
     *     @type string $token_type
     *     @type string $id_token
     * }
     */
    public function fetchAuthToken(callable $httpHandler = null)
    {
        return $this->auth->fetchAuthToken($httpHandler);
    }
    /**
     * @return string
     */
    public function getCacheKey()
    {
        return $this->auth->getClientId() . ':' . $this->auth->getCacheKey();
    }
    /**
     * @return array<mixed>
     */
    public function getLastReceivedToken()
    {
        return $this->auth->getLastReceivedToken();
    }
    /**
     * Get the quota project used for this API request
     *
     * @return string|null
     */
    public function getQuotaProject()
    {
        return $this->quotaProject;
    }
    /**
     * Get the granted scopes (if they exist) for the last fetched token.
     *
     * @return string|null
     */
    public function getGrantedScope()
    {
        return $this->auth->getGrantedScope();
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Credentials;

/*
 * The AppIdentityService class is automatically defined on App Engine,
 * so including this dependency is not necessary, and will result in a
 * PHP fatal error in the App Engine environment.
 */
use Google\Site_Kit_Dependencies\google\appengine\api\app_identity\AppIdentityService;
use Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader;
use Google\Site_Kit_Dependencies\Google\Auth\ProjectIdProviderInterface;
use Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface;
/**
 * @deprecated
 *
 * AppIdentityCredentials supports authorization on Google App Engine.
 *
 * It can be used to authorize requests using the AuthTokenMiddleware or
 * AuthTokenSubscriber, but will only succeed if being run on App Engine:
 *
 * Example:
 * ```
 * use Google\Auth\Credentials\AppIdentityCredentials;
 * use Google\Auth\Middleware\AuthTokenMiddleware;
 * use GuzzleHttp\Client;
 * use GuzzleHttp\HandlerStack;
 *
 * $gae = new AppIdentityCredentials('https://www.googleapis.com/auth/books');
 * $middleware = new AuthTokenMiddleware($gae);
 * $stack = HandlerStack::create();
 * $stack->push($middleware);
 *
 * $client = new Client([
 *     'handler' => $stack,
 *     'base_uri' => 'https://www.googleapis.com/books/v1',
 *     'auth' => 'google_auth'
 * ]);
 *
 * $res = $client->get('volumes?q=Henry+David+Thoreau&country=US');
 * ```
 */
class AppIdentityCredentials extends \Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader implements \Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface, \Google\Site_Kit_Dependencies\Google\Auth\ProjectIdProviderInterface
{
    /**
     * Result of fetchAuthToken.
     *
     * @var array<mixed>
     */
    protected $lastReceivedToken;
    /**
     * Array of OAuth2 scopes to be requested.
     *
     * @var string[]
     */
    private $scope;
    /**
     * @var string
     */
    private $clientName;
    /**
     * @param string|string[] $scope One or more scopes.
     */
    public function __construct($scope = [])
    {
        $this->scope = \is_array($scope) ? $scope : \explode(' ', (string) $scope);
    }
    /**
     * Determines if this an App Engine instance, by accessing the
     * SERVER_SOFTWARE environment variable (prod) or the APPENGINE_RUNTIME
     * environment variable (dev).
     *
     * @return bool true if this an App Engine Instance, false otherwise
     */
    public static function onAppEngine()
    {
        $appEngineProduction = isset($_SERVER['SERVER_SOFTWARE']) && 0 === \strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine');
        if ($appEngineProduction) {
            return \true;
        }
        $appEngineDevAppServer = isset($_SERVER['APPENGINE_RUNTIME']) && $_SERVER['APPENGINE_RUNTIME'] == 'php';
        if ($appEngineDevAppServer) {
            return \true;
        }
        return \false;
    }
    /**
     * Implements FetchAuthTokenInterface#fetchAuthToken.
     *
     * Fetches the auth tokens using the AppIdentityService if available.
     * As the AppIdentityService uses protobufs to fetch the access token,
     * the GuzzleHttp\ClientInterface instance passed in will not be used.
     *
     * @param callable $httpHandler callback which delivers psr7 request
     * @return array<mixed> {
     *     A set of auth related metadata, containing the following
     *
     *     @type string $access_token
     *     @type string $expiration_time
     * }
     */
    public function fetchAuthToken(callable $httpHandler = null)
    {
        try {
            $this->checkAppEngineContext();
        } catch (\Exception $e) {
            return [];
        }
        /** @phpstan-ignore-next-line */
        $token = \Google\Site_Kit_Dependencies\google\appengine\api\app_identity\AppIdentityService::getAccessToken($this->scope);
        $this->lastReceivedToken = $token;
        return $token;
    }
    /**
     * Sign a string using AppIdentityService.
     *
     * @param string $stringToSign The string to sign.
     * @param bool $forceOpenSsl [optional] Does not apply to this credentials
     *        type.
     * @return string The signature, base64-encoded.
     * @throws \Exception If AppEngine SDK or mock is not available.
     */
    public function signBlob($stringToSign, $forceOpenSsl = \false)
    {
        $this->checkAppEngineContext();
        /** @phpstan-ignore-next-line */
        return \base64_encode(\Google\Site_Kit_Dependencies\google\appengine\api\app_identity\AppIdentityService::signForApp($stringToSign)['signature']);
    }
    /**
     * Get the project ID from AppIdentityService.
     *
     * Returns null if AppIdentityService is unavailable.
     *
     * @param callable $httpHandler Not used by this type.
     * @return string|null
     */
    public function getProjectId(callable $httpHandler = null)
    {
        try {
            $this->checkAppEngineContext();
        } catch (\Exception $e) {
            return null;
        }
        /** @phpstan-ignore-next-line */
        return \Google\Site_Kit_Dependencies\google\appengine\api\app_identity\AppIdentityService::getApplicationId();
    }
    /**
     * Get the client name from AppIdentityService.
     *
     * Subsequent calls to this method will return a cached value.
     *
     * @param callable $httpHandler Not used in this implementation.
     * @return string
     * @throws \Exception If AppEngine SDK or mock is not available.
     */
    public function getClientName(callable $httpHandler = null)
    {
        $this->checkAppEngineContext();
        if (!$this->clientName) {
            /** @phpstan-ignore-next-line */
            $this->clientName = \Google\Site_Kit_Dependencies\google\appengine\api\app_identity\AppIdentityService::getServiceAccountName();
        }
        return $this->clientName;
    }
    /**
     * @return array{access_token:string,expires_at:int}|null
     */
    public function getLastReceivedToken()
    {
        if ($this->lastReceivedToken) {
            return ['access_token' => $this->lastReceivedToken['access_token'], 'expires_at' => $this->lastReceivedToken['expiration_time']];
        }
        return null;
    }
    /**
     * Caching is handled by the underlying AppIdentityService, return empty string
     * to prevent caching.
     *
     * @return string
     */
    public function getCacheKey()
    {
        return '';
    }
    /**
     * @return void
     */
    private function checkAppEngineContext()
    {
        if (!self::onAppEngine() || !\class_exists('Google\\Site_Kit_Dependencies\\google\\appengine\\api\\app_identity\\AppIdentityService')) {
            throw new \Exception('This class must be run in App Engine, or you must include the AppIdentityService ' . 'mock class defined in tests/mocks/AppIdentityService.php');
        }
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Credentials;

use Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader;
use Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface;
use Google\Site_Kit_Dependencies\Google\Auth\OAuth2;
use Google\Site_Kit_Dependencies\Google\Auth\ProjectIdProviderInterface;
use Google\Site_Kit_Dependencies\Google\Auth\ServiceAccountSignerTrait;
use Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface;
use InvalidArgumentException;
/**
 * ServiceAccountCredentials supports authorization using a Google service
 * account.
 *
 * (cf https://developers.google.com/accounts/docs/OAuth2ServiceAccount)
 *
 * It's initialized using the json key file that's downloadable from developer
 * console, which should contain a private_key and client_email fields that it
 * uses.
 *
 * Use it with AuthTokenMiddleware to authorize http requests:
 *
 *   use Google\Auth\Credentials\ServiceAccountCredentials;
 *   use Google\Auth\Middleware\AuthTokenMiddleware;
 *   use GuzzleHttp\Client;
 *   use GuzzleHttp\HandlerStack;
 *
 *   $sa = new ServiceAccountCredentials(
 *       'https://www.googleapis.com/auth/taskqueue',
 *       '/path/to/your/json/key_file.json'
 *   );
 *   $middleware = new AuthTokenMiddleware($sa);
 *   $stack = HandlerStack::create();
 *   $stack->push($middleware);
 *
 *   $client = new Client([
 *       'handler' => $stack,
 *       'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
 *       'auth' => 'google_auth' // authorize all requests
 *   ]);
 *
 *   $res = $client->get('myproject/taskqueues/myqueue');
 */
class ServiceAccountCredentials extends \Google\Site_Kit_Dependencies\Google\Auth\CredentialsLoader implements \Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface, \Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface, \Google\Site_Kit_Dependencies\Google\Auth\ProjectIdProviderInterface
{
    use ServiceAccountSignerTrait;
    /**
     * The OAuth2 instance used to conduct authorization.
     *
     * @var OAuth2
     */
    protected $auth;
    /**
     * The quota project associated with the JSON credentials
     *
     * @var string
     */
    protected $quotaProject;
    /**
     * @var string|null
     */
    protected $projectId;
    /**
     * @var array<mixed>|null
     */
    private $lastReceivedJwtAccessToken;
    /**
     * @var bool
     */
    private $useJwtAccessWithScope = \false;
    /**
     * @var ServiceAccountJwtAccessCredentials|null
     */
    private $jwtAccessCredentials;
    /**
     * Create a new ServiceAccountCredentials.
     *
     * @param string|string[]|null $scope the scope of the access request, expressed
     *   either as an Array or as a space-delimited String.
     * @param string|array<mixed> $jsonKey JSON credential file path or JSON credentials
     *   as an associative array
     * @param string $sub an email address account to impersonate, in situations when
     *   the service account has been delegated domain wide access.
     * @param string $targetAudience The audience for the ID token.
     */
    public function __construct($scope, $jsonKey, $sub = null, $targetAudience = null)
    {
        if (\is_string($jsonKey)) {
            if (!\file_exists($jsonKey)) {
                throw new \InvalidArgumentException('file does not exist');
            }
            $jsonKeyStream = \file_get_contents($jsonKey);
            if (!($jsonKey = \json_decode((string) $jsonKeyStream, \true))) {
                throw new \LogicException('invalid json for auth config');
            }
        }
        if (!\array_key_exists('client_email', $jsonKey)) {
            throw new \InvalidArgumentException('json key is missing the client_email field');
        }
        if (!\array_key_exists('private_key', $jsonKey)) {
            throw new \InvalidArgumentException('json key is missing the private_key field');
        }
        if (\array_key_exists('quota_project_id', $jsonKey)) {
            $this->quotaProject = (string) $jsonKey['quota_project_id'];
        }
        if ($scope && $targetAudience) {
            throw new \InvalidArgumentException('Scope and targetAudience cannot both be supplied');
        }
        $additionalClaims = [];
        if ($targetAudience) {
            $additionalClaims = ['target_audience' => $targetAudience];
        }
        $this->auth = new \Google\Site_Kit_Dependencies\Google\Auth\OAuth2(['audience' => self::TOKEN_CREDENTIAL_URI, 'issuer' => $jsonKey['client_email'], 'scope' => $scope, 'signingAlgorithm' => 'RS256', 'signingKey' => $jsonKey['private_key'], 'sub' => $sub, 'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI, 'additionalClaims' => $additionalClaims]);
        $this->projectId = isset($jsonKey['project_id']) ? $jsonKey['project_id'] : null;
    }
    /**
     * When called, the ServiceAccountCredentials will use an instance of
     * ServiceAccountJwtAccessCredentials to fetch (self-sign) an access token
     * even when only scopes are supplied. Otherwise,
     * ServiceAccountJwtAccessCredentials is only called when no scopes and an
     * authUrl (audience) is suppled.
     *
     * @return void
     */
    public function useJwtAccessWithScope()
    {
        $this->useJwtAccessWithScope = \true;
    }
    /**
     * @param callable $httpHandler
     *
     * @return array<mixed> {
     *     A set of auth related metadata, containing the following
     *
     *     @type string $access_token
     *     @type int $expires_in
     *     @type string $token_type
     * }
     */
    public function fetchAuthToken(callable $httpHandler = null)
    {
        if ($this->useSelfSignedJwt()) {
            $jwtCreds = $this->createJwtAccessCredentials();
            $accessToken = $jwtCreds->fetchAuthToken($httpHandler);
            if ($lastReceivedToken = $jwtCreds->getLastReceivedToken()) {
                // Keep self-signed JWTs in memory as the last received token
                $this->lastReceivedJwtAccessToken = $lastReceivedToken;
            }
            return $accessToken;
        }
        return $this->auth->fetchAuthToken($httpHandler);
    }
    /**
     * @return string
     */
    public function getCacheKey()
    {
        $key = $this->auth->getIssuer() . ':' . $this->auth->getCacheKey();
        if ($sub = $this->auth->getSub()) {
            $key .= ':' . $sub;
        }
        return $key;
    }
    /**
     * @return array<mixed>
     */
    public function getLastReceivedToken()
    {
        // If self-signed JWTs are being used, fetch the last received token
        // from memory. Else, fetch it from OAuth2
        return $this->useSelfSignedJwt() ? $this->lastReceivedJwtAccessToken : $this->auth->getLastReceivedToken();
    }
    /**
     * Get the project ID from the service account keyfile.
     *
     * Returns null if the project ID does not exist in the keyfile.
     *
     * @param callable $httpHandler Not used by this credentials type.
     * @return string|null
     */
    public function getProjectId(callable $httpHandler = null)
    {
        return $this->projectId;
    }
    /**
     * Updates metadata with the authorization token.
     *
     * @param array<mixed> $metadata metadata hashmap
     * @param string $authUri optional auth uri
     * @param callable $httpHandler callback which delivers psr7 request
     * @return array<mixed> updated metadata hashmap
     */
    public function updateMetadata($metadata, $authUri = null, callable $httpHandler = null)
    {
        // scope exists. use oauth implementation
        if (!$this->useSelfSignedJwt()) {
            return parent::updateMetadata($metadata, $authUri, $httpHandler);
        }
        $jwtCreds = $this->createJwtAccessCredentials();
        if ($this->auth->getScope()) {
            // Prefer user-provided "scope" to "audience"
            $updatedMetadata = $jwtCreds->updateMetadata($metadata, null, $httpHandler);
        } else {
            $updatedMetadata = $jwtCreds->updateMetadata($metadata, $authUri, $httpHandler);
        }
        if ($lastReceivedToken = $jwtCreds->getLastReceivedToken()) {
            // Keep self-signed JWTs in memory as the last received token
            $this->lastReceivedJwtAccessToken = $lastReceivedToken;
        }
        return $updatedMetadata;
    }
    /**
     * @return ServiceAccountJwtAccessCredentials
     */
    private function createJwtAccessCredentials()
    {
        if (!$this->jwtAccessCredentials) {
            // Create credentials for self-signing a JWT (JwtAccess)
            $credJson = ['private_key' => $this->auth->getSigningKey(), 'client_email' => $this->auth->getIssuer()];
            $this->jwtAccessCredentials = new \Google\Site_Kit_Dependencies\Google\Auth\Credentials\ServiceAccountJwtAccessCredentials($credJson, $this->auth->getScope());
        }
        return $this->jwtAccessCredentials;
    }
    /**
     * @param string $sub an email address account to impersonate, in situations when
     *   the service account has been delegated domain wide access.
     * @return void
     */
    public function setSub($sub)
    {
        $this->auth->setSub($sub);
    }
    /**
     * Get the client name from the keyfile.
     *
     * In this case, it returns the keyfile's client_email key.
     *
     * @param callable $httpHandler Not used by this credentials type.
     * @return string
     */
    public function getClientName(callable $httpHandler = null)
    {
        return $this->auth->getIssuer();
    }
    /**
     * Get the quota project used for this API request
     *
     * @return string|null
     */
    public function getQuotaProject()
    {
        return $this->quotaProject;
    }
    /**
     * @return bool
     */
    private function useSelfSignedJwt()
    {
        // If claims are set, this call is for "id_tokens"
        if ($this->auth->getAdditionalClaims()) {
            return \false;
        }
        // When true, ServiceAccountCredentials will always use JwtAccess for access tokens
        if ($this->useJwtAccessWithScope) {
            return \true;
        }
        return \is_null($this->auth->getScope());
    }
}
<?php

/*
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

/**
 * Describes a Credentials object which supports fetching the project ID.
 */
interface ProjectIdProviderInterface
{
    /**
     * Get the project ID.
     *
     * @param callable $httpHandler Callback which delivers psr7 request
     * @return string|null
     */
    public function getProjectId(callable $httpHandler = null);
}
<?php

/*
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

/**
 * Describes a Credentials object which supports updating request metadata
 * (request headers).
 */
interface UpdateMetadataInterface
{
    const AUTH_METADATA_KEY = 'authorization';
    /**
     * Updates metadata with the authorization token.
     *
     * @param array<mixed> $metadata metadata hashmap
     * @param string $authUri optional auth uri
     * @param callable $httpHandler callback which delivers psr7 request
     * @return array<mixed> updated metadata hashmap
     */
    public function updateMetadata($metadata, $authUri = null, callable $httpHandler = null);
}
<?php

/*
 * Copyright 2010 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface;
/**
 * A class to implement caching for any object implementing
 * FetchAuthTokenInterface
 */
class FetchAuthTokenCache implements \Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface, \Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface, \Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface, \Google\Site_Kit_Dependencies\Google\Auth\ProjectIdProviderInterface, \Google\Site_Kit_Dependencies\Google\Auth\UpdateMetadataInterface
{
    use CacheTrait;
    /**
     * @var FetchAuthTokenInterface
     */
    private $fetcher;
    /**
     * @var int
     */
    private $eagerRefreshThresholdSeconds = 10;
    /**
     * @param FetchAuthTokenInterface $fetcher A credentials fetcher
     * @param array<mixed> $cacheConfig Configuration for the cache
     * @param CacheItemPoolInterface $cache
     */
    public function __construct(\Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface $fetcher, array $cacheConfig = null, \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface $cache)
    {
        $this->fetcher = $fetcher;
        $this->cache = $cache;
        $this->cacheConfig = \array_merge(['lifetime' => 1500, 'prefix' => ''], (array) $cacheConfig);
    }
    /**
     * @return FetchAuthTokenInterface
     */
    public function getFetcher()
    {
        return $this->fetcher;
    }
    /**
     * Implements FetchAuthTokenInterface#fetchAuthToken.
     *
     * Checks the cache for a valid auth token and fetches the auth tokens
     * from the supplied fetcher.
     *
     * @param callable $httpHandler callback which delivers psr7 request
     * @return array<mixed> the response
     * @throws \Exception
     */
    public function fetchAuthToken(callable $httpHandler = null)
    {
        if ($cached = $this->fetchAuthTokenFromCache()) {
            return $cached;
        }
        $auth_token = $this->fetcher->fetchAuthToken($httpHandler);
        $this->saveAuthTokenInCache($auth_token);
        return $auth_token;
    }
    /**
     * @return string
     */
    public function getCacheKey()
    {
        return $this->getFullCacheKey($this->fetcher->getCacheKey());
    }
    /**
     * @return array<mixed>|null
     */
    public function getLastReceivedToken()
    {
        return $this->fetcher->getLastReceivedToken();
    }
    /**
     * Get the client name from the fetcher.
     *
     * @param callable $httpHandler An HTTP handler to deliver PSR7 requests.
     * @return string
     */
    public function getClientName(callable $httpHandler = null)
    {
        if (!$this->fetcher instanceof \Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface) {
            throw new \RuntimeException('Credentials fetcher does not implement ' . 'Google\\Auth\\SignBlobInterface');
        }
        return $this->fetcher->getClientName($httpHandler);
    }
    /**
     * Sign a blob using the fetcher.
     *
     * @param string $stringToSign The string to sign.
     * @param bool $forceOpenSsl Require use of OpenSSL for local signing. Does
     *        not apply to signing done using external services. **Defaults to**
     *        `false`.
     * @return string The resulting signature.
     * @throws \RuntimeException If the fetcher does not implement
     *     `Google\Auth\SignBlobInterface`.
     */
    public function signBlob($stringToSign, $forceOpenSsl = \false)
    {
        if (!$this->fetcher instanceof \Google\Site_Kit_Dependencies\Google\Auth\SignBlobInterface) {
            throw new \RuntimeException('Credentials fetcher does not implement ' . 'Google\\Auth\\SignBlobInterface');
        }
        // Pass the access token from cache to GCECredentials for signing a blob.
        // This saves a call to the metadata server when a cached token exists.
        if ($this->fetcher instanceof \Google\Site_Kit_Dependencies\Google\Auth\Credentials\GCECredentials) {
            $cached = $this->fetchAuthTokenFromCache();
            $accessToken = isset($cached['access_token']) ? $cached['access_token'] : null;
            return $this->fetcher->signBlob($stringToSign, $forceOpenSsl, $accessToken);
        }
        return $this->fetcher->signBlob($stringToSign, $forceOpenSsl);
    }
    /**
     * Get the quota project used for this API request from the credentials
     * fetcher.
     *
     * @return string|null
     */
    public function getQuotaProject()
    {
        if ($this->fetcher instanceof \Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface) {
            return $this->fetcher->getQuotaProject();
        }
        return null;
    }
    /*
     * Get the Project ID from the fetcher.
     *
     * @param callable $httpHandler Callback which delivers psr7 request
     * @return string|null
     * @throws \RuntimeException If the fetcher does not implement
     *     `Google\Auth\ProvidesProjectIdInterface`.
     */
    public function getProjectId(callable $httpHandler = null)
    {
        if (!$this->fetcher instanceof \Google\Site_Kit_Dependencies\Google\Auth\ProjectIdProviderInterface) {
            throw new \RuntimeException('Credentials fetcher does not implement ' . 'Google\\Auth\\ProvidesProjectIdInterface');
        }
        return $this->fetcher->getProjectId($httpHandler);
    }
    /**
     * Updates metadata with the authorization token.
     *
     * @param array<mixed> $metadata metadata hashmap
     * @param string $authUri optional auth uri
     * @param callable $httpHandler callback which delivers psr7 request
     * @return array<mixed> updated metadata hashmap
     * @throws \RuntimeException If the fetcher does not implement
     *     `Google\Auth\UpdateMetadataInterface`.
     */
    public function updateMetadata($metadata, $authUri = null, callable $httpHandler = null)
    {
        if (!$this->fetcher instanceof \Google\Site_Kit_Dependencies\Google\Auth\UpdateMetadataInterface) {
            throw new \RuntimeException('Credentials fetcher does not implement ' . 'Google\\Auth\\UpdateMetadataInterface');
        }
        $cached = $this->fetchAuthTokenFromCache($authUri);
        if ($cached) {
            // Set the access token in the `Authorization` metadata header so
            // the downstream call to updateMetadata know they don't need to
            // fetch another token.
            if (isset($cached['access_token'])) {
                $metadata[self::AUTH_METADATA_KEY] = ['Bearer ' . $cached['access_token']];
            }
        }
        $newMetadata = $this->fetcher->updateMetadata($metadata, $authUri, $httpHandler);
        if (!$cached && ($token = $this->fetcher->getLastReceivedToken())) {
            $this->saveAuthTokenInCache($token, $authUri);
        }
        return $newMetadata;
    }
    /**
     * @param string|null $authUri
     * @return array<mixed>|null
     */
    private function fetchAuthTokenFromCache($authUri = null)
    {
        // Use the cached value if its available.
        //
        // TODO: correct caching; update the call to setCachedValue to set the expiry
        // to the value returned with the auth token.
        //
        // TODO: correct caching; enable the cache to be cleared.
        // if $authUri is set, use it as the cache key
        $cacheKey = $authUri ? $this->getFullCacheKey($authUri) : $this->fetcher->getCacheKey();
        $cached = $this->getCachedValue($cacheKey);
        if (\is_array($cached)) {
            if (empty($cached['expires_at'])) {
                // If there is no expiration data, assume token is not expired.
                // (for JwtAccess and ID tokens)
                return $cached;
            }
            if (\time() + $this->eagerRefreshThresholdSeconds < $cached['expires_at']) {
                // access token is not expired
                return $cached;
            }
        }
        return null;
    }
    /**
     * @param array<mixed> $authToken
     * @param string|null  $authUri
     * @return void
     */
    private function saveAuthTokenInCache($authToken, $authUri = null)
    {
        if (isset($authToken['access_token']) || isset($authToken['id_token'])) {
            // if $authUri is set, use it as the cache key
            $cacheKey = $authUri ? $this->getFullCacheKey($authUri) : $this->fetcher->getCacheKey();
            $this->setCachedValue($cacheKey, $authToken);
        }
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface;
trait CacheTrait
{
    /**
     * @var int
     */
    private $maxKeyLength = 64;
    /**
     * @var array<mixed>
     */
    private $cacheConfig;
    /**
     * @var ?CacheItemPoolInterface
     */
    private $cache;
    /**
     * Gets the cached value if it is present in the cache when that is
     * available.
     *
     * @param mixed $k
     *
     * @return mixed
     */
    private function getCachedValue($k)
    {
        if (\is_null($this->cache)) {
            return null;
        }
        $key = $this->getFullCacheKey($k);
        if (\is_null($key)) {
            return null;
        }
        $cacheItem = $this->cache->getItem($key);
        if ($cacheItem->isHit()) {
            return $cacheItem->get();
        }
    }
    /**
     * Saves the value in the cache when that is available.
     *
     * @param mixed $k
     * @param mixed $v
     * @return mixed
     */
    private function setCachedValue($k, $v)
    {
        if (\is_null($this->cache)) {
            return null;
        }
        $key = $this->getFullCacheKey($k);
        if (\is_null($key)) {
            return null;
        }
        $cacheItem = $this->cache->getItem($key);
        $cacheItem->set($v);
        $cacheItem->expiresAfter($this->cacheConfig['lifetime']);
        return $this->cache->save($cacheItem);
    }
    /**
     * @param null|string $key
     * @return null|string
     */
    private function getFullCacheKey($key)
    {
        if (\is_null($key)) {
            return null;
        }
        $key = $this->cacheConfig['prefix'] . $key;
        // ensure we do not have illegal characters
        $key = \preg_replace('|[^a-zA-Z0-9_\\.!]|', '', $key);
        // Hash keys if they exceed $maxKeyLength (defaults to 64)
        if ($this->maxKeyLength && \strlen($key) > $this->maxKeyLength) {
            $key = \substr(\hash('sha256', $key), 0, $this->maxKeyLength);
        }
        return $key;
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

use Google\Site_Kit_Dependencies\Firebase\JWT\JWT;
use Google\Site_Kit_Dependencies\Firebase\JWT\Key;
use Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache;
use Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory;
use Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Query;
use Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Request;
use Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Utils;
use InvalidArgumentException;
use Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface;
use Google\Site_Kit_Dependencies\Psr\Http\Message\ResponseInterface;
use Google\Site_Kit_Dependencies\Psr\Http\Message\UriInterface;
/**
 * OAuth2 supports authentication by OAuth2 2-legged flows.
 *
 * It primary supports
 * - service account authorization
 * - authorization where a user already has an access token
 */
class OAuth2 implements \Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface
{
    const DEFAULT_EXPIRY_SECONDS = 3600;
    // 1 hour
    const DEFAULT_SKEW_SECONDS = 60;
    // 1 minute
    const JWT_URN = 'urn:ietf:params:oauth:grant-type:jwt-bearer';
    /**
     * TODO: determine known methods from the keys of JWT::methods.
     *
     * @var array<string>
     */
    public static $knownSigningAlgorithms = ['HS256', 'HS512', 'HS384', 'RS256'];
    /**
     * The well known grant types.
     *
     * @var array<string>
     */
    public static $knownGrantTypes = ['authorization_code', 'refresh_token', 'password', 'client_credentials'];
    /**
     * - authorizationUri
     *   The authorization server's HTTP endpoint capable of
     *   authenticating the end-user and obtaining authorization.
     *
     * @var ?UriInterface
     */
    private $authorizationUri;
    /**
     * - tokenCredentialUri
     *   The authorization server's HTTP endpoint capable of issuing
     *   tokens and refreshing expired tokens.
     *
     * @var UriInterface
     */
    private $tokenCredentialUri;
    /**
     * The redirection URI used in the initial request.
     *
     * @var ?string
     */
    private $redirectUri;
    /**
     * A unique identifier issued to the client to identify itself to the
     * authorization server.
     *
     * @var string
     */
    private $clientId;
    /**
     * A shared symmetric secret issued by the authorization server, which is
     * used to authenticate the client.
     *
     * @var string
     */
    private $clientSecret;
    /**
     * The resource owner's username.
     *
     * @var ?string
     */
    private $username;
    /**
     * The resource owner's password.
     *
     * @var ?string
     */
    private $password;
    /**
     * The scope of the access request, expressed either as an Array or as a
     * space-delimited string.
     *
     * @var ?array<string>
     */
    private $scope;
    /**
     * An arbitrary string designed to allow the client to maintain state.
     *
     * @var string
     */
    private $state;
    /**
     * The authorization code issued to this client.
     *
     * Only used by the authorization code access grant type.
     *
     * @var ?string
     */
    private $code;
    /**
     * The issuer ID when using assertion profile.
     *
     * @var ?string
     */
    private $issuer;
    /**
     * The target audience for assertions.
     *
     * @var string
     */
    private $audience;
    /**
     * The target sub when issuing assertions.
     *
     * @var string
     */
    private $sub;
    /**
     * The number of seconds assertions are valid for.
     *
     * @var int
     */
    private $expiry;
    /**
     * The signing key when using assertion profile.
     *
     * @var ?string
     */
    private $signingKey;
    /**
     * The signing key id when using assertion profile. Param kid in jwt header
     *
     * @var string
     */
    private $signingKeyId;
    /**
     * The signing algorithm when using an assertion profile.
     *
     * @var ?string
     */
    private $signingAlgorithm;
    /**
     * The refresh token associated with the access token to be refreshed.
     *
     * @var ?string
     */
    private $refreshToken;
    /**
     * The current access token.
     *
     * @var string
     */
    private $accessToken;
    /**
     * The current ID token.
     *
     * @var string
     */
    private $idToken;
    /**
     * The scopes granted to the current access token
     *
     * @var string
     */
    private $grantedScope;
    /**
     * The lifetime in seconds of the current access token.
     *
     * @var ?int
     */
    private $expiresIn;
    /**
     * The expiration time of the access token as a number of seconds since the
     * unix epoch.
     *
     * @var ?int
     */
    private $expiresAt;
    /**
     * The issue time of the access token as a number of seconds since the unix
     * epoch.
     *
     * @var ?int
     */
    private $issuedAt;
    /**
     * The current grant type.
     *
     * @var ?string
     */
    private $grantType;
    /**
     * When using an extension grant type, this is the set of parameters used by
     * that extension.
     *
     * @var array<mixed>
     */
    private $extensionParams;
    /**
     * When using the toJwt function, these claims will be added to the JWT
     * payload.
     *
     * @var array<mixed>
     */
    private $additionalClaims;
    /**
     * Create a new OAuthCredentials.
     *
     * The configuration array accepts various options
     *
     * - authorizationUri
     *   The authorization server's HTTP endpoint capable of
     *   authenticating the end-user and obtaining authorization.
     *
     * - tokenCredentialUri
     *   The authorization server's HTTP endpoint capable of issuing
     *   tokens and refreshing expired tokens.
     *
     * - clientId
     *   A unique identifier issued to the client to identify itself to the
     *   authorization server.
     *
     * - clientSecret
     *   A shared symmetric secret issued by the authorization server,
     *   which is used to authenticate the client.
     *
     * - scope
     *   The scope of the access request, expressed either as an Array
     *   or as a space-delimited String.
     *
     * - state
     *   An arbitrary string designed to allow the client to maintain state.
     *
     * - redirectUri
     *   The redirection URI used in the initial request.
     *
     * - username
     *   The resource owner's username.
     *
     * - password
     *   The resource owner's password.
     *
     * - issuer
     *   Issuer ID when using assertion profile
     *
     * - audience
     *   Target audience for assertions
     *
     * - expiry
     *   Number of seconds assertions are valid for
     *
     * - signingKey
     *   Signing key when using assertion profile
     *
     * - signingKeyId
     *   Signing key id when using assertion profile
     *
     * - refreshToken
     *   The refresh token associated with the access token
     *   to be refreshed.
     *
     * - accessToken
     *   The current access token for this client.
     *
     * - idToken
     *   The current ID token for this client.
     *
     * - extensionParams
     *   When using an extension grant type, this is the set of parameters used
     *   by that extension.
     *
     * @param array<mixed> $config Configuration array
     */
    public function __construct(array $config)
    {
        $opts = \array_merge(['expiry' => self::DEFAULT_EXPIRY_SECONDS, 'extensionParams' => [], 'authorizationUri' => null, 'redirectUri' => null, 'tokenCredentialUri' => null, 'state' => null, 'username' => null, 'password' => null, 'clientId' => null, 'clientSecret' => null, 'issuer' => null, 'sub' => null, 'audience' => null, 'signingKey' => null, 'signingKeyId' => null, 'signingAlgorithm' => null, 'scope' => null, 'additionalClaims' => []], $config);
        $this->setAuthorizationUri($opts['authorizationUri']);
        $this->setRedirectUri($opts['redirectUri']);
        $this->setTokenCredentialUri($opts['tokenCredentialUri']);
        $this->setState($opts['state']);
        $this->setUsername($opts['username']);
        $this->setPassword($opts['password']);
        $this->setClientId($opts['clientId']);
        $this->setClientSecret($opts['clientSecret']);
        $this->setIssuer($opts['issuer']);
        $this->setSub($opts['sub']);
        $this->setExpiry($opts['expiry']);
        $this->setAudience($opts['audience']);
        $this->setSigningKey($opts['signingKey']);
        $this->setSigningKeyId($opts['signingKeyId']);
        $this->setSigningAlgorithm($opts['signingAlgorithm']);
        $this->setScope($opts['scope']);
        $this->setExtensionParams($opts['extensionParams']);
        $this->setAdditionalClaims($opts['additionalClaims']);
        $this->updateToken($opts);
    }
    /**
     * Verifies the idToken if present.
     *
     * - if none is present, return null
     * - if present, but invalid, raises DomainException.
     * - otherwise returns the payload in the idtoken as a PHP object.
     *
     * The behavior of this method varies depending on the version of
     * `firebase/php-jwt` you are using. In versions 6.0 and above, you cannot
     * provide multiple $allowed_algs, and instead must provide an array of Key
     * objects as the $publicKey.
     *
     * @param string|Key|Key[] $publicKey The public key to use to authenticate the token
     * @param string|array<string> $allowed_algs algorithm or array of supported verification algorithms.
     *        Providing more than one algorithm will throw an exception.
     * @throws \DomainException if the token is missing an audience.
     * @throws \DomainException if the audience does not match the one set in
     *         the OAuth2 class instance.
     * @throws \UnexpectedValueException If the token is invalid
     * @throws \InvalidArgumentException If more than one value for allowed_algs is supplied
     * @throws \Firebase\JWT\SignatureInvalidException If the signature is invalid.
     * @throws \Firebase\JWT\BeforeValidException If the token is not yet valid.
     * @throws \Firebase\JWT\ExpiredException If the token has expired.
     * @return null|object
     */
    public function verifyIdToken($publicKey = null, $allowed_algs = [])
    {
        $idToken = $this->getIdToken();
        if (\is_null($idToken)) {
            return null;
        }
        $resp = $this->jwtDecode($idToken, $publicKey, $allowed_algs);
        if (!\property_exists($resp, 'aud')) {
            throw new \DomainException('No audience found the id token');
        }
        if ($resp->aud != $this->getAudience()) {
            throw new \DomainException('Wrong audience present in the id token');
        }
        return $resp;
    }
    /**
     * Obtains the encoded jwt from the instance data.
     *
     * @param array<mixed> $config array optional configuration parameters
     * @return string
     */
    public function toJwt(array $config = [])
    {
        if (\is_null($this->getSigningKey())) {
            throw new \DomainException('No signing key available');
        }
        if (\is_null($this->getSigningAlgorithm())) {
            throw new \DomainException('No signing algorithm specified');
        }
        $now = \time();
        $opts = \array_merge(['skew' => self::DEFAULT_SKEW_SECONDS], $config);
        $assertion = ['iss' => $this->getIssuer(), 'exp' => $now + $this->getExpiry(), 'iat' => $now - $opts['skew']];
        foreach ($assertion as $k => $v) {
            if (\is_null($v)) {
                throw new \DomainException($k . ' should not be null');
            }
        }
        if (!\is_null($this->getAudience())) {
            $assertion['aud'] = $this->getAudience();
        }
        if (!\is_null($this->getScope())) {
            $assertion['scope'] = $this->getScope();
        }
        if (empty($assertion['scope']) && empty($assertion['aud'])) {
            throw new \DomainException('one of scope or aud should not be null');
        }
        if (!\is_null($this->getSub())) {
            $assertion['sub'] = $this->getSub();
        }
        $assertion += $this->getAdditionalClaims();
        return \Google\Site_Kit_Dependencies\Firebase\JWT\JWT::encode($assertion, $this->getSigningKey(), $this->getSigningAlgorithm(), $this->getSigningKeyId());
    }
    /**
     * Generates a request for token credentials.
     *
     * @return RequestInterface the authorization Url.
     */
    public function generateCredentialsRequest()
    {
        $uri = $this->getTokenCredentialUri();
        if (\is_null($uri)) {
            throw new \DomainException('No token credential URI was set.');
        }
        $grantType = $this->getGrantType();
        $params = ['grant_type' => $grantType];
        switch ($grantType) {
            case 'authorization_code':
                $params['code'] = $this->getCode();
                $params['redirect_uri'] = $this->getRedirectUri();
                $this->addClientCredentials($params);
                break;
            case 'password':
                $params['username'] = $this->getUsername();
                $params['password'] = $this->getPassword();
                $this->addClientCredentials($params);
                break;
            case 'refresh_token':
                $params['refresh_token'] = $this->getRefreshToken();
                $this->addClientCredentials($params);
                break;
            case self::JWT_URN:
                $params['assertion'] = $this->toJwt();
                break;
            default:
                if (!\is_null($this->getRedirectUri())) {
                    # Grant type was supposed to be 'authorization_code', as there
                    # is a redirect URI.
                    throw new \DomainException('Missing authorization code');
                }
                unset($params['grant_type']);
                if (!\is_null($grantType)) {
                    $params['grant_type'] = $grantType;
                }
                $params = \array_merge($params, $this->getExtensionParams());
        }
        $headers = ['Cache-Control' => 'no-store', 'Content-Type' => 'application/x-www-form-urlencoded'];
        return new \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Request('POST', $uri, $headers, \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Query::build($params));
    }
    /**
     * Fetches the auth tokens based on the current state.
     *
     * @param callable $httpHandler callback which delivers psr7 request
     * @return array<mixed> the response
     */
    public function fetchAuthToken(callable $httpHandler = null)
    {
        if (\is_null($httpHandler)) {
            $httpHandler = \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory::build(\Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache::getHttpClient());
        }
        $response = $httpHandler($this->generateCredentialsRequest());
        $credentials = $this->parseTokenResponse($response);
        $this->updateToken($credentials);
        if (isset($credentials['scope'])) {
            $this->setGrantedScope($credentials['scope']);
        }
        return $credentials;
    }
    /**
     * Obtains a key that can used to cache the results of #fetchAuthToken.
     *
     * The key is derived from the scopes.
     *
     * @return ?string a key that may be used to cache the auth token.
     */
    public function getCacheKey()
    {
        if (\is_array($this->scope)) {
            return \implode(':', $this->scope);
        }
        if ($this->audience) {
            return $this->audience;
        }
        // If scope has not set, return null to indicate no caching.
        return null;
    }
    /**
     * Parses the fetched tokens.
     *
     * @param ResponseInterface $resp the response.
     * @return array<mixed> the tokens parsed from the response body.
     * @throws \Exception
     */
    public function parseTokenResponse(\Google\Site_Kit_Dependencies\Psr\Http\Message\ResponseInterface $resp)
    {
        $body = (string) $resp->getBody();
        if ($resp->hasHeader('Content-Type') && $resp->getHeaderLine('Content-Type') == 'application/x-www-form-urlencoded') {
            $res = [];
            \parse_str($body, $res);
            return $res;
        }
        // Assume it's JSON; if it's not throw an exception
        if (null === ($res = \json_decode($body, \true))) {
            throw new \Exception('Invalid JSON response');
        }
        return $res;
    }
    /**
     * Updates an OAuth 2.0 client.
     *
     * Example:
     * ```
     * $oauth->updateToken([
     *     'refresh_token' => 'n4E9O119d',
     *     'access_token' => 'FJQbwq9',
     *     'expires_in' => 3600
     * ]);
     * ```
     *
     * @param array<mixed> $config
     *  The configuration parameters related to the token.
     *
     *  - refresh_token
     *    The refresh token associated with the access token
     *    to be refreshed.
     *
     *  - access_token
     *    The current access token for this client.
     *
     *  - id_token
     *    The current ID token for this client.
     *
     *  - expires_in
     *    The time in seconds until access token expiration.
     *
     *  - expires_at
     *    The time as an integer number of seconds since the Epoch
     *
     *  - issued_at
     *    The timestamp that the token was issued at.
     * @return void
     */
    public function updateToken(array $config)
    {
        $opts = \array_merge(['extensionParams' => [], 'access_token' => null, 'id_token' => null, 'expires_in' => null, 'expires_at' => null, 'issued_at' => null, 'scope' => null], $config);
        $this->setExpiresAt($opts['expires_at']);
        $this->setExpiresIn($opts['expires_in']);
        // By default, the token is issued at `Time.now` when `expiresIn` is set,
        // but this can be used to supply a more precise time.
        if (!\is_null($opts['issued_at'])) {
            $this->setIssuedAt($opts['issued_at']);
        }
        $this->setAccessToken($opts['access_token']);
        $this->setIdToken($opts['id_token']);
        // The refresh token should only be updated if a value is explicitly
        // passed in, as some access token responses do not include a refresh
        // token.
        if (\array_key_exists('refresh_token', $opts)) {
            $this->setRefreshToken($opts['refresh_token']);
        }
    }
    /**
     * Builds the authorization Uri that the user should be redirected to.
     *
     * @param array<mixed> $config configuration options that customize the return url
     * @return UriInterface the authorization Url.
     * @throws InvalidArgumentException
     */
    public function buildFullAuthorizationUri(array $config = [])
    {
        if (\is_null($this->getAuthorizationUri())) {
            throw new \InvalidArgumentException('requires an authorizationUri to have been set');
        }
        $params = \array_merge(['response_type' => 'code', 'access_type' => 'offline', 'client_id' => $this->clientId, 'redirect_uri' => $this->redirectUri, 'state' => $this->state, 'scope' => $this->getScope()], $config);
        // Validate the auth_params
        if (\is_null($params['client_id'])) {
            throw new \InvalidArgumentException('missing the required client identifier');
        }
        if (\is_null($params['redirect_uri'])) {
            throw new \InvalidArgumentException('missing the required redirect URI');
        }
        if (!empty($params['prompt']) && !empty($params['approval_prompt'])) {
            throw new \InvalidArgumentException('prompt and approval_prompt are mutually exclusive');
        }
        // Construct the uri object; return it if it is valid.
        $result = clone $this->authorizationUri;
        $existingParams = \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Query::parse($result->getQuery());
        $result = $result->withQuery(\Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Query::build(\array_merge($existingParams, $params)));
        if ($result->getScheme() != 'https') {
            throw new \InvalidArgumentException('Authorization endpoint must be protected by TLS');
        }
        return $result;
    }
    /**
     * Sets the authorization server's HTTP endpoint capable of authenticating
     * the end-user and obtaining authorization.
     *
     * @param string $uri
     * @return void
     */
    public function setAuthorizationUri($uri)
    {
        $this->authorizationUri = $this->coerceUri($uri);
    }
    /**
     * Gets the authorization server's HTTP endpoint capable of authenticating
     * the end-user and obtaining authorization.
     *
     * @return ?UriInterface
     */
    public function getAuthorizationUri()
    {
        return $this->authorizationUri;
    }
    /**
     * Gets the authorization server's HTTP endpoint capable of issuing tokens
     * and refreshing expired tokens.
     *
     * @return ?UriInterface
     */
    public function getTokenCredentialUri()
    {
        return $this->tokenCredentialUri;
    }
    /**
     * Sets the authorization server's HTTP endpoint capable of issuing tokens
     * and refreshing expired tokens.
     *
     * @param string $uri
     * @return void
     */
    public function setTokenCredentialUri($uri)
    {
        $this->tokenCredentialUri = $this->coerceUri($uri);
    }
    /**
     * Gets the redirection URI used in the initial request.
     *
     * @return ?string
     */
    public function getRedirectUri()
    {
        return $this->redirectUri;
    }
    /**
     * Sets the redirection URI used in the initial request.
     *
     * @param ?string $uri
     * @return void
     */
    public function setRedirectUri($uri)
    {
        if (\is_null($uri)) {
            $this->redirectUri = null;
            return;
        }
        // redirect URI must be absolute
        if (!$this->isAbsoluteUri($uri)) {
            // "postmessage" is a reserved URI string in Google-land
            // @see https://developers.google.com/identity/sign-in/web/server-side-flow
            if ('postmessage' !== (string) $uri) {
                throw new \InvalidArgumentException('Redirect URI must be absolute');
            }
        }
        $this->redirectUri = (string) $uri;
    }
    /**
     * Gets the scope of the access requests as a space-delimited String.
     *
     * @return ?string
     */
    public function getScope()
    {
        if (\is_null($this->scope)) {
            return $this->scope;
        }
        return \implode(' ', $this->scope);
    }
    /**
     * Sets the scope of the access request, expressed either as an Array or as
     * a space-delimited String.
     *
     * @param string|array<string>|null $scope
     * @return void
     * @throws InvalidArgumentException
     */
    public function setScope($scope)
    {
        if (\is_null($scope)) {
            $this->scope = null;
        } elseif (\is_string($scope)) {
            $this->scope = \explode(' ', $scope);
        } elseif (\is_array($scope)) {
            foreach ($scope as $s) {
                $pos = \strpos($s, ' ');
                if ($pos !== \false) {
                    throw new \InvalidArgumentException('array scope values should not contain spaces');
                }
            }
            $this->scope = $scope;
        } else {
            throw new \InvalidArgumentException('scopes should be a string or array of strings');
        }
    }
    /**
     * Gets the current grant type.
     *
     * @return ?string
     */
    public function getGrantType()
    {
        if (!\is_null($this->grantType)) {
            return $this->grantType;
        }
        // Returns the inferred grant type, based on the current object instance
        // state.
        if (!\is_null($this->code)) {
            return 'authorization_code';
        }
        if (!\is_null($this->refreshToken)) {
            return 'refresh_token';
        }
        if (!\is_null($this->username) && !\is_null($this->password)) {
            return 'password';
        }
        if (!\is_null($this->issuer) && !\is_null($this->signingKey)) {
            return self::JWT_URN;
        }
        return null;
    }
    /**
     * Sets the current grant type.
     *
     * @param string $grantType
     * @return void
     * @throws InvalidArgumentException
     */
    public function setGrantType($grantType)
    {
        if (\in_array($grantType, self::$knownGrantTypes)) {
            $this->grantType = $grantType;
        } else {
            // validate URI
            if (!$this->isAbsoluteUri($grantType)) {
                throw new \InvalidArgumentException('invalid grant type');
            }
            $this->grantType = (string) $grantType;
        }
    }
    /**
     * Gets an arbitrary string designed to allow the client to maintain state.
     *
     * @return string
     */
    public function getState()
    {
        return $this->state;
    }
    /**
     * Sets an arbitrary string designed to allow the client to maintain state.
     *
     * @param string $state
     * @return void
     */
    public function setState($state)
    {
        $this->state = $state;
    }
    /**
     * Gets the authorization code issued to this client.
     *
     * @return string
     */
    public function getCode()
    {
        return $this->code;
    }
    /**
     * Sets the authorization code issued to this client.
     *
     * @param string $code
     * @return void
     */
    public function setCode($code)
    {
        $this->code = $code;
    }
    /**
     * Gets the resource owner's username.
     *
     * @return string
     */
    public function getUsername()
    {
        return $this->username;
    }
    /**
     * Sets the resource owner's username.
     *
     * @param string $username
     * @return void
     */
    public function setUsername($username)
    {
        $this->username = $username;
    }
    /**
     * Gets the resource owner's password.
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }
    /**
     * Sets the resource owner's password.
     *
     * @param string $password
     * @return void
     */
    public function setPassword($password)
    {
        $this->password = $password;
    }
    /**
     * Sets a unique identifier issued to the client to identify itself to the
     * authorization server.
     *
     * @return string
     */
    public function getClientId()
    {
        return $this->clientId;
    }
    /**
     * Sets a unique identifier issued to the client to identify itself to the
     * authorization server.
     *
     * @param string $clientId
     * @return void
     */
    public function setClientId($clientId)
    {
        $this->clientId = $clientId;
    }
    /**
     * Gets a shared symmetric secret issued by the authorization server, which
     * is used to authenticate the client.
     *
     * @return string
     */
    public function getClientSecret()
    {
        return $this->clientSecret;
    }
    /**
     * Sets a shared symmetric secret issued by the authorization server, which
     * is used to authenticate the client.
     *
     * @param string $clientSecret
     * @return void
     */
    public function setClientSecret($clientSecret)
    {
        $this->clientSecret = $clientSecret;
    }
    /**
     * Gets the Issuer ID when using assertion profile.
     *
     * @return ?string
     */
    public function getIssuer()
    {
        return $this->issuer;
    }
    /**
     * Sets the Issuer ID when using assertion profile.
     *
     * @param string $issuer
     * @return void
     */
    public function setIssuer($issuer)
    {
        $this->issuer = $issuer;
    }
    /**
     * Gets the target sub when issuing assertions.
     *
     * @return ?string
     */
    public function getSub()
    {
        return $this->sub;
    }
    /**
     * Sets the target sub when issuing assertions.
     *
     * @param string $sub
     * @return void
     */
    public function setSub($sub)
    {
        $this->sub = $sub;
    }
    /**
     * Gets the target audience when issuing assertions.
     *
     * @return ?string
     */
    public function getAudience()
    {
        return $this->audience;
    }
    /**
     * Sets the target audience when issuing assertions.
     *
     * @param string $audience
     * @return void
     */
    public function setAudience($audience)
    {
        $this->audience = $audience;
    }
    /**
     * Gets the signing key when using an assertion profile.
     *
     * @return ?string
     */
    public function getSigningKey()
    {
        return $this->signingKey;
    }
    /**
     * Sets the signing key when using an assertion profile.
     *
     * @param string $signingKey
     * @return void
     */
    public function setSigningKey($signingKey)
    {
        $this->signingKey = $signingKey;
    }
    /**
     * Gets the signing key id when using an assertion profile.
     *
     * @return ?string
     */
    public function getSigningKeyId()
    {
        return $this->signingKeyId;
    }
    /**
     * Sets the signing key id when using an assertion profile.
     *
     * @param string $signingKeyId
     * @return void
     */
    public function setSigningKeyId($signingKeyId)
    {
        $this->signingKeyId = $signingKeyId;
    }
    /**
     * Gets the signing algorithm when using an assertion profile.
     *
     * @return ?string
     */
    public function getSigningAlgorithm()
    {
        return $this->signingAlgorithm;
    }
    /**
     * Sets the signing algorithm when using an assertion profile.
     *
     * @param ?string $signingAlgorithm
     * @return void
     */
    public function setSigningAlgorithm($signingAlgorithm)
    {
        if (\is_null($signingAlgorithm)) {
            $this->signingAlgorithm = null;
        } elseif (!\in_array($signingAlgorithm, self::$knownSigningAlgorithms)) {
            throw new \InvalidArgumentException('unknown signing algorithm');
        } else {
            $this->signingAlgorithm = $signingAlgorithm;
        }
    }
    /**
     * Gets the set of parameters used by extension when using an extension
     * grant type.
     *
     * @return array<mixed>
     */
    public function getExtensionParams()
    {
        return $this->extensionParams;
    }
    /**
     * Sets the set of parameters used by extension when using an extension
     * grant type.
     *
     * @param array<mixed> $extensionParams
     * @return void
     */
    public function setExtensionParams($extensionParams)
    {
        $this->extensionParams = $extensionParams;
    }
    /**
     * Gets the number of seconds assertions are valid for.
     *
     * @return int
     */
    public function getExpiry()
    {
        return $this->expiry;
    }
    /**
     * Sets the number of seconds assertions are valid for.
     *
     * @param int $expiry
     * @return void
     */
    public function setExpiry($expiry)
    {
        $this->expiry = $expiry;
    }
    /**
     * Gets the lifetime of the access token in seconds.
     *
     * @return int
     */
    public function getExpiresIn()
    {
        return $this->expiresIn;
    }
    /**
     * Sets the lifetime of the access token in seconds.
     *
     * @param ?int $expiresIn
     * @return void
     */
    public function setExpiresIn($expiresIn)
    {
        if (\is_null($expiresIn)) {
            $this->expiresIn = null;
            $this->issuedAt = null;
        } else {
            $this->issuedAt = \time();
            $this->expiresIn = (int) $expiresIn;
        }
    }
    /**
     * Gets the time the current access token expires at.
     *
     * @return ?int
     */
    public function getExpiresAt()
    {
        if (!\is_null($this->expiresAt)) {
            return $this->expiresAt;
        }
        if (!\is_null($this->issuedAt) && !\is_null($this->expiresIn)) {
            return $this->issuedAt + $this->expiresIn;
        }
        return null;
    }
    /**
     * Returns true if the acccess token has expired.
     *
     * @return bool
     */
    public function isExpired()
    {
        $expiration = $this->getExpiresAt();
        $now = \time();
        return !\is_null($expiration) && $now >= $expiration;
    }
    /**
     * Sets the time the current access token expires at.
     *
     * @param int $expiresAt
     * @return void
     */
    public function setExpiresAt($expiresAt)
    {
        $this->expiresAt = $expiresAt;
    }
    /**
     * Gets the time the current access token was issued at.
     *
     * @return ?int
     */
    public function getIssuedAt()
    {
        return $this->issuedAt;
    }
    /**
     * Sets the time the current access token was issued at.
     *
     * @param int $issuedAt
     * @return void
     */
    public function setIssuedAt($issuedAt)
    {
        $this->issuedAt = $issuedAt;
    }
    /**
     * Gets the current access token.
     *
     * @return ?string
     */
    public function getAccessToken()
    {
        return $this->accessToken;
    }
    /**
     * Sets the current access token.
     *
     * @param string $accessToken
     * @return void
     */
    public function setAccessToken($accessToken)
    {
        $this->accessToken = $accessToken;
    }
    /**
     * Gets the current ID token.
     *
     * @return ?string
     */
    public function getIdToken()
    {
        return $this->idToken;
    }
    /**
     * Sets the current ID token.
     *
     * @param string $idToken
     * @return void
     */
    public function setIdToken($idToken)
    {
        $this->idToken = $idToken;
    }
    /**
     * Get the granted scopes (if they exist) for the last fetched token.
     *
     * @return string|null
     */
    public function getGrantedScope()
    {
        return $this->grantedScope;
    }
    /**
     * Sets the current ID token.
     *
     * @param string $grantedScope
     * @return void
     */
    public function setGrantedScope($grantedScope)
    {
        $this->grantedScope = $grantedScope;
    }
    /**
     * Gets the refresh token associated with the current access token.
     *
     * @return ?string
     */
    public function getRefreshToken()
    {
        return $this->refreshToken;
    }
    /**
     * Sets the refresh token associated with the current access token.
     *
     * @param string $refreshToken
     * @return void
     */
    public function setRefreshToken($refreshToken)
    {
        $this->refreshToken = $refreshToken;
    }
    /**
     * Sets additional claims to be included in the JWT token
     *
     * @param array<mixed> $additionalClaims
     * @return void
     */
    public function setAdditionalClaims(array $additionalClaims)
    {
        $this->additionalClaims = $additionalClaims;
    }
    /**
     * Gets the additional claims to be included in the JWT token.
     *
     * @return array<mixed>
     */
    public function getAdditionalClaims()
    {
        return $this->additionalClaims;
    }
    /**
     * The expiration of the last received token.
     *
     * @return array<mixed>|null
     */
    public function getLastReceivedToken()
    {
        if ($token = $this->getAccessToken()) {
            // the bare necessity of an auth token
            $authToken = ['access_token' => $token, 'expires_at' => $this->getExpiresAt()];
        } elseif ($idToken = $this->getIdToken()) {
            $authToken = ['id_token' => $idToken, 'expires_at' => $this->getExpiresAt()];
        } else {
            return null;
        }
        if ($expiresIn = $this->getExpiresIn()) {
            $authToken['expires_in'] = $expiresIn;
        }
        if ($issuedAt = $this->getIssuedAt()) {
            $authToken['issued_at'] = $issuedAt;
        }
        if ($refreshToken = $this->getRefreshToken()) {
            $authToken['refresh_token'] = $refreshToken;
        }
        return $authToken;
    }
    /**
     * Get the client ID.
     *
     * Alias of {@see Google\Auth\OAuth2::getClientId()}.
     *
     * @param callable $httpHandler
     * @return string
     * @access private
     */
    public function getClientName(callable $httpHandler = null)
    {
        return $this->getClientId();
    }
    /**
     * @todo handle uri as array
     *
     * @param ?string $uri
     * @return null|UriInterface
     */
    private function coerceUri($uri)
    {
        if (\is_null($uri)) {
            return null;
        }
        return \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Utils::uriFor($uri);
    }
    /**
     * @param string $idToken
     * @param Key|Key[]|string|string[] $publicKey
     * @param string|string[] $allowedAlgs
     * @return object
     */
    private function jwtDecode($idToken, $publicKey, $allowedAlgs)
    {
        $keys = $this->getFirebaseJwtKeys($publicKey, $allowedAlgs);
        // Default exception if none are caught. We are using the same exception
        // class and message from firebase/php-jwt to preserve backwards
        // compatibility.
        $e = new \InvalidArgumentException('Key may not be empty');
        foreach ($keys as $key) {
            try {
                return \Google\Site_Kit_Dependencies\Firebase\JWT\JWT::decode($idToken, $key);
            } catch (\Exception $e) {
                // try next alg
            }
        }
        throw $e;
    }
    /**
     * @param Key|Key[]|string|string[] $publicKey
     * @param string|string[] $allowedAlgs
     * @return Key[]
     */
    private function getFirebaseJwtKeys($publicKey, $allowedAlgs)
    {
        // If $publicKey is instance of Key, return it
        if ($publicKey instanceof \Google\Site_Kit_Dependencies\Firebase\JWT\Key) {
            return [$publicKey];
        }
        // If $allowedAlgs is empty, $publicKey must be Key or Key[].
        if (empty($allowedAlgs)) {
            $keys = [];
            foreach ((array) $publicKey as $kid => $pubKey) {
                if (!$pubKey instanceof \Google\Site_Kit_Dependencies\Firebase\JWT\Key) {
                    throw new \InvalidArgumentException(\sprintf('When allowed algorithms is empty, the public key must' . 'be an instance of %s or an array of %s objects', \Google\Site_Kit_Dependencies\Firebase\JWT\Key::class, \Google\Site_Kit_Dependencies\Firebase\JWT\Key::class));
                }
                $keys[$kid] = $pubKey;
            }
            return $keys;
        }
        $allowedAlg = null;
        if (\is_string($allowedAlgs)) {
            $allowedAlg = $allowedAlg;
        } elseif (\is_array($allowedAlgs)) {
            if (\count($allowedAlgs) > 1) {
                throw new \InvalidArgumentException('To have multiple allowed algorithms, You must provide an' . ' array of Firebase\\JWT\\Key objects.' . ' See https://github.com/firebase/php-jwt for more information.');
            }
            $allowedAlg = \array_pop($allowedAlgs);
        } else {
            throw new \InvalidArgumentException('allowed algorithms must be a string or array.');
        }
        if (\is_array($publicKey)) {
            // When publicKey is greater than 1, create keys with the single alg.
            $keys = [];
            foreach ($publicKey as $kid => $pubKey) {
                if ($pubKey instanceof \Google\Site_Kit_Dependencies\Firebase\JWT\Key) {
                    $keys[$kid] = $pubKey;
                } else {
                    $keys[$kid] = new \Google\Site_Kit_Dependencies\Firebase\JWT\Key($pubKey, $allowedAlg);
                }
            }
            return $keys;
        }
        return [new \Google\Site_Kit_Dependencies\Firebase\JWT\Key($publicKey, $allowedAlg)];
    }
    /**
     * Determines if the URI is absolute based on its scheme and host or path
     * (RFC 3986).
     *
     * @param string $uri
     * @return bool
     */
    private function isAbsoluteUri($uri)
    {
        $uri = $this->coerceUri($uri);
        return $uri->getScheme() && ($uri->getHost() || $uri->getPath());
    }
    /**
     * @param array<mixed> $params
     * @return array<mixed>
     */
    private function addClientCredentials(&$params)
    {
        $clientId = $this->getClientId();
        $clientSecret = $this->getClientSecret();
        if ($clientId && $clientSecret) {
            $params['client_id'] = $clientId;
            $params['client_secret'] = $clientSecret;
        }
        return $params;
    }
}
<?php

/*
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

/**
 * An interface implemented by objects that can get quota projects.
 */
interface GetQuotaProjectInterface
{
    const X_GOOG_USER_PROJECT_HEADER = 'X-Goog-User-Project';
    /**
     * Get the quota project used for this API request
     *
     * @return string|null
     */
    public function getQuotaProject();
}
<?php

/**
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\HttpHandler;

use Google\Site_Kit_Dependencies\GuzzleHttp\ClientInterface;
use Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface;
use Google\Site_Kit_Dependencies\Psr\Http\Message\ResponseInterface;
class Guzzle6HttpHandler
{
    /**
     * @var ClientInterface
     */
    private $client;
    /**
     * @param ClientInterface $client
     */
    public function __construct(\Google\Site_Kit_Dependencies\GuzzleHttp\ClientInterface $client)
    {
        $this->client = $client;
    }
    /**
     * Accepts a PSR-7 request and an array of options and returns a PSR-7 response.
     *
     * @param RequestInterface $request
     * @param array<mixed> $options
     * @return ResponseInterface
     */
    public function __invoke(\Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface $request, array $options = [])
    {
        return $this->client->send($request, $options);
    }
    /**
     * Accepts a PSR-7 request and an array of options and returns a PromiseInterface
     *
     * @param RequestInterface $request
     * @param array<mixed> $options
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function async(\Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface $request, array $options = [])
    {
        return $this->client->sendAsync($request, $options);
    }
}
<?php

/**
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\HttpHandler;

use Exception;
use Google\Site_Kit_Dependencies\GuzzleHttp\ClientInterface;
use Google\Site_Kit_Dependencies\GuzzleHttp\Message\ResponseInterface as Guzzle5ResponseInterface;
use Google\Site_Kit_Dependencies\GuzzleHttp\Promise\Promise;
use Google\Site_Kit_Dependencies\GuzzleHttp\Promise\RejectedPromise;
use Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Response;
use Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface;
use Google\Site_Kit_Dependencies\Psr\Http\Message\ResponseInterface;
/**
 * @deprecated
 */
class Guzzle5HttpHandler
{
    /**
     * @var ClientInterface
     */
    private $client;
    /**
     * @param ClientInterface $client
     */
    public function __construct(\Google\Site_Kit_Dependencies\GuzzleHttp\ClientInterface $client)
    {
        $this->client = $client;
    }
    /**
     * Accepts a PSR-7 Request and an array of options and returns a PSR-7 response.
     *
     * @param RequestInterface $request
     * @param array $options
     * @return ResponseInterface
     */
    public function __invoke(\Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface $request, array $options = [])
    {
        $response = $this->client->send($this->createGuzzle5Request($request, $options));
        return $this->createPsr7Response($response);
    }
    /**
     * Accepts a PSR-7 request and an array of options and returns a PromiseInterface
     *
     * @param RequestInterface $request
     * @param array $options
     * @return Promise
     */
    public function async(\Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface $request, array $options = [])
    {
        if (!\class_exists('Google\\Site_Kit_Dependencies\\GuzzleHttp\\Promise\\Promise')) {
            throw new \Exception('Install guzzlehttp/promises to use async with Guzzle 5');
        }
        $futureResponse = $this->client->send($this->createGuzzle5Request($request, ['future' => \true] + $options));
        $promise = new \Google\Site_Kit_Dependencies\GuzzleHttp\Promise\Promise(function () use($futureResponse) {
            try {
                $futureResponse->wait();
            } catch (\Exception $e) {
                // The promise is already delivered when the exception is
                // thrown, so don't rethrow it.
            }
        }, [$futureResponse, 'cancel']);
        $futureResponse->then([$promise, 'resolve'], [$promise, 'reject']);
        return $promise->then(function (\Google\Site_Kit_Dependencies\GuzzleHttp\Message\ResponseInterface $response) {
            // Adapt the Guzzle 5 Response to a PSR-7 Response.
            return $this->createPsr7Response($response);
        }, function (\Exception $e) {
            return new \Google\Site_Kit_Dependencies\GuzzleHttp\Promise\RejectedPromise($e);
        });
    }
    private function createGuzzle5Request(\Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface $request, array $options)
    {
        return $this->client->createRequest($request->getMethod(), $request->getUri(), \array_merge_recursive(['headers' => $request->getHeaders(), 'body' => $request->getBody()], $options));
    }
    private function createPsr7Response(\Google\Site_Kit_Dependencies\GuzzleHttp\Message\ResponseInterface $response)
    {
        return new \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Response($response->getStatusCode(), $response->getHeaders() ?: [], $response->getBody(), $response->getProtocolVersion(), $response->getReasonPhrase());
    }
}
<?php

/*
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\HttpHandler;

use Google\Site_Kit_Dependencies\GuzzleHttp\ClientInterface;
/**
 * Stores an HTTP Client in order to prevent multiple instantiations.
 */
class HttpClientCache
{
    /**
     * @var ClientInterface|null
     */
    private static $httpClient;
    /**
     * Cache an HTTP Client for later calls.
     *
     * Passing null will unset the cached client.
     *
     * @param ClientInterface|null $client
     * @return void
     */
    public static function setHttpClient(\Google\Site_Kit_Dependencies\GuzzleHttp\ClientInterface $client = null)
    {
        self::$httpClient = $client;
    }
    /**
     * Get the stored HTTP Client, or null.
     *
     * @return ClientInterface|null
     */
    public static function getHttpClient()
    {
        return self::$httpClient;
    }
}
<?php

/**
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\HttpHandler;

use Google\Site_Kit_Dependencies\GuzzleHttp\BodySummarizer;
use Google\Site_Kit_Dependencies\GuzzleHttp\Client;
use Google\Site_Kit_Dependencies\GuzzleHttp\ClientInterface;
use Google\Site_Kit_Dependencies\GuzzleHttp\HandlerStack;
use Google\Site_Kit_Dependencies\GuzzleHttp\Middleware;
class HttpHandlerFactory
{
    /**
     * Builds out a default http handler for the installed version of guzzle.
     *
     * @param ClientInterface $client
     * @return Guzzle5HttpHandler|Guzzle6HttpHandler|Guzzle7HttpHandler
     * @throws \Exception
     */
    public static function build(\Google\Site_Kit_Dependencies\GuzzleHttp\ClientInterface $client = null)
    {
        if (\is_null($client)) {
            $stack = null;
            if (\class_exists(\Google\Site_Kit_Dependencies\GuzzleHttp\BodySummarizer::class)) {
                // double the # of characters before truncation by default
                $bodySummarizer = new \Google\Site_Kit_Dependencies\GuzzleHttp\BodySummarizer(240);
                $stack = \Google\Site_Kit_Dependencies\GuzzleHttp\HandlerStack::create();
                $stack->remove('http_errors');
                $stack->unshift(\Google\Site_Kit_Dependencies\GuzzleHttp\Middleware::httpErrors($bodySummarizer), 'http_errors');
            }
            $client = new \Google\Site_Kit_Dependencies\GuzzleHttp\Client(['handler' => $stack]);
        }
        $version = null;
        if (\defined('Google\\Site_Kit_Dependencies\\GuzzleHttp\\ClientInterface::MAJOR_VERSION')) {
            $version = \Google\Site_Kit_Dependencies\GuzzleHttp\ClientInterface::MAJOR_VERSION;
        } elseif (\defined('Google\\Site_Kit_Dependencies\\GuzzleHttp\\ClientInterface::VERSION')) {
            $version = (int) \substr(\Google\Site_Kit_Dependencies\GuzzleHttp\ClientInterface::VERSION, 0, 1);
        }
        switch ($version) {
            case 5:
                return new \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\Guzzle5HttpHandler($client);
            case 6:
                return new \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\Guzzle6HttpHandler($client);
            case 7:
                return new \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\Guzzle7HttpHandler($client);
            default:
                throw new \Exception('Version not supported');
        }
    }
}
<?php

/**
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\HttpHandler;

class Guzzle7HttpHandler extends \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\Guzzle6HttpHandler
{
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

/**
 * An interface implemented by objects that can fetch auth tokens.
 */
interface FetchAuthTokenInterface
{
    /**
     * Fetches the auth tokens based on the current state.
     *
     * @param callable $httpHandler callback which delivers psr7 request
     * @return array<mixed> a hash of auth tokens
     */
    public function fetchAuthToken(callable $httpHandler = null);
    /**
     * Obtains a key that can used to cache the results of #fetchAuthToken.
     *
     * If the value is empty, the auth token is not cached.
     *
     * @return string a key that may be used to cache the auth token.
     */
    public function getCacheKey();
    /**
     * Returns an associative array with the token and
     * expiration time.
     *
     * @return null|array<mixed> {
     *     The last received access token.
     *
     *     @type string $access_token The access token string.
     *     @type int $expires_at The time the token expires as a UNIX timestamp.
     * }
     */
    public function getLastReceivedToken();
}
<?php

/*
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

use Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache;
use Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory;
use Google\Site_Kit_Dependencies\GuzzleHttp\Psr7;
use Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Utils;
/**
 * Tools for using the IAM API.
 *
 * @see https://cloud.google.com/iam/docs IAM Documentation
 */
class Iam
{
    const IAM_API_ROOT = 'https://iamcredentials.googleapis.com/v1';
    const SIGN_BLOB_PATH = '%s:signBlob?alt=json';
    const SERVICE_ACCOUNT_NAME = 'projects/-/serviceAccounts/%s';
    /**
     * @var callable
     */
    private $httpHandler;
    /**
     * @param callable $httpHandler [optional] The HTTP Handler to send requests.
     */
    public function __construct(callable $httpHandler = null)
    {
        $this->httpHandler = $httpHandler ?: \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory::build(\Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache::getHttpClient());
    }
    /**
     * Sign a string using the IAM signBlob API.
     *
     * Note that signing using IAM requires your service account to have the
     * `iam.serviceAccounts.signBlob` permission, part of the "Service Account
     * Token Creator" IAM role.
     *
     * @param string $email The service account email.
     * @param string $accessToken An access token from the service account.
     * @param string $stringToSign The string to be signed.
     * @param array<string> $delegates [optional] A list of service account emails to
     *        add to the delegate chain. If omitted, the value of `$email` will
     *        be used.
     * @return string The signed string, base64-encoded.
     */
    public function signBlob($email, $accessToken, $stringToSign, array $delegates = [])
    {
        $httpHandler = $this->httpHandler;
        $name = \sprintf(self::SERVICE_ACCOUNT_NAME, $email);
        $uri = self::IAM_API_ROOT . '/' . \sprintf(self::SIGN_BLOB_PATH, $name);
        if ($delegates) {
            foreach ($delegates as &$delegate) {
                $delegate = \sprintf(self::SERVICE_ACCOUNT_NAME, $delegate);
            }
        } else {
            $delegates = [$name];
        }
        $body = ['delegates' => $delegates, 'payload' => \base64_encode($stringToSign)];
        $headers = ['Authorization' => 'Bearer ' . $accessToken];
        $request = new \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Request('POST', $uri, $headers, \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Utils::streamFor(\json_encode($body)));
        $res = $httpHandler($request);
        $body = \json_decode((string) $res->getBody(), \true);
        return $body['signedBlob'];
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Middleware;

use Google\Site_Kit_Dependencies\Google\Auth\CacheTrait;
use Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface;
use Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface;
/**
 * ScopedAccessTokenMiddleware is a Guzzle Middleware that adds an Authorization
 * header provided by a closure.
 *
 * The closure returns an access token, taking the scope, either a single
 * string or an array of strings, as its value.  If provided, a cache will be
 * used to preserve the access token for a given lifetime.
 *
 * Requests will be accessed with the authorization header:
 *
 * 'authorization' 'Bearer <value of auth_token>'
 */
class ScopedAccessTokenMiddleware
{
    use CacheTrait;
    const DEFAULT_CACHE_LIFETIME = 1500;
    /**
     * @var callable
     */
    private $tokenFunc;
    /**
     * @var array<string>|string
     */
    private $scopes;
    /**
     * Creates a new ScopedAccessTokenMiddleware.
     *
     * @param callable $tokenFunc a token generator function
     * @param array<string>|string $scopes the token authentication scopes
     * @param array<mixed> $cacheConfig configuration for the cache when it's present
     * @param CacheItemPoolInterface $cache an implementation of CacheItemPoolInterface
     */
    public function __construct(callable $tokenFunc, $scopes, array $cacheConfig = null, \Google\Site_Kit_Dependencies\Psr\Cache\CacheItemPoolInterface $cache = null)
    {
        $this->tokenFunc = $tokenFunc;
        if (!(\is_string($scopes) || \is_array($scopes))) {
            throw new \InvalidArgumentException('wants scope should be string or array');
        }
        $this->scopes = $scopes;
        if (!\is_null($cache)) {
            $this->cache = $cache;
            $this->cacheConfig = \array_merge(['lifetime' => self::DEFAULT_CACHE_LIFETIME, 'prefix' => ''], $cacheConfig);
        }
    }
    /**
     * Updates the request with an Authorization header when auth is 'scoped'.
     *
     *   E.g this could be used to authenticate using the AppEngine
     *   AppIdentityService.
     *
     *   use google\appengine\api\app_identity\AppIdentityService;
     *   use Google\Auth\Middleware\ScopedAccessTokenMiddleware;
     *   use GuzzleHttp\Client;
     *   use GuzzleHttp\HandlerStack;
     *
     *   $scope = 'https://www.googleapis.com/auth/taskqueue'
     *   $middleware = new ScopedAccessTokenMiddleware(
     *       'AppIdentityService::getAccessToken',
     *       $scope,
     *       [ 'prefix' => 'Google\Auth\ScopedAccessToken::' ],
     *       $cache = new Memcache()
     *   );
     *   $stack = HandlerStack::create();
     *   $stack->push($middleware);
     *
     *   $client = new Client([
     *       'handler' => $stack,
     *       'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
     *       'auth' => 'scoped' // authorize all requests
     *   ]);
     *
     *   $res = $client->get('myproject/taskqueues/myqueue');
     *
     * @param callable $handler
     * @return \Closure
     */
    public function __invoke(callable $handler)
    {
        return function (\Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface $request, array $options) use($handler) {
            // Requests using "auth"="scoped" will be authorized.
            if (!isset($options['auth']) || $options['auth'] !== 'scoped') {
                return $handler($request, $options);
            }
            $request = $request->withHeader('authorization', 'Bearer ' . $this->fetchToken());
            return $handler($request, $options);
        };
    }
    /**
     * @return string
     */
    private function getCacheKey()
    {
        $key = null;
        if (\is_string($this->scopes)) {
            $key .= $this->scopes;
        } elseif (\is_array($this->scopes)) {
            $key .= \implode(':', $this->scopes);
        }
        return $key;
    }
    /**
     * Determine if token is available in the cache, if not call tokenFunc to
     * fetch it.
     *
     * @return string
     */
    private function fetchToken()
    {
        $cacheKey = $this->getCacheKey();
        $cached = $this->getCachedValue($cacheKey);
        if (!empty($cached)) {
            return $cached;
        }
        $token = \call_user_func($this->tokenFunc, $this->scopes);
        $this->setCachedValue($cacheKey, $token);
        return $token;
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Middleware;

use Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface;
use Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface;
use Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface;
/**
 * AuthTokenMiddleware is a Guzzle Middleware that adds an Authorization header
 * provided by an object implementing FetchAuthTokenInterface.
 *
 * The FetchAuthTokenInterface#fetchAuthToken is used to obtain a hash; one of
 * the values value in that hash is added as the authorization header.
 *
 * Requests will be accessed with the authorization header:
 *
 * 'authorization' 'Bearer <value of auth_token>'
 */
class AuthTokenMiddleware
{
    /**
     * @var callable
     */
    private $httpHandler;
    /**
     * @var FetchAuthTokenInterface
     */
    private $fetcher;
    /**
     * @var ?callable
     */
    private $tokenCallback;
    /**
     * Creates a new AuthTokenMiddleware.
     *
     * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token
     * @param callable $httpHandler (optional) callback which delivers psr7 request
     * @param callable $tokenCallback (optional) function to be called when a new token is fetched.
     */
    public function __construct(\Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface $fetcher, callable $httpHandler = null, callable $tokenCallback = null)
    {
        $this->fetcher = $fetcher;
        $this->httpHandler = $httpHandler;
        $this->tokenCallback = $tokenCallback;
    }
    /**
     * Updates the request with an Authorization header when auth is 'google_auth'.
     *
     *   use Google\Auth\Middleware\AuthTokenMiddleware;
     *   use Google\Auth\OAuth2;
     *   use GuzzleHttp\Client;
     *   use GuzzleHttp\HandlerStack;
     *
     *   $config = [..<oauth config param>.];
     *   $oauth2 = new OAuth2($config)
     *   $middleware = new AuthTokenMiddleware($oauth2);
     *   $stack = HandlerStack::create();
     *   $stack->push($middleware);
     *
     *   $client = new Client([
     *       'handler' => $stack,
     *       'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
     *       'auth' => 'google_auth' // authorize all requests
     *   ]);
     *
     *   $res = $client->get('myproject/taskqueues/myqueue');
     *
     * @param callable $handler
     * @return \Closure
     */
    public function __invoke(callable $handler)
    {
        return function (\Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface $request, array $options) use($handler) {
            // Requests using "auth"="google_auth" will be authorized.
            if (!isset($options['auth']) || $options['auth'] !== 'google_auth') {
                return $handler($request, $options);
            }
            $request = $request->withHeader('authorization', 'Bearer ' . $this->fetchToken());
            if ($quotaProject = $this->getQuotaProject()) {
                $request = $request->withHeader(\Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER, $quotaProject);
            }
            return $handler($request, $options);
        };
    }
    /**
     * Call fetcher to fetch the token.
     *
     * @return string|null
     */
    private function fetchToken()
    {
        $auth_tokens = (array) $this->fetcher->fetchAuthToken($this->httpHandler);
        if (\array_key_exists('access_token', $auth_tokens)) {
            // notify the callback if applicable
            if ($this->tokenCallback) {
                \call_user_func($this->tokenCallback, $this->fetcher->getCacheKey(), $auth_tokens['access_token']);
            }
            return $auth_tokens['access_token'];
        }
        if (\array_key_exists('id_token', $auth_tokens)) {
            return $auth_tokens['id_token'];
        }
        return null;
    }
    /**
     * @return string|null
     */
    private function getQuotaProject()
    {
        if ($this->fetcher instanceof \Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface) {
            return $this->fetcher->getQuotaProject();
        }
        return null;
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Middleware;

use Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface;
use Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface;
use Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface;
/**
 * ProxyAuthTokenMiddleware is a Guzzle Middleware that adds an Authorization header
 * provided by an object implementing FetchAuthTokenInterface.
 *
 * The FetchAuthTokenInterface#fetchAuthToken is used to obtain a hash; one of
 * the values value in that hash is added as the authorization header.
 *
 * Requests will be accessed with the authorization header:
 *
 * 'proxy-authorization' 'Bearer <value of auth_token>'
 */
class ProxyAuthTokenMiddleware
{
    /**
     * @var callable
     */
    private $httpHandler;
    /**
     * @var FetchAuthTokenInterface
     */
    private $fetcher;
    /**
     * @var ?callable
     */
    private $tokenCallback;
    /**
     * Creates a new ProxyAuthTokenMiddleware.
     *
     * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token
     * @param callable $httpHandler (optional) callback which delivers psr7 request
     * @param callable $tokenCallback (optional) function to be called when a new token is fetched.
     */
    public function __construct(\Google\Site_Kit_Dependencies\Google\Auth\FetchAuthTokenInterface $fetcher, callable $httpHandler = null, callable $tokenCallback = null)
    {
        $this->fetcher = $fetcher;
        $this->httpHandler = $httpHandler;
        $this->tokenCallback = $tokenCallback;
    }
    /**
     * Updates the request with an Authorization header when auth is 'google_auth'.
     *
     *   use Google\Auth\Middleware\ProxyAuthTokenMiddleware;
     *   use Google\Auth\OAuth2;
     *   use GuzzleHttp\Client;
     *   use GuzzleHttp\HandlerStack;
     *
     *   $config = [..<oauth config param>.];
     *   $oauth2 = new OAuth2($config)
     *   $middleware = new ProxyAuthTokenMiddleware($oauth2);
     *   $stack = HandlerStack::create();
     *   $stack->push($middleware);
     *
     *   $client = new Client([
     *       'handler' => $stack,
     *       'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
     *       'proxy_auth' => 'google_auth' // authorize all requests
     *   ]);
     *
     *   $res = $client->get('myproject/taskqueues/myqueue');
     *
     * @param callable $handler
     * @return \Closure
     */
    public function __invoke(callable $handler)
    {
        return function (\Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface $request, array $options) use($handler) {
            // Requests using "proxy_auth"="google_auth" will be authorized.
            if (!isset($options['proxy_auth']) || $options['proxy_auth'] !== 'google_auth') {
                return $handler($request, $options);
            }
            $request = $request->withHeader('proxy-authorization', 'Bearer ' . $this->fetchToken());
            if ($quotaProject = $this->getQuotaProject()) {
                $request = $request->withHeader(\Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER, $quotaProject);
            }
            return $handler($request, $options);
        };
    }
    /**
     * Call fetcher to fetch the token.
     *
     * @return string|null
     */
    private function fetchToken()
    {
        $auth_tokens = $this->fetcher->fetchAuthToken($this->httpHandler);
        if (\array_key_exists('access_token', $auth_tokens)) {
            // notify the callback if applicable
            if ($this->tokenCallback) {
                \call_user_func($this->tokenCallback, $this->fetcher->getCacheKey(), $auth_tokens['access_token']);
            }
            return $auth_tokens['access_token'];
        }
        if (\array_key_exists('id_token', $auth_tokens)) {
            return $auth_tokens['id_token'];
        }
        return null;
    }
    /**
     * @return string|null;
     */
    private function getQuotaProject()
    {
        if ($this->fetcher instanceof \Google\Site_Kit_Dependencies\Google\Auth\GetQuotaProjectInterface) {
            return $this->fetcher->getQuotaProject();
        }
        return null;
    }
}
<?php

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth\Middleware;

use Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Query;
use Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface;
/**
 * SimpleMiddleware is a Guzzle Middleware that implements Google's Simple API
 * access.
 *
 * Requests are accessed using the Simple API access developer key.
 */
class SimpleMiddleware
{
    /**
     * @var array<mixed>
     */
    private $config;
    /**
     * Create a new Simple plugin.
     *
     * The configuration array expects one option
     * - key: required, otherwise InvalidArgumentException is thrown
     *
     * @param array<mixed> $config Configuration array
     */
    public function __construct(array $config)
    {
        if (!isset($config['key'])) {
            throw new \InvalidArgumentException('requires a key to have been set');
        }
        $this->config = \array_merge(['key' => null], $config);
    }
    /**
     * Updates the request query with the developer key if auth is set to simple.
     *
     *   use Google\Auth\Middleware\SimpleMiddleware;
     *   use GuzzleHttp\Client;
     *   use GuzzleHttp\HandlerStack;
     *
     *   $my_key = 'is not the same as yours';
     *   $middleware = new SimpleMiddleware(['key' => $my_key]);
     *   $stack = HandlerStack::create();
     *   $stack->push($middleware);
     *
     *   $client = new Client([
     *       'handler' => $stack,
     *       'base_uri' => 'https://www.googleapis.com/discovery/v1/',
     *       'auth' => 'simple'
     *   ]);
     *
     *   $res = $client->get('drive/v2/rest');
     *
     * @param callable $handler
     * @return \Closure
     */
    public function __invoke(callable $handler)
    {
        return function (\Google\Site_Kit_Dependencies\Psr\Http\Message\RequestInterface $request, array $options) use($handler) {
            // Requests using "auth"="scoped" will be authorized.
            if (!isset($options['auth']) || $options['auth'] !== 'simple') {
                return $handler($request, $options);
            }
            $query = \Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Query::parse($request->getUri()->getQuery());
            $params = \array_merge($query, $this->config);
            $uri = $request->getUri()->withQuery(\Google\Site_Kit_Dependencies\GuzzleHttp\Psr7\Query::build($params));
            $request = $request->withUri($uri);
            return $handler($request, $options);
        };
    }
}
<?php

/*
 * Copyright 2022 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Auth;

use Exception;
use Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache;
use Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory;
trait IamSignerTrait
{
    /**
     * @var Iam|null
     */
    private $iam;
    /**
     * Sign a string using the default service account private key.
     *
     * This implementation uses IAM's signBlob API.
     *
     * @see https://cloud.google.com/iam/credentials/reference/rest/v1/projects.serviceAccounts/signBlob SignBlob
     *
     * @param string $stringToSign The string to sign.
     * @param bool $forceOpenSsl [optional] Does not apply to this credentials
     *        type.
     * @param string $accessToken The access token to use to sign the blob. If
     *        provided, saves a call to the metadata server for a new access
     *        token. **Defaults to** `null`.
     * @return string
     * @throws Exception
     */
    public function signBlob($stringToSign, $forceOpenSsl = \false, $accessToken = null)
    {
        $httpHandler = \Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpHandlerFactory::build(\Google\Site_Kit_Dependencies\Google\Auth\HttpHandler\HttpClientCache::getHttpClient());
        // Providing a signer is useful for testing, but it's undocumented
        // because it's not something a user would generally need to do.
        $signer = $this->iam ?: new \Google\Site_Kit_Dependencies\Google\Auth\Iam($httpHandler);
        $email = $this->getClientName($httpHandler);
        if (\is_null($accessToken)) {
            $previousToken = $this->getLastReceivedToken();
            $accessToken = $previousToken ? $previousToken['access_token'] : $this->fetchAuthToken($httpHandler)['access_token'];
        }
        return $signer->signBlob($email, $accessToken, $stringToSign);
    }
}
<?php

namespace Google\Site_Kit_Dependencies;

// For older (pre-2.7.2) verions of google/apiclient
if (\file_exists(__DIR__ . '/../apiclient/src/Google/Client.php') && !\class_exists('Google\\Site_Kit_Dependencies\\Google_Client', \false)) {
    require_once __DIR__ . '/../apiclient/src/Google/Client.php';
    if (\defined('Google_Client::LIBVER') && \version_compare(\Google\Site_Kit_Dependencies\Google_Client::LIBVER, '2.7.2', '<=')) {
        $servicesClassMap = ['Google\\Site_Kit_Dependencies\\Google\\Client' => 'Google_Client', 'Google\\Site_Kit_Dependencies\\Google\\Service' => 'Google_Service', 'Google\\Site_Kit_Dependencies\\Google\\Service\\Resource' => 'Google_Service_Resource', 'Google\\Site_Kit_Dependencies\\Google\\Model' => 'Google_Model', 'Google\\Site_Kit_Dependencies\\Google\\Collection' => 'Google_Collection'];
        foreach ($servicesClassMap as $alias => $class) {
            \class_alias($class, $alias);
        }
    }
}
\spl_autoload_register(function ($class) {
    if (0 === \strpos($class, 'Google_Service_')) {
        // Autoload the new class, which will also create an alias for the
        // old class by changing underscores to namespaces:
        //     Google_Service_Speech_Resource_Operations
        //      => Google\Service\Speech\Resource\Operations
        $classExists = \class_exists($newClass = \str_replace('_', '\\', $class));
        if ($classExists) {
            return \true;
        }
    }
}, \true, \true);
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service;

use Google\Site_Kit_Dependencies\Google\Client;
/**
 * Service definition for GoogleAnalyticsAdmin (v1beta).
 *
 * <p>
 * Manage properties in Google Analytics. Warning: Creating multiple Customer
 * Applications, Accounts, or Projects to simulate or act as a single Customer
 * Application, Account, or Project (respectively) or to circumvent Service-
 * specific usage limits or quotas is a direct violation of Google Cloud
 * Platform Terms of Service as well as Google APIs Terms of Service. These
 * actions can result in immediate termination of your GCP project(s) without
 * any warning.</p>
 *
 * <p>
 * For more information about this service, see the API
 * <a href="http://code.google.com/apis/analytics/docs/mgmt/home.html" target="_blank">Documentation</a>
 * </p>
 *
 * @author Google, Inc.
 */
class GoogleAnalyticsAdmin extends \Google\Site_Kit_Dependencies\Google\Service
{
    /** Edit Google Analytics management entities. */
    const ANALYTICS_EDIT = "https://www.googleapis.com/auth/analytics.edit";
    /** See and download your Google Analytics data. */
    const ANALYTICS_READONLY = "https://www.googleapis.com/auth/analytics.readonly";
    public $accountSummaries;
    public $accounts;
    public $properties;
    public $properties_conversionEvents;
    public $properties_customDimensions;
    public $properties_customMetrics;
    public $properties_dataStreams;
    public $properties_dataStreams_measurementProtocolSecrets;
    public $properties_firebaseLinks;
    public $properties_googleAdsLinks;
    public $properties_keyEvents;
    /**
     * Constructs the internal representation of the GoogleAnalyticsAdmin service.
     *
     * @param Client|array $clientOrConfig The client used to deliver requests, or a
     *                                     config array to pass to a new Client instance.
     * @param string $rootUrl The root URL used for requests to the service.
     */
    public function __construct($clientOrConfig = [], $rootUrl = null)
    {
        parent::__construct($clientOrConfig);
        $this->rootUrl = $rootUrl ?: 'https://analyticsadmin.googleapis.com/';
        $this->servicePath = '';
        $this->batchPath = 'batch';
        $this->version = 'v1beta';
        $this->serviceName = 'analyticsadmin';
        $this->accountSummaries = new \Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin\Resource\AccountSummaries($this, $this->serviceName, 'accountSummaries', ['methods' => ['list' => ['path' => 'v1beta/accountSummaries', 'httpMethod' => 'GET', 'parameters' => ['pageSize' => ['location' => 'query', 'type' => 'integer'], 'pageToken' => ['location' => 'query', 'type' => 'string']]]]]);
        $this->accounts = new \Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin\Resource\Accounts($this, $this->serviceName, 'accounts', ['methods' => ['delete' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'DELETE', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'get' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'GET', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'getDataSharingSettings' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'GET', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'v1beta/accounts', 'httpMethod' => 'GET', 'parameters' => ['pageSize' => ['location' => 'query', 'type' => 'integer'], 'pageToken' => ['location' => 'query', 'type' => 'string'], 'showDeleted' => ['location' => 'query', 'type' => 'boolean']]], 'patch' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'PATCH', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'updateMask' => ['location' => 'query', 'type' => 'string']]], 'provisionAccountTicket' => ['path' => 'v1beta/accounts:provisionAccountTicket', 'httpMethod' => 'POST', 'parameters' => []], 'runAccessReport' => ['path' => 'v1beta/{+entity}:runAccessReport', 'httpMethod' => 'POST', 'parameters' => ['entity' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'searchChangeHistoryEvents' => ['path' => 'v1beta/{+account}:searchChangeHistoryEvents', 'httpMethod' => 'POST', 'parameters' => ['account' => ['location' => 'path', 'type' => 'string', 'required' => \true]]]]]);
        $this->properties = new \Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin\Resource\Properties($this, $this->serviceName, 'properties', ['methods' => ['acknowledgeUserDataCollection' => ['path' => 'v1beta/{+property}:acknowledgeUserDataCollection', 'httpMethod' => 'POST', 'parameters' => ['property' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'create' => ['path' => 'v1beta/properties', 'httpMethod' => 'POST', 'parameters' => []], 'delete' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'DELETE', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'get' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'GET', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'getDataRetentionSettings' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'GET', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'v1beta/properties', 'httpMethod' => 'GET', 'parameters' => ['filter' => ['location' => 'query', 'type' => 'string'], 'pageSize' => ['location' => 'query', 'type' => 'integer'], 'pageToken' => ['location' => 'query', 'type' => 'string'], 'showDeleted' => ['location' => 'query', 'type' => 'boolean']]], 'patch' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'PATCH', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'updateMask' => ['location' => 'query', 'type' => 'string']]], 'runAccessReport' => ['path' => 'v1beta/{+entity}:runAccessReport', 'httpMethod' => 'POST', 'parameters' => ['entity' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'updateDataRetentionSettings' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'PATCH', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'updateMask' => ['location' => 'query', 'type' => 'string']]]]]);
        $this->properties_conversionEvents = new \Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin\Resource\PropertiesConversionEvents($this, $this->serviceName, 'conversionEvents', ['methods' => ['create' => ['path' => 'v1beta/{+parent}/conversionEvents', 'httpMethod' => 'POST', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'delete' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'DELETE', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'get' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'GET', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'v1beta/{+parent}/conversionEvents', 'httpMethod' => 'GET', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'pageSize' => ['location' => 'query', 'type' => 'integer'], 'pageToken' => ['location' => 'query', 'type' => 'string']]], 'patch' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'PATCH', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'updateMask' => ['location' => 'query', 'type' => 'string']]]]]);
        $this->properties_customDimensions = new \Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin\Resource\PropertiesCustomDimensions($this, $this->serviceName, 'customDimensions', ['methods' => ['archive' => ['path' => 'v1beta/{+name}:archive', 'httpMethod' => 'POST', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'create' => ['path' => 'v1beta/{+parent}/customDimensions', 'httpMethod' => 'POST', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'get' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'GET', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'v1beta/{+parent}/customDimensions', 'httpMethod' => 'GET', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'pageSize' => ['location' => 'query', 'type' => 'integer'], 'pageToken' => ['location' => 'query', 'type' => 'string']]], 'patch' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'PATCH', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'updateMask' => ['location' => 'query', 'type' => 'string']]]]]);
        $this->properties_customMetrics = new \Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin\Resource\PropertiesCustomMetrics($this, $this->serviceName, 'customMetrics', ['methods' => ['archive' => ['path' => 'v1beta/{+name}:archive', 'httpMethod' => 'POST', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'create' => ['path' => 'v1beta/{+parent}/customMetrics', 'httpMethod' => 'POST', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'get' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'GET', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'v1beta/{+parent}/customMetrics', 'httpMethod' => 'GET', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'pageSize' => ['location' => 'query', 'type' => 'integer'], 'pageToken' => ['location' => 'query', 'type' => 'string']]], 'patch' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'PATCH', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'updateMask' => ['location' => 'query', 'type' => 'string']]]]]);
        $this->properties_dataStreams = new \Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin\Resource\PropertiesDataStreams($this, $this->serviceName, 'dataStreams', ['methods' => ['create' => ['path' => 'v1beta/{+parent}/dataStreams', 'httpMethod' => 'POST', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'delete' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'DELETE', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'get' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'GET', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'v1beta/{+parent}/dataStreams', 'httpMethod' => 'GET', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'pageSize' => ['location' => 'query', 'type' => 'integer'], 'pageToken' => ['location' => 'query', 'type' => 'string']]], 'patch' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'PATCH', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'updateMask' => ['location' => 'query', 'type' => 'string']]]]]);
        $this->properties_dataStreams_measurementProtocolSecrets = new \Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin\Resource\PropertiesDataStreamsMeasurementProtocolSecrets($this, $this->serviceName, 'measurementProtocolSecrets', ['methods' => ['create' => ['path' => 'v1beta/{+parent}/measurementProtocolSecrets', 'httpMethod' => 'POST', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'delete' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'DELETE', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'get' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'GET', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'v1beta/{+parent}/measurementProtocolSecrets', 'httpMethod' => 'GET', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'pageSize' => ['location' => 'query', 'type' => 'integer'], 'pageToken' => ['location' => 'query', 'type' => 'string']]], 'patch' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'PATCH', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'updateMask' => ['location' => 'query', 'type' => 'string']]]]]);
        $this->properties_firebaseLinks = new \Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin\Resource\PropertiesFirebaseLinks($this, $this->serviceName, 'firebaseLinks', ['methods' => ['create' => ['path' => 'v1beta/{+parent}/firebaseLinks', 'httpMethod' => 'POST', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'delete' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'DELETE', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'v1beta/{+parent}/firebaseLinks', 'httpMethod' => 'GET', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'pageSize' => ['location' => 'query', 'type' => 'integer'], 'pageToken' => ['location' => 'query', 'type' => 'string']]]]]);
        $this->properties_googleAdsLinks = new \Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin\Resource\PropertiesGoogleAdsLinks($this, $this->serviceName, 'googleAdsLinks', ['methods' => ['create' => ['path' => 'v1beta/{+parent}/googleAdsLinks', 'httpMethod' => 'POST', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'delete' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'DELETE', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'v1beta/{+parent}/googleAdsLinks', 'httpMethod' => 'GET', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'pageSize' => ['location' => 'query', 'type' => 'integer'], 'pageToken' => ['location' => 'query', 'type' => 'string']]], 'patch' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'PATCH', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'updateMask' => ['location' => 'query', 'type' => 'string']]]]]);
        $this->properties_keyEvents = new \Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin\Resource\PropertiesKeyEvents($this, $this->serviceName, 'keyEvents', ['methods' => ['create' => ['path' => 'v1beta/{+parent}/keyEvents', 'httpMethod' => 'POST', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'delete' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'DELETE', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'get' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'GET', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'v1beta/{+parent}/keyEvents', 'httpMethod' => 'GET', 'parameters' => ['parent' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'pageSize' => ['location' => 'query', 'type' => 'integer'], 'pageToken' => ['location' => 'query', 'type' => 'string']]], 'patch' => ['path' => 'v1beta/{+name}', 'httpMethod' => 'PATCH', 'parameters' => ['name' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'updateMask' => ['location' => 'query', 'type' => 'string']]]]]);
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin::class, 'Google\\Site_Kit_Dependencies\\Google_Service_GoogleAnalyticsAdmin');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service;

use Google\Site_Kit_Dependencies\Google\Client;
/**
 * Service definition for SiteVerification (v1).
 *
 * <p>
 * Verifies ownership of websites or domains with Google.</p>
 *
 * <p>
 * For more information about this service, see the API
 * <a href="https://developers.google.com/site-verification/" target="_blank">Documentation</a>
 * </p>
 *
 * @author Google, Inc.
 */
class SiteVerification extends \Google\Site_Kit_Dependencies\Google\Service
{
    /** Manage the list of sites and domains you control. */
    const SITEVERIFICATION = "https://www.googleapis.com/auth/siteverification";
    /** Manage your new site verifications with Google. */
    const SITEVERIFICATION_VERIFY_ONLY = "https://www.googleapis.com/auth/siteverification.verify_only";
    public $webResource;
    /**
     * Constructs the internal representation of the SiteVerification service.
     *
     * @param Client|array $clientOrConfig The client used to deliver requests, or a
     *                                     config array to pass to a new Client instance.
     * @param string $rootUrl The root URL used for requests to the service.
     */
    public function __construct($clientOrConfig = [], $rootUrl = null)
    {
        parent::__construct($clientOrConfig);
        $this->rootUrl = $rootUrl ?: 'https://www.googleapis.com/';
        $this->servicePath = 'siteVerification/v1/';
        $this->batchPath = 'batch/siteVerification/v1';
        $this->version = 'v1';
        $this->serviceName = 'siteVerification';
        $this->webResource = new \Google\Site_Kit_Dependencies\Google\Service\SiteVerification\Resource\WebResource($this, $this->serviceName, 'webResource', ['methods' => ['delete' => ['path' => 'webResource/{id}', 'httpMethod' => 'DELETE', 'parameters' => ['id' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'get' => ['path' => 'webResource/{id}', 'httpMethod' => 'GET', 'parameters' => ['id' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'getToken' => ['path' => 'token', 'httpMethod' => 'POST', 'parameters' => []], 'insert' => ['path' => 'webResource', 'httpMethod' => 'POST', 'parameters' => ['verificationMethod' => ['location' => 'query', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'webResource', 'httpMethod' => 'GET', 'parameters' => []], 'patch' => ['path' => 'webResource/{id}', 'httpMethod' => 'PATCH', 'parameters' => ['id' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'update' => ['path' => 'webResource/{id}', 'httpMethod' => 'PUT', 'parameters' => ['id' => ['location' => 'path', 'type' => 'string', 'required' => \true]]]]]);
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\SiteVerification::class, 'Google\\Site_Kit_Dependencies\\Google_Service_SiteVerification');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class Entity extends \Google\Site_Kit_Dependencies\Google\Model
{
    protected $builtInVariableType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\BuiltInVariable::class;
    protected $builtInVariableDataType = '';
    /**
     * @var string
     */
    public $changeStatus;
    protected $clientType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Client::class;
    protected $clientDataType = '';
    protected $customTemplateType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\CustomTemplate::class;
    protected $customTemplateDataType = '';
    protected $folderType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Folder::class;
    protected $folderDataType = '';
    protected $gtagConfigType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\GtagConfig::class;
    protected $gtagConfigDataType = '';
    protected $tagType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Tag::class;
    protected $tagDataType = '';
    protected $transformationType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Transformation::class;
    protected $transformationDataType = '';
    protected $triggerType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Trigger::class;
    protected $triggerDataType = '';
    protected $variableType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Variable::class;
    protected $variableDataType = '';
    protected $zoneType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Zone::class;
    protected $zoneDataType = '';
    /**
     * @param BuiltInVariable
     */
    public function setBuiltInVariable(\Google\Site_Kit_Dependencies\Google\Service\TagManager\BuiltInVariable $builtInVariable)
    {
        $this->builtInVariable = $builtInVariable;
    }
    /**
     * @return BuiltInVariable
     */
    public function getBuiltInVariable()
    {
        return $this->builtInVariable;
    }
    /**
     * @param string
     */
    public function setChangeStatus($changeStatus)
    {
        $this->changeStatus = $changeStatus;
    }
    /**
     * @return string
     */
    public function getChangeStatus()
    {
        return $this->changeStatus;
    }
    /**
     * @param Client
     */
    public function setClient(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Client $client)
    {
        $this->client = $client;
    }
    /**
     * @return Client
     */
    public function getClient()
    {
        return $this->client;
    }
    /**
     * @param CustomTemplate
     */
    public function setCustomTemplate(\Google\Site_Kit_Dependencies\Google\Service\TagManager\CustomTemplate $customTemplate)
    {
        $this->customTemplate = $customTemplate;
    }
    /**
     * @return CustomTemplate
     */
    public function getCustomTemplate()
    {
        return $this->customTemplate;
    }
    /**
     * @param Folder
     */
    public function setFolder(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Folder $folder)
    {
        $this->folder = $folder;
    }
    /**
     * @return Folder
     */
    public function getFolder()
    {
        return $this->folder;
    }
    /**
     * @param GtagConfig
     */
    public function setGtagConfig(\Google\Site_Kit_Dependencies\Google\Service\TagManager\GtagConfig $gtagConfig)
    {
        $this->gtagConfig = $gtagConfig;
    }
    /**
     * @return GtagConfig
     */
    public function getGtagConfig()
    {
        return $this->gtagConfig;
    }
    /**
     * @param Tag
     */
    public function setTag(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Tag $tag)
    {
        $this->tag = $tag;
    }
    /**
     * @return Tag
     */
    public function getTag()
    {
        return $this->tag;
    }
    /**
     * @param Transformation
     */
    public function setTransformation(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Transformation $transformation)
    {
        $this->transformation = $transformation;
    }
    /**
     * @return Transformation
     */
    public function getTransformation()
    {
        return $this->transformation;
    }
    /**
     * @param Trigger
     */
    public function setTrigger(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Trigger $trigger)
    {
        $this->trigger = $trigger;
    }
    /**
     * @return Trigger
     */
    public function getTrigger()
    {
        return $this->trigger;
    }
    /**
     * @param Variable
     */
    public function setVariable(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Variable $variable)
    {
        $this->variable = $variable;
    }
    /**
     * @return Variable
     */
    public function getVariable()
    {
        return $this->variable;
    }
    /**
     * @param Zone
     */
    public function setZone(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Zone $zone)
    {
        $this->zone = $zone;
    }
    /**
     * @return Zone
     */
    public function getZone()
    {
        return $this->zone;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Entity::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_Entity');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class RevertTemplateResponse extends \Google\Site_Kit_Dependencies\Google\Model
{
    protected $templateType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\CustomTemplate::class;
    protected $templateDataType = '';
    /**
     * @param CustomTemplate
     */
    public function setTemplate(\Google\Site_Kit_Dependencies\Google\Service\TagManager\CustomTemplate $template)
    {
        $this->template = $template;
    }
    /**
     * @return CustomTemplate
     */
    public function getTemplate()
    {
        return $this->template;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\RevertTemplateResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_RevertTemplateResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class Trigger extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'parameter';
    /**
     * @var string
     */
    public $accountId;
    protected $autoEventFilterType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Condition::class;
    protected $autoEventFilterDataType = 'array';
    protected $checkValidationType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $checkValidationDataType = '';
    /**
     * @var string
     */
    public $containerId;
    protected $continuousTimeMinMillisecondsType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $continuousTimeMinMillisecondsDataType = '';
    protected $customEventFilterType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Condition::class;
    protected $customEventFilterDataType = 'array';
    protected $eventNameType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $eventNameDataType = '';
    protected $filterType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Condition::class;
    protected $filterDataType = 'array';
    /**
     * @var string
     */
    public $fingerprint;
    protected $horizontalScrollPercentageListType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $horizontalScrollPercentageListDataType = '';
    protected $intervalType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $intervalDataType = '';
    protected $intervalSecondsType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $intervalSecondsDataType = '';
    protected $limitType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $limitDataType = '';
    protected $maxTimerLengthSecondsType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $maxTimerLengthSecondsDataType = '';
    /**
     * @var string
     */
    public $name;
    /**
     * @var string
     */
    public $notes;
    protected $parameterType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $parameterDataType = 'array';
    /**
     * @var string
     */
    public $parentFolderId;
    /**
     * @var string
     */
    public $path;
    protected $selectorType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $selectorDataType = '';
    /**
     * @var string
     */
    public $tagManagerUrl;
    protected $totalTimeMinMillisecondsType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $totalTimeMinMillisecondsDataType = '';
    /**
     * @var string
     */
    public $triggerId;
    /**
     * @var string
     */
    public $type;
    protected $uniqueTriggerIdType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $uniqueTriggerIdDataType = '';
    protected $verticalScrollPercentageListType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $verticalScrollPercentageListDataType = '';
    protected $visibilitySelectorType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $visibilitySelectorDataType = '';
    protected $visiblePercentageMaxType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $visiblePercentageMaxDataType = '';
    protected $visiblePercentageMinType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $visiblePercentageMinDataType = '';
    protected $waitForTagsType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $waitForTagsDataType = '';
    protected $waitForTagsTimeoutType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $waitForTagsTimeoutDataType = '';
    /**
     * @var string
     */
    public $workspaceId;
    /**
     * @param string
     */
    public function setAccountId($accountId)
    {
        $this->accountId = $accountId;
    }
    /**
     * @return string
     */
    public function getAccountId()
    {
        return $this->accountId;
    }
    /**
     * @param Condition[]
     */
    public function setAutoEventFilter($autoEventFilter)
    {
        $this->autoEventFilter = $autoEventFilter;
    }
    /**
     * @return Condition[]
     */
    public function getAutoEventFilter()
    {
        return $this->autoEventFilter;
    }
    /**
     * @param Parameter
     */
    public function setCheckValidation(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $checkValidation)
    {
        $this->checkValidation = $checkValidation;
    }
    /**
     * @return Parameter
     */
    public function getCheckValidation()
    {
        return $this->checkValidation;
    }
    /**
     * @param string
     */
    public function setContainerId($containerId)
    {
        $this->containerId = $containerId;
    }
    /**
     * @return string
     */
    public function getContainerId()
    {
        return $this->containerId;
    }
    /**
     * @param Parameter
     */
    public function setContinuousTimeMinMilliseconds(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $continuousTimeMinMilliseconds)
    {
        $this->continuousTimeMinMilliseconds = $continuousTimeMinMilliseconds;
    }
    /**
     * @return Parameter
     */
    public function getContinuousTimeMinMilliseconds()
    {
        return $this->continuousTimeMinMilliseconds;
    }
    /**
     * @param Condition[]
     */
    public function setCustomEventFilter($customEventFilter)
    {
        $this->customEventFilter = $customEventFilter;
    }
    /**
     * @return Condition[]
     */
    public function getCustomEventFilter()
    {
        return $this->customEventFilter;
    }
    /**
     * @param Parameter
     */
    public function setEventName(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $eventName)
    {
        $this->eventName = $eventName;
    }
    /**
     * @return Parameter
     */
    public function getEventName()
    {
        return $this->eventName;
    }
    /**
     * @param Condition[]
     */
    public function setFilter($filter)
    {
        $this->filter = $filter;
    }
    /**
     * @return Condition[]
     */
    public function getFilter()
    {
        return $this->filter;
    }
    /**
     * @param string
     */
    public function setFingerprint($fingerprint)
    {
        $this->fingerprint = $fingerprint;
    }
    /**
     * @return string
     */
    public function getFingerprint()
    {
        return $this->fingerprint;
    }
    /**
     * @param Parameter
     */
    public function setHorizontalScrollPercentageList(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $horizontalScrollPercentageList)
    {
        $this->horizontalScrollPercentageList = $horizontalScrollPercentageList;
    }
    /**
     * @return Parameter
     */
    public function getHorizontalScrollPercentageList()
    {
        return $this->horizontalScrollPercentageList;
    }
    /**
     * @param Parameter
     */
    public function setInterval(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $interval)
    {
        $this->interval = $interval;
    }
    /**
     * @return Parameter
     */
    public function getInterval()
    {
        return $this->interval;
    }
    /**
     * @param Parameter
     */
    public function setIntervalSeconds(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $intervalSeconds)
    {
        $this->intervalSeconds = $intervalSeconds;
    }
    /**
     * @return Parameter
     */
    public function getIntervalSeconds()
    {
        return $this->intervalSeconds;
    }
    /**
     * @param Parameter
     */
    public function setLimit(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $limit)
    {
        $this->limit = $limit;
    }
    /**
     * @return Parameter
     */
    public function getLimit()
    {
        return $this->limit;
    }
    /**
     * @param Parameter
     */
    public function setMaxTimerLengthSeconds(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $maxTimerLengthSeconds)
    {
        $this->maxTimerLengthSeconds = $maxTimerLengthSeconds;
    }
    /**
     * @return Parameter
     */
    public function getMaxTimerLengthSeconds()
    {
        return $this->maxTimerLengthSeconds;
    }
    /**
     * @param string
     */
    public function setName($name)
    {
        $this->name = $name;
    }
    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * @param string
     */
    public function setNotes($notes)
    {
        $this->notes = $notes;
    }
    /**
     * @return string
     */
    public function getNotes()
    {
        return $this->notes;
    }
    /**
     * @param Parameter[]
     */
    public function setParameter($parameter)
    {
        $this->parameter = $parameter;
    }
    /**
     * @return Parameter[]
     */
    public function getParameter()
    {
        return $this->parameter;
    }
    /**
     * @param string
     */
    public function setParentFolderId($parentFolderId)
    {
        $this->parentFolderId = $parentFolderId;
    }
    /**
     * @return string
     */
    public function getParentFolderId()
    {
        return $this->parentFolderId;
    }
    /**
     * @param string
     */
    public function setPath($path)
    {
        $this->path = $path;
    }
    /**
     * @return string
     */
    public function getPath()
    {
        return $this->path;
    }
    /**
     * @param Parameter
     */
    public function setSelector(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $selector)
    {
        $this->selector = $selector;
    }
    /**
     * @return Parameter
     */
    public function getSelector()
    {
        return $this->selector;
    }
    /**
     * @param string
     */
    public function setTagManagerUrl($tagManagerUrl)
    {
        $this->tagManagerUrl = $tagManagerUrl;
    }
    /**
     * @return string
     */
    public function getTagManagerUrl()
    {
        return $this->tagManagerUrl;
    }
    /**
     * @param Parameter
     */
    public function setTotalTimeMinMilliseconds(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $totalTimeMinMilliseconds)
    {
        $this->totalTimeMinMilliseconds = $totalTimeMinMilliseconds;
    }
    /**
     * @return Parameter
     */
    public function getTotalTimeMinMilliseconds()
    {
        return $this->totalTimeMinMilliseconds;
    }
    /**
     * @param string
     */
    public function setTriggerId($triggerId)
    {
        $this->triggerId = $triggerId;
    }
    /**
     * @return string
     */
    public function getTriggerId()
    {
        return $this->triggerId;
    }
    /**
     * @param string
     */
    public function setType($type)
    {
        $this->type = $type;
    }
    /**
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }
    /**
     * @param Parameter
     */
    public function setUniqueTriggerId(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $uniqueTriggerId)
    {
        $this->uniqueTriggerId = $uniqueTriggerId;
    }
    /**
     * @return Parameter
     */
    public function getUniqueTriggerId()
    {
        return $this->uniqueTriggerId;
    }
    /**
     * @param Parameter
     */
    public function setVerticalScrollPercentageList(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $verticalScrollPercentageList)
    {
        $this->verticalScrollPercentageList = $verticalScrollPercentageList;
    }
    /**
     * @return Parameter
     */
    public function getVerticalScrollPercentageList()
    {
        return $this->verticalScrollPercentageList;
    }
    /**
     * @param Parameter
     */
    public function setVisibilitySelector(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $visibilitySelector)
    {
        $this->visibilitySelector = $visibilitySelector;
    }
    /**
     * @return Parameter
     */
    public function getVisibilitySelector()
    {
        return $this->visibilitySelector;
    }
    /**
     * @param Parameter
     */
    public function setVisiblePercentageMax(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $visiblePercentageMax)
    {
        $this->visiblePercentageMax = $visiblePercentageMax;
    }
    /**
     * @return Parameter
     */
    public function getVisiblePercentageMax()
    {
        return $this->visiblePercentageMax;
    }
    /**
     * @param Parameter
     */
    public function setVisiblePercentageMin(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $visiblePercentageMin)
    {
        $this->visiblePercentageMin = $visiblePercentageMin;
    }
    /**
     * @return Parameter
     */
    public function getVisiblePercentageMin()
    {
        return $this->visiblePercentageMin;
    }
    /**
     * @param Parameter
     */
    public function setWaitForTags(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $waitForTags)
    {
        $this->waitForTags = $waitForTags;
    }
    /**
     * @return Parameter
     */
    public function getWaitForTags()
    {
        return $this->waitForTags;
    }
    /**
     * @param Parameter
     */
    public function setWaitForTagsTimeout(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $waitForTagsTimeout)
    {
        $this->waitForTagsTimeout = $waitForTagsTimeout;
    }
    /**
     * @return Parameter
     */
    public function getWaitForTagsTimeout()
    {
        return $this->waitForTagsTimeout;
    }
    /**
     * @param string
     */
    public function setWorkspaceId($workspaceId)
    {
        $this->workspaceId = $workspaceId;
    }
    /**
     * @return string
     */
    public function getWorkspaceId()
    {
        return $this->workspaceId;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Trigger::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_Trigger');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class TeardownTag extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var bool
     */
    public $stopTeardownOnFailure;
    /**
     * @var string
     */
    public $tagName;
    /**
     * @param bool
     */
    public function setStopTeardownOnFailure($stopTeardownOnFailure)
    {
        $this->stopTeardownOnFailure = $stopTeardownOnFailure;
    }
    /**
     * @return bool
     */
    public function getStopTeardownOnFailure()
    {
        return $this->stopTeardownOnFailure;
    }
    /**
     * @param string
     */
    public function setTagName($tagName)
    {
        $this->tagName = $tagName;
    }
    /**
     * @return string
     */
    public function getTagName()
    {
        return $this->tagName;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\TeardownTag::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_TeardownTag');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class ListClientsResponse extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'client';
    protected $clientType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Client::class;
    protected $clientDataType = 'array';
    /**
     * @var string
     */
    public $nextPageToken;
    /**
     * @param Client[]
     */
    public function setClient($client)
    {
        $this->client = $client;
    }
    /**
     * @return Client[]
     */
    public function getClient()
    {
        return $this->client;
    }
    /**
     * @param string
     */
    public function setNextPageToken($nextPageToken)
    {
        $this->nextPageToken = $nextPageToken;
    }
    /**
     * @return string
     */
    public function getNextPageToken()
    {
        return $this->nextPageToken;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ListClientsResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_ListClientsResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class ZoneChildContainer extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var string
     */
    public $nickname;
    /**
     * @var string
     */
    public $publicId;
    /**
     * @param string
     */
    public function setNickname($nickname)
    {
        $this->nickname = $nickname;
    }
    /**
     * @return string
     */
    public function getNickname()
    {
        return $this->nickname;
    }
    /**
     * @param string
     */
    public function setPublicId($publicId)
    {
        $this->publicId = $publicId;
    }
    /**
     * @return string
     */
    public function getPublicId()
    {
        return $this->publicId;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ZoneChildContainer::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_ZoneChildContainer');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class Folder extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var string
     */
    public $accountId;
    /**
     * @var string
     */
    public $containerId;
    /**
     * @var string
     */
    public $fingerprint;
    /**
     * @var string
     */
    public $folderId;
    /**
     * @var string
     */
    public $name;
    /**
     * @var string
     */
    public $notes;
    /**
     * @var string
     */
    public $path;
    /**
     * @var string
     */
    public $tagManagerUrl;
    /**
     * @var string
     */
    public $workspaceId;
    /**
     * @param string
     */
    public function setAccountId($accountId)
    {
        $this->accountId = $accountId;
    }
    /**
     * @return string
     */
    public function getAccountId()
    {
        return $this->accountId;
    }
    /**
     * @param string
     */
    public function setContainerId($containerId)
    {
        $this->containerId = $containerId;
    }
    /**
     * @return string
     */
    public function getContainerId()
    {
        return $this->containerId;
    }
    /**
     * @param string
     */
    public function setFingerprint($fingerprint)
    {
        $this->fingerprint = $fingerprint;
    }
    /**
     * @return string
     */
    public function getFingerprint()
    {
        return $this->fingerprint;
    }
    /**
     * @param string
     */
    public function setFolderId($folderId)
    {
        $this->folderId = $folderId;
    }
    /**
     * @return string
     */
    public function getFolderId()
    {
        return $this->folderId;
    }
    /**
     * @param string
     */
    public function setName($name)
    {
        $this->name = $name;
    }
    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * @param string
     */
    public function setNotes($notes)
    {
        $this->notes = $notes;
    }
    /**
     * @return string
     */
    public function getNotes()
    {
        return $this->notes;
    }
    /**
     * @param string
     */
    public function setPath($path)
    {
        $this->path = $path;
    }
    /**
     * @return string
     */
    public function getPath()
    {
        return $this->path;
    }
    /**
     * @param string
     */
    public function setTagManagerUrl($tagManagerUrl)
    {
        $this->tagManagerUrl = $tagManagerUrl;
    }
    /**
     * @return string
     */
    public function getTagManagerUrl()
    {
        return $this->tagManagerUrl;
    }
    /**
     * @param string
     */
    public function setWorkspaceId($workspaceId)
    {
        $this->workspaceId = $workspaceId;
    }
    /**
     * @return string
     */
    public function getWorkspaceId()
    {
        return $this->workspaceId;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Folder::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_Folder');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class ContainerFeatures extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var bool
     */
    public $supportBuiltInVariables;
    /**
     * @var bool
     */
    public $supportClients;
    /**
     * @var bool
     */
    public $supportEnvironments;
    /**
     * @var bool
     */
    public $supportFolders;
    /**
     * @var bool
     */
    public $supportGtagConfigs;
    /**
     * @var bool
     */
    public $supportTags;
    /**
     * @var bool
     */
    public $supportTemplates;
    /**
     * @var bool
     */
    public $supportTransformations;
    /**
     * @var bool
     */
    public $supportTriggers;
    /**
     * @var bool
     */
    public $supportUserPermissions;
    /**
     * @var bool
     */
    public $supportVariables;
    /**
     * @var bool
     */
    public $supportVersions;
    /**
     * @var bool
     */
    public $supportWorkspaces;
    /**
     * @var bool
     */
    public $supportZones;
    /**
     * @param bool
     */
    public function setSupportBuiltInVariables($supportBuiltInVariables)
    {
        $this->supportBuiltInVariables = $supportBuiltInVariables;
    }
    /**
     * @return bool
     */
    public function getSupportBuiltInVariables()
    {
        return $this->supportBuiltInVariables;
    }
    /**
     * @param bool
     */
    public function setSupportClients($supportClients)
    {
        $this->supportClients = $supportClients;
    }
    /**
     * @return bool
     */
    public function getSupportClients()
    {
        return $this->supportClients;
    }
    /**
     * @param bool
     */
    public function setSupportEnvironments($supportEnvironments)
    {
        $this->supportEnvironments = $supportEnvironments;
    }
    /**
     * @return bool
     */
    public function getSupportEnvironments()
    {
        return $this->supportEnvironments;
    }
    /**
     * @param bool
     */
    public function setSupportFolders($supportFolders)
    {
        $this->supportFolders = $supportFolders;
    }
    /**
     * @return bool
     */
    public function getSupportFolders()
    {
        return $this->supportFolders;
    }
    /**
     * @param bool
     */
    public function setSupportGtagConfigs($supportGtagConfigs)
    {
        $this->supportGtagConfigs = $supportGtagConfigs;
    }
    /**
     * @return bool
     */
    public function getSupportGtagConfigs()
    {
        return $this->supportGtagConfigs;
    }
    /**
     * @param bool
     */
    public function setSupportTags($supportTags)
    {
        $this->supportTags = $supportTags;
    }
    /**
     * @return bool
     */
    public function getSupportTags()
    {
        return $this->supportTags;
    }
    /**
     * @param bool
     */
    public function setSupportTemplates($supportTemplates)
    {
        $this->supportTemplates = $supportTemplates;
    }
    /**
     * @return bool
     */
    public function getSupportTemplates()
    {
        return $this->supportTemplates;
    }
    /**
     * @param bool
     */
    public function setSupportTransformations($supportTransformations)
    {
        $this->supportTransformations = $supportTransformations;
    }
    /**
     * @return bool
     */
    public function getSupportTransformations()
    {
        return $this->supportTransformations;
    }
    /**
     * @param bool
     */
    public function setSupportTriggers($supportTriggers)
    {
        $this->supportTriggers = $supportTriggers;
    }
    /**
     * @return bool
     */
    public function getSupportTriggers()
    {
        return $this->supportTriggers;
    }
    /**
     * @param bool
     */
    public function setSupportUserPermissions($supportUserPermissions)
    {
        $this->supportUserPermissions = $supportUserPermissions;
    }
    /**
     * @return bool
     */
    public function getSupportUserPermissions()
    {
        return $this->supportUserPermissions;
    }
    /**
     * @param bool
     */
    public function setSupportVariables($supportVariables)
    {
        $this->supportVariables = $supportVariables;
    }
    /**
     * @return bool
     */
    public function getSupportVariables()
    {
        return $this->supportVariables;
    }
    /**
     * @param bool
     */
    public function setSupportVersions($supportVersions)
    {
        $this->supportVersions = $supportVersions;
    }
    /**
     * @return bool
     */
    public function getSupportVersions()
    {
        return $this->supportVersions;
    }
    /**
     * @param bool
     */
    public function setSupportWorkspaces($supportWorkspaces)
    {
        $this->supportWorkspaces = $supportWorkspaces;
    }
    /**
     * @return bool
     */
    public function getSupportWorkspaces()
    {
        return $this->supportWorkspaces;
    }
    /**
     * @param bool
     */
    public function setSupportZones($supportZones)
    {
        $this->supportZones = $supportZones;
    }
    /**
     * @return bool
     */
    public function getSupportZones()
    {
        return $this->supportZones;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ContainerFeatures::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_ContainerFeatures');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class BuiltInVariable extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var string
     */
    public $accountId;
    /**
     * @var string
     */
    public $containerId;
    /**
     * @var string
     */
    public $name;
    /**
     * @var string
     */
    public $path;
    /**
     * @var string
     */
    public $type;
    /**
     * @var string
     */
    public $workspaceId;
    /**
     * @param string
     */
    public function setAccountId($accountId)
    {
        $this->accountId = $accountId;
    }
    /**
     * @return string
     */
    public function getAccountId()
    {
        return $this->accountId;
    }
    /**
     * @param string
     */
    public function setContainerId($containerId)
    {
        $this->containerId = $containerId;
    }
    /**
     * @return string
     */
    public function getContainerId()
    {
        return $this->containerId;
    }
    /**
     * @param string
     */
    public function setName($name)
    {
        $this->name = $name;
    }
    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * @param string
     */
    public function setPath($path)
    {
        $this->path = $path;
    }
    /**
     * @return string
     */
    public function getPath()
    {
        return $this->path;
    }
    /**
     * @param string
     */
    public function setType($type)
    {
        $this->type = $type;
    }
    /**
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }
    /**
     * @param string
     */
    public function setWorkspaceId($workspaceId)
    {
        $this->workspaceId = $workspaceId;
    }
    /**
     * @return string
     */
    public function getWorkspaceId()
    {
        return $this->workspaceId;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\BuiltInVariable::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_BuiltInVariable');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class PublishContainerVersionResponse extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var bool
     */
    public $compilerError;
    protected $containerVersionType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\ContainerVersion::class;
    protected $containerVersionDataType = '';
    /**
     * @param bool
     */
    public function setCompilerError($compilerError)
    {
        $this->compilerError = $compilerError;
    }
    /**
     * @return bool
     */
    public function getCompilerError()
    {
        return $this->compilerError;
    }
    /**
     * @param ContainerVersion
     */
    public function setContainerVersion(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ContainerVersion $containerVersion)
    {
        $this->containerVersion = $containerVersion;
    }
    /**
     * @return ContainerVersion
     */
    public function getContainerVersion()
    {
        return $this->containerVersion;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\PublishContainerVersionResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_PublishContainerVersionResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class CreateContainerVersionResponse extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var bool
     */
    public $compilerError;
    protected $containerVersionType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\ContainerVersion::class;
    protected $containerVersionDataType = '';
    /**
     * @var string
     */
    public $newWorkspacePath;
    protected $syncStatusType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\SyncStatus::class;
    protected $syncStatusDataType = '';
    /**
     * @param bool
     */
    public function setCompilerError($compilerError)
    {
        $this->compilerError = $compilerError;
    }
    /**
     * @return bool
     */
    public function getCompilerError()
    {
        return $this->compilerError;
    }
    /**
     * @param ContainerVersion
     */
    public function setContainerVersion(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ContainerVersion $containerVersion)
    {
        $this->containerVersion = $containerVersion;
    }
    /**
     * @return ContainerVersion
     */
    public function getContainerVersion()
    {
        return $this->containerVersion;
    }
    /**
     * @param string
     */
    public function setNewWorkspacePath($newWorkspacePath)
    {
        $this->newWorkspacePath = $newWorkspacePath;
    }
    /**
     * @return string
     */
    public function getNewWorkspacePath()
    {
        return $this->newWorkspacePath;
    }
    /**
     * @param SyncStatus
     */
    public function setSyncStatus(\Google\Site_Kit_Dependencies\Google\Service\TagManager\SyncStatus $syncStatus)
    {
        $this->syncStatus = $syncStatus;
    }
    /**
     * @return SyncStatus
     */
    public function getSyncStatus()
    {
        return $this->syncStatus;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\CreateContainerVersionResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_CreateContainerVersionResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class SyncWorkspaceResponse extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'mergeConflict';
    protected $mergeConflictType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\MergeConflict::class;
    protected $mergeConflictDataType = 'array';
    protected $syncStatusType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\SyncStatus::class;
    protected $syncStatusDataType = '';
    /**
     * @param MergeConflict[]
     */
    public function setMergeConflict($mergeConflict)
    {
        $this->mergeConflict = $mergeConflict;
    }
    /**
     * @return MergeConflict[]
     */
    public function getMergeConflict()
    {
        return $this->mergeConflict;
    }
    /**
     * @param SyncStatus
     */
    public function setSyncStatus(\Google\Site_Kit_Dependencies\Google\Service\TagManager\SyncStatus $syncStatus)
    {
        $this->syncStatus = $syncStatus;
    }
    /**
     * @return SyncStatus
     */
    public function getSyncStatus()
    {
        return $this->syncStatus;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\SyncWorkspaceResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_SyncWorkspaceResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class ListTagsResponse extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'tag';
    /**
     * @var string
     */
    public $nextPageToken;
    protected $tagType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Tag::class;
    protected $tagDataType = 'array';
    /**
     * @param string
     */
    public function setNextPageToken($nextPageToken)
    {
        $this->nextPageToken = $nextPageToken;
    }
    /**
     * @return string
     */
    public function getNextPageToken()
    {
        return $this->nextPageToken;
    }
    /**
     * @param Tag[]
     */
    public function setTag($tag)
    {
        $this->tag = $tag;
    }
    /**
     * @return Tag[]
     */
    public function getTag()
    {
        return $this->tag;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ListTagsResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_ListTagsResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class MergeConflict extends \Google\Site_Kit_Dependencies\Google\Model
{
    protected $entityInBaseVersionType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Entity::class;
    protected $entityInBaseVersionDataType = '';
    protected $entityInWorkspaceType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Entity::class;
    protected $entityInWorkspaceDataType = '';
    /**
     * @param Entity
     */
    public function setEntityInBaseVersion(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Entity $entityInBaseVersion)
    {
        $this->entityInBaseVersion = $entityInBaseVersion;
    }
    /**
     * @return Entity
     */
    public function getEntityInBaseVersion()
    {
        return $this->entityInBaseVersion;
    }
    /**
     * @param Entity
     */
    public function setEntityInWorkspace(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Entity $entityInWorkspace)
    {
        $this->entityInWorkspace = $entityInWorkspace;
    }
    /**
     * @return Entity
     */
    public function getEntityInWorkspace()
    {
        return $this->entityInWorkspace;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\MergeConflict::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_MergeConflict');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class GalleryReference extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var string
     */
    public $host;
    /**
     * @var bool
     */
    public $isModified;
    /**
     * @var string
     */
    public $owner;
    /**
     * @var string
     */
    public $repository;
    /**
     * @var string
     */
    public $signature;
    /**
     * @var string
     */
    public $version;
    /**
     * @param string
     */
    public function setHost($host)
    {
        $this->host = $host;
    }
    /**
     * @return string
     */
    public function getHost()
    {
        return $this->host;
    }
    /**
     * @param bool
     */
    public function setIsModified($isModified)
    {
        $this->isModified = $isModified;
    }
    /**
     * @return bool
     */
    public function getIsModified()
    {
        return $this->isModified;
    }
    /**
     * @param string
     */
    public function setOwner($owner)
    {
        $this->owner = $owner;
    }
    /**
     * @return string
     */
    public function getOwner()
    {
        return $this->owner;
    }
    /**
     * @param string
     */
    public function setRepository($repository)
    {
        $this->repository = $repository;
    }
    /**
     * @return string
     */
    public function getRepository()
    {
        return $this->repository;
    }
    /**
     * @param string
     */
    public function setSignature($signature)
    {
        $this->signature = $signature;
    }
    /**
     * @return string
     */
    public function getSignature()
    {
        return $this->signature;
    }
    /**
     * @param string
     */
    public function setVersion($version)
    {
        $this->version = $version;
    }
    /**
     * @return string
     */
    public function getVersion()
    {
        return $this->version;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\GalleryReference::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_GalleryReference');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class ListContainerVersionsResponse extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'containerVersionHeader';
    protected $containerVersionHeaderType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\ContainerVersionHeader::class;
    protected $containerVersionHeaderDataType = 'array';
    /**
     * @var string
     */
    public $nextPageToken;
    /**
     * @param ContainerVersionHeader[]
     */
    public function setContainerVersionHeader($containerVersionHeader)
    {
        $this->containerVersionHeader = $containerVersionHeader;
    }
    /**
     * @return ContainerVersionHeader[]
     */
    public function getContainerVersionHeader()
    {
        return $this->containerVersionHeader;
    }
    /**
     * @param string
     */
    public function setNextPageToken($nextPageToken)
    {
        $this->nextPageToken = $nextPageToken;
    }
    /**
     * @return string
     */
    public function getNextPageToken()
    {
        return $this->nextPageToken;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ListContainerVersionsResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_ListContainerVersionsResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class RevertTransformationResponse extends \Google\Site_Kit_Dependencies\Google\Model
{
    protected $transformationType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Transformation::class;
    protected $transformationDataType = '';
    /**
     * @param Transformation
     */
    public function setTransformation(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Transformation $transformation)
    {
        $this->transformation = $transformation;
    }
    /**
     * @return Transformation
     */
    public function getTransformation()
    {
        return $this->transformation;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\RevertTransformationResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_RevertTransformationResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class Condition extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'parameter';
    protected $parameterType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $parameterDataType = 'array';
    /**
     * @var string
     */
    public $type;
    /**
     * @param Parameter[]
     */
    public function setParameter($parameter)
    {
        $this->parameter = $parameter;
    }
    /**
     * @return Parameter[]
     */
    public function getParameter()
    {
        return $this->parameter;
    }
    /**
     * @param string
     */
    public function setType($type)
    {
        $this->type = $type;
    }
    /**
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Condition::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_Condition');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class ListEnvironmentsResponse extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'environment';
    protected $environmentType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Environment::class;
    protected $environmentDataType = 'array';
    /**
     * @var string
     */
    public $nextPageToken;
    /**
     * @param Environment[]
     */
    public function setEnvironment($environment)
    {
        $this->environment = $environment;
    }
    /**
     * @return Environment[]
     */
    public function getEnvironment()
    {
        return $this->environment;
    }
    /**
     * @param string
     */
    public function setNextPageToken($nextPageToken)
    {
        $this->nextPageToken = $nextPageToken;
    }
    /**
     * @return string
     */
    public function getNextPageToken()
    {
        return $this->nextPageToken;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ListEnvironmentsResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_ListEnvironmentsResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class RevertTagResponse extends \Google\Site_Kit_Dependencies\Google\Model
{
    protected $tagType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Tag::class;
    protected $tagDataType = '';
    /**
     * @param Tag
     */
    public function setTag(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Tag $tag)
    {
        $this->tag = $tag;
    }
    /**
     * @return Tag
     */
    public function getTag()
    {
        return $this->tag;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\RevertTagResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_RevertTagResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class Container extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'usageContext';
    /**
     * @var string
     */
    public $accountId;
    /**
     * @var string
     */
    public $containerId;
    /**
     * @var string[]
     */
    public $domainName;
    protected $featuresType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\ContainerFeatures::class;
    protected $featuresDataType = '';
    /**
     * @var string
     */
    public $fingerprint;
    /**
     * @var string
     */
    public $name;
    /**
     * @var string
     */
    public $notes;
    /**
     * @var string
     */
    public $path;
    /**
     * @var string
     */
    public $publicId;
    /**
     * @var string[]
     */
    public $tagIds;
    /**
     * @var string
     */
    public $tagManagerUrl;
    /**
     * @var string[]
     */
    public $taggingServerUrls;
    /**
     * @var string[]
     */
    public $usageContext;
    /**
     * @param string
     */
    public function setAccountId($accountId)
    {
        $this->accountId = $accountId;
    }
    /**
     * @return string
     */
    public function getAccountId()
    {
        return $this->accountId;
    }
    /**
     * @param string
     */
    public function setContainerId($containerId)
    {
        $this->containerId = $containerId;
    }
    /**
     * @return string
     */
    public function getContainerId()
    {
        return $this->containerId;
    }
    /**
     * @param string[]
     */
    public function setDomainName($domainName)
    {
        $this->domainName = $domainName;
    }
    /**
     * @return string[]
     */
    public function getDomainName()
    {
        return $this->domainName;
    }
    /**
     * @param ContainerFeatures
     */
    public function setFeatures(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ContainerFeatures $features)
    {
        $this->features = $features;
    }
    /**
     * @return ContainerFeatures
     */
    public function getFeatures()
    {
        return $this->features;
    }
    /**
     * @param string
     */
    public function setFingerprint($fingerprint)
    {
        $this->fingerprint = $fingerprint;
    }
    /**
     * @return string
     */
    public function getFingerprint()
    {
        return $this->fingerprint;
    }
    /**
     * @param string
     */
    public function setName($name)
    {
        $this->name = $name;
    }
    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * @param string
     */
    public function setNotes($notes)
    {
        $this->notes = $notes;
    }
    /**
     * @return string
     */
    public function getNotes()
    {
        return $this->notes;
    }
    /**
     * @param string
     */
    public function setPath($path)
    {
        $this->path = $path;
    }
    /**
     * @return string
     */
    public function getPath()
    {
        return $this->path;
    }
    /**
     * @param string
     */
    public function setPublicId($publicId)
    {
        $this->publicId = $publicId;
    }
    /**
     * @return string
     */
    public function getPublicId()
    {
        return $this->publicId;
    }
    /**
     * @param string[]
     */
    public function setTagIds($tagIds)
    {
        $this->tagIds = $tagIds;
    }
    /**
     * @return string[]
     */
    public function getTagIds()
    {
        return $this->tagIds;
    }
    /**
     * @param string
     */
    public function setTagManagerUrl($tagManagerUrl)
    {
        $this->tagManagerUrl = $tagManagerUrl;
    }
    /**
     * @return string
     */
    public function getTagManagerUrl()
    {
        return $this->tagManagerUrl;
    }
    /**
     * @param string[]
     */
    public function setTaggingServerUrls($taggingServerUrls)
    {
        $this->taggingServerUrls = $taggingServerUrls;
    }
    /**
     * @return string[]
     */
    public function getTaggingServerUrls()
    {
        return $this->taggingServerUrls;
    }
    /**
     * @param string[]
     */
    public function setUsageContext($usageContext)
    {
        $this->usageContext = $usageContext;
    }
    /**
     * @return string[]
     */
    public function getUsageContext()
    {
        return $this->usageContext;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Container::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_Container');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class QuickPreviewResponse extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var bool
     */
    public $compilerError;
    protected $containerVersionType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\ContainerVersion::class;
    protected $containerVersionDataType = '';
    protected $syncStatusType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\SyncStatus::class;
    protected $syncStatusDataType = '';
    /**
     * @param bool
     */
    public function setCompilerError($compilerError)
    {
        $this->compilerError = $compilerError;
    }
    /**
     * @return bool
     */
    public function getCompilerError()
    {
        return $this->compilerError;
    }
    /**
     * @param ContainerVersion
     */
    public function setContainerVersion(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ContainerVersion $containerVersion)
    {
        $this->containerVersion = $containerVersion;
    }
    /**
     * @return ContainerVersion
     */
    public function getContainerVersion()
    {
        return $this->containerVersion;
    }
    /**
     * @param SyncStatus
     */
    public function setSyncStatus(\Google\Site_Kit_Dependencies\Google\Service\TagManager\SyncStatus $syncStatus)
    {
        $this->syncStatus = $syncStatus;
    }
    /**
     * @return SyncStatus
     */
    public function getSyncStatus()
    {
        return $this->syncStatus;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\QuickPreviewResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_QuickPreviewResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class SetupTag extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var bool
     */
    public $stopOnSetupFailure;
    /**
     * @var string
     */
    public $tagName;
    /**
     * @param bool
     */
    public function setStopOnSetupFailure($stopOnSetupFailure)
    {
        $this->stopOnSetupFailure = $stopOnSetupFailure;
    }
    /**
     * @return bool
     */
    public function getStopOnSetupFailure()
    {
        return $this->stopOnSetupFailure;
    }
    /**
     * @param string
     */
    public function setTagName($tagName)
    {
        $this->tagName = $tagName;
    }
    /**
     * @return string
     */
    public function getTagName()
    {
        return $this->tagName;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\SetupTag::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_SetupTag');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class ListContainersResponse extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'container';
    protected $containerType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Container::class;
    protected $containerDataType = 'array';
    /**
     * @var string
     */
    public $nextPageToken;
    /**
     * @param Container[]
     */
    public function setContainer($container)
    {
        $this->container = $container;
    }
    /**
     * @return Container[]
     */
    public function getContainer()
    {
        return $this->container;
    }
    /**
     * @param string
     */
    public function setNextPageToken($nextPageToken)
    {
        $this->nextPageToken = $nextPageToken;
    }
    /**
     * @return string
     */
    public function getNextPageToken()
    {
        return $this->nextPageToken;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ListContainersResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_ListContainersResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class RevertVariableResponse extends \Google\Site_Kit_Dependencies\Google\Model
{
    protected $variableType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Variable::class;
    protected $variableDataType = '';
    /**
     * @param Variable
     */
    public function setVariable(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Variable $variable)
    {
        $this->variable = $variable;
    }
    /**
     * @return Variable
     */
    public function getVariable()
    {
        return $this->variable;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\RevertVariableResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_RevertVariableResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class ListEnabledBuiltInVariablesResponse extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'builtInVariable';
    protected $builtInVariableType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\BuiltInVariable::class;
    protected $builtInVariableDataType = 'array';
    /**
     * @var string
     */
    public $nextPageToken;
    /**
     * @param BuiltInVariable[]
     */
    public function setBuiltInVariable($builtInVariable)
    {
        $this->builtInVariable = $builtInVariable;
    }
    /**
     * @return BuiltInVariable[]
     */
    public function getBuiltInVariable()
    {
        return $this->builtInVariable;
    }
    /**
     * @param string
     */
    public function setNextPageToken($nextPageToken)
    {
        $this->nextPageToken = $nextPageToken;
    }
    /**
     * @return string
     */
    public function getNextPageToken()
    {
        return $this->nextPageToken;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ListEnabledBuiltInVariablesResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_ListEnabledBuiltInVariablesResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class Tag extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'teardownTag';
    /**
     * @var string
     */
    public $accountId;
    /**
     * @var string[]
     */
    public $blockingRuleId;
    /**
     * @var string[]
     */
    public $blockingTriggerId;
    protected $consentSettingsType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\TagConsentSetting::class;
    protected $consentSettingsDataType = '';
    /**
     * @var string
     */
    public $containerId;
    /**
     * @var string
     */
    public $fingerprint;
    /**
     * @var string[]
     */
    public $firingRuleId;
    /**
     * @var string[]
     */
    public $firingTriggerId;
    /**
     * @var bool
     */
    public $liveOnly;
    protected $monitoringMetadataType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $monitoringMetadataDataType = '';
    /**
     * @var string
     */
    public $monitoringMetadataTagNameKey;
    /**
     * @var string
     */
    public $name;
    /**
     * @var string
     */
    public $notes;
    protected $parameterType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $parameterDataType = 'array';
    /**
     * @var string
     */
    public $parentFolderId;
    /**
     * @var string
     */
    public $path;
    /**
     * @var bool
     */
    public $paused;
    protected $priorityType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $priorityDataType = '';
    /**
     * @var string
     */
    public $scheduleEndMs;
    /**
     * @var string
     */
    public $scheduleStartMs;
    protected $setupTagType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\SetupTag::class;
    protected $setupTagDataType = 'array';
    /**
     * @var string
     */
    public $tagFiringOption;
    /**
     * @var string
     */
    public $tagId;
    /**
     * @var string
     */
    public $tagManagerUrl;
    protected $teardownTagType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\TeardownTag::class;
    protected $teardownTagDataType = 'array';
    /**
     * @var string
     */
    public $type;
    /**
     * @var string
     */
    public $workspaceId;
    /**
     * @param string
     */
    public function setAccountId($accountId)
    {
        $this->accountId = $accountId;
    }
    /**
     * @return string
     */
    public function getAccountId()
    {
        return $this->accountId;
    }
    /**
     * @param string[]
     */
    public function setBlockingRuleId($blockingRuleId)
    {
        $this->blockingRuleId = $blockingRuleId;
    }
    /**
     * @return string[]
     */
    public function getBlockingRuleId()
    {
        return $this->blockingRuleId;
    }
    /**
     * @param string[]
     */
    public function setBlockingTriggerId($blockingTriggerId)
    {
        $this->blockingTriggerId = $blockingTriggerId;
    }
    /**
     * @return string[]
     */
    public function getBlockingTriggerId()
    {
        return $this->blockingTriggerId;
    }
    /**
     * @param TagConsentSetting
     */
    public function setConsentSettings(\Google\Site_Kit_Dependencies\Google\Service\TagManager\TagConsentSetting $consentSettings)
    {
        $this->consentSettings = $consentSettings;
    }
    /**
     * @return TagConsentSetting
     */
    public function getConsentSettings()
    {
        return $this->consentSettings;
    }
    /**
     * @param string
     */
    public function setContainerId($containerId)
    {
        $this->containerId = $containerId;
    }
    /**
     * @return string
     */
    public function getContainerId()
    {
        return $this->containerId;
    }
    /**
     * @param string
     */
    public function setFingerprint($fingerprint)
    {
        $this->fingerprint = $fingerprint;
    }
    /**
     * @return string
     */
    public function getFingerprint()
    {
        return $this->fingerprint;
    }
    /**
     * @param string[]
     */
    public function setFiringRuleId($firingRuleId)
    {
        $this->firingRuleId = $firingRuleId;
    }
    /**
     * @return string[]
     */
    public function getFiringRuleId()
    {
        return $this->firingRuleId;
    }
    /**
     * @param string[]
     */
    public function setFiringTriggerId($firingTriggerId)
    {
        $this->firingTriggerId = $firingTriggerId;
    }
    /**
     * @return string[]
     */
    public function getFiringTriggerId()
    {
        return $this->firingTriggerId;
    }
    /**
     * @param bool
     */
    public function setLiveOnly($liveOnly)
    {
        $this->liveOnly = $liveOnly;
    }
    /**
     * @return bool
     */
    public function getLiveOnly()
    {
        return $this->liveOnly;
    }
    /**
     * @param Parameter
     */
    public function setMonitoringMetadata(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $monitoringMetadata)
    {
        $this->monitoringMetadata = $monitoringMetadata;
    }
    /**
     * @return Parameter
     */
    public function getMonitoringMetadata()
    {
        return $this->monitoringMetadata;
    }
    /**
     * @param string
     */
    public function setMonitoringMetadataTagNameKey($monitoringMetadataTagNameKey)
    {
        $this->monitoringMetadataTagNameKey = $monitoringMetadataTagNameKey;
    }
    /**
     * @return string
     */
    public function getMonitoringMetadataTagNameKey()
    {
        return $this->monitoringMetadataTagNameKey;
    }
    /**
     * @param string
     */
    public function setName($name)
    {
        $this->name = $name;
    }
    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * @param string
     */
    public function setNotes($notes)
    {
        $this->notes = $notes;
    }
    /**
     * @return string
     */
    public function getNotes()
    {
        return $this->notes;
    }
    /**
     * @param Parameter[]
     */
    public function setParameter($parameter)
    {
        $this->parameter = $parameter;
    }
    /**
     * @return Parameter[]
     */
    public function getParameter()
    {
        return $this->parameter;
    }
    /**
     * @param string
     */
    public function setParentFolderId($parentFolderId)
    {
        $this->parentFolderId = $parentFolderId;
    }
    /**
     * @return string
     */
    public function getParentFolderId()
    {
        return $this->parentFolderId;
    }
    /**
     * @param string
     */
    public function setPath($path)
    {
        $this->path = $path;
    }
    /**
     * @return string
     */
    public function getPath()
    {
        return $this->path;
    }
    /**
     * @param bool
     */
    public function setPaused($paused)
    {
        $this->paused = $paused;
    }
    /**
     * @return bool
     */
    public function getPaused()
    {
        return $this->paused;
    }
    /**
     * @param Parameter
     */
    public function setPriority(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter $priority)
    {
        $this->priority = $priority;
    }
    /**
     * @return Parameter
     */
    public function getPriority()
    {
        return $this->priority;
    }
    /**
     * @param string
     */
    public function setScheduleEndMs($scheduleEndMs)
    {
        $this->scheduleEndMs = $scheduleEndMs;
    }
    /**
     * @return string
     */
    public function getScheduleEndMs()
    {
        return $this->scheduleEndMs;
    }
    /**
     * @param string
     */
    public function setScheduleStartMs($scheduleStartMs)
    {
        $this->scheduleStartMs = $scheduleStartMs;
    }
    /**
     * @return string
     */
    public function getScheduleStartMs()
    {
        return $this->scheduleStartMs;
    }
    /**
     * @param SetupTag[]
     */
    public function setSetupTag($setupTag)
    {
        $this->setupTag = $setupTag;
    }
    /**
     * @return SetupTag[]
     */
    public function getSetupTag()
    {
        return $this->setupTag;
    }
    /**
     * @param string
     */
    public function setTagFiringOption($tagFiringOption)
    {
        $this->tagFiringOption = $tagFiringOption;
    }
    /**
     * @return string
     */
    public function getTagFiringOption()
    {
        return $this->tagFiringOption;
    }
    /**
     * @param string
     */
    public function setTagId($tagId)
    {
        $this->tagId = $tagId;
    }
    /**
     * @return string
     */
    public function getTagId()
    {
        return $this->tagId;
    }
    /**
     * @param string
     */
    public function setTagManagerUrl($tagManagerUrl)
    {
        $this->tagManagerUrl = $tagManagerUrl;
    }
    /**
     * @return string
     */
    public function getTagManagerUrl()
    {
        return $this->tagManagerUrl;
    }
    /**
     * @param TeardownTag[]
     */
    public function setTeardownTag($teardownTag)
    {
        $this->teardownTag = $teardownTag;
    }
    /**
     * @return TeardownTag[]
     */
    public function getTeardownTag()
    {
        return $this->teardownTag;
    }
    /**
     * @param string
     */
    public function setType($type)
    {
        $this->type = $type;
    }
    /**
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }
    /**
     * @param string
     */
    public function setWorkspaceId($workspaceId)
    {
        $this->workspaceId = $workspaceId;
    }
    /**
     * @return string
     */
    public function getWorkspaceId()
    {
        return $this->workspaceId;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Tag::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_Tag');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class ListTriggersResponse extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'trigger';
    /**
     * @var string
     */
    public $nextPageToken;
    protected $triggerType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Trigger::class;
    protected $triggerDataType = 'array';
    /**
     * @param string
     */
    public function setNextPageToken($nextPageToken)
    {
        $this->nextPageToken = $nextPageToken;
    }
    /**
     * @return string
     */
    public function getNextPageToken()
    {
        return $this->nextPageToken;
    }
    /**
     * @param Trigger[]
     */
    public function setTrigger($trigger)
    {
        $this->trigger = $trigger;
    }
    /**
     * @return Trigger[]
     */
    public function getTrigger()
    {
        return $this->trigger;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ListTriggersResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_ListTriggersResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class ContainerAccess extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var string
     */
    public $containerId;
    /**
     * @var string
     */
    public $permission;
    /**
     * @param string
     */
    public function setContainerId($containerId)
    {
        $this->containerId = $containerId;
    }
    /**
     * @return string
     */
    public function getContainerId()
    {
        return $this->containerId;
    }
    /**
     * @param string
     */
    public function setPermission($permission)
    {
        $this->permission = $permission;
    }
    /**
     * @return string
     */
    public function getPermission()
    {
        return $this->permission;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ContainerAccess::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_ContainerAccess');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class ListTransformationsResponse extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'transformation';
    /**
     * @var string
     */
    public $nextPageToken;
    protected $transformationType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Transformation::class;
    protected $transformationDataType = 'array';
    /**
     * @param string
     */
    public function setNextPageToken($nextPageToken)
    {
        $this->nextPageToken = $nextPageToken;
    }
    /**
     * @return string
     */
    public function getNextPageToken()
    {
        return $this->nextPageToken;
    }
    /**
     * @param Transformation[]
     */
    public function setTransformation($transformation)
    {
        $this->transformation = $transformation;
    }
    /**
     * @return Transformation[]
     */
    public function getTransformation()
    {
        return $this->transformation;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\ListTransformationsResponse::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_ListTransformationsResponse');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class Environment extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var string
     */
    public $accountId;
    /**
     * @var string
     */
    public $authorizationCode;
    /**
     * @var string
     */
    public $authorizationTimestamp;
    /**
     * @var string
     */
    public $containerId;
    /**
     * @var string
     */
    public $containerVersionId;
    /**
     * @var string
     */
    public $description;
    /**
     * @var bool
     */
    public $enableDebug;
    /**
     * @var string
     */
    public $environmentId;
    /**
     * @var string
     */
    public $fingerprint;
    /**
     * @var string
     */
    public $name;
    /**
     * @var string
     */
    public $path;
    /**
     * @var string
     */
    public $tagManagerUrl;
    /**
     * @var string
     */
    public $type;
    /**
     * @var string
     */
    public $url;
    /**
     * @var string
     */
    public $workspaceId;
    /**
     * @param string
     */
    public function setAccountId($accountId)
    {
        $this->accountId = $accountId;
    }
    /**
     * @return string
     */
    public function getAccountId()
    {
        return $this->accountId;
    }
    /**
     * @param string
     */
    public function setAuthorizationCode($authorizationCode)
    {
        $this->authorizationCode = $authorizationCode;
    }
    /**
     * @return string
     */
    public function getAuthorizationCode()
    {
        return $this->authorizationCode;
    }
    /**
     * @param string
     */
    public function setAuthorizationTimestamp($authorizationTimestamp)
    {
        $this->authorizationTimestamp = $authorizationTimestamp;
    }
    /**
     * @return string
     */
    public function getAuthorizationTimestamp()
    {
        return $this->authorizationTimestamp;
    }
    /**
     * @param string
     */
    public function setContainerId($containerId)
    {
        $this->containerId = $containerId;
    }
    /**
     * @return string
     */
    public function getContainerId()
    {
        return $this->containerId;
    }
    /**
     * @param string
     */
    public function setContainerVersionId($containerVersionId)
    {
        $this->containerVersionId = $containerVersionId;
    }
    /**
     * @return string
     */
    public function getContainerVersionId()
    {
        return $this->containerVersionId;
    }
    /**
     * @param string
     */
    public function setDescription($description)
    {
        $this->description = $description;
    }
    /**
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }
    /**
     * @param bool
     */
    public function setEnableDebug($enableDebug)
    {
        $this->enableDebug = $enableDebug;
    }
    /**
     * @return bool
     */
    public function getEnableDebug()
    {
        return $this->enableDebug;
    }
    /**
     * @param string
     */
    public function setEnvironmentId($environmentId)
    {
        $this->environmentId = $environmentId;
    }
    /**
     * @return string
     */
    public function getEnvironmentId()
    {
        return $this->environmentId;
    }
    /**
     * @param string
     */
    public function setFingerprint($fingerprint)
    {
        $this->fingerprint = $fingerprint;
    }
    /**
     * @return string
     */
    public function getFingerprint()
    {
        return $this->fingerprint;
    }
    /**
     * @param string
     */
    public function setName($name)
    {
        $this->name = $name;
    }
    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * @param string
     */
    public function setPath($path)
    {
        $this->path = $path;
    }
    /**
     * @return string
     */
    public function getPath()
    {
        return $this->path;
    }
    /**
     * @param string
     */
    public function setTagManagerUrl($tagManagerUrl)
    {
        $this->tagManagerUrl = $tagManagerUrl;
    }
    /**
     * @return string
     */
    public function getTagManagerUrl()
    {
        return $this->tagManagerUrl;
    }
    /**
     * @param string
     */
    public function setType($type)
    {
        $this->type = $type;
    }
    /**
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }
    /**
     * @param string
     */
    public function setUrl($url)
    {
        $this->url = $url;
    }
    /**
     * @return string
     */
    public function getUrl()
    {
        return $this->url;
    }
    /**
     * @param string
     */
    public function setWorkspaceId($workspaceId)
    {
        $this->workspaceId = $workspaceId;
    }
    /**
     * @return string
     */
    public function getWorkspaceId()
    {
        return $this->workspaceId;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Environment::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_Environment');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class Client extends \Google\Site_Kit_Dependencies\Google\Collection
{
    protected $collection_key = 'parameter';
    /**
     * @var string
     */
    public $accountId;
    /**
     * @var string
     */
    public $clientId;
    /**
     * @var string
     */
    public $containerId;
    /**
     * @var string
     */
    public $fingerprint;
    /**
     * @var string
     */
    public $name;
    /**
     * @var string
     */
    public $notes;
    protected $parameterType = \Google\Site_Kit_Dependencies\Google\Service\TagManager\Parameter::class;
    protected $parameterDataType = 'array';
    /**
     * @var string
     */
    public $parentFolderId;
    /**
     * @var string
     */
    public $path;
    /**
     * @var int
     */
    public $priority;
    /**
     * @var string
     */
    public $tagManagerUrl;
    /**
     * @var string
     */
    public $type;
    /**
     * @var string
     */
    public $workspaceId;
    /**
     * @param string
     */
    public function setAccountId($accountId)
    {
        $this->accountId = $accountId;
    }
    /**
     * @return string
     */
    public function getAccountId()
    {
        return $this->accountId;
    }
    /**
     * @param string
     */
    public function setClientId($clientId)
    {
        $this->clientId = $clientId;
    }
    /**
     * @return string
     */
    public function getClientId()
    {
        return $this->clientId;
    }
    /**
     * @param string
     */
    public function setContainerId($containerId)
    {
        $this->containerId = $containerId;
    }
    /**
     * @return string
     */
    public function getContainerId()
    {
        return $this->containerId;
    }
    /**
     * @param string
     */
    public function setFingerprint($fingerprint)
    {
        $this->fingerprint = $fingerprint;
    }
    /**
     * @return string
     */
    public function getFingerprint()
    {
        return $this->fingerprint;
    }
    /**
     * @param string
     */
    public function setName($name)
    {
        $this->name = $name;
    }
    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * @param string
     */
    public function setNotes($notes)
    {
        $this->notes = $notes;
    }
    /**
     * @return string
     */
    public function getNotes()
    {
        return $this->notes;
    }
    /**
     * @param Parameter[]
     */
    public function setParameter($parameter)
    {
        $this->parameter = $parameter;
    }
    /**
     * @return Parameter[]
     */
    public function getParameter()
    {
        return $this->parameter;
    }
    /**
     * @param string
     */
    public function setParentFolderId($parentFolderId)
    {
        $this->parentFolderId = $parentFolderId;
    }
    /**
     * @return string
     */
    public function getParentFolderId()
    {
        return $this->parentFolderId;
    }
    /**
     * @param string
     */
    public function setPath($path)
    {
        $this->path = $path;
    }
    /**
     * @return string
     */
    public function getPath()
    {
        return $this->path;
    }
    /**
     * @param int
     */
    public function setPriority($priority)
    {
        $this->priority = $priority;
    }
    /**
     * @return int
     */
    public function getPriority()
    {
        return $this->priority;
    }
    /**
     * @param string
     */
    public function setTagManagerUrl($tagManagerUrl)
    {
        $this->tagManagerUrl = $tagManagerUrl;
    }
    /**
     * @return string
     */
    public function getTagManagerUrl()
    {
        return $this->tagManagerUrl;
    }
    /**
     * @param string
     */
    public function setType($type)
    {
        $this->type = $type;
    }
    /**
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }
    /**
     * @param string
     */
    public function setWorkspaceId($workspaceId)
    {
        $this->workspaceId = $workspaceId;
    }
    /**
     * @return string
     */
    public function getWorkspaceId()
    {
        return $this->workspaceId;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\Client::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_Client');
<?php

/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
namespace Google\Site_Kit_Dependencies\Google\Service\TagManager;

class AccountFeatures extends \Google\Site_Kit_Dependencies\Google\Model
{
    /**
     * @var bool
     */
    public $supportMultipleContainers;
    /**
     * @var bool
     */
    public $supportUserPermissions;
    /**
     * @param bool
     */
    public function setSupportMultipleContainers($supportMultipleContainers)
    {
        $this->supportMultipleContainers = $supportMultipleContainers;
    }
    /**
     * @return bool
     */
    public function getSupportMultipleContainers()
    {
        return $this->supportMultipleContainers;
    }
    /**
     * @param bool
     */
    public function setSupportUserPermissions($supportUserPermissions)
    {
        $this->supportUserPermissions = $supportUserPermissions;
    }
    /**
     * @return bool
     */
    public function getSupportUserPermissions()
    {
        return $this->supportUserPermissions;
    }
}
// Adding a class alias for backwards compatibility with the previous class name.
\class_alias(\Google\Site_Kit_Dependencies\Google\Service\TagManager\AccountFeatures::class, 'Google\\Site_Kit_Dependencies\\Google_Service_TagManager_AccountFeatures');

F1le Man4ger