Code Duplication    Length = 8-10 lines in 2 locations

renderer.php 2 locations

@@ 45-52 (lines=8) @@
42
     * @param string $class_name
43
     * @throws \RuntimeException
44
     */
45
    public function register_component( $type, $class_name )
46
    {
47
        if( !in_array($type, $this->registered_components) )
48
        {
49
            $this->registered_components[$type] = $class_name;
50
        }
51
        else throw new \RuntimeException("A component of type '$type' has already been registered.");
52
    }
53
    
54
    /**
55
     * 
@@ 104-113 (lines=10) @@
101
     * @param type $props
102
     * @throws \RuntimeException
103
     */
104
    private function create_registered_component( $type, $props )
105
    {
106
        if(in_array($type, $this->registered_components))
107
        {
108
            $class_name = $this->registered_components[$type];
109
            return new $class_name($props);
110
        }
111
        
112
        throw new \RuntimeException("A component of type '$type' has not been registered.");
113
    }
114
}