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.

Issues (25)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/MissiveServiceProvider.php (5 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace LBHurtado\Missive;
4
5
use Opis\Events\EventDispatcher;
6
use LBHurtado\Missive\Routing\Router;
7
use Illuminate\Support\ServiceProvider;
8
use LBHurtado\Missive\Container\LaravelContainer;
9
use LBHurtado\Missive\Models\{SMS, Contact, Relay, Airtime, Topup};
10
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
11
use LBHurtado\Missive\Repositories\{SMSRepository, SMSRepositoryEloquent};
12
use LBHurtado\Missive\Repositories\{RelayRepository, RelayRepositoryEloquent};
13
use LBHurtado\Missive\Repositories\{ContactRepository, ContactRepositoryEloquent};
14
use LBHurtado\Missive\Repositories\{AirtimeRepository, AirtimeRepositoryEloquent};
15
use LBHurtado\Missive\Observers\{SMSObserver, ContactObserver, RelayObserver, AirtimeObserver,
16
    AirtimeContactObserver};
17
18
class MissiveServiceProvider extends ServiceProvider
19
{
20
    const APPLICATION_ROUTE_SMS = 'routes/sms.php';
21
    const APPLICATION_AIRTIME_SEEDER = 'seeds/AirtimeSeeder.php';
22
23
    const PACKAGE_ROUTE_API = __DIR__.'/../routes/api.php';
24
    const PACKAGE_ROUTE_SMS = __DIR__.'/../routes/sms.php';
25
    const PACKAGE_FACTORY_DIR = __DIR__ . '/../database/factories';
26
    const PACKAGE_MISSIVE_CONFIG = __DIR__.'/../config/config.php';
27
    const PACKAGE_AIRTIME_SEEDER = __DIR__.'/../database/seeds/AirtimeSeeder.php';
28
    const PACKAGE_TACTICIAN_FIELDS_CONFIG = __DIR__ . '/../config/tactician.fields.php';
29
    const PACKAGE_SMSS_TABLE_MIGRATION_STUB = __DIR__.'/../database/migrations/create_s_m_s_s_table.php.stub';
30
    const PACKAGE_RELAYS_TABLE_MIGRATION_STUB = __DIR__.'/../database/migrations/create_relays_table.php.stub';
31
    const PACKAGE_CONTACTS_TABLE_MIGRATION_STUB = __DIR__.'/../database/migrations/create_contacts_table.php.stub';
32
    const PACKAGE_AIRTIMES_TABLE_MIGRATION_STUB = __DIR__.'/../database/migrations/create_airtimes_table.php.stub';
33
    const PACKAGE_TOPUPS_TABLE_MIGRATION_STUB = __DIR__.'/../database/migrations/create_topups_table.php.stub';
34
35
    public function boot()
36
    {
37
        $this->observeModels();
38
        $this->publishConfigs();
39
        $this->publishMigrations();
40
        $this->publishSeeds();
41
        $this->publishRoutes();
42
        $this->mapFactories();
43
        $this->mapRoutes();
44
    }
45
46
    public function register()
47
    {
48
        $this->registerConfigs();
49
        $this->registerRepositories();
50
        $this->registerModels();
51
        $this->registerPivots();
52
        $this->registerFacades();
53
        $this->registerClasses();
54
    }
55
56
    protected function observeModels()
57
    {
58
        app('missive.sms')::observe(SMSObserver::class);
59
        app('missive.relay')::observe(RelayObserver::class);
60
        app('missive.contact')::observe(ContactObserver::class);
61
        app('missive.airtime')::observe(AirtimeObserver::class);
62
        app('missive.airtime_contact')::observe(AirtimeContactObserver::class);
63
        //TODO: create topup observer
64
    }
65
66
    protected function publishConfigs()
67
    {
68
        if ($this->app->runningInConsole()) {
69
            $this->publishes([
70
                self::PACKAGE_MISSIVE_CONFIG => config_path('missive.php'),
71
            ], 'missive-config');
72
        }
73
    }
74
75
    protected function publishMigrations()
76
    {
77
        if ($this->app->runningInConsole()) {
78 View Code Duplication
            if (! class_exists(CreateRelaysTable::class)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
79
                $this->publishes([
80
                    self::PACKAGE_RELAYS_TABLE_MIGRATION_STUB => database_path('migrations/'.date('Y_m_d_His', time()).'_create_relays_table.php'),
81
                ], 'missive-migrations');
82
            }
83 View Code Duplication
            if (! class_exists(CreateSMSsTable::class)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
84
                $this->publishes([
85
                    self::PACKAGE_SMSS_TABLE_MIGRATION_STUB => database_path('migrations/'.date('Y_m_d_His', time()).'_create_s_m_s_s_table.php'),
86
                ], 'missive-migrations');
87
            }
88 View Code Duplication
            if (! class_exists(CreateContactsTable::class)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
89
                $this->publishes([
90
                    self::PACKAGE_CONTACTS_TABLE_MIGRATION_STUB => database_path('migrations/'.date('Y_m_d_His', time()).'_create_contacts_table.php'),
91
                ], 'missive-migrations');
92
            }
93 View Code Duplication
            if (! class_exists(CreateAirtimesTable::class)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
94
                $this->publishes([
95
                    self::PACKAGE_AIRTIMES_TABLE_MIGRATION_STUB => database_path('migrations/'.date('Y_m_d_His', time()+60).'_create_airtimes_table.php'),
96
                ], 'missive-migrations');
97
            }
98 View Code Duplication
            if (! class_exists(CreateTopupsTable::class)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
99
                $this->publishes([
100
                    self::PACKAGE_TOPUPS_TABLE_MIGRATION_STUB => database_path('migrations/'.date('Y_m_d_His', time()+60).'_create_topups_table.php'),
101
                ], 'missive-migrations');
102
            }
103
        }
104
    }
105
106
    protected function publishSeeds()
107
    {
108
        if ($this->app->runningInConsole()) {
109
            $this->publishes([
110
                self::PACKAGE_AIRTIME_SEEDER => database_path(self::APPLICATION_AIRTIME_SEEDER),
111
            ], 'missive-seeds');
112
        }
113
    }
114
115
    protected function publishRoutes()
116
    {
117
        if ($this->app->runningInConsole()) {
118
            $this->publishes([
119
                self::PACKAGE_ROUTE_SMS => base_path(self::APPLICATION_ROUTE_SMS),
120
            ], 'missive-routes');
121
        }
122
    }
123
124
    protected function registerConfigs()
125
    {
126
        $this->mergeConfigFrom(self::PACKAGE_MISSIVE_CONFIG, 'missive');
127
        $this->mergeConfigFrom(self::PACKAGE_TACTICIAN_FIELDS_CONFIG, 'tactician.fields');
128
    }
129
130
    protected function registerRepositories()
131
    {
132
        $this->app->bind(SMSRepository::class, SMSRepositoryEloquent::class);
133
        $this->app->bind(RelayRepository::class, RelayRepositoryEloquent::class);
134
        $this->app->bind(ContactRepository::class, ContactRepositoryEloquent::class);
135
        $this->app->bind(AirtimeRepository::class, AirtimeRepositoryEloquent::class);
136
        //TODO: create topup repository
137
    }
138
139
    protected function registerModels()
140
    {
141
        $this->app->singleton('missive.sms', function () {
142
            $class = config('missive.classes.models.sms', SMS::class);
143
            return new $class;
144
        });
145
        $this->app->singleton('missive.relay', function () {
146
            $class = config('missive.classes.models.relay', Relay::class);
147
            return new $class;
148
        });
149
        $this->app->singleton('missive.contact', function () {
150
            $class = config('missive.classes.models.contact', Contact::class);
151
            return new $class;
152
        });
153
        $this->app->singleton('missive.airtime', function () {
154
            $class = config('missive.classes.models.airtime', Airtime::class);
155
            return new $class;
156
        });
157
        $this->app->singleton('missive.topup', function () {
158
            $class = config('missive.classes.models.topup', Topup::class);
159
            return new $class;
160
        });
161
    }
162
163
    protected function registerPivots()
164
    {
165
        $this->app->singleton('missive.airtime_contact', function () {
166
            $class = config('missive.classes.pivots.airtime_contact', Airtime::class);
167
            return new $class;
168
        });
169
    }
170
171
    protected function registerFacades()
172
    {
173
        $this->app->singleton('missive', function () {
174
            return new Missive(app(AirtimeRepository::class));
175
        });
176
        $this->app->singleton('missive:router', function () {
177
            $router = new Router(app(Missive::class));
178
            $router->setContainer(new LaravelContainer($this->app));
179
180
            return $router;
181
        });
182
    }
183
184
    protected function registerClasses()
185
    {
186
        $this->app->singleton(Router::class);
187
        $this->app->singleton(EventDispatcher::class);
188
        $this->app->singleton(Missive::class, function ($app) {
189
            return $app->make('missive');
190
        });
191
        $this->app->singleton(Router::class, function ($app) {
192
            return $app->make('missive:router');
193
        });
194
    }
195
196
    public function mapFactories()
197
    {
198
        $this->app->make(EloquentFactory::class)->load(self::PACKAGE_FACTORY_DIR);
199
    }
200
201
    public function mapRoutes()
202
    {
203
        $this->loadRoutesFrom(self::PACKAGE_ROUTE_API);
204
        $file = base_path(self::APPLICATION_ROUTE_SMS);
205
        if (file_exists($file)) include_once $file;
206
    }
207
}
208