Conditions | 7 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | public function detect(ProfileContainerInterface $profileContainer): ?ProfileInterface |
||
31 | { |
||
32 | $url = $this->request->getUrl()->getAbsoluteUrl(); |
||
33 | |||
34 | foreach ($profileContainer->toArray() as $profile) { |
||
35 | if (FALSE === $profile->isEnabled()) { |
||
36 | continue; |
||
37 | } |
||
38 | |||
39 | foreach ($profile->getDomains() as $domain) { |
||
40 | $matches = NULL; |
||
41 | if ($domain === $url || (FALSE !== preg_match('#' . $domain . '#', $url, $matches) && !empty($matches))) { |
||
42 | return $profile; |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 | |||
47 | return NULL; |
||
48 | } |
||
50 |