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

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