src/Koldy/Response/View.php
public function render(string $view, array $with = null): string
    {
        $path = $this->getViewPath($view);

        if (!file_exists($path)) {
            throw new ResponseException("View ({$view}) not found on path={$path}");
        }

        if ($with !== null && count($with) > 0) {
            foreach ($with as $variableName => $value) {
                if (!is_string($variableName)) {
                    throw new ResponseException('Invalid argument name, expected string, got ' . gettype($variableName));
                }

                $$variableName = $value;
            }
        }

        ob_start(null, 0, PHP_OUTPUT_HANDLER_CLEANABLE | PHP_OUTPUT_HANDLER_FLUSHABLE | PHP_OUTPUT_HANDLER_REMOVABLE);

        require $path;

        return ob_get_clean();
    }
public function render(string $view, array $with = null): string
    {
        $path = $this->getViewPath($view);

        if (!file_exists($path)) {
            throw new ResponseException("View ({$view}) not found on path={$path}");
        }

        if ($with !== null && count($with) > 0) {
            foreach ($with as $variableName => $value) {
                if (!is_string($variableName)) {
                    throw new ResponseException('Invalid argument name, expected string, got ' . gettype($variableName));
                }

                $$variableName = $value;
            }
        }

        ob_start(null, 0, PHP_OUTPUT_HANDLER_CLEANABLE | PHP_OUTPUT_HANDLER_FLUSHABLE | PHP_OUTPUT_HANDLER_REMOVABLE);

        require $path;

        return ob_get_clean();
    }
public function render ( string $ view , array $ with = null ) : string { $ path = $ this -> getViewPath ( $ view ) ; if ( ! file_exists ( $ path ) ) { throw new ResponseException ( "View ({$view}) not found on path={$path}" ) ; } if ( $ with !== null && count ( $ with ) > 0 ) { foreach ( $ with as $ variableName => $ value ) { if ( ! is_string ( $ variableName ) ) { throw new ResponseException ( 'Invalid argument name, expected string, got ' . gettype ( $ variableName ) ) ; } $ $ variableName = $ value ; } } ob_start ( null , 0 , PHP_OUTPUT_HANDLER_CLEANABLE | PHP_OUTPUT_HANDLER_FLUSHABLE | PHP_OUTPUT_HANDLER_REMOVABLE ) ; require $ path ; return ob_get_clean ( ) ; }
Render some other view file inside of parent view file

@param string $view
@param array $with php variables

@throws Exception
@return string
Render some other view file inside of parent view file