src/AbstractTemplate.php
private function make(string $block, array $vars = null): string
    {
        $commonVars = static::COMMON_NAME . static::VARS_PROPERTY_SUFFIX;
        $blockVars = $block . static::VARS_PROPERTY_SUFFIX;
        $allVars = [];
        if (isset($this->$commonVars) && is_array($this->$commonVars)) {
            $allVars = $this->$commonVars;
        }
        if (isset($this->$blockVars) && is_array($this->$blockVars)) {
            $allVars += $this->$blockVars;
        }
        if (isset($vars)) {
            $allVars += $vars;
        }
        $file = $this->path . $this->{$block . static::BLOCK_PROPERTY_SUFFIX} . '.' . static::FILE_EXTENSION;

        $localScope = function ($vars, $file) {
            ob_start();
            extract($vars);
            try {
                require $file;
            } catch (\Exception $exception) {
                ob_end_clean();
                throw $exception;
            }
            $_ = isset($_) ? str_pad('', $_) : '';

            return str_replace(PHP_EOL, PHP_EOL . $_, PHP_EOL . ob_get_clean());
        };

        return $localScope($allVars, $file);
    }
private function make(string $block, array $vars = null): string
    {
        $commonVars = static::COMMON_NAME . static::VARS_PROPERTY_SUFFIX;
        $blockVars = $block . static::VARS_PROPERTY_SUFFIX;
        $allVars = [];
        if (isset($this->$commonVars) && is_array($this->$commonVars)) {
            $allVars = $this->$commonVars;
        }
        if (isset($this->$blockVars) && is_array($this->$blockVars)) {
            $allVars += $this->$blockVars;
        }
        if (isset($vars)) {
            $allVars += $vars;
        }
        $file = $this->path . $this->{$block . static::BLOCK_PROPERTY_SUFFIX} . '.' . static::FILE_EXTENSION;

        $localScope = function ($vars, $file) {
            ob_start();
            extract($vars);
            try {
                require $file;
            } catch (\Exception $exception) {
                ob_end_clean();
                throw $exception;
            }
            $_ = isset($_) ? str_pad('', $_) : '';

            return str_replace(PHP_EOL, PHP_EOL . $_, PHP_EOL . ob_get_clean());
        };

        return $localScope($allVars, $file);
    }
Makes a block.

@param string $block The partition name.
@param array  $vars  Partition variables.

@return string Rendered content.