Return a debug title for the document for use in exception messages.

@param $document

@return string
502788
public static function getDebugTitle($document)
    {
        $title = spl_object_hash($document);

        if ($document instanceof PathBehavior && $document->getPath()) {
            $title .= ' (' . $document->getPath() . ')';
        } elseif ($document instanceof TitleBehavior && $document->getTitle()) {
            $title .= ' (' . $document->getTitle() . ')';
        }

        return $title;
    }
621092
public function get_document_display_title(\core_search\document $doc) {

        $user = \core_user::get_user($doc->get('itemid'));
        return fullname($user);
    }
502070
private function getPageTitle(ArticleInterface $document)
    {
        $pageTitleProperty = $this->getPageTitleProperty($document);
        if (!$pageTitleProperty) {
            return;
        }

        $stagedData = $document->getStructure()->getStagedData();
        if (array_key_exists($pageTitleProperty->getName(), $stagedData)) {
            return $stagedData[$pageTitleProperty->getName()];
        }

        if (!$document->getStructure()->hasProperty($pageTitleProperty->getName())) {
            return;
        }

        return $document->getStructure()->getProperty($pageTitleProperty->getName())->getValue();
    }
791739
function _shortTitleForDocument(doc) {
        var fullPath = doc.file.fullPath;

        // If the document is untitled then return the filename, ("Untitled-n.ext");
        // otherwise show the project-relative path if the file is inside the
        // current project or the full absolute path if it's not in the project.
        if (doc.isUntitled()) {
            return fullPath.substring(fullPath.lastIndexOf("/") + 1);
        } else {
            return ProjectManager.makeProjectRelativeIfPossible(fullPath);
        }
    }
1361402
public function getXPath($document)
	{
		$i=strpos($document,'#');

		if ($i!== false)
		{
			return substr($document, $i+1);
		}
		else
		{
			return "";
		}
	}
982613
public function getDestName()
    {
        if (!$this->destName) {
            throw new \RuntimeException(sprintf(
                'No destName set in copy/move event when copying/moving document "%s" to "%s". ' .
                'This should have been set by a listener',
                spl_object_hash($this->document),
                $this->destId
            ));
        }

        return $this->destName;
    }
404819
protected function document(Document $document = null): ?Document {
        if ($document === null) {
            return $this->document;
        }

        $this->document = $document;

        return $this->document;
    }
512265
public function getLocalizationState($document)
    {
        if ($document instanceof ShadowLocaleBehavior) {
            if (true === $document->isShadowLocaleEnabled()) {
                return LocalizationState::SHADOW;
            }
        }

        $originalLocale = $document->getOriginalLocale();
        $currentLocale = $document->getLocale();

        if ($originalLocale === $currentLocale) {
            return LocalizationState::LOCALIZED;
        }

        return LocalizationState::GHOST;
    }
263577
public function getDocumentChangeSet($document)
    {
        $oid = spl_object_hash($document);
        if (isset($this->documentChangeSets[$oid])) {
            return $this->documentChangeSets[$oid];
        }
        return array();
    }
518675
protected function getExceptionName(): string
    {
        $exception = $this->getException();

        if ($exception instanceof Exception) {
            $name = $exception->getName();
        } else {
            $name = $this->getDefaultName();
        }

        if ($code = $this->getExceptionCode()) {
            $name .= " (#$code)";
        }

        return $name;
    }
1206189
public static function convertExceptionToString($exception)
    {
        if ($exception instanceof Exception && ($exception instanceof UserException || !YII_DEBUG)) {
            $message = "{$exception->getName()}: {$exception->getMessage()}";
        } elseif (YII_DEBUG) {
            if ($exception instanceof Exception) {
                $message = "Exception ({$exception->getName()})";
            } elseif ($exception instanceof ErrorException) {
                $message = "{$exception->getName()}";
            } else {
                $message = 'Exception';
            }
            $message .= " '" . get_class($exception) . "' with message '{$exception->getMessage()}' \n\nin "
                . $exception->getFile() . ':' . $exception->getLine() . "\n\n"
                . "Stack trace:\n" . $exception->getTraceAsString();
        } else {
            $message = 'Error: ' . $exception->getMessage();
        }
        return $message;
    }
777055
public function getDocumentIdentifier($document)
    {
        return isset($this->documentIdentifiers[spl_object_hash($document)]) ?
            $this->documentIdentifiers[spl_object_hash($document)] : null;
    }
774541
public function getVersion(\DOMDocument $document)
    {
        if (empty($document->documentElement)) {
            return '';
        }

        $xpath = $this->getXpath($document);
        $this->setNs($document);
        $xpath->registerNamespace('cbc', self::CBC_NS);

        return $this->getSingleValue($xpath, 'cbc:UBLVersionID');
    }
132039
public function getSubscriptionName(DocumentNode $document): string
    {
        return $document->definitions[0]->selectionSet->selections[0]->name->value;
    }
776412
private function getPageTitleProperty(ArticleInterface $document)
    {
        $metadata = $this->structureMetadataFactory->getStructureMetadata(
            'article',
            $document->getStructureType()
        );

        if ($metadata->hasPropertyWithTagName(self::PAGE_TITLE_TAG_NAME)) {
            return $metadata->getPropertyByTagName(self::PAGE_TITLE_TAG_NAME);
        }

        if ($metadata->hasProperty(self::PAGE_TITLE_PROPERTY_NAME)) {
            return $metadata->getProperty(self::PAGE_TITLE_PROPERTY_NAME);
        }

        return null;
    }
819664
protected function format_exception( Exception $exception ) {
		$string = get_class( $exception );

		if ( ! empty( $exception->getMessage() ) ) {
			$string .= " : {$exception->getMessage()}";
		}

		if ( ! empty( $exception->getCode() ) ) {
			$string .= " (#{$exception->getCode()})";
		}

		return $string;
	}
1224401
private function getRevision($document)
    {
        $revision = null;

        if ($document instanceof Document) {
            $revision = $document->getRevision();
        }

        return $revision;
    }