summaryrefslogtreecommitdiff
path: root/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/http-kernel/Debug/FileLinkFormatter.php')
-rw-r--r--vendor/symfony/http-kernel/Debug/FileLinkFormatter.php28
1 files changed, 10 insertions, 18 deletions
diff --git a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php
index 9476d50486..54defbf1d1 100644
--- a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php
+++ b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php
@@ -20,8 +20,10 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
* Formats debug file links.
*
* @author Jérémy Romey <jeremy@free-agent.fr>
+ *
+ * @final since Symfony 4.3
*/
-class FileLinkFormatter implements \Serializable
+class FileLinkFormatter
{
private $fileLinkFormat;
private $requestStack;
@@ -64,17 +66,11 @@ class FileLinkFormatter implements \Serializable
/**
* @internal
*/
- public function serialize()
+ public function __sleep(): array
{
- return serialize($this->getFileLinkFormat());
- }
+ $this->getFileLinkFormat();
- /**
- * @internal
- */
- public function unserialize($serialized)
- {
- $this->fileLinkFormat = unserialize($serialized, ['allowed_classes' => false]);
+ return ['fileLinkFormat'];
}
/**
@@ -91,21 +87,17 @@ class FileLinkFormatter implements \Serializable
private function getFileLinkFormat()
{
- if ($this->fileLinkFormat) {
- return $this->fileLinkFormat;
- }
if ($this->requestStack && $this->baseDir && $this->urlFormat) {
$request = $this->requestStack->getMasterRequest();
- if ($request instanceof Request) {
- if ($this->urlFormat instanceof \Closure && !$this->urlFormat = ($this->urlFormat)()) {
- return;
- }
- return [
+ if ($request instanceof Request && (!$this->urlFormat instanceof \Closure || $this->urlFormat = ($this->urlFormat)())) {
+ $this->fileLinkFormat = [
$request->getSchemeAndHttpHost().$request->getBasePath().$this->urlFormat,
$this->baseDir.\DIRECTORY_SEPARATOR, '',
];
}
}
+
+ return $this->fileLinkFormat;
}
}