Code Duplication    Length = 34-34 lines in 2 locations

src/Log/Json.php 1 location

@@ 130-163 (lines=34) @@
127
     * @param  \phpbu\App\Result $result
128
     * @return array
129
     */
130
    protected function extractBackups(Result $result) : array
131
    {
132
        $output = [];
133
        $backups = $result->getBackups();
134
        if (count($backups) > 0) {
135
            /** @var \phpbu\App\Result\Backup $backup */
136
            foreach ($backups as $backup) {
137
                $output[] = [
138
                    'name'   => $backup->getName(),
139
                    'status' => $backup->wasSuccessful() ? 0 : 1,
140
                    'checks' => [
141
                        'executed' => $backup->checkCount(),
142
                        'failed'   => $backup->checkCountFailed()
143
                    ],
144
                    'crypt' => [
145
                        'executed' => $backup->cryptCount(),
146
                        'skipped'  => $backup->cryptCountSkipped(),
147
                        'failed'   => $backup->cryptCountFailed()
148
                    ],
149
                    'syncs' => [
150
                        'executed' => $backup->syncCount(),
151
                        'skipped'  => $backup->syncCountSkipped(),
152
                        'failed'   => $backup->syncCountFailed()
153
                    ],
154
                    'cleanups' => [
155
                        'executed' => $backup->cleanupCount(),
156
                        'skipped'  => $backup->cleanupCountSkipped(),
157
                        'failed'   => $backup->cleanupCountFailed()
158
                    ]
159
                ];
160
            }
161
        }
162
        return $output;
163
    }
164
}
165

src/Log/Webhook.php 1 location

@@ 252-285 (lines=34) @@
249
     * @param  \phpbu\App\Result $result
250
     * @return array
251
     */
252
    protected function extractBackups(Result $result) : array
253
    {
254
        $output = [];
255
        $backups = $result->getBackups();
256
        if (count($backups) > 0) {
257
            /** @var \phpbu\App\Result\Backup $backup */
258
            foreach ($backups as $backup) {
259
                $output[] = [
260
                    'name' => $backup->getName(),
261
                    'status' => $backup->wasSuccessful() ? 0 : 1,
262
                    'checks' => [
263
                        'executed' => $backup->checkCount(),
264
                        'failed' => $backup->checkCountFailed()
265
                    ],
266
                    'crypt' => [
267
                        'executed' => $backup->cryptCount(),
268
                        'skipped' => $backup->cryptCountSkipped(),
269
                        'failed' => $backup->cryptCountFailed()
270
                    ],
271
                    'syncs' => [
272
                        'executed' => $backup->syncCount(),
273
                        'skipped' => $backup->syncCountSkipped(),
274
                        'failed' => $backup->syncCountFailed()
275
                    ],
276
                    'cleanups' => [
277
                        'executed' => $backup->cleanupCount(),
278
                        'skipped' => $backup->cleanupCountSkipped(),
279
                        'failed' => $backup->cleanupCountFailed()
280
                    ]
281
                ];
282
            }
283
        }
284
        return $output;
285
    }
286
}
287