Code Duplication    Length = 31-32 lines in 2 locations

src/RunOpenCode/Backup/Workflow/Name.php 1 location

@@ 29-59 (lines=31) @@
26
 *
27
 * @package RunOpenCode\Backup\Workflow
28
 */
29
class Name extends BaseActivity implements LoggerAwareInterface, EventDispatcherAwareInterface
30
{
31
    use LoggerAwareTrait;
32
    use EventDispatcherAwareTrait;
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function execute()
38
    {
39
        try {
40
41
            $this->backup->setName($this->profile->getNamer()->getName());
42
            $this->getEventDispatcher()->dispatch(BackupEvents::NAME, new BackupEvent($this, $this->profile, $this->backup, $this));
43
44
        } catch (\Exception $e) {
45
46
            $this->getLogger()->error(sprintf('Could not set name of new backup for profile "%s".', $this->profile->getName()), array(
47
                'message' => $e->getMessage(),
48
                'code' => $e->getCode(),
49
                'file' => $e->getFile(),
50
                'line' => $e->getLine(),
51
                'trace' => $e->getTrace()
52
            ));
53
54
            throw $e;
55
        }
56
57
        $this->getLogger()->info(sprintf('Naming successfully completed, backup name: "%s".', $this->backup->getName()));
58
    }
59
}
60

src/RunOpenCode/Backup/Workflow/Push.php 1 location

@@ 29-60 (lines=32) @@
26
 *
27
 * @package RunOpenCode\Backup\Workflow
28
 */
29
class Push extends BaseActivity implements LoggerAwareInterface, EventDispatcherAwareInterface
30
{
31
    use LoggerAwareTrait;
32
    use EventDispatcherAwareTrait;
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function execute()
38
    {
39
        try {
40
41
            $this->profile->getDestination()->push($this->backup);
42
43
            $this->getEventDispatcher()->dispatch(BackupEvents::PUSH, new BackupEvent($this, $this->profile, $this->backup, $this));
44
45
            $this->getLogger()->info(sprintf('Backup "%s" successfully pushed to destination.', $this->backup->getName()));
46
47
        } catch (\Exception $e) {
48
49
            $this->getLogger()->error(sprintf('Could not push backup to destination for profile "%s".', $this->profile->getName()), array(
50
                'message' => $e->getMessage(),
51
                'code' => $e->getCode(),
52
                'file' => $e->getFile(),
53
                'line' => $e->getLine(),
54
                'trace' => $e->getTrace()
55
            ));
56
57
            throw $e;
58
        }
59
    }
60
}
61