Code Duplication    Length = 47-56 lines in 3 locations

src/Eccube/DependencyInjection/Facade/AnnotationReaderFacade.php 1 location

@@ 11-62 (lines=52) @@
8
/**
9
 * XXX ContainerInterface は不要かも
10
 */
11
class AnnotationReaderFacade
12
{
13
    /** @var self|null */
14
    private static $instance = null;
15
16
    /** @var ContainerInterface */
17
    private static $Container;
18
19
    /** @var Reader */
20
    private static $Reader;
21
22
    /**
23
     * @param ContainerInterface $container
24
     */
25
    public function __construct(ContainerInterface $container, Reader $Reader)
26
    {
27
        self::$Container = $container;
28
        self::$Reader = $Reader;
29
    }
30
31
    /**
32
     * @param ContainerInterface $container
33
     *
34
     * @return null|AnnotationReaderFacade
35
     */
36
    public static function init(ContainerInterface $container, Reader $Reader)
37
    {
38
        if (null === self::$instance) {
39
            self::$instance = new self($container, $Reader);
40
        }
41
42
        return self::$instance;
43
    }
44
45
    /**
46
     * @return Reader
47
     * @throws \Exception
48
     */
49
    public static function create()
50
    {
51
        if (null === self::$instance) {
52
            throw new \Exception("Facade is not instantiated");
53
        }
54
55
        return self::$Reader;
56
    }
57
58
    public function getAnnotationReader()
59
    {
60
        return self::$Reader;
61
    }
62
}
63

src/Eccube/DependencyInjection/Facade/LoggerFacade.php 1 location

@@ 11-66 (lines=56) @@
8
/**
9
 * XXX ContainerInterface は不要かも
10
 */
11
class LoggerFacade
12
{
13
    /** @var self|null */
14
    private static $instance = null;
15
16
    /** @var ContainerInterface */
17
    private static $Container;
18
19
    /** @var Logger */
20
    private static $Logger;
21
22
    /**
23
     * @param ContainerInterface $container
24
     */
25
    private function __construct(ContainerInterface $container, Logger $Logger)
26
    {
27
        self::$Container = $container;
28
        self::$Logger = $Logger;
29
    }
30
31
    /**
32
     * @param ContainerInterface $container
33
     *
34
     * @return null|LoggerFacade
35
     */
36
    public static function init(ContainerInterface $container, Logger $Logger)
37
    {
38
        if (null === self::$instance) {
39
            self::$instance = new self($container, $Logger);
40
        }
41
42
        return self::$instance;
43
    }
44
45
    /**
46
     * @return Logger
47
     * @throws \Exception
48
     */
49
    public static function create()
50
    {
51
        if (null === self::$instance) {
52
            throw new \Exception("Facade is not instantiated");
53
        }
54
55
        return self::$Logger;
56
    }
57
58
    /**
59
     * @deprecated
60
     * @return ContainerInterface
61
     */
62
    public static function getContainer()
63
    {
64
        return self::$Container;
65
    }
66
}
67

src/Eccube/DependencyInjection/Facade/TranslatorFacade.php 1 location

@@ 11-57 (lines=47) @@
8
/**
9
 * XXX ContainerInterface は不要かも
10
 */
11
class TranslatorFacade
12
{
13
    /** @var self|null */
14
    private static $instance = null;
15
16
    /** @var ContainerInterface */
17
    private static $Container;
18
19
    /** @var TranslatorInterface */
20
    private static $Translator;
21
22
    /**
23
     * @param ContainerInterface $container
24
     */
25
    private function __construct(ContainerInterface $container, TranslatorInterface $Translator)
26
    {
27
        self::$Container = $container;
28
        self::$Translator = $Translator;
29
    }
30
31
    /**
32
     * @param ContainerInterface $container
33
     *
34
     * @return null|TranslatorFacade
35
     */
36
    public static function init(ContainerInterface $container, TranslatorInterface $Translator)
37
    {
38
        if (null === self::$instance) {
39
            self::$instance = new self($container, $Translator);
40
        }
41
42
        return self::$instance;
43
    }
44
45
    /**
46
     * @return TranslatorInterface
47
     * @throws \Exception
48
     */
49
    public static function create()
50
    {
51
        if (null === self::$instance) {
52
            throw new \Exception("Facade is not instantiated");
53
        }
54
55
        return self::$Translator;
56
    }
57
}
58