Code Duplication    Length = 7-9 lines in 2 locations

src/Psalm/Config/ErrorLevelFileFilter.php 1 location

@@ 28-36 (lines=9) @@
25
    ) {
26
        $filter = parent::loadFromXMLElement($e, $base_dir, $inclusive);
27
28
        if (isset($e['type'])) {
29
            $filter->error_level = (string) $e['type'];
30
31
            if (!in_array($filter->error_level, \Psalm\Config::$ERROR_LEVELS, true)) {
32
                throw new \Psalm\Exception\ConfigException('Unexpected error level ' . $filter->error_level);
33
            }
34
        } else {
35
            throw new \Psalm\Exception\ConfigException('<type> element expects a level');
36
        }
37
38
        return $filter;
39
    }

src/Psalm/Config/IssueHandler.php 1 location

@@ 36-42 (lines=7) @@
33
    {
34
        $handler = new self();
35
36
        if (isset($e['errorLevel'])) {
37
            $handler->error_level = (string) $e['errorLevel'];
38
39
            if (!in_array($handler->error_level, \Psalm\Config::$ERROR_LEVELS, true)) {
40
                throw new \Psalm\Exception\ConfigException('Unexpected error level ' . $handler->error_level);
41
            }
42
        }
43
44
        /** @var \SimpleXMLElement $error_level */
45
        foreach ($e->errorLevel as $error_level) {