wordpress-seo
/
vendor_prefixed
/
league
/
oauth2-client
/
src
/
OptionProvider
/
PostAuthOptionProvider.php
PostAuthOptionProvider.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.2, at vendor_prefixed/league/oauth2-client/src/OptionProvider/PostAuthOptionProvider.php
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This file is part of the league/oauth2-client library |
| 5 | * |
| 6 | * For the full copyright and license information, please view the LICENSE |
| 7 | * file that was distributed with this source code. |
| 8 | * |
| 9 | * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com> |
| 10 | * @license http://opensource.org/licenses/MIT MIT |
| 11 | * @link http://thephpleague.com/oauth2-client/ Documentation |
| 12 | * @link https://packagist.org/packages/league/oauth2-client Packagist |
| 13 | * @link https://github.com/thephpleague/oauth2-client GitHub |
| 14 | */ |
| 15 | namespace YoastSEO_Vendor\League\OAuth2\Client\OptionProvider; |
| 16 | |
| 17 | use YoastSEO_Vendor\League\OAuth2\Client\Provider\AbstractProvider; |
| 18 | use YoastSEO_Vendor\League\OAuth2\Client\Tool\QueryBuilderTrait; |
| 19 | /** |
| 20 | * Provide options for access token |
| 21 | */ |
| 22 | class PostAuthOptionProvider implements \YoastSEO_Vendor\League\OAuth2\Client\OptionProvider\OptionProviderInterface |
| 23 | { |
| 24 | use QueryBuilderTrait; |
| 25 | /** |
| 26 | * @inheritdoc |
| 27 | */ |
| 28 | public function getAccessTokenOptions($method, array $params) |
| 29 | { |
| 30 | $options = ['headers' => ['content-type' => 'application/x-www-form-urlencoded']]; |
| 31 | if ($method === \YoastSEO_Vendor\League\OAuth2\Client\Provider\AbstractProvider::METHOD_POST) { |
| 32 | $options['body'] = $this->getAccessTokenBody($params); |
| 33 | } |
| 34 | return $options; |
| 35 | } |
| 36 | /** |
| 37 | * Returns the request body for requesting an access token. |
| 38 | * |
| 39 | * @param array $params |
| 40 | * @return string |
| 41 | */ |
| 42 | protected function getAccessTokenBody(array $params) |
| 43 | { |
| 44 | return $this->buildQueryString($params); |
| 45 | } |
| 46 | } |
| 47 |