Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <fabien@symfony.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
 
12
namespace Symfony\Component\Routing\Annotation;
13
 
14
/**
15
 * Annotation class for @Route().
16
 *
17
 * @Annotation
18
 * @NamedArgumentConstructor
19
 * @Target({"CLASS", "METHOD"})
20
 *
21
 * @author Fabien Potencier <fabien@symfony.com>
22
 * @author Alexander M. Turek <me@derrabus.de>
23
 */
24
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)]
25
class Route
26
{
27
    private ?string $path = null;
28
    private array $localizedPaths = [];
29
    private array $methods;
30
    private array $schemes;
31
 
32
    /**
33
     * @param array<string|\Stringable> $requirements
34
     * @param string[]|string           $methods
35
     * @param string[]|string           $schemes
36
     */
37
    public function __construct(
38
        string|array $path = null,
39
        private ?string $name = null,
40
        private array $requirements = [],
41
        private array $options = [],
42
        private array $defaults = [],
43
        private ?string $host = null,
44
        array|string $methods = [],
45
        array|string $schemes = [],
46
        private ?string $condition = null,
47
        private ?int $priority = null,
48
        string $locale = null,
49
        string $format = null,
50
        bool $utf8 = null,
51
        bool $stateless = null,
52
        private ?string $env = null
53
    ) {
54
        if (\is_array($path)) {
55
            $this->localizedPaths = $path;
56
        } else {
57
            $this->path = $path;
58
        }
59
        $this->setMethods($methods);
60
        $this->setSchemes($schemes);
61
 
62
        if (null !== $locale) {
63
            $this->defaults['_locale'] = $locale;
64
        }
65
 
66
        if (null !== $format) {
67
            $this->defaults['_format'] = $format;
68
        }
69
 
70
        if (null !== $utf8) {
71
            $this->options['utf8'] = $utf8;
72
        }
73
 
74
        if (null !== $stateless) {
75
            $this->defaults['_stateless'] = $stateless;
76
        }
77
    }
78
 
79
    public function setPath(string $path)
80
    {
81
        $this->path = $path;
82
    }
83
 
84
    public function getPath()
85
    {
86
        return $this->path;
87
    }
88
 
89
    public function setLocalizedPaths(array $localizedPaths)
90
    {
91
        $this->localizedPaths = $localizedPaths;
92
    }
93
 
94
    public function getLocalizedPaths(): array
95
    {
96
        return $this->localizedPaths;
97
    }
98
 
99
    public function setHost(string $pattern)
100
    {
101
        $this->host = $pattern;
102
    }
103
 
104
    public function getHost()
105
    {
106
        return $this->host;
107
    }
108
 
109
    public function setName(string $name)
110
    {
111
        $this->name = $name;
112
    }
113
 
114
    public function getName()
115
    {
116
        return $this->name;
117
    }
118
 
119
    public function setRequirements(array $requirements)
120
    {
121
        $this->requirements = $requirements;
122
    }
123
 
124
    public function getRequirements()
125
    {
126
        return $this->requirements;
127
    }
128
 
129
    public function setOptions(array $options)
130
    {
131
        $this->options = $options;
132
    }
133
 
134
    public function getOptions()
135
    {
136
        return $this->options;
137
    }
138
 
139
    public function setDefaults(array $defaults)
140
    {
141
        $this->defaults = $defaults;
142
    }
143
 
144
    public function getDefaults()
145
    {
146
        return $this->defaults;
147
    }
148
 
149
    public function setSchemes(array|string $schemes)
150
    {
151
        $this->schemes = (array) $schemes;
152
    }
153
 
154
    public function getSchemes()
155
    {
156
        return $this->schemes;
157
    }
158
 
159
    public function setMethods(array|string $methods)
160
    {
161
        $this->methods = (array) $methods;
162
    }
163
 
164
    public function getMethods()
165
    {
166
        return $this->methods;
167
    }
168
 
169
    public function setCondition(?string $condition)
170
    {
171
        $this->condition = $condition;
172
    }
173
 
174
    public function getCondition()
175
    {
176
        return $this->condition;
177
    }
178
 
179
    public function setPriority(int $priority): void
180
    {
181
        $this->priority = $priority;
182
    }
183
 
184
    public function getPriority(): ?int
185
    {
186
        return $this->priority;
187
    }
188
 
189
    public function setEnv(?string $env): void
190
    {
191
        $this->env = $env;
192
    }
193
 
194
    public function getEnv(): ?string
195
    {
196
        return $this->env;
197
    }
198
}