Playbook::run()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
nc 1
1
<?php
2
3
namespace Scaling\Playbook;
4
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
abstract class Playbook
9
{
10
    /**
11
     * Run the playbook.
12
     *
13
     * @param  \Symfony\Component\Console\Input\InputInterface  $input
14
     * @param  \Symfony\Component\Console\Output\OutputInterface  $output
15
     * @return void
16
     */
17
    abstract public function run(InputInterface $input, OutputInterface $output): void;
18
19
    /**
20
     * Run the playbook x amount of times.
21
     *
22
     * @param int $times
23
     * @return \Scaling\Playbook\PlaybookDefenition
24
     */
25
    public static function times(int $times): PlaybookDefenition
26
    {
27
        return PlaybookDefenition::times(static::class, $times);
28
    }
29
30
    /**
31
     * Only run the playbook once.
32
     *
33
     * @return \Scaling\Playbook\PlaybookDefenition
34
     */
35
    public static function once(): PlaybookDefenition
36
    {
37
        return PlaybookDefenition::once(static::class);
38
    }
39
40
    /**
41
     * Let the playbook know that it has run.
42
     */
43
    public function finished(): void
44
    {
45
        //
46
    }
47
48
    /**
49
     * List of playbooks that have to run before this playbook.
50
     *
51
     * @return array
52
     */
53
    public function before(): array
54
    {
55
        return [];
56
    }
57
58
    /**
59
     * List of playbooks that have to run after this playbook.
60
     *
61
     * @return array
62
     */
63
    public function after(): array
64
    {
65
        return [];
66
    }
67
}
68