<commit_before><?php namespace Limoncello\OAuthServer\Contracts\Integration;

/**
 * Copyright 2015-2018 <EMAIL>
 *
 * 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.
 */

use Limoncello\OAuthServer\Contracts\AuthorizationCodeInterface;
use Limoncello\OAuthServer\Contracts\ClientInterface;
use Psr\Http\Message\ResponseInterface;

/**
 * Authorization code integration interface for server.
 *
 * @package Limoncello\OAuthServer
 */
interface CodeIntegrationInterface extends IntegrationInterface
{
    /**
     * @param ClientInterface $client
     * @param array|null      $scopes
     *
     * @return array [bool $isScopeValid, string[]|null $scopeList, bool $isScopeModified] Scope list `null` for
     *               invalid, string[] otherwise.
     */
    public function codeValidateScope(ClientInterface $client, array $scopes = null): array;

    /** @noinspection PhpTooManyParametersInspection
     * @param ClientInterface $client
     * @param string|null     $redirectUri
     * @param bool            $isScopeModified
     * @param string[]|null   $scopeList
     * @param string|null     $state
     * @param array           $extraParameters
     *
     * @return ResponseInterface
     *
     * @link https://tools.ietf.org/html/rfc6749#section-4.1.2
     *
     * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
     */
    public function codeCreateAskResourceOwnerForApprovalResponse(
        ClientInterface $client,
        string $redirectUri = null,
        bool $isScopeModified = false,
        array $scopeList = null,
        string $state = null,
        array $extraParameters = []
    ): ResponseInterface;

    /**
     * @param string $code
     *
     * @return AuthorizationCodeInterface|null
     */
    public function codeReadAuthenticationCode(string $code): ?AuthorizationCodeInterface;

    /**
     * Revoke all tokens issued based on the input authorization code.
     *
     * @param AuthorizationCodeInterface $code
     *
     * @return void
     *
     * @link https://tools.ietf.org/html/rfc6749#section-10.5
     */
    public function codeRevokeTokens(AuthorizationCodeInterface $code): void;<commit_msg>Correct reference to RFC.<commit_after><?php namespace Limoncello\OAuthServer\Contracts\Integration;

/**
 * Copyright 2015-2018 <EMAIL>
 *
 * 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.
 */

use Limoncello\OAuthServer\Contracts\AuthorizationCodeInterface;
use Limoncello\OAuthServer\Contracts\ClientInterface;
use Psr\Http\Message\ResponseInterface;

/**
 * Authorization code integration interface for server.
 *
 * @package Limoncello\OAuthServer
 */
interface CodeIntegrationInterface extends IntegrationInterface
{
    /**
     * @param ClientInterface $client
     * @param array|null      $scopes
     *
     * @return array [bool $isScopeValid, string[]|null $scopeList, bool $isScopeModified] Scope list `null` for
     *               invalid, string[] otherwise.
     */
    public function codeValidateScope(ClientInterface $client, array $scopes = null): array;

    /** @noinspection PhpTooManyParametersInspection
     * @param ClientInterface $client
     * @param string|null     $redirectUri
     * @param bool            $isScopeModified
     * @param string[]|null   $scopeList
     * @param string|null     $state
     * @param array           $extraParameters
     *
     * @return ResponseInterface
     *
     * @link https://tools.ietf.org/html/rfc6749#section-4.1.1
     *
     * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
     */
    public function codeCreateAskResourceOwnerForApprovalResponse(
        ClientInterface $client,
        string $redirectUri = null,
        bool $isScopeModified = false,
        array $scopeList = null,
        string $state = null,
        array $extraParameters = []
    ): ResponseInterface;

    /**
     * @param string $code
     *
     * @return AuthorizationCodeInterface|null
     */
    public function codeReadAuthenticationCode(string $code): ?AuthorizationCodeInterface;

    /**
     * Revoke all tokens issued based on the input authorization code.
     *
     * @param AuthorizationCodeInterface $code
     *
     * @return void
     *
     * @link https://tools.ietf.org/html/rfc6749#section-10.5
     */
    public function codeRevokeTokens(AuthorizationCodeInterface $code): void;
{'fraction_non_alphanumeric': 0.09113115370161594, 'fraction_numerical': 0.00977076287110109, 'mean_word_length': 3.123160340821069, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '9894', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1424, 'n_words': 418}