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.
Completed
Push — master ( 87aa82...931556 )
by Simon
02:00
created

BuildLaravelEventStore::handle()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 10
rs 9.4286
cc 3
eloc 6
nc 2
nop 0
1
<?php
2
namespace SmoothPhp\LaravelAdapter\Console;
3
4
use Illuminate\Console\Command;
5
use Illuminate\Contracts\Config\Repository;
6
use Illuminate\Database\Schema\Blueprint;
7
use Schema;
8
9
/**
10
 * Class BuildLaravelEventStore
11
 * @package SmoothPhp\LaravelAdapter\Console
12
 * @author Simon Bennett <[email protected]>
13
 */
14
final class BuildLaravelEventStore extends Command
15
{
16
    /**
17
     * The name and signature of the console command.
18
     *
19
     * @var string
20
     */
21
    protected $signature = 'smoothphp:buildeventstore {--force=false}';
22
23
    /**
24
     * The console command description.
25
     *
26
     * @var string
27
     */
28
    protected $description = 'Build the Laravel Event Store';
29
30
    /** @var Repository */
31
    private $config;
32
33
    /**
34
     * BuildLaravelEventStore constructor.
35
     * @param Repository $config
36
     */
37
    public function __construct(Repository $config)
38
    {
39
        parent::__construct();
40
        $this->config = $config;
41
    }
42
43
    /**
44
     * Execute the console command.
45
     *
46
     * @return mixed
47
     */
48
    public function handle()
49
    {
50
        if ($this->option('force') == 'true' || $this->confirm("Are you sure you want to make a new table '{$this->config->get('cqrses.eventstore_table')}'"
51
                                                               . " on connection '{$this->config->get('cqrses.eventstore_connection')}'"
52
                                                               . " Do you wish to continue?")
53
        ) {
54
            return $this->buildEventStoreTable();
55
        }
56
        $this->line("Stopping");
57
    }
58
59
    /**
60
     * Build eventstore table
61
     */
62
    protected function buildEventStoreTable()
63
    {
64
        Schema::connection($this->config->get('cqrses.eventstore_connection'))
65
              ->create($this->config->get('cqrses.eventstore_table'),
66
                  function (Blueprint $table) {
67
                      $table->increments('id');
68
                      $table->string('uuid', 56);
69
                      $table->integer('playhead')->unsigned();
70
                      $table->text('metadata');
71
                      $table->text('payload');
72
                      $table->string('recorded_on', 32);
73
                      $table->text('type');
74
                      $table->unique(['uuid', 'playhead']);
75
                  });
76
    }
77
}