/** * Replaces setters and getters from the stub. The functions are created * from provider properties. * * @param array $properties * @param string $class * @return 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); }