public function grantHash(bool $save = false) : string
    {
        if (!nb_isValidGUID($hash = $this->getHash())) {
            $this->setHash($hash = nb_generateGUID());
            if ($save && $this instanceof CNabuDBObject) {
                $this->save();
            }
        }

        return $hash;
    }
public function grantHash(bool $save = false) : string
    {
        if (!nb_isValidGUID($hash = $this->getHash())) {
            $this->setHash($hash = nb_generateGUID());
            if ($save && $this instanceof CNabuDBObject) {
                $this->save();
            }
        }

        return $hash;
    }
public function grantHash ( bool $ save = false ) : string { if ( ! nb_isValidGUID ( $ hash = $ this -> getHash ( ) ) ) { $ this -> setHash ( $ hash = nb_generateGUID ( ) ) ; if ( $ save && $ this instanceof CNabuDBObject ) { $ this -> save ( ) ; } } return $ hash ; }
Grants that this object have a valid hash. Optionally can save the hash in the database.
@param bool $save If true, the save() method is called after grant the hash and just before return.
@return string Returns a valid hash.
Grants that this object have a valid hash . Optionally can save the hash in the database .