<?php
 
namespace App\Rules;

use Illuminate\Contracts\Validation\Rule;

class SynCookieOsGate implements Rule
{
    /* The operating system classes SYN cookies can be forced for. */
    public const VALID_GATES = [ 'non-windows', 'windows' ];

    public function passes($attribute, $value)
    {

        if($value === null) {
            return true;
        }

        return is_string($value) && in_array($value, self::VALID_GATES, true);

    }
 
    public function message()
    {
        return 'The :attribute must be null, `non-windows` or `windows`.';
    }
}
