Code Duplication    Length = 19-20 lines in 3 locations

src/Offer/ReadModel/History/OfferHistoryProjector.php 1 location

@@ 56-75 (lines=20) @@
53
     * @return string[]
54
     *   An associative array of commands and their handler methods.
55
     */
56
    protected function getEventHandlers()
57
    {
58
        $events = [];
59
60
        foreach (get_class_methods($this) as $method) {
61
            $matches = [];
62
63
            if (preg_match('/^apply(.+)$/', $method, $matches)) {
64
                $event = $matches[1];
65
                $classNameMethod = 'get' . $event . 'ClassName';
66
67
                if (method_exists($this, $classNameMethod)) {
68
                    $eventFullClassName = call_user_func(array($this, $classNameMethod));
69
                    $events[$eventFullClassName] = $method;
70
                }
71
            }
72
        }
73
74
        return $events;
75
    }
76
77
    /**
78
     * @return string

src/Offer/ReadModel/JSONLD/OfferLDProjector.php 1 location

@@ 129-148 (lines=20) @@
126
     * @return string[]
127
     *   An associative array of commands and their handler methods.
128
     */
129
    private function getEventHandlers()
130
    {
131
        $events = [];
132
133
        foreach (get_class_methods($this) as $method) {
134
            $matches = [];
135
136
            if (preg_match('/^apply(.+)$/', $method, $matches)) {
137
                $event = $matches[1];
138
                $classNameMethod = 'get' . $event . 'ClassName';
139
140
                if (method_exists($this, $classNameMethod)) {
141
                    $eventFullClassName = call_user_func(array($this, $classNameMethod));
142
                    $events[$eventFullClassName] = $method;
143
                }
144
            }
145
        }
146
147
        return $events;
148
    }
149
150
    /**
151
     * @return string

src/Offer/OfferCommandHandler.php 1 location

@@ 88-106 (lines=19) @@
85
     * @return string[]
86
     *   An associative array of commands and their handler methods.
87
     */
88
    private function getCommandHandlers()
89
    {
90
        $commands = [];
91
92
        foreach (get_class_methods($this) as $method) {
93
            $matches = [];
94
            if (preg_match('/^handle(.+)$/', $method, $matches)) {
95
                $command = $matches[1];
96
                $classNameMethod = 'get' . $command . 'ClassName';
97
98
                if (method_exists($this, $classNameMethod)) {
99
                    $commandFullClassName = call_user_func(array($this, $classNameMethod));
100
                    $commands[$commandFullClassName] = $method;
101
                }
102
            }
103
        }
104
105
        return $commands;
106
    }
107
108
    /**
109
     * @return string