/** * Returns an identifier object. * * Accepts various types of parameters and returns a valid identifier. Parameters can either be an * object that implements KObjectInterface, or a KObjectIdentifier object, or valid identifier * string. Function recursively resolves identifier aliases and returns the aliased identifier. * * If the identifier does not have a type set default type to 'lib'. Eg, event.publisher is the same as * lib:event.publisher. * * If no identifier is passed the object identifier of this object will be returned. * * @param mixed $identifier An KObjectIdentifier, identifier string or object implementing KObjectInterface * @return KObjectIdentifier * @throws KObjectExceptionInvalidIdentifier If the identifier is not valid */ public function getIdentifier($identifier = null) { //Get the identifier if (isset($identifier)) { if (!$identifier instanceof KObjectIdentifierInterface) { if ($identifier instanceof KObjectInterface) { $identifier = $identifier->getIdentifier(); } else { $identifier = new KObjectIdentifier($identifier); } } //Get the identifier object if (!($result = $this->__registry->find($identifier))) { $result = $this->__registry->set($identifier); } } else { $result = $this->__object_identifier; } return $result; }