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

Improve Phalcon\Translate\InterpolatorFactory::newInstance #15038

Closed
sergeyklay opened this issue May 13, 2020 · 1 comment · Fixed by #15039
Closed

Improve Phalcon\Translate\InterpolatorFactory::newInstance #15038

sergeyklay opened this issue May 13, 2020 · 1 comment · Fixed by #15039
Assignees
Labels
enhancement Enhancement to the framework

Comments

@sergeyklay
Copy link
Contributor

Currently Phalcon\Translate\InterpolatorFactory::newInstance looks as follows:

    public function newInstance(string! name) -> <InterpolatorInterface>
    {
        var definition;

        this->checkService(name);

        let definition = this->mapper[name];

        return create_instance(definition);
    }

this->checkService(name);

From design point of view, child class shouldn't know what internal check need to perform. It is base class responsibility.

let definition = this->mapper[name];

For the same reason child class should know nothing about the name of the protected property of the base class (as well as the signature of that property). It will be better to use an interface method here


I think need to merge

        this->checkService(name);

        let definition = this->mapper[name];

into an interface method and move to a base class.

@sergeyklay sergeyklay added the enhancement Enhancement to the framework label May 13, 2020
@niden niden self-assigned this May 13, 2020
@niden niden added the 4.1.0 label May 13, 2020
@niden niden mentioned this issue May 13, 2020
5 tasks
@niden niden linked a pull request May 13, 2020 that will close this issue
5 tasks
@niden niden added 4.0.6 and removed 4.1.0 labels May 13, 2020
niden added a commit that referenced this issue May 13, 2020
@niden
Copy link
Member

niden commented May 13, 2020

Resovled

@niden niden closed this as completed May 13, 2020
niden added a commit that referenced this issue May 16, 2020
niden added a commit that referenced this issue May 31, 2020
@niden niden moved this to Released in Phalcon v5 Aug 25, 2022
@niden niden added this to Phalcon v5 Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to the framework
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants