Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

MailToHandler.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishCoreBundle\URLChecker\Handler;
8
9 use Symfony\Component\OptionsResolver\OptionsResolver;
10
11 class MailToHandler extends AbstractURLHandler
12 {
13 const MAILTO_PATTERN = '/^mailto:(.+)@([^?]+)(\\?.*)?$/';
14
18 public function validate(array $urls)
19 {
20 if (!$this->options['enabled']) {
21 return;
22 }
23
24 foreach ($urls as $url) {
25 if (preg_match(self::MAILTO_PATTERN, $url->url, $matches)) {
26 $host = trim($matches[2]);
27
28 $this->setUrlStatus($url, checkdnsrr($host, 'MX'));
29 }
30 }
31 }
32
38 protected function getOptionsResolver()
39 {
40 $resolver = new OptionsResolver();
41 $resolver->setDefaults([
42 'enabled' => true,
43 ]);
44
45 $resolver->setAllowedTypes('enabled', 'bool');
46
47 return $resolver;
48 }
49 }
eZ\Bundle\EzPublishCoreBundle\URLChecker\Handler\AbstractURLHandler
Definition: AbstractURLHandler.php:18
eZ\Bundle\EzPublishCoreBundle\URLChecker\Handler\AbstractURLHandler\setUrlStatus
setUrlStatus(URL $url, $isValid)
Sets URL status.
Definition: AbstractURLHandler.php:59
eZ\Bundle\EzPublishCoreBundle\URLChecker\Handler\MailToHandler
Definition: MailToHandler.php:12
eZ\Bundle\EzPublishCoreBundle\URLChecker\Handler\MailToHandler\MAILTO_PATTERN
const MAILTO_PATTERN
Definition: MailToHandler.php:13
eZ\Bundle\EzPublishCoreBundle\URLChecker\Handler\MailToHandler\getOptionsResolver
getOptionsResolver()
Returns options resolver.
Definition: MailToHandler.php:38
eZ\Bundle\EzPublishCoreBundle\URLChecker\Handler\MailToHandler\validate
validate(array $urls)
{Validates given list of URLs.}
Definition: MailToHandler.php:18
eZ\Bundle\EzPublishCoreBundle\URLChecker\Handler
Definition: AbstractURLHandler.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.