Code Duplication    Length = 12-12 lines in 4 locations

src/Client.php 4 locations

@@ 159-170 (lines=12) @@
156
        };
157
    }
158
159
    protected static function getChannelPostEvent(Closure $action)
160
    {
161
        return function (Update $update) use ($action) {
162
            if (!$update->getChannelPost()) {
163
                return true;
164
            }
165
166
            $action = new ReflectionFunction($action);
167
            $action->invokeArgs([$update->getChannelPost()]);
168
            return false;
169
        };
170
    }
171
172
    protected static function getInlineQueryEvent(Closure $action)
173
    {
@@ 172-183 (lines=12) @@
169
        };
170
    }
171
172
    protected static function getInlineQueryEvent(Closure $action)
173
    {
174
        return function (Update $update) use ($action) {
175
            if (!$update->getInlineQuery()) {
176
                return true;
177
            }
178
179
            $reflectionAction = new ReflectionFunction($action);
180
            $reflectionAction->invokeArgs([$update->getInlineQuery()]);
181
            return false;
182
        };
183
    }
184
185
    protected static function getShippingQueryEvent(Closure $action)
186
    {
@@ 185-196 (lines=12) @@
182
        };
183
    }
184
185
    protected static function getShippingQueryEvent(Closure $action)
186
    {
187
        return function (Update $update) use ($action) {
188
            if (!$update->getShippingQuery()) {
189
                return true;
190
            }
191
192
            $reflectionAction = new ReflectionFunction($action);
193
            $reflectionAction->invokeArgs([$update->getShippingQuery()]);
194
            return false;
195
        };
196
    }
197
198
    protected static function getPreCheckoutQueryEvent(Closure $action)
199
    {
@@ 198-209 (lines=12) @@
195
        };
196
    }
197
198
    protected static function getPreCheckoutQueryEvent(Closure $action)
199
    {
200
        return function (Update $update) use ($action) {
201
            if (!$update->getPreCheckoutQuery()) {
202
                return true;
203
            }
204
205
            $reflectionAction = new ReflectionFunction($action);
206
            $reflectionAction->invokeArgs([$update->getPreCheckoutQuery()]);
207
            return false;
208
        };
209
    }
210
211
    /**
212
     * Returns check function to handling the command.