Files
FOSSBilling/src/modules/Page/Service.php
T
Belle Aerni 303f4cfa2d Code styling & rector config improvements (#2254)
* Bumped the Rector deadcode level

* Added the instanceof setlist

* Increasded type coverage and updated tests config too

* Bumped type coverage & ran PHP-cs-fixer
2024-04-23 10:38:18 -07:00

60 lines
1.5 KiB
PHP

<?php
/**
* Copyright 2022-2024 FOSSBilling
* Copyright 2011-2021 BoxBilling, Inc.
* SPDX-License-Identifier: Apache-2.0.
*
* @copyright FOSSBilling (https://www.fossbilling.org)
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache-2.0
*/
namespace Box\Mod\Page;
use FOSSBilling\InjectionAwareInterface;
class Service implements InjectionAwareInterface
{
protected ?\Pimple\Container $di = null;
public function setDi(\Pimple\Container $di): void
{
$this->di = $di;
}
public function getDi(): ?\Pimple\Container
{
return $this->di;
}
public function getModulePermissions(): array
{
return [
'can_always_access' => true,
'hide_permissions' => true,
];
}
/**
* @return string[]
*/
public function getPairs(): array
{
$themeService = $this->di['mod_service']('theme');
$code = $themeService->getCurrentClientAreaThemeCode();
$paths = [
PATH_THEMES . DIRECTORY_SEPARATOR . $code . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR,
PATH_MODS . DIRECTORY_SEPARATOR . 'mod_page' . DIRECTORY_SEPARATOR . 'html_client' . DIRECTORY_SEPARATOR,
];
$list = [];
foreach ($paths as $path) {
foreach (glob($path . 'mod_page_*.html.twig') as $file) {
$file = str_replace('mod_page_', '', pathinfo($file, PATHINFO_FILENAME));
$list[$file] = ucwords(strtr($file, ['-' => ' ', '_' => ' ']));
}
}
return $list;
}
}