public function findOrCreateState($name)
{
if (!$this->stateCollection->hasState($name)) {
if ($this->stateCollection instanceof StateCollection) {
$this->stateCollection->addState($this->createState($name));
} else {
throw new \InvalidArgumentException('Overwrite this method to implement a different type!');
}
}
return $this->stateCollection->getState($name);
}