public function setState($name, $value = null)
{
if($name instanceof JRegistry)
{
$this->state->merge($name);
}
else
{
$this->state->set($name, $value);
}
}
But that does create an ambiguous argument name since the first argument can both be a path and an object. With maybe an optional argument whether to merge or just replace the whole registry object. Quite possibly it would be better to implement two methods in the interface. And of course their getters respectively.
public function setState($name, $value);
public function setStore(JRegistry $object);
This would allow proper type hinting where needed, and make the behavior consistent to what a lot of software already out there expects, being able to set values in the state using setState()
- Rune