# wpide/3.5.9/vendor/rakit/validation/src/Rules/NotIn.php

WPIDE – File Manager &amp; Code Editor, version 3.5.9. 62 lines.

- Page: https://pluginprobe.com/plugins/wpide/3.5.9/code/vendor/rakit/validation/src/Rules/NotIn.php
- Raw: https://pluginprobe.com/plugins/wpide/3.5.9/raw/vendor/rakit/validation/src/Rules/NotIn.php
- Modified: 2022-07-30T20:33:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wpide/3.5.9/code/vendor/rakit/validation/src/Rules/NotIn.php#L10-L20`.

```php
<?php

namespace Rakit\Validation\Rules;

use Rakit\Validation\Helper;
use Rakit\Validation\Rule;

class NotIn extends Rule
{

    /** @var string */
    protected $message = "The :attribute is not allowing :disallowed_values";

    /** @var bool */
    protected $strict = false;

    /**
     * Given $params and assign the $this->params
     *
     * @param array $params
     * @return self
     */
    public function fillParameters(array $params): Rule
    {
        if (count($params) == 1 and is_array($params[0])) {
            $params = $params[0];
        }
        $this->params['disallowed_values'] = $params;
        return $this;
    }

    /**
     * Set strict value
     *
     * @param bool $strict
     * @return void
     */
    public function strict($strict = true)
    {
        $this->strict = $strict;
    }

    /**
     * Check the $value is valid
     *
     * @param mixed $value
     * @return bool
     */
    public function check($value): bool
    {
        $this->requireParameters(['disallowed_values']);

        $disallowedValues = (array) $this->parameter('disallowed_values');

        $and = $this->validation ? $this->validation->getTranslation('and') : 'and';
        $disallowedValuesText = Helper::join(Helper::wraps($disallowedValues, "'"), ', ', ", {$and} ");
        $this->setParameterText('disallowed_values', $disallowedValuesText);

        return !in_array($value, $disallowedValues, $this->strict);
    }
}

```
