module/FzyCommon/src/FzyCommon/Entity/Base.php
public function nullGet(BaseInterface $entity = null, BaseNull $nullObject = null)
    {
        if ($entity === null) {
            if ($nullObject === null) {
                throw new \RuntimeException('Unable to instantiate null class');
            }

            return $nullObject;
        }

        return $entity;
    }
public function nullGet(BaseInterface $entity = null, BaseNull $nullObject = null)
    {
        if ($entity === null) {
            if ($nullObject === null) {
                throw new \RuntimeException('Unable to instantiate null class');
            }

            return $nullObject;
        }

        return $entity;
    }
Helper method to allow entities to return
$this->nullGet($this->property)
and have the entity never return an actual null
The second parameter is optional and allows overriding of
the null object instantiated by naming convention (classname + 'Null')

@param  \FzyCommon\Entity\BaseInterface $entity
@param  \FzyCommon\Entity\BaseNull|null $nullObject
@return \FzyCommon\Entity\BaseInterface