|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. |
|
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Yves\Coremedia\ApiResponse\Renderer; |
|
9
|
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\CoremediaPlaceholderTransfer; |
|
|
|
|
|
|
11
|
|
|
use Symfony\Component\Routing\Exception\RouteNotFoundException; |
|
12
|
|
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
|
13
|
|
|
|
|
14
|
|
|
class CustomPageUrlPlaceholderReplacementRenderer implements PlaceholderReplacementRendererInterface |
|
15
|
|
|
{ |
|
16
|
|
|
protected const PLACEHOLDER_OBJECT_TYPE = 'page'; |
|
17
|
|
|
protected const PLACEHOLDER_RENDER_TYPE = 'url'; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $urlGenerator; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator |
|
26
|
|
|
*/ |
|
27
|
|
|
public function __construct(UrlGeneratorInterface $urlGenerator) |
|
28
|
|
|
{ |
|
29
|
|
|
$this->urlGenerator = $urlGenerator; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @param \Generated\Shared\Transfer\CoremediaPlaceholderTransfer $coreMediaPlaceholderTransfer |
|
34
|
|
|
* |
|
35
|
|
|
* @return bool |
|
36
|
|
|
*/ |
|
37
|
|
|
public function isApplicable(CoremediaPlaceholderTransfer $coreMediaPlaceholderTransfer): bool |
|
38
|
|
|
{ |
|
39
|
|
|
return $coreMediaPlaceholderTransfer->getObjectType() === static::PLACEHOLDER_OBJECT_TYPE && |
|
40
|
|
|
$coreMediaPlaceholderTransfer->getRenderType() === static::PLACEHOLDER_RENDER_TYPE; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @param \Generated\Shared\Transfer\CoremediaPlaceholderTransfer $coreMediaPlaceholderTransfer |
|
45
|
|
|
* @param string $locale |
|
46
|
|
|
* |
|
47
|
|
|
* @return string|null |
|
48
|
|
|
*/ |
|
49
|
|
|
public function getPlaceholderReplacement( |
|
50
|
|
|
CoremediaPlaceholderTransfer $coreMediaPlaceholderTransfer, |
|
51
|
|
|
string $locale |
|
52
|
|
|
): ?string { |
|
53
|
|
|
if (!$coreMediaPlaceholderTransfer->getExternalSeoSegment()) { |
|
54
|
|
|
return null; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
try { |
|
58
|
|
|
$pageUrl = $this->urlGenerator->generate($coreMediaPlaceholderTransfer->getExternalSeoSegment()); |
|
59
|
|
|
|
|
60
|
|
|
return $pageUrl; |
|
61
|
|
|
} catch (RouteNotFoundException $e) { |
|
62
|
|
|
return null; |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @return string|null |
|
68
|
|
|
*/ |
|
69
|
|
|
public function getFallbackPlaceholderReplacement(): ?string |
|
70
|
|
|
{ |
|
71
|
|
|
return ''; |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths