-
-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathstructarmed.php
More file actions
153 lines (143 loc) · 6.06 KB
/
Copy pathstructarmed.php
File metadata and controls
153 lines (143 loc) · 6.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
declare(strict_types=1);
use Boundwize\StructArmed\Architecture;
use Boundwize\StructArmed\Preset\Preset;
$layerPatterns = [
'Auth' => '/^Spiral\\\\Auth\\\\.*$/',
'Boot' => '/^Spiral\\\\Boot\\\\.*$/',
'Broadcasting' => '/^Spiral\\\\Broadcasting\\\\.*$/',
'Cache' => '/^Spiral\\\\Cache\\\\.*$/',
'Config' => '/^Spiral\\\\Config\\\\.*$/',
'Console' => '/^Spiral\\\\Console\\\\.*$/',
'Cookies' => '/^Spiral\\\\Cookies\\\\.*$/',
'Core' => '/^Spiral\\\\Core\\\\.*$/',
'Csrf' => '/^Spiral\\\\Csrf\\\\.*$/',
'Debug' => '/^Spiral\\\\Debug\\\\.*$/',
'Distribution' => '/^Spiral\\\\Distribution\\\\.*$/',
'DotEnv' => '/^Spiral\\\\DotEnv\\\\.*$/',
'Encrypter' => '/^Spiral\\\\Encrypter\\\\.*$/',
'Events' => '/^Spiral\\\\Events\\\\.*$/',
'Exceptions' => '/^Spiral\\\\Exceptions\\\\.*$/',
'Files' => '/^Spiral\\\\Files\\\\.*$/',
'Filters' => '/^Spiral\\\\Filters\\\\.*$/',
'Framework' => '/^Spiral\\\\(?:Attribute|Bootloader|Command|Domain|Filter|Framework|Module)(?:\\\\.*)?$/',
'Http' => '/^Spiral\\\\Http\\\\.*$/',
'Interceptors' => '/^Spiral\\\\Interceptors\\\\.*$/',
'Logger' => '/^Spiral\\\\Logger\\\\.*$/',
'Mailer' => '/^Spiral\\\\Mailer\\\\.*$/',
'Models' => '/^Spiral\\\\Models\\\\.*$/',
'Monolog' => '/^Spiral\\\\Monolog\\\\.*$/',
'Pagination' => '/^Spiral\\\\Pagination\\\\.*$/',
'Prototype' => '/^Spiral\\\\Prototype\\\\.*$/',
'Queue' => '/^Spiral\\\\Queue\\\\.*$/',
'Reactor' => '/^Spiral\\\\Reactor\\\\.*$/',
'Router' => '/^Spiral\\\\Router\\\\.*$/',
'Scaffolder' => '/^Spiral\\\\Scaffolder\\\\.*$/',
'Security' => '/^Spiral\\\\Security\\\\.*$/',
'SendIt' => '/^Spiral\\\\SendIt\\\\.*$/',
'Serializer' => '/^Spiral\\\\Serializer\\\\.*$/',
'Session' => '/^Spiral\\\\Session\\\\.*$/',
'Snapshots' => '/^Spiral\\\\Snapshots\\\\.*$/',
'Stempler' => '/^Spiral\\\\Stempler\\\\.*$/',
'Storage' => '/^Spiral\\\\Storage\\\\.*$/',
'Streams' => '/^Spiral\\\\Streams\\\\.*$/',
'Telemetry' => '/^Spiral\\\\Telemetry\\\\.*$/',
'Tokenizer' => '/^Spiral\\\\Tokenizer\\\\.*$/',
'Translator' => '/^Spiral\\\\Translator\\\\.*$/',
'Validation' => '/^Spiral\\\\Validation\\\\.*$/',
'Views' => '/^Spiral\\\\Views\\\\.*$/',
];
$frameworkDependencies = array_values(array_diff(array_keys($layerPatterns), ['Framework']));
$ruleset = [
'Auth' => ['Cache', 'Cookies', 'Core', 'Session'],
'Boot' => ['Config', 'Core', 'Debug', 'Events', 'Exceptions', 'Files', 'Framework', 'Logger'],
'Broadcasting' => ['Boot', 'Config', 'Core', 'Framework'],
'Cache' => ['Boot', 'Config', 'Core', 'Files'],
'Config' => ['Core'],
'Console' => ['Boot', 'Config', 'Core', 'Events', 'Exceptions', 'Files', 'Framework', 'Interceptors', 'Logger', 'Tokenizer'],
'Cookies' => ['Core', 'Encrypter', 'Framework'],
'Core' => ['Interceptors', 'Security'],
'Csrf' => ['Cookies', 'Core'],
'Debug' => ['Boot', 'Core', 'Logger'],
'Distribution' => ['Boot', 'Config', 'Core'],
'DotEnv' => ['Boot', 'Core'],
'Encrypter' => ['Core'],
'Events' => ['Boot', 'Config', 'Core', 'Framework', 'Interceptors', 'Tokenizer'],
'Exceptions' => ['Boot', 'Core', 'Debug', 'Filters', 'Http', 'Snapshots'],
'Files' => [],
'Filters' => ['Auth', 'Core', 'Interceptors', 'Models', 'Validation'],
'Framework' => $frameworkDependencies,
'Http' => ['Boot', 'Core', 'Exceptions', 'Files', 'Framework', 'Logger', 'Pagination', 'Router', 'Streams', 'Telemetry'],
'Interceptors' => ['Core'],
'Logger' => ['Boot', 'Core'],
'Mailer' => [],
'Models' => [],
'Monolog' => ['Boot', 'Config', 'Core', 'Logger'],
'Pagination' => [],
'Prototype' => [
'Auth',
'Boot',
'Broadcasting',
'Cache',
'Config',
'Console',
'Cookies',
'Core',
'Encrypter',
'Events',
'Exceptions',
'Files',
'Framework',
'Http',
'Interceptors',
'Logger',
'Pagination',
'Queue',
'Reactor',
'Router',
'Security',
'Serializer',
'Session',
'Snapshots',
'Storage',
'Tokenizer',
'Translator',
'Validation',
'Views',
],
'Queue' => ['Boot', 'Config', 'Core', 'Exceptions', 'Interceptors', 'Serializer', 'Snapshots', 'Telemetry', 'Tokenizer'],
'Reactor' => ['Files'],
'Router' => ['Boot', 'Core', 'Framework', 'Http', 'Interceptors', 'Telemetry', 'Tokenizer'],
'Scaffolder' => ['Boot', 'Config', 'Console', 'Core', 'Events', 'Files', 'Filters', 'Framework', 'Interceptors', 'Prototype', 'Queue', 'Reactor', 'Router', 'Validation'],
'Security' => ['Console', 'Core', 'Events', 'Interceptors'],
'SendIt' => ['Boot', 'Config', 'Core', 'Logger', 'Mailer', 'Queue', 'Stempler', 'Views'],
'Serializer' => ['Boot', 'Config', 'Core'],
'Session' => ['Cache', 'Cookies', 'Core', 'Files', 'Http'],
'Snapshots' => ['Exceptions', 'Files', 'Storage'],
'Stempler' => ['Boot', 'Config', 'Core', 'Files', 'Router', 'Translator', 'Views'],
'Storage' => ['Boot', 'Config', 'Core', 'Distribution'],
'Streams' => [],
'Telemetry' => ['Boot', 'Config', 'Core', 'Logger'],
'Tokenizer' => ['Boot', 'Config', 'Core', 'Framework', 'Logger'],
'Translator' => ['Boot', 'Core', 'Logger', 'Tokenizer', 'Views'],
'Validation' => ['Boot', 'Config', 'Core'],
'Views' => ['Boot', 'Config', 'Core', 'Files'],
];
$architecture = Architecture::define()
->skipPaths([
// fixtures
'src/Tokenizer/tests/Enums',
'src/Tokenizer/tests/Interfaces',
'src/Tokenizer/tests/Classes',
'src/Scaffolder/tests/App/config',
// multiple classes in one file on purpose
'src/Tokenizer/tests/ReflectionFileTest.php',
'src/Core/tests/Internal/Proxy/ProxyClassRendererTest.php',
// uses as bootstrapping
'src/Core/tests/bootstrap.php',
])
->ruleset($ruleset);
foreach ($layerPatterns as $name => $pattern) {
$architecture->layerPattern($name, $pattern);
}
return $architecture->withPreset(Preset::PSR4());