Code Duplication    Length = 18-25 lines in 2 locations

src/Tokens/Elements/Html.php 1 location

@@ 21-38 (lines=18) @@
18
        );
19
    }
20
21
    public function validate(Configuration $configuration)
22
    {
23
        parent::validate($configuration);
24
25
        // If not valid, then we are done.
26
        if (!$this->isValid) {
27
            return;
28
        }
29
30
        // If no cleaning, then we are done.
31
        if ($configuration->get('clean-strategy') == 'none') {
32
            return;
33
        }
34
35
        if ($this->getParent() !== null) {
36
            return $this->handleValidationError('Html element must not be nested.');
37
        }
38
    }
39
}
40

src/Tokens/Elements/Link.php 1 location

@@ 25-49 (lines=25) @@
22
        );
23
    }
24
25
    public function validate(Configuration $configuration)
26
    {
27
        parent::validate($configuration);
28
29
        // If not valid, then we are done.
30
        if (!$this->isValid) {
31
            return;
32
        }
33
34
        // If no cleaning, then we are done.
35
        if ($configuration->get('clean-strategy') == 'none') {
36
            return;
37
        }
38
39
        // Must have "href" attribute.
40
        if (!$this->hasAttribute('href')) {
41
            $this->handleValidationError(
42
                $configuration,
43
                'Link element must have "href" attribute.'
44
            );
45
        }
46
47
        // Must have either "rel" or "itemprop" attribute, but not both.
48
        /// @todo
49
    }
50
}
51