Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Маленькие улучшения #23

Closed
SerginhoLD opened this issue Mar 13, 2016 · 2 comments
Closed

Маленькие улучшения #23

SerginhoLD opened this issue Mar 13, 2016 · 2 comments

Comments

@SerginhoLD
Copy link

  1. Заменить $this->templatePath на $this->getTemplatePath() и т.п.
    Например:
public function __construct($templatePath, array $attributes = [])
{
    $this->setTemplatePath($templatePath);
    $this->setAttributes($attributes);
}

Это очень важно для наследования класса, сейчас это бессмысленно, все равно все переписывать

  1. Убрать \InvalidArgumentException("Duplicate template key found") в методе fetch(). Исправить protectedIncludeScope:
protected function protectedIncludeScope ($template, array $data) {
    extract($data, EXTR_SKIP); // fix
    include $template;
}
  1. Унаследовать PhpRenderer от \ArrayObject и выкинуть эти функции с $attributes
@akrabat
Copy link
Member

akrabat commented Mar 13, 2016

Please report any issues in English.

@SerginhoLD
Copy link
Author

Как все трудно..

Google translate:

  1. Replace the $this->templatePath at $ this->getTemplatePath(), etc.
    For example:
public function __construct($templatePath, array $attributes = [])
{
     $this->setTemplatePath($templatePath);
     $this->setAttributes($attributes);
}

It is necessary to inherit PhpRenderer class, now it is pointless to have to rewrite all

  1. Remove \InvalidArgumentException("Duplicate template key found") in the fetch() method. Correct protectedIncludeScope:
protected function protectedIncludeScope($template, array $data) {
     extract($data, EXTR_SKIP); // fix
     include $template;
}
  1. PhpRenderer Inherit from class \ArrayObject and remove features that use the $attributes.
    (It also uses an interface \ ArrayAccess, https://github.com/slimphp/Twig-View/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants