Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 11 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| RepeatBills | |
0.00% |
0 / 11 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| configure | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| execute | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Nextcloud - Cospend |
| 5 | * |
| 6 | * This file is licensed under the Affero General Public License version 3 or |
| 7 | * later. See the COPYING file. |
| 8 | * |
| 9 | * @author Julien Veyssier <eneiluj@posteo.net> |
| 10 | * @copyright Julien Veyssier 2019 |
| 11 | */ |
| 12 | |
| 13 | namespace OCA\Cospend\Command; |
| 14 | |
| 15 | use Symfony\Component\Console\Command\Command; |
| 16 | use Symfony\Component\Console\Input\InputInterface; |
| 17 | use Symfony\Component\Console\Output\OutputInterface; |
| 18 | |
| 19 | use OCA\Cospend\Service\ProjectService; |
| 20 | |
| 21 | class RepeatBills extends Command { |
| 22 | |
| 23 | /** |
| 24 | * @var ProjectService |
| 25 | */ |
| 26 | private $projectService; |
| 27 | |
| 28 | public function __construct(ProjectService $projectService) { |
| 29 | parent::__construct(); |
| 30 | $this->projectService = $projectService; |
| 31 | } |
| 32 | |
| 33 | protected function configure() { |
| 34 | $this->setName('cospend:repeat-bills') |
| 35 | ->setDescription('Repeat bills if necessary'); |
| 36 | } |
| 37 | |
| 38 | protected function execute(InputInterface $input, OutputInterface $output): int { |
| 39 | $repeated = $this->projectService->cronRepeatBills(); |
| 40 | foreach ($repeated as $r) { |
| 41 | $output->writeln( |
| 42 | '[Project "'.$r['project_name'].'"] Bill "'.$r['what']. |
| 43 | '" ('.$r['date_orig'].') repeated on ('.$r['date_repeat'].')' |
| 44 | ); |
| 45 | } |
| 46 | return 0; |
| 47 | } |
| 48 | } |