Skip to content

Improve Phalcon\Translate\InterpolatorFactory::newInstance #15038

Closed
@sergeyklay

Description

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.

Metadata

Assignees

Labels

enhancementEnhancement to the framework

Type

No type

Projects

  • Status

    Released

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions