Remove unused SettingsController::convertStylesToString method

[MAILPOET-5798]
This commit is contained in:
Rostislav Wolny
2024-04-09 14:35:04 +02:00
committed by Rostislav Wolný
parent 15e0c3fa4d
commit 47a4871600
2 changed files with 0 additions and 22 deletions

View File

@ -103,17 +103,6 @@ class SettingsController {
return "{$width}px"; return "{$width}px";
} }
/**
* This functions converts an array of styles to a string that can be used in HTML.
*/
public function convertStylesToString(array $styles): string {
$cssString = '';
foreach ($styles as $property => $value) {
$cssString .= $property . ':' . $value . ';';
}
return trim($cssString); // Remove trailing space and return the formatted string
}
public function parseStylesToArray(string $styles): array { public function parseStylesToArray(string $styles): array {
$styles = explode(';', $styles); $styles = explode(';', $styles);
$parsedStyles = []; $parsedStyles = [];

View File

@ -26,15 +26,4 @@ class SettingsControllerTest extends \MailPoetUnitTest {
$expectedWidth = (int)SettingsController::EMAIL_WIDTH - 10 * 2; $expectedWidth = (int)SettingsController::EMAIL_WIDTH - 10 * 2;
verify($layoutWidth)->equals($expectedWidth . 'px'); verify($layoutWidth)->equals($expectedWidth . 'px');
} }
public function testItConvertsStylesToString(): void {
$settingsController = new SettingsController($this->makeEmpty(ThemeController::class));
$styles = [
'width' => '600px',
'background' => '#ffffff',
'padding-left' => '15px',
];
$string = $settingsController->convertStylesToString($styles);
verify($string)->equals('width:600px;background:#ffffff;padding-left:15px;');
}
} }