configuration = $configuration; } /** * Apply transformations to the provided DOM document. * * @param Document $document DOM document to apply the transformations to. * @param ErrorCollection $errors Collection of errors that are collected during transformation. * @return void */ public function transform(Document $document, ErrorCollection $errors) { $document->html->setAttribute(self::TRANSFORMED_ATTRIBUTE, $this->getOrigin()); } /** * Get the origin that transformed the AMP document. * * @return string Origin of the transformation. */ private function getOrigin() { $version = $this->configuration->get(TransformedIdentifierConfiguration::VERSION); $origin = self::TRANSFORMED_ORIGIN; if ($version > 0) { $origin .= ";v={$version}"; } return $origin; } }