I got a message of PHPMD telling me:
else is never necessary and you can simplify the code to work without else on this portion of code:
if ($settings == null) {
$settings = new self($arrSettings);
} else {
$settings->fill($arrSettings);
}
$settings->save();
return $settings;
My question is : How should I avoid else(). The only way I see is duplicating $setting->save()
and return.
Any idea?
via Juliatzin del Toro