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/OfferCommandHandler.php 1 location

@@ 101-119 (lines=19) @@
98
     * @return string[]
99
     *   An associative array of commands and their handler methods.
100
     */
101
    private function getCommandHandlers()
102
    {
103
        $commands = [];
104
105
        foreach (get_class_methods($this) as $method) {
106
            $matches = [];
107
            if (preg_match('/^handle(.+)$/', $method, $matches)) {
108
                $command = $matches[1];
109
                $classNameMethod = 'get' . $command . 'ClassName';
110
111
                if (method_exists($this, $classNameMethod)) {
112
                    $commandFullClassName = call_user_func(array($this, $classNameMethod));
113
                    $commands[$commandFullClassName] = $method;
114
                }
115
            }
116
        }
117
118
        return $commands;
119
    }
120
121
    /**
122
     * @return string

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

@@ 158-177 (lines=20) @@
155
     * @return string[]
156
     *   An associative array of commands and their handler methods.
157
     */
158
    private function getEventHandlers()
159
    {
160
        $events = [];
161
162
        foreach (get_class_methods($this) as $method) {
163
            $matches = [];
164
165
            if (preg_match('/^apply(.+)$/', $method, $matches)) {
166
                $event = $matches[1];
167
                $classNameMethod = 'get' . $event . 'ClassName';
168
169
                if (method_exists($this, $classNameMethod)) {
170
                    $eventFullClassName = call_user_func(array($this, $classNameMethod));
171
                    $events[$eventFullClassName] = $method;
172
                }
173
            }
174
        }
175
176
        return $events;
177
    }
178
179
    /**
180
     * @return string