[FORMATTING] Cherry-pick of Diogo's 763ac735c0758624ebd5957993dc0676b865927a

This commit is contained in:
Hugo Sales
2020-05-11 17:39:12 +00:00
committed by Hugo Sales
parent f60e37ba3d
commit f628665589
65 changed files with 505 additions and 114 deletions

View File

@@ -32,9 +32,10 @@ abstract class HTML
/**
* Creates an HTML tag without attributes
*
* @param string $tag
* @param string $tag
* @param array|string $content
* @param bool $empty_tag
* @param bool $empty_tag
*
* @return array
*/
private static function tag(string $tag, $content = '', bool $empty_tag = false): array
@@ -45,10 +46,11 @@ abstract class HTML
/**
* Create tag, possibly with attributes and indentation
*
* @param string $tag
* @param array|string $attrs - element attributes
* @param array|string $content - what goes inside the tag
* @param bool $empty_tag
* @param string $tag
* @param array|string $attrs - element attributes
* @param array|string $content - what goes inside the tag
* @param bool $empty_tag
*
* @return array
*/
private static function attr_tag(string $tag, $attrs, $content = '', bool $empty_tag = false): array
@@ -66,15 +68,19 @@ abstract class HTML
* Attribute with given optional value
*
* @param array $attrs
*
* @return string
*/
private static function attr(array $attrs): string
{
return ' ' . implode(' ', F\map($attrs, function ($val, $key, $_) { return "{$key} = '{$val}'"; }));
return ' ' . implode(' ', F\map($attrs, function ($val, $key, $_) {
return "{$key} = '{$val}'";
}));
}
/**
* @param $html
*
* @return string
*/
public static function html($html): string