/** * @param IdentityInterface $identity * * @throws Exception\InvalidArgumentException on complete identity */ protected function guardIdentityIsIncomplete(IdentityInterface $identity) { if (true === $identity->isComplete()) { $msg = 'Identity must be incomplete'; throw new Exception\InvalidArgumentException($msg); } }
/** * @param IdentityInterface $identity * * @return string */ public static function assembleKey(IdentityInterface $identity) { if (false === $identity->isComplete()) { $msg = 'Identity must be complete for key assembly'; throw new Exception\InvalidArgumentException($msg); } $keyArr = [$identity->getDomainSpace()]; $values = $identity->getValues(); $keyArr = array_merge($keyArr, $values); $key = implode('-', $keyArr); return $key; }