Skip to content

Commit 7f8bcad

Browse files
committed
Cleanup
1 parent dca12a0 commit 7f8bcad

File tree

5 files changed

+2
-43
lines changed

5 files changed

+2
-43
lines changed

TODO.taskpaper

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ TODO.taskpaper
44
✔ Implement code generation for nested module in `x-route` and other pertinent place @done (25-03-26 11:38)
55
✔ implement default action `actionIndex()` in `DefaultController` in module generation @done (25-04-09 15:44)
66
✔ resolve all sub tasks of issue - Support for Yii Modules in x-route and pertinent places #14 @done (25-04-09 08:50)
7-
resolve all TODOs
7+
resolve all TODOs @done (25-04-09 16:23)
88
☐ delete this file

src/lib/generators/JsonActionGenerator.php

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ protected function prepareAction(
7777
$actionId = $routeData->isNonCrudAction() ? trim("{$actionType}-{$routeData->action}", '-')
7878
: "$actionType{$routeData->action}";
7979
if (!empty($customRoute)) {
80-
// $actionType = '';
8180
$parts = explode('/', $customRoute);
8281
$controllerId = $parts[count($parts) - 2];
8382
$actionId = $parts[count($parts) - 1];

src/lib/items/ActionHelperTrait.php

-26
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,6 @@ public function getOptionsRoute():string
3737
$r = explode('/', $r);
3838
array_pop($r);
3939
return implode('/', $r) . '/options';
40-
41-
// if (!empty($this->prefixSettings)) {
42-
// if (isset($this->prefixSettings['module'])) {
43-
// $prefix = $this->prefixSettings['module'];
44-
// return static::finalOptionsRoute($prefix, $this->controllerId);
45-
// } elseif (isset($this->prefixSettings['namespace']) && str_contains($this->prefixSettings['namespace'], '\modules\\')) { # if `module` not present then check in namespace and then in path
46-
// $prefix = static::computeModule('\\', $this->prefixSettings['namespace']);
47-
// if ($prefix) {
48-
// return static::finalOptionsRoute($prefix, $this->controllerId);
49-
// }
50-
// } elseif (isset($this->prefixSettings['path']) && str_contains($this->prefixSettings['path'], '/modules/')) {
51-
// $prefix = static::computeModule('/', $this->prefixSettings['path']);
52-
// if ($prefix) {
53-
// return static::finalOptionsRoute($prefix, $this->controllerId);
54-
// }
55-
// }
56-
// }
57-
// return $this->controllerId.'/options';
5840
}
5941

6042
/**
@@ -96,28 +78,20 @@ public function getRoute(): string
9678
if (!empty($this->prefixSettings)) {
9779
if (isset($this->prefixSettings['module'])) {
9880
$prefix = $this->prefixSettings['module'];
99-
// return static::finalOptionsRoute($prefix, $this->controllerId);
10081
return trim($prefix, '/') . '/' . $this->controllerId . ($this->id ? '/' . $this->id : '');
10182
} elseif (isset($this->prefixSettings['namespace']) && str_contains($this->prefixSettings['namespace'], '\modules\\')) { # if `module` not present then check in namespace and then in path
10283
$prefix = static::computeModule('\\', $this->prefixSettings['namespace']);
10384
if ($prefix) {
104-
// return static::finalOptionsRoute($prefix, $this->controllerId);
10585
return trim($prefix, '/') . '/' . $this->controllerId . ($this->id ? '/' . $this->id : '');
10686
}
10787
} elseif (isset($this->prefixSettings['path']) && str_contains($this->prefixSettings['path'], '/modules/')) {
10888
$prefix = static::computeModule('/', $this->prefixSettings['path']);
10989
if ($prefix) {
110-
// return static::finalOptionsRoute($prefix, $this->controllerId);
11190
return trim($prefix, '/') . '/' . $this->controllerId . ($this->id ? '/' . $this->id : '');
11291
}
11392
}
11493
}
11594

116-
// if (!empty($this->prefixSettings)) {
117-
// $prefix = $this->prefixSettings['module'] ?? $this->prefix;
118-
// return trim($prefix, '/') . '/' . $this->controllerId . '/' . $this->id;
119-
// }
120-
12195
return $this->controllerId . ($this->id ? '/' . $this->id : '');
12296
}
12397
}

src/lib/items/FractalAction.php

-13
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,6 @@ private function templateFactory():FractalActionTemplates
9595
return $this->templateFactory;
9696
}
9797

98-
// public function getRoute():string
99-
// {
100-
// if ($this->xRoute) {
101-
// return $this->xRoute;
102-
// }
103-
//
104-
// if (!empty($this->prefixSettings)) {
105-
// $prefix = $this->prefixSettings['module'] ?? $this->prefix;
106-
// return trim($prefix, '/').'/'.$this->controllerId.'/'.$this->id;
107-
// }
108-
// return $this->controllerId.'/'.$this->id;
109-
// }
110-
11198
public function getBaseModelName():string
11299
{
113100
return $this->modelFqn ? StringHelper::basename($this->modelFqn) : '';

src/lib/items/RouteData.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ public function __construct(
199199
$parts = explode('/', $customRoute);
200200
array_pop($parts);
201201
array_pop($parts);
202-
// $this->prefix = implode('/', $parts); # add everything (modules) except controller ID and action ID
203202

204203
$modulesPathSection = $modulesPath = [];
205204
$container = $modulesNamespaceSection = '';
@@ -310,7 +309,7 @@ public function getPrefixSettings():array
310309
protected function detectUrlPattern():void
311310
{
312311
if ($this->path === '/') {
313-
$this->type = self::TYPE_DEFAULT; // issue is here https://github.com/php-openapi/yii2-openapi/issues/102
312+
$this->type = self::TYPE_DEFAULT;
314313
$this->action = '';
315314
$this->controller = 'default';
316315
if (isset($this->operation->{CustomSpecAttr::ROUTE})) { # https://github.com/cebe/yii2-openapi/issues/144

0 commit comments

Comments
 (0)