diff --git a/src/Fenom/Scope.php b/src/Fenom/Scope.php index 8480f81..5dec737 100644 --- a/src/Fenom/Scope.php +++ b/src/Fenom/Scope.php @@ -14,8 +14,8 @@ namespace Fenom; * * @author Ivan Shalganov */ -class Scope extends \ArrayObject { - +class Scope extends \ArrayObject +{ public $line = 0; public $name; public $level = 0; @@ -37,15 +37,16 @@ class Scope extends \ArrayObject { * @param int $line * @param array $action * @param int $level - * @param $body + * @param $body */ - public function __construct($name, $tpl, $line, $action, $level, &$body) { - $this->line = $line; - $this->name = $name; - $this->tpl = $tpl; + public function __construct($name, $tpl, $line, $action, $level, &$body) + { + $this->line = $line; + $this->name = $name; + $this->tpl = $tpl; $this->_action = $action; - $this->level = $level; - $this->_body = &$body; + $this->level = $level; + $this->_body = & $body; $this->_offset = strlen($body); } @@ -53,8 +54,9 @@ class Scope extends \ArrayObject { * * @param string $function */ - public function setFuncName($function) { - $this["function"] = $function; + public function setFuncName($function) + { + $this["function"] = $function; $this->is_compiler = false; } @@ -64,7 +66,8 @@ class Scope extends \ArrayObject { * @param Tokenizer $tokenizer * @return mixed */ - public function open($tokenizer) { + public function open($tokenizer) + { return call_user_func($this->_action["open"], $tokenizer, $this); } @@ -72,28 +75,31 @@ class Scope extends \ArrayObject { * Check, has the block this tag * * @param string $tag - * @param int $level + * @param int $level * @return bool */ - public function hasTag($tag, $level) { - if(isset($this->_action["tags"][$tag])) { - if($level) { + public function hasTag($tag, $level) + { + if (isset($this->_action["tags"][$tag])) { + if ($level) { return isset($this->_action["float_tags"][$tag]); } else { return true; } } + return false; } /** * Call tag callback * - * @param string $tag + * @param string $tag * @param Tokenizer $tokenizer * @return string */ - public function tag($tag, $tokenizer) { + public function tag($tag, $tokenizer) + { return call_user_func($this->_action["tags"][$tag], $tokenizer, $this); } @@ -103,7 +109,8 @@ class Scope extends \ArrayObject { * @param Tokenizer $tokenizer * @return string */ - public function close($tokenizer) { + public function close($tokenizer) + { return call_user_func($this->_action["close"], $tokenizer, $this); } @@ -113,7 +120,8 @@ class Scope extends \ArrayObject { * @throws \LogicException * @return string */ - public function getContent() { + public function getContent() + { return substr($this->_body, $this->_offset); } @@ -123,9 +131,11 @@ class Scope extends \ArrayObject { * @return string * @throws \LogicException */ - public function cutContent() { - $content = substr($this->_body, $this->_offset + 1); + public function cutContent() + { + $content = substr($this->_body, $this->_offset + 1); $this->_body = substr($this->_body, 0, $this->_offset); + return $content; } @@ -134,7 +144,8 @@ class Scope extends \ArrayObject { * * @param $new_content */ - public function replaceContent($new_content) { + public function replaceContent($new_content) + { $this->cutContent(); $this->_body .= $new_content; }