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 In
6
{
7
    /**
8
     * The name of the rule.
9
     *
10
     * @var string
11
     */
12
    protected $rule = 'in';
13
 
14
    /**
15
     * The accepted values.
16
     *
17
     * @var array
18
     */
19
    protected $values;
20
 
21
    /**
22
     * Create a new 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
     * @see \Illuminate\Validation\ValidationRuleParser::parseParameters
38
     */
39
    public function __toString()
40
    {
41
        $values = array_map(function ($value) {
42
            return '"'.str_replace('"', '""', $value).'"';
43
        }, $this->values);
44
 
45
        return $this->rule.':'.implode(',', $values);
46
    }
47
}