Improve Phalcon\Translate\InterpolatorFactory::newInstance #15038
Closed
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
Type
Projects
Status
Released