Code Duplication    Length = 10-10 lines in 2 locations

src/Serializard.php 1 location

@@ 45-54 (lines=10) @@
42
        return $context->withRoot($var)->withFormat($format);
43
    }
44
45
    private function getFormat($alias)
46
    {
47
        $format = $this->formats->get($alias);
48
49
        if(false === $format instanceof FormatInterface) {
50
            throw new \RuntimeException(sprintf('No registered format for alias %s!', $alias));
51
        }
52
53
        return $format;
54
    }
55
}
56

src/SerializardFacade.php 1 location

@@ 65-74 (lines=10) @@
62
        return $this->getFormat($format)->unserialize($var, $class, $this->hydrators);
63
    }
64
65
    private function getFormat($alias)
66
    {
67
        $format = $this->formats->get($alias);
68
69
        if(false === $format instanceof FormatInterface) {
70
            throw new \RuntimeException(sprintf('No registered format for alias %s!', $alias));
71
        }
72
73
        return $format;
74
    }
75
}
76