Code Duplication    Length = 8-9 lines in 4 locations

core/libraries/batch/BatchRequestProcessor.php 4 locations

@@ 72-79 (lines=8) @@
69
            $obj = $this->instantiate_batch_job_handler_from_classname($batch_job_handler_class);
70
            $this->_job_parameters = new JobParameters($this->_job_id, $batch_job_handler_class, $request_data);
71
            $response = $obj->create_job($this->_job_parameters);
72
            if (! $response instanceof JobStepResponse) {
73
                throw new BatchRequestException(
74
                    sprintf(
75
                        __(
76
                            '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',
77
                            'event_espresso'
78
                        ),
79
                        wp_json_encode($request_data)
80
                    )
81
                );
82
            }
@@ 84-92 (lines=9) @@
81
                );
82
            }
83
            $success = $this->_job_parameters->save(true);
84
            if (! $success) {
85
                throw new BatchRequestException(
86
                    sprintf(
87
                        __(
88
                            'Could not save job %1$s to the Wordpress Options table. These were the arguments used: %2$s',
89
                            'event_espresso'
90
                        ),
91
                        $this->_job_id,
92
                        wp_json_encode($request_data)
93
                    )
94
                );
95
            }
@@ 120-127 (lines=8) @@
117
            $handler_obj = $this->instantiate_batch_job_handler_from_classname($this->_job_parameters->classname());
118
            // continue it
119
            $response = $handler_obj->continue_job($this->_job_parameters, $batch_size);
120
            if (! $response instanceof JobStepResponse) {
121
                throw new BatchRequestException(
122
                    sprintf(
123
                        __(
124
                            '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',
125
                            'event_espresso'
126
                        ),
127
                        $this->_job_id
128
                    )
129
                );
130
            }
@@ 191-198 (lines=8) @@
188
            $handler_obj = $this->instantiate_batch_job_handler_from_classname($job_parameters->classname());
189
            // continue it
190
            $response = $handler_obj->cleanup_job($job_parameters);
191
            if (! $response instanceof JobStepResponse) {
192
                throw new BatchRequestException(
193
                    sprintf(
194
                        __(
195
                            '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',
196
                            'event_espresso'
197
                        ),
198
                        $this->_job_id
199
                    )
200
                );
201
            }