<commit_before><?php

namespace Keboola\StorageApi\Options;

use Keboola\StorageApi\ClientException;

abstract class TokenAbstractOptions
{
    const BUCKET_PERMISSION_WRITE = 'write';
    const BUCKET_PERMISSION_READ = 'read';

    /** @var string|null */
    private $description;

    /** @var bool|null */
    private $canReadAllFileUploads;

    /** @var array */
    private $bucketPermissions = [];

    /** @var array */
    private $componentAccess = [];

    /**
     * @return string|null
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * @param string $description
     * @return $this
     */
    public function setDescription($description)
    {
        $this->description = (string) $description;
        return $this;
    }

    /**
     * @return bool|null
     */
    public function getCanReadAllFileUploads()
    {
        return $this->canReadAllFileUploads;
    }

    /**
     * @param bool $canReadAll
     * @return $this
     */
    public function setCanReadAllFileUploads($canReadAll)
    {
        $this->canReadAllFileUploads = (bool) $canReadAll;
        return $this;
    }

    /**
     * @return array
     */
    public function getBucketPermissions()
    {
        return $this->bucketPermissions;
    }

    /**
     * @param string $bucketId
     * @param string $permission
     * @return $this
     * @throws ClientException
     */
    public function addBucketPermission($bucketId, $permission)
    {
        $possibleValues = [self::BUCKET_PERMISSION_READ, self::BUCKET_PERMISSION_WRITE];

        if (!in_array($permission, $possibleValues)) {
            throw new ClientException(
                sprintf(
                    'Invalid bucket permission "%s". Available permissions "%s"',
                    $permission,
                    implode('|', $possibleValues)
                )
            );
        }
<commit_msg>Revert "fixup addBucketPermission option validation"<commit_after><?php

namespace Keboola\StorageApi\Options;

abstract class TokenAbstractOptions
{
    const BUCKET_PERMISSION_WRITE = 'write';
    const BUCKET_PERMISSION_READ = 'read';

    /** @var string|null */
    private $description;

    /** @var bool|null */
    private $canReadAllFileUploads;

    /** @var array */
    private $bucketPermissions = [];

    /** @var array */
    private $componentAccess = [];

    /**
     * @return string|null
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * @param string $description
     * @return $this
     */
    public function setDescription($description)
    {
        $this->description = (string) $description;
        return $this;
    }

    /**
     * @return bool|null
     */
    public function getCanReadAllFileUploads()
    {
        return $this->canReadAllFileUploads;
    }

    /**
     * @param bool $canReadAll
     * @return $this
     */
    public function setCanReadAllFileUploads($canReadAll)
    {
        $this->canReadAllFileUploads = (bool) $canReadAll;
        return $this;
    }

    /**
     * @return array
     */
    public function getBucketPermissions()
    {
        return $this->bucketPermissions;
    }

    /**
     * @param string $bucketId
     * @param string $permission
     * @return $this
     */
    public function addBucketPermission($bucketId, $permission)
    {
{'fraction_non_alphanumeric': 0.11814717091761946, 'fraction_numerical': 0.0, 'mean_word_length': 2.1828358208955225, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '4820011', 'n_tokens_mistral': 983, 'n_tokens_neox': 971, 'n_words': 202}