Skip to content

Commit 2eae371

Browse files
committed
Changed from spec to pluginName
1 parent fcc9f8a commit 2eae371

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

API.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,25 @@ class API extends \Piwik\Plugin\API
2929
*
3030
* /index.php?module=API&method=OpenApiDocs.getOpenApiSpec&spec=CustomAlerts
3131
*
32-
* @param string $spec Plugin name used in the generated filename.
32+
* @param string $pluginName Plugin name used in the generated filename.
3333
* @param string $format Output format. Only `json` is supported.
3434
* @return array<string, mixed> The decoded OpenAPI specification payload.
3535
* @throws \Exception If the file is missing, unreadable, or contains invalid JSON.
3636
*/
37-
public function getOpenApiSpec(string $spec, string $format = 'json'): array
37+
public function getOpenApiSpec(string $pluginName, string $format = 'json'): array
3838
{
3939
Piwik::checkUserHasSomeViewAccess();
4040

4141
$this->validateJsonFormat($format);
4242

4343
if (
44-
!Manager::getInstance()->isValidPluginName($spec)
45-
|| !Manager::getInstance()->isPluginInFilesystem($spec)
44+
!Manager::getInstance()->isValidPluginName($pluginName)
45+
|| !Manager::getInstance()->isPluginInFilesystem($pluginName)
4646
) {
47-
throw new \Piwik\Exception\PluginNotFoundException($spec);
47+
throw new \Piwik\Exception\PluginNotFoundException($pluginName);
4848
}
4949

50-
$filePath = $this->getSpecFilePath($spec);
50+
$filePath = $this->getSpecFilePath($pluginName);
5151
if (!$this->isSpecFileReadable($filePath)) {
5252
throw new \Exception('OpenAPI spec file was not found. Generate it first via openapidocs:generate-spec-file.');
5353
}
@@ -65,11 +65,11 @@ public function getOpenApiSpec(string $spec, string $format = 'json'): array
6565
return $decodedSpec;
6666
}
6767

68-
protected function getSpecFilePath(string $spec): string
68+
protected function getSpecFilePath(string $pluginName): string
6969
{
7070
$currentPluginDir = Manager::getInstance()::getPluginDirectory('OpenApiDocs');
7171

72-
return $currentPluginDir . OpenApiDocs::GENERATED_SPECS_PATH . $spec . '_openapi_spec_v' . OpenApiDocs::DEFAULT_SPEC_VERSION . '.json';
72+
return $currentPluginDir . OpenApiDocs::GENERATED_SPECS_PATH . $pluginName . '_openapi_spec_v' . OpenApiDocs::DEFAULT_SPEC_VERSION . '.json';
7373
}
7474

7575
protected function isSpecFileReadable(string $filePath): bool

0 commit comments

Comments
 (0)