mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 15:25:15 +02:00
Fix code style
This commit is contained in:
parent
a01217ef79
commit
a6a0af0670
7 changed files with 30 additions and 32 deletions
|
@ -14,5 +14,4 @@ namespace Friendica\Addon\Event;
|
||||||
*/
|
*/
|
||||||
final class AddonInstallEvent
|
final class AddonInstallEvent
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,5 +14,4 @@ namespace Friendica\Addon\Event;
|
||||||
*/
|
*/
|
||||||
final class AddonUninstallEvent
|
final class AddonUninstallEvent
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,8 @@ class Page implements ArrayAccess
|
||||||
*/
|
*/
|
||||||
public function __construct(string $basepath, EventDispatcherInterface $eventDispatcher)
|
public function __construct(string $basepath, EventDispatcherInterface $eventDispatcher)
|
||||||
{
|
{
|
||||||
$this->timestamp = microtime(true);
|
$this->timestamp = microtime(true);
|
||||||
$this->basePath = $basepath;
|
$this->basePath = $basepath;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ class Page implements ArrayAccess
|
||||||
$this->initContent($response, $mode);
|
$this->initContent($response, $mode);
|
||||||
|
|
||||||
// Load current theme info after module has been initialized as theme could have been set in module
|
// 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';
|
$theme_info_file = 'view/theme/' . $currentTheme . '/theme.php';
|
||||||
if (file_exists($theme_info_file)) {
|
if (file_exists($theme_info_file)) {
|
||||||
require_once $theme_info_file;
|
require_once $theme_info_file;
|
||||||
|
@ -495,7 +495,7 @@ class Page implements ArrayAccess
|
||||||
// Add the navigation (menu) template
|
// Add the navigation (menu) template
|
||||||
if ($moduleName != 'install' && $moduleName != 'maintenance') {
|
if ($moduleName != 'install' && $moduleName != 'maintenance') {
|
||||||
$this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('nav_head.tpl'), []);
|
$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
|
// 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)
|
// add and escape some common but crucial content for direct "echo" in HTML (security)
|
||||||
$page['title'] = htmlspecialchars($page['title'] ?? '');
|
$page['title'] = htmlspecialchars($page['title'] ?? '');
|
||||||
|
|
|
@ -27,7 +27,7 @@ final class ProvideLoggerEvent implements NamedEvent
|
||||||
|
|
||||||
public function __construct(LoggerInterface $logger)
|
public function __construct(LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
$this->name = self::NAME;
|
$this->name = self::NAME;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,11 @@ final class HookEventBridge implements StaticEventSubscriber
|
||||||
* This maps the new event names to the legacy Hook names.
|
* This maps the new event names to the legacy Hook names.
|
||||||
*/
|
*/
|
||||||
private static array $eventMapper = [
|
private static array $eventMapper = [
|
||||||
Event::INIT => 'init_1',
|
Event::INIT => 'init_1',
|
||||||
HtmlFilterEvent::HEAD => 'head',
|
HtmlFilterEvent::HEAD => 'head',
|
||||||
HtmlFilterEvent::FOOTER => 'footer',
|
HtmlFilterEvent::FOOTER => 'footer',
|
||||||
HtmlFilterEvent::PAGE_CONTENT_TOP => 'page_content_top',
|
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
|
public static function getStaticSubscribedEvents(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Event::INIT => 'onNamedEvent',
|
Event::INIT => 'onNamedEvent',
|
||||||
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
|
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
|
||||||
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
|
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
|
||||||
HtmlFilterEvent::PAGE_CONTENT_TOP => 'onHtmlFilterEvent',
|
HtmlFilterEvent::PAGE_CONTENT_TOP => 'onHtmlFilterEvent',
|
||||||
HtmlFilterEvent::PAGE_END => 'onHtmlFilterEvent',
|
HtmlFilterEvent::PAGE_END => 'onHtmlFilterEvent',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,11 @@ class HookEventBridgeTest extends TestCase
|
||||||
public function testGetStaticSubscribedEventsReturnsStaticMethods(): void
|
public function testGetStaticSubscribedEventsReturnsStaticMethods(): void
|
||||||
{
|
{
|
||||||
$expected = [
|
$expected = [
|
||||||
Event::INIT => 'onNamedEvent',
|
Event::INIT => 'onNamedEvent',
|
||||||
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
|
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
|
||||||
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
|
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
|
||||||
HtmlFilterEvent::PAGE_CONTENT_TOP => 'onHtmlFilterEvent',
|
HtmlFilterEvent::PAGE_CONTENT_TOP => 'onHtmlFilterEvent',
|
||||||
HtmlFilterEvent::PAGE_END => 'onHtmlFilterEvent',
|
HtmlFilterEvent::PAGE_END => 'onHtmlFilterEvent',
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
|
@ -102,7 +102,7 @@ class HookEventBridgeTest extends TestCase
|
||||||
$reflectionProperty = new \ReflectionProperty(HookEventBridge::class, 'mockedCallHook');
|
$reflectionProperty = new \ReflectionProperty(HookEventBridge::class, 'mockedCallHook');
|
||||||
$reflectionProperty->setAccessible(true);
|
$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($expected, $name);
|
||||||
$this->assertSame('original', $data);
|
$this->assertSame('original', $data);
|
||||||
|
|
||||||
|
|
|
@ -16,48 +16,48 @@ class BasePathTest extends TestCase
|
||||||
{
|
{
|
||||||
public static function getDataPaths(): array
|
public static function getDataPaths(): array
|
||||||
{
|
{
|
||||||
$basePath = dirname(__DIR__, 3);
|
$basePath = dirname(__DIR__, 3);
|
||||||
$configPath = $basePath . DIRECTORY_SEPARATOR . 'config';
|
$configPath = $basePath . DIRECTORY_SEPARATOR . 'config';
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'fullPath' => [
|
'fullPath' => [
|
||||||
'server' => [],
|
'server' => [],
|
||||||
'baseDir' => $configPath,
|
'baseDir' => $configPath,
|
||||||
'expected' => $configPath,
|
'expected' => $configPath,
|
||||||
],
|
],
|
||||||
'relative' => [
|
'relative' => [
|
||||||
'server' => [],
|
'server' => [],
|
||||||
'baseDir' => 'config',
|
'baseDir' => 'config',
|
||||||
'expected' => $configPath,
|
'expected' => $configPath,
|
||||||
],
|
],
|
||||||
'document_root' => [
|
'document_root' => [
|
||||||
'server' => [
|
'server' => [
|
||||||
'DOCUMENT_ROOT' => $configPath,
|
'DOCUMENT_ROOT' => $configPath,
|
||||||
],
|
],
|
||||||
'baseDir' => '/noooop',
|
'baseDir' => '/noooop',
|
||||||
'expected' => $configPath,
|
'expected' => $configPath,
|
||||||
],
|
],
|
||||||
'pwd' => [
|
'pwd' => [
|
||||||
'server' => [
|
'server' => [
|
||||||
'PWD' => $configPath,
|
'PWD' => $configPath,
|
||||||
],
|
],
|
||||||
'baseDir' => '/noooop',
|
'baseDir' => '/noooop',
|
||||||
'expected' => $configPath,
|
'expected' => $configPath,
|
||||||
],
|
],
|
||||||
'no_overwrite' => [
|
'no_overwrite' => [
|
||||||
'server' => [
|
'server' => [
|
||||||
'DOCUMENT_ROOT' => $basePath,
|
'DOCUMENT_ROOT' => $basePath,
|
||||||
'PWD' => $basePath,
|
'PWD' => $basePath,
|
||||||
],
|
],
|
||||||
'baseDir' => 'config',
|
'baseDir' => 'config',
|
||||||
'expected' => $configPath,
|
'expected' => $configPath,
|
||||||
],
|
],
|
||||||
'no_overwrite_if_invalid' => [
|
'no_overwrite_if_invalid' => [
|
||||||
'server' => [
|
'server' => [
|
||||||
'DOCUMENT_ROOT' => '/nopopop',
|
'DOCUMENT_ROOT' => '/nopopop',
|
||||||
'PWD' => $configPath,
|
'PWD' => $configPath,
|
||||||
],
|
],
|
||||||
'baseDir' => '/noatgawe22fafa',
|
'baseDir' => '/noatgawe22fafa',
|
||||||
'expected' => $configPath,
|
'expected' => $configPath,
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue