Skip to content

Commit a461a37

Browse files
committed
some constants are PascalCase
1 parent 7d30ce9 commit a461a37

13 files changed

Lines changed: 36 additions & 36 deletions

src/Application/Routers/Route.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ class Route extends Nette\Routing\Route implements Nette\Routing\Router
2424

2525
private const UiMeta = [
2626
'module' => [
27-
self::PATTERN => '[a-z][a-z0-9.-]*',
28-
self::FILTER_IN => [self::class, 'path2presenter'],
29-
self::FILTER_OUT => [self::class, 'presenter2path'],
27+
self::Pattern => '[a-z][a-z0-9.-]*',
28+
self::FilterIn => [self::class, 'path2presenter'],
29+
self::FilterOut => [self::class, 'presenter2path'],
3030
],
3131
'presenter' => [
32-
self::PATTERN => '[a-z][a-z0-9.-]*',
33-
self::FILTER_IN => [self::class, 'path2presenter'],
34-
self::FILTER_OUT => [self::class, 'presenter2path'],
32+
self::Pattern => '[a-z][a-z0-9.-]*',
33+
self::FilterIn => [self::class, 'path2presenter'],
34+
self::FilterOut => [self::class, 'presenter2path'],
3535
],
3636
'action' => [
37-
self::PATTERN => '[a-z][a-z0-9-]*',
38-
self::FILTER_IN => [self::class, 'path2action'],
39-
self::FILTER_OUT => [self::class, 'action2path'],
37+
self::Pattern => '[a-z][a-z0-9-]*',
38+
self::FilterIn => [self::class, 'path2action'],
39+
self::FilterOut => [self::class, 'action2path'],
4040
],
4141
];
4242

@@ -104,12 +104,12 @@ public function constructUrl(array $params, Nette\Http\UrlScript $refUrl): ?stri
104104
if (isset($metadata[self::ModuleKey])) { // try split into module and [submodule:]presenter parts
105105
$presenter = $params[self::PresenterKey];
106106
$module = $metadata[self::ModuleKey];
107-
$a = isset($module['fixity'], $module[self::VALUE])
108-
&& strncmp($presenter, $module[self::VALUE] . ':', strlen($module[self::VALUE]) + 1) === 0
109-
? strlen($module[self::VALUE])
107+
$a = isset($module['fixity'], $module[self::Value])
108+
&& strncmp($presenter, $module[self::Value] . ':', strlen($module[self::Value]) + 1) === 0
109+
? strlen($module[self::Value])
110110
: strrpos($presenter, ':');
111111
if ($a === false) {
112-
$params[self::ModuleKey] = isset($module[self::VALUE]) ? '' : null;
112+
$params[self::ModuleKey] = isset($module[self::Value]) ? '' : null;
113113
} else {
114114
$params[self::ModuleKey] = substr($presenter, 0, $a);
115115
$params[self::PresenterKey] = substr($presenter, $a + 1);

src/Application/UI/Component.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ final public function getParameters(): array
208208
final public function getParameterId(string $name): string
209209
{
210210
$uid = $this->getUniqueId();
211-
return $uid === '' ? $name : $uid . self::NAME_SEPARATOR . $name;
211+
return $uid === '' ? $name : $uid . self::NameSeparator . $name;
212212
}
213213

214214

src/Application/UI/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ protected function beforeRender()
126126
parent::beforeRender();
127127
$key = ($this->isMethod('post') ? '_' : '') . Presenter::SIGNAL_KEY;
128128
if (!isset($this[$key]) && $this->getAction() !== '') {
129-
$do = $this->lookupPath(Presenter::class) . self::NAME_SEPARATOR . 'submit';
129+
$do = $this->lookupPath(Presenter::class) . self::NameSeparator . 'submit';
130130
$this[$key] = (new Nette\Forms\Controls\HiddenField($do))->setOmitted();
131131
}
132132
}

src/Application/UI/Presenter.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ protected function createRequest(
773773
if (array_key_exists(0, $args)) {
774774
throw new InvalidLinkException("Unable to pass parameters to 'this!' signal.");
775775
}
776-
} elseif (!str_contains($signal, self::NAME_SEPARATOR)) {
776+
} elseif (!str_contains($signal, self::NameSeparator)) {
777777
// counterpart of signalReceived() & tryCall()
778778
$method = $component->formatSignalMethod($signal);
779779
if (!$reflection->hasCallableMethod($method)) {
@@ -797,7 +797,7 @@ protected function createRequest(
797797
}
798798

799799
if ($args && $component !== $this) {
800-
$prefix = $component->getUniqueId() . self::NAME_SEPARATOR;
800+
$prefix = $component->getUniqueId() . self::NameSeparator;
801801
foreach ($args as $key => $val) {
802802
unset($args[$key]);
803803
$args[$prefix . $key] = $val;
@@ -1114,7 +1114,7 @@ protected function getGlobalState(?string $forClass = null): array
11141114
if (!isset($this->globalState)) {
11151115
$state = [];
11161116
foreach ($this->globalParams as $id => $params) {
1117-
$prefix = $id . self::NAME_SEPARATOR;
1117+
$prefix = $id . self::NameSeparator;
11181118
foreach ($params as $key => $val) {
11191119
$state[$prefix . $key] = $val;
11201120
}
@@ -1142,7 +1142,7 @@ protected function getGlobalState(?string $forClass = null): array
11421142
continue;
11431143
}
11441144

1145-
$prefix = $component->getUniqueId() . self::NAME_SEPARATOR;
1145+
$prefix = $component->getUniqueId() . self::NameSeparator;
11461146
$params = [];
11471147
$component->saveState($params);
11481148
foreach ($params as $key => $val) {
@@ -1159,7 +1159,7 @@ protected function getGlobalState(?string $forClass = null): array
11591159
$since = null;
11601160
foreach ($state as $key => $foo) {
11611161
if (!isset($sinces[$key])) {
1162-
$x = strpos($key, self::NAME_SEPARATOR);
1162+
$x = strpos($key, self::NameSeparator);
11631163
$x = $x === false ? $key : substr($key, 0, $x);
11641164
$sinces[$key] = $sinces[$x] ?? false;
11651165
}

tests/Routers/Route.filter.global.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require __DIR__ . '/Route.php';
1717

1818
$route = new Route('<presenter>', [
1919
null => [
20-
Route::FILTER_IN => function (array $arr) {
20+
Route::FilterIn => function (array $arr) {
2121
if (substr($arr['presenter'], 0, 3) !== 'Abc') {
2222
return null;
2323
}
@@ -26,7 +26,7 @@ $route = new Route('<presenter>', [
2626
$arr['param'] .= '.in';
2727
return $arr;
2828
},
29-
Route::FILTER_OUT => function (array $arr) {
29+
Route::FilterOut => function (array $arr) {
3030
if (substr($arr['presenter'], 0, 3) !== 'Abc') {
3131
return null;
3232
}
@@ -51,7 +51,7 @@ Assert::null(testRouteOut($route, ['presenter' => 'Cde']));
5151

5252
$route = new Route('<lang>/<presenter>/<action>', [
5353
null => [
54-
Route::FILTER_IN => function (array $arr) {
54+
Route::FilterIn => function (array $arr) {
5555
if ($arr['presenter'] !== 'AbcCs') {
5656
return null;
5757
}
@@ -60,7 +60,7 @@ $route = new Route('<lang>/<presenter>/<action>', [
6060
$arr['action'] = substr($arr['action'], 0, -2);
6161
return $arr;
6262
},
63-
Route::FILTER_OUT => function (array $arr) {
63+
Route::FilterOut => function (array $arr) {
6464
if ($arr['presenter'] !== 'Abc') {
6565
return null;
6666
}

tests/Routers/Route.filter.query.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ require __DIR__ . '/Route.php';
1616

1717
$route = new Route(' ? action=<presenter>', [
1818
'presenter' => [
19-
Route::FILTER_IN => fn($s) => strrev($s),
20-
Route::FILTER_OUT => fn($s) => strtoupper(strrev($s)),
19+
Route::FilterIn => fn($s) => strrev($s),
20+
Route::FilterOut => fn($s) => strtoupper(strrev($s)),
2121
],
2222
]);
2323

tests/Routers/Route.filter.url.object.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ $identityMap[2] = new RouterObject(2);
2424
$route = new Route('<parameter>', [
2525
'presenter' => 'presenter',
2626
'parameter' => [
27-
Route::FILTER_IN => fn($s) => $identityMap[$s] ?? null,
28-
Route::FILTER_OUT => fn($obj) => $obj instanceof RouterObject ? $obj->getId() : null,
27+
Route::FilterIn => fn($s) => $identityMap[$s] ?? null,
28+
Route::FilterOut => fn($obj) => $obj instanceof RouterObject ? $obj->getId() : null,
2929
],
3030
]);
3131

tests/Routers/Route.filter.url.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ require __DIR__ . '/Route.php';
1616

1717
$route = new Route('<presenter>', [
1818
'presenter' => [
19-
Route::FILTER_IN => fn($s) => strrev($s),
20-
Route::FILTER_OUT => fn($s) => strrev($s),
19+
Route::FilterIn => fn($s) => strrev($s),
20+
Route::FilterOut => fn($s) => strrev($s),
2121
],
2222
]);
2323

tests/Routers/Route.filterTable.query.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require __DIR__ . '/Route.php';
1616

1717
$route = new Route(' ? action=<presenter>', [
1818
'presenter' => [
19-
Route::FILTER_TABLE => [
19+
Route::FilterTable => [
2020
'produkt' => 'Product',
2121
'kategorie' => 'Category',
2222
'zakaznik' => 'Customer',

tests/Routers/Route.filterTable.strict.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ require __DIR__ . '/Route.php';
1616

1717
$route = new Route('<presenter>', [
1818
'presenter' => [
19-
Route::FILTER_TABLE => [
19+
Route::FilterTable => [
2020
'produkt' => 'Product',
2121
'kategorie' => 'Category',
2222
'zakaznik' => 'Customer',
2323
'kosik' => 'Basket',
2424
],
25-
Route::FILTER_STRICT => true,
25+
Route::FilterStrict => true,
2626
],
2727
]);
2828

0 commit comments

Comments
 (0)