diff --git a/src/Compiler.php b/src/Compiler.php index 7fad4ee..31634be 100755 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -12,7 +12,8 @@ namespace Machy8\Macdom; -class Compiler { +class Compiler +{ /** * The skip are tag @@ -63,7 +64,8 @@ class Compiler { * @param int $spacesPerIndent * @param bool $compressCode */ - public function __construct($Elements, $Macros, $Replicator, $indentMethod, $spacesPerIndent, $compressCode) { + public function __construct($Elements, $Macros, $Replicator, $indentMethod, $spacesPerIndent, $compressCode) + { $this->indentMethod = $indentMethod ?: 3; $this->spacesPerIndent = $spacesPerIndent ?: 4; $this->lnBreak = $compressCode ? '' : "\n"; @@ -76,7 +78,8 @@ public function __construct($Elements, $Macros, $Replicator, $indentMethod, $spa * @param string $content * @return string */ - public function compile($content) { + public function compile($content) + { $lns = preg_split('/\n/', $content); foreach ($lns as $key => $ln) { @@ -119,32 +122,22 @@ public function compile($content) { return $this->codeStorage; } - /** - * @param string $txt - * @return string - */ - private function getElement($txt) { - $element = explode(' ', trim($txt)); - return $element[0]; - } - /** * HOW LEVELS WORKS * * method 1 = spaces - * - is better to set the number of the constant SPACES_PER_INDENT on the number - * you have in your editor setted as "spaces per indent" * method 2 = tabulators * method 3 = combined - * - tabulators are always twice bigger - * - Example: - * - spaces per indent = 4 => tab size = 8 - * - spaces per indent = 8 => tab size = 16 - * - etc... + * - tabulators are always twice bigger + * - example: + * - spaces per indent = 4 => tab size = 8 + * - spaces per indent = 8 => tab size = 16 + * - etc... * @param string $ln * @return int */ - private function getLnLvl($ln) { + private function getLnLvl($ln) + { $method = $this->indentMethod; preg_match('/^\s+/', $ln, $matches); $whites = implode('', $matches); @@ -165,15 +158,80 @@ private function getLnLvl($ln) { * @param string $ln * @return string */ - private function getLnTxt($ln) { + private function getLnTxt($ln) + { return ltrim($ln); } /** - * @param string $txt - * @return array + * @param string $txt + * @return string + */ + private function getElement($txt) + { + $element = explode(' ', trim($txt)); + return $element[0]; + } + + /** + * @param string $element + * @return bool */ - private function getLnAttributes($txt) { + private function detectNoCompileArea($element) + { + $tagDetected = FALSE; + $areaClosed = $this->inNoCompileArea ? FALSE : NULL; + + // For skip tag + $closeTag = '/' . self::AREA_TAG; + if ($element === self::AREA_TAG) { + $tagDetected = TRUE; + $this->inNoCompileArea = TRUE; + } elseif ($element === $closeTag) { + $tagDetected = TRUE; + $this->inNoCompileArea = FALSE; + } + + // For style tag + $tag = 'style'; + $open = '<' . $tag; + $close = ''; + if ($element === $open . '>' || $element === $open) { + $this->inNoCompileArea = TRUE; + } elseif ($element === $close) { + $this->inNoCompileArea = FALSE; + } + + // For script tag + $tag = 'script'; + $open = '<' . $tag; + $close = ''; + if ($element === $open . '>' || $element === $open) { + $this->inNoCompileArea = TRUE; + } elseif ($element === $close) { + $this->inNoCompileArea = FALSE; + } + + // For php + $open = ''; + if ($element === $open . 'php' || $element === $open) { + $this->inNoCompileArea = TRUE; + } elseif ($element === $close) { + $this->inNoCompileArea = FALSE; + } + + // Set and return + $this->noCompileAreaClosed = $areaClosed; + return $tagDetected; + } + + /** + * @param string $txt + * @return array + */ + private function getLnAttributes($txt) + { // Store the text from the first tag to the end of the line $re = '/\<.*$/'; @@ -281,7 +339,8 @@ private function getLnAttributes($txt) { * @param int $lvl * @param array $attributes */ - private function addOpenTag($element, $lvl, $attributes) { + private function addOpenTag($element, $lvl, $attributes) + { $elementSettings = $this->Elements->findElement($element, TRUE); $openTag = '<' . $element; if ($elementSettings['qkAttributes'] && $attributes['qkAttributes']) { @@ -298,7 +357,7 @@ private function addOpenTag($element, $lvl, $attributes) { } } elseif (!in_array($withoutKey, $usedKeys)) { $newAttr = $elementSettings['qkAttributes'][$withoutKey] . '="' . $attribute['value'] . '"'; - $withoutKey ++; + $withoutKey++; } if ($newAttr) $openTag .= ' ' . $newAttr; @@ -337,7 +396,8 @@ private function addOpenTag($element, $lvl, $attributes) { } /** @param int $lvl */ - private function addCloseTags($lvl) { + private function addCloseTags($lvl) + { $length = count($this->closeTags); $lastTag = $length; if ($length > 0) { @@ -352,56 +412,4 @@ private function addCloseTags($lvl) { array_splice($this->closeTags, $lastTag); } } - - /** - * @param string $element - * @return bool - */ - private function detectNoCompileArea($element) { - $tagDetected = FALSE; - $areaClosed = $this->inNoCompileArea ? FALSE : NULL; - - // For skip tag - $closeTag = '/' . self::AREA_TAG; - if ($element === self::AREA_TAG) { - $tagDetected = TRUE; - $this->inNoCompileArea = TRUE; - } elseif ($element === $closeTag) { - $tagDetected = TRUE; - $this->inNoCompileArea = FALSE; - } - - // For style tag - $tag = 'style'; - $open = '<' . $tag; - $close = ''; - if ($element === $open . '>' || $element === $open) { - $this->inNoCompileArea = TRUE; - } elseif ($element === $close) { - $this->inNoCompileArea = FALSE; - } - - // For script tag - $tag = 'script'; - $open = '<' . $tag; - $close = ''; - if ($element === $open . '>' || $element === $open) { - $this->inNoCompileArea = TRUE; - } elseif ($element === $close) { - $this->inNoCompileArea = FALSE; - } - - // For php - $open = ''; - if ($element === $open . 'php' || $element === $open) { - $this->inNoCompileArea = TRUE; - } elseif ($element === $close) { - $this->inNoCompileArea = FALSE; - } - - // Set and return - $this->noCompileAreaClosed = $areaClosed; - return $tagDetected; - } } diff --git a/src/Elements/BooleanAttributes.php b/src/Elements/BooleanAttributes.php index 1a51c6a..a319308 100755 --- a/src/Elements/BooleanAttributes.php +++ b/src/Elements/BooleanAttributes.php @@ -12,7 +12,8 @@ namespace Machy8\Macdom\Elements; -class BooleanAttributes { +class BooleanAttributes +{ /** @var array */ protected $booleanAttributes = [ diff --git a/src/Elements/Elements.php b/src/Elements/Elements.php index 7323d5c..7fbc08c 100755 --- a/src/Elements/Elements.php +++ b/src/Elements/Elements.php @@ -12,15 +12,15 @@ namespace Machy8\Macdom\Elements; -use Machy8\Macdom\Elements\ElementsSettings; - -class Elements extends ElementsSettings { +class Elements extends ElementsSettings +{ /** * @param string $attribute * @return bool */ - public function isBoolean($attribute) { + public function isBoolean($attribute) + { return in_array($attribute, $this->booleanAttributes); } @@ -29,7 +29,8 @@ public function isBoolean($attribute) { * @param string $returnSettings * @return bool|array */ - public function findElement($el, $returnSettings) { + public function findElement($el, $returnSettings) + { $return = FALSE; if (in_array($el, $this->elements)) $return = $returnSettings ? $this->getElementSettings($el) : TRUE; @@ -40,7 +41,8 @@ public function findElement($el, $returnSettings) { * @param string $el * @return array */ - private function getElementSettings($el) { + private function getElementSettings($el) + { $qkAttributes = NULL; $paired = TRUE; $settings = $this->elementsSettings; @@ -60,7 +62,8 @@ private function getElementSettings($el) { } /** @param array $elements */ - public function addElements($elements) { + public function addElements($elements) + { if ($elements) { foreach ($elements as $element => $settings) { $settingsExists = TRUE; @@ -84,7 +87,8 @@ public function addElements($elements) { } /** @param array $attributes */ - public function addBooleanAttributes($attributes) { + public function addBooleanAttributes($attributes) + { if ($attributes && is_array($attributes)) { if (count($attributes)) { $merged = array_merge($this->booleanAttributes, $attributes); diff --git a/src/Elements/ElementsList.php b/src/Elements/ElementsList.php index e954a04..791ef98 100755 --- a/src/Elements/ElementsList.php +++ b/src/Elements/ElementsList.php @@ -12,9 +12,8 @@ namespace Machy8\Macdom\Elements; -use Machy8\Macdom\Elements\BooleanAttributes; - -class ElementsList extends BooleanAttributes { +class ElementsList extends BooleanAttributes +{ /** @var array */ protected $elements = [ diff --git a/src/Elements/ElementsSettings.php b/src/Elements/ElementsSettings.php index 207b702..9dfbf2a 100755 --- a/src/Elements/ElementsSettings.php +++ b/src/Elements/ElementsSettings.php @@ -12,9 +12,8 @@ namespace Machy8\Macdom\Elements; -use Machy8\Macdom\Elements\ElementsList; - -class ElementsSettings extends ElementsList { +class ElementsSettings extends ElementsList +{ /** @var array */ protected $elementsSettings = [ diff --git a/src/Loader.php b/src/Loader.php index 5c79ba1..c77f13f 100755 --- a/src/Loader.php +++ b/src/Loader.php @@ -14,21 +14,23 @@ use Machy8\Macdom\Replicator\Replicator; -class Loader extends Setup { +class Loader extends Setup +{ /** - * @param string $file - * @return string $compiled + * Loader constructor */ - public function __construct() { + public function __construct() + { parent::__construct(); } /** - * @param sting $content + * @param string $content * @return string */ - public function compileContent($content) { + public function compileContent($content) + { $compiler = new Compiler($this->elements, $this->macros, new Replicator, $this->indentMethod, $this->spacesCount, $this->compressCode); $compiled = $compiler->compile($content); return $compiled; diff --git a/src/LoaderLatte.php b/src/LoaderLatte.php index 08e919c..e7b36ab 100755 --- a/src/LoaderLatte.php +++ b/src/LoaderLatte.php @@ -14,13 +14,14 @@ use Machy8\Macdom\Replicator\Replicator; -class LoaderLatte extends SetupLatte { +class LoaderLatte extends SetupLatte +{ /** - * @param string $file - * @return string $compiled + * LoaderLatte constructor */ - public function __construct() { + public function __construct() + { parent::__construct(); } @@ -28,7 +29,8 @@ public function __construct() { * @param string $file * @return string */ - public function getContent($file) { + public function getContent($file) + { $content = parent::getContent($file); $compiled = $this->compileContent($content); return $compiled; @@ -38,7 +40,8 @@ public function getContent($file) { * @param string $content * @return string */ - public function compileContent($content) { + public function compileContent($content) + { $compiler = new Compiler($this->elements, $this->macros, new Replicator, $this->indentMethod, $this->spacesCount, $this->compressCode); $compiled = $compiler->compile($content); return $compiled; diff --git a/src/Macros/CoreMacros.php b/src/Macros/CoreMacros.php index 2ea10b0..f64f387 100755 --- a/src/Macros/CoreMacros.php +++ b/src/Macros/CoreMacros.php @@ -12,11 +12,14 @@ namespace Machy8\Macdom\Macros; -use Machy8\Macdom\Macros\MacrosInstaller; +class CoreMacros extends MacrosInstaller +{ -class CoreMacros extends MacrosInstaller { - - public function __construct() { + /** + * CoreMacros constructor + */ + public function __construct() + { // Doctype $this->addMacro('doctype5', '!5'); $this->addMacro('doctype', '!DOCTYPE'); @@ -52,70 +55,79 @@ public function __construct() { /** * @return string */ - public function macroDoctype5() { + public function macroDoctype5() + { return ''; } /** * @param string $line - * @return sring + * @return string */ - public function macroDoctype($line) { + public function macroDoctype($line) + { return ''; } /** - * @return sring + * @return string */ - public function macroUtf8() { + public function macroUtf8() + { return ''; } /** * @param string $line - * @return sring + * @return string */ - public function macroCharset($line) { + public function macroCharset($line) + { return ''; } /** * @param string $line - * @return sring + * @return string */ - public function macroKeywords($line) { + public function macroKeywords($line) + { return ''; } /** * @param string $line - * @return sring + * @return string */ - public function macroDescription($line) { + public function macroDescription($line) + { return ''; } /** * @param string $line - * @return sring + * @return string */ - public function macroAuthor($line) { + public function macroAuthor($line) + { return ''; } /** * @param string $line - * @return sring + * @return string */ - public function macroViewport($line) { + public function macroViewport($line) + { return ''; } /** * @param string $line - * @return sring + * @return string */ - public function macroFacebook($line) { + public function macroFacebook($line) + { $selected = strtok($line, " "); $content = preg_replace("/" . $selected . " /", "", $line); return ''; @@ -123,9 +135,10 @@ public function macroFacebook($line) { /** * @param string $line - * @return sring + * @return string */ - public function macroTwitter($line) { + public function macroTwitter($line) + { $selected = strtok($line, " "); $content = trim(preg_replace("/" . $selected . "/", "", $line)); return ''; @@ -133,55 +146,62 @@ public function macroTwitter($line) { /** * @param string $line - * @return sring + * @return string */ - public function macroCss($line) { + public function macroCss($line) + { return ''; } /** * @param string $line - * @return sring + * @return string */ - public function macroFavicon($line) { + public function macroFavicon($line) + { return ''; } /** * @param string $line - * @return sring + * @return string */ - public function macroJs($line) { + public function macroJs($line) + { return ''; } /** * @param string $line - * @return sring + * @return string */ - public function macroJsAsync($line) { + public function macroJsAsync($line) + { return ''; } /** * @param string $line - * @return sring + * @return string */ - public function macroInlineHtmlComment($line) { + public function macroInlineHtmlComment($line) + { return ''; } /** - * @return sring + * @return string */ - public function macroOpenHtmlComment() { + public function macroOpenHtmlComment() + { return ''; } } diff --git a/src/Macros/Macros.php b/src/Macros/Macros.php index df79389..d4568af 100755 --- a/src/Macros/Macros.php +++ b/src/Macros/Macros.php @@ -12,23 +12,23 @@ namespace Machy8\Macdom\Macros; -use Machy8\Macdom\Macros\CoreMacros; - -class Macros extends CoreMacros { +class Macros extends CoreMacros +{ /** * @param string $macro * @param string $ln * @return array */ - public function replace($macro, $ln) { + public function replace($macro, $ln) + { $replacement = NULL; $exists = FALSE; if (isset($this->macros[$macro])) { $line = trim(strstr($ln, ' ')); $replacement = isset($this->macros[$macro]['function']) - ? call_user_func($this->macros[$macro]['function'], $line) - : $this->{'macro' . ucfirst($this->macros[$macro])}($line); + ? call_user_func($this->macros[$macro]['function'], $line) + : $this->{'macro' . ucfirst($this->macros[$macro])}($line); $exists = TRUE; } return [ diff --git a/src/Macros/MacrosInstaller.php b/src/Macros/MacrosInstaller.php index a5aab43..62be962 100755 --- a/src/Macros/MacrosInstaller.php +++ b/src/Macros/MacrosInstaller.php @@ -12,24 +12,20 @@ namespace Machy8\Macdom\Macros; -class MacrosInstaller { - - protected $macros = []; +class MacrosInstaller +{ /** - * @param string $fnName - * @param string $macroId + * @var array */ - protected function addMacro($fnName, $macroId) { - if (!in_array($macroId, $this->macros)) - $this->macros[$macroId] = $fnName; - } + protected $macros = []; /** * @param string $macroId - * @param function $function + * @param callable $function */ - public function addCustomMacro($macroId, $function) { + public function addCustomMacro($macroId, $function) + { if ($macroId && $function) { if (!in_array($macroId, $this->macros)) { $this->macros[] = $macroId; @@ -37,4 +33,14 @@ public function addCustomMacro($macroId, $function) { } } } + + /** + * @param string $fnName + * @param string $macroId + */ + protected function addMacro($fnName, $macroId) + { + if (!in_array($macroId, $this->macros)) + $this->macros[$macroId] = $fnName; + } } diff --git a/src/Replicator/Register.php b/src/Replicator/Register.php index d9b2bae..4608d2f 100755 --- a/src/Replicator/Register.php +++ b/src/Replicator/Register.php @@ -12,16 +12,14 @@ namespace Machy8\Macdom\Replicator; -class Register { +class Register +{ const - /** @const regular expression */ - REG_EXP = '@([\S]*)', - /** @const string */ - SUFFIX = '-x'; - - /** @var REGEXP */ - protected $regExp; + /** @const regular expression */ + REG_EXP = '@([\S]*)', + /** @const string */ + SUFFIX = '-x'; /** @var array */ private $register = []; @@ -31,7 +29,8 @@ class Register { * @param string $element * @return bool */ - protected function deregisterLvl($lvl, $element) { + protected function deregisterLvl($lvl, $element) + { $unregistered = FALSE; $match = preg_match('/^\/' . self::REG_EXP . '/', $element, $matches); if ($match) { @@ -57,9 +56,10 @@ protected function deregisterLvl($lvl, $element) { * @param int $registrationLine * @return array */ - protected function isRegistered($lvl, $element, $line, $registrationLine) { + protected function isRegistered($lvl, $element, $line, $registrationLine) + { $registered = $key = FALSE; - $registereId = NULL; + $registerId = NULL; if (!$registrationLine) { if (array_key_exists($lvl . '-' . $element, $this->register)) { $registered = $key = TRUE; @@ -87,13 +87,14 @@ protected function isRegistered($lvl, $element, $line, $registrationLine) { * @param int $lvl * @return array */ - private function registerLvl($element, $line, $lvl) { + private function registerLvl($element, $line, $lvl) + { $registered = FALSE; $registerId = NULL; $match = preg_match('/^' . self::REG_EXP . '/', $element, $matches); if ($match) { $registerId = $lvl; - $registerId .=!empty($matches[1]) ? '-' . $matches[1] : self::SUFFIX; + $registerId .= !empty($matches[1]) ? '-' . $matches[1] : self::SUFFIX; $this->register[$registerId] = $line; $registered = TRUE; } @@ -107,7 +108,8 @@ private function registerLvl($element, $line, $lvl) { * @param string $registerId * @return string $registeredLine */ - protected function getRegisteredLine($registerId) { + protected function getRegisteredLine($registerId) + { return $this->register[$registerId]; } } diff --git a/src/Replicator/Replicator.php b/src/Replicator/Replicator.php index f4fe3f6..6341f31 100755 --- a/src/Replicator/Replicator.php +++ b/src/Replicator/Replicator.php @@ -12,16 +12,15 @@ namespace Machy8\Macdom\Replicator; -use Machy8\Macdom\Replicator\Register; - -class Replicator extends Register { +class Replicator extends Register +{ const - /** @const regular expression */ - REG_EXP_A = '/\[(.*?)\]/', + /** @const regular expression */ + REG_EXP_A = '/\[(.*?)\]/', - /** @const regular expression */ - REG_EXP_B = '/\[\@\]/'; + /** @const regular expression */ + REG_EXP_B = '/\[\@\]/'; /** * @param int $lvl @@ -29,7 +28,8 @@ class Replicator extends Register { * @param string $line * @return array */ - public function detect($lvl, $element, $line) { + public function detect($lvl, $element, $line) + { $replicate = $clearLine = FALSE; $replacement = NULL; $registrationLine = preg_match('/^' . parent::REG_EXP . '/', $line); @@ -45,8 +45,8 @@ public function detect($lvl, $element, $line) { // If the first word on line is also the part of the key in the register $key = $isRegistered['key']; $replacement = $key === TRUE - ? $this->replicate($isRegistered['registerId'], $line, $element, $key) - : $this->replicate($isRegistered['registerId'], $line); + ? $this->replicate($isRegistered['registerId'], $line, $element, $key) + : $this->replicate($isRegistered['registerId'], $line); } } else { $clearLine = TRUE; @@ -65,13 +65,14 @@ public function detect($lvl, $element, $line) { * @param bool $key * @return string $replicatedLine */ - private function replicate($registerId, $line, $element = NULL, $key = FALSE) { + private function replicate($registerId, $line, $element = NULL, $key = FALSE) + { $contentArrays = preg_match_all(self::REG_EXP_A, $line, $matches); if ($key) $line = preg_replace('/' . preg_quote($element) . '/', '', $line, 1); $replicatedline = $contentArrays - ? $this->synchronizeLines($line, $registerId, $matches[1]) - : $this->synchronizeLines($line, $registerId); + ? $this->synchronizeLines($line, $registerId, $matches[1]) + : $this->synchronizeLines($line, $registerId); return $replicatedline; } @@ -81,7 +82,8 @@ private function replicate($registerId, $line, $element = NULL, $key = FALSE) { * @param array $matches * @return string $synchronizedLine */ - private function synchronizeLines($line, $registerId, $matches = NULL) { + private function synchronizeLines($line, $registerId, $matches = NULL) + { $registeredLine = $this->getRegisteredLine($registerId); if ($matches !== NULL) { foreach ($matches as $key => $match) { diff --git a/src/Setup.php b/src/Setup.php index 07c04a2..16ba4f0 100755 --- a/src/Setup.php +++ b/src/Setup.php @@ -15,7 +15,8 @@ use Machy8\Macdom\Elements\Elements; use Machy8\Macdom\Macros\Macros; -class Setup { +class Setup +{ /** @var Elements */ protected $elements; @@ -32,64 +33,73 @@ class Setup { /** @var int */ protected $spacesCount; - public function __construct() { + /** + * Setup constructor + */ + public function __construct() + { $this->elements = new Elements; $this->macros = new Macros; } /** - * @param bool $value - * @return \Machy8\Macdom\SetupLatte + * @param bool|null $compress + * @return Setup */ - public function compressCode($compress = NULL) { + public function compressCode($compress = NULL) + { $this->compressCode = $compress ?: TRUE; return $this; } /** * @param int $count - * @return \Machy8\Macdom\Setup + * @return Setup */ - public function spacesPerIndent($count) { + public function spacesPerIndent($count) + { $this->spacesCount = $count; return $this; } /** * @param int $id - * @return \Machy8\Macdom\Setup + * @return Setup */ - public function indentMethod($id) { + public function indentMethod($id) + { $this->indentMethod = $id; return $this; } /** * @param array $elements - * @return \Machy8\Macdom\Setup + * @return Setup */ - public function addElements($elements) { + public function addElements($elements) + { $this->elements->addElements($elements); return $this; } /** * @param array $attributes - * @return \Machy8\Macdom\Setup + * @return Setup */ - public function addBooleanAttributes($attributes) { + public function addBooleanAttributes($attributes) + { $this->elements->addBooleanAttributes($attributes); return $this; } /** * @param string $macroId - * @param function $function - * @return \Machy8\Macdom\Setup + * @param callable $function + * @return Setup */ - public function addMacro($macroId, $function) { + public function addMacro($macroId, $function) + { $this->macros->addCustomMacro($macroId, $function); return $this; } - } diff --git a/src/SetupLatte.php b/src/SetupLatte.php index 4c77b96..ef23ceb 100755 --- a/src/SetupLatte.php +++ b/src/SetupLatte.php @@ -16,12 +16,13 @@ use Machy8\Macdom\Elements\Elements; use Machy8\Macdom\Macros\Macros; -class SetupLatte extends FileLoader { +class SetupLatte extends FileLoader +{ - /** @var Elements\Elements */ + /** @var Elements */ protected $elements; - /** @var Macros\Macros */ + /** @var Macros */ protected $macros; /** @var bool */ @@ -33,62 +34,72 @@ class SetupLatte extends FileLoader { /** @var int */ protected $spacesCount; - public function __construct() { + /** + * SetupLatte constructor + */ + public function __construct() + { $this->elements = new Elements; $this->macros = new Macros; } /** - * @param bool $value - * @return \Machy8\Macdom\SetupLatte + * @param bool|null $compress + * @return SetupLatte */ - public function compressCode($compress = NULL) { + public function compressCode($compress = NULL) + { $this->compressCode = $compress ?: TRUE; return $this; } /** * @param int $count - * @return \Machy8\Macdom\Setup + * @return SetupLatte */ - public function spacesPerIndent($count) { + public function spacesPerIndent($count) + { $this->spacesCount = $count; return $this; } /** * @param int $id - * @return \Machy8\Macdom\Setup + * @return SetupLatte */ - public function indentMethod($id) { + public function indentMethod($id) + { $this->indentMethod = $id; return $this; } /** * @param array $elements - * @return \Machy8\Macdom\Setup + * @return SetupLatte */ - public function addElements($elements) { + public function addElements($elements) + { $this->elements->addElements($elements); return $this; } /** * @param array $attributes - * @return \Machy8\Macdom\Setup + * @return SetupLatte */ - public function addBooleanAttributes($attributes) { + public function addBooleanAttributes($attributes) + { $this->elements->addBooleanAttributes($attributes); return $this; } /** * @param string $macroId - * @param function $function - * @return \Machy8\Macdom\Setup + * @param callable $function + * @return SetupLatte */ - public function addMacro($macroId, $function) { + public function addMacro($macroId, $function) + { $this->macros->addCustomMacro($macroId, $function); return $this; }