<commit_before><?php

namespace fkooman\RemoteStorage;

use fkooman\Rest\Plugin\Authentication\Bearer\ValidatorInterface;
use fkooman\Rest\Plugin\Authentication\Bearer\TokenInfo;

class FakeTokenValidator implements ValidatorInterface
{
    /**
     * @return TokenInfo
     */
    public function validate($bearerToken)
    {
        switch ($bearerToken) {
            case 'token':
                return new TokenInfo(
                    array(
                        'active' => true,
                        'username' => 'demo',
                        'scope' => 'api-test:rw',
                    )
                );
            case 'root_token':
                return new TokenInfo(
                    array(
                        'active' => true,
                        'username' => 'demo',
                        'scope' => '*:rw',
                    )
                );
            default:
                return new TokenInfo(
                    array(
                        'active' => false,
                    )
                );
        }
    }
}
<commit_msg>add a :r token for api-test-suite<commit_after><?php

namespace fkooman\RemoteStorage;

use fkooman\Rest\Plugin\Authentication\Bearer\ValidatorInterface;
use fkooman\Rest\Plugin\Authentication\Bearer\TokenInfo;

class FakeTokenValidator implements ValidatorInterface
{
    /**
     * @return TokenInfo
     */
    public function validate($bearerToken)
    {
        switch ($bearerToken) {
            case 'token':
                return new TokenInfo(
                    array(
                        'active' => true,
                        'username' => 'demo',
                        'scope' => 'api-test:rw',
                    )
                );
            case 'root_token':
                return new TokenInfo(
                    array(
                        'active' => true,
                        'username' => 'demo',
                        'scope' => '*:rw',
                    )
                );
            case 'read_only_token':
                return new TokenInfo(
                    array(
                        'active' => true,
                        'username' => 'demo',
                        'scope' => 'api-test:r',
                    )
                );
            default:
                return new TokenInfo(
                    array(
                        'active' => false,
                    )
                );
        }
    }
}

{'fraction_non_alphanumeric': 0.098676293622142, 'fraction_numerical': 0.0, 'mean_word_length': 0.9453978159126365, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5406034', 'n_tokens_mistral': 611, 'n_tokens_neox': 568, 'n_words': 115}