Code Duplication    Length = 13-18 lines in 2 locations

src/Application/Projection/Projectionist.php 2 locations

@@ 61-78 (lines=18) @@
58
     * @param Projector[] $projectors
59
     * @throws Exception
60
     */
61
    public function play(array $projectors): void
62
    {
63
        foreach ($projectors as $projector) {
64
            $projectorState = $this->ledger->get($projector);
65
66
            // Play only when projector is not halted or being processed by other agent
67
            if ($projectorState->isHalted() || $projectorState->isProjecting()) {
68
                continue;
69
            }
70
71
            // If it's not halted, it already ran.
72
            if ($projectorState->projectorRunsFrom() === Projector::RUN_ONCE) {
73
                continue;
74
            }
75
76
            $this->project($projector, $projectorState);
77
        }
78
    }
79
80
    /**
81
     * Boots provided list of projectors
@@ 86-98 (lines=13) @@
83
     * @param Projector[] $projectors
84
     * @throws Exception
85
     */
86
    public function boot(array $projectors): void
87
    {
88
        foreach ($projectors as $projector) {
89
            $projectorState = $this->ledger->get($projector);
90
91
            // Play only when projector is not halted or being processed by other agent
92
            if (!$projectorState->isHalted() || $projectorState->isProjecting()) {
93
                continue;
94
            }
95
96
            $this->project($projector, $projectorState);
97
        }
98
    }
99
100
    /**
101
     * Retires provided list of projectors