Iber\Generator\Commands\MakeModelsCommand::replaceTokensWithSetGetFunctions PHP Метод

replaceTokensWithSetGetFunctions() защищенный Метод

Replaces setters and getters from the stub. The functions are created from provider properties.
protected replaceTokensWithSetGetFunctions ( array $properties, string $class ) : string
$properties array
$class string
Результат string
    protected function replaceTokensWithSetGetFunctions($properties, $class)
    {
        $getters = "";
        $setters = "";
        $fillableGetSet = new SetGetGenerator($properties['fillable'], $this->getFunctionStub, $this->setFunctionStub);
        $getters .= $fillableGetSet->generateGetFunctions();
        $setters .= $fillableGetSet->generateSetFunctions();
        $guardedGetSet = new SetGetGenerator($properties['guarded'], $this->getFunctionStub, $this->setFunctionStub);
        $getters .= $guardedGetSet->generateGetFunctions();
        return str_replace(["{{setters}}", "{{getters}}"], [$setters, $getters], $class);
    }