Issues (1191)

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/StreamsServiceProvider.php (1 issue)

Labels
Severity

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 namespace Anomaly\Streams\Platform;
2
3
use Anomaly\Streams\Platform\Addon\AddonManager;
4
use Anomaly\Streams\Platform\Addon\Theme\Command\LoadCurrentTheme;
5
use Anomaly\Streams\Platform\Application\Command\ConfigureFileCacheStore;
6
use Anomaly\Streams\Platform\Application\Command\ConfigureTranslator;
7
use Anomaly\Streams\Platform\Application\Command\ConfigureUriValidator;
8
use Anomaly\Streams\Platform\Application\Command\InitializeApplication;
9
use Anomaly\Streams\Platform\Application\Command\LoadEnvironmentOverrides;
10
use Anomaly\Streams\Platform\Application\Command\LoadStreamsConfiguration;
11
use Anomaly\Streams\Platform\Application\Command\SetCoreConnection;
12
use Anomaly\Streams\Platform\Asset\Command\AddAssetNamespaces;
13
use Anomaly\Streams\Platform\Assignment\AssignmentModel;
14
use Anomaly\Streams\Platform\Assignment\AssignmentObserver;
15
use Anomaly\Streams\Platform\Entry\Command\AutoloadEntryModels;
16
use Anomaly\Streams\Platform\Entry\EntryModel;
17
use Anomaly\Streams\Platform\Entry\EntryObserver;
18
use Anomaly\Streams\Platform\Event\Booted;
19
use Anomaly\Streams\Platform\Event\Booting;
20
use Anomaly\Streams\Platform\Event\Ready;
21
use Anomaly\Streams\Platform\Field\FieldModel;
22
use Anomaly\Streams\Platform\Field\FieldObserver;
23
use Anomaly\Streams\Platform\Http\Command\ConfigureRequest;
24
use Anomaly\Streams\Platform\Image\Command\AddImageNamespaces;
25
use Anomaly\Streams\Platform\Model\EloquentModel;
26
use Anomaly\Streams\Platform\Model\EloquentObserver;
27
use Anomaly\Streams\Platform\Routing\Command\IncludeRoutes;
28
use Anomaly\Streams\Platform\Routing\UrlGenerator;
29
use Anomaly\Streams\Platform\Search\Command\ConfigureScout;
30
use Anomaly\Streams\Platform\Stream\StreamModel;
31
use Anomaly\Streams\Platform\Stream\StreamObserver;
32
use Anomaly\Streams\Platform\View\Cache\CacheAdapter;
33
use Anomaly\Streams\Platform\View\Cache\CacheKey;
34
use Anomaly\Streams\Platform\View\Cache\CacheStrategy;
35
use Anomaly\Streams\Platform\View\Command\AddViewNamespaces;
36
use Anomaly\Streams\Platform\View\Event\RegisteringTwigPlugins;
37
use Aptoma\Twig\Extension\MarkdownEngine\MichelfMarkdownEngine;
38
use Aptoma\Twig\Extension\MarkdownExtension;
39
use Asm89\Twig\CacheExtension\Extension;
40
use Illuminate\Console\Scheduling\Schedule;
41
use Illuminate\Contracts\Cache\Repository;
42
use Illuminate\Contracts\Events\Dispatcher;
43
use Illuminate\Foundation\Bus\DispatchesJobs;
44
use Illuminate\Pagination\Paginator;
45
use Illuminate\Routing\Redirector;
46
use Illuminate\Support\ServiceProvider;
47
48
/**
49
 * Class StreamsServiceProvider
50
 *
51
 * @link   http://pyrocms.com/
52
 * @author PyroCMS, Inc. <[email protected]>
53
 * @author Ryan Thompson <[email protected]>
54
 */
55
class StreamsServiceProvider extends ServiceProvider
56
{
57
58
    use DispatchesJobs;
59
60
    /**
61
     * The scheduled commands.
62
     *
63
     * @var array
64
     */
65
    protected $schedule = [];
66
67
    /**
68
     * The providers to register.
69
     *
70
     * @var array
71
     */
72
    protected $providers = [
73
        'Anomaly\Streams\Platform\StreamsConsoleProvider',
74
        'Anomaly\Streams\Platform\StreamsEventProvider',
75
    ];
76
77
    /**
78
     * The plugins to register.
79
     *
80
     * @var array
81
     */
82
    protected $plugins = [
83
        'TwigBridge\Extension\Laravel\Form',
84
        'TwigBridge\Extension\Laravel\Html',
85
        'Anomaly\Streams\Platform\StreamsPlugin',
86
        'Phive\Twig\Extensions\Deferred\DeferredExtension',
87
    ];
88
89
    /**
90
     * The commands to register.
91
     *
92
     * @var array
93
     */
94
    protected $commands = [
95
        'Anomaly\Streams\Platform\Asset\Console\Clear',
96
        'Anomaly\Streams\Platform\Stream\Console\Make',
97
        'Anomaly\Streams\Platform\Stream\Console\Compile',
98
        'Anomaly\Streams\Platform\Stream\Console\Refresh',
99
        'Anomaly\Streams\Platform\Stream\Console\Cleanup',
100
        'Anomaly\Streams\Platform\Stream\Console\Destroy',
101
        'Anomaly\Streams\Platform\Addon\Console\MakeAddon',
102
        'Anomaly\Streams\Platform\Addon\Console\AddonInstall',
103
        'Anomaly\Streams\Platform\Addon\Console\AddonUninstall',
104
        'Anomaly\Streams\Platform\Addon\Console\AddonReinstall',
105
        'Anomaly\Streams\Platform\Installer\Console\Install',
106
        'Anomaly\Streams\Platform\Application\Console\EnvSet',
107
        'Anomaly\Streams\Platform\Addon\Console\AddonPublish',
108
        'Anomaly\Streams\Platform\Addon\Module\Console\Install',
109
        'Anomaly\Streams\Platform\Addon\Module\Console\Uninstall',
110
        'Anomaly\Streams\Platform\Addon\Module\Console\Reinstall',
111
        'Anomaly\Streams\Platform\Application\Console\AppPublish',
112
        'Anomaly\Streams\Platform\Addon\Extension\Console\Install',
113
        'Anomaly\Streams\Platform\Addon\Extension\Console\Uninstall',
114
        'Anomaly\Streams\Platform\Addon\Extension\Console\Reinstall',
115
        'Anomaly\Streams\Platform\Application\Console\StreamsPublish',
116
    ];
117
118
    /**
119
     * The class bindings.
120
     *
121
     * @var array
122
     */
123
    protected $bindings = [
124
        'Illuminate\Contracts\Debug\ExceptionHandler'                                    => 'Anomaly\Streams\Platform\Exception\ExceptionHandler',
125
        'Illuminate\Routing\UrlGenerator'                                                => 'Anomaly\Streams\Platform\Routing\UrlGenerator',
126
        'Illuminate\Contracts\Routing\UrlGenerator'                                      => 'Anomaly\Streams\Platform\Routing\UrlGenerator',
127
        'GrahamCampbell\Exceptions\Displayers\ViewDisplayer'                             => 'Anomaly\Streams\Platform\Exception\Displayer\ViewDisplayer',
128
        'Anomaly\Streams\Platform\Entry\EntryModel'                                      => 'Anomaly\Streams\Platform\Entry\EntryModel',
129
        'Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface'               => 'Anomaly\Streams\Platform\Entry\EntryRepository',
130
        'Anomaly\Streams\Platform\Field\FieldModel'                                      => 'Anomaly\Streams\Platform\Field\FieldModel',
131
        'Anomaly\Streams\Platform\Field\Contract\FieldRepositoryInterface'               => 'Anomaly\Streams\Platform\Field\FieldRepository',
132
        'Anomaly\Streams\Platform\Stream\StreamModel'                                    => 'Anomaly\Streams\Platform\Stream\StreamModel',
133
        'Anomaly\Streams\Platform\Stream\Contract\StreamRepositoryInterface'             => 'Anomaly\Streams\Platform\Stream\StreamRepository',
134
        'Anomaly\Streams\Platform\Model\Contract\EloquentRepositoryInterface'            => 'Anomaly\Streams\Platform\Model\EloquentRepository',
135
        'Anomaly\Streams\Platform\Assignment\AssignmentModel'                            => 'Anomaly\Streams\Platform\Assignment\AssignmentModel',
136
        'Anomaly\Streams\Platform\Assignment\Contract\AssignmentRepositoryInterface'     => 'Anomaly\Streams\Platform\Assignment\AssignmentRepository',
137
        'Anomaly\Streams\Platform\Addon\Module\ModuleModel'                              => 'Anomaly\Streams\Platform\Addon\Module\ModuleModel',
138
        'Anomaly\Streams\Platform\Addon\Module\Contract\ModuleRepositoryInterface'       => 'Anomaly\Streams\Platform\Addon\Module\ModuleRepository',
139
        'Anomaly\Streams\Platform\Addon\Extension\ExtensionModel'                        => 'Anomaly\Streams\Platform\Addon\Extension\ExtensionModel',
140
        'Anomaly\Streams\Platform\Addon\Extension\Contract\ExtensionRepositoryInterface' => 'Anomaly\Streams\Platform\Addon\Extension\ExtensionRepository',
141
        'addon.collection'                                                               => 'Anomaly\Streams\Platform\Addon\AddonCollection',
142
        'module.collection'                                                              => 'Anomaly\Streams\Platform\Addon\Module\ModuleCollection',
143
        'extension.collection'                                                           => 'Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection',
144
        'field_type.collection'                                                          => 'Anomaly\Streams\Platform\Addon\FieldType\FieldTypeCollection',
145
        'plugin.collection'                                                              => 'Anomaly\Streams\Platform\Addon\Plugin\PluginCollection',
146
        'theme.collection'                                                               => 'Anomaly\Streams\Platform\Addon\Theme\ThemeCollection',
147
    ];
148
149
    /**
150
     * The singleton bindings.
151
     *
152
     * @var array
153
     */
154
    protected $singletons = [
155
        'Illuminate\Contracts\Routing\UrlGenerator'                                          => 'Anomaly\Streams\Platform\Routing\UrlGenerator',
156
        'Intervention\Image\ImageManager'                                                    => 'image',
157
        'League\Flysystem\MountManager'                                                      => 'League\Flysystem\MountManager',
158
        'Illuminate\Console\Scheduling\Schedule'                                             => 'Illuminate\Console\Scheduling\Schedule',
159
        'Anomaly\Streams\Platform\Application\Application'                                   => 'Anomaly\Streams\Platform\Application\Application',
160
        'Anomaly\Streams\Platform\Addon\AddonLoader'                                         => 'Anomaly\Streams\Platform\Addon\AddonLoader',
161
        'Anomaly\Streams\Platform\Addon\AddonBinder'                                         => 'Anomaly\Streams\Platform\Addon\AddonBinder',
162
        'Anomaly\Streams\Platform\Addon\AddonManager'                                        => 'Anomaly\Streams\Platform\Addon\AddonManager',
163
        'Anomaly\Streams\Platform\Addon\AddonProvider'                                       => 'Anomaly\Streams\Platform\Addon\AddonProvider',
164
        'Anomaly\Streams\Platform\Addon\AddonCollection'                                     => 'Anomaly\Streams\Platform\Addon\AddonCollection',
165
        'Anomaly\Streams\Platform\Message\MessageBag'                                        => 'Anomaly\Streams\Platform\Message\MessageBag',
166
        'Anomaly\Streams\Platform\Stream\StreamStore'                                        => 'Anomaly\Streams\Platform\Stream\StreamStore',
167
        'Anomaly\Streams\Platform\Support\Configurator'                                      => 'Anomaly\Streams\Platform\Support\Configurator',
168
        'Anomaly\Streams\Platform\Support\Authorizer'                                        => 'Anomaly\Streams\Platform\Support\Authorizer',
169
        'Anomaly\Streams\Platform\Support\Evaluator'                                         => 'Anomaly\Streams\Platform\Support\Evaluator',
170
        'Anomaly\Streams\Platform\Support\Currency'                                          => 'Anomaly\Streams\Platform\Support\Currency',
171
        'Anomaly\Streams\Platform\Support\Parser'                                            => 'Anomaly\Streams\Platform\Support\Parser',
172
        'Anomaly\Streams\Platform\Support\Hydrator'                                          => 'Anomaly\Streams\Platform\Support\Hydrator',
173
        'Anomaly\Streams\Platform\Support\Resolver'                                          => 'Anomaly\Streams\Platform\Support\Resolver',
174
        'Anomaly\Streams\Platform\Support\Translator'                                        => 'Anomaly\Streams\Platform\Support\Translator',
175
        'Anomaly\Streams\Platform\Asset\Asset'                                               => 'Anomaly\Streams\Platform\Asset\Asset',
176
        'Anomaly\Streams\Platform\Asset\AssetPaths'                                          => 'Anomaly\Streams\Platform\Asset\AssetPaths',
177
        'Anomaly\Streams\Platform\Asset\AssetParser'                                         => 'Anomaly\Streams\Platform\Asset\AssetParser',
178
        'Anomaly\Streams\Platform\Image\Image'                                               => 'Anomaly\Streams\Platform\Image\Image',
179
        'Anomaly\Streams\Platform\Image\ImagePaths'                                          => 'Anomaly\Streams\Platform\Image\ImagePaths',
180
        'Anomaly\Streams\Platform\Image\ImageMacros'                                         => 'Anomaly\Streams\Platform\Image\ImageMacros',
181
        'Anomaly\Streams\Platform\Ui\Table\Component\View\ViewRegistry'                      => 'Anomaly\Streams\Platform\Ui\Table\Component\View\ViewRegistry',
182
        'Anomaly\Streams\Platform\Ui\Table\Component\Filter\FilterRegistry'                  => 'Anomaly\Streams\Platform\Ui\Table\Component\Filter\FilterRegistry',
183
        'Anomaly\Streams\Platform\Ui\Breadcrumb\BreadcrumbCollection'                        => 'Anomaly\Streams\Platform\Ui\Breadcrumb\BreadcrumbCollection',
184
        'Anomaly\Streams\Platform\Ui\Icon\IconRegistry'                                      => 'Anomaly\Streams\Platform\Ui\Icon\IconRegistry',
185
        'Anomaly\Streams\Platform\Ui\Button\ButtonRegistry'                                  => 'Anomaly\Streams\Platform\Ui\Button\ButtonRegistry',
186
        'Anomaly\Streams\Platform\Ui\ControlPanel\Component\Section\SectionCollection'       => 'Anomaly\Streams\Platform\Ui\ControlPanel\Component\Section\SectionCollection',
187
        'Anomaly\Streams\Platform\Ui\ControlPanel\Component\Navigation\NavigationCollection' => 'Anomaly\Streams\Platform\Ui\ControlPanel\Component\Navigation\NavigationCollection',
188
        'Anomaly\Streams\Platform\Http\Middleware\MiddlewareCollection'                      => 'Anomaly\Streams\Platform\Http\Middleware\MiddlewareCollection',
189
        'Anomaly\Streams\Platform\Stream\StreamModel'                                        => 'Anomaly\Streams\Platform\Stream\StreamModel',
190
        'Anomaly\Streams\Platform\Addon\Module\ModuleCollection'                             => 'Anomaly\Streams\Platform\Addon\Module\ModuleCollection',
191
        'Anomaly\Streams\Platform\Addon\Module\Listener\PutModuleInCollection'               => 'Anomaly\Streams\Platform\Addon\Module\Listener\PutModuleInCollection',
192
        'Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection'                       => 'Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection',
193
        'Anomaly\Streams\Platform\Addon\Extension\Listener\PutExtensionInCollection'         => 'Anomaly\Streams\Platform\Addon\Extension\Listener\PutExtensionInCollection',
194
        'Anomaly\Streams\Platform\Addon\FieldType\FieldTypeModifier'                         => 'Anomaly\Streams\Platform\Addon\FieldType\FieldTypeModifier',
195
        'Anomaly\Streams\Platform\Addon\FieldType\FieldTypeCollection'                       => 'Anomaly\Streams\Platform\Addon\FieldType\FieldTypeCollection',
196
        'Anomaly\Streams\Platform\Addon\FieldType\Listener\PutFieldTypeInCollection'         => 'Anomaly\Streams\Platform\Addon\FieldType\Listener\PutFieldTypeInCollection',
197
        'Anomaly\Streams\Platform\Addon\Plugin\PluginCollection'                             => 'Anomaly\Streams\Platform\Addon\Plugin\PluginCollection',
198
        'Anomaly\Streams\Platform\Addon\Plugin\Listener\PutPluginInCollection'               => 'Anomaly\Streams\Platform\Addon\Plugin\Listener\PutPluginInCollection',
199
        'Anomaly\Streams\Platform\Addon\Theme\ThemeCollection'                               => 'Anomaly\Streams\Platform\Addon\Theme\ThemeCollection',
200
        'Anomaly\Streams\Platform\Addon\Theme\Listener\PutThemeInCollection'                 => 'Anomaly\Streams\Platform\Addon\Theme\Listener\PutThemeInCollection',
201
        'Anomaly\Streams\Platform\View\ViewComposer'                                         => 'Anomaly\Streams\Platform\View\ViewComposer',
202
        'Anomaly\Streams\Platform\View\ViewTemplate'                                         => 'Anomaly\Streams\Platform\View\ViewTemplate',
203
        'Anomaly\Streams\Platform\View\ViewOverrides'                                        => 'Anomaly\Streams\Platform\View\ViewOverrides',
204
        'Anomaly\Streams\Platform\View\ViewMobileOverrides'                                  => 'Anomaly\Streams\Platform\View\ViewMobileOverrides',
205
        'Anomaly\Streams\Platform\View\Listener\LoadTemplateData'                            => 'Anomaly\Streams\Platform\View\Listener\LoadTemplateData',
206
        'Anomaly\Streams\Platform\View\Listener\DecorateData'                                => 'Anomaly\Streams\Platform\View\Listener\DecorateData',
207
        'Anomaly\Streams\Platform\Support\Template'                                          => 'Anomaly\Streams\Platform\Support\Template',
208
        'Anomaly\Streams\Platform\Support\Purifier'                                          => 'Anomaly\Streams\Platform\Support\Purifier',
209
        'Anomaly\Streams\Platform\Assignment\AssignmentRouter'                               => 'Anomaly\Streams\Platform\Assignment\AssignmentRouter',
210
        'Anomaly\Streams\Platform\Field\FieldRouter'                                         => 'Anomaly\Streams\Platform\Field\FieldRouter',
211
    ];
212
213
    /**
214
     * Boot the service provider.
215
     */
216
    public function boot(Dispatcher $events)
217
    {
218
        $events->fire(new Booting());
219
220
        // Next take care of core utilities.
221
        $this->dispatch(new SetCoreConnection());
222
        $this->dispatch(new ConfigureUriValidator());
223
        $this->dispatch(new InitializeApplication());
224
225
        // Load application specific .env file.
226
        $this->dispatch(new LoadEnvironmentOverrides());
227
228
        // Setup and preparing utilities.
229
        $this->dispatch(new LoadStreamsConfiguration());
230
        $this->dispatch(new ConfigureFileCacheStore());
231
        $this->dispatch(new ConfigureTranslator());
232
        $this->dispatch(new AutoloadEntryModels());
233
        $this->dispatch(new AddAssetNamespaces());
234
        $this->dispatch(new AddImageNamespaces());
235
        $this->dispatch(new ConfigureRequest());
236
        $this->dispatch(new ConfigureScout());
237
238
        // Observe our base models.
239
        EntryModel::observe(EntryObserver::class);
240
        FieldModel::observe(FieldObserver::class);
241
        StreamModel::observe(StreamObserver::class);
242
        EloquentModel::observe(EloquentObserver::class);
243
        AssignmentModel::observe(AssignmentObserver::class);
244
245
        $this->app->booted(
246
            function () use ($events) {
247
                $events->fire(new Booted());
248
249
                /* @var AddonManager $manager */
250
                $manager = $this->app->make('Anomaly\Streams\Platform\Addon\AddonManager');
251
252
                /* @var Dispatcher $events */
253
                $events = $this->app->make('Illuminate\Contracts\Events\Dispatcher');
0 ignored issues
show
Consider using a different name than the imported variable $events, or did you forget to import by reference?

It seems like you are assigning to a variable which was imported through a use statement which was not imported by reference.

For clarity, we suggest to use a different name or import by reference depending on whether you would like to have the change visibile in outer-scope.

Change not visible in outer-scope

$x = 1;
$callable = function() use ($x) {
    $x = 2; // Not visible in outer scope. If you would like this, how
            // about using a different variable name than $x?
};

$callable();
var_dump($x); // integer(1)

Change visible in outer-scope

$x = 1;
$callable = function() use (&$x) {
    $x = 2;
};

$callable();
var_dump($x); // integer(2)
Loading history...
254
255
                $events->listen(
256
                    'Anomaly\Streams\Platform\View\Event\RegisteringTwigPlugins',
257
                    function (RegisteringTwigPlugins $event) {
258
                        $twig = $event->getTwig();
259
260
                        foreach ($this->plugins as $plugin) {
261
                            if (!$twig->hasExtension($plugin)) {
262
                                $twig->addExtension($this->app->make($plugin));
263
                            }
264
                        }
265
266
                        if (!$twig->hasExtension('markdown')) {
267
                            $twig->addExtension(new MarkdownExtension(new MichelfMarkdownEngine()));
268
                        }
269
270
                        $twig->addExtension(
271
                            new Extension(
272
                                new CacheStrategy(
273
                                    new CacheAdapter($this->app->make(Repository::class)), new CacheKey()
274
                                )
275
                            )
276
                        );
277
                    }
278
                );
279
280
                $manager->register();
281
282
                $this->dispatch(new LoadCurrentTheme());
283
                $this->dispatch(new AddViewNamespaces());
284
285
                /*
286
                 * Do this after addons are registered
287
                 * so that they can override named routes.
288
                 */
289
                $this->dispatch(new IncludeRoutes());
290
291
                $events->fire(new Ready());
292
            }
293
        );
294
    }
295
296
    /**
297
     * Register the service provider.
298
     *
299
     * @return void
300
     */
301
    public function register()
302
    {
303
        /*
304
         * Register all third party packages first.
305
         */
306
        $this->app->register(\TwigBridge\ServiceProvider::class);
307
        $this->app->register(\Laravel\Scout\ScoutServiceProvider::class);
308
        $this->app->register(\Collective\Html\HtmlServiceProvider::class);
309
        $this->app->register(\Intervention\Image\ImageServiceProvider::class);
310
        $this->app->register(\TeamTNT\Scout\TNTSearchScoutServiceProvider::class);
311
        $this->app->register(\GrahamCampbell\Exceptions\ExceptionsServiceProvider::class);
312
313
        if (env('APP_DEBUG')) {
314
            $this->app->register(\Barryvdh\Debugbar\ServiceProvider::class);
315
        }
316
317
        // Register bindings.
318
        foreach (array_merge($this->bindings, config('streams.bindings', [])) as $abstract => $concrete) {
319
            $this->app->bind($abstract, $concrete);
320
        }
321
322
        // Register singletons.
323
        foreach (array_merge($this->singletons, config('streams.singletons', [])) as $abstract => $concrete) {
324
            $this->app->singleton($abstract, $concrete);
325
        }
326
327
        // Register streams other providers.
328
        foreach (array_merge($this->providers, config('streams.providers', [])) as $provider) {
329
            $this->app->register($provider);
330
        }
331
332
        // Register commands.
333
        $this->commands(array_merge($this->commands, config('streams.commands', [])));
334
335
        /* @var Schedule $schedule */
336
        $schedule = $this->app->make(Schedule::class);
337
338
        foreach (array_merge($this->schedule, config('streams.schedule', [])) as $frequency => $commands) {
339
            foreach (array_filter($commands) as $command) {
340
                if (str_contains($frequency, ' ')) {
341
                    $schedule->command($command)->cron($frequency);
342
                } else {
343
                    $schedule->command($command)->{camel_case($frequency)}();
344
                }
345
            }
346
        }
347
348
        /*
349
         * Change the default language path so
350
         * that there MUST be a prefix hint.
351
         */
352
        $this->app->singleton(
353
            'path.lang',
354
            function () {
355
                return realpath(__DIR__ . '/../resources/lang');
356
            }
357
        );
358
359
        /*
360
         * Register the path to the streams platform.
361
         * This is handy for helping load other streams things.
362
         */
363
        $this->app->instance(
364
            'streams.path',
365
            $this->app->make('path.base') . '/vendor/anomaly/streams-platform'
366
        );
367
368
        /*
369
         * If we don't have an .env file we need to head
370
         * to the installer (unless that's where we're at).
371
         */
372
        if (!env('INSTALLED') && $this->app->make('request')->segment(1) !== 'installer') {
373
            $this->app->make('router')->any(
374
                '{url?}',
375
                function (Redirector $redirector) {
376
                    return $redirector->to('installer');
377
                }
378
            )->where(['url' => '(.*)']);
379
380
            return;
381
        }
382
383
        /**
384
         * Correct path for Paginator.
385
         */
386
        Paginator::currentPathResolver(
387
            function () {
388
                return $this->app->make(UrlGenerator::class)->current();
389
            }
390
        );
391
392
        /*
393
         * Register system routes.
394
         */
395
        $this->app->make('router')->post(
396
            'form/handle/{key}',
397
            'Anomaly\Streams\Platform\Http\Controller\FormController@handle'
398
        );
399
400
        $this->app->make('router')->get(
401
            'entry/handle/restore/{addon}/{namespace}/{stream}/{id}',
402
            'Anomaly\Streams\Platform\Http\Controller\EntryController@restore'
403
        );
404
405
        $this->app->make('router')->get(
406
            'entry/handle/export/{addon}/{namespace}/{stream}',
407
            'Anomaly\Streams\Platform\Http\Controller\EntryController@export'
408
        );
409
    }
410
}
411