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

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

src/Offer/OfferCommandHandler.php 1 location

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