Code Duplication    Length = 11-13 lines in 3 locations

src/Runner/Simulate.php 3 locations

@@ 148-160 (lines=13) @@
145
     * @param  \phpbu\App\Backup\Collector     $collector
146
     * @throws \phpbu\App\Exception
147
     */
148
    protected function simulateCleanup(Configuration\Backup $backup, Target $target, Collector $collector)
149
    {
150
        /* @var \phpbu\App\Configuration\Backup\Cleanup $cleanup */
151
        if ($backup->hasCleanup()) {
152
            $cleanup = $backup->getCleanup();
153
            $cleaner = $this->factory->createCleaner($cleanup->type, $cleanup->options);
154
            $this->result->cleanupStart($cleanup);
155
            if ($cleaner instanceof Cleaner\Simulator) {
156
                $cleaner->simulate($target, $collector, $this->result);
157
            }
158
            $this->result->cleanupEnd($cleanup);
159
        }
160
    }
161
162
    /**
163
     * Execute the compressor.
@@ 89-99 (lines=11) @@
86
     * @param  \phpbu\App\Backup\Collector     $collector
87
     * @throws \Exception
88
     */
89
    protected function simulateChecks(Configuration\Backup $backup, Target $target, Collector $collector)
90
    {
91
        foreach ($backup->getChecks() as $config) {
92
            $this->result->checkStart($config);
93
            $check = $this->factory->createCheck($config->type);
94
            if ($check instanceof Check\Simulator) {
95
                $check->simulate($target, $config->value, $collector, $this->result);
96
            }
97
            $this->result->checkEnd($config);
98
        }
99
    }
100
101
    /**
102
     * Simulate encryption.
@@ 108-120 (lines=13) @@
105
     * @param  \phpbu\App\Backup\Target        $target
106
     * @throws \phpbu\App\Exception
107
     */
108
    protected function simulateCrypt(Configuration\Backup $backup, Target $target)
109
    {
110
        if ($backup->hasCrypt()) {
111
            $crypt = $backup->getCrypt();
112
            $this->result->cryptStart($crypt);
113
            $crypter = $this->factory->createCrypter($crypt->type, $crypt->options);
114
            if ($crypter instanceof Crypter\Simulator) {
115
                $crypter->simulate($target, $this->result);
116
            }
117
            $target->setCrypter($crypter);
118
            $this->result->cryptEnd($crypt);
119
        }
120
    }
121
122
    /**
123
     * Simulate all syncs.