| 1 | <?php |
||
| 15 | abstract class AbstractNightlyTaskCommand extends Command |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var InputInterface |
||
| 19 | */ |
||
| 20 | protected $input; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var OutputInterface |
||
| 24 | */ |
||
| 25 | protected $output; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var LoggerInterface |
||
| 29 | */ |
||
| 30 | protected $logger; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @var TasksBag |
||
| 34 | */ |
||
| 35 | private $taskBag; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @param TasksBag $taskBag |
||
| 39 | * @param LoggerInterface $logger |
||
| 40 | */ |
||
| 41 | public function __construct(TasksBag $taskBag, LoggerInterface $logger) |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return array |
||
| 50 | */ |
||
| 51 | protected function getTasks() |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Initialize fields |
||
| 58 | * |
||
| 59 | * @param InputInterface $input |
||
| 60 | * @param OutputInterface $output |
||
| 61 | */ |
||
| 62 | protected function beforeExecute(InputInterface $input, OutputInterface $output) |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Fill task lists |
||
| 70 | */ |
||
| 71 | protected function fillTasks() |
||
| 80 | } |
||
| 81 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: