3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Fundbay\Deals; use Illuminate\Support\ServiceProvider; class DealServiceProvider extends ServiceProvider { /** * @return void */ public function boot() { $this->bootObservers(); $this->bootViewComposers(); $this->registerPayloadEvents(); } /** * @return void */ public function registerPayloadEvents() { $this->app['events']->listen('dashboard.payload', 'Fundbay\Deals\Services\PayloadBuilder'); } /** * @return void */ protected function bootObservers() { Models\EloquentDealModel::observe(new Observers\DealStatusObserver($this->app['Fundbay\Authentication\Services\PermissionService'])); Models\EloquentAssetImageModel::observe(new Observers\ImageResizeObserver($this->app['queue'])); Models\EloquentMessageModel::observe($this->app->make('Fundbay\Deals\Observers\MessageMailerObserver')); Models\EloquentEvidenceRequestModel::observe($this->app->make('Fundbay\Deals\Observers\EvidenceRequestMailerObserver')); Models\EloquentOfferModel::observe($this->app->make('Fundbay\Deals\Observers\OfferMailerObserver')); Models\EloquentOfferModel::observe(new Observers\OfferStatusObserver($this->app['Fundbay\Authentication\Services\PermissionService'])); } /** * @return void */ protected function bootViewComposers() { /** @var \Illuminate\View\Factory $view */ $view = $this->app['view']; $view->composer('deals.partials.show', 'Fundbay\Deals\Composers\DealIndexShowComposer'); $view->composer('emails.deals.deal', 'Fundbay\Deals\Composers\DealIndexShowComposer'); $view->composer('deals.show', 'Fundbay\Deals\Composers\DealShowComposer'); $view->composer('deals.partials.details', 'Fundbay\Deals\Composers\DealShowDetailsComposer'); $view->composer('offers.partials.embed-item', 'Fundbay\Deals\Composers\OfferEmbedItemComposer'); } /** * Register the service provider. * * @return void */ public function register() { $this->registerRepositories(); $this->registerFormBuilders(); $this->registerServices(); $this->registerCommands(); } /** * @return void */ protected function registerRepositories() { $this->app->bind('Fundbay\Deals\Repositories\DealRepositoryInterface', function() { return new Repositories\EloquentDealRepository(new Models\EloquentDealModel, new Validators\DealValidator($this->app['validator'])); }); $this->app->bind('Fundbay\Deals\Repositories\ContactRepositoryInterface', function() { return new Repositories\EloquentContactRepository(new Models\EloquentContactModel, new Validators\ContactValidator($this->app['validator'])); }); $this->app->bind('Fundbay\Deals\Repositories\AssetRepositoryInterface', function() { return new Repositories\EloquentAssetRepository(new Models\EloquentAssetModel, new Validators\AssetValidator($this->app['validator'])); }); $this->app->bind('Fundbay\Deals\Repositories\LoanRepositoryInterface', function() { return new Repositories\EloquentLoanRepository(new Models\EloquentLoanModel, new Validators\LoanValidator($this->app['validator'])); }); $this->app->bind('Fundbay\Deals\Repositories\LoanPurposeRepositoryInterface', function() { return new Repositories\EloquentLoanPurposeRepository(new Models\EloquentLoanPurposeModel, new Validators\LoanPurposeValidator($this->app['validator'])); }); $this->app->bind('Fundbay\Deals\Repositories\AssetOptionRepositoryInterface', function() { return new Repositories\EloquentAssetOptionRepository(new Models\EloquentAssetOptionModel, new Validators\AssetOptionValidator($this->app['validator'])); }); $this->app->bind('Fundbay\Deals\Repositories\AssetImageRepositoryInterface', function() { return new Repositories\EloquentAssetImageRepository(new Models\EloquentAssetImageModel, new Validators\AssetImageValidator($this->app['validator'])); }); $this->app->bind('Fundbay\Deals\Repositories\OfferRepositoryInterface', function() { return new Repositories\EloquentOfferRepository(new Models\EloquentOfferModel, new Validators\OfferValidator($this->app['validator'])); }); $this->app->bind('Fundbay\Deals\Repositories\MessageRepositoryInterface', function() { return new Repositories\EloquentMessageRepository(new Models\EloquentMessageModel, new Validators\MessageValidator($this->app['validator'])); }); $this->app->bind('Fundbay\Deals\Repositories\EvidenceRequirementRepositoryInterface', function() { return new Repositories\EloquentEvidenceRequirementRepository(new Models\EloquentEvidenceRequirementModel, new Validators\EvidenceRequirementValidator($this->app['validator'])); }); $this->app->bind('Fundbay\Deals\Repositories\EvidenceRequiredRepositoryInterface', function() { return new Repositories\EloquentEvidenceRequiredRepository(new Models\EloquentEvidenceRequiredModel, new Validators\EvidenceRequiredValidator($this->app['validator'])); }); $this->app->bind('Fundbay\Deals\Repositories\EvidenceRequiredFileRepositoryInterface', function() { return new Repositories\EloquentEvidenceRequiredFileRepository(new Models\EloquentEvidenceRequiredFileModel, new Validators\EvidenceRequiredFileValidator($this->app['validator'])); }); $this->app->bind('Fundbay\Deals\Repositories\EvidenceRequestRepositoryInterface', function() { return new Repositories\EloquentEvidenceRequestRepository(new Models\EloquentEvidenceRequestModel, new Validators\EvidenceRequestValidator($this->app['validator'])); }); } /** * @return void */ protected function registerServices() { Services\OfferService::setMinimum($this->app['config']->get('deals.offers.minimum')); $this->app->bindShared('Fundbay\Deals\Services\ImageResizeService', function() { $storage = $this->app->make('Fundbay\Deals\Services\AssetImages\StorageInterface'); return new Services\ImageResizeService($storage, $this->app['image'], $this->app['config']['images.sizes']); }); $this->app->bindShared('Fundbay\Deals\Services\AssetImages\StorageInterface', function() { $driver = $this->app['config']['images.driver']; $method = 'getAssetImageStorageDriver' . ucfirst($driver); $config = $this->app['config']['images.drivers'][$driver]; return $this->{$method}($config); }); $this->app->bind('Fundbay\Deals\Services\EvidenceFileManager', function() { return new Services\EvidenceFileManager( $this->app->make('Fundbay\Deals\Repositories\EvidenceRequiredFileRepositoryInterface'), $this->app->make('Fundbay\Deals\Repositories\EvidenceRequirementRepositoryInterface'), $this->app['path.evidence-requirements'] ); }); } /** * @return void */ protected function registerFormBuilders() { $form = new Html\FormMacros($this->app); $this->app->booted(function() use ($form) { $form->setAssetOptionRepository($this->app->make('Fundbay\Deals\Repositories\AssetOptionRepositoryInterface')); $this->app['form']->macro('assetOptions', [$form, 'assetOptions']); }); } /** * @param array $config * @return \Fundbay\Deals\Services\AssetImages\FilesystemStorage */ protected function getAssetImageStorageDriverFiles(array $config) { $instance = new Services\AssetImages\FilesystemStorage($this->app['files']); foreach ($config['folders'] as $name => $data) { if ('~' === $data['dir'][0]) { $data['dir'] = $this->app['path.base'] . substr($data['dir'], 1); } if ('~' === $data['uri'][0]) { $data['uri'] = $this->app['config']['app.url'] . substr($data['uri'], 1); } $instance->addSize($name, $data['dir'], $data['uri']); } return $instance; } /** * Register commands. */ protected function registerCommands() { $this->app['commands.deals.digest'] = function() { return $this->app->make(Commands\LenderDigestCommand::class); }; $this->commands('commands.deals.digest'); } }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Class "Illuminate\Support\ServiceProvider" not found in /in/Psd22:5 Stack trace: #0 {main} thrown in /in/Psd22 on line 5
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Class 'Illuminate\Support\ServiceProvider' not found in /in/Psd22:5 Stack trace: #0 {main} thrown in /in/Psd22 on line 5
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
Fatal error: Class 'Illuminate\Support\ServiceProvider' not found in /in/Psd22 on line 5
Process exited with code 255.
Output for 5.4.0 - 5.4.45
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/Psd22 on line 205
Process exited with code 255.

preferences:
173.33 ms | 401 KiB | 299 Q