Code Duplication    Length = 10-11 lines in 2 locations

src/Factory.php 2 locations

@@ 99-109 (lines=11) @@
96
     * @throws \phpbu\App\Exception
97
     * @return mixed
98
     */
99
    protected function create($type, $alias)
100
    {
101
        self::checkType($type);
102
        $alias = strtolower($alias);
103
104
        if (!isset(self::$classMap[$type][$alias])) {
105
            throw new Exception(sprintf('unknown %s: %s', $type, $alias));
106
        }
107
        $class = self::$classMap[$type][$alias];
108
        return new $class();
109
    }
110
111
    /**
112
     * Runner Factory.
@@ 291-300 (lines=10) @@
288
     * @param  boolean $force       Overwrite already registered class
289
     * @throws \phpbu\App\Exception
290
     */
291
    public static function register($type, $alias, $fqcn, $force = false)
292
    {
293
        self::checkType($type);
294
        $alias = strtolower($alias);
295
296
        if (!$force && isset(self::$classMap[$type][$alias])) {
297
            throw new Exception(sprintf('%s is already registered use force parameter to overwrite', $type));
298
        }
299
        self::$classMap[$type][$alias] = $fqcn;
300
    }
301
302
    /**
303
     * Throws an exception if type is invalid.