Code Duplication    Length = 8-9 lines in 4 locations

core/libraries/batch/BatchRequestProcessor.php 4 locations

@@ 58-65 (lines=8) @@
55
            $obj = $this->instantiate_batch_job_handler_from_classname($batch_job_handler_class);
56
            $this->_job_parameters = new JobParameters($this->_job_id, $batch_job_handler_class, $request_data);
57
            $response = $obj->create_job($this->_job_parameters);
58
            if (! $response instanceof JobStepResponse) {
59
                throw new BatchRequestException(
60
                    sprintf(
61
                        __(
62
                            'The class implementing JobHandlerInterface did not return a JobStepResponse when create_job was called with %1$s. It needs to return one or throw an Exception',
63
                            'event_espresso'
64
                        ),
65
                        wp_json_encode($request_data)
66
                    )
67
                );
68
            }
@@ 70-78 (lines=9) @@
67
                );
68
            }
69
            $success = $this->_job_parameters->save(true);
70
            if (! $success) {
71
                throw new BatchRequestException(
72
                    sprintf(
73
                        __(
74
                            'Could not save job %1$s to the Wordpress Options table. These were the arguments used: %2$s',
75
                            'event_espresso'
76
                        ),
77
                        $this->_job_id,
78
                        wp_json_encode($request_data)
79
                    )
80
                );
81
            }
@@ 106-113 (lines=8) @@
103
            $handler_obj = $this->instantiate_batch_job_handler_from_classname($this->_job_parameters->classname());
104
            // continue it
105
            $response = $handler_obj->continue_job($this->_job_parameters, $batch_size);
106
            if (! $response instanceof JobStepResponse) {
107
                throw new BatchRequestException(
108
                    sprintf(
109
                        __(
110
                            'The class implementing JobHandlerInterface did not return a JobStepResponse when continue_job was called with job %1$s. It needs to return one or throw an Exception',
111
                            'event_espresso'
112
                        ),
113
                        $this->_job_id
114
                    )
115
                );
116
            }
@@ 177-184 (lines=8) @@
174
            $handler_obj = $this->instantiate_batch_job_handler_from_classname($job_parameters->classname());
175
            // continue it
176
            $response = $handler_obj->cleanup_job($job_parameters);
177
            if (! $response instanceof JobStepResponse) {
178
                throw new BatchRequestException(
179
                    sprintf(
180
                        __(
181
                            'The class implementing JobHandlerInterface did not return a JobStepResponse when cleanup_job was called with job %1$s. It needs to return one or throw an Exception',
182
                            'event_espresso'
183
                        ),
184
                        $this->_job_id
185
                    )
186
                );
187
            }