/** * Returns an identifier object. * * Accepts various types of parameters and returns a valid identifier. Parameters can either be an * object that implements ObjectInterface, or a ObjectIdentifier object, or valid identifier * string. Function recursively resolves identifier aliases and returns the aliased identifier. * * If the identifier does not have a type set and it's not an alias the type will default 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 ObjectIdentifier, identifier string or object implementing ObjectInterface * @return ObjectIdentifier * @throws ObjectExceptionInvalidIdentifier If the identifier is not valid */ public function getIdentifier($identifier = null) { //Get the identifier if (isset($identifier)) { if (!$identifier instanceof ObjectIdentifierInterface) { if ($identifier instanceof ObjectInterface) { $identifier = $identifier->getIdentifier(); } else { $identifier = new ObjectIdentifier($identifier); } } //Get the identifier object if (!($result = $this->__registry->find($identifier))) { $result = $this->__registry->set($identifier); } } else { $result = $this->__object_identifier; } return $result; }