Fixed lint errors

This commit is contained in:
Tim Otte 2020-03-03 10:33:26 +01:00
parent f026b959a2
commit 667f00872c

View File

@ -8,7 +8,7 @@ class HtmlToOdtConverter
/**
* Converts a string with html inside into an odt compatible string
* @param string The text to convert
* @param string $htmlText The text to convert
* @return array
*/
public static function htmlToOdt($htmlText)
@ -60,6 +60,8 @@ class HtmlToOdtConverter
* Replaces html tags in with odt tags and returns an odt string
* @param array $tags An array with html tags generated by the getDataFromHtml() function
* @param array $customStyles An array of style defenitions that should be included inside the odt file
* @param array $fontDeclarations An array of font declarations that should be included inside the odt file
* @return string
*/
private static function replaceHtmlWithOdtTag($tags, &$customStyles, &$fontDeclarations)
{
@ -147,6 +149,7 @@ class HtmlToOdtConverter
/**
* Checks if the given text is a html string
* @param string $text The text to check
* @return bool
*/
public static function isHtmlTag($text)
{
@ -156,6 +159,7 @@ class HtmlToOdtConverter
/**
* Checks if the given text includes a html string
* @param string $text The text to check
* @return bool
*/
public static function hasHtmlTag($text)
{
@ -166,6 +170,7 @@ class HtmlToOdtConverter
/**
* Returns an array of html elements
* @param string $html A string with html tags
* @return array
*/
private static function getDataFromHtml($html)
{
@ -190,7 +195,8 @@ class HtmlToOdtConverter
$explodedAttributes = array_filter($explodedAttributes[0]);
$attributes = array();
// Store each attribute with its name in the $attributes array
for ($i=0; $i<count($explodedAttributes); $i++) {
$explodedAttributesCount = count($explodedAttributes);
for ($i=0; $i<$explodedAttributesCount; $i++) {
$attribute = trim($explodedAttributes[$i]);
// Check if the attribute has a value (like style="") or has no value (like required)
if (strpos($attribute, '=') !== false) {
@ -203,7 +209,8 @@ class HtmlToOdtConverter
if (strpos($attrValue, ';') !== false) {
// Split the style properties and store them in an array
$explodedStyles = explode(';', $attrValue);
for ($n=0; $n<count($explodedStyles); $n++) {
$explodedStylesCount = count($explodedStyles);
for ($n=0; $n<$explodedStylesCount; $n++) {
$splitStyle = explode(':', $explodedStyles[$n]);
$attributes[$attrName][trim($splitStyle[0])] = trim($splitStyle[1]);
}