Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Validation\Rules;
4
 
5
class NotIn
6
{
7
    /**
8
     * The name of the rule.
9
     *
10
     * @var string
11
     */
12
    protected $rule = 'not_in';
13
 
14
    /**
15
     * The accepted values.
16
     *
17
     * @var array
18
     */
19
    protected $values;
20
 
21
    /**
22
     * Create a new "not in" rule instance.
23
     *
24
     * @param  array  $values
25
     * @return void
26
     */
27
    public function __construct(array $values)
28
    {
29
        $this->values = $values;
30
    }
31
 
32
    /**
33
     * Convert the rule to a validation string.
34
     *
35
     * @return string
36
     */
37
    public function __toString()
38
    {
39
        $values = array_map(function ($value) {
40
            return '"'.str_replace('"', '""', $value).'"';
41
        }, $this->values);
42
 
43
        return $this->rule.':'.implode(',', $values);
44
    }
45
}