Fix code style

This commit is contained in:
Art4 2025-01-02 08:18:47 +00:00
parent a01217ef79
commit a6a0af0670
7 changed files with 30 additions and 32 deletions

View file

@ -14,5 +14,4 @@ namespace Friendica\Addon\Event;
*/
final class AddonInstallEvent
{
}

View file

@ -14,5 +14,4 @@ namespace Friendica\Addon\Event;
*/
final class AddonUninstallEvent
{
}

View file

@ -83,8 +83,8 @@ class Page implements ArrayAccess
*/
public function __construct(string $basepath, EventDispatcherInterface $eventDispatcher)
{
$this->timestamp = microtime(true);
$this->basePath = $basepath;
$this->timestamp = microtime(true);
$this->basePath = $basepath;
$this->eventDispatcher = $eventDispatcher;
}
@ -458,7 +458,7 @@ class Page implements ArrayAccess
$this->initContent($response, $mode);
// Load current theme info after module has been initialized as theme could have been set in module
$currentTheme = $appHelper->getCurrentTheme();
$currentTheme = $appHelper->getCurrentTheme();
$theme_info_file = 'view/theme/' . $currentTheme . '/theme.php';
if (file_exists($theme_info_file)) {
require_once $theme_info_file;
@ -495,7 +495,7 @@ class Page implements ArrayAccess
// Add the navigation (menu) template
if ($moduleName != 'install' && $moduleName != 'maintenance') {
$this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('nav_head.tpl'), []);
$this->page['nav'] = $nav->getHtml();
$this->page['nav'] = $nav->getHtml();
}
// Build the page - now that we have all the components
@ -528,7 +528,7 @@ class Page implements ArrayAccess
}
}
$page = $this->page;
$page = $this->page;
// add and escape some common but crucial content for direct "echo" in HTML (security)
$page['title'] = htmlspecialchars($page['title'] ?? '');

View file

@ -27,7 +27,7 @@ final class ProvideLoggerEvent implements NamedEvent
public function __construct(LoggerInterface $logger)
{
$this->name = self::NAME;
$this->name = self::NAME;
$this->logger = $logger;
}

View file

@ -30,11 +30,11 @@ final class HookEventBridge implements StaticEventSubscriber
* This maps the new event names to the legacy Hook names.
*/
private static array $eventMapper = [
Event::INIT => 'init_1',
HtmlFilterEvent::HEAD => 'head',
HtmlFilterEvent::FOOTER => 'footer',
Event::INIT => 'init_1',
HtmlFilterEvent::HEAD => 'head',
HtmlFilterEvent::FOOTER => 'footer',
HtmlFilterEvent::PAGE_CONTENT_TOP => 'page_content_top',
HtmlFilterEvent::PAGE_END => 'page_end',
HtmlFilterEvent::PAGE_END => 'page_end',
];
/**
@ -43,11 +43,11 @@ final class HookEventBridge implements StaticEventSubscriber
public static function getStaticSubscribedEvents(): array
{
return [
Event::INIT => 'onNamedEvent',
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
Event::INIT => 'onNamedEvent',
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
HtmlFilterEvent::PAGE_CONTENT_TOP => 'onHtmlFilterEvent',
HtmlFilterEvent::PAGE_END => 'onHtmlFilterEvent',
HtmlFilterEvent::PAGE_END => 'onHtmlFilterEvent',
];
}

View file

@ -28,11 +28,11 @@ class HookEventBridgeTest extends TestCase
public function testGetStaticSubscribedEventsReturnsStaticMethods(): void
{
$expected = [
Event::INIT => 'onNamedEvent',
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
Event::INIT => 'onNamedEvent',
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
HtmlFilterEvent::PAGE_CONTENT_TOP => 'onHtmlFilterEvent',
HtmlFilterEvent::PAGE_END => 'onHtmlFilterEvent',
HtmlFilterEvent::PAGE_END => 'onHtmlFilterEvent',
];
$this->assertSame(
@ -102,7 +102,7 @@ class HookEventBridgeTest extends TestCase
$reflectionProperty = new \ReflectionProperty(HookEventBridge::class, 'mockedCallHook');
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue(null, function (string $name, $data) use($expected) {
$reflectionProperty->setValue(null, function (string $name, $data) use ($expected) {
$this->assertSame($expected, $name);
$this->assertSame('original', $data);

View file

@ -16,48 +16,48 @@ class BasePathTest extends TestCase
{
public static function getDataPaths(): array
{
$basePath = dirname(__DIR__, 3);
$basePath = dirname(__DIR__, 3);
$configPath = $basePath . DIRECTORY_SEPARATOR . 'config';
return [
'fullPath' => [
'server' => [],
'baseDir' => $configPath,
'server' => [],
'baseDir' => $configPath,
'expected' => $configPath,
],
'relative' => [
'server' => [],
'baseDir' => 'config',
'server' => [],
'baseDir' => 'config',
'expected' => $configPath,
],
'document_root' => [
'server' => [
'DOCUMENT_ROOT' => $configPath,
],
'baseDir' => '/noooop',
'baseDir' => '/noooop',
'expected' => $configPath,
],
'pwd' => [
'server' => [
'PWD' => $configPath,
],
'baseDir' => '/noooop',
'baseDir' => '/noooop',
'expected' => $configPath,
],
'no_overwrite' => [
'server' => [
'DOCUMENT_ROOT' => $basePath,
'PWD' => $basePath,
'PWD' => $basePath,
],
'baseDir' => 'config',
'baseDir' => 'config',
'expected' => $configPath,
],
'no_overwrite_if_invalid' => [
'server' => [
'DOCUMENT_ROOT' => '/nopopop',
'PWD' => $configPath,
'PWD' => $configPath,
],
'baseDir' => '/noatgawe22fafa',
'baseDir' => '/noatgawe22fafa',
'expected' => $configPath,
]
];