Issues (193)

src/Console/Commands/SubscriptionsCharge.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace ByTIC\Payments\Console\Commands;
4
5
use ByTIC\Console\Command;
6
use ByTIC\Payments\Actions\Subscriptions\ChargeSubscription;
7
use ByTIC\Payments\Utility\PaymentsModels;
8
use Enqueue\Consumption\ChainExtension;
0 ignored issues
show
The type Enqueue\Consumption\ChainExtension was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Enqueue\Consumption\Extension\ExitStatusExtension;
0 ignored issues
show
The type Enqueue\Consumption\Extension\ExitStatusExtension was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
/**
14
 * Class SessionsCleanup
15
 * @package Nip\Payments\Console\Commands
16
 */
17
class SubscriptionsCharge extends Command
18
{
19
    public const NAME = 'payments:subscriptions:charge';
20
21
    protected function configure()
22
    {
23
        parent::configure();
24
        $this->setName(static::NAME);
25
        $this
26
            ->setAliases(['p:charge'])
27
            ->setDescription('Charge due subscriptions');
28
    }
29
30
    /**
31
     * @inheritDoc
32
     */
33
    protected function execute(InputInterface $input, OutputInterface $output): int
34
    {
35
        $repository = PaymentsModels::subscriptions();
36
37
        $repository->findChargeDue(10)->each(function ($subscription) {
38
            ChargeSubscription::handle($subscription);
39
        });
40
        return 0;
41
    }
42
}
43