GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ExportEventStore   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 55
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A handle() 0 4 1
A getAllEvents() 0 7 1
1
<?php declare(strict_types=1);
2
3
namespace SmoothPhp\LaravelAdapter\Console;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Contracts\Config\Repository;
7
use Illuminate\Database\DatabaseManager;
8
9
/**
10
 * Class ExportEventStore
11
 * @package SmoothPhp\LaravelAdapter\Console
12
 * @author Simon Bennett <[email protected]>
13
 */
14
final class ExportEventStore extends Command
15
{
16
    /**
17
     * The name and signature of the console command.
18
     *
19
     * @var string
20
     */
21
    protected $signature = 'smoothphp:export';
22
23
    /**
24
     * The console command description.
25
     *
26
     * @var string
27
     */
28
    protected $description = 'Export EventStore';
29
30
    /** @var DatabaseManager */
31
    private $databaseManager;
32
33
    /** @var Repository */
34
    private $config;
35
36
    /**
37
     * ExportEventStore constructor.
38
     * @param DatabaseManager $databaseManager
39
     * @param Repository $config
40
     */
41
    public function __construct(DatabaseManager $databaseManager, Repository $config)
42
    {
43
        $this->databaseManager = $databaseManager;
44
        parent::__construct();
45
        $this->config = $config;
46
    }
47
48
    /**
49
     * Execute the console command.
50
     *
51
     * @return mixed
52
     */
53
    public function handle()
54
    {
55
        echo json_encode($this->getAllEvents());
56
    }
57
58
    /**
59
     * @return \stdClass
60
     */
61
    private function getAllEvents()
62
    {
63
        return $this->databaseManager
64
            ->connection($this->config->get('cqrses.eventstore_connection'))
65
            ->table($this->config->get('cqrses.eventstore_table'))
66
            ->get();
67
    }
68
}
69